summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Zend/zend.c235
-rw-r--r--Zend/zend.h276
-rw-r--r--Zend/zend_API.c1722
-rw-r--r--Zend/zend_API.h202
-rw-r--r--Zend/zend_alloc.c5
-rw-r--r--Zend/zend_alloc.h15
-rw-r--r--Zend/zend_ast.c16
-rw-r--r--Zend/zend_ast.h2
-rw-r--r--Zend/zend_builtin_functions.c822
-rw-r--r--Zend/zend_closures.c157
-rw-r--r--Zend/zend_compile.c1398
-rw-r--r--Zend/zend_compile.h100
-rw-r--r--Zend/zend_constants.c230
-rw-r--r--Zend/zend_constants.h6
-rw-r--r--Zend/zend_exceptions.c237
-rw-r--r--Zend/zend_exceptions.h10
-rw-r--r--Zend/zend_execute.c1021
-rw-r--r--Zend/zend_execute.h179
-rw-r--r--Zend/zend_execute_API.c615
-rw-r--r--Zend/zend_gc.c187
-rw-r--r--Zend/zend_gc.h143
-rw-r--r--Zend/zend_generators.c171
-rw-r--r--Zend/zend_generators.h8
-rw-r--r--Zend/zend_globals.h38
-rw-r--r--Zend/zend_hash.c1701
-rw-r--r--Zend/zend_hash.h425
-rw-r--r--Zend/zend_highlight.c4
-rw-r--r--Zend/zend_indent.c2
-rw-r--r--Zend/zend_ini.c44
-rw-r--r--Zend/zend_ini.h6
-rw-r--r--Zend/zend_ini_parser.y30
-rw-r--r--Zend/zend_ini_scanner.c9324
-rw-r--r--Zend/zend_ini_scanner.l8
-rw-r--r--Zend/zend_ini_scanner_defs.h26
-rw-r--r--Zend/zend_interfaces.c131
-rw-r--r--Zend/zend_interfaces.h8
-rw-r--r--Zend/zend_iterators.c12
-rw-r--r--Zend/zend_iterators.h2
-rw-r--r--Zend/zend_language_parser.y24
-rw-r--r--Zend/zend_language_scanner.c813
-rw-r--r--Zend/zend_language_scanner.h2
-rw-r--r--Zend/zend_language_scanner.l117
-rw-r--r--Zend/zend_language_scanner_defs.h2
-rw-r--r--Zend/zend_list.c203
-rw-r--r--Zend/zend_list.h36
-rw-r--r--Zend/zend_modules.h2
-rw-r--r--Zend/zend_object_handlers.c995
-rw-r--r--Zend/zend_object_handlers.h32
-rw-r--r--Zend/zend_objects.c131
-rw-r--r--Zend/zend_objects.h11
-rw-r--r--Zend/zend_objects_API.c239
-rw-r--r--Zend/zend_objects_API.h79
-rw-r--r--Zend/zend_opcode.c35
-rw-r--r--Zend/zend_operators.c362
-rw-r--r--Zend/zend_operators.h95
-rw-r--r--Zend/zend_stack.c21
-rw-r--r--Zend/zend_stack.h1
-rw-r--r--Zend/zend_string.c248
-rw-r--r--Zend/zend_string.h233
-rw-r--r--Zend/zend_ts_hash.c106
-rw-r--r--Zend/zend_ts_hash.h60
-rw-r--r--Zend/zend_types.h419
-rw-r--r--Zend/zend_variables.c139
-rw-r--r--Zend/zend_variables.h26
-rw-r--r--Zend/zend_vm_def.h1927
-rw-r--r--Zend/zend_vm_execute.h13853
-rw-r--r--Zend/zend_vm_execute.skl2
-rw-r--r--Zend/zend_vm_gen.php86
-rw-r--r--ext/com_dotnet/com_extension.c6
-rw-r--r--ext/date/php_date.c779
-rw-r--r--ext/dom/php_dom.c8
-rw-r--r--ext/dom/php_dom.h2
-rw-r--r--ext/ereg/ereg.c111
-rw-r--r--ext/intl/breakiterator/breakiterator_class.cpp4
-rw-r--r--ext/intl/breakiterator/breakiterator_iterators.cpp2
-rw-r--r--ext/intl/calendar/calendar_class.cpp2
-rw-r--r--ext/intl/collator/collator_sort.c4
-rw-r--r--ext/intl/intl_error.c2
-rw-r--r--ext/mysql/php_mysql.c9
-rw-r--r--ext/mysqli/mysqli.c13
-rw-r--r--ext/mysqlnd/mysqlnd_plugin.c10
-rw-r--r--ext/mysqlnd/mysqlnd_reverse_api.c2
-rw-r--r--ext/mysqlnd/php_mysqlnd.c10
-rw-r--r--ext/opcache/Optimizer/compact_literals.c1
-rw-r--r--ext/opcache/Optimizer/zend_optimizer.c27
-rw-r--r--ext/opcache/ZendAccelerator.c170
-rw-r--r--ext/opcache/ZendAccelerator.h7
-rw-r--r--ext/opcache/zend_accelerator_util_funcs.c324
-rw-r--r--ext/opcache/zend_persist.c86
-rw-r--r--ext/opcache/zend_persist_calc.c38
-rw-r--r--ext/pcre/php_pcre.c258
-rw-r--r--ext/pcre/php_pcre.h8
-rw-r--r--ext/pdo/pdo.c2
-rw-r--r--ext/pdo/pdo_dbh.c9
-rw-r--r--ext/pdo/pdo_stmt.c9
-rw-r--r--ext/phar/dirstream.c10
-rw-r--r--ext/phar/func_interceptors.c24
-rw-r--r--ext/phar/phar.c28
-rw-r--r--ext/phar/phar_object.c10
-rw-r--r--ext/phar/stream.c6
-rw-r--r--ext/phar/util.c6
-rw-r--r--ext/phar/zip.c12
-rw-r--r--ext/reflection/php_reflection.c1144
-rw-r--r--ext/simplexml/sxe.c2
-rw-r--r--ext/snmp/snmp.c4
-rw-r--r--ext/soap/php_encoding.c7
-rw-r--r--ext/soap/soap.c3
-rw-r--r--ext/spl/php_spl.c24
-rw-r--r--ext/spl/spl_array.c46
-rw-r--r--ext/spl/spl_directory.c11
-rw-r--r--ext/spl/spl_functions.c2
-rw-r--r--ext/spl/spl_observer.c1
-rw-r--r--ext/standard/array.c326
-rw-r--r--ext/standard/base64.c6
-rw-r--r--ext/standard/browscap.c5
-rw-r--r--ext/standard/info.c8
-rw-r--r--ext/standard/url_scanner_ex.c1
-rw-r--r--ext/standard/url_scanner_ex.re1
-rw-r--r--ext/tidy/tidy.c2
-rw-r--r--ext/xsl/php_xsl.h2
-rw-r--r--main/SAPI.c46
-rw-r--r--main/SAPI.h2
-rw-r--r--main/fopen_wrappers.c15
-rw-r--r--main/main.c45
-rw-r--r--main/network.c6
-rw-r--r--main/output.c83
-rw-r--r--main/php_globals.h2
-rw-r--r--main/php_ini.c81
-rw-r--r--main/php_main.h2
-rw-r--r--main/php_output.h2
-rw-r--r--main/php_streams.h10
-rw-r--r--main/php_variables.c333
-rw-r--r--main/rfc1867.c32
-rw-r--r--main/streams/filter.c19
-rw-r--r--main/streams/memory.c31
-rw-r--r--main/streams/php_stream_context.h10
-rw-r--r--main/streams/php_stream_filter_api.h2
-rw-r--r--main/streams/streams.c167
-rw-r--r--main/streams/transports.c18
-rw-r--r--main/streams/userspace.c748
-rw-r--r--main/streams/xp_socket.c10
-rw-r--r--sapi/apache_hooks/php_apache.c2
-rw-r--r--sapi/cgi/cgi_main.c8
-rw-r--r--sapi/cli/php_cli.c11
-rw-r--r--sapi/fpm/fpm/fpm_main.c8
145 files changed, 21295 insertions, 23809 deletions
diff --git a/Zend/zend.c b/Zend/zend.c
index acbbcbebc7..b3e05f68ad 100644
--- a/Zend/zend.c
+++ b/Zend/zend.c
@@ -123,8 +123,6 @@ static HashTable *global_persistent_list = NULL;
ZEND_API zend_utility_values zend_uv;
-ZEND_API zval zval_used_for_init; /* True global variable */
-
/* version information */
static char *zend_version_info;
static uint zend_version_info_length;
@@ -133,11 +131,10 @@ static uint zend_version_info_length;
static void print_hash(zend_write_func_t write_func, HashTable *ht, int indent, zend_bool is_object TSRMLS_DC) /* {{{ */
{
- zval **tmp;
- char *string_key;
+ zval *tmp;
+ zend_string *string_key;
HashPosition iterator;
ulong num_key;
- uint str_len;
int i;
for (i = 0; i < indent; i++) {
@@ -146,17 +143,17 @@ static void print_hash(zend_write_func_t write_func, HashTable *ht, int indent,
ZEND_PUTS_EX("(\n");
indent += PRINT_ZVAL_INDENT;
zend_hash_internal_pointer_reset_ex(ht, &iterator);
- while (zend_hash_get_current_data_ex(ht, (void **) &tmp, &iterator) == SUCCESS) {
+ while ((tmp = zend_hash_get_current_data_ex(ht, &iterator)) != NULL) {
for (i = 0; i < indent; i++) {
ZEND_PUTS_EX(" ");
}
ZEND_PUTS_EX("[");
- switch (zend_hash_get_current_key_ex(ht, &string_key, &str_len, &num_key, 0, &iterator)) {
+ switch (zend_hash_get_current_key_ex(ht, &string_key, &num_key, 0, &iterator)) {
case HASH_KEY_IS_STRING:
if (is_object) {
const char *prop_name, *class_name;
int prop_len;
- int mangled = zend_unmangle_property_name_ex(string_key, str_len - 1, &class_name, &prop_name, &prop_len);
+ int mangled = zend_unmangle_property_name_ex(string_key->val, string_key->len, &class_name, &prop_name, &prop_len);
ZEND_WRITE_EX(prop_name, prop_len);
if (class_name && mangled == SUCCESS) {
@@ -169,7 +166,7 @@ static void print_hash(zend_write_func_t write_func, HashTable *ht, int indent,
}
}
} else {
- ZEND_WRITE_EX(string_key, str_len-1);
+ ZEND_WRITE_EX(string_key->val, string_key->len);
}
break;
case HASH_KEY_IS_LONG:
@@ -181,7 +178,7 @@ static void print_hash(zend_write_func_t write_func, HashTable *ht, int indent,
break;
}
ZEND_PUTS_EX("] => ");
- zend_print_zval_r_ex(write_func, *tmp, indent+PRINT_ZVAL_INDENT TSRMLS_CC);
+ zend_print_zval_r_ex(write_func, tmp, indent+PRINT_ZVAL_INDENT TSRMLS_CC);
ZEND_PUTS_EX("\n");
zend_hash_move_forward_ex(ht, &iterator);
}
@@ -195,29 +192,28 @@ static void print_hash(zend_write_func_t write_func, HashTable *ht, int indent,
static void print_flat_hash(HashTable *ht TSRMLS_DC) /* {{{ */
{
- zval **tmp;
- char *string_key;
+ zval *tmp;
+ zend_string *string_key;
HashPosition iterator;
ulong num_key;
- uint str_len;
int i = 0;
zend_hash_internal_pointer_reset_ex(ht, &iterator);
- while (zend_hash_get_current_data_ex(ht, (void **) &tmp, &iterator) == SUCCESS) {
+ while ((tmp = zend_hash_get_current_data_ex(ht, &iterator)) != NULL) {
if (i++ > 0) {
ZEND_PUTS(",");
}
ZEND_PUTS("[");
- switch (zend_hash_get_current_key_ex(ht, &string_key, &str_len, &num_key, 0, &iterator)) {
+ switch (zend_hash_get_current_key_ex(ht, &string_key, &num_key, 0, &iterator)) {
case HASH_KEY_IS_STRING:
- ZEND_PUTS(string_key);
+ ZEND_WRITE(string_key->val, string_key->len);
break;
case HASH_KEY_IS_LONG:
zend_printf("%ld", num_key);
break;
}
ZEND_PUTS("] => ");
- zend_print_flat_zval_r(*tmp TSRMLS_CC);
+ zend_print_flat_zval_r(tmp TSRMLS_CC);
zend_hash_move_forward_ex(ht, &iterator);
}
}
@@ -231,26 +227,28 @@ ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_cop
}
switch (Z_TYPE_P(expr)) {
case IS_NULL:
- Z_STRLEN_P(expr_copy) = 0;
- Z_STRVAL_P(expr_copy) = STR_EMPTY_ALLOC();
+ Z_STR_P(expr_copy) = STR_EMPTY_ALLOC();
break;
case IS_BOOL:
if (Z_LVAL_P(expr)) {
- Z_STRLEN_P(expr_copy) = 1;
- Z_STRVAL_P(expr_copy) = estrndup("1", 1);
+ // TODO: ??? use interned string
+ Z_STR_P(expr_copy) = STR_INIT("1", 1, 0);
} else {
- Z_STRLEN_P(expr_copy) = 0;
- Z_STRVAL_P(expr_copy) = STR_EMPTY_ALLOC();
+ Z_STR_P(expr_copy) = STR_EMPTY_ALLOC();
}
break;
- case IS_RESOURCE:
- Z_STRVAL_P(expr_copy) = (char *) emalloc(sizeof("Resource id #") - 1 + MAX_LENGTH_OF_LONG);
- Z_STRLEN_P(expr_copy) = snprintf(Z_STRVAL_P(expr_copy), sizeof("Resource id #") - 1 + MAX_LENGTH_OF_LONG, "Resource id #%ld", Z_LVAL_P(expr));
+ case IS_RESOURCE: {
+ char buf[sizeof("Resource id #") + MAX_LENGTH_OF_LONG];
+ int len;
+
+ len = snprintf(buf, sizeof(buf), "Resource id #%ld", Z_RES_HANDLE_P(expr));
+ Z_STR_P(expr_copy) = STR_INIT(buf, len, 0);
+ }
break;
case IS_ARRAY:
zend_error(E_NOTICE, "Array to string conversion");
- Z_STRLEN_P(expr_copy) = sizeof("Array") - 1;
- Z_STRVAL_P(expr_copy) = estrndup("Array", Z_STRLEN_P(expr_copy));
+ // TODO: ??? use interned string
+ Z_STR_P(expr_copy) = STR_INIT("Array", 1, 0);
break;
case IS_OBJECT:
{
@@ -260,12 +258,18 @@ ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_cop
break;
}
if (Z_OBJ_HANDLER_P(expr, cast_object)) {
- zval *val;
+ zval val;
- ALLOC_ZVAL(val);
- INIT_PZVAL_COPY(val, expr);
- zval_copy_ctor(val);
- if (Z_OBJ_HANDLER_P(expr, cast_object)(val, expr_copy, IS_STRING TSRMLS_CC) == SUCCESS) {
+//??? ALLOC_ZVAL(val);
+//??? INIT_PZVAL_COPY(val, expr);
+//??? zval_copy_ctor(val);
+ if (Z_ISREF_P(expr)) {
+ ZVAL_COPY_VALUE(&val, Z_REFVAL_P(expr));
+ } else {
+ ZVAL_COPY_VALUE(&val, expr);
+ }
+ zval_copy_ctor(&val);
+ if (Z_OBJ_HANDLER_P(expr, cast_object)(&val, expr_copy, IS_STRING TSRMLS_CC) == SUCCESS) {
zval_ptr_dtor(&val);
break;
}
@@ -278,28 +282,25 @@ ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_cop
if (Z_TYPE_P(z) != IS_OBJECT) {
zend_make_printable_zval(z, expr_copy, use_copy);
if (*use_copy) {
- zval_ptr_dtor(&z);
+ zval_ptr_dtor(z);
} else {
ZVAL_ZVAL(expr_copy, z, 0, 1);
*use_copy = 1;
}
return;
}
- zval_ptr_dtor(&z);
+ zval_ptr_dtor(z);
}
- zend_error(EG(exception) ? E_ERROR : E_RECOVERABLE_ERROR, "Object of class %s could not be converted to string", Z_OBJCE_P(expr)->name);
- Z_STRLEN_P(expr_copy) = 0;
- Z_STRVAL_P(expr_copy) = STR_EMPTY_ALLOC();
+ zend_error(EG(exception) ? E_ERROR : E_RECOVERABLE_ERROR, "Object of class %s could not be converted to string", Z_OBJCE_P(expr)->name->val);
+ Z_STR_P(expr_copy) = STR_EMPTY_ALLOC();
}
break;
case IS_DOUBLE:
- *expr_copy = *expr;
- zval_copy_ctor(expr_copy);
+ ZVAL_DUP(expr_copy, expr);
zend_locale_sprintf_double(expr_copy ZEND_FILE_LINE_CC);
break;
default:
- *expr_copy = *expr;
- zval_copy_ctor(expr_copy);
+ ZVAL_DUP(expr_copy, expr);
convert_to_string(expr_copy);
break;
}
@@ -354,14 +355,13 @@ ZEND_API void zend_print_flat_zval_r(zval *expr TSRMLS_DC) /* {{{ */
case IS_OBJECT:
{
HashTable *properties = NULL;
- const char *class_name = NULL;
- zend_uint clen;
+ zend_string *class_name = NULL;
if (Z_OBJ_HANDLER_P(expr, get_class_name)) {
- Z_OBJ_HANDLER_P(expr, get_class_name)(expr, &class_name, &clen, 0 TSRMLS_CC);
+ class_name = Z_OBJ_HANDLER_P(expr, get_class_name)(expr, 0 TSRMLS_CC);
}
if (class_name) {
- zend_printf("%s Object (", class_name);
+ zend_printf("%s Object (", class_name->val);
} else {
zend_printf("%s Object (", "Unknown Class");
}
@@ -412,15 +412,14 @@ ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int
case IS_OBJECT:
{
HashTable *properties;
- const char *class_name = NULL;
- zend_uint clen;
+ zend_string *class_name = NULL;
int is_temp;
if (Z_OBJ_HANDLER_P(expr, get_class_name)) {
- Z_OBJ_HANDLER_P(expr, get_class_name)(expr, &class_name, &clen, 0 TSRMLS_CC);
+ class_name = Z_OBJ_HANDLER_P(expr, get_class_name)(expr, 0 TSRMLS_CC);
}
if (class_name) {
- ZEND_PUTS_EX(class_name);
+ ZEND_PUTS_EX(class_name->val);
} else {
ZEND_PUTS_EX("Unknown Class");
}
@@ -621,16 +620,16 @@ static void php_scanner_globals_ctor(zend_php_scanner_globals *scanner_globals_p
void zend_init_opcodes_handlers(void);
-static zend_bool php_auto_globals_create_globals(const char *name, uint name_len TSRMLS_DC) /* {{{ */
+static zend_bool php_auto_globals_create_globals(zend_string *name TSRMLS_DC) /* {{{ */
{
- zval *globals;
-
- ALLOC_ZVAL(globals);
- Z_SET_REFCOUNT_P(globals, 1);
- Z_SET_ISREF_P(globals);
- Z_TYPE_P(globals) = IS_ARRAY;
- Z_ARRVAL_P(globals) = &EG(symbol_table);
- zend_hash_update(&EG(symbol_table), name, name_len + 1, &globals, sizeof(zval *), NULL);
+ zval globals;
+
+//??? ALLOC_ZVAL(globals);
+//??? Z_SET_REFCOUNT_P(globals, 1);
+//??? Z_SET_ISREF_P(globals);
+ ZVAL_ARR(&globals, &EG(symbol_table));
+ ZVAL_NEW_REF(&globals, &globals);
+ zend_hash_update(&EG(symbol_table).ht, name, &globals);
return 0;
}
/* }}} */
@@ -712,11 +711,6 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions TS
zend_hash_init_ex(&module_registry, 50, NULL, ZEND_MODULE_DTOR, 1, 0);
zend_init_rsrc_list_dtors();
- /* This zval can be used to initialize allocate zval's to an uninit'ed value */
- Z_UNSET_ISREF(zval_used_for_init);
- Z_SET_REFCOUNT(zval_used_for_init, 1);
- Z_TYPE(zval_used_for_init) = IS_NULL;
-
#ifdef ZTS
ts_allocate_id(&compiler_globals_id, sizeof(zend_compiler_globals), (ts_allocate_ctor) compiler_globals_ctor, (ts_allocate_dtor) compiler_globals_dtor);
ts_allocate_id(&executor_globals_id, sizeof(zend_executor_globals), (ts_allocate_ctor) executor_globals_ctor, (ts_allocate_dtor) executor_globals_dtor);
@@ -740,14 +734,14 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions TS
ini_scanner_globals_ctor(&ini_scanner_globals TSRMLS_CC);
php_scanner_globals_ctor(&language_scanner_globals TSRMLS_CC);
zend_set_default_compile_time_values(TSRMLS_C);
- EG(user_error_handler) = NULL;
- EG(user_exception_handler) = NULL;
+ ZVAL_UNDEF(&EG(user_error_handler));
+ ZVAL_UNDEF(&EG(user_exception_handler));
#endif
zend_interned_strings_init(TSRMLS_C);
zend_startup_builtin_functions(TSRMLS_C);
zend_register_standard_constants(TSRMLS_C);
- zend_register_auto_global("GLOBALS", sizeof("GLOBALS") - 1, 1, php_auto_globals_create_globals TSRMLS_CC);
+ zend_register_auto_global(STR_INIT("GLOBALS", sizeof("GLOBALS") - 1, 0), 1, php_auto_globals_create_globals TSRMLS_CC);
#ifndef ZTS
zend_init_rsrc_plist(TSRMLS_C);
@@ -1019,14 +1013,15 @@ ZEND_API int zend_get_configuration_directive(const char *name, uint name_length
ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
{
+ char *str;
+ int len;
va_list args;
va_list usr_copy;
- zval ***params;
- zval *retval;
- zval *z_error_type, *z_error_message, *z_error_filename, *z_error_lineno, *z_context;
+ zval params[5];
+ zval retval;
const char *error_filename;
uint error_lineno;
- zval *orig_user_error_handler;
+ zval orig_user_error_handler;
zend_bool in_compilation;
zend_class_entry *saved_class_entry;
zend_stack bp_stack;
@@ -1083,7 +1078,7 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
case E_USER_DEPRECATED:
case E_RECOVERABLE_ERROR:
if (zend_is_compiling(TSRMLS_C)) {
- error_filename = zend_get_compiled_filename(TSRMLS_C);
+ error_filename = zend_get_compiled_filename(TSRMLS_C)->val;
error_lineno = zend_get_compiled_lineno(TSRMLS_C);
} else if (zend_is_executing(TSRMLS_C)) {
error_filename = zend_get_executed_filename(TSRMLS_C);
@@ -1116,7 +1111,7 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
va_start(args, format);
/* if we don't have a user defined error handler */
- if (!EG(user_error_handler)
+ if (Z_TYPE(EG(user_error_handler)) == IS_UNDEF
|| !(EG(user_error_handler_error_reporting) & type)
|| EG(error_handling) != EH_NORMAL) {
zend_error_cb(type, error_filename, error_lineno, format, args);
@@ -1132,12 +1127,6 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
break;
default:
/* Handle the error in user space */
- ALLOC_INIT_ZVAL(z_error_message);
- ALLOC_INIT_ZVAL(z_error_type);
- ALLOC_INIT_ZVAL(z_error_filename);
- ALLOC_INIT_ZVAL(z_error_lineno);
- ALLOC_INIT_ZVAL(z_context);
-
/* va_copy() is __va_copy() in old gcc versions.
* According to the autoconf manual, using
* memcpy(&dst, &src, sizeof(va_list))
@@ -1150,21 +1139,22 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
# endif
#endif
va_copy(usr_copy, args);
- Z_STRLEN_P(z_error_message) = zend_vspprintf(&Z_STRVAL_P(z_error_message), 0, format, usr_copy);
+ len = zend_vspprintf(&str, 0, format, usr_copy);
+ ZVAL_STR(&params[1], STR_INIT(str, len, 0));
+ efree(str);
#ifdef va_copy
va_end(usr_copy);
#endif
- Z_TYPE_P(z_error_message) = IS_STRING;
- Z_LVAL_P(z_error_type) = type;
- Z_TYPE_P(z_error_type) = IS_LONG;
+ ZVAL_LONG(&params[0], type);
if (error_filename) {
- ZVAL_STRING(z_error_filename, error_filename, 1);
+ ZVAL_STRING(&params[2], error_filename);
+ } else {
+ ZVAL_NULL(&params[2]);
}
- Z_LVAL_P(z_error_lineno) = error_lineno;
- Z_TYPE_P(z_error_lineno) = IS_LONG;
+ ZVAL_LONG(&params[3], error_lineno);
if (!EG(active_symbol_table)) {
zend_rebuild_symbol_table(TSRMLS_C);
@@ -1172,22 +1162,14 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
/* during shutdown the symbol table table can be still null */
if (!EG(active_symbol_table)) {
- Z_TYPE_P(z_context) = IS_NULL;
+ ZVAL_NULL(&params[4]);
} else {
- Z_ARRVAL_P(z_context) = EG(active_symbol_table);
- Z_TYPE_P(z_context) = IS_ARRAY;
- zval_copy_ctor(z_context);
+//??? ZVAL_ARR(&params[4], EG(active_symbol_table));
+ zval_copy_ctor(&params[4]);
}
- params = (zval ***) emalloc(sizeof(zval **)*5);
- params[0] = &z_error_type;
- params[1] = &z_error_message;
- params[2] = &z_error_filename;
- params[3] = &z_error_lineno;
- params[4] = &z_context;
-
- orig_user_error_handler = EG(user_error_handler);
- EG(user_error_handler) = NULL;
+ ZVAL_COPY_VALUE(&orig_user_error_handler, &EG(user_error_handler));
+ ZVAL_UNDEF(&EG(user_error_handler));
/* User error handler may include() additinal PHP files.
* If an error was generated during comilation PHP will compile
@@ -1209,9 +1191,10 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
CG(in_compilation) = 0;
}
- if (call_user_function_ex(CG(function_table), NULL, orig_user_error_handler, &retval, 5, params, 1, NULL TSRMLS_CC) == SUCCESS) {
- if (retval) {
- if (Z_TYPE_P(retval) == IS_BOOL && Z_LVAL_P(retval) == 0) {
+ ZVAL_UNDEF(&retval);
+ if (call_user_function_ex(CG(function_table), NULL, &orig_user_error_handler, &retval, 5, params, 1, NULL TSRMLS_CC) == SUCCESS) {
+ if (Z_TYPE(retval) != IS_UNDEF) {
+ if (Z_TYPE(retval) == IS_BOOL && Z_LVAL(retval) == 0) {
zend_error_cb(type, error_filename, error_lineno, format, args);
}
zval_ptr_dtor(&retval);
@@ -1234,19 +1217,12 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
CG(in_compilation) = 1;
}
- if (!EG(user_error_handler)) {
- EG(user_error_handler) = orig_user_error_handler;
+ if (Z_TYPE(EG(user_error_handler)) == IS_UNDEF) {
+ ZVAL_COPY_VALUE(&EG(user_error_handler), &orig_user_error_handler);
}
else {
zval_ptr_dtor(&orig_user_error_handler);
}
-
- efree(params);
- zval_ptr_dtor(&z_error_message);
- zval_ptr_dtor(&z_error_type);
- zval_ptr_dtor(&z_error_filename);
- zval_ptr_dtor(&z_error_lineno);
- zval_ptr_dtor(&z_context);
break;
}
@@ -1295,13 +1271,13 @@ ZEND_API void zend_output_debug_string(zend_bool trigger_break, const char *form
}
/* }}} */
-ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval **retval, int file_count, ...) /* {{{ */
+ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval *retval, int file_count, ...) /* {{{ */
{
va_list files;
int i;
zend_file_handle *file_handle;
zend_op_array *orig_op_array = EG(active_op_array);
- zval **orig_retval_ptr_ptr = EG(return_value_ptr_ptr);
+//??? zval **orig_retval_ptr_ptr = EG(return_value_ptr_ptr);
long orig_interactive = CG(interactive);
va_start(files, file_count);
@@ -1321,31 +1297,30 @@ ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval **retval, int file_co
EG(active_op_array) = zend_compile_file(file_handle, type TSRMLS_CC);
if (file_handle->opened_path) {
- int dummy = 1;
- zend_hash_add(&EG(included_files), file_handle->opened_path, strlen(file_handle->opened_path) + 1, (void *)&dummy, sizeof(int), NULL);
+ zend_hash_str_add_empty_element(&EG(included_files), file_handle->opened_path, strlen(file_handle->opened_path));
}
zend_destroy_file_handle(file_handle TSRMLS_CC);
if (EG(active_op_array)) {
- EG(return_value_ptr_ptr) = retval ? retval : NULL;
+//??? EG(return_value_ptr_ptr) = retval ? retval : NULL;
zend_execute(EG(active_op_array) TSRMLS_CC);
zend_exception_restore(TSRMLS_C);
if (EG(exception)) {
- if (EG(user_exception_handler)) {
- zval *orig_user_exception_handler;
- zval **params[1], *retval2, *old_exception;
+ if (Z_TYPE(EG(user_exception_handler)) != IS_UNDEF) {
+ zval orig_user_exception_handler;
+ zval params[1], retval2;
+ zend_object *old_exception;
old_exception = EG(exception);
EG(exception) = NULL;
- params[0] = &old_exception;
- orig_user_exception_handler = EG(user_exception_handler);
- if (call_user_function_ex(CG(function_table), NULL, orig_user_exception_handler, &retval2, 1, params, 1, NULL TSRMLS_CC) == SUCCESS) {
- if (retval2 != NULL) {
- zval_ptr_dtor(&retval2);
- }
+ ZVAL_OBJ(&params[0], old_exception);
+ ZVAL_COPY_VALUE(&orig_user_exception_handler, &EG(user_exception_handler));
+ ZVAL_UNDEF(&retval2);
+ if (call_user_function_ex(CG(function_table), NULL, &orig_user_exception_handler, &retval2, 1, params, 1, NULL TSRMLS_CC) == SUCCESS) {
+ zval_ptr_dtor(&retval2);
if (EG(exception)) {
- zval_ptr_dtor(&EG(exception));
+//??? zval_ptr_dtor(&EG(exception));
EG(exception) = NULL;
}
- zval_ptr_dtor(&old_exception);
+//??? zval_ptr_dtor(&old_exception);
} else {
EG(exception) = old_exception;
zend_exception_error(EG(exception), E_ERROR TSRMLS_CC);
@@ -1359,14 +1334,14 @@ ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval **retval, int file_co
} else if (type==ZEND_REQUIRE) {
va_end(files);
EG(active_op_array) = orig_op_array;
- EG(return_value_ptr_ptr) = orig_retval_ptr_ptr;
+//??? EG(return_value_ptr_ptr) = orig_retval_ptr_ptr;
CG(interactive) = orig_interactive;
return FAILURE;
}
}
va_end(files);
EG(active_op_array) = orig_op_array;
- EG(return_value_ptr_ptr) = orig_retval_ptr_ptr;
+//??? EG(return_value_ptr_ptr) = orig_retval_ptr_ptr;
CG(interactive) = orig_interactive;
return SUCCESS;
@@ -1382,7 +1357,7 @@ ZEND_API char *zend_make_compiled_string_description(const char *name TSRMLS_DC)
char *compiled_string_description;
if (zend_is_compiling(TSRMLS_C)) {
- cur_filename = zend_get_compiled_filename(TSRMLS_C);
+ cur_filename = zend_get_compiled_filename(TSRMLS_C)->val;
cur_lineno = zend_get_compiled_lineno(TSRMLS_C);
} else if (zend_is_executing(TSRMLS_C)) {
cur_filename = zend_get_executed_filename(TSRMLS_C);
diff --git a/Zend/zend.h b/Zend/zend.h
index c8b57cd043..fe80471c9d 100644
--- a/Zend/zend.h
+++ b/Zend/zend.h
@@ -66,6 +66,7 @@
/* all HAVE_XXX test have to be after the include of zend_config above */
#include <stdio.h>
+#include <assert.h>
#ifdef HAVE_UNIX_H
# include <unix.h>
@@ -252,7 +253,6 @@ char *alloca ();
#include "zend_alloc.h"
#include "zend_types.h"
-#include "zend_string.h"
#ifdef HAVE_LIMITS_H
# include <limits.h>
@@ -284,11 +284,10 @@ typedef enum {
} ZEND_RESULT_CODE;
#include "zend_hash.h"
-#include "zend_ts_hash.h"
#include "zend_llist.h"
-#define INTERNAL_FUNCTION_PARAMETERS int ht, zval *return_value, zval **return_value_ptr, zval *this_ptr, int return_value_used TSRMLS_DC
-#define INTERNAL_FUNCTION_PARAM_PASSTHRU ht, return_value, return_value_ptr, this_ptr, return_value_used TSRMLS_CC
+#define INTERNAL_FUNCTION_PARAMETERS zend_uint param_count, zval *return_value, zval *this_ptr, int return_value_used TSRMLS_DC
+#define INTERNAL_FUNCTION_PARAM_PASSTHRU param_count, return_value, this_ptr, return_value_used TSRMLS_CC
#if defined(__GNUC__) && __GNUC__ >= 3 && !defined(__INTEL_COMPILER) && !defined(DARWIN) && !defined(__hpux) && !defined(_AIX) && !defined(__osf__)
void zend_error_noreturn(int type, const char *format, ...) __attribute__ ((noreturn));
@@ -296,75 +295,23 @@ void zend_error_noreturn(int type, const char *format, ...) __attribute__ ((nore
# define zend_error_noreturn zend_error
#endif
-/*
- * zval
- */
-typedef struct _zend_class_entry zend_class_entry;
-
-typedef struct _zend_guard {
- zend_bool in_get;
- zend_bool in_set;
- zend_bool in_unset;
- zend_bool in_isset;
- zend_bool dummy; /* sizeof(zend_guard) must not be equal to sizeof(void*) */
-} zend_guard;
-
-typedef struct _zend_object {
- zend_class_entry *ce;
- HashTable *properties;
- zval **properties_table;
- HashTable *guards; /* protects from __get/__set ... recursion */
-} zend_object;
-
#include "zend_object_handlers.h"
#include "zend_ast.h"
-typedef union _zvalue_value {
- long lval; /* long value */
- double dval; /* double value */
- struct {
- char *val;
- int len;
- } str;
- HashTable *ht; /* hash table value */
- zend_object_value obj;
- zend_ast *ast;
-} zvalue_value;
-
-struct _zval_struct {
- /* Variable information */
- zvalue_value value; /* value */
- zend_uint refcount__gc;
- zend_uchar type; /* active type */
- zend_uchar is_ref__gc;
-};
-
-#define Z_REFCOUNT_PP(ppz) Z_REFCOUNT_P(*(ppz))
-#define Z_SET_REFCOUNT_PP(ppz, rc) Z_SET_REFCOUNT_P(*(ppz), rc)
-#define Z_ADDREF_PP(ppz) Z_ADDREF_P(*(ppz))
-#define Z_DELREF_PP(ppz) Z_DELREF_P(*(ppz))
-#define Z_ISREF_PP(ppz) Z_ISREF_P(*(ppz))
-#define Z_SET_ISREF_PP(ppz) Z_SET_ISREF_P(*(ppz))
-#define Z_UNSET_ISREF_PP(ppz) Z_UNSET_ISREF_P(*(ppz))
-#define Z_SET_ISREF_TO_PP(ppz, isref) Z_SET_ISREF_TO_P(*(ppz), isref)
+/* overloaded elements data types */
+#define OE_IS_ARRAY (1<<0)
+#define OE_IS_OBJECT (1<<1)
+#define OE_IS_METHOD (1<<2)
-#define Z_REFCOUNT_P(pz) zval_refcount_p(pz)
+#define Z_REFCOUNT_P(pz) zval_refcount_p(pz)
#define Z_SET_REFCOUNT_P(pz, rc) zval_set_refcount_p(pz, rc)
-#define Z_ADDREF_P(pz) zval_addref_p(pz)
-#define Z_DELREF_P(pz) zval_delref_p(pz)
-#define Z_ISREF_P(pz) zval_isref_p(pz)
-#define Z_SET_ISREF_P(pz) zval_set_isref_p(pz)
-#define Z_UNSET_ISREF_P(pz) zval_unset_isref_p(pz)
-#define Z_SET_ISREF_TO_P(pz, isref) zval_set_isref_to_p(pz, isref)
-
-#define Z_REFCOUNT(z) Z_REFCOUNT_P(&(z))
+#define Z_ADDREF_P(pz) zval_addref_p(pz)
+#define Z_DELREF_P(pz) zval_delref_p(pz)
+
+#define Z_REFCOUNT(z) Z_REFCOUNT_P(&(z))
#define Z_SET_REFCOUNT(z, rc) Z_SET_REFCOUNT_P(&(z), rc)
-#define Z_ADDREF(z) Z_ADDREF_P(&(z))
-#define Z_DELREF(z) Z_DELREF_P(&(z))
-#define Z_ISREF(z) Z_ISREF_P(&(z))
-#define Z_SET_ISREF(z) Z_SET_ISREF_P(&(z))
-#define Z_UNSET_ISREF(z) Z_UNSET_ISREF_P(&(z))
-#define Z_SET_ISREF_TO(z, isref) Z_SET_ISREF_TO_P(&(z), isref)
+#define Z_ADDREF(z) Z_ADDREF_P(&(z))
+#define Z_DELREF(z) Z_DELREF_P(&(z))
#if ZEND_DEBUG
#define zend_always_inline inline
@@ -395,36 +342,26 @@ struct _zval_struct {
# define UNEXPECTED(condition) (condition)
#endif
+#include "zend_string.h"
+
static zend_always_inline zend_uint zval_refcount_p(zval* pz) {
- return pz->refcount__gc;
+ ZEND_ASSERT(Z_REFCOUNTED_P(pz));
+ return Z_COUNTED_P(pz)->refcount;
}
static zend_always_inline zend_uint zval_set_refcount_p(zval* pz, zend_uint rc) {
- return pz->refcount__gc = rc;
+ ZEND_ASSERT(Z_REFCOUNTED_P(pz));
+ return Z_COUNTED_P(pz)->refcount = rc;
}
static zend_always_inline zend_uint zval_addref_p(zval* pz) {
- return ++pz->refcount__gc;
+ ZEND_ASSERT(Z_REFCOUNTED_P(pz));
+ return ++Z_COUNTED_P(pz)->refcount;
}
static zend_always_inline zend_uint zval_delref_p(zval* pz) {
- return --pz->refcount__gc;
-}
-
-static zend_always_inline zend_bool zval_isref_p(zval* pz) {
- return pz->is_ref__gc;
-}
-
-static zend_always_inline zend_bool zval_set_isref_p(zval* pz) {
- return pz->is_ref__gc = 1;
-}
-
-static zend_always_inline zend_bool zval_unset_isref_p(zval* pz) {
- return pz->is_ref__gc = 0;
-}
-
-static zend_always_inline zend_bool zval_set_isref_to_p(zval* pz, zend_bool isref) {
- return pz->is_ref__gc = isref;
+ ZEND_ASSERT(Z_REFCOUNTED_P(pz));
+ return --Z_COUNTED_P(pz)->refcount;
}
/* excpt.h on Digital Unix 4.0 defines function_table */
@@ -442,20 +379,18 @@ typedef struct _zend_serialize_data zend_serialize_data;
typedef struct _zend_unserialize_data zend_unserialize_data;
struct _zend_trait_method_reference {
- const char* method_name;
- unsigned int mname_len;
-
+ zend_string *method_name;
zend_class_entry *ce;
-
- const char* class_name;
- unsigned int cname_len;
+ zend_string *class_name;
};
typedef struct _zend_trait_method_reference zend_trait_method_reference;
struct _zend_trait_precedence {
- zend_trait_method_reference *trait_method;
-
- zend_class_entry** exclude_from_classes;
+ zend_trait_method_reference *trait_method;
+ union {
+ zend_class_entry *ce;
+ zend_string *class_name;
+ } *exclude_from_classes;
};
typedef struct _zend_trait_precedence zend_trait_precedence;
@@ -465,8 +400,7 @@ struct _zend_trait_alias {
/**
* name for method to be added
*/
- const char* alias;
- unsigned int alias_len;
+ zend_string *alias;
/**
* modifiers to be set on trait method
@@ -477,17 +411,16 @@ typedef struct _zend_trait_alias zend_trait_alias;
struct _zend_class_entry {
char type;
- const char *name;
- zend_uint name_length;
+ zend_string *name;
struct _zend_class_entry *parent;
int refcount;
zend_uint ce_flags;
HashTable function_table;
HashTable properties_info;
- zval **default_properties_table;
- zval **default_static_members_table;
- zval **static_members_table;
+ zval *default_properties_table;
+ zval *default_static_members_table;
+ zval *static_members_table;
HashTable constants_table;
int default_properties_count;
int default_static_members_count;
@@ -508,14 +441,14 @@ struct _zend_class_entry {
zend_class_iterator_funcs iterator_funcs;
/* handlers */
- zend_object_value (*create_object)(zend_class_entry *class_type TSRMLS_DC);
+ zend_object* (*create_object)(zend_class_entry *class_type TSRMLS_DC);
zend_object_iterator *(*get_iterator)(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC);
int (*interface_gets_implemented)(zend_class_entry *iface, zend_class_entry *class_type TSRMLS_DC); /* a class implements this interface */
- union _zend_function *(*get_static_method)(zend_class_entry *ce, char* method, int method_len TSRMLS_DC);
+ union _zend_function *(*get_static_method)(zend_class_entry *ce, zend_string* method TSRMLS_DC);
/* serializer callbacks */
int (*serialize)(zval *object, unsigned char **buffer, zend_uint *buf_len, zend_serialize_data *data TSRMLS_DC);
- int (*unserialize)(zval **object, zend_class_entry *ce, const unsigned char *buf, zend_uint buf_len, zend_unserialize_data *data TSRMLS_DC);
+ int (*unserialize)(zval *object, zend_class_entry *ce, const unsigned char *buf, zend_uint buf_len, zend_unserialize_data *data TSRMLS_DC);
zend_class_entry **interfaces;
zend_uint num_interfaces;
@@ -527,11 +460,10 @@ struct _zend_class_entry {
union {
struct {
- const char *filename;
+ zend_string *filename;
zend_uint line_start;
zend_uint line_end;
- const char *doc_comment;
- zend_uint doc_comment_len;
+ zend_string *doc_comment;
} user;
struct {
const struct _zend_function_entry *builtin_functions;
@@ -577,36 +509,6 @@ typedef int (*zend_write_func_t)(const char *str, uint str_length);
#define ZEND_TRUTH(x) ((x) ? 1 : 0)
#define ZEND_LOG_XOR(a, b) (ZEND_TRUTH(a) ^ ZEND_TRUTH(b))
-/* data types */
-/* All data types <= IS_BOOL have their constructor/destructors skipped */
-#define IS_NULL 0
-#define IS_LONG 1
-#define IS_DOUBLE 2
-#define IS_BOOL 3
-#define IS_ARRAY 4
-#define IS_OBJECT 5
-#define IS_STRING 6
-#define IS_RESOURCE 7
-#define IS_CONSTANT 8
-#define IS_CONSTANT_ARRAY 9
-#define IS_CONSTANT_AST 10
-#define IS_CALLABLE 11
-
-/* Ugly hack to support constants as static array indices */
-#define IS_CONSTANT_TYPE_MASK 0x00f
-#define IS_CONSTANT_UNQUALIFIED 0x010
-#define IS_CONSTANT_INDEX 0x080
-#define IS_LEXICAL_VAR 0x020
-#define IS_LEXICAL_REF 0x040
-#define IS_CONSTANT_IN_NAMESPACE 0x100
-
-#define IS_CONSTANT_TYPE(type) (((type) & IS_CONSTANT_TYPE_MASK) >= IS_CONSTANT && ((type) & IS_CONSTANT_TYPE_MASK) <= IS_CONSTANT_AST)
-
-/* overloaded elements data types */
-#define OE_IS_ARRAY (1<<0)
-#define OE_IS_OBJECT (1<<1)
-#define OE_IS_METHOD (1<<2)
-
int zend_startup(zend_utility_functions *utility_functions, char **extensions TSRMLS_DC);
void zend_shutdown(TSRMLS_D);
void zend_register_standard_ini_entries(TSRMLS_D);
@@ -677,17 +579,8 @@ END_EXTERN_C()
/* FIXME: Check if we can save if (ptr) too */
-#define STR_FREE(ptr) if (ptr) { str_efree(ptr); }
-#define STR_FREE_REL(ptr) if (ptr) { str_efree_rel(ptr); }
-
-#ifndef ZTS
-#define STR_EMPTY_ALLOC() CG(interned_empty_string)? CG(interned_empty_string) : estrndup("", sizeof("")-1)
-#else
-#define STR_EMPTY_ALLOC() estrndup("", sizeof("")-1)
-#endif
-
-#define STR_REALLOC(ptr, size) \
- ptr = (char *) erealloc(ptr, size);
+//???#define STR_FREE(ptr) if (ptr) { str_efree(ptr); }
+//???#define STR_FREE_REL(ptr) if (ptr) { str_efree_rel(ptr); }
/* output support */
#define ZEND_WRITE(str, str_len) zend_write((str), (str_len))
@@ -749,28 +642,26 @@ END_EXTERN_C()
#define ZMSG_LOG_SCRIPT_NAME 6L
#define ZMSG_MEMORY_LEAKS_GRAND_TOTAL 7L
-#define INIT_PZVAL(z) \
- (z)->refcount__gc = 1; \
- (z)->is_ref__gc = 0;
-
-#define INIT_ZVAL(z) z = zval_used_for_init;
-
-#define ALLOC_INIT_ZVAL(zp) \
- ALLOC_ZVAL(zp); \
- INIT_ZVAL(*zp);
-
-#define MAKE_STD_ZVAL(zv) \
- ALLOC_ZVAL(zv); \
- INIT_PZVAL(zv);
-
-#define PZVAL_IS_REF(z) Z_ISREF_P(z)
-
#define ZVAL_COPY_VALUE(z, v) \
do { \
(z)->value = (v)->value; \
Z_TYPE_P(z) = Z_TYPE_P(v); \
} while (0)
+#define ZVAL_COPY(z, v) \
+ do { \
+ ZVAL_COPY_VALUE(z, v); \
+ if (Z_REFCOUNTED_P(z)) { \
+ Z_ADDREF_P(z); \
+ } \
+ } while (0)
+
+#define ZVAL_DUP(z, v) \
+ do { \
+ ZVAL_COPY_VALUE(z, v); \
+ zval_copy_ctor(z); \
+ } while (0)
+
#define INIT_PZVAL_COPY(z, v) \
do { \
ZVAL_COPY_VALUE(z, v); \
@@ -778,43 +669,39 @@ END_EXTERN_C()
Z_UNSET_ISREF_P(z); \
} while (0)
-#define SEPARATE_ZVAL(ppzv) \
- do { \
- if (Z_REFCOUNT_PP((ppzv)) > 1) { \
- zval *new_zv; \
- Z_DELREF_PP(ppzv); \
- ALLOC_ZVAL(new_zv); \
- INIT_PZVAL_COPY(new_zv, *(ppzv)); \
- *(ppzv) = new_zv; \
- zval_copy_ctor(new_zv); \
+// TODO: support objects and resources???
+#define SEPARATE_ZVAL(zv) do { \
+ if (Z_REFCOUNTED_P(zv)) { \
+ if (Z_REFCOUNT_P(zv) > 1) { \
+ Z_DELREF_P(zv); \
+ zval_copy_ctor(zv); \
+ Z_SET_REFCOUNT_P(zv, 1); \
+ } \
} \
} while (0)
-#define SEPARATE_ZVAL_IF_NOT_REF(ppzv) \
- if (!PZVAL_IS_REF(*ppzv)) { \
- SEPARATE_ZVAL(ppzv); \
+#define SEPARATE_ZVAL_IF_NOT_REF(zv) \
+ if (!Z_ISREF_P(zv)) { \
+ SEPARATE_ZVAL(zv); \
}
-#define SEPARATE_ZVAL_TO_MAKE_IS_REF(ppzv) \
- if (!PZVAL_IS_REF(*ppzv)) { \
- SEPARATE_ZVAL(ppzv); \
- Z_SET_ISREF_PP((ppzv)); \
+#define SEPARATE_ZVAL_TO_MAKE_IS_REF(zv) \
+ if (!Z_ISREF_P(zv)) { \
+ zval ref; \
+ ZVAL_COPY_VALUE(&ref, zv); \
+ SEPARATE_ZVAL(&ref); \
+ ZVAL_NEW_REF(zv, &ref); \
}
#define COPY_PZVAL_TO_ZVAL(zv, pzv) \
- (zv) = *(pzv); \
+ ZVAL_COPY_VALUE(&(zv), (pzv)); \
if (Z_REFCOUNT_P(pzv)>1) { \
zval_copy_ctor(&(zv)); \
Z_DELREF_P((pzv)); \
- } else { \
- FREE_ZVAL(pzv); \
} \
- INIT_PZVAL(&(zv));
-
-#define MAKE_COPY_ZVAL(ppzv, pzv) \
- INIT_PZVAL_COPY(pzv, *(ppzv)); \
- zval_copy_ctor((pzv));
+//??? INIT_PZVAL(&(zv));
+
#define REPLACE_ZVAL_VALUE(ppzv_dest, pzv_src, copy) { \
int is_ref, refcount; \
\
@@ -831,11 +718,8 @@ END_EXTERN_C()
}
#define SEPARATE_ARG_IF_REF(varptr) \
- if (PZVAL_IS_REF(varptr)) { \
- zval *original_var = varptr; \
- ALLOC_ZVAL(varptr); \
- INIT_PZVAL_COPY(varptr, original_var); \
- zval_copy_ctor(varptr); \
+ if (Z_ISREF_P(varptr)) { \
+ ZVAL_DUP(varptr, Z_REFVAL_P(varptr)); \
} else { \
Z_ADDREF_P(varptr); \
}
@@ -860,7 +744,7 @@ typedef enum {
typedef struct {
zend_error_handling_t handling;
zend_class_entry *exception;
- zval *user_handler;
+ zval user_handler;
} zend_error_handling;
ZEND_API void zend_save_error_handling(zend_error_handling *current TSRMLS_DC);
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index 553060e0a0..cc9275ead4 100644
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@ -44,14 +44,14 @@ static zend_class_entry **class_cleanup_handlers;
/* this function doesn't check for too many parameters */
ZEND_API int zend_get_parameters(int ht, int param_count, ...) /* {{{ */
{
- void **p;
+ zval *p;
int arg_count;
va_list ptr;
zval **param, *param_ptr;
TSRMLS_FETCH();
p = zend_vm_stack_top(TSRMLS_C) - 1;
- arg_count = (int)(zend_uintptr_t) *p;
+ arg_count = Z_LVAL_P(p);
if (param_count>arg_count) {
return FAILURE;
@@ -61,17 +61,13 @@ ZEND_API int zend_get_parameters(int ht, int param_count, ...) /* {{{ */
while (param_count-->0) {
param = va_arg(ptr, zval **);
- param_ptr = *(p-arg_count);
- if (!PZVAL_IS_REF(param_ptr) && Z_REFCOUNT_P(param_ptr) > 1) {
- zval *new_tmp;
-
- ALLOC_ZVAL(new_tmp);
- *new_tmp = *param_ptr;
- zval_copy_ctor(new_tmp);
- INIT_PZVAL(new_tmp);
- param_ptr = new_tmp;
- Z_DELREF_P((zval *) *(p-arg_count));
- *(p-arg_count) = param_ptr;
+ param_ptr = (p-arg_count);
+ if (!Z_ISREF_P(param_ptr) && Z_REFCOUNT_P(param_ptr) > 1) {
+ zval new_tmp;
+
+ ZVAL_DUP(&new_tmp, param_ptr);
+ Z_DELREF_P(param_ptr);
+ ZVAL_COPY_VALUE(param_ptr, &new_tmp);
}
*param = param_ptr;
arg_count--;
@@ -82,33 +78,31 @@ ZEND_API int zend_get_parameters(int ht, int param_count, ...) /* {{{ */
}
/* }}} */
-ZEND_API int _zend_get_parameters_array(int ht, int param_count, zval **argument_array TSRMLS_DC) /* {{{ */
+ZEND_API int _zend_get_parameters_array(int ht, int param_count, zval *argument_array TSRMLS_DC) /* {{{ */
{
- void **p;
+ zval *p;
int arg_count;
zval *param_ptr;
p = zend_vm_stack_top(TSRMLS_C) - 1;
- arg_count = (int)(zend_uintptr_t) *p;
+ arg_count = Z_LVAL_P(p);
if (param_count>arg_count) {
return FAILURE;
}
while (param_count-->0) {
- param_ptr = *(p-arg_count);
- if (!PZVAL_IS_REF(param_ptr) && Z_REFCOUNT_P(param_ptr) > 1) {
- zval *new_tmp;
-
- ALLOC_ZVAL(new_tmp);
- *new_tmp = *param_ptr;
- zval_copy_ctor(new_tmp);
- INIT_PZVAL(new_tmp);
- param_ptr = new_tmp;
- Z_DELREF_P((zval *) *(p-arg_count));
- *(p-arg_count) = param_ptr;
- }
- *(argument_array++) = param_ptr;
+ param_ptr = (p-arg_count);
+ if (!Z_ISREF_P(param_ptr) && Z_REFCOUNT_P(param_ptr) > 1) {
+ zval new_tmp;
+
+ ZVAL_DUP(&new_tmp, param_ptr);
+ Z_DELREF_P(param_ptr);
+ ZVAL_COPY_VALUE(argument_array, &new_tmp);
+ } else {
+ ZVAL_COPY_VALUE(argument_array, param_ptr);
+ }
+ argument_array++;
arg_count--;
}
@@ -120,14 +114,14 @@ ZEND_API int _zend_get_parameters_array(int ht, int param_count, zval **argument
/* this function doesn't check for too many parameters */
ZEND_API int zend_get_parameters_ex(int param_count, ...) /* {{{ */
{
- void **p;
+ zval *p;
int arg_count;
va_list ptr;
- zval ***param;
+ zval **param;
TSRMLS_FETCH();
p = zend_vm_stack_top(TSRMLS_C) - 1;
- arg_count = (int)(zend_uintptr_t) *p;
+ arg_count = Z_LVAL_P(p);
if (param_count>arg_count) {
return FAILURE;
@@ -135,8 +129,8 @@ ZEND_API int zend_get_parameters_ex(int param_count, ...) /* {{{ */
va_start(ptr, param_count);
while (param_count-->0) {
- param = va_arg(ptr, zval ***);
- *param = (zval **) p-(arg_count--);
+ param = va_arg(ptr, zval **);
+ *param = p-(arg_count--);
}
va_end(ptr);
@@ -144,22 +138,23 @@ ZEND_API int zend_get_parameters_ex(int param_count, ...) /* {{{ */
}
/* }}} */
-ZEND_API int _zend_get_parameters_array_ex(int param_count, zval ***argument_array TSRMLS_DC) /* {{{ */
+ZEND_API int _zend_get_parameters_array_ex(int param_count, zval *argument_array TSRMLS_DC) /* {{{ */
{
- void **p;
+ zval *p;
int arg_count;
p = zend_vm_stack_top(TSRMLS_C) - 1;
- arg_count = (int)(zend_uintptr_t) *p;
+ arg_count = Z_LVAL_P(p);
if (param_count>arg_count) {
return FAILURE;
}
while (param_count-->0) {
- zval **value = (zval**)(p-arg_count);
+ zval *value = (p-arg_count);
- *(argument_array++) = value;
+ ZVAL_COPY_VALUE(argument_array, value);
+ argument_array++;
arg_count--;
}
@@ -169,20 +164,20 @@ ZEND_API int _zend_get_parameters_array_ex(int param_count, zval ***argument_arr
ZEND_API int zend_copy_parameters_array(int param_count, zval *argument_array TSRMLS_DC) /* {{{ */
{
- void **p;
+ zval *p;
int arg_count;
p = zend_vm_stack_top(TSRMLS_C) - 1;
- arg_count = (int)(zend_uintptr_t) *p;
+ arg_count = Z_LVAL_P(p);
if (param_count>arg_count) {
return FAILURE;
}
while (param_count-->0) {
- zval **param = (zval **) p-(arg_count--);
- zval_add_ref(param);
- add_next_index_zval(argument_array, *param);
+ zval *param = p-(arg_count--);
+ Z_ADDREF_P(param);
+ add_next_index_zval(argument_array, param);
}
return SUCCESS;
@@ -244,65 +239,63 @@ ZEND_API zend_class_entry *zend_get_class_entry(const zval *zobject TSRMLS_DC) /
/* }}} */
/* returns 1 if you need to copy result, 0 if it's already a copy */
-ZEND_API int zend_get_object_classname(const zval *object, const char **class_name, zend_uint *class_name_len TSRMLS_DC) /* {{{ */
+ZEND_API zend_string *zend_get_object_classname(const zval *object TSRMLS_DC) /* {{{ */
{
- if (Z_OBJ_HT_P(object)->get_class_name == NULL ||
- Z_OBJ_HT_P(object)->get_class_name(object, class_name, class_name_len, 0 TSRMLS_CC) != SUCCESS) {
- zend_class_entry *ce = Z_OBJCE_P(object);
+ zend_string *ret;
- *class_name = ce->name;
- *class_name_len = ce->name_length;
- return 1;
+ if (Z_OBJ_HT_P(object)->get_class_name != NULL) {
+ ret = Z_OBJ_HT_P(object)->get_class_name(object, 0 TSRMLS_CC);
+ if (ret) {
+ return ret;
+ }
}
- return 0;
+ return Z_OBJCE_P(object)->name;
}
/* }}} */
-static int parse_arg_object_to_string(zval **arg, char **p, int *pl, int type TSRMLS_DC) /* {{{ */
+static int parse_arg_object_to_string(zval *arg, char **p, int *pl, int type TSRMLS_DC) /* {{{ */
{
- if (Z_OBJ_HANDLER_PP(arg, cast_object)) {
- zval *obj;
- MAKE_STD_ZVAL(obj);
- if (Z_OBJ_HANDLER_P(*arg, cast_object)(*arg, obj, type TSRMLS_CC) == SUCCESS) {
+ if (Z_OBJ_HANDLER_P(arg, cast_object)) {
+ zval obj;
+ if (Z_OBJ_HANDLER_P(arg, cast_object)(arg, &obj, type TSRMLS_CC) == SUCCESS) {
zval_ptr_dtor(arg);
- *arg = obj;
- *pl = Z_STRLEN_PP(arg);
- *p = Z_STRVAL_PP(arg);
+ ZVAL_COPY_VALUE(arg, &obj);
+ *pl = Z_STRLEN_P(arg);
+ *p = Z_STRVAL_P(arg);
return SUCCESS;
}
- efree(obj);
}
/* Standard PHP objects */
- if (Z_OBJ_HT_PP(arg) == &std_object_handlers || !Z_OBJ_HANDLER_PP(arg, cast_object)) {
+ if (Z_OBJ_HT_P(arg) == &std_object_handlers || !Z_OBJ_HANDLER_P(arg, cast_object)) {
SEPARATE_ZVAL_IF_NOT_REF(arg);
- if (zend_std_cast_object_tostring(*arg, *arg, type TSRMLS_CC) == SUCCESS) {
- *pl = Z_STRLEN_PP(arg);
- *p = Z_STRVAL_PP(arg);
+ if (zend_std_cast_object_tostring(arg, arg, type TSRMLS_CC) == SUCCESS) {
+ *pl = Z_STRLEN_P(arg);
+ *p = Z_STRVAL_P(arg);
return SUCCESS;
}
}
- if (!Z_OBJ_HANDLER_PP(arg, cast_object) && Z_OBJ_HANDLER_PP(arg, get)) {
+ if (!Z_OBJ_HANDLER_P(arg, cast_object) && Z_OBJ_HANDLER_P(arg, get)) {
int use_copy;
- zval *z = Z_OBJ_HANDLER_PP(arg, get)(*arg TSRMLS_CC);
+ zval *z = Z_OBJ_HANDLER_P(arg, get)(arg TSRMLS_CC);
Z_ADDREF_P(z);
if(Z_TYPE_P(z) != IS_OBJECT) {
- zval_dtor(*arg);
- Z_TYPE_P(*arg) = IS_NULL;
- zend_make_printable_zval(z, *arg, &use_copy);
+ zval_dtor(arg);
+ Z_TYPE_P(arg) = IS_NULL;
+ zend_make_printable_zval(z, arg, &use_copy);
if (!use_copy) {
- ZVAL_ZVAL(*arg, z, 1, 1);
+ ZVAL_ZVAL(arg, z, 1, 1);
}
- *pl = Z_STRLEN_PP(arg);
- *p = Z_STRVAL_PP(arg);
+ *pl = Z_STRLEN_P(arg);
+ *p = Z_STRVAL_P(arg);
return SUCCESS;
}
- zval_ptr_dtor(&z);
+ zval_ptr_dtor(z);
}
return FAILURE;
}
/* }}} */
-static const char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, const char **spec, char **error, int *severity TSRMLS_DC) /* {{{ */
+static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, const char **spec, char **error, int *severity TSRMLS_DC) /* {{{ */
{
const char *spec_walk = *spec;
char c = *spec_walk++;
@@ -328,16 +321,16 @@ static const char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, con
if (check_null) {
zend_bool *p = va_arg(*va, zend_bool *);
- *p = (Z_TYPE_PP(arg) == IS_NULL);
+ *p = (Z_TYPE_P(arg) == IS_NULL);
}
- switch (Z_TYPE_PP(arg)) {
+ switch (Z_TYPE_P(arg)) {
case IS_STRING:
{
double d;
int type;
- if ((type = is_numeric_string(Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), p, &d, -1)) == 0) {
+ if ((type = is_numeric_string(Z_STRVAL_P(arg), Z_STRLEN_P(arg), p, &d, -1)) == 0) {
return "long";
} else if (type == IS_DOUBLE) {
if (c == 'L') {
@@ -357,10 +350,10 @@ static const char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, con
case IS_DOUBLE:
if (c == 'L') {
- if (Z_DVAL_PP(arg) > LONG_MAX) {
+ if (Z_DVAL_P(arg) > LONG_MAX) {
*p = LONG_MAX;
break;
- } else if (Z_DVAL_PP(arg) < LONG_MIN) {
+ } else if (Z_DVAL_P(arg) < LONG_MIN) {
*p = LONG_MIN;
break;
}
@@ -369,7 +362,7 @@ static const char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, con
case IS_LONG:
case IS_BOOL:
convert_to_long_ex(arg);
- *p = Z_LVAL_PP(arg);
+ *p = Z_LVAL_P(arg);
break;
case IS_ARRAY:
@@ -387,16 +380,16 @@ static const char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, con
if (check_null) {
zend_bool *p = va_arg(*va, zend_bool *);
- *p = (Z_TYPE_PP(arg) == IS_NULL);
+ *p = (Z_TYPE_P(arg) == IS_NULL);
}
- switch (Z_TYPE_PP(arg)) {
+ switch (Z_TYPE_P(arg)) {
case IS_STRING:
{
long l;
int type;
- if ((type = is_numeric_string(Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), &l, p, -1)) == 0) {
+ if ((type = is_numeric_string(Z_STRVAL_P(arg), Z_STRLEN_P(arg), &l, p, -1)) == 0) {
return "double";
} else if (type == IS_LONG) {
*p = (double) l;
@@ -409,7 +402,7 @@ static const char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, con
case IS_DOUBLE:
case IS_BOOL:
convert_to_double_ex(arg);
- *p = Z_DVAL_PP(arg);
+ *p = Z_DVAL_P(arg);
break;
case IS_ARRAY:
@@ -426,7 +419,7 @@ static const char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, con
{
char **p = va_arg(*va, char **);
int *pl = va_arg(*va, int *);
- switch (Z_TYPE_PP(arg)) {
+ switch (Z_TYPE_P(arg)) {
case IS_NULL:
if (check_null) {
*p = NULL;
@@ -440,22 +433,22 @@ static const char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, con
case IS_DOUBLE:
case IS_BOOL:
convert_to_string_ex(arg);
- if (UNEXPECTED(Z_ISREF_PP(arg) != 0)) {
+ if (UNEXPECTED(Z_ISREF_P(arg) != 0)) {
/* it's dangerous to return pointers to string
buffer of referenced variable, because it can
be clobbered throug magic callbacks */
SEPARATE_ZVAL(arg);
}
- *p = Z_STRVAL_PP(arg);
- *pl = Z_STRLEN_PP(arg);
- if (c == 'p' && CHECK_ZVAL_NULL_PATH(*arg)) {
+ *p = Z_STRVAL_P(arg);
+ *pl = Z_STRLEN_P(arg);
+ if (c == 'p' && CHECK_ZVAL_NULL_PATH(arg)) {
return "a valid path";
}
break;
case IS_OBJECT:
if (parse_arg_object_to_string(arg, p, pl, IS_STRING TSRMLS_CC) == SUCCESS) {
- if (c == 'p' && CHECK_ZVAL_NULL_PATH(*arg)) {
+ if (c == 'p' && CHECK_ZVAL_NULL_PATH(arg)) {
return "a valid path";
}
break;
@@ -469,23 +462,65 @@ static const char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, con
}
break;
+ case 'S':
+ {
+ zend_string **str = va_arg(*va, zend_string **);
+ switch (Z_TYPE_P(arg)) {
+ case IS_NULL:
+ if (check_null) {
+ *str = NULL;
+ break;
+ }
+ /* break omitted intentionally */
+
+ case IS_STRING:
+ case IS_LONG:
+ case IS_DOUBLE:
+ case IS_BOOL:
+ convert_to_string_ex(arg);
+ if (UNEXPECTED(Z_ISREF_P(arg) != 0)) {
+ /* it's dangerous to return pointers to string
+ buffer of referenced variable, because it can
+ be clobbered throug magic callbacks */
+ SEPARATE_ZVAL(arg);
+ }
+ *str = Z_STR_P(arg);
+ break;
+
+ case IS_OBJECT: {
+ char *p;
+ int pl;
+
+ if (parse_arg_object_to_string(arg, &p, &pl, IS_STRING TSRMLS_CC) == SUCCESS) {
+ *str = STR_INIT(p, pl, 0);
+ break;
+ }
+ }
+ case IS_ARRAY:
+ case IS_RESOURCE:
+ default:
+ return "string";
+ }
+ }
+ break;
+
case 'b':
{
zend_bool *p = va_arg(*va, zend_bool *);
if (check_null) {
zend_bool *p = va_arg(*va, zend_bool *);
- *p = (Z_TYPE_PP(arg) == IS_NULL);
+ *p = (Z_TYPE_P(arg) == IS_NULL);
}
- switch (Z_TYPE_PP(arg)) {
+ switch (Z_TYPE_P(arg)) {
case IS_NULL:
case IS_STRING:
case IS_LONG:
case IS_DOUBLE:
case IS_BOOL:
convert_to_boolean_ex(arg);
- *p = Z_BVAL_PP(arg);
+ *p = Z_BVAL_P(arg);
break;
case IS_ARRAY:
@@ -500,12 +535,12 @@ static const char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, con
case 'r':
{
zval **p = va_arg(*va, zval **);
- if (check_null && Z_TYPE_PP(arg) == IS_NULL) {
+ if (check_null && Z_TYPE_P(arg) == IS_NULL) {
*p = NULL;
break;
}
- if (Z_TYPE_PP(arg) == IS_RESOURCE) {
- *p = *arg;
+ if (Z_TYPE_P(arg) == IS_RESOURCE) {
+ *p = arg;
} else {
return "resource";
}
@@ -515,12 +550,12 @@ static const char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, con
case 'a':
{
zval **p = va_arg(*va, zval **);
- if (check_null && Z_TYPE_PP(arg) == IS_NULL) {
+ if (check_null && Z_TYPE_P(arg) == IS_NULL) {
*p = NULL;
break;
}
- if (Z_TYPE_PP(arg) == IS_ARRAY || (c == 'A' && Z_TYPE_PP(arg) == IS_OBJECT)) {
- *p = *arg;
+ if (Z_TYPE_P(arg) == IS_ARRAY || (c == 'A' && Z_TYPE_P(arg) == IS_OBJECT)) {
+ *p = arg;
} else {
return "array";
}
@@ -530,14 +565,14 @@ static const char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, con
case 'h':
{
HashTable **p = va_arg(*va, HashTable **);
- if (check_null && Z_TYPE_PP(arg) == IS_NULL) {
+ if (check_null && Z_TYPE_P(arg) == IS_NULL) {
*p = NULL;
break;
}
- if (Z_TYPE_PP(arg) == IS_ARRAY) {
- *p = Z_ARRVAL_PP(arg);
- } else if(c == 'H' && Z_TYPE_PP(arg) == IS_OBJECT) {
- *p = HASH_OF(*arg);
+ if (Z_TYPE_P(arg) == IS_ARRAY) {
+ *p = Z_ARRVAL_P(arg);
+ } else if(c == 'H' && Z_TYPE_P(arg) == IS_OBJECT) {
+ *p = HASH_OF(arg);
if(*p == NULL) {
return "array";
}
@@ -550,12 +585,12 @@ static const char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, con
case 'o':
{
zval **p = va_arg(*va, zval **);
- if (check_null && Z_TYPE_PP(arg) == IS_NULL) {
+ if (check_null && Z_TYPE_P(arg) == IS_NULL) {
*p = NULL;
break;
}
- if (Z_TYPE_PP(arg) == IS_OBJECT) {
- *p = *arg;
+ if (Z_TYPE_P(arg) == IS_OBJECT) {
+ *p = arg;
} else {
return "object";
}
@@ -567,16 +602,16 @@ static const char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, con
zval **p = va_arg(*va, zval **);
zend_class_entry *ce = va_arg(*va, zend_class_entry *);
- if (check_null && Z_TYPE_PP(arg) == IS_NULL) {
+ if (check_null && Z_TYPE_P(arg) == IS_NULL) {
*p = NULL;
break;
}
- if (Z_TYPE_PP(arg) == IS_OBJECT &&
- (!ce || instanceof_function(Z_OBJCE_PP(arg), ce TSRMLS_CC))) {
- *p = *arg;
+ if (Z_TYPE_P(arg) == IS_OBJECT &&
+ (!ce || instanceof_function(Z_OBJCE_P(arg), ce TSRMLS_CC))) {
+ *p = arg;
} else {
if (ce) {
- return ce->name;
+ return ce->name->val;
} else {
return "object";
}
@@ -586,30 +621,30 @@ static const char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, con
case 'C':
{
- zend_class_entry **lookup, **pce = va_arg(*va, zend_class_entry **);
+ zend_class_entry *lookup, **pce = va_arg(*va, zend_class_entry **);
zend_class_entry *ce_base = *pce;
- if (check_null && Z_TYPE_PP(arg) == IS_NULL) {
+ if (check_null && Z_TYPE_P(arg) == IS_NULL) {
*pce = NULL;
break;
}
convert_to_string_ex(arg);
- if (zend_lookup_class(Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), &lookup TSRMLS_CC) == FAILURE) {
+ if ((lookup = zend_lookup_class(Z_STR_P(arg) TSRMLS_CC)) == NULL) {
*pce = NULL;
} else {
- *pce = *lookup;
+ *pce = lookup;
}
if (ce_base) {
if ((!*pce || !instanceof_function(*pce, ce_base TSRMLS_CC))) {
zend_spprintf(error, 0, "to be a class name derived from %s, '%s' given",
- ce_base->name, Z_STRVAL_PP(arg));
+ ce_base->name, Z_STRVAL_P(arg));
*pce = NULL;
return "";
}
}
if (!*pce) {
zend_spprintf(error, 0, "to be a valid class name, '%s' given",
- Z_STRVAL_PP(arg));
+ Z_STRVAL_P(arg));
return "";
}
break;
@@ -623,13 +658,13 @@ static const char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, con
zend_fcall_info_cache *fcc = va_arg(*va, zend_fcall_info_cache *);
char *is_callable_error = NULL;
- if (check_null && Z_TYPE_PP(arg) == IS_NULL) {
+ if (check_null && Z_TYPE_P(arg) == IS_NULL) {
fci->size = 0;
fcc->initialized = 0;
break;
}
- if (zend_fcall_info_init(*arg, 0, fci, fcc, NULL, &is_callable_error TSRMLS_CC) == SUCCESS) {
+ if (zend_fcall_info_init(arg, 0, fci, fcc, NULL, &is_callable_error TSRMLS_CC) == SUCCESS) {
if (is_callable_error) {
*severity = E_STRICT;
zend_spprintf(error, 0, "to be a valid callback, %s", is_callable_error);
@@ -653,18 +688,7 @@ static const char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, con
case 'z':
{
zval **p = va_arg(*va, zval **);
- if (check_null && Z_TYPE_PP(arg) == IS_NULL) {
- *p = NULL;
- } else {
- *p = *arg;
- }
- }
- break;
-
- case 'Z':
- {
- zval ***p = va_arg(*va, zval ***);
- if (check_null && Z_TYPE_PP(arg) == IS_NULL) {
+ if (check_null && Z_TYPE_P(arg) == IS_NULL) {
*p = NULL;
} else {
*p = arg;
@@ -672,6 +696,8 @@ static const char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, con
}
break;
+//???
+ case 'Z':
default:
return "unknown";
}
@@ -682,7 +708,7 @@ static const char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, con
}
/* }}} */
-static int zend_parse_arg(int arg_num, zval **arg, va_list *va, const char **spec, int quiet TSRMLS_DC) /* {{{ */
+static int zend_parse_arg(int arg_num, zval *arg, va_list *va, const char **spec, int quiet TSRMLS_DC) /* {{{ */
{
const char *expected_type = NULL;
char *error = NULL;
@@ -701,7 +727,7 @@ static int zend_parse_arg(int arg_num, zval **arg, va_list *va, const char **spe
} else {
zend_error(severity, "%s%s%s() expects parameter %d to be %s, %s given",
class_name, space, get_active_function_name(TSRMLS_C), arg_num, expected_type,
- zend_zval_type_name(*arg));
+ zend_zval_type_name(arg));
}
}
if (severity != E_STRICT) {
@@ -713,7 +739,7 @@ static int zend_parse_arg(int arg_num, zval **arg, va_list *va, const char **spe
}
/* }}} */
-ZEND_API int zend_parse_parameter(int flags, int arg_num TSRMLS_DC, zval **arg, const char *spec, ...)
+ZEND_API int zend_parse_parameter(int flags, int arg_num TSRMLS_DC, zval *arg, const char *spec, ...)
{
va_list va;
int ret;
@@ -733,11 +759,11 @@ static int zend_parse_va_args(int num_args, const char *type_spec, va_list *va,
int min_num_args = -1;
int max_num_args = 0;
int post_varargs = 0;
- zval **arg;
+ zval *arg;
int arg_count;
int quiet = flags & ZEND_PARSE_PARAMS_QUIET;
zend_bool have_varargs = 0;
- zval ****varargs = NULL;
+ zval ***varargs = NULL;
int *n_varargs = NULL;
for (spec_walk = type_spec; *spec_walk; spec_walk++) {
@@ -751,6 +777,7 @@ static int zend_parse_va_args(int num_args, const char *type_spec, va_list *va,
case 'C': case 'h':
case 'f': case 'A':
case 'H': case 'p':
+ case 'S':
max_num_args++;
break;
@@ -768,11 +795,11 @@ static int zend_parse_va_args(int num_args, const char *type_spec, va_list *va,
if (have_varargs) {
if (!quiet) {
zend_function *active_function = EG(current_execute_data)->function_state.function;
- const char *class_name = active_function->common.scope ? active_function->common.scope->name : "";
+ const char *class_name = active_function->common.scope ? active_function->common.scope->name->val : "";
zend_error(E_WARNING, "%s%s%s(): only one varargs specifier (* or +) is permitted",
class_name,
class_name[0] ? "::" : "",
- active_function->common.function_name);
+ active_function->common.function_name->val);
}
return FAILURE;
}
@@ -788,11 +815,11 @@ static int zend_parse_va_args(int num_args, const char *type_spec, va_list *va,
default:
if (!quiet) {
zend_function *active_function = EG(current_execute_data)->function_state.function;
- const char *class_name = active_function->common.scope ? active_function->common.scope->name : "";
+ const char *class_name = active_function->common.scope ? active_function->common.scope->name->val : "";
zend_error(E_WARNING, "%s%s%s(): bad type specifier while parsing parameters",
class_name,
class_name[0] ? "::" : "",
- active_function->common.function_name);
+ active_function->common.function_name->val);
}
return FAILURE;
}
@@ -811,11 +838,11 @@ static int zend_parse_va_args(int num_args, const char *type_spec, va_list *va,
if (num_args < min_num_args || (num_args > max_num_args && max_num_args > 0)) {
if (!quiet) {
zend_function *active_function = EG(current_execute_data)->function_state.function;
- const char *class_name = active_function->common.scope ? active_function->common.scope->name : "";
+ const char *class_name = active_function->common.scope ? active_function->common.scope->name->val : "";
zend_error(E_WARNING, "%s%s%s() expects %s %d parameter%s, %d given",
class_name,
class_name[0] ? "::" : "",
- active_function->common.function_name,
+ active_function->common.function_name->val,
min_num_args == max_num_args ? "exactly" : num_args < min_num_args ? "at least" : "at most",
num_args < min_num_args ? min_num_args : max_num_args,
(num_args < min_num_args ? min_num_args : max_num_args) == 1 ? "" : "s",
@@ -824,7 +851,7 @@ static int zend_parse_va_args(int num_args, const char *type_spec, va_list *va,
return FAILURE;
}
- arg_count = (int)(zend_uintptr_t) *(zend_vm_stack_top(TSRMLS_C) - 1);
+ arg_count = Z_LVAL_P(zend_vm_stack_top(TSRMLS_C) - 1);
if (num_args > arg_count) {
zend_error(E_WARNING, "%s(): could not obtain parameters for parsing",
@@ -842,18 +869,18 @@ static int zend_parse_va_args(int num_args, const char *type_spec, va_list *va,
int num_varargs = num_args + 1 - post_varargs;
/* eat up the passed in storage even if it won't be filled in with varargs */
- varargs = va_arg(*va, zval ****);
+ varargs = va_arg(*va, zval ***);
n_varargs = va_arg(*va, int *);
type_spec++;
if (num_varargs > 0) {
int iv = 0;
- zval **p = (zval **) (zend_vm_stack_top(TSRMLS_C) - 1 - (arg_count - i));
+ zval *p = (zend_vm_stack_top(TSRMLS_C) - 1 - (arg_count - i));
*n_varargs = num_varargs;
/* allocate space for array and store args */
- *varargs = safe_emalloc(num_varargs, sizeof(zval **), 0);
+ *varargs = safe_emalloc(num_varargs, sizeof(zval *), 0);
while (num_varargs-- > 0) {
(*varargs)[iv++] = p++;
}
@@ -868,7 +895,7 @@ static int zend_parse_va_args(int num_args, const char *type_spec, va_list *va,
}
}
- arg = (zval **) (zend_vm_stack_top(TSRMLS_C) - 1 - (arg_count-i));
+ arg = zend_vm_stack_top(TSRMLS_C) - 1 - (arg_count-i);
if (zend_parse_arg(i+1, arg, va, &type_spec, quiet TSRMLS_CC) == FAILURE) {
/* clean up varargs array if it was used */
@@ -954,7 +981,7 @@ ZEND_API int zend_parse_method_parameters(int num_args TSRMLS_DC, zval *this_ptr
if (ce && !instanceof_function(Z_OBJCE_P(this_ptr), ce TSRMLS_CC)) {
zend_error(E_CORE_ERROR, "%s::%s() must be derived from %s::%s",
- ce->name, get_active_function_name(TSRMLS_C), Z_OBJCE_P(this_ptr)->name, get_active_function_name(TSRMLS_C));
+ ce->name->val, get_active_function_name(TSRMLS_C), Z_OBJCE_P(this_ptr)->name->val, get_active_function_name(TSRMLS_C));
}
retval = zend_parse_va_args(num_args, p, &va, 0 TSRMLS_CC);
@@ -992,7 +1019,7 @@ ZEND_API int zend_parse_method_parameters_ex(int flags, int num_args TSRMLS_DC,
if (ce && !instanceof_function(Z_OBJCE_P(this_ptr), ce TSRMLS_CC)) {
if (!quiet) {
zend_error(E_CORE_ERROR, "%s::%s() must be derived from %s::%s",
- ce->name, get_active_function_name(TSRMLS_C), Z_OBJCE_P(this_ptr)->name, get_active_function_name(TSRMLS_C));
+ ce->name->val, get_active_function_name(TSRMLS_C), Z_OBJCE_P(this_ptr)->name->val, get_active_function_name(TSRMLS_C));
}
va_end(va);
return FAILURE;
@@ -1008,25 +1035,22 @@ ZEND_API int zend_parse_method_parameters_ex(int flags, int num_args TSRMLS_DC,
/* Argument parsing API -- andrei */
ZEND_API int _array_init(zval *arg, uint size ZEND_FILE_LINE_DC) /* {{{ */
{
- ALLOC_HASHTABLE_REL(Z_ARRVAL_P(arg));
-
+ ZVAL_NEW_ARR(arg);
_zend_hash_init(Z_ARRVAL_P(arg), size, ZVAL_PTR_DTOR, 0 ZEND_FILE_LINE_RELAY_CC);
- Z_TYPE_P(arg) = IS_ARRAY;
return SUCCESS;
}
/* }}} */
-static int zend_merge_property(zval **value TSRMLS_DC, int num_args, va_list args, const zend_hash_key *hash_key) /* {{{ */
+static int zend_merge_property(zval *value TSRMLS_DC, int num_args, va_list args, const zend_hash_key *hash_key) /* {{{ */
{
/* which name should a numeric property have ? */
- if (hash_key->nKeyLength) {
+ if (hash_key->key) {
zval *obj = va_arg(args, zval *);
zend_object_handlers *obj_ht = va_arg(args, zend_object_handlers *);
- zval *member;
+ zval member;
- MAKE_STD_ZVAL(member);
- ZVAL_STRINGL(member, hash_key->arKey, hash_key->nKeyLength-1, 1);
- obj_ht->write_property(obj, member, *value, 0 TSRMLS_CC);
+ ZVAL_STR(&member, STR_DUP(hash_key->key, 0));
+ obj_ht->write_property(obj, &member, value, 0 TSRMLS_CC);
zval_ptr_dtor(&member);
}
return ZEND_HASH_APPLY_KEEP;
@@ -1051,9 +1075,9 @@ ZEND_API void zend_merge_properties(zval *obj, HashTable *properties, int destro
}
/* }}} */
-static int zval_update_class_constant(zval **pp, int is_static, int offset TSRMLS_DC) /* {{{ */
+static int zval_update_class_constant(zval *pp, int is_static, int offset TSRMLS_DC) /* {{{ */
{
- if (IS_CONSTANT_TYPE(Z_TYPE_PP(pp))) {
+ if (IS_CONSTANT_TYPE(Z_TYPE_P(pp))) {
zend_class_entry **scope = EG(in_execution)?&EG(scope):&CG(active_class_entry);
if ((*scope)->parent) {
@@ -1063,7 +1087,7 @@ static int zval_update_class_constant(zval **pp, int is_static, int offset TSRML
do {
for (zend_hash_internal_pointer_reset_ex(&ce->properties_info, &pos);
- zend_hash_get_current_data_ex(&ce->properties_info, (void **) &prop_info, &pos) == SUCCESS;
+ (prop_info = zend_hash_get_current_data_ptr_ex(&ce->properties_info, &pos)) != NULL;
zend_hash_move_forward_ex(&ce->properties_info, &pos)) {
if (is_static == ((prop_info->flags & ZEND_ACC_STATIC) != 0) &&
offset == prop_info->offset) {
@@ -1096,13 +1120,13 @@ ZEND_API void zend_update_class_constants(zend_class_entry *class_type TSRMLS_DC
zend_hash_apply_with_argument(&class_type->constants_table, (apply_func_arg_t) zval_update_constant, (void*)1 TSRMLS_CC);
for (i = 0; i < class_type->default_properties_count; i++) {
- if (class_type->default_properties_table[i]) {
+ if (Z_TYPE(class_type->default_properties_table[i]) != IS_UNDEF) {
zval_update_class_constant(&class_type->default_properties_table[i], 0, i TSRMLS_CC);
}
}
if (!CE_STATIC_MEMBERS(class_type) && class_type->default_static_members_count) {
- zval **p;
+ zval *p;
if (class_type->parent) {
zend_update_class_constants(class_type->parent TSRMLS_CC);
@@ -1114,25 +1138,19 @@ ZEND_API void zend_update_class_constants(zend_class_entry *class_type TSRMLS_DC
#endif
for (i = 0; i < class_type->default_static_members_count; i++) {
p = &class_type->default_static_members_table[i];
- if (Z_ISREF_PP(p) &&
+ if (Z_ISREF_P(p) &&
class_type->parent &&
i < class_type->parent->default_static_members_count &&
- *p == class_type->parent->default_static_members_table[i] &&
- CE_STATIC_MEMBERS(class_type->parent)[i]
+ p == &class_type->parent->default_static_members_table[i] &&
+ Z_TYPE(CE_STATIC_MEMBERS(class_type->parent)[i]) != IS_UNDEF
) {
- zval *q = CE_STATIC_MEMBERS(class_type->parent)[i];
+ zval *q = &CE_STATIC_MEMBERS(class_type->parent)[i];
+ ZVAL_NEW_REF(q, q);
+ ZVAL_COPY_VALUE(&CE_STATIC_MEMBERS(class_type)[i], q);
Z_ADDREF_P(q);
- Z_SET_ISREF_P(q);
- CE_STATIC_MEMBERS(class_type)[i] = q;
} else {
- zval *r;
-
- ALLOC_ZVAL(r);
- *r = **p;
- INIT_PZVAL(r);
- zval_copy_ctor(r);
- CE_STATIC_MEMBERS(class_type)[i] = r;
+ ZVAL_DUP(&CE_STATIC_MEMBERS(class_type)[i], p);
}
}
}
@@ -1152,15 +1170,15 @@ ZEND_API void object_properties_init(zend_object *object, zend_class_entry *clas
int i;
if (class_type->default_properties_count) {
- object->properties_table = emalloc(sizeof(zval*) * class_type->default_properties_count);
+//??? object->properties_table = emalloc(sizeof(zval*) * class_type->default_properties_count);
for (i = 0; i < class_type->default_properties_count; i++) {
- object->properties_table[i] = class_type->default_properties_table[i];
- if (class_type->default_properties_table[i]) {
+ ZVAL_COPY_VALUE(&object->properties_table[i], &class_type->default_properties_table[i]);
+ if (Z_REFCOUNTED(class_type->default_properties_table[i])) {
#if ZTS
ALLOC_ZVAL( object->properties_table[i]);
MAKE_COPY_ZVAL(&class_type->default_properties_table[i], object->properties_table[i]);
#else
- Z_ADDREF_P(object->properties_table[i]);
+ Z_ADDREF(object->properties_table[i]);
#endif
}
}
@@ -1175,28 +1193,25 @@ ZEND_API void object_properties_init(zend_object *object, zend_class_entry *clas
* calling zend_merge_properties(). */
ZEND_API int _object_and_properties_init(zval *arg, zend_class_entry *class_type, HashTable *properties ZEND_FILE_LINE_DC TSRMLS_DC) /* {{{ */
{
- zend_object *object;
-
if (class_type->ce_flags & (ZEND_ACC_INTERFACE|ZEND_ACC_IMPLICIT_ABSTRACT_CLASS|ZEND_ACC_EXPLICIT_ABSTRACT_CLASS)) {
char *what = (class_type->ce_flags & ZEND_ACC_INTERFACE) ? "interface"
:((class_type->ce_flags & ZEND_ACC_TRAIT) == ZEND_ACC_TRAIT) ? "trait"
: "abstract class";
- zend_error(E_ERROR, "Cannot instantiate %s %s", what, class_type->name);
+ zend_error(E_ERROR, "Cannot instantiate %s %s", what, class_type->name->val);
}
zend_update_class_constants(class_type TSRMLS_CC);
- Z_TYPE_P(arg) = IS_OBJECT;
if (class_type->create_object == NULL) {
- Z_OBJVAL_P(arg) = zend_objects_new(&object, class_type TSRMLS_CC);
+ ZVAL_OBJ(arg, zend_objects_new(class_type TSRMLS_CC));
if (properties) {
- object->properties = properties;
- object->properties_table = NULL;
+ Z_OBJ_P(arg)->properties = properties;
+//??? Z_OBJ_P(arg)->properties_table = NULL;
} else {
- object_properties_init(object, class_type);
+ object_properties_init(Z_OBJ_P(arg), class_type);
}
} else {
- Z_OBJVAL_P(arg) = class_type->create_object(class_type TSRMLS_CC);
+ ZVAL_OBJ(arg, class_type->create_object(class_type TSRMLS_CC));
}
return SUCCESS;
}
@@ -1223,365 +1238,361 @@ ZEND_API int add_assoc_function(zval *arg, const char *key, void (*function_ptr)
ZEND_API int add_assoc_long_ex(zval *arg, const char *key, uint key_len, long n) /* {{{ */
{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_LONG(tmp, n);
-
- return zend_symtable_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL);
+ zval *ret, tmp;
+
+ ZVAL_LONG(&tmp, n);
+ ret = zend_symtable_str_update(Z_ARRVAL_P(arg), key, key_len, &tmp);
+ return ret ? SUCCESS : FAILURE;
}
/* }}} */
ZEND_API int add_assoc_null_ex(zval *arg, const char *key, uint key_len) /* {{{ */
{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_NULL(tmp);
-
- return zend_symtable_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL);
+ zval *ret, tmp;
+
+ ZVAL_NULL(&tmp);
+ ret = zend_symtable_str_update(Z_ARRVAL_P(arg), key, key_len, &tmp);
+ return ret ? SUCCESS : FAILURE;
}
/* }}} */
ZEND_API int add_assoc_bool_ex(zval *arg, const char *key, uint key_len, int b) /* {{{ */
{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_BOOL(tmp, b);
-
- return zend_symtable_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL);
+ zval *ret, tmp;
+
+ ZVAL_BOOL(&tmp, b);
+ ret = zend_symtable_str_update(Z_ARRVAL_P(arg), key, key_len, &tmp);
+ return ret ? SUCCESS : FAILURE;
}
/* }}} */
-ZEND_API int add_assoc_resource_ex(zval *arg, const char *key, uint key_len, int r) /* {{{ */
+ZEND_API int add_assoc_resource_ex(zval *arg, const char *key, uint key_len, zend_resource *r) /* {{{ */
{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_RESOURCE(tmp, r);
-
- return zend_symtable_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL);
+ zval *ret, tmp;
+
+ ZVAL_RES(&tmp, r);
+ ret = zend_symtable_str_update(Z_ARRVAL_P(arg), key, key_len, &tmp);
+ return ret ? SUCCESS : FAILURE;
}
/* }}} */
ZEND_API int add_assoc_double_ex(zval *arg, const char *key, uint key_len, double d) /* {{{ */
{
- zval *tmp;
+ zval *ret, tmp;
+
+ ZVAL_DOUBLE(&tmp, d);
+ ret = zend_symtable_str_update(Z_ARRVAL_P(arg), key, key_len, &tmp);
+ return ret ? SUCCESS : FAILURE;
+}
+/* }}} */
- MAKE_STD_ZVAL(tmp);
- ZVAL_DOUBLE(tmp, d);
+ZEND_API int add_assoc_str_ex(zval *arg, const char *key, uint key_len, zend_string *str) /* {{{ */
+{
+ zval *ret, tmp;
- return zend_symtable_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL);
+ ZVAL_STR(&tmp, str);
+ STR_ADDREF(str);
+ ret = zend_symtable_str_update(Z_ARRVAL_P(arg), key, key_len, &tmp);
+ return ret ? SUCCESS : FAILURE;
}
/* }}} */
ZEND_API int add_assoc_string_ex(zval *arg, const char *key, uint key_len, char *str, int duplicate) /* {{{ */
{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_STRING(tmp, str, duplicate);
-
- return zend_symtable_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL);
+ zval *ret, tmp;
+
+//??? ZVAL_STRING(tmp, str, duplicate);
+ ZVAL_STRING(&tmp, str);
+ ret = zend_symtable_str_update(Z_ARRVAL_P(arg), key, key_len, &tmp);
+ return ret ? SUCCESS : FAILURE;
}
/* }}} */
ZEND_API int add_assoc_stringl_ex(zval *arg, const char *key, uint key_len, char *str, uint length, int duplicate) /* {{{ */
{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_STRINGL(tmp, str, length, duplicate);
-
- return zend_symtable_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL);
+ zval *ret, tmp;
+
+//??? ZVAL_STRINGL(tmp, str, length, duplicate);
+ ZVAL_STRINGL(&tmp, str, length);
+ ret = zend_symtable_str_update(Z_ARRVAL_P(arg), key, key_len, &tmp);
+ return ret ? SUCCESS : FAILURE;
}
/* }}} */
ZEND_API int add_assoc_zval_ex(zval *arg, const char *key, uint key_len, zval *value) /* {{{ */
{
- return zend_symtable_update(Z_ARRVAL_P(arg), key, key_len, (void *) &value, sizeof(zval *), NULL);
+ zval *ret;
+
+ ret = zend_symtable_str_update(Z_ARRVAL_P(arg), key, key_len, value);
+ return ret ? SUCCESS : FAILURE;
}
/* }}} */
ZEND_API int add_index_long(zval *arg, ulong index, long n) /* {{{ */
{
- zval *tmp;
+ zval tmp;
- MAKE_STD_ZVAL(tmp);
- ZVAL_LONG(tmp, n);
-
- return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), NULL);
+ ZVAL_LONG(&tmp, n);
+ return zend_hash_index_update(Z_ARRVAL_P(arg), index, &tmp) ? SUCCESS : FAILURE;
}
/* }}} */
ZEND_API int add_index_null(zval *arg, ulong index) /* {{{ */
{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_NULL(tmp);
+ zval tmp;
- return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), NULL);
+ ZVAL_NULL(&tmp);
+ return zend_hash_index_update(Z_ARRVAL_P(arg), index, &tmp) ? SUCCESS : FAILURE;
}
/* }}} */
ZEND_API int add_index_bool(zval *arg, ulong index, int b) /* {{{ */
{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_BOOL(tmp, b);
+ zval tmp;
- return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), NULL);
+ ZVAL_BOOL(&tmp, b);
+ return zend_hash_index_update(Z_ARRVAL_P(arg), index, &tmp) ? SUCCESS : FAILURE;
}
/* }}} */
-ZEND_API int add_index_resource(zval *arg, ulong index, int r) /* {{{ */
+ZEND_API int add_index_resource(zval *arg, ulong index, zend_resource *r) /* {{{ */
{
- zval *tmp;
+ zval tmp;
- MAKE_STD_ZVAL(tmp);
- ZVAL_RESOURCE(tmp, r);
-
- return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), NULL);
+ ZVAL_RES(&tmp, r);
+ return zend_hash_index_update(Z_ARRVAL_P(arg), index, &tmp) ? SUCCESS : FAILURE;
}
/* }}} */
ZEND_API int add_index_double(zval *arg, ulong index, double d) /* {{{ */
{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_DOUBLE(tmp, d);
+ zval tmp;
- return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), NULL);
+ ZVAL_DOUBLE(&tmp, d);
+ return zend_hash_index_update(Z_ARRVAL_P(arg), index, &tmp) ? SUCCESS : FAILURE;
}
/* }}} */
ZEND_API int add_index_string(zval *arg, ulong index, const char *str, int duplicate) /* {{{ */
{
- zval *tmp;
+ zval tmp;
- MAKE_STD_ZVAL(tmp);
- ZVAL_STRING(tmp, str, duplicate);
-
- return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), NULL);
+//??? ZVAL_STRING(tmp, str, duplicate);
+ ZVAL_STRING(&tmp, str);
+ return zend_hash_index_update(Z_ARRVAL_P(arg), index, &tmp) ? SUCCESS : FAILURE;
}
/* }}} */
ZEND_API int add_index_stringl(zval *arg, ulong index, const char *str, uint length, int duplicate) /* {{{ */
{
- zval *tmp;
+ zval tmp;
- MAKE_STD_ZVAL(tmp);
- ZVAL_STRINGL(tmp, str, length, duplicate);
+//??? ZVAL_STRINGL(tmp, str, length, duplicate);
+ ZVAL_STRINGL(&tmp, str, length);
- return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), NULL);
+ return zend_hash_index_update(Z_ARRVAL_P(arg), index, &tmp) ? SUCCESS : FAILURE;
}
/* }}} */
ZEND_API int add_index_zval(zval *arg, ulong index, zval *value) /* {{{ */
{
- return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &value, sizeof(zval *), NULL);
+ return zend_hash_index_update(Z_ARRVAL_P(arg), index, value) ? SUCCESS : FAILURE;
}
/* }}} */
ZEND_API int add_next_index_long(zval *arg, long n) /* {{{ */
{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_LONG(tmp, n);
+ zval tmp;
- return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp, sizeof(zval *), NULL);
+ ZVAL_LONG(&tmp, n);
+ return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp) ? SUCCESS : FAILURE;
}
/* }}} */
ZEND_API int add_next_index_null(zval *arg) /* {{{ */
{
- zval *tmp;
+ zval tmp;
- MAKE_STD_ZVAL(tmp);
- ZVAL_NULL(tmp);
-
- return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp, sizeof(zval *), NULL);
+ ZVAL_NULL(&tmp);
+ return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp) ? SUCCESS : FAILURE;
}
/* }}} */
ZEND_API int add_next_index_bool(zval *arg, int b) /* {{{ */
{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_BOOL(tmp, b);
+ zval tmp;
- return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp, sizeof(zval *), NULL);
+ ZVAL_BOOL(&tmp, b);
+ return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp) ? SUCCESS : FAILURE;
}
/* }}} */
-ZEND_API int add_next_index_resource(zval *arg, int r) /* {{{ */
+ZEND_API int add_next_index_resource(zval *arg, zend_resource *r) /* {{{ */
{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_RESOURCE(tmp, r);
+ zval tmp;
- return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp, sizeof(zval *), NULL);
+ ZVAL_RES(&tmp, r);
+ return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp) ? SUCCESS : FAILURE;
}
/* }}} */
ZEND_API int add_next_index_double(zval *arg, double d) /* {{{ */
{
- zval *tmp;
+ zval tmp;
- MAKE_STD_ZVAL(tmp);
- ZVAL_DOUBLE(tmp, d);
+ ZVAL_DOUBLE(&tmp, d);
+ return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp) ? SUCCESS : FAILURE;
+}
+/* }}} */
+
+ZEND_API int add_next_index_str(zval *arg, zend_string *str) /* {{{ */
+{
+ zval tmp;
- return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp, sizeof(zval *), NULL);
+ ZVAL_STR(&tmp, STR_COPY(str));
+ return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp) ? SUCCESS : FAILURE;
}
/* }}} */
ZEND_API int add_next_index_string(zval *arg, const char *str, int duplicate) /* {{{ */
{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_STRING(tmp, str, duplicate);
+ zval tmp;
- return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp, sizeof(zval *), NULL);
+//??? ZVAL_STRING(&tmp, str, duplicate);
+ ZVAL_STRING(&tmp, str);
+ return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp) ? SUCCESS : FAILURE;
}
/* }}} */
ZEND_API int add_next_index_stringl(zval *arg, const char *str, uint length, int duplicate) /* {{{ */
{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_STRINGL(tmp, str, length, duplicate);
+ zval tmp;
- return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp, sizeof(zval *), NULL);
+//??? ZVAL_STRINGL(&tmp, str, length, duplicate);
+ ZVAL_STRINGL(&tmp, str, length);
+ return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp) ? SUCCESS : FAILURE;
}
/* }}} */
ZEND_API int add_next_index_zval(zval *arg, zval *value) /* {{{ */
{
- return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &value, sizeof(zval *), NULL);
+ return zend_hash_next_index_insert(Z_ARRVAL_P(arg), value) ? SUCCESS : FAILURE;
}
/* }}} */
-ZEND_API int add_get_assoc_string_ex(zval *arg, const char *key, uint key_len, const char *str, void **dest, int duplicate) /* {{{ */
+ZEND_API zval *add_get_assoc_string_ex(zval *arg, const char *key, uint key_len, const char *str, int duplicate) /* {{{ */
{
- zval *tmp;
+ zval tmp, *ret;
- MAKE_STD_ZVAL(tmp);
- ZVAL_STRING(tmp, str, duplicate);
-
- return zend_symtable_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), dest);
+//??? ZVAL_STRING(tmp, str, duplicate);
+ ZVAL_STRING(&tmp, str);
+ ret = zend_symtable_str_update(Z_ARRVAL_P(arg), key, key_len, &tmp);
+ return ret;
}
/* }}} */
-ZEND_API int add_get_assoc_stringl_ex(zval *arg, const char *key, uint key_len, const char *str, uint length, void **dest, int duplicate) /* {{{ */
+ZEND_API zval *add_get_assoc_stringl_ex(zval *arg, const char *key, uint key_len, const char *str, uint length, int duplicate) /* {{{ */
{
- zval *tmp;
+ zval tmp, *ret;
- MAKE_STD_ZVAL(tmp);
- ZVAL_STRINGL(tmp, str, length, duplicate);
-
- return zend_symtable_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), dest);
+//??? ZVAL_STRING(tmp, str, length, duplicate);
+ ZVAL_STRINGL(&tmp, str, length);
+ ret = zend_symtable_str_update(Z_ARRVAL_P(arg), key, key_len, &tmp);
+ return ret;
}
/* }}} */
-ZEND_API int add_get_index_long(zval *arg, ulong index, long l, void **dest) /* {{{ */
+ZEND_API zval *add_get_index_long(zval *arg, ulong index, long l) /* {{{ */
{
- zval *tmp;
+ zval tmp;
- MAKE_STD_ZVAL(tmp);
- ZVAL_LONG(tmp, l);
-
- return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), dest);
+ ZVAL_LONG(&tmp, l);
+ return zend_hash_index_update(Z_ARRVAL_P(arg), index, &tmp);
}
/* }}} */
-ZEND_API int add_get_index_double(zval *arg, ulong index, double d, void **dest) /* {{{ */
+ZEND_API zval *add_get_index_double(zval *arg, ulong index, double d) /* {{{ */
{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_DOUBLE(tmp, d);
+ zval tmp;
- return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), dest);
+ ZVAL_DOUBLE(&tmp, d);
+ return zend_hash_index_update(Z_ARRVAL_P(arg), index, &tmp);
}
/* }}} */
-ZEND_API int add_get_index_string(zval *arg, ulong index, const char *str, void **dest, int duplicate) /* {{{ */
+ZEND_API zval *add_get_index_str(zval *arg, ulong index, zend_string *str) /* {{{ */
{
- zval *tmp;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_STRING(tmp, str, duplicate);
+ zval tmp;
- return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), dest);
+//??? ZVAL_STRING(tmp, str, duplicate);
+ ZVAL_STR(&tmp, STR_COPY(str));
+ return zend_hash_index_update(Z_ARRVAL_P(arg), index, &tmp);
}
/* }}} */
-ZEND_API int add_get_index_stringl(zval *arg, ulong index, const char *str, uint length, void **dest, int duplicate) /* {{{ */
+ZEND_API zval *add_get_index_string(zval *arg, ulong index, const char *str, int duplicate) /* {{{ */
{
- zval *tmp;
+ zval tmp;
- MAKE_STD_ZVAL(tmp);
- ZVAL_STRINGL(tmp, str, length, duplicate);
+//??? ZVAL_STRING(tmp, str, duplicate);
+ ZVAL_STRING(&tmp, str);
+ return zend_hash_index_update(Z_ARRVAL_P(arg), index, &tmp);
+}
+/* }}} */
+
+ZEND_API zval *add_get_index_stringl(zval *arg, ulong index, const char *str, uint length, int duplicate) /* {{{ */
+{
+ zval tmp;
- return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), dest);
+//??? ZVAL_STRINGL(tmp, str, length, duplicate);
+ ZVAL_STRINGL(&tmp, str, length);
+ return zend_hash_index_update(Z_ARRVAL_P(arg), index, &tmp);
}
/* }}} */
ZEND_API int array_set_zval_key(HashTable *ht, zval *key, zval *value) /* {{{ */
{
- int result;
+ zval *result;
switch (Z_TYPE_P(key)) {
case IS_STRING:
- result = zend_symtable_update(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &value, sizeof(zval *), NULL);
+ result = zend_symtable_update(ht, Z_STR_P(key), value);
break;
case IS_NULL:
- result = zend_symtable_update(ht, "", 1, &value, sizeof(zval *), NULL);
+ result = zend_symtable_update(ht, STR_EMPTY_ALLOC(), value);
break;
case IS_RESOURCE:
zend_error(E_STRICT, "Resource ID#%ld used as offset, casting to integer (%ld)", Z_LVAL_P(key), Z_LVAL_P(key));
/* break missing intentionally */
case IS_BOOL:
case IS_LONG:
- result = zend_hash_index_update(ht, Z_LVAL_P(key), &value, sizeof(zval *), NULL);
+ result = zend_hash_index_update(ht, Z_LVAL_P(key), value);
break;
case IS_DOUBLE:
- result = zend_hash_index_update(ht, zend_dval_to_lval(Z_DVAL_P(key)), &value, sizeof(zval *), NULL);
+ result = zend_hash_index_update(ht, zend_dval_to_lval(Z_DVAL_P(key)), value);
break;
default:
zend_error(E_WARNING, "Illegal offset type");
- result = FAILURE;
+ result = NULL;
}
- if (result == SUCCESS) {
- Z_ADDREF_P(value);
+ if (result) {
+ Z_ADDREF_P(result);
+ return SUCCESS;
+ } else {
+ return FAILURE;
}
-
- return result;
}
/* }}} */
ZEND_API int add_property_long_ex(zval *arg, const char *key, uint key_len, long n TSRMLS_DC) /* {{{ */
{
- zval *tmp;
- zval *z_key;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_LONG(tmp, n);
+ zval tmp;
+ zval z_key;
- MAKE_STD_ZVAL(z_key);
- ZVAL_STRINGL(z_key, key, key_len-1, 1);
-
- Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp, 0 TSRMLS_CC);
+ ZVAL_LONG(&tmp, n);
+ ZVAL_STRINGL(&z_key, key, key_len-1);
+ Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, &tmp, 0 TSRMLS_CC);
zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */
zval_ptr_dtor(&z_key);
return SUCCESS;
@@ -1590,16 +1601,12 @@ ZEND_API int add_property_long_ex(zval *arg, const char *key, uint key_len, long
ZEND_API int add_property_bool_ex(zval *arg, const char *key, uint key_len, int b TSRMLS_DC) /* {{{ */
{
- zval *tmp;
- zval *z_key;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_BOOL(tmp, b);
-
- MAKE_STD_ZVAL(z_key);
- ZVAL_STRINGL(z_key, key, key_len-1, 1);
+ zval tmp;
+ zval z_key;
- Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp, 0 TSRMLS_CC);
+ ZVAL_BOOL(&tmp, b);
+ ZVAL_STRINGL(&z_key, key, key_len-1);
+ Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, &tmp, 0 TSRMLS_CC);
zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */
zval_ptr_dtor(&z_key);
return SUCCESS;
@@ -1608,34 +1615,26 @@ ZEND_API int add_property_bool_ex(zval *arg, const char *key, uint key_len, int
ZEND_API int add_property_null_ex(zval *arg, const char *key, uint key_len TSRMLS_DC) /* {{{ */
{
- zval *tmp;
- zval *z_key;
+ zval tmp;
+ zval z_key;
- MAKE_STD_ZVAL(tmp);
- ZVAL_NULL(tmp);
-
- MAKE_STD_ZVAL(z_key);
- ZVAL_STRINGL(z_key, key, key_len-1, 1);
-
- Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp, 0 TSRMLS_CC);
+ ZVAL_NULL(&tmp);
+ ZVAL_STRINGL(&z_key, key, key_len-1);
+ Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, &tmp, 0 TSRMLS_CC);
zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */
zval_ptr_dtor(&z_key);
return SUCCESS;
}
/* }}} */
-ZEND_API int add_property_resource_ex(zval *arg, const char *key, uint key_len, long n TSRMLS_DC) /* {{{ */
+ZEND_API int add_property_resource_ex(zval *arg, const char *key, uint key_len, zend_resource *r TSRMLS_DC) /* {{{ */
{
- zval *tmp;
- zval *z_key;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_RESOURCE(tmp, n);
-
- MAKE_STD_ZVAL(z_key);
- ZVAL_STRINGL(z_key, key, key_len-1, 1);
+ zval tmp;
+ zval z_key;
- Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp, 0 TSRMLS_CC);
+ ZVAL_RES(&tmp, r);
+ ZVAL_STRINGL(&z_key, key, key_len-1);
+ Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, &tmp, 0 TSRMLS_CC);
zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */
zval_ptr_dtor(&z_key);
return SUCCESS;
@@ -1644,16 +1643,12 @@ ZEND_API int add_property_resource_ex(zval *arg, const char *key, uint key_len,
ZEND_API int add_property_double_ex(zval *arg, const char *key, uint key_len, double d TSRMLS_DC) /* {{{ */
{
- zval *tmp;
- zval *z_key;
+ zval tmp;
+ zval z_key;
- MAKE_STD_ZVAL(tmp);
- ZVAL_DOUBLE(tmp, d);
-
- MAKE_STD_ZVAL(z_key);
- ZVAL_STRINGL(z_key, key, key_len-1, 1);
-
- Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp, 0 TSRMLS_CC);
+ ZVAL_DOUBLE(&tmp, d);
+ ZVAL_STRINGL(&z_key, key, key_len-1);
+ Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, &tmp, 0 TSRMLS_CC);
zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */
zval_ptr_dtor(&z_key);
return SUCCESS;
@@ -1662,16 +1657,13 @@ ZEND_API int add_property_double_ex(zval *arg, const char *key, uint key_len, do
ZEND_API int add_property_string_ex(zval *arg, const char *key, uint key_len, const char *str, int duplicate TSRMLS_DC) /* {{{ */
{
- zval *tmp;
- zval *z_key;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_STRING(tmp, str, duplicate);
+ zval tmp;
+ zval z_key;
- MAKE_STD_ZVAL(z_key);
- ZVAL_STRINGL(z_key, key, key_len-1, 1);
-
- Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp, 0 TSRMLS_CC);
+//??? ZVAL_STRING(tmp, str, duplicate);
+ ZVAL_STRING(&tmp, str);
+ ZVAL_STRINGL(&z_key, key, key_len-1);
+ Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, &tmp, 0 TSRMLS_CC);
zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */
zval_ptr_dtor(&z_key);
return SUCCESS;
@@ -1680,16 +1672,13 @@ ZEND_API int add_property_string_ex(zval *arg, const char *key, uint key_len, co
ZEND_API int add_property_stringl_ex(zval *arg, const char *key, uint key_len, const char *str, uint length, int duplicate TSRMLS_DC) /* {{{ */
{
- zval *tmp;
- zval *z_key;
-
- MAKE_STD_ZVAL(tmp);
- ZVAL_STRINGL(tmp, str, length, duplicate);
+ zval tmp;
+ zval z_key;
- MAKE_STD_ZVAL(z_key);
- ZVAL_STRINGL(z_key, key, key_len-1, 1);
-
- Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp, 0 TSRMLS_CC);
+//??? ZVAL_STRINGL(tmp, str, length, duplicate);
+ ZVAL_STRINGL(&tmp, str, length);
+ ZVAL_STRINGL(&z_key, key, key_len-1);
+ Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, &tmp, 0 TSRMLS_CC);
zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */
zval_ptr_dtor(&z_key);
return SUCCESS;
@@ -1698,12 +1687,10 @@ ZEND_API int add_property_stringl_ex(zval *arg, const char *key, uint key_len, c
ZEND_API int add_property_zval_ex(zval *arg, const char *key, uint key_len, zval *value TSRMLS_DC) /* {{{ */
{
- zval *z_key;
-
- MAKE_STD_ZVAL(z_key);
- ZVAL_STRINGL(z_key, key, key_len-1, 1);
+ zval z_key;
- Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, value, 0 TSRMLS_CC);
+ ZVAL_STRINGL(&z_key, key, key_len-1);
+ Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, value, 0 TSRMLS_CC);
zval_ptr_dtor(&z_key);
return SUCCESS;
}
@@ -1712,7 +1699,7 @@ ZEND_API int add_property_zval_ex(zval *arg, const char *key, uint key_len, zval
ZEND_API int zend_startup_module_ex(zend_module_entry *module TSRMLS_DC) /* {{{ */
{
int name_len;
- char *lcname;
+ zend_string *lcname;
if (module->module_started) {
return SUCCESS;
@@ -1728,16 +1715,17 @@ ZEND_API int zend_startup_module_ex(zend_module_entry *module TSRMLS_DC) /* {{{
zend_module_entry *req_mod;
name_len = strlen(dep->name);
- lcname = zend_str_tolower_dup(dep->name, name_len);
+ lcname = STR_ALLOC(name_len, 0);
+ zend_str_tolower_copy(lcname->val, dep->name, name_len);
- if (zend_hash_find(&module_registry, lcname, name_len+1, (void**)&req_mod) == FAILURE || !req_mod->module_started) {
- efree(lcname);
+ if ((req_mod = zend_hash_find_ptr(&module_registry, lcname)) == NULL || !req_mod->module_started) {
+ STR_FREE(lcname);
/* TODO: Check version relationship */
zend_error(E_CORE_WARNING, "Cannot load module '%s' because required module '%s' is not loaded", module->name, dep->name);
module->module_started = 0;
return FAILURE;
}
- efree(lcname);
+ STR_FREE(lcname);
}
++dep;
}
@@ -1768,22 +1756,22 @@ ZEND_API int zend_startup_module_ex(zend_module_entry *module TSRMLS_DC) /* {{{
static void zend_sort_modules(void *base, size_t count, size_t siz, compare_func_t compare TSRMLS_DC) /* {{{ */
{
- Bucket **b1 = base;
- Bucket **b2;
- Bucket **end = b1 + count;
- Bucket *tmp;
+ Bucket *b1 = base;
+ Bucket *b2;
+ Bucket *end = b1 + count;
+ Bucket tmp;
zend_module_entry *m, *r;
while (b1 < end) {
try_again:
- m = (zend_module_entry*)(*b1)->pData;
+ m = (zend_module_entry*)Z_PTR(b1->val);
if (!m->module_started && m->deps) {
const zend_module_dep *dep = m->deps;
while (dep->name) {
if (dep->type == MODULE_DEP_REQUIRED || dep->type == MODULE_DEP_OPTIONAL) {
b2 = b1 + 1;
while (b2 < end) {
- r = (zend_module_entry*)(*b2)->pData;
+ r = (zend_module_entry*)Z_PTR(b2->val);
if (strcasecmp(dep->name, r->name) == 0) {
tmp = *b1;
*b1 = *b2;
@@ -1813,7 +1801,7 @@ ZEND_API void zend_collect_module_handlers(TSRMLS_D) /* {{{ */
/* Collect extensions with request startup/shutdown handlers */
for (zend_hash_internal_pointer_reset_ex(&module_registry, &pos);
- zend_hash_get_current_data_ex(&module_registry, (void *) &module, &pos) == SUCCESS;
+ (module = zend_hash_get_current_data_ptr_ex(&module_registry, &pos)) != NULL;
zend_hash_move_forward_ex(&module_registry, &pos)) {
if (module->request_startup_func) {
startup_count++;
@@ -1838,7 +1826,7 @@ ZEND_API void zend_collect_module_handlers(TSRMLS_D) /* {{{ */
startup_count = 0;
for (zend_hash_internal_pointer_reset_ex(&module_registry, &pos);
- zend_hash_get_current_data_ex(&module_registry, (void *) &module, &pos) == SUCCESS;
+ (module = zend_hash_get_current_data_ptr_ex(&module_registry, &pos)) != NULL;
zend_hash_move_forward_ex(&module_registry, &pos)) {
if (module->request_startup_func) {
module_request_startup_handlers[startup_count++] = module;
@@ -1853,7 +1841,7 @@ ZEND_API void zend_collect_module_handlers(TSRMLS_D) /* {{{ */
/* Collect internal classes with static members */
for (zend_hash_internal_pointer_reset_ex(CG(class_table), &pos);
- zend_hash_get_current_data_ex(CG(class_table), (void *) &pce, &pos) == SUCCESS;
+ (pce = zend_hash_get_current_data_ptr_ex(CG(class_table), &pos)) != NULL;
zend_hash_move_forward_ex(CG(class_table), &pos)) {
if ((*pce)->type == ZEND_INTERNAL_CLASS &&
(*pce)->default_static_members_count > 0) {
@@ -1868,7 +1856,7 @@ ZEND_API void zend_collect_module_handlers(TSRMLS_D) /* {{{ */
if (class_count) {
for (zend_hash_internal_pointer_reset_ex(CG(class_table), &pos);
- zend_hash_get_current_data_ex(CG(class_table), (void *) &pce, &pos) == SUCCESS;
+ (pce = zend_hash_get_current_data_ptr_ex(CG(class_table), &pos)) != NULL;
zend_hash_move_forward_ex(CG(class_table), &pos)) {
if ((*pce)->type == ZEND_INTERNAL_CLASS &&
(*pce)->default_static_members_count > 0) {
@@ -1898,8 +1886,8 @@ ZEND_API void zend_destroy_modules(void) /* {{{ */
ZEND_API zend_module_entry* zend_register_module_ex(zend_module_entry *module TSRMLS_DC) /* {{{ */
{
int name_len;
- char *lcname;
- zend_module_entry *module_ptr;
+ zend_string *lcname;
+//??? zend_module_entry *module_ptr;
if (!module) {
return NULL;
@@ -1916,30 +1904,32 @@ ZEND_API zend_module_entry* zend_register_module_ex(zend_module_entry *module TS
while (dep->name) {
if (dep->type == MODULE_DEP_CONFLICTS) {
name_len = strlen(dep->name);
- lcname = zend_str_tolower_dup(dep->name, name_len);
+ lcname = STR_ALLOC(name_len, 0);
+ zend_str_tolower_copy(lcname->val, dep->name, name_len);
- if (zend_hash_exists(&module_registry, lcname, name_len+1)) {
- efree(lcname);
+ if (zend_hash_exists(&module_registry, lcname)) {
+ STR_FREE(lcname);
/* TODO: Check version relationship */
zend_error(E_CORE_WARNING, "Cannot load module '%s' because conflicting module '%s' is already loaded", module->name, dep->name);
return NULL;
}
- efree(lcname);
+ STR_FREE(lcname);
}
++dep;
}
}
name_len = strlen(module->name);
- lcname = zend_str_tolower_dup(module->name, name_len);
+ lcname = STR_ALLOC(name_len, 1);
+ zend_str_tolower_copy(lcname->val, module->name, name_len);
- if (zend_hash_add(&module_registry, lcname, name_len+1, (void *)module, sizeof(zend_module_entry), (void**)&module_ptr)==FAILURE) {
+ if (zend_hash_add_mem(&module_registry, lcname, module, sizeof(zend_module_entry)) == NULL) {
zend_error(E_CORE_WARNING, "Module '%s' already loaded", module->name);
- efree(lcname);
+ STR_RELEASE(lcname);
return NULL;
}
- efree(lcname);
- module = module_ptr;
+ STR_RELEASE(lcname);
+//??? module = module_ptr;
EG(current_module) = module;
if (module->functions && zend_register_functions(NULL, module->functions, NULL, module->type TSRMLS_CC)==FAILURE) {
@@ -1968,56 +1958,56 @@ ZEND_API void zend_check_magic_method_implementation(const zend_class_entry *ce,
/* we don't care if the function name is longer, in fact lowercasing only
* the beginning of the name speeds up the check process */
- name_len = strlen(fptr->common.function_name);
- zend_str_tolower_copy(lcname, fptr->common.function_name, MIN(name_len, sizeof(lcname)-1));
+ name_len = fptr->common.function_name->len;
+ zend_str_tolower_copy(lcname, fptr->common.function_name->val, MIN(name_len, sizeof(lcname)-1));
lcname[sizeof(lcname)-1] = '\0'; /* zend_str_tolower_copy won't necessarily set the zero byte */
if (name_len == sizeof(ZEND_DESTRUCTOR_FUNC_NAME) - 1 && !memcmp(lcname, ZEND_DESTRUCTOR_FUNC_NAME, sizeof(ZEND_DESTRUCTOR_FUNC_NAME) - 1) && fptr->common.num_args != 0) {
- zend_error(error_type, "Destructor %s::%s() cannot take arguments", ce->name, ZEND_DESTRUCTOR_FUNC_NAME);
+ zend_error(error_type, "Destructor %s::%s() cannot take arguments", ce->name->val, 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) - 1) && fptr->common.num_args != 0) {
- zend_error(error_type, "Method %s::%s() cannot accept any arguments", ce->name, ZEND_CLONE_FUNC_NAME);
+ zend_error(error_type, "Method %s::%s() cannot accept any arguments", ce->name->val, 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) - 1)) {
if (fptr->common.num_args != 1) {
- zend_error(error_type, "Method %s::%s() must take exactly 1 argument", ce->name, ZEND_GET_FUNC_NAME);
+ zend_error(error_type, "Method %s::%s() must take exactly 1 argument", ce->name->val, 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);
+ zend_error(error_type, "Method %s::%s() cannot take arguments by reference", ce->name->val, 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) - 1)) {
if (fptr->common.num_args != 2) {
- zend_error(error_type, "Method %s::%s() must take exactly 2 arguments", ce->name, ZEND_SET_FUNC_NAME);
+ zend_error(error_type, "Method %s::%s() must take exactly 2 arguments", ce->name->val, 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);
+ zend_error(error_type, "Method %s::%s() cannot take arguments by reference", ce->name->val, 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) - 1)) {
if (fptr->common.num_args != 1) {
- zend_error(error_type, "Method %s::%s() must take exactly 1 argument", ce->name, ZEND_UNSET_FUNC_NAME);
+ zend_error(error_type, "Method %s::%s() must take exactly 1 argument", ce->name->val, 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);
+ zend_error(error_type, "Method %s::%s() cannot take arguments by reference", ce->name->val, 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) - 1)) {
if (fptr->common.num_args != 1) {
- zend_error(error_type, "Method %s::%s() must take exactly 1 argument", ce->name, ZEND_ISSET_FUNC_NAME);
+ zend_error(error_type, "Method %s::%s() must take exactly 1 argument", ce->name->val, 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);
+ zend_error(error_type, "Method %s::%s() cannot take arguments by reference", ce->name->val, 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) - 1)) {
if (fptr->common.num_args != 2) {
- zend_error(error_type, "Method %s::%s() must take exactly 2 arguments", ce->name, ZEND_CALL_FUNC_NAME);
+ zend_error(error_type, "Method %s::%s() must take exactly 2 arguments", ce->name->val, 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);
+ zend_error(error_type, "Method %s::%s() cannot take arguments by reference", ce->name->val, ZEND_CALL_FUNC_NAME);
}
} else if (name_len == sizeof(ZEND_CALLSTATIC_FUNC_NAME) - 1 &&
!memcmp(lcname, ZEND_CALLSTATIC_FUNC_NAME, sizeof(ZEND_CALLSTATIC_FUNC_NAME)-1)
) {
if (fptr->common.num_args != 2) {
- zend_error(error_type, "Method %s::%s() must take exactly 2 arguments", ce->name, ZEND_CALLSTATIC_FUNC_NAME);
+ zend_error(error_type, "Method %s::%s() must take exactly 2 arguments", ce->name->val, ZEND_CALLSTATIC_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_CALLSTATIC_FUNC_NAME);
+ zend_error(error_type, "Method %s::%s() cannot take arguments by reference", ce->name->val, ZEND_CALLSTATIC_FUNC_NAME);
}
} else if (name_len == sizeof(ZEND_TOSTRING_FUNC_NAME) - 1 &&
!memcmp(lcname, ZEND_TOSTRING_FUNC_NAME, sizeof(ZEND_TOSTRING_FUNC_NAME)-1) && fptr->common.num_args != 0
) {
- zend_error(error_type, "Method %s::%s() cannot take arguments", ce->name, ZEND_TOSTRING_FUNC_NAME);
+ zend_error(error_type, "Method %s::%s() cannot take arguments", ce->name->val, ZEND_TOSTRING_FUNC_NAME);
}
}
/* }}} */
@@ -2032,11 +2022,10 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
HashTable *target_function_table = function_table;
int error_type;
zend_function *ctor = NULL, *dtor = NULL, *clone = NULL, *__get = NULL, *__set = NULL, *__unset = NULL, *__isset = NULL, *__call = NULL, *__callstatic = NULL, *__tostring = NULL;
- const char *lowercase_name;
+ zend_string *lowercase_name;
int fname_len;
const char *lc_class_name = NULL;
int class_name_len = 0;
- zend_ulong hash;
if (type==MODULE_PERSISTENT) {
error_type = E_CORE_WARNING;
@@ -2051,25 +2040,26 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
internal_function->module = EG(current_module);
if (scope) {
- class_name_len = strlen(scope->name);
+ class_name_len = scope->name->len;
if ((lc_class_name = zend_memrchr(scope->name, '\\', class_name_len))) {
++lc_class_name;
- class_name_len -= (lc_class_name - scope->name);
+ class_name_len -= (lc_class_name - scope->name->val);
lc_class_name = zend_str_tolower_dup(lc_class_name, class_name_len);
} else {
- lc_class_name = zend_str_tolower_dup(scope->name, class_name_len);
+ lc_class_name = zend_str_tolower_dup(scope->name->val, class_name_len);
}
}
while (ptr->fname) {
+ fname_len = strlen(ptr->fname);
internal_function->handler = ptr->handler;
- internal_function->function_name = (char*)ptr->fname;
+ internal_function->function_name = STR_INIT(ptr->fname, fname_len, 1);
internal_function->scope = scope;
internal_function->prototype = NULL;
if (ptr->flags) {
if (!(ptr->flags & ZEND_ACC_PPP_MASK)) {
if (ptr->flags != ZEND_ACC_DEPRECATED || scope) {
- zend_error(error_type, "Invalid access level for %s%s%s() - access must be exactly one of public, protected or private", scope ? scope->name : "", scope ? "::" : "", ptr->fname);
+ zend_error(error_type, "Invalid access level for %s%s%s() - access must be exactly one of public, protected or private", scope ? scope->name->val : "", scope ? "::" : "", ptr->fname);
}
internal_function->fn_flags = ZEND_ACC_PUBLIC | ptr->flags;
} else {
@@ -2112,29 +2102,29 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
}
}
if (ptr->flags & ZEND_ACC_STATIC && (!scope || !(scope->ce_flags & ZEND_ACC_INTERFACE))) {
- zend_error(error_type, "Static function %s%s%s() cannot be abstract", scope ? scope->name : "", scope ? "::" : "", ptr->fname);
+ zend_error(error_type, "Static function %s%s%s() cannot be abstract", scope ? scope->name->val : "", scope ? "::" : "", ptr->fname);
}
} else {
if (scope && (scope->ce_flags & ZEND_ACC_INTERFACE)) {
efree((char*)lc_class_name);
- zend_error(error_type, "Interface %s cannot contain non abstract method %s()", scope->name, ptr->fname);
+ zend_error(error_type, "Interface %s cannot contain non abstract method %s()", scope->name->val, ptr->fname);
return FAILURE;
}
if (!internal_function->handler) {
if (scope) {
efree((char*)lc_class_name);
}
- zend_error(error_type, "Method %s%s%s() cannot be a NULL function", scope ? scope->name : "", scope ? "::" : "", ptr->fname);
+ zend_error(error_type, "Method %s%s%s() cannot be a NULL function", scope ? scope->name->val : "", scope ? "::" : "", ptr->fname);
zend_unregister_functions(functions, count, target_function_table TSRMLS_CC);
return FAILURE;
}
}
- fname_len = strlen(ptr->fname);
- lowercase_name = zend_new_interned_string(zend_str_tolower_dup(ptr->fname, fname_len), fname_len + 1, 1 TSRMLS_CC);
- hash = str_hash(lowercase_name, fname_len);
- if (zend_hash_quick_add(target_function_table, lowercase_name, fname_len+1, hash, &function, sizeof(zend_function), (void**)&reg_function) == FAILURE) {
+ lowercase_name = STR_ALLOC(fname_len, 1);
+ zend_str_tolower_copy(lowercase_name->val, ptr->fname, fname_len);
+ lowercase_name = zend_new_interned_string(lowercase_name TSRMLS_CC);
+ if ((reg_function = zend_hash_add_mem(target_function_table, lowercase_name, &function, sizeof(zend_function))) == NULL) {
unload=1;
- str_efree(lowercase_name);
+ STR_RELEASE(lowercase_name);
break;
}
@@ -2162,7 +2152,7 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
} else if ((fname_len == sizeof(ZEND_DESTRUCTOR_FUNC_NAME)-1) && !memcmp(lowercase_name, ZEND_DESTRUCTOR_FUNC_NAME, sizeof(ZEND_DESTRUCTOR_FUNC_NAME) - 1)) {
dtor = reg_function;
if (internal_function->num_args) {
- zend_error(error_type, "Destructor %s::%s() cannot take arguments", scope->name, ptr->fname);
+ zend_error(error_type, "Destructor %s::%s() cannot take arguments", scope->name->val, ptr->fname);
}
} else if ((fname_len == sizeof(ZEND_CLONE_FUNC_NAME)-1) && !memcmp(lowercase_name, ZEND_CLONE_FUNC_NAME, sizeof(ZEND_CLONE_FUNC_NAME) - 1)) {
clone = reg_function;
@@ -2189,7 +2179,7 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
}
ptr++;
count++;
- str_efree(lowercase_name);
+ STR_RELEASE(lowercase_name);
}
if (unload) { /* before unloading, display all remaining bad function in the module */
if (scope) {
@@ -2197,11 +2187,12 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
}
while (ptr->fname) {
fname_len = strlen(ptr->fname);
- lowercase_name = zend_str_tolower_dup(ptr->fname, fname_len);
- if (zend_hash_exists(target_function_table, lowercase_name, fname_len+1)) {
- zend_error(error_type, "Function registration failed - duplicate name - %s%s%s", scope ? scope->name : "", scope ? "::" : "", ptr->fname);
+ lowercase_name = STR_ALLOC(fname_len, 0);
+ zend_str_tolower_copy(lowercase_name->val, ptr->fname, fname_len);
+ if (zend_hash_exists(target_function_table, lowercase_name)) {
+ zend_error(error_type, "Function registration failed - duplicate name - %s%s%s", scope ? scope->name->val : "", scope ? "::" : "", ptr->fname);
}
- efree((char*)lowercase_name);
+ STR_FREE(lowercase_name);
ptr++;
}
zend_unregister_functions(functions, count, target_function_table TSRMLS_CC);
@@ -2221,63 +2212,63 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
if (ctor) {
ctor->common.fn_flags |= ZEND_ACC_CTOR;
if (ctor->common.fn_flags & ZEND_ACC_STATIC) {
- zend_error(error_type, "Constructor %s::%s() cannot be static", scope->name, ctor->common.function_name);
+ zend_error(error_type, "Constructor %s::%s() cannot be static", scope->name->val, ctor->common.function_name->val);
}
ctor->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
}
if (dtor) {
dtor->common.fn_flags |= ZEND_ACC_DTOR;
if (dtor->common.fn_flags & ZEND_ACC_STATIC) {
- zend_error(error_type, "Destructor %s::%s() cannot be static", scope->name, dtor->common.function_name);
+ zend_error(error_type, "Destructor %s::%s() cannot be static", scope->name->val, dtor->common.function_name->val);
}
dtor->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
}
if (clone) {
clone->common.fn_flags |= ZEND_ACC_CLONE;
if (clone->common.fn_flags & ZEND_ACC_STATIC) {
- zend_error(error_type, "Constructor %s::%s() cannot be static", scope->name, clone->common.function_name);
+ zend_error(error_type, "Constructor %s::%s() cannot be static", scope->name->val, clone->common.function_name->val);
}
clone->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
}
if (__call) {
if (__call->common.fn_flags & ZEND_ACC_STATIC) {
- zend_error(error_type, "Method %s::%s() cannot be static", scope->name, __call->common.function_name);
+ zend_error(error_type, "Method %s::%s() cannot be static", scope->name->val, __call->common.function_name->val);
}
__call->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
}
if (__callstatic) {
if (!(__callstatic->common.fn_flags & ZEND_ACC_STATIC)) {
- zend_error(error_type, "Method %s::%s() must be static", scope->name, __callstatic->common.function_name);
+ zend_error(error_type, "Method %s::%s() must be static", scope->name->val, __callstatic->common.function_name->val);
}
__callstatic->common.fn_flags |= ZEND_ACC_STATIC;
}
if (__tostring) {
if (__tostring->common.fn_flags & ZEND_ACC_STATIC) {
- zend_error(error_type, "Method %s::%s() cannot be static", scope->name, __tostring->common.function_name);
+ zend_error(error_type, "Method %s::%s() cannot be static", scope->name->val, __tostring->common.function_name->val);
}
__tostring->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
}
if (__get) {
if (__get->common.fn_flags & ZEND_ACC_STATIC) {
- zend_error(error_type, "Method %s::%s() cannot be static", scope->name, __get->common.function_name);
+ zend_error(error_type, "Method %s::%s() cannot be static", scope->name->val, __get->common.function_name->val);
}
__get->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
}
if (__set) {
if (__set->common.fn_flags & ZEND_ACC_STATIC) {
- zend_error(error_type, "Method %s::%s() cannot be static", scope->name, __set->common.function_name);
+ zend_error(error_type, "Method %s::%s() cannot be static", scope->name->val, __set->common.function_name->val);
}
__set->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
}
if (__unset) {
if (__unset->common.fn_flags & ZEND_ACC_STATIC) {
- zend_error(error_type, "Method %s::%s() cannot be static", scope->name, __unset->common.function_name);
+ zend_error(error_type, "Method %s::%s() cannot be static", scope->name->val, __unset->common.function_name->val);
}
__unset->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
}
if (__isset) {
if (__isset->common.fn_flags & ZEND_ACC_STATIC) {
- zend_error(error_type, "Method %s::%s() cannot be static", scope->name, __isset->common.function_name);
+ zend_error(error_type, "Method %s::%s() cannot be static", scope->name->val, __isset->common.function_name->val);
}
__isset->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
}
@@ -2295,6 +2286,8 @@ ZEND_API void zend_unregister_functions(const zend_function_entry *functions, in
const zend_function_entry *ptr = functions;
int i=0;
HashTable *target_function_table = function_table;
+ zend_string *lowercase_name;
+ int fname_len;
if (!target_function_table) {
target_function_table = CG(function_table);
@@ -2303,10 +2296,11 @@ ZEND_API void zend_unregister_functions(const zend_function_entry *functions, in
if (count!=-1 && i>=count) {
break;
}
-#if 0
- zend_printf("Unregistering %s()\n", ptr->fname);
-#endif
- zend_hash_del(target_function_table, ptr->fname, strlen(ptr->fname)+1);
+ fname_len = strlen(ptr->fname);
+ lowercase_name = STR_ALLOC(fname_len, 0);
+ zend_str_tolower_copy(lowercase_name->val, ptr->fname, fname_len);
+ zend_hash_del(target_function_table, lowercase_name);
+ STR_FREE(lowercase_name);
ptr++;
i++;
}
@@ -2326,7 +2320,8 @@ ZEND_API int zend_get_module_started(const char *module_name) /* {{{ */
{
zend_module_entry *module;
- return (zend_hash_find(&module_registry, module_name, strlen(module_name)+1, (void**)&module) == SUCCESS && module->module_started) ? SUCCESS : FAILURE;
+ module = zend_hash_str_find_ptr(&module_registry, module_name, strlen(module_name));
+ return (module && module->module_started) ? SUCCESS : FAILURE;
}
/* }}} */
@@ -2495,8 +2490,7 @@ int zend_next_free_module(void) /* {{{ */
static zend_class_entry *do_register_internal_class(zend_class_entry *orig_class_entry, zend_uint ce_flags TSRMLS_DC) /* {{{ */
{
zend_class_entry *class_entry = malloc(sizeof(zend_class_entry));
- char *lowercase_name = emalloc(orig_class_entry->name_length + 1);
- zend_ulong hash;
+ zend_string *lowercase_name = STR_ALLOC(orig_class_entry->name->len, 1);
*class_entry = *orig_class_entry;
class_entry->type = ZEND_INTERNAL_CLASS;
@@ -2508,11 +2502,10 @@ static zend_class_entry *do_register_internal_class(zend_class_entry *orig_class
zend_register_functions(class_entry, class_entry->info.internal.builtin_functions, &class_entry->function_table, MODULE_PERSISTENT TSRMLS_CC);
}
- zend_str_tolower_copy(lowercase_name, orig_class_entry->name, class_entry->name_length);
- lowercase_name = (char*)zend_new_interned_string(lowercase_name, class_entry->name_length + 1, 1 TSRMLS_CC);
- hash = str_hash(lowercase_name, class_entry->name_length);
- zend_hash_quick_update(CG(class_table), lowercase_name, class_entry->name_length+1, hash, &class_entry, sizeof(zend_class_entry *), NULL);
- str_efree(lowercase_name);
+ zend_str_tolower_copy(lowercase_name->val, orig_class_entry->name->val, class_entry->name->len);
+ lowercase_name = zend_new_interned_string(lowercase_name TSRMLS_CC);
+ zend_hash_update_ptr(CG(class_table), lowercase_name, class_entry);
+ STR_RELEASE(lowercase_name);
return class_entry;
}
/* }}} */
@@ -2522,19 +2515,10 @@ static zend_class_entry *do_register_internal_class(zend_class_entry *orig_class
* If both parent_ce and parent_name are NULL it does a regular class registration
* If parent_name is specified but not found NULL is returned
*/
-ZEND_API zend_class_entry *zend_register_internal_class_ex(zend_class_entry *class_entry, zend_class_entry *parent_ce, char *parent_name TSRMLS_DC) /* {{{ */
+ZEND_API zend_class_entry *zend_register_internal_class_ex(zend_class_entry *class_entry, zend_class_entry *parent_ce TSRMLS_DC) /* {{{ */
{
zend_class_entry *register_class;
- if (!parent_ce && parent_name) {
- zend_class_entry **pce;
- if (zend_hash_find(CG(class_table), parent_name, strlen(parent_name)+1, (void **) &pce)==FAILURE) {
- return NULL;
- } else {
- parent_ce = *pce;
- }
- }
-
register_class = zend_register_internal_class(class_entry TSRMLS_CC);
if (parent_ce) {
@@ -2575,20 +2559,22 @@ ZEND_API zend_class_entry *zend_register_internal_interface(zend_class_entry *or
ZEND_API int zend_register_class_alias_ex(const char *name, int name_len, zend_class_entry *ce TSRMLS_DC) /* {{{ */
{
- char *lcname = zend_str_tolower_dup(name, name_len);
- int ret;
+ zend_string *lcname;
- if (lcname[0] == '\\') {
- ret = zend_hash_add(CG(class_table), lcname+1, name_len, &ce, sizeof(zend_class_entry *), NULL);
+ if (name[0] == '\\') {
+ lcname = STR_ALLOC(name_len-1, 1);
+ zend_str_tolower_copy(lcname->val, name+1, name_len-1);
} else {
- ret = zend_hash_add(CG(class_table), lcname, name_len+1, &ce, sizeof(zend_class_entry *), NULL);
+ lcname = STR_ALLOC(name_len, 1);
+ zend_str_tolower_copy(lcname->val, name, name_len);
}
-
- efree(lcname);
- if (ret == SUCCESS) {
+ ce = zend_hash_add_ptr(CG(class_table), lcname, &ce);
+ STR_RELEASE(lcname);
+ if (ce) {
ce->refcount++;
+ return SUCCESS;
}
- return ret;
+ return FAILURE;
}
/* }}} */
@@ -2599,13 +2585,15 @@ ZEND_API int zend_set_hash_symbol(zval *symbol, const char *name, int name_lengt
if (num_symbol_tables <= 0) return FAILURE;
- Z_SET_ISREF_TO_P(symbol, is_ref);
+ if (is_ref && Z_TYPE_P(symbol) != IS_REFERENCE) {
+ ZVAL_NEW_REF(symbol, symbol);
+ }
va_start(symbol_table_list, num_symbol_tables);
while (num_symbol_tables-- > 0) {
symbol_table = va_arg(symbol_table_list, HashTable *);
- zend_hash_update(symbol_table, name, name_length + 1, &symbol, sizeof(zval *), NULL);
- zval_add_ref(&symbol);
+ zend_hash_str_update(symbol_table, name, name_length, symbol);
+ Z_ADDREF_P(symbol);
}
va_end(symbol_table_list);
return SUCCESS;
@@ -2629,7 +2617,10 @@ static zend_function_entry disabled_function[] = {
ZEND_API int zend_disable_function(char *function_name, uint function_name_length TSRMLS_DC) /* {{{ */
{
- if (zend_hash_del(CG(function_table), function_name, function_name_length+1)==FAILURE) {
+ int ret;
+
+ ret = zend_hash_str_del(CG(function_table), function_name, function_name_length);
+ if (ret == FAILURE) {
return FAILURE;
}
disabled_function[0].fname = function_name;
@@ -2640,13 +2631,13 @@ ZEND_API int zend_disable_function(char *function_name, uint function_name_lengt
#ifdef ZEND_WIN32
#pragma optimize("", off)
#endif
-static zend_object_value display_disabled_class(zend_class_entry *class_type TSRMLS_DC) /* {{{ */
+static zend_object *display_disabled_class(zend_class_entry *class_type TSRMLS_DC) /* {{{ */
{
- zend_object_value retval;
zend_object *intern;
- retval = zend_objects_new(&intern, class_type TSRMLS_CC);
- zend_error(E_WARNING, "%s() has been disabled for security reasons", class_type->name);
- return retval;
+
+ intern = zend_objects_new(class_type TSRMLS_CC);
+ zend_error(E_WARNING, "%s() has been disabled for security reasons", class_type->name->val);
+ return intern;
}
#ifdef ZEND_WIN32
#pragma optimize("", on)
@@ -2659,35 +2650,42 @@ static const zend_function_entry disabled_class_new[] = {
ZEND_API int zend_disable_class(char *class_name, uint class_name_length TSRMLS_DC) /* {{{ */
{
- zend_class_entry **disabled_class;
+ zend_class_entry *disabled_class;
+ zend_string *key;
- zend_str_tolower(class_name, class_name_length);
- if (zend_hash_find(CG(class_table), class_name, class_name_length+1, (void **)&disabled_class)==FAILURE) {
+ key = STR_ALLOC(class_name_length, 0);
+ zend_str_tolower_copy(key->val, class_name, class_name_length);
+ disabled_class = zend_hash_find_ptr(CG(class_table), key);
+ if (!disabled_class) {
return FAILURE;
}
- INIT_CLASS_ENTRY_INIT_METHODS((**disabled_class), disabled_class_new, NULL, NULL, NULL, NULL, NULL);
- (*disabled_class)->create_object = display_disabled_class;
- zend_hash_clean(&((*disabled_class)->function_table));
+ INIT_CLASS_ENTRY_INIT_METHODS((*disabled_class), disabled_class_new, NULL, NULL, NULL, NULL, NULL);
+ disabled_class->create_object = display_disabled_class;
+ zend_hash_clean(&disabled_class->function_table);
return SUCCESS;
}
/* }}} */
-static int zend_is_callable_check_class(const char *name, int name_len, zend_fcall_info_cache *fcc, int *strict_class, char **error TSRMLS_DC) /* {{{ */
+static int zend_is_callable_check_class(zend_string *name, zend_fcall_info_cache *fcc, int *strict_class, char **error TSRMLS_DC) /* {{{ */
{
int ret = 0;
- zend_class_entry **pce;
- char *lcname = zend_str_tolower_dup(name, name_len);
+ zend_class_entry *ce;
+ int name_len = name->len;
+ zend_string *lcname;
+
+ lcname = STR_ALLOC(name_len, 0);
+ zend_str_tolower_copy(lcname->val, name->val, name_len);
*strict_class = 0;
if (name_len == sizeof("self") - 1 &&
- !memcmp(lcname, "self", sizeof("self") - 1)) {
+ !memcmp(lcname->val, "self", sizeof("self") - 1)) {
if (!EG(scope)) {
if (error) *error = estrdup("cannot access self:: when no class scope is active");
} else {
fcc->called_scope = EG(called_scope);
fcc->calling_scope = EG(scope);
if (!fcc->object_ptr) {
- fcc->object_ptr = EG(This);
+ fcc->object_ptr = &EG(This);
}
ret = 1;
}
@@ -2701,7 +2699,7 @@ static int zend_is_callable_check_class(const char *name, int name_len, zend_fca
fcc->called_scope = EG(called_scope);
fcc->calling_scope = EG(scope)->parent;
if (!fcc->object_ptr) {
- fcc->object_ptr = EG(This);
+ fcc->object_ptr = &EG(This);
}
*strict_class = 1;
ret = 1;
@@ -2714,19 +2712,19 @@ static int zend_is_callable_check_class(const char *name, int name_len, zend_fca
fcc->called_scope = EG(called_scope);
fcc->calling_scope = EG(called_scope);
if (!fcc->object_ptr) {
- fcc->object_ptr = EG(This);
+ fcc->object_ptr = &EG(This);
}
*strict_class = 1;
ret = 1;
}
- } else if (zend_lookup_class_ex(name, name_len, NULL, 1, &pce TSRMLS_CC) == SUCCESS) {
+ } else if ((ce = zend_lookup_class_ex(name, NULL, 1 TSRMLS_CC)) != NULL) {
zend_class_entry *scope = EG(active_op_array) ? EG(active_op_array)->scope : NULL;
- fcc->calling_scope = *pce;
- if (scope && !fcc->object_ptr && EG(This) &&
- instanceof_function(Z_OBJCE_P(EG(This)), scope TSRMLS_CC) &&
+ fcc->calling_scope = ce;
+ if (scope && !fcc->object_ptr && Z_TYPE(EG(This)) != IS_UNDEF &&
+ instanceof_function(Z_OBJCE(EG(This)), scope TSRMLS_CC) &&
instanceof_function(scope, fcc->calling_scope TSRMLS_CC)) {
- fcc->object_ptr = EG(This);
+ fcc->object_ptr = &EG(This);
fcc->called_scope = Z_OBJCE_P(fcc->object_ptr);
} else {
fcc->called_scope = fcc->object_ptr ? Z_OBJCE_P(fcc->object_ptr) : fcc->calling_scope;
@@ -2745,7 +2743,8 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca
{
zend_class_entry *ce_org = fcc->calling_scope;
int retval = 0;
- char *mname, *lmname;
+ zend_string *mname;
+ zend_string *lmname;
const char *colon;
int clen, mlen;
zend_class_entry *last_scope;
@@ -2762,19 +2761,20 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca
if (!ce_org) {
/* Skip leading \ */
if (Z_STRVAL_P(callable)[0] == '\\') {
- mlen = Z_STRLEN_P(callable) - 1;
- lmname = zend_str_tolower_dup(Z_STRVAL_P(callable) + 1, mlen);
+ lmname = STR_ALLOC(Z_STRLEN_P(callable) - 1, 0);
+ zend_str_tolower_copy(lmname->val, Z_STRVAL_P(callable) + 1, Z_STRLEN_P(callable) - 1);
} else {
- mlen = Z_STRLEN_P(callable);
- lmname = zend_str_tolower_dup(Z_STRVAL_P(callable), mlen);
+ lmname = STR_ALLOC(Z_STRLEN_P(callable), 0);
+ zend_str_tolower_copy(lmname->val, Z_STRVAL_P(callable), Z_STRLEN_P(callable));
}
/* Check if function with given name exists.
* This may be a compound name that includes namespace name */
- if (zend_hash_find(EG(function_table), lmname, mlen+1, (void**)&fcc->function_handler) == SUCCESS) {
- efree(lmname);
+ fcc->function_handler = zend_hash_find_ptr(EG(function_table), lmname);
+ if (fcc->function_handler != NULL) {
+ STR_FREE(lmname);
return 1;
}
- efree(lmname);
+ STR_FREE(lmname);
}
/* Split name into class/namespace and method/function names */
@@ -2798,7 +2798,8 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca
EG(scope) = ce_org;
}
- if (!zend_is_callable_check_class(Z_STRVAL_P(callable), clen, fcc, &strict_class, error TSRMLS_CC)) {
+//??? if (!zend_is_callable_check_class(Z_STRVAL_P(callable), clen, fcc, &strict_class, error TSRMLS_CC)) {
+ if (!zend_is_callable_check_class(Z_STR_P(callable), fcc, &strict_class, error TSRMLS_CC)) {
EG(scope) = last_scope;
return 0;
}
@@ -2809,11 +2810,12 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca
if (error) zend_spprintf(error, 0, "class '%s' is not a subclass of '%s'", ce_org->name, fcc->calling_scope->name);
return 0;
}
- mname = Z_STRVAL_P(callable) + clen + 2;
+ mname = STR_INIT(Z_STRVAL_P(callable) + clen + 2, mlen, 0);
} else if (ce_org) {
/* Try to fetch find static method of given class. */
mlen = Z_STRLEN_P(callable);
- mname = Z_STRVAL_P(callable);
+ mname = Z_STR_P(callable);
+ STR_ADDREF(mname);
ftable = &ce_org->function_table;
fcc->calling_scope = ce_org;
} else {
@@ -2824,23 +2826,24 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca
return 0;
}
- lmname = zend_str_tolower_dup(mname, mlen);
+ lmname = STR_ALLOC(mlen, 0);
+ zend_str_tolower_copy(lmname->val, mname->val, mlen);
if (strict_class &&
fcc->calling_scope &&
mlen == sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1 &&
- !memcmp(lmname, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME) - 1)) {
+ !memcmp(lmname->val, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME) - 1)) {
fcc->function_handler = fcc->calling_scope->constructor;
if (fcc->function_handler) {
retval = 1;
}
- } else if (zend_hash_find(ftable, lmname, mlen+1, (void**)&fcc->function_handler) == SUCCESS) {
+ } else if ((fcc->function_handler = zend_hash_find_ptr(ftable, lmname)) != NULL) {
retval = 1;
if ((fcc->function_handler->op_array.fn_flags & ZEND_ACC_CHANGED) &&
!strict_class && EG(scope) &&
instanceof_function(fcc->function_handler->common.scope, EG(scope) TSRMLS_CC)) {
zend_function *priv_fbc;
- if (zend_hash_find(&EG(scope)->function_table, lmname, mlen+1, (void **) &priv_fbc)==SUCCESS
+ if ((priv_fbc = zend_hash_find_ptr(&EG(scope)->function_table, lmname)) != NULL
&& priv_fbc->common.fn_flags & ZEND_ACC_PRIVATE
&& priv_fbc->common.scope == EG(scope)) {
fcc->function_handler = priv_fbc;
@@ -2851,7 +2854,7 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca
((fcc->object_ptr && fcc->calling_scope->__call) ||
(!fcc->object_ptr && fcc->calling_scope->__callstatic)))) {
if (fcc->function_handler->op_array.fn_flags & ZEND_ACC_PRIVATE) {
- if (!zend_check_private(fcc->function_handler, fcc->object_ptr ? Z_OBJCE_P(fcc->object_ptr) : EG(scope), lmname, mlen TSRMLS_CC)) {
+ if (!zend_check_private(fcc->function_handler, fcc->object_ptr ? Z_OBJCE_P(fcc->object_ptr) : EG(scope), lmname TSRMLS_CC)) {
retval = 0;
fcc->function_handler = NULL;
goto get_function_via_handler;
@@ -2876,11 +2879,12 @@ get_function_via_handler:
fcc->function_handler->internal_function.num_args = 0;
fcc->function_handler->internal_function.scope = ce_org;
fcc->function_handler->internal_function.fn_flags = ZEND_ACC_CALL_VIA_HANDLER;
- fcc->function_handler->internal_function.function_name = estrndup(mname, mlen);
+ fcc->function_handler->internal_function.function_name = mname;
+ STR_ADDREF(mname);
call_via_handler = 1;
retval = 1;
} else if (Z_OBJ_HT_P(fcc->object_ptr)->get_method) {
- fcc->function_handler = Z_OBJ_HT_P(fcc->object_ptr)->get_method(&fcc->object_ptr, mname, mlen, NULL TSRMLS_CC);
+ fcc->function_handler = Z_OBJ_HT_P(fcc->object_ptr)->get_method(fcc->object_ptr, mname, NULL TSRMLS_CC);
if (fcc->function_handler) {
if (strict_class &&
(!fcc->function_handler->common.scope ||
@@ -2899,17 +2903,17 @@ get_function_via_handler:
}
} else if (fcc->calling_scope) {
if (fcc->calling_scope->get_static_method) {
- fcc->function_handler = fcc->calling_scope->get_static_method(fcc->calling_scope, mname, mlen TSRMLS_CC);
+ fcc->function_handler = fcc->calling_scope->get_static_method(fcc->calling_scope, mname TSRMLS_CC);
} else {
- fcc->function_handler = zend_std_get_static_method(fcc->calling_scope, mname, mlen, NULL TSRMLS_CC);
+ fcc->function_handler = zend_std_get_static_method(fcc->calling_scope, mname, NULL TSRMLS_CC);
}
if (fcc->function_handler) {
retval = 1;
call_via_handler = (fcc->function_handler->common.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) != 0;
- if (call_via_handler && !fcc->object_ptr && EG(This) &&
- Z_OBJ_HT_P(EG(This))->get_class_entry &&
- instanceof_function(Z_OBJCE_P(EG(This)), fcc->calling_scope TSRMLS_CC)) {
- fcc->object_ptr = EG(This);
+ if (call_via_handler && !fcc->object_ptr && Z_TYPE(EG(This)) != IS_UNDEF &&
+ Z_OBJ_HT(EG(This))->get_class_entry &&
+ instanceof_function(Z_OBJCE(EG(This)), fcc->calling_scope TSRMLS_CC)) {
+ fcc->object_ptr = &EG(This);
}
}
}
@@ -2922,7 +2926,7 @@ get_function_via_handler:
zend_spprintf(error, 0, "cannot call abstract method %s::%s()", fcc->calling_scope->name, fcc->function_handler->common.function_name);
retval = 0;
} else {
- zend_error(E_ERROR, "Cannot call abstract method %s::%s()", fcc->calling_scope->name, fcc->function_handler->common.function_name);
+ zend_error(E_ERROR, "Cannot call abstract method %s::%s()", fcc->calling_scope->name->val, fcc->function_handler->common.function_name->val);
}
} else if (!fcc->object_ptr && !(fcc->function_handler->common.fn_flags & ZEND_ACC_STATIC)) {
int severity;
@@ -2938,30 +2942,30 @@ get_function_via_handler:
if ((check_flags & IS_CALLABLE_CHECK_IS_STATIC) != 0) {
retval = 0;
}
- if (EG(This) && instanceof_function(Z_OBJCE_P(EG(This)), fcc->calling_scope TSRMLS_CC)) {
- fcc->object_ptr = EG(This);
+ if (Z_TYPE(EG(This)) != IS_UNDEF && instanceof_function(Z_OBJCE(EG(This)), fcc->calling_scope TSRMLS_CC)) {
+ fcc->object_ptr = &EG(This);
if (error) {
- zend_spprintf(error, 0, "non-static method %s::%s() %s be called statically, assuming $this from compatible context %s", fcc->calling_scope->name, fcc->function_handler->common.function_name, verb, Z_OBJCE_P(EG(This))->name);
+ zend_spprintf(error, 0, "non-static method %s::%s() %s be called statically, assuming $this from compatible context %s", fcc->calling_scope->name->val, fcc->function_handler->common.function_name->val, verb, Z_OBJCE(EG(This))->name->val);
if (severity == E_ERROR) {
retval = 0;
}
} else if (retval) {
- zend_error(severity, "Non-static method %s::%s() %s be called statically, assuming $this from compatible context %s", fcc->calling_scope->name, fcc->function_handler->common.function_name, verb, Z_OBJCE_P(EG(This))->name);
+ zend_error(severity, "Non-static method %s::%s() %s be called statically, assuming $this from compatible context %s", fcc->calling_scope->name->val, fcc->function_handler->common.function_name->val, verb, Z_OBJCE(EG(This))->name->val);
}
} else {
if (error) {
- zend_spprintf(error, 0, "non-static method %s::%s() %s be called statically", fcc->calling_scope->name, fcc->function_handler->common.function_name, verb);
+ zend_spprintf(error, 0, "non-static method %s::%s() %s be called statically", fcc->calling_scope->name->val, fcc->function_handler->common.function_name->val, verb);
if (severity == E_ERROR) {
retval = 0;
}
} else if (retval) {
- zend_error(severity, "Non-static method %s::%s() %s be called statically", fcc->calling_scope->name, fcc->function_handler->common.function_name, verb);
+ zend_error(severity, "Non-static method %s::%s() %s be called statically", fcc->calling_scope->name->val, fcc->function_handler->common.function_name->val, verb);
}
}
}
if (retval && (check_flags & IS_CALLABLE_CHECK_NO_ACCESS) == 0) {
if (fcc->function_handler->op_array.fn_flags & ZEND_ACC_PRIVATE) {
- if (!zend_check_private(fcc->function_handler, fcc->object_ptr ? Z_OBJCE_P(fcc->object_ptr) : EG(scope), lmname, mlen TSRMLS_CC)) {
+ if (!zend_check_private(fcc->function_handler, fcc->object_ptr ? Z_OBJCE_P(fcc->object_ptr) : EG(scope), lmname TSRMLS_CC)) {
if (error) {
if (*error) {
efree(*error);
@@ -3031,11 +3035,11 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, zval *object_ptr, uint ch
if (object_ptr && Z_TYPE_P(object_ptr) != IS_OBJECT) {
object_ptr = NULL;
}
- if (object_ptr &&
- (!EG(objects_store).object_buckets ||
- !EG(objects_store).object_buckets[Z_OBJ_HANDLE_P(object_ptr)].valid)) {
- return 0;
- }
+//??? if (object_ptr &&
+//??? (!EG(objects_store).object_buckets ||
+//??? !EG(objects_store).object_buckets[Z_OBJ_HANDLE_P(object_ptr)].valid)) {
+//??? return 0;
+//??? }
switch (Z_TYPE_P(callable)) {
case IS_STRING:
@@ -3045,10 +3049,10 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, zval *object_ptr, uint ch
if (callable_name) {
char *ptr;
- *callable_name_len = fcc->calling_scope->name_length + Z_STRLEN_P(callable) + sizeof("::") - 1;
+ *callable_name_len = fcc->calling_scope->name->len + Z_STRLEN_P(callable) + sizeof("::") - 1;
ptr = *callable_name = emalloc(*callable_name_len + 1);
- memcpy(ptr, fcc->calling_scope->name, fcc->calling_scope->name_length);
- ptr += fcc->calling_scope->name_length;
+ memcpy(ptr, fcc->calling_scope->name, fcc->calling_scope->name->len);
+ ptr += fcc->calling_scope->name->len;
memcpy(ptr, "::", sizeof("::") - 1);
ptr += sizeof("::") - 1;
memcpy(ptr, Z_STRVAL_P(callable), Z_STRLEN_P(callable) + 1);
@@ -3078,60 +3082,60 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, zval *object_ptr, uint ch
case IS_ARRAY:
{
- zval **method = NULL;
- zval **obj = NULL;
+ zval *method = NULL;
+ zval *obj = NULL;
int strict_class = 0;
if (zend_hash_num_elements(Z_ARRVAL_P(callable)) == 2) {
- zend_hash_index_find(Z_ARRVAL_P(callable), 0, (void **) &obj);
- zend_hash_index_find(Z_ARRVAL_P(callable), 1, (void **) &method);
+ obj = zend_hash_index_find(Z_ARRVAL_P(callable), 0);
+ method = zend_hash_index_find(Z_ARRVAL_P(callable), 1);
}
if (obj && method &&
- (Z_TYPE_PP(obj) == IS_OBJECT ||
- Z_TYPE_PP(obj) == IS_STRING) &&
- Z_TYPE_PP(method) == IS_STRING) {
+ (Z_TYPE_P(obj) == IS_OBJECT ||
+ Z_TYPE_P(obj) == IS_STRING) &&
+ Z_TYPE_P(method) == IS_STRING) {
- if (Z_TYPE_PP(obj) == IS_STRING) {
+ if (Z_TYPE_P(obj) == IS_STRING) {
if (callable_name) {
char *ptr;
- *callable_name_len = Z_STRLEN_PP(obj) + Z_STRLEN_PP(method) + sizeof("::") - 1;
+ *callable_name_len = Z_STRLEN_P(obj) + Z_STRLEN_P(method) + sizeof("::") - 1;
ptr = *callable_name = emalloc(*callable_name_len + 1);
- memcpy(ptr, Z_STRVAL_PP(obj), Z_STRLEN_PP(obj));
- ptr += Z_STRLEN_PP(obj);
+ memcpy(ptr, Z_STRVAL_P(obj), Z_STRLEN_P(obj));
+ ptr += Z_STRLEN_P(obj);
memcpy(ptr, "::", sizeof("::") - 1);
ptr += sizeof("::") - 1;
- memcpy(ptr, Z_STRVAL_PP(method), Z_STRLEN_PP(method) + 1);
+ memcpy(ptr, Z_STRVAL_P(method), Z_STRLEN_P(method) + 1);
}
if (check_flags & IS_CALLABLE_CHECK_SYNTAX_ONLY) {
return 1;
}
- if (!zend_is_callable_check_class(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj), fcc, &strict_class, error TSRMLS_CC)) {
+ if (!zend_is_callable_check_class(Z_STR_P(obj), fcc, &strict_class, error TSRMLS_CC)) {
return 0;
}
} else {
- if (!EG(objects_store).object_buckets ||
- !EG(objects_store).object_buckets[Z_OBJ_HANDLE_PP(obj)].valid) {
- return 0;
- }
+//??? if (!EG(objects_store).object_buckets ||
+//??? !EG(objects_store).object_buckets[Z_OBJ_HANDLE_PP(obj)].valid) {
+//??? return 0;
+//??? }
- fcc->calling_scope = Z_OBJCE_PP(obj); /* TBFixed: what if it's overloaded? */
+ fcc->calling_scope = Z_OBJCE_P(obj); /* TBFixed: what if it's overloaded? */
- fcc->object_ptr = *obj;
+ fcc->object_ptr = obj;
if (callable_name) {
char *ptr;
- *callable_name_len = fcc->calling_scope->name_length + Z_STRLEN_PP(method) + sizeof("::") - 1;
+ *callable_name_len = fcc->calling_scope->name->len + Z_STRLEN_P(method) + sizeof("::") - 1;
ptr = *callable_name = emalloc(*callable_name_len + 1);
- memcpy(ptr, fcc->calling_scope->name, fcc->calling_scope->name_length);
- ptr += fcc->calling_scope->name_length;
+ memcpy(ptr, fcc->calling_scope->name, fcc->calling_scope->name->len);
+ ptr += fcc->calling_scope->name->len;
memcpy(ptr, "::", sizeof("::") - 1);
ptr += sizeof("::") - 1;
- memcpy(ptr, Z_STRVAL_PP(method), Z_STRLEN_PP(method) + 1);
+ memcpy(ptr, Z_STRVAL_P(method), Z_STRLEN_P(method) + 1);
}
if (check_flags & IS_CALLABLE_CHECK_SYNTAX_ONLY) {
@@ -3140,7 +3144,7 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, zval *object_ptr, uint ch
}
}
- ret = zend_is_callable_check_func(check_flags, *method, fcc, strict_class, error TSRMLS_CC);
+ ret = zend_is_callable_check_func(check_flags, method, fcc, strict_class, error TSRMLS_CC);
if (fcc == &fcc_local &&
fcc->function_handler &&
((fcc->function_handler->type == ZEND_INTERNAL_FUNCTION &&
@@ -3156,7 +3160,7 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, zval *object_ptr, uint ch
} else {
if (zend_hash_num_elements(Z_ARRVAL_P(callable)) == 2) {
- if (!obj || (Z_TYPE_PP(obj) != IS_STRING && Z_TYPE_PP(obj) != IS_OBJECT)) {
+ if (!obj || (Z_TYPE_P(obj) != IS_STRING && Z_TYPE_P(obj) != IS_OBJECT)) {
if (error) zend_spprintf(error, 0, "first array member is not a valid class name or object");
} else {
if (error) zend_spprintf(error, 0, "second array member is not a valid method");
@@ -3173,15 +3177,15 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, zval *object_ptr, uint ch
return 0;
case IS_OBJECT:
- if (Z_OBJ_HANDLER_P(callable, get_closure) && Z_OBJ_HANDLER_P(callable, get_closure)(callable, &fcc->calling_scope, &fcc->function_handler, &fcc->object_ptr TSRMLS_CC) == SUCCESS) {
+ if (Z_OBJ_HANDLER_P(callable, get_closure) && Z_OBJ_HANDLER_P(callable, get_closure)(callable, &fcc->calling_scope, &fcc->function_handler, fcc->object_ptr TSRMLS_CC) == SUCCESS) {
fcc->called_scope = fcc->calling_scope;
if (callable_name) {
zend_class_entry *ce = Z_OBJCE_P(callable); /* TBFixed: what if it's overloaded? */
- *callable_name_len = ce->name_length + sizeof("::__invoke") - 1;
+ *callable_name_len = ce->name->len + sizeof("::__invoke") - 1;
*callable_name = emalloc(*callable_name_len + 1);
- memcpy(*callable_name, ce->name, ce->name_length);
- memcpy((*callable_name) + ce->name_length, "::__invoke", sizeof("::__invoke"));
+ memcpy(*callable_name, ce->name, ce->name->len);
+ memcpy((*callable_name) + ce->name->len, "::__invoke", sizeof("::__invoke"));
}
return 1;
}
@@ -3217,8 +3221,8 @@ ZEND_API zend_bool zend_make_callable(zval *callable, char **callable_name TSRML
if (Z_TYPE_P(callable) == IS_STRING && fcc.calling_scope) {
zval_dtor(callable);
array_init(callable);
- add_next_index_string(callable, fcc.calling_scope->name, 1);
- add_next_index_string(callable, fcc.function_handler->common.function_name, 1);
+ add_next_index_str(callable, fcc.calling_scope->name);
+ add_next_index_str(callable, fcc.function_handler->common.function_name);
}
if (fcc.function_handler &&
((fcc.function_handler->type == ZEND_INTERNAL_FUNCTION &&
@@ -3245,8 +3249,8 @@ ZEND_API int zend_fcall_info_init(zval *callable, uint check_flags, zend_fcall_i
fci->size = sizeof(*fci);
fci->function_table = fcc->calling_scope ? &fcc->calling_scope->function_table : EG(function_table);
fci->object_ptr = fcc->object_ptr;
- fci->function_name = callable;
- fci->retval_ptr_ptr = NULL;
+ ZVAL_COPY_VALUE(&fci->function_name, callable);
+ fci->retval = NULL;
fci->param_count = 0;
fci->params = NULL;
fci->no_separation = 1;
@@ -3268,7 +3272,7 @@ ZEND_API void zend_fcall_info_args_clear(zend_fcall_info *fci, int free_mem) /*
}
/* }}} */
-ZEND_API void zend_fcall_info_args_save(zend_fcall_info *fci, int *param_count, zval ****params) /* {{{ */
+ZEND_API void zend_fcall_info_args_save(zend_fcall_info *fci, int *param_count, zval **params) /* {{{ */
{
*param_count = fci->param_count;
*params = fci->params;
@@ -3277,7 +3281,7 @@ ZEND_API void zend_fcall_info_args_save(zend_fcall_info *fci, int *param_count,
}
/* }}} */
-ZEND_API void zend_fcall_info_args_restore(zend_fcall_info *fci, int param_count, zval ***params) /* {{{ */
+ZEND_API void zend_fcall_info_args_restore(zend_fcall_info *fci, int param_count, zval *params) /* {{{ */
{
zend_fcall_info_args_clear(fci, 1);
fci->param_count = param_count;
@@ -3288,7 +3292,7 @@ ZEND_API void zend_fcall_info_args_restore(zend_fcall_info *fci, int param_count
ZEND_API int zend_fcall_info_args(zend_fcall_info *fci, zval *args TSRMLS_DC) /* {{{ */
{
HashPosition pos;
- zval **arg, ***params;
+ zval *arg, *params;
zend_fcall_info_args_clear(fci, !args);
@@ -3301,11 +3305,12 @@ ZEND_API int zend_fcall_info_args(zend_fcall_info *fci, zval *args TSRMLS_DC) /*
}
fci->param_count = zend_hash_num_elements(Z_ARRVAL_P(args));
- fci->params = params = (zval ***) erealloc(fci->params, fci->param_count * sizeof(zval **));
+ fci->params = params = (zval *) erealloc(fci->params, fci->param_count * sizeof(zval));
zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(args), &pos);
- while (zend_hash_get_current_data_ex(Z_ARRVAL_P(args), (void *) &arg, &pos) == SUCCESS) {
- *params++ = arg;
+ while ((arg = zend_hash_get_current_data_ex(Z_ARRVAL_P(args), &pos)) != NULL) {
+ ZVAL_COPY_VALUE(params, arg);
+ params++;
zend_hash_move_forward_ex(Z_ARRVAL_P(args), &pos);
}
@@ -3313,7 +3318,7 @@ ZEND_API int zend_fcall_info_args(zend_fcall_info *fci, zval *args TSRMLS_DC) /*
}
/* }}} */
-ZEND_API int zend_fcall_info_argp(zend_fcall_info *fci TSRMLS_DC, int argc, zval ***argv) /* {{{ */
+ZEND_API int zend_fcall_info_argp(zend_fcall_info *fci TSRMLS_DC, int argc, zval *argv) /* {{{ */
{
int i;
@@ -3325,10 +3330,10 @@ ZEND_API int zend_fcall_info_argp(zend_fcall_info *fci TSRMLS_DC, int argc, zval
if (argc) {
fci->param_count = argc;
- fci->params = (zval ***) erealloc(fci->params, fci->param_count * sizeof(zval **));
+ fci->params = (zval *) erealloc(fci->params, fci->param_count * sizeof(zval));
for (i = 0; i < argc; ++i) {
- fci->params[i] = argv[i];
+ ZVAL_COPY_VALUE(&fci->params[i], &argv[i]);
}
}
@@ -3339,7 +3344,7 @@ ZEND_API int zend_fcall_info_argp(zend_fcall_info *fci TSRMLS_DC, int argc, zval
ZEND_API int zend_fcall_info_argv(zend_fcall_info *fci TSRMLS_DC, int argc, va_list *argv) /* {{{ */
{
int i;
- zval **arg;
+ zval *arg;
if (argc < 0) {
return FAILURE;
@@ -3349,11 +3354,11 @@ ZEND_API int zend_fcall_info_argv(zend_fcall_info *fci TSRMLS_DC, int argc, va_l
if (argc) {
fci->param_count = argc;
- fci->params = (zval ***) erealloc(fci->params, fci->param_count * sizeof(zval **));
+ fci->params = (zval *) erealloc(fci->params, fci->param_count * sizeof(zval));
for (i = 0; i < argc; ++i) {
- arg = va_arg(*argv, zval **);
- fci->params[i] = arg;
+ arg = va_arg(*argv, zval *);
+ ZVAL_COPY_VALUE(&fci->params[i], arg);
}
}
@@ -3374,19 +3379,19 @@ ZEND_API int zend_fcall_info_argn(zend_fcall_info *fci TSRMLS_DC, int argc, ...)
}
/* }}} */
-ZEND_API int zend_fcall_info_call(zend_fcall_info *fci, zend_fcall_info_cache *fcc, zval **retval_ptr_ptr, zval *args TSRMLS_DC) /* {{{ */
+ZEND_API int zend_fcall_info_call(zend_fcall_info *fci, zend_fcall_info_cache *fcc, zval *retval_ptr, zval *args TSRMLS_DC) /* {{{ */
{
- zval *retval, ***org_params = NULL;
+ zval retval, *org_params = NULL;
int result, org_count = 0;
- fci->retval_ptr_ptr = retval_ptr_ptr ? retval_ptr_ptr : &retval;
+ fci->retval = retval_ptr ? retval_ptr : &retval;
if (args) {
zend_fcall_info_args_save(fci, &org_count, &org_params);
zend_fcall_info_args(fci, args TSRMLS_CC);
}
result = zend_call_function(fci, fcc TSRMLS_CC);
- if (!retval_ptr_ptr && retval) {
+ if (!retval_ptr && Z_TYPE(retval) != IS_UNDEF) {
zval_ptr_dtor(&retval);
}
if (args) {
@@ -3398,54 +3403,50 @@ ZEND_API int zend_fcall_info_call(zend_fcall_info *fci, zend_fcall_info_cache *f
ZEND_API const char *zend_get_module_version(const char *module_name) /* {{{ */
{
- char *lname;
+ zend_string *lname;
int name_len = strlen(module_name);
zend_module_entry *module;
- lname = zend_str_tolower_dup(module_name, name_len);
- if (zend_hash_find(&module_registry, lname, name_len + 1, (void**)&module) == FAILURE) {
- efree(lname);
- return NULL;
- }
- efree(lname);
- return module->version;
+ lname = STR_ALLOC(name_len, 0);
+ zend_str_tolower_copy(lname->val, module_name, name_len);
+ module = zend_hash_find_ptr(&module_registry, lname);
+ STR_FREE(lname);
+ return module ? module->version : NULL;
}
/* }}} */
-ZEND_API int zend_declare_property_ex(zend_class_entry *ce, const char *name, int name_length, zval *property, int access_type, const char *doc_comment, int doc_comment_len TSRMLS_DC) /* {{{ */
+ZEND_API int zend_declare_property_ex(zend_class_entry *ce, zend_string *name, zval *property, int access_type, zend_string *doc_comment TSRMLS_DC) /* {{{ */
{
zend_property_info property_info, *property_info_ptr;
- const char *interned_name;
- ulong h = zend_get_hash_value(name, name_length+1);
if (!(access_type & ZEND_ACC_PPP_MASK)) {
access_type |= ZEND_ACC_PUBLIC;
}
if (access_type & ZEND_ACC_STATIC) {
- if (zend_hash_quick_find(&ce->properties_info, name, name_length + 1, h, (void**)&property_info_ptr) == SUCCESS &&
+ if ((property_info_ptr = zend_hash_find_ptr(&ce->properties_info, name)) != NULL &&
(property_info_ptr->flags & ZEND_ACC_STATIC) != 0) {
property_info.offset = property_info_ptr->offset;
zval_ptr_dtor(&ce->default_static_members_table[property_info.offset]);
- zend_hash_quick_del(&ce->properties_info, name, name_length + 1, h);
+ zend_hash_del(&ce->properties_info, name);
} else {
property_info.offset = ce->default_static_members_count++;
- ce->default_static_members_table = perealloc(ce->default_static_members_table, sizeof(zval*) * ce->default_static_members_count, ce->type == ZEND_INTERNAL_CLASS);
+ ce->default_static_members_table = perealloc(ce->default_static_members_table, sizeof(zval) * ce->default_static_members_count, ce->type == ZEND_INTERNAL_CLASS);
}
- ce->default_static_members_table[property_info.offset] = property;
+ ZVAL_COPY_VALUE(&ce->default_static_members_table[property_info.offset], property);
if (ce->type == ZEND_USER_CLASS) {
ce->static_members_table = ce->default_static_members_table;
}
} else {
- if (zend_hash_quick_find(&ce->properties_info, name, name_length + 1, h, (void**)&property_info_ptr) == SUCCESS &&
+ if ((property_info_ptr = zend_hash_find_ptr(&ce->properties_info, name)) != NULL &&
(property_info_ptr->flags & ZEND_ACC_STATIC) == 0) {
property_info.offset = property_info_ptr->offset;
zval_ptr_dtor(&ce->default_properties_table[property_info.offset]);
- zend_hash_quick_del(&ce->properties_info, name, name_length + 1, h);
+ zend_hash_del(&ce->properties_info, name);
} else {
property_info.offset = ce->default_properties_count++;
- ce->default_properties_table = perealloc(ce->default_properties_table, sizeof(zval*) * ce->default_properties_count, ce->type == ZEND_INTERNAL_CLASS);
+ ce->default_properties_table = perealloc(ce->default_properties_table, sizeof(zval) * ce->default_properties_count, ce->type == ZEND_INTERNAL_CLASS);
}
- ce->default_properties_table[property_info.offset] = property;
+ ZVAL_COPY_VALUE(&ce->default_properties_table[property_info.offset], property);
}
if (ce->type & ZEND_INTERNAL_CLASS) {
switch(Z_TYPE_P(property)) {
@@ -3464,49 +3465,32 @@ ZEND_API int zend_declare_property_ex(zend_class_entry *ce, const char *name, in
char *priv_name;
int priv_name_length;
- zend_mangle_property_name(&priv_name, &priv_name_length, ce->name, ce->name_length, name, name_length, ce->type & ZEND_INTERNAL_CLASS);
- property_info.name = priv_name;
- property_info.name_length = priv_name_length;
+ zend_mangle_property_name(&priv_name, &priv_name_length, ce->name->val, ce->name->len, name->val, name->len, ce->type & ZEND_INTERNAL_CLASS);
+ property_info.name = STR_INIT(priv_name, priv_name_length, ce->type & ZEND_INTERNAL_CLASS);
}
break;
case ZEND_ACC_PROTECTED: {
char *prot_name;
int prot_name_length;
- zend_mangle_property_name(&prot_name, &prot_name_length, "*", 1, name, name_length, ce->type & ZEND_INTERNAL_CLASS);
- property_info.name = prot_name;
- property_info.name_length = prot_name_length;
+ zend_mangle_property_name(&prot_name, &prot_name_length, "*", 1, name->val, name->len, ce->type & ZEND_INTERNAL_CLASS);
+ property_info.name = STR_INIT(prot_name, prot_name_length, ce->type & ZEND_INTERNAL_CLASS);
}
break;
case ZEND_ACC_PUBLIC:
- if (IS_INTERNED(name)) {
- property_info.name = (char*)name;
- } else {
- property_info.name = ce->type & ZEND_INTERNAL_CLASS ? zend_strndup(name, name_length) : estrndup(name, name_length);
- }
- property_info.name_length = name_length;
+ property_info.name = STR_COPY(name);
break;
}
- interned_name = zend_new_interned_string(property_info.name, property_info.name_length+1, 0 TSRMLS_CC);
- if (interned_name != property_info.name) {
- if (ce->type == ZEND_USER_CLASS) {
- efree((char*)property_info.name);
- } else {
- free((char*)property_info.name);
- }
- property_info.name = interned_name;
- }
+ property_info.name = zend_new_interned_string(property_info.name TSRMLS_CC);
property_info.flags = access_type;
- property_info.h = (access_type & ZEND_ACC_PUBLIC) ? h : zend_get_hash_value(property_info.name, property_info.name_length+1);
- property_info.doc_comment = doc_comment;
- property_info.doc_comment_len = doc_comment_len;
+ property_info.doc_comment = doc_comment ? STR_COPY(doc_comment) : NULL;
property_info.ce = ce;
- zend_hash_quick_update(&ce->properties_info, name, name_length+1, h, &property_info, sizeof(zend_property_info), NULL);
+ zend_hash_update_mem(&ce->properties_info, name, &property_info, sizeof(zend_property_info));
return SUCCESS;
}
@@ -3514,181 +3498,116 @@ ZEND_API int zend_declare_property_ex(zend_class_entry *ce, const char *name, in
ZEND_API int zend_declare_property(zend_class_entry *ce, const char *name, int name_length, zval *property, int access_type TSRMLS_DC) /* {{{ */
{
- return zend_declare_property_ex(ce, name, name_length, property, access_type, NULL, 0 TSRMLS_CC);
+ zend_string *key = STR_INIT(name, name_length, ce->type & ZEND_INTERNAL_CLASS);
+ int ret = zend_declare_property_ex(ce, key, property, access_type, NULL TSRMLS_CC);
+ STR_RELEASE(key);
+ return ret;
}
/* }}} */
ZEND_API int zend_declare_property_null(zend_class_entry *ce, const char *name, int name_length, int access_type TSRMLS_DC) /* {{{ */
{
- zval *property;
+ zval property;
- if (ce->type & ZEND_INTERNAL_CLASS) {
- ALLOC_PERMANENT_ZVAL(property);
- } else {
- ALLOC_ZVAL(property);
- }
- INIT_ZVAL(*property);
- return zend_declare_property(ce, name, name_length, property, access_type TSRMLS_CC);
+ ZVAL_NULL(&property);
+ return zend_declare_property(ce, name, name_length, &property, access_type TSRMLS_CC);
}
/* }}} */
ZEND_API int zend_declare_property_bool(zend_class_entry *ce, const char *name, int name_length, long value, int access_type TSRMLS_DC) /* {{{ */
{
- zval *property;
+ zval property;
- if (ce->type & ZEND_INTERNAL_CLASS) {
- ALLOC_PERMANENT_ZVAL(property);
- } else {
- ALLOC_ZVAL(property);
- }
- INIT_PZVAL(property);
- ZVAL_BOOL(property, value);
- return zend_declare_property(ce, name, name_length, property, access_type TSRMLS_CC);
+ ZVAL_BOOL(&property, value);
+ return zend_declare_property(ce, name, name_length, &property, access_type TSRMLS_CC);
}
/* }}} */
ZEND_API int zend_declare_property_long(zend_class_entry *ce, const char *name, int name_length, long value, int access_type TSRMLS_DC) /* {{{ */
{
- zval *property;
+ zval property;
- if (ce->type & ZEND_INTERNAL_CLASS) {
- ALLOC_PERMANENT_ZVAL(property);
- } else {
- ALLOC_ZVAL(property);
- }
- INIT_PZVAL(property);
- ZVAL_LONG(property, value);
- return zend_declare_property(ce, name, name_length, property, access_type TSRMLS_CC);
+ ZVAL_LONG(&property, value);
+ return zend_declare_property(ce, name, name_length, &property, access_type TSRMLS_CC);
}
/* }}} */
ZEND_API int zend_declare_property_double(zend_class_entry *ce, const char *name, int name_length, double value, int access_type TSRMLS_DC) /* {{{ */
{
- zval *property;
+ zval property;
- if (ce->type & ZEND_INTERNAL_CLASS) {
- ALLOC_PERMANENT_ZVAL(property);
- } else {
- ALLOC_ZVAL(property);
- }
- INIT_PZVAL(property);
- ZVAL_DOUBLE(property, value);
- return zend_declare_property(ce, name, name_length, property, access_type TSRMLS_CC);
+ ZVAL_DOUBLE(&property, value);
+ return zend_declare_property(ce, name, name_length, &property, access_type TSRMLS_CC);
}
/* }}} */
ZEND_API int zend_declare_property_string(zend_class_entry *ce, const char *name, int name_length, const char *value, int access_type TSRMLS_DC) /* {{{ */
{
- zval *property;
- int len = strlen(value);
+ zval property;
- if (ce->type & ZEND_INTERNAL_CLASS) {
- ALLOC_PERMANENT_ZVAL(property);
- ZVAL_STRINGL(property, zend_strndup(value, len), len, 0);
- } else {
- ALLOC_ZVAL(property);
- ZVAL_STRINGL(property, value, len, 1);
- }
- INIT_PZVAL(property);
- return zend_declare_property(ce, name, name_length, property, access_type TSRMLS_CC);
+ ZVAL_STR(&property, STR_INIT(value, strlen(value), ce->type & ZEND_INTERNAL_CLASS));
+ return zend_declare_property(ce, name, name_length, &property, access_type TSRMLS_CC);
}
/* }}} */
ZEND_API int zend_declare_property_stringl(zend_class_entry *ce, const char *name, int name_length, const char *value, int value_len, int access_type TSRMLS_DC) /* {{{ */
{
- zval *property;
+ zval property;
- if (ce->type & ZEND_INTERNAL_CLASS) {
- ALLOC_PERMANENT_ZVAL(property);
- ZVAL_STRINGL(property, zend_strndup(value, value_len), value_len, 0);
- } else {
- ALLOC_ZVAL(property);
- ZVAL_STRINGL(property, value, value_len, 1);
- }
- INIT_PZVAL(property);
- return zend_declare_property(ce, name, name_length, property, access_type TSRMLS_CC);
+ ZVAL_STR(&property, STR_INIT(value, value_len, ce->type & ZEND_INTERNAL_CLASS));
+ return zend_declare_property(ce, name, name_length, &property, access_type TSRMLS_CC);
}
/* }}} */
ZEND_API int zend_declare_class_constant(zend_class_entry *ce, const char *name, size_t name_length, zval *value TSRMLS_DC) /* {{{ */
{
- return zend_hash_update(&ce->constants_table, name, name_length+1, &value, sizeof(zval *), NULL);
+ return zend_hash_str_update(&ce->constants_table, name, name_length, value) ?
+ SUCCESS : FAILURE;
}
/* }}} */
ZEND_API int zend_declare_class_constant_null(zend_class_entry *ce, const char *name, size_t name_length TSRMLS_DC) /* {{{ */
{
- zval *constant;
+ zval constant;
- if (ce->type & ZEND_INTERNAL_CLASS) {
- ALLOC_PERMANENT_ZVAL(constant);
- } else {
- ALLOC_ZVAL(constant);
- }
- ZVAL_NULL(constant);
- INIT_PZVAL(constant);
- return zend_declare_class_constant(ce, name, name_length, constant TSRMLS_CC);
+ ZVAL_NULL(&constant);
+ return zend_declare_class_constant(ce, name, name_length, &constant TSRMLS_CC);
}
/* }}} */
ZEND_API int zend_declare_class_constant_long(zend_class_entry *ce, const char *name, size_t name_length, long value TSRMLS_DC) /* {{{ */
{
- zval *constant;
+ zval constant;
- if (ce->type & ZEND_INTERNAL_CLASS) {
- ALLOC_PERMANENT_ZVAL(constant);
- } else {
- ALLOC_ZVAL(constant);
- }
- ZVAL_LONG(constant, value);
- INIT_PZVAL(constant);
- return zend_declare_class_constant(ce, name, name_length, constant TSRMLS_CC);
+ ZVAL_LONG(&constant, value);
+ return zend_declare_class_constant(ce, name, name_length, &constant TSRMLS_CC);
}
/* }}} */
ZEND_API int zend_declare_class_constant_bool(zend_class_entry *ce, const char *name, size_t name_length, zend_bool value TSRMLS_DC) /* {{{ */
{
- zval *constant;
+ zval constant;
- if (ce->type & ZEND_INTERNAL_CLASS) {
- ALLOC_PERMANENT_ZVAL(constant);
- } else {
- ALLOC_ZVAL(constant);
- }
- ZVAL_BOOL(constant, value);
- INIT_PZVAL(constant);
- return zend_declare_class_constant(ce, name, name_length, constant TSRMLS_CC);
+ ZVAL_BOOL(&constant, value);
+ return zend_declare_class_constant(ce, name, name_length, &constant TSRMLS_CC);
}
/* }}} */
ZEND_API int zend_declare_class_constant_double(zend_class_entry *ce, const char *name, size_t name_length, double value TSRMLS_DC) /* {{{ */
{
- zval *constant;
+ zval constant;
- if (ce->type & ZEND_INTERNAL_CLASS) {
- ALLOC_PERMANENT_ZVAL(constant);
- } else {
- ALLOC_ZVAL(constant);
- }
- ZVAL_DOUBLE(constant, value);
- INIT_PZVAL(constant);
- return zend_declare_class_constant(ce, name, name_length, constant TSRMLS_CC);
+ ZVAL_DOUBLE(&constant, value);
+ return zend_declare_class_constant(ce, name, name_length, &constant TSRMLS_CC);
}
/* }}} */
ZEND_API int zend_declare_class_constant_stringl(zend_class_entry *ce, const char *name, size_t name_length, const char *value, size_t value_length TSRMLS_DC) /* {{{ */
{
- zval *constant;
+ zval constant;
- if (ce->type & ZEND_INTERNAL_CLASS) {
- ALLOC_PERMANENT_ZVAL(constant);
- ZVAL_STRINGL(constant, zend_strndup(value, value_length), value_length, 0);
- } else {
- ALLOC_ZVAL(constant);
- ZVAL_STRINGL(constant, value, value_length, 1);
- }
- INIT_PZVAL(constant);
- return zend_declare_class_constant(ce, name, name_length, constant TSRMLS_CC);
+ ZVAL_STR(&constant, STR_INIT(value, value_length, ce->type & ZEND_INTERNAL_CLASS));
+ return zend_declare_class_constant(ce, name, name_length, &constant TSRMLS_CC);
}
/* }}} */
@@ -3700,22 +3619,17 @@ ZEND_API int zend_declare_class_constant_string(zend_class_entry *ce, const char
ZEND_API void zend_update_property(zend_class_entry *scope, zval *object, const char *name, int name_length, zval *value TSRMLS_DC) /* {{{ */
{
- zval *property;
+ zval property;
zend_class_entry *old_scope = EG(scope);
EG(scope) = scope;
if (!Z_OBJ_HT_P(object)->write_property) {
- const char *class_name;
- zend_uint class_name_len;
-
- zend_get_object_classname(object, &class_name, &class_name_len TSRMLS_CC);
-
- zend_error(E_CORE_ERROR, "Property %s of class %s cannot be updated", name, class_name);
+ zend_string *class_name = zend_get_object_classname(object TSRMLS_CC);
+ zend_error(E_CORE_ERROR, "Property %s of class %s cannot be updated", name, class_name->val);
}
- MAKE_STD_ZVAL(property);
- ZVAL_STRINGL(property, name, name_length, 1);
- Z_OBJ_HT_P(object)->write_property(object, property, value, 0 TSRMLS_CC);
+ ZVAL_STRINGL(&property, name, name_length);
+ Z_OBJ_HT_P(object)->write_property(object, &property, value, 0 TSRMLS_CC);
zval_ptr_dtor(&property);
EG(scope) = old_scope;
@@ -3724,105 +3638,91 @@ ZEND_API void zend_update_property(zend_class_entry *scope, zval *object, const
ZEND_API void zend_update_property_null(zend_class_entry *scope, zval *object, const char *name, int name_length TSRMLS_DC) /* {{{ */
{
- zval *tmp;
+ zval tmp;
- ALLOC_ZVAL(tmp);
- Z_UNSET_ISREF_P(tmp);
- Z_SET_REFCOUNT_P(tmp, 0);
- ZVAL_NULL(tmp);
- zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC);
+ ZVAL_NULL(&tmp);
+ zend_update_property(scope, object, name, name_length, &tmp TSRMLS_CC);
}
/* }}} */
ZEND_API void zend_update_property_bool(zend_class_entry *scope, zval *object, const char *name, int name_length, long value TSRMLS_DC) /* {{{ */
{
- zval *tmp;
+ zval tmp;
- ALLOC_ZVAL(tmp);
- Z_UNSET_ISREF_P(tmp);
- Z_SET_REFCOUNT_P(tmp, 0);
- ZVAL_BOOL(tmp, value);
- zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC);
+ ZVAL_BOOL(&tmp, value);
+ zend_update_property(scope, object, name, name_length, &tmp TSRMLS_CC);
}
/* }}} */
ZEND_API void zend_update_property_long(zend_class_entry *scope, zval *object, const char *name, int name_length, long value TSRMLS_DC) /* {{{ */
{
- zval *tmp;
+ zval tmp;
- ALLOC_ZVAL(tmp);
- Z_UNSET_ISREF_P(tmp);
- Z_SET_REFCOUNT_P(tmp, 0);
- ZVAL_LONG(tmp, value);
- zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC);
+ ZVAL_LONG(&tmp, value);
+ zend_update_property(scope, object, name, name_length, &tmp TSRMLS_CC);
}
/* }}} */
ZEND_API void zend_update_property_double(zend_class_entry *scope, zval *object, const char *name, int name_length, double value TSRMLS_DC) /* {{{ */
{
- zval *tmp;
+ zval tmp;
- ALLOC_ZVAL(tmp);
- Z_UNSET_ISREF_P(tmp);
- Z_SET_REFCOUNT_P(tmp, 0);
- ZVAL_DOUBLE(tmp, value);
- zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC);
+ ZVAL_DOUBLE(&tmp, value);
+ zend_update_property(scope, object, name, name_length, &tmp TSRMLS_CC);
}
/* }}} */
ZEND_API void zend_update_property_string(zend_class_entry *scope, zval *object, const char *name, int name_length, const char *value TSRMLS_DC) /* {{{ */
{
- zval *tmp;
+ zval tmp;
- ALLOC_ZVAL(tmp);
- Z_UNSET_ISREF_P(tmp);
- Z_SET_REFCOUNT_P(tmp, 0);
- ZVAL_STRING(tmp, value, 1);
- zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC);
+ ZVAL_STRING(&tmp, value);
+ Z_SET_REFCOUNT(tmp, 0);
+ zend_update_property(scope, object, name, name_length, &tmp TSRMLS_CC);
}
/* }}} */
ZEND_API void zend_update_property_stringl(zend_class_entry *scope, zval *object, const char *name, int name_length, const char *value, int value_len TSRMLS_DC) /* {{{ */
{
- zval *tmp;
+ zval tmp;
- ALLOC_ZVAL(tmp);
- Z_UNSET_ISREF_P(tmp);
- Z_SET_REFCOUNT_P(tmp, 0);
- ZVAL_STRINGL(tmp, value, value_len, 1);
- zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC);
+ ZVAL_STRINGL(&tmp, value, value_len);
+ Z_SET_REFCOUNT(tmp, 0);
+ zend_update_property(scope, object, name, name_length, &tmp TSRMLS_CC);
}
/* }}} */
ZEND_API int zend_update_static_property(zend_class_entry *scope, const char *name, int name_length, zval *value TSRMLS_DC) /* {{{ */
{
- zval **property;
+ zval *property;
zend_class_entry *old_scope = EG(scope);
+ zend_string *key = STR_INIT(name, name_length, 0);
EG(scope) = scope;
- property = zend_std_get_static_property(scope, name, name_length, 0, NULL TSRMLS_CC);
+ property = zend_std_get_static_property(scope, key, 0, NULL TSRMLS_CC);
EG(scope) = old_scope;
+ STR_FREE(key);
if (!property) {
return FAILURE;
} else {
- if (*property != value) {
- if (PZVAL_IS_REF(*property)) {
- zval_dtor(*property);
- Z_TYPE_PP(property) = Z_TYPE_P(value);
- (*property)->value = value->value;
+ if (property != value) {
+ if (Z_ISREF_P(property)) {
+ zval_dtor(property);
+ ZVAL_COPY_VALUE(property, value);
if (Z_REFCOUNT_P(value) > 0) {
- zval_copy_ctor(*property);
+ zval_copy_ctor(property);
} else {
- efree(value);
+//??? efree(value);
}
} else {
- zval *garbage = *property;
+ zval garbage;
+ ZVAL_COPY_VALUE(&garbage, property);
Z_ADDREF_P(value);
- if (PZVAL_IS_REF(value)) {
- SEPARATE_ZVAL(&value);
+ if (Z_ISREF_P(value)) {
+ SEPARATE_ZVAL(value);
}
- *property = value;
+ ZVAL_COPY_VALUE(property, value);
zval_ptr_dtor(&garbage);
}
}
@@ -3833,94 +3733,74 @@ ZEND_API int zend_update_static_property(zend_class_entry *scope, const char *na
ZEND_API int zend_update_static_property_null(zend_class_entry *scope, const char *name, int name_length TSRMLS_DC) /* {{{ */
{
- zval *tmp;
-
- ALLOC_ZVAL(tmp);
- Z_UNSET_ISREF_P(tmp);
- Z_SET_REFCOUNT_P(tmp, 0);
- ZVAL_NULL(tmp);
- return zend_update_static_property(scope, name, name_length, tmp TSRMLS_CC);
+ zval tmp;
+
+ ZVAL_NULL(&tmp);
+ return zend_update_static_property(scope, name, name_length, &tmp TSRMLS_CC);
}
/* }}} */
ZEND_API int zend_update_static_property_bool(zend_class_entry *scope, const char *name, int name_length, long value TSRMLS_DC) /* {{{ */
{
- zval *tmp;
+ zval tmp;
- ALLOC_ZVAL(tmp);
- Z_UNSET_ISREF_P(tmp);
- Z_SET_REFCOUNT_P(tmp, 0);
- ZVAL_BOOL(tmp, value);
- return zend_update_static_property(scope, name, name_length, tmp TSRMLS_CC);
+ ZVAL_BOOL(&tmp, value);
+ return zend_update_static_property(scope, name, name_length, &tmp TSRMLS_CC);
}
/* }}} */
ZEND_API int zend_update_static_property_long(zend_class_entry *scope, const char *name, int name_length, long value TSRMLS_DC) /* {{{ */
{
- zval *tmp;
+ zval tmp;
- ALLOC_ZVAL(tmp);
- Z_UNSET_ISREF_P(tmp);
- Z_SET_REFCOUNT_P(tmp, 0);
- ZVAL_LONG(tmp, value);
- return zend_update_static_property(scope, name, name_length, tmp TSRMLS_CC);
+ ZVAL_LONG(&tmp, value);
+ return zend_update_static_property(scope, name, name_length, &tmp TSRMLS_CC);
}
/* }}} */
ZEND_API int zend_update_static_property_double(zend_class_entry *scope, const char *name, int name_length, double value TSRMLS_DC) /* {{{ */
{
- zval *tmp;
+ zval tmp;
- ALLOC_ZVAL(tmp);
- Z_UNSET_ISREF_P(tmp);
- Z_SET_REFCOUNT_P(tmp, 0);
- ZVAL_DOUBLE(tmp, value);
- return zend_update_static_property(scope, name, name_length, tmp TSRMLS_CC);
+ ZVAL_DOUBLE(&tmp, value);
+ return zend_update_static_property(scope, name, name_length, &tmp TSRMLS_CC);
}
/* }}} */
ZEND_API int zend_update_static_property_string(zend_class_entry *scope, const char *name, int name_length, const char *value TSRMLS_DC) /* {{{ */
{
- zval *tmp;
+ zval tmp;
- ALLOC_ZVAL(tmp);
- Z_UNSET_ISREF_P(tmp);
- Z_SET_REFCOUNT_P(tmp, 0);
- ZVAL_STRING(tmp, value, 1);
- return zend_update_static_property(scope, name, name_length, tmp TSRMLS_CC);
+ ZVAL_STRING(&tmp, value);
+ Z_SET_REFCOUNT(tmp, 0);
+ return zend_update_static_property(scope, name, name_length, &tmp TSRMLS_CC);
}
/* }}} */
ZEND_API int zend_update_static_property_stringl(zend_class_entry *scope, const char *name, int name_length, const char *value, int value_len TSRMLS_DC) /* {{{ */
{
- zval *tmp;
+ zval tmp;
- ALLOC_ZVAL(tmp);
- Z_UNSET_ISREF_P(tmp);
- Z_SET_REFCOUNT_P(tmp, 0);
- ZVAL_STRINGL(tmp, value, value_len, 1);
- return zend_update_static_property(scope, name, name_length, tmp TSRMLS_CC);
+ ZVAL_STRINGL(&tmp, value, value_len);
+ Z_SET_REFCOUNT(tmp, 0);
+ return zend_update_static_property(scope, name, name_length, &tmp TSRMLS_CC);
}
/* }}} */
ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, const char *name, int name_length, zend_bool silent TSRMLS_DC) /* {{{ */
{
- zval *property, *value;
+ zval property, *value;
zend_class_entry *old_scope = EG(scope);
EG(scope) = scope;
if (!Z_OBJ_HT_P(object)->read_property) {
- const char *class_name;
- zend_uint class_name_len;
-
- zend_get_object_classname(object, &class_name, &class_name_len TSRMLS_CC);
- zend_error(E_CORE_ERROR, "Property %s of class %s cannot be read", name, class_name);
+ zend_string *class_name = zend_get_object_classname(object TSRMLS_CC);
+ zend_error(E_CORE_ERROR, "Property %s of class %s cannot be read", name, class_name->val);
}
- MAKE_STD_ZVAL(property);
- ZVAL_STRINGL(property, name, name_length, 1);
- value = Z_OBJ_HT_P(object)->read_property(object, property, silent?BP_VAR_IS:BP_VAR_R, 0 TSRMLS_CC);
+ ZVAL_STRINGL(&property, name, name_length);
+ value = Z_OBJ_HT_P(object)->read_property(object, &property, silent?BP_VAR_IS:BP_VAR_R, 0 TSRMLS_CC);
zval_ptr_dtor(&property);
EG(scope) = old_scope;
@@ -3930,14 +3810,16 @@ ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, const c
ZEND_API zval *zend_read_static_property(zend_class_entry *scope, const char *name, int name_length, zend_bool silent TSRMLS_DC) /* {{{ */
{
- zval **property;
+ zval *property;
zend_class_entry *old_scope = EG(scope);
+ zend_string *key = STR_INIT(name, name_length, 0);
EG(scope) = scope;
- property = zend_std_get_static_property(scope, name, name_length, silent, NULL TSRMLS_CC);
+ property = zend_std_get_static_property(scope, key, silent, NULL TSRMLS_CC);
EG(scope) = old_scope;
+ STR_FREE(key);
- return property?*property:NULL;
+ return property;
}
/* }}} */
@@ -3945,10 +3827,7 @@ ZEND_API void zend_save_error_handling(zend_error_handling *current TSRMLS_DC) /
{
current->handling = EG(error_handling);
current->exception = EG(exception_class);
- current->user_handler = EG(user_error_handler);
- if (current->user_handler) {
- Z_ADDREF_P(current->user_handler);
- }
+ ZVAL_COPY(&current->user_handler, &EG(user_error_handler));
}
/* }}} */
@@ -3956,9 +3835,9 @@ ZEND_API void zend_replace_error_handling(zend_error_handling_t error_handling,
{
if (current) {
zend_save_error_handling(current TSRMLS_CC);
- if (error_handling != EH_NORMAL && EG(user_error_handler)) {
+ if (error_handling != EH_NORMAL && Z_TYPE(EG(user_error_handler)) != IS_UNDEF) {
zval_ptr_dtor(&EG(user_error_handler));
- EG(user_error_handler) = NULL;
+ ZVAL_UNDEF(&EG(user_error_handler));
}
}
EG(error_handling) = error_handling;
@@ -3970,27 +3849,26 @@ ZEND_API void zend_restore_error_handling(zend_error_handling *saved TSRMLS_DC)
{
EG(error_handling) = saved->handling;
EG(exception_class) = saved->handling == EH_THROW ? saved->exception : NULL;
- if (saved->user_handler && saved->user_handler != EG(user_error_handler)) {
- if (EG(user_error_handler)) {
- zval_ptr_dtor(&EG(user_error_handler));
- }
- EG(user_error_handler) = saved->user_handler;
- } else if (saved->user_handler) {
- zval_ptr_dtor(&saved->user_handler);
+ if (Z_TYPE(saved->user_handler) != IS_UNDEF) {
+//??? && saved->user_handler != EG(user_error_handler)) {
+ zval_ptr_dtor(&EG(user_error_handler));
+ ZVAL_COPY_VALUE(&EG(user_error_handler), &saved->user_handler);
+//??? } else if (saved->user_handler) {
+//??? zval_ptr_dtor(&saved->user_handler);
}
- saved->user_handler = NULL;
+ ZVAL_UNDEF(&saved->user_handler);
}
/* }}} */
-ZEND_API const char* zend_find_alias_name(zend_class_entry *ce, const char *name, zend_uint len) /* {{{ */
+ZEND_API zend_string* zend_find_alias_name(zend_class_entry *ce, zend_string *name) /* {{{ */
{
zend_trait_alias *alias, **alias_ptr;
if ((alias_ptr = ce->trait_aliases)) {
alias = *alias_ptr;
while (alias) {
- if (alias->alias_len == len &&
- !strncasecmp(name, alias->alias, alias->alias_len)) {
+ if (alias->alias->len == name->len &&
+ !strncasecmp(name->val, alias->alias->val, alias->alias->len)) {
return alias->alias;
}
alias_ptr++;
@@ -4002,7 +3880,7 @@ ZEND_API const char* zend_find_alias_name(zend_class_entry *ce, const char *name
}
/* }}} */
-ZEND_API const char* zend_resolve_method_name(zend_class_entry *ce, zend_function *f) /* {{{ */
+ZEND_API zend_string *zend_resolve_method_name(zend_class_entry *ce, zend_function *f) /* {{{ */
{
zend_function *func;
HashPosition iterator;
@@ -4017,21 +3895,19 @@ ZEND_API const char* zend_resolve_method_name(zend_class_entry *ce, zend_functio
function_table = &ce->function_table;
zend_hash_internal_pointer_reset_ex(function_table, &iterator);
- while (zend_hash_get_current_data_ex(function_table, (void **)&func, &iterator) == SUCCESS) {
+ while ((func = zend_hash_get_current_data_ptr_ex(function_table, &iterator)) != NULL) {
if (func == f) {
- char *name;
- uint len;
+ zend_string *name;
ulong idx;
- if (zend_hash_get_current_key_ex(function_table, &name, &len, &idx, 0, &iterator) != HASH_KEY_IS_STRING) {
+ if (zend_hash_get_current_key_ex(function_table, &name, &idx, 0, &iterator) != HASH_KEY_IS_STRING) {
return f->common.function_name;
}
- --len;
- if (len == strlen(f->common.function_name) &&
- !strncasecmp(name, f->common.function_name, len)) {
+ if (name->len == f->common.function_name->len &&
+ !strncasecmp(name->val, f->common.function_name->val, f->common.function_name->len)) {
return f->common.function_name;
}
- return zend_find_alias_name(f->common.scope, name, len);
+ return zend_find_alias_name(f->common.scope, name);
}
zend_hash_move_forward_ex(function_table, &iterator);
}
diff --git a/Zend/zend_API.h b/Zend/zend_API.h
index 569407b19a..37c112cd9c 100644
--- a/Zend/zend_API.h
+++ b/Zend/zend_API.h
@@ -43,11 +43,11 @@ typedef struct _zend_function_entry {
typedef struct _zend_fcall_info {
size_t size;
HashTable *function_table;
- zval *function_name;
+ zval function_name;
HashTable *symbol_table;
- zval **retval_ptr_ptr;
+ zval *retval;
zend_uint param_count;
- zval ***params;
+ zval *params;
zval *object_ptr;
zend_bool no_separation;
} zend_fcall_info;
@@ -170,13 +170,9 @@ typedef struct _zend_fcall_info_cache {
#define INIT_OVERLOADED_CLASS_ENTRY_EX(class_container, class_name, class_name_len, functions, handle_fcall, handle_propget, handle_propset, handle_propunset, handle_propisset) \
{ \
- const char *cl_name = class_name; \
- int _len = class_name_len; \
- class_container.name = zend_new_interned_string(cl_name, _len+1, 0 TSRMLS_CC); \
- if (class_container.name == cl_name) { \
- class_container.name = zend_strndup(cl_name, _len); \
- } \
- class_container.name_length = _len; \
+ zend_string *cl_name; \
+ cl_name = STR_INIT(class_name, class_name_len, 1); \
+ class_container.name = zend_new_interned_string(cl_name TSRMLS_CC); \
INIT_CLASS_ENTRY_INIT_METHODS(class_container, functions, handle_fcall, handle_propget, handle_propset, handle_propunset, handle_propisset) \
}
@@ -236,9 +232,9 @@ int zend_next_free_module(void);
BEGIN_EXTERN_C()
ZEND_API int zend_get_parameters(int ht, int param_count, ...);
-ZEND_API int _zend_get_parameters_array(int ht, int param_count, zval **argument_array TSRMLS_DC);
+ZEND_API int _zend_get_parameters_array(int ht, int param_count, zval *argument_array TSRMLS_DC);
ZEND_API ZEND_ATTRIBUTE_DEPRECATED int zend_get_parameters_ex(int param_count, ...);
-ZEND_API int _zend_get_parameters_array_ex(int param_count, zval ***argument_array TSRMLS_DC);
+ZEND_API int _zend_get_parameters_array_ex(int param_count, zval *argument_array TSRMLS_DC);
/* internal function to efficiently copy parameters when executing __call() */
ZEND_API int zend_copy_parameters_array(int param_count, zval *argument_array TSRMLS_DC);
@@ -260,7 +256,7 @@ ZEND_API char *zend_zval_type_name(const zval *arg);
ZEND_API int zend_parse_method_parameters(int num_args TSRMLS_DC, zval *this_ptr, const char *type_spec, ...);
ZEND_API int zend_parse_method_parameters_ex(int flags, int num_args TSRMLS_DC, zval *this_ptr, const char *type_spec, ...);
-ZEND_API int zend_parse_parameter(int flags, int arg_num TSRMLS_DC, zval **arg, const char *spec, ...);
+ZEND_API int zend_parse_parameter(int flags, int arg_num TSRMLS_DC, zval *arg, const char *spec, ...);
/* End of parameter parsing API -- andrei */
@@ -276,7 +272,7 @@ ZEND_API void zend_destroy_modules(void);
ZEND_API void zend_check_magic_method_implementation(const zend_class_entry *ce, const zend_function *fptr, int error_type TSRMLS_DC);
ZEND_API zend_class_entry *zend_register_internal_class(zend_class_entry *class_entry TSRMLS_DC);
-ZEND_API zend_class_entry *zend_register_internal_class_ex(zend_class_entry *class_entry, zend_class_entry *parent_ce, char *parent_name TSRMLS_DC);
+ZEND_API zend_class_entry *zend_register_internal_class_ex(zend_class_entry *class_entry, zend_class_entry *parent_ce TSRMLS_DC);
ZEND_API zend_class_entry *zend_register_internal_interface(zend_class_entry *orig_class_entry TSRMLS_DC);
ZEND_API void zend_class_implements(zend_class_entry *class_entry TSRMLS_DC, int num_interfaces, ...);
@@ -304,8 +300,8 @@ ZEND_API zend_bool zend_is_callable(zval *callable, uint check_flags, char **cal
ZEND_API zend_bool zend_make_callable(zval *callable, char **callable_name TSRMLS_DC);
ZEND_API const char *zend_get_module_version(const char *module_name);
ZEND_API int zend_get_module_started(const char *module_name);
+ZEND_API int zend_declare_property_ex(zend_class_entry *ce, zend_string *name, zval *property, int access_type, zend_string *doc_comment TSRMLS_DC);
ZEND_API int zend_declare_property(zend_class_entry *ce, const char *name, int name_length, zval *property, int access_type TSRMLS_DC);
-ZEND_API int zend_declare_property_ex(zend_class_entry *ce, const char *name, int name_length, zval *property, int access_type, const char *doc_comment, int doc_comment_len TSRMLS_DC);
ZEND_API int zend_declare_property_null(zend_class_entry *ce, const char *name, int name_length, int access_type TSRMLS_DC);
ZEND_API int zend_declare_property_bool(zend_class_entry *ce, const char *name, int name_length, long value, int access_type TSRMLS_DC);
ZEND_API int zend_declare_property_long(zend_class_entry *ce, const char *name, int name_length, long value, int access_type TSRMLS_DC);
@@ -343,15 +339,15 @@ ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, const c
ZEND_API zval *zend_read_static_property(zend_class_entry *scope, const char *name, int name_length, zend_bool silent TSRMLS_DC);
ZEND_API zend_class_entry *zend_get_class_entry(const zval *zobject TSRMLS_DC);
-ZEND_API int zend_get_object_classname(const zval *object, const char **class_name, zend_uint *class_name_len TSRMLS_DC);
+ZEND_API zend_string *zend_get_object_classname(const zval *object TSRMLS_DC);
ZEND_API char *zend_get_type_by_const(int type);
#define getThis() (this_ptr)
#define WRONG_PARAM_COUNT ZEND_WRONG_PARAM_COUNT()
#define WRONG_PARAM_COUNT_WITH_RETVAL(ret) ZEND_WRONG_PARAM_COUNT_WITH_RETVAL(ret)
-#define ARG_COUNT(dummy) (ht)
-#define ZEND_NUM_ARGS() (ht)
+#define ARG_COUNT(dummy) (param_count)
+#define ZEND_NUM_ARGS() (param_count)
#define ZEND_WRONG_PARAM_COUNT() { zend_wrong_param_count(TSRMLS_C); return; }
#define ZEND_WRONG_PARAM_COUNT_WITH_RETVAL(ret) { zend_wrong_param_count(TSRMLS_C); return ret; }
@@ -378,23 +374,25 @@ ZEND_API int add_assoc_function(zval *arg, const char *key, void (*function_ptr)
ZEND_API int add_assoc_long_ex(zval *arg, const char *key, uint key_len, long n);
ZEND_API int add_assoc_null_ex(zval *arg, const char *key, uint key_len);
ZEND_API int add_assoc_bool_ex(zval *arg, const char *key, uint key_len, int b);
-ZEND_API int add_assoc_resource_ex(zval *arg, const char *key, uint key_len, int r);
+ZEND_API int add_assoc_resource_ex(zval *arg, const char *key, uint key_len, zend_resource *r);
ZEND_API int add_assoc_double_ex(zval *arg, const char *key, uint key_len, double d);
+ZEND_API int add_assoc_str_ex(zval *arg, const char *key, uint key_len, zend_string *str);
ZEND_API int add_assoc_string_ex(zval *arg, const char *key, uint key_len, char *str, int duplicate);
ZEND_API int add_assoc_stringl_ex(zval *arg, const char *key, uint key_len, char *str, uint length, int duplicate);
ZEND_API int add_assoc_zval_ex(zval *arg, const char *key, uint key_len, zval *value);
-#define add_assoc_long(__arg, __key, __n) add_assoc_long_ex(__arg, __key, strlen(__key)+1, __n)
-#define add_assoc_null(__arg, __key) add_assoc_null_ex(__arg, __key, strlen(__key) + 1)
-#define add_assoc_bool(__arg, __key, __b) add_assoc_bool_ex(__arg, __key, strlen(__key)+1, __b)
-#define add_assoc_resource(__arg, __key, __r) add_assoc_resource_ex(__arg, __key, strlen(__key)+1, __r)
-#define add_assoc_double(__arg, __key, __d) add_assoc_double_ex(__arg, __key, strlen(__key)+1, __d)
-#define add_assoc_string(__arg, __key, __str, __duplicate) add_assoc_string_ex(__arg, __key, strlen(__key)+1, __str, __duplicate)
-#define add_assoc_stringl(__arg, __key, __str, __length, __duplicate) add_assoc_stringl_ex(__arg, __key, strlen(__key)+1, __str, __length, __duplicate)
-#define add_assoc_zval(__arg, __key, __value) add_assoc_zval_ex(__arg, __key, strlen(__key)+1, __value)
+#define add_assoc_long(__arg, __key, __n) add_assoc_long_ex(__arg, __key, strlen(__key), __n)
+#define add_assoc_null(__arg, __key) add_assoc_null_ex(__arg, __key, strlen(__key))
+#define add_assoc_bool(__arg, __key, __b) add_assoc_bool_ex(__arg, __key, strlen(__key), __b)
+#define add_assoc_resource(__arg, __key, __r) add_assoc_resource_ex(__arg, __key, strlen(__key), __r)
+#define add_assoc_double(__arg, __key, __d) add_assoc_double_ex(__arg, __key, strlen(__key), __d)
+#define add_assoc_str(__arg, __key, __str) add_assoc_str_ex(__arg, __key, strlen(__key), __str)
+#define add_assoc_string(__arg, __key, __str, __duplicate) add_assoc_string_ex(__arg, __key, strlen(__key), __str, __duplicate)
+#define add_assoc_stringl(__arg, __key, __str, __length, __duplicate) add_assoc_stringl_ex(__arg, __key, strlen(__key), __str, __length, __duplicate)
+#define add_assoc_zval(__arg, __key, __value) add_assoc_zval_ex(__arg, __key, strlen(__key), __value)
/* unset() functions are only suported for legacy modules and null() functions should be used */
-#define add_assoc_unset(__arg, __key) add_assoc_null_ex(__arg, __key, strlen(__key) + 1)
+#define add_assoc_unset(__arg, __key) add_assoc_null_ex(__arg, __key, strlen(__key))
#define add_index_unset(__arg, __key) add_index_null(__arg, __key)
#define add_next_index_unset(__arg) add_next_index_null(__arg)
#define add_property_unset(__arg, __key) add_property_null(__arg, __key)
@@ -402,8 +400,9 @@ ZEND_API int add_assoc_zval_ex(zval *arg, const char *key, uint key_len, zval *v
ZEND_API int add_index_long(zval *arg, ulong idx, long n);
ZEND_API int add_index_null(zval *arg, ulong idx);
ZEND_API int add_index_bool(zval *arg, ulong idx, int b);
-ZEND_API int add_index_resource(zval *arg, ulong idx, int r);
+ZEND_API int add_index_resource(zval *arg, ulong idx, zend_resource *r);
ZEND_API int add_index_double(zval *arg, ulong idx, double d);
+ZEND_API int add_index_str(zval *arg, ulong idx, zend_string *str);
ZEND_API int add_index_string(zval *arg, ulong idx, const char *str, int duplicate);
ZEND_API int add_index_stringl(zval *arg, ulong idx, const char *str, uint length, int duplicate);
ZEND_API int add_index_zval(zval *arg, ulong index, zval *value);
@@ -411,46 +410,48 @@ ZEND_API int add_index_zval(zval *arg, ulong index, zval *value);
ZEND_API int add_next_index_long(zval *arg, long n);
ZEND_API int add_next_index_null(zval *arg);
ZEND_API int add_next_index_bool(zval *arg, int b);
-ZEND_API int add_next_index_resource(zval *arg, int r);
+ZEND_API int add_next_index_resource(zval *arg, zend_resource *r);
ZEND_API int add_next_index_double(zval *arg, double d);
+ZEND_API int add_next_index_str(zval *arg, zend_string *str);
ZEND_API int add_next_index_string(zval *arg, const char *str, int duplicate);
ZEND_API int add_next_index_stringl(zval *arg, const char *str, uint length, int duplicate);
ZEND_API int add_next_index_zval(zval *arg, zval *value);
-ZEND_API int add_get_assoc_string_ex(zval *arg, const char *key, uint key_len, const char *str, void **dest, int duplicate);
-ZEND_API int add_get_assoc_stringl_ex(zval *arg, const char *key, uint key_len, const char *str, uint length, void **dest, int duplicate);
+ZEND_API zval *add_get_assoc_string_ex(zval *arg, const char *key, uint key_len, const char *str, int duplicate);
+ZEND_API zval *add_get_assoc_stringl_ex(zval *arg, const char *key, uint key_len, const char *str, uint length, int duplicate);
-#define add_get_assoc_string(__arg, __key, __str, __dest, __duplicate) add_get_assoc_string_ex(__arg, __key, strlen(__key)+1, __str, __dest, __duplicate)
-#define add_get_assoc_stringl(__arg, __key, __str, __length, __dest, __duplicate) add_get_assoc_stringl_ex(__arg, __key, strlen(__key)+1, __str, __length, __dest, __duplicate)
+#define add_get_assoc_string(__arg, __key, __str, __duplicate) add_get_assoc_string_ex(__arg, __key, strlen(__key), __str, __duplicate)
+#define add_get_assoc_stringl(__arg, __key, __str, __length, __duplicate) add_get_assoc_stringl_ex(__arg, __key, strlen(__key), __str, __length, __duplicate)
-ZEND_API int add_get_index_long(zval *arg, ulong idx, long l, void **dest);
-ZEND_API int add_get_index_double(zval *arg, ulong idx, double d, void **dest);
-ZEND_API int add_get_index_string(zval *arg, ulong idx, const char *str, void **dest, int duplicate);
-ZEND_API int add_get_index_stringl(zval *arg, ulong idx, const char *str, uint length, void **dest, int duplicate);
+ZEND_API zval *add_get_index_long(zval *arg, ulong idx, long l);
+ZEND_API zval *add_get_index_double(zval *arg, ulong idx, double d);
+ZEND_API zval *add_get_index_str(zval *arg, ulong index, zend_string *str);
+ZEND_API zval *add_get_index_string(zval *arg, ulong idx, const char *str, int duplicate);
+ZEND_API zval *add_get_index_stringl(zval *arg, ulong idx, const char *str, uint length, int duplicate);
ZEND_API int array_set_zval_key(HashTable *ht, zval *key, zval *value);
ZEND_API int add_property_long_ex(zval *arg, const char *key, uint key_len, long l TSRMLS_DC);
ZEND_API int add_property_null_ex(zval *arg, const char *key, uint key_len TSRMLS_DC);
ZEND_API int add_property_bool_ex(zval *arg, const char *key, uint key_len, int b TSRMLS_DC);
-ZEND_API int add_property_resource_ex(zval *arg, const char *key, uint key_len, long r TSRMLS_DC);
+ZEND_API int add_property_resource_ex(zval *arg, const char *key, uint key_len, zend_resource *r TSRMLS_DC);
ZEND_API int add_property_double_ex(zval *arg, const char *key, uint key_len, double d TSRMLS_DC);
ZEND_API int add_property_string_ex(zval *arg, const char *key, uint key_len, const char *str, int duplicate TSRMLS_DC);
ZEND_API int add_property_stringl_ex(zval *arg, const char *key, uint key_len, const char *str, uint length, int duplicate TSRMLS_DC);
ZEND_API int add_property_zval_ex(zval *arg, const char *key, uint key_len, zval *value TSRMLS_DC);
-#define add_property_long(__arg, __key, __n) add_property_long_ex(__arg, __key, strlen(__key)+1, __n TSRMLS_CC)
-#define add_property_null(__arg, __key) add_property_null_ex(__arg, __key, strlen(__key) + 1 TSRMLS_CC)
-#define add_property_bool(__arg, __key, __b) add_property_bool_ex(__arg, __key, strlen(__key)+1, __b TSRMLS_CC)
-#define add_property_resource(__arg, __key, __r) add_property_resource_ex(__arg, __key, strlen(__key)+1, __r TSRMLS_CC)
-#define add_property_double(__arg, __key, __d) add_property_double_ex(__arg, __key, strlen(__key)+1, __d TSRMLS_CC)
-#define add_property_string(__arg, __key, __str, __duplicate) add_property_string_ex(__arg, __key, strlen(__key)+1, __str, __duplicate TSRMLS_CC)
-#define add_property_stringl(__arg, __key, __str, __length, __duplicate) add_property_stringl_ex(__arg, __key, strlen(__key)+1, __str, __length, __duplicate TSRMLS_CC)
-#define add_property_zval(__arg, __key, __value) add_property_zval_ex(__arg, __key, strlen(__key)+1, __value TSRMLS_CC)
+#define add_property_long(__arg, __key, __n) add_property_long_ex(__arg, __key, strlen(__key), __n TSRMLS_CC)
+#define add_property_null(__arg, __key) add_property_null_ex(__arg, __key, strlen(__key) TSRMLS_CC)
+#define add_property_bool(__arg, __key, __b) add_property_bool_ex(__arg, __key, strlen(__key), __b TSRMLS_CC)
+#define add_property_resource(__arg, __key, __r) add_property_resource_ex(__arg, __key, strlen(__key), __r TSRMLS_CC)
+#define add_property_double(__arg, __key, __d) add_property_double_ex(__arg, __key, strlen(__key), __d TSRMLS_CC)
+#define add_property_string(__arg, __key, __str, __duplicate) add_property_string_ex(__arg, __key, strlen(__key), __str, __duplicate TSRMLS_CC)
+#define add_property_stringl(__arg, __key, __str, __length, __duplicate) add_property_stringl_ex(__arg, __key, strlen(__key), __str, __length, __duplicate TSRMLS_CC)
+#define add_property_zval(__arg, __key, __value) add_property_zval_ex(__arg, __key, strlen(__key), __value TSRMLS_CC)
-ZEND_API int call_user_function(HashTable *function_table, zval **object_pp, zval *function_name, zval *retval_ptr, zend_uint param_count, zval *params[] TSRMLS_DC);
-ZEND_API int call_user_function_ex(HashTable *function_table, zval **object_pp, zval *function_name, zval **retval_ptr_ptr, zend_uint param_count, zval **params[], int no_separation, HashTable *symbol_table TSRMLS_DC);
+ZEND_API int call_user_function(HashTable *function_table, zval *object, zval *function_name, zval *retval_ptr, zend_uint param_count, zval params[] TSRMLS_DC);
+ZEND_API int call_user_function_ex(HashTable *function_table, zval *object, zval *function_name, zval *retval_ptr, zend_uint param_count, zval params[], int no_separation, HashTable *symbol_table TSRMLS_DC);
ZEND_API extern const zend_fcall_info empty_fcall_info;
ZEND_API extern const zend_fcall_info_cache empty_fcall_info_cache;
@@ -475,11 +476,11 @@ ZEND_API void zend_fcall_info_args_clear(zend_fcall_info *fci, int free_mem);
/** Save current arguments from zend_fcall_info *fci
* params array will be set to NULL
*/
-ZEND_API void zend_fcall_info_args_save(zend_fcall_info *fci, int *param_count, zval ****params);
+ZEND_API void zend_fcall_info_args_save(zend_fcall_info *fci, int *param_count, zval **params);
/** Free arguments connected with zend_fcall_info *fci andset back saved ones.
*/
-ZEND_API void zend_fcall_info_args_restore(zend_fcall_info *fci, int param_count, zval ***params);
+ZEND_API void zend_fcall_info_args_restore(zend_fcall_info *fci, int param_count, zval *params);
/** Set or clear the arguments in the zend_call_info struct taking care of
* refcount. If args is NULL and arguments are set then those are cleared.
@@ -490,7 +491,7 @@ ZEND_API int zend_fcall_info_args(zend_fcall_info *fci, zval *args TSRMLS_DC);
* If argc is 0 the arguments which are set will be cleared, else pass
* a variable amount of zval** arguments.
*/
-ZEND_API int zend_fcall_info_argp(zend_fcall_info *fci TSRMLS_DC, int argc, zval ***argv);
+ZEND_API int zend_fcall_info_argp(zend_fcall_info *fci TSRMLS_DC, int argc, zval *argv);
/** Set arguments in the zend_fcall_info struct taking care of refcount.
* If argc is 0 the arguments which are set will be cleared, else pass
@@ -507,24 +508,22 @@ ZEND_API int zend_fcall_info_argn(zend_fcall_info *fci TSRMLS_DC, int argc, ...)
/** Call a function using information created by zend_fcall_info_init()/args().
* If args is given then those replace the argument info in fci is temporarily.
*/
-ZEND_API int zend_fcall_info_call(zend_fcall_info *fci, zend_fcall_info_cache *fcc, zval **retval, zval *args TSRMLS_DC);
+ZEND_API int zend_fcall_info_call(zend_fcall_info *fci, zend_fcall_info_cache *fcc, zval *retval, zval *args TSRMLS_DC);
ZEND_API int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TSRMLS_DC);
ZEND_API int zend_set_hash_symbol(zval *symbol, const char *name, int name_length, zend_bool is_ref, int num_symbol_tables, ...);
-ZEND_API void zend_delete_variable(zend_execute_data *ex, HashTable *ht, const char *name, int name_len, ulong hash_value TSRMLS_DC);
+ZEND_API void zend_delete_variable(zend_execute_data *ex, HashTable *ht, zend_string *name TSRMLS_DC);
-ZEND_API int zend_delete_global_variable(const char *name, int name_len TSRMLS_DC);
-
-ZEND_API int zend_delete_global_variable_ex(const char *name, int name_len, ulong hash_value TSRMLS_DC);
+ZEND_API int zend_delete_global_variable(zend_string *name TSRMLS_DC);
ZEND_API void zend_reset_all_cv(HashTable *symbol_table TSRMLS_DC);
ZEND_API void zend_rebuild_symbol_table(TSRMLS_D);
-ZEND_API const char* zend_find_alias_name(zend_class_entry *ce, const char *name, zend_uint len);
-ZEND_API const char* zend_resolve_method_name(zend_class_entry *ce, zend_function *f);
+ZEND_API zend_string *zend_find_alias_name(zend_class_entry *ce, zend_string *name);
+ZEND_API zend_string *zend_resolve_method_name(zend_class_entry *ce, zend_function *f);
#define add_method(arg, key, method) add_assoc_function((arg), (key), (method))
@@ -545,55 +544,38 @@ END_EXTERN_C()
#define CHECK_ZVAL_NULL_PATH(p) (Z_STRLEN_P(p) != strlen(Z_STRVAL_P(p)))
#define CHECK_NULL_PATH(p, l) (strlen(p) != l)
-#define ZVAL_RESOURCE(z, l) do { \
- zval *__z = (z); \
- Z_LVAL_P(__z) = l; \
- Z_TYPE_P(__z) = IS_RESOURCE;\
+#define ZVAL_STRINGL(z, s, l) do { \
+ zval *__z = (z); \
+ int __l = l; \
+ ZVAL_STR(__z, STR_ALLOC(__l, 0)); \
+ memcpy(Z_STRVAL_P(__z), (s), __l + 1); \
} while (0)
-#define ZVAL_BOOL(z, b) do { \
- zval *__z = (z); \
- Z_LVAL_P(__z) = ((b) != 0); \
- Z_TYPE_P(__z) = IS_BOOL; \
+#define ZVAL_STRING(z, s) do { \
+ const char *_s = (s); \
+ int _l = strlen(_s); \
+ ZVAL_STRINGL(z, _s, _l); \
} while (0)
-#define ZVAL_NULL(z) { \
- Z_TYPE_P(z) = IS_NULL; \
- }
-
-#define ZVAL_LONG(z, l) { \
- zval *__z = (z); \
- Z_LVAL_P(__z) = l; \
- Z_TYPE_P(__z) = IS_LONG; \
- }
-
-#define ZVAL_DOUBLE(z, d) { \
- zval *__z = (z); \
- Z_DVAL_P(__z) = d; \
- Z_TYPE_P(__z) = IS_DOUBLE; \
- }
-
-#define ZVAL_STRING(z, s, duplicate) do { \
- const char *__s=(s); \
- zval *__z = (z); \
- Z_STRLEN_P(__z) = strlen(__s); \
- Z_STRVAL_P(__z) = (duplicate?estrndup(__s, Z_STRLEN_P(__z)):(char*)__s);\
- Z_TYPE_P(__z) = IS_STRING; \
+#define ZVAL_EMPTY_STRING(z) do { \
+ ZVAL_STRINGL(z, "", 0); \
} while (0)
-#define ZVAL_STRINGL(z, s, l, duplicate) do { \
- const char *__s=(s); int __l=l; \
+#define ZVAL_PSTRINGL(z, s, l) do { \
zval *__z = (z); \
- Z_STRLEN_P(__z) = __l; \
- Z_STRVAL_P(__z) = (duplicate?estrndup(__s, __l):(char*)__s);\
- Z_TYPE_P(__z) = IS_STRING; \
+ int __l = l; \
+ ZVAL_STR(__z, STR_ALLOC(__l, 1)); \
+ memcpy(Z_STRVAL_P(__z), (s), __l + 1); \
} while (0)
-#define ZVAL_EMPTY_STRING(z) do { \
- zval *__z = (z); \
- Z_STRLEN_P(__z) = 0; \
- Z_STRVAL_P(__z) = STR_EMPTY_ALLOC();\
- Z_TYPE_P(__z) = IS_STRING; \
+#define ZVAL_PSTRING(z, s) do { \
+ const char *_s = (s); \
+ int _l = strlen(_s); \
+ ZVAL_PSTRINGL(z, _s, _l); \
+ } while (0)
+
+#define ZVAL_EMPTY_PSTRING(z) do { \
+ ZVAL_PSTRINGL(z, "", 0); \
} while (0)
#define ZVAL_ZVAL(z, zv, copy, dtor) do { \
@@ -607,32 +589,32 @@ END_EXTERN_C()
if (!copy) { \
ZVAL_NULL(__zv); \
} \
- zval_ptr_dtor(&__zv); \
+ zval_ptr_dtor(__zv); \
} \
} while (0)
#define ZVAL_FALSE(z) ZVAL_BOOL(z, 0)
#define ZVAL_TRUE(z) ZVAL_BOOL(z, 1)
-#define RETVAL_RESOURCE(l) ZVAL_RESOURCE(return_value, l)
#define RETVAL_BOOL(b) ZVAL_BOOL(return_value, b)
#define RETVAL_NULL() ZVAL_NULL(return_value)
#define RETVAL_LONG(l) ZVAL_LONG(return_value, l)
#define RETVAL_DOUBLE(d) ZVAL_DOUBLE(return_value, d)
-#define RETVAL_STRING(s, duplicate) ZVAL_STRING(return_value, s, duplicate)
-#define RETVAL_STRINGL(s, l, duplicate) ZVAL_STRINGL(return_value, s, l, duplicate)
+#define RETVAL_STR(s) ZVAL_STR(return_value, s)
+#define RETVAL_STRING(s) ZVAL_STRING(return_value, s)
+#define RETVAL_STRINGL(s, l) ZVAL_STRINGL(return_value, s, l)
#define RETVAL_EMPTY_STRING() ZVAL_EMPTY_STRING(return_value)
#define RETVAL_ZVAL(zv, copy, dtor) ZVAL_ZVAL(return_value, zv, copy, dtor)
#define RETVAL_FALSE ZVAL_BOOL(return_value, 0)
#define RETVAL_TRUE ZVAL_BOOL(return_value, 1)
-#define RETURN_RESOURCE(l) { RETVAL_RESOURCE(l); return; }
#define RETURN_BOOL(b) { RETVAL_BOOL(b); return; }
#define RETURN_NULL() { RETVAL_NULL(); return;}
#define RETURN_LONG(l) { RETVAL_LONG(l); return; }
#define RETURN_DOUBLE(d) { RETVAL_DOUBLE(d); return; }
-#define RETURN_STRING(s, duplicate) { RETVAL_STRING(s, duplicate); return; }
-#define RETURN_STRINGL(s, l, duplicate) { RETVAL_STRINGL(s, l, duplicate); return; }
+#define RETURN_STR(s) { RETVAL_STR(s); return; }
+#define RETURN_STRING(s) { RETVAL_STRING(s); return; }
+#define RETURN_STRINGL(s, l) { RETVAL_STRINGL(s, l); return; }
#define RETURN_EMPTY_STRING() { RETVAL_EMPTY_STRING(); return; }
#define RETURN_ZVAL(zv, copy, dtor) { RETVAL_ZVAL(zv, copy, dtor); return; }
#define RETURN_FALSE { RETVAL_FALSE; return; }
@@ -643,11 +625,11 @@ END_EXTERN_C()
if (Z_ISREF_P(_z)) { \
RETVAL_ZVAL(_z, 1, 0); \
} else { \
- zval_ptr_dtor(&return_value); \
- Z_ADDREF_P(_z); \
- *return_value_ptr = _z; \
+ zval_ptr_dtor(return_value); \
+ ZVAL_COPY(return_value, _z); \
} \
} while (0)
+
#define RETURN_ZVAL_FAST(z) { RETVAL_ZVAL_FAST(z); return; }
#define SET_VAR_STRING(n, v) { \
@@ -699,7 +681,7 @@ END_EXTERN_C()
zval **orig_var; \
\
if (zend_hash_find(symtable, (name), (name_length), (void **) &orig_var)==SUCCESS \
- && PZVAL_IS_REF(*orig_var)) { \
+ && Z_ISREF_PP(orig_var)) { \
Z_SET_REFCOUNT_P(var, Z_REFCOUNT_PP(orig_var)); \
Z_SET_ISREF_P(var); \
\
diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c
index f621487819..3e94ae0bd6 100644
--- a/Zend/zend_alloc.c
+++ b/Zend/zend_alloc.c
@@ -1758,10 +1758,11 @@ static void zend_mm_safe_error(zend_mm_heap *heap,
uint error_lineno;
TSRMLS_FETCH();
if (zend_is_compiling(TSRMLS_C)) {
- error_filename = zend_get_compiled_filename(TSRMLS_C);
+ zend_string *str = zend_get_compiled_filename(TSRMLS_C);
+ error_filename = str ? str->val : NULL;
error_lineno = zend_get_compiled_lineno(TSRMLS_C);
} else if (EG(in_execution)) {
- error_filename = EG(active_op_array)?EG(active_op_array)->filename:NULL;
+ error_filename = EG(active_op_array)?EG(active_op_array)->filename->val:NULL;
error_lineno = EG(opline_ptr)?(*EG(opline_ptr))->lineno:0;
} else {
error_filename = NULL;
diff --git a/Zend/zend_alloc.h b/Zend/zend_alloc.h
index 1541dffcec..bd1765f7ff 100644
--- a/Zend/zend_alloc.h
+++ b/Zend/zend_alloc.h
@@ -162,17 +162,10 @@ ZEND_API size_t zend_memory_peak_usage(int real_usage TSRMLS_DC);
END_EXTERN_C()
/* fast cache for zval's */
-#define ALLOC_ZVAL(z) \
- (z) = (zval *) emalloc(sizeof(zval))
-
-#define FREE_ZVAL(z) \
- efree_rel(z)
-
-#define ALLOC_ZVAL_REL(z) \
- (z) = (zval *) emalloc_rel(sizeof(zval))
-
-#define FREE_ZVAL_REL(z) \
- efree_rel(z)
+//???#define ALLOC_ZVAL(z) (z) = (zval *) emalloc(sizeof(zval))
+//???#define FREE_ZVAL(z) efree_rel(z)
+//???#define ALLOC_ZVAL_REL(z) (z) = (zval *) emalloc_rel(sizeof(zval))
+//???#define FREE_ZVAL_REL(z) efree_rel(z)
/* fast cache for HashTables */
#define ALLOC_HASHTABLE(ht) \
diff --git a/Zend/zend_ast.c b/Zend/zend_ast.c
index 49fd3ff0f0..d6cb253b56 100644
--- a/Zend/zend_ast.c
+++ b/Zend/zend_ast.c
@@ -28,8 +28,7 @@ ZEND_API zend_ast *zend_ast_create_constant(zval *zv)
zend_ast *ast = emalloc(sizeof(zend_ast) + sizeof(zval));
ast->kind = ZEND_CONST;
ast->children = 0;
- ast->u.val = (zval*)(ast + 1);
- INIT_PZVAL_COPY(ast->u.val, zv);
+ ZVAL_COPY_VALUE(&ast->u.val, zv);
return ast;
}
@@ -68,7 +67,7 @@ ZEND_API int zend_ast_is_ct_constant(zend_ast *ast)
int i;
if (ast->kind == ZEND_CONST) {
- return !IS_CONSTANT_TYPE(Z_TYPE_P(ast->u.val));
+ return !IS_CONSTANT_TYPE(Z_TYPE(ast->u.val));
} else {
for (i = 0; i < ast->children; i++) {
if ((&ast->u.child)[i]) {
@@ -223,10 +222,9 @@ ZEND_API void zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry *s
zval_dtor(&op2);
break;
case ZEND_CONST:
- *result = *ast->u.val;
- zval_copy_ctor(result);
+ ZVAL_DUP(result, &ast->u.val);
if (IS_CONSTANT_TYPE(Z_TYPE_P(result))) {
- zval_update_constant_ex(&result, (void *) 1, scope TSRMLS_CC);
+ zval_update_constant_ex(result, (void *) 1, scope TSRMLS_CC);
}
break;
case ZEND_BOOL_AND:
@@ -287,8 +285,8 @@ ZEND_API zend_ast *zend_ast_copy(zend_ast *ast)
if (ast == NULL) {
return NULL;
} else if (ast->kind == ZEND_CONST) {
- zend_ast *copy = zend_ast_create_constant(ast->u.val);
- zval_copy_ctor(copy->u.val);
+ zend_ast *copy = zend_ast_create_constant(&ast->u.val);
+ zval_copy_ctor(&copy->u.val);
return copy;
} else {
switch (ast->children) {
@@ -317,7 +315,7 @@ ZEND_API void zend_ast_destroy(zend_ast *ast)
int i;
if (ast->kind == ZEND_CONST) {
- zval_dtor(ast->u.val);
+ zval_dtor(&ast->u.val);
} else {
for (i = 0; i < ast->children; i++) {
if ((&ast->u.child)[i]) {
diff --git a/Zend/zend_ast.h b/Zend/zend_ast.h
index 927e99cff8..0f28253895 100644
--- a/Zend/zend_ast.h
+++ b/Zend/zend_ast.h
@@ -40,7 +40,7 @@ struct _zend_ast {
unsigned short kind;
unsigned short children;
union {
- zval *val;
+ zval val;
zend_ast *child;
} u;
};
diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c
index 6bfb888988..8139a443f7 100644
--- a/Zend/zend_builtin_functions.c
+++ b/Zend/zend_builtin_functions.c
@@ -349,7 +349,7 @@ int zend_startup_builtin_functions(TSRMLS_D) /* {{{ */
Get the version of the Zend Engine */
ZEND_FUNCTION(zend_version)
{
- RETURN_STRINGL(ZEND_VERSION, sizeof(ZEND_VERSION)-1, 1);
+ RETURN_STRINGL(ZEND_VERSION, sizeof(ZEND_VERSION)-1);
}
/* }}} */
@@ -374,7 +374,9 @@ ZEND_FUNCTION(gc_enabled)
Activates the circular reference collector */
ZEND_FUNCTION(gc_enable)
{
- zend_alter_ini_entry("zend.enable_gc", sizeof("zend.enable_gc"), "1", sizeof("1")-1, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
+ zend_string *key = STR_INIT("zend.enable_gc", sizeof("zend.enable_gc")-1, 0);
+ zend_alter_ini_entry(key, "1", sizeof("1")-1, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
+ STR_FREE(key);
}
/* }}} */
@@ -382,7 +384,9 @@ ZEND_FUNCTION(gc_enable)
Deactivates the circular reference collector */
ZEND_FUNCTION(gc_disable)
{
- zend_alter_ini_entry("zend.enable_gc", sizeof("zend.enable_gc"), "0", sizeof("0")-1, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
+ zend_string *key = STR_INIT("zend.enable_gc", sizeof("zend.enable_gc")-1, 0);
+ zend_alter_ini_entry(key, "0", sizeof("0")-1, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
+ STR_FREE(key);
}
/* }}} */
@@ -393,7 +397,7 @@ ZEND_FUNCTION(func_num_args)
zend_execute_data *ex = EG(current_execute_data)->prev_execute_data;
if (ex && ex->function_state.arguments) {
- RETURN_LONG((long)(zend_uintptr_t)*(ex->function_state.arguments));
+ RETURN_LONG(Z_LVAL_P(ex->function_state.arguments));
} else {
zend_error(E_WARNING, "func_num_args(): Called from the global scope - no function context");
RETURN_LONG(-1);
@@ -406,7 +410,7 @@ ZEND_FUNCTION(func_num_args)
Get the $arg_num'th argument that was passed to the function */
ZEND_FUNCTION(func_get_arg)
{
- void **p;
+ zval *p;
int arg_count;
zval *arg;
long requested_offset;
@@ -427,14 +431,14 @@ ZEND_FUNCTION(func_get_arg)
}
p = ex->function_state.arguments;
- arg_count = (int)(zend_uintptr_t) *p; /* this is the amount of arguments passed to func_get_arg(); */
+ arg_count = Z_LVAL_P(p); /* this is the amount of arguments passed to func_get_arg(); */
if (requested_offset >= arg_count) {
zend_error(E_WARNING, "func_get_arg(): Argument %ld not passed to function", requested_offset);
RETURN_FALSE;
}
- arg = *(p-(arg_count-requested_offset));
+ arg = p-(arg_count-requested_offset);
RETURN_ZVAL_FAST(arg);
}
/* }}} */
@@ -444,7 +448,7 @@ ZEND_FUNCTION(func_get_arg)
Get an array of the arguments that were passed to the function */
ZEND_FUNCTION(func_get_args)
{
- void **p;
+ zval *p;
int arg_count;
int i;
zend_execute_data *ex = EG(current_execute_data)->prev_execute_data;
@@ -455,22 +459,21 @@ ZEND_FUNCTION(func_get_args)
}
p = ex->function_state.arguments;
- arg_count = (int)(zend_uintptr_t) *p; /* this is the amount of arguments passed to func_get_args(); */
+ arg_count = Z_LVAL_P(p); /* this is the amount of arguments passed to func_get_args(); */
array_init_size(return_value, arg_count);
for (i=0; i<arg_count; i++) {
- zval *element, *arg;
+ zval *element, *arg, tmp;
- arg = *((zval **) (p-(arg_count-i)));
+ arg = p-(arg_count-i);
if (!Z_ISREF_P(arg)) {
element = arg;
Z_ADDREF_P(element);
} else {
- ALLOC_ZVAL(element);
- INIT_PZVAL_COPY(element, arg);
- zval_copy_ctor(element);
+ ZVAL_DUP(&tmp, Z_REFVAL_P(arg));
+ element = &tmp;
}
- zend_hash_next_index_insert(return_value->value.ht, &element, sizeof(zval *), NULL);
+ zend_hash_next_index_insert(Z_ARRVAL_P(return_value), element);
}
}
/* }}} */
@@ -572,12 +575,11 @@ ZEND_FUNCTION(strncasecmp)
Return the currently pointed key..value pair in the passed array, and advance the pointer to the next element */
ZEND_FUNCTION(each)
{
- zval *array, *entry, **entry_ptr, *tmp;
- char *string_key;
- uint string_key_len;
+ zval *array, *entry, tmp;
ulong num_key;
- zval **inserted_pointer;
+ zval *inserted_pointer;
HashTable *target_hash;
+ zend_string *key;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &array) == FAILURE) {
return;
@@ -588,37 +590,34 @@ ZEND_FUNCTION(each)
zend_error(E_WARNING,"Variable passed to each() is not an array or object");
return;
}
- if (zend_hash_get_current_data(target_hash, (void **) &entry_ptr)==FAILURE) {
+ entry = zend_hash_get_current_data(target_hash);
+ if (!entry) {
RETURN_FALSE;
}
array_init(return_value);
- entry = *entry_ptr;
/* add value elements */
if (Z_ISREF_P(entry)) {
- ALLOC_ZVAL(tmp);
- *tmp = *entry;
- zval_copy_ctor(tmp);
- Z_UNSET_ISREF_P(tmp);
- Z_SET_REFCOUNT_P(tmp, 0);
- entry=tmp;
- }
- zend_hash_index_update(return_value->value.ht, 1, &entry, sizeof(zval *), NULL);
+ ZVAL_DUP(&tmp, Z_REFVAL_P(entry));
+ Z_SET_REFCOUNT(tmp, 0);
+ entry = &tmp;
+ }
+ zend_hash_index_update(Z_ARRVAL_P(return_value), 1, entry);
Z_ADDREF_P(entry);
- zend_hash_update(return_value->value.ht, "value", sizeof("value"), &entry, sizeof(zval *), NULL);
+ zend_hash_str_update(Z_ARRVAL_P(return_value), "value", sizeof("value")-1, entry);
Z_ADDREF_P(entry);
/* add the key elements */
- switch (zend_hash_get_current_key_ex(target_hash, &string_key, &string_key_len, &num_key, 0, NULL)) {
+ switch (zend_hash_get_current_key_ex(target_hash, &key, &num_key, 0, NULL)) {
case HASH_KEY_IS_STRING:
- add_get_index_stringl(return_value, 0, string_key, string_key_len-1, (void **) &inserted_pointer, !IS_INTERNED(string_key));
+ inserted_pointer = add_get_index_str(return_value, 0, key);
break;
case HASH_KEY_IS_LONG:
- add_get_index_long(return_value, 0, num_key, (void **) &inserted_pointer);
+ inserted_pointer = add_get_index_long(return_value, 0, num_key);
break;
}
- zend_hash_update(return_value->value.ht, "key", sizeof("key"), inserted_pointer, sizeof(zval *), NULL);
- Z_ADDREF_PP(inserted_pointer);
+ zend_hash_str_update(Z_ARRVAL_P(return_value), "key", sizeof("key")-1, inserted_pointer);
+ Z_ADDREF_P(inserted_pointer);
zend_hash_move_forward(target_hash);
}
/* }}} */
@@ -638,7 +637,9 @@ ZEND_FUNCTION(error_reporting)
old_error_reporting = EG(error_reporting);
if(ZEND_NUM_ARGS() != 0) {
- zend_alter_ini_entry("error_reporting", sizeof("error_reporting"), err, err_len, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
+ zend_string *key = STR_INIT("error_reporting", sizeof("error_reporting")-1, 0);
+ zend_alter_ini_entry(key, err, err_len, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
+ STR_FREE(key);
}
RETVAL_LONG(old_error_reporting);
@@ -652,8 +653,7 @@ ZEND_FUNCTION(define)
{
char *name;
int name_len;
- zval *val;
- zval *val_free = NULL;
+ zval *val, val_free;
zend_bool non_cs = 0;
int case_sensitive = CONST_CS;
zend_constant c;
@@ -672,6 +672,8 @@ ZEND_FUNCTION(define)
RETURN_FALSE;
}
+ ZVAL_UNDEF(&val_free);
+
repeat:
switch (Z_TYPE_P(val)) {
case IS_LONG:
@@ -682,14 +684,14 @@ repeat:
case IS_NULL:
break;
case IS_OBJECT:
- if (!val_free) {
+ if (Z_TYPE(val_free) == IS_UNDEF) {
if (Z_OBJ_HT_P(val)->get) {
- val_free = val = Z_OBJ_HT_P(val)->get(val TSRMLS_CC);
+ val = Z_OBJ_HT_P(val)->get(val TSRMLS_CC);
+ ZVAL_COPY_VALUE(&val_free, val);
goto repeat;
} else if (Z_OBJ_HT_P(val)->cast_object) {
- ALLOC_INIT_ZVAL(val_free);
- if (Z_OBJ_HT_P(val)->cast_object(val, val_free, IS_STRING TSRMLS_CC) == SUCCESS) {
- val = val_free;
+ if (Z_OBJ_HT_P(val)->cast_object(val, &val_free, IS_STRING TSRMLS_CC) == SUCCESS) {
+ val = &val_free;
break;
}
}
@@ -697,23 +699,17 @@ repeat:
/* no break */
default:
zend_error(E_WARNING,"Constants may only evaluate to scalar values");
- if (val_free) {
- zval_ptr_dtor(&val_free);
- }
+ zval_ptr_dtor(&val_free);
RETURN_FALSE;
}
- c.value = *val;
- zval_copy_ctor(&c.value);
- if (val_free) {
- zval_ptr_dtor(&val_free);
- }
+ ZVAL_DUP(&c.value, val);
+ zval_ptr_dtor(&val_free);
c.flags = case_sensitive; /* non persistent */
- c.name = str_strndup(name, name_len);
+ c.name = STR_INIT(name, name_len, 1);
if(c.name == NULL) {
RETURN_FALSE;
}
- c.name_len = name_len+1;
c.module_number = PHP_USER_CONSTANT;
if (zend_register_constant(&c TSRMLS_CC) == SUCCESS) {
RETURN_TRUE;
@@ -751,9 +747,6 @@ ZEND_FUNCTION(defined)
ZEND_FUNCTION(get_class)
{
zval *obj = NULL;
- const char *name = "";
- zend_uint name_len = 0;
- int dup;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|o!", &obj) == FAILURE) {
RETURN_FALSE;
@@ -761,16 +754,14 @@ ZEND_FUNCTION(get_class)
if (!obj) {
if (EG(scope)) {
- RETURN_STRINGL(EG(scope)->name, EG(scope)->name_length, 1);
+ RETURN_STR(STR_COPY(EG(scope)->name));
} else {
zend_error(E_WARNING, "get_class() called without object from outside a class");
RETURN_FALSE;
}
}
- dup = zend_get_object_classname(obj, &name, &name_len TSRMLS_CC);
-
- RETURN_STRINGL(name, name_len, dup);
+ RETURN_STR(zend_get_object_classname(obj TSRMLS_CC));
}
/* }}} */
@@ -784,7 +775,7 @@ ZEND_FUNCTION(get_called_class)
}
if (EG(called_scope)) {
- RETURN_STRINGL(EG(called_scope)->name, EG(called_scope)->name_length, 1);
+ RETURN_STR(STR_COPY(EG(called_scope)->name));
} else if (!EG(scope)) {
zend_error(E_WARNING, "get_called_class() called from outside a class");
}
@@ -799,8 +790,7 @@ ZEND_FUNCTION(get_parent_class)
{
zval *arg;
zend_class_entry *ce = NULL;
- const char *name;
- zend_uint name_length;
+ zend_string *name;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z", &arg) == FAILURE) {
return;
@@ -809,7 +799,7 @@ ZEND_FUNCTION(get_parent_class)
if (!ZEND_NUM_ARGS()) {
ce = EG(scope);
if (ce && ce->parent) {
- RETURN_STRINGL(ce->parent->name, ce->parent->name_length, 1);
+ RETURN_STR(STR_COPY(ce->parent->name));
} else {
RETURN_FALSE;
}
@@ -817,21 +807,17 @@ ZEND_FUNCTION(get_parent_class)
if (Z_TYPE_P(arg) == IS_OBJECT) {
if (Z_OBJ_HT_P(arg)->get_class_name
- && Z_OBJ_HT_P(arg)->get_class_name(arg, &name, &name_length, 1 TSRMLS_CC) == SUCCESS) {
- RETURN_STRINGL(name, name_length, 0);
+ && (name = Z_OBJ_HT_P(arg)->get_class_name(arg, 1 TSRMLS_CC)) != NULL) {
+ RETURN_STR(name);
} else {
ce = zend_get_class_entry(arg TSRMLS_CC);
}
} else if (Z_TYPE_P(arg) == IS_STRING) {
- zend_class_entry **pce;
-
- if (zend_lookup_class(Z_STRVAL_P(arg), Z_STRLEN_P(arg), &pce TSRMLS_CC) == SUCCESS) {
- ce = *pce;
- }
+ ce = zend_lookup_class(Z_STR_P(arg) TSRMLS_CC);
}
if (ce && ce->parent) {
- RETURN_STRINGL(ce->parent->name, ce->parent->name_length, 1);
+ RETURN_STR(STR_COPY(ce->parent->name));
} else {
RETURN_FALSE;
}
@@ -842,14 +828,13 @@ ZEND_FUNCTION(get_parent_class)
static void is_a_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool only_subclass)
{
zval *obj;
- char *class_name;
- int class_name_len;
+ zend_string *class_name;
zend_class_entry *instance_ce;
- zend_class_entry **ce;
+ zend_class_entry *ce;
zend_bool allow_string = only_subclass;
zend_bool retval;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zs|b", &obj, &class_name, &class_name_len, &allow_string) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zS|b", &obj, &class_name, &allow_string) == FAILURE) {
return;
}
/*
@@ -860,24 +845,24 @@ static void is_a_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool only_subclass)
*/
if (allow_string && Z_TYPE_P(obj) == IS_STRING) {
- zend_class_entry **the_ce;
- if (zend_lookup_class(Z_STRVAL_P(obj), Z_STRLEN_P(obj), &the_ce TSRMLS_CC) == FAILURE) {
+ instance_ce = zend_lookup_class(Z_STR_P(obj) TSRMLS_CC);
+ if (!instance_ce) {
RETURN_FALSE;
}
- instance_ce = *the_ce;
} else if (Z_TYPE_P(obj) == IS_OBJECT && HAS_CLASS_ENTRY(*obj)) {
instance_ce = Z_OBJCE_P(obj);
} else {
RETURN_FALSE;
}
- if (zend_lookup_class_ex(class_name, class_name_len, NULL, 0, &ce TSRMLS_CC) == FAILURE) {
+ ce = zend_lookup_class_ex(class_name, NULL, 0 TSRMLS_CC);
+ if (!ce) {
retval = 0;
} else {
- if (only_subclass && instance_ce == *ce) {
+ if (only_subclass && instance_ce == ce) {
retval = 0;
} else {
- retval = instanceof_function(instance_ce, *ce TSRMLS_CC);
+ retval = instanceof_function(instance_ce, ce TSRMLS_CC);
}
}
@@ -908,14 +893,13 @@ static void add_class_vars(zend_class_entry *ce, int statics, zval *return_value
{
HashPosition pos;
zend_property_info *prop_info;
- zval *prop, *prop_copy;
- char *key;
- uint key_len;
+ zval *prop, prop_copy;
+ zend_string *key;
ulong num_index;
zend_hash_internal_pointer_reset_ex(&ce->properties_info, &pos);
- while (zend_hash_get_current_data_ex(&ce->properties_info, (void **) &prop_info, &pos) == SUCCESS) {
- zend_hash_get_current_key_ex(&ce->properties_info, &key, &key_len, &num_index, 0, &pos);
+ while ((prop_info = zend_hash_get_current_data_ptr_ex(&ce->properties_info, &pos)) != NULL) {
+ zend_hash_get_current_key_ex(&ce->properties_info, &key, &num_index, 0, &pos);
zend_hash_move_forward_ex(&ce->properties_info, &pos);
if (((prop_info->flags & ZEND_ACC_SHADOW) &&
prop_info->ce != EG(scope)) ||
@@ -929,28 +913,26 @@ static void add_class_vars(zend_class_entry *ce, int statics, zval *return_value
prop = NULL;
if (prop_info->offset >= 0) {
if (statics && (prop_info->flags & ZEND_ACC_STATIC) != 0) {
- prop = ce->default_static_members_table[prop_info->offset];
+ prop = &ce->default_static_members_table[prop_info->offset];
} else if (!statics && (prop_info->flags & ZEND_ACC_STATIC) == 0) {
- prop = ce->default_properties_table[prop_info->offset];
+ prop = &ce->default_properties_table[prop_info->offset];
}
}
- if (!prop) {
+ if (!prop || Z_TYPE_P(prop) == IS_UNDEF) {
continue;
}
/* copy: enforce read only access */
- ALLOC_ZVAL(prop_copy);
- *prop_copy = *prop;
- zval_copy_ctor(prop_copy);
- INIT_PZVAL(prop_copy);
+ ZVAL_DUP(&prop_copy, prop);
+//??? INIT_PZVAL(prop_copy);
/* this is necessary to make it able to work with default array
* properties, returned to user */
- if (IS_CONSTANT_TYPE(Z_TYPE_P(prop_copy))) {
+ if (IS_CONSTANT_TYPE(Z_TYPE(prop_copy))) {
zval_update_constant(&prop_copy, 0 TSRMLS_CC);
}
- zend_hash_update(Z_ARRVAL_P(return_value), key, key_len, &prop_copy, sizeof(zval*), NULL);
+ zend_hash_update(Z_ARRVAL_P(return_value), key, &prop_copy);
}
}
/* }}} */
@@ -960,21 +942,21 @@ static void add_class_vars(zend_class_entry *ce, int statics, zval *return_value
Returns an array of default properties of the class. */
ZEND_FUNCTION(get_class_vars)
{
- char *class_name;
- int class_name_len;
- zend_class_entry **pce;
+ zend_string *class_name;
+ zend_class_entry *ce;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &class_name, &class_name_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &class_name) == FAILURE) {
return;
}
- if (zend_lookup_class(class_name, class_name_len, &pce TSRMLS_CC) == FAILURE) {
+ ce = zend_lookup_class(class_name TSRMLS_CC);
+ if (!ce) {
RETURN_FALSE;
} else {
array_init(return_value);
- zend_update_class_constants(*pce TSRMLS_CC);
- add_class_vars(*pce, 0, return_value TSRMLS_CC);
- add_class_vars(*pce, 1, return_value TSRMLS_CC);
+ zend_update_class_constants(ce TSRMLS_CC);
+ add_class_vars(ce, 0, return_value TSRMLS_CC);
+ add_class_vars(ce, 1, return_value TSRMLS_CC);
}
}
/* }}} */
@@ -985,12 +967,12 @@ ZEND_FUNCTION(get_class_vars)
ZEND_FUNCTION(get_object_vars)
{
zval *obj;
- zval **value;
+ zval *value;
HashTable *properties;
HashPosition pos;
- char *key;
+ zend_string *key;
const char *prop_name, *class_name;
- uint key_len, prop_len;
+ uint prop_len;
ulong num_index;
zend_object *zobj;
@@ -1008,26 +990,19 @@ ZEND_FUNCTION(get_object_vars)
RETURN_FALSE;
}
- zobj = zend_objects_get_address(obj TSRMLS_CC);
+ zobj = Z_OBJ_P(obj);
array_init(return_value);
zend_hash_internal_pointer_reset_ex(properties, &pos);
- while (zend_hash_get_current_data_ex(properties, (void **) &value, &pos) == SUCCESS) {
- if (zend_hash_get_current_key_ex(properties, &key, &key_len, &num_index, 0, &pos) == HASH_KEY_IS_STRING) {
- if (zend_check_property_access(zobj, key, key_len-1 TSRMLS_CC) == SUCCESS) {
- zend_unmangle_property_name_ex(key, key_len - 1, &class_name, &prop_name, (int*) &prop_len);
+ while ((value = zend_hash_get_current_data_ex(properties, &pos)) != NULL) {
+ if (zend_hash_get_current_key_ex(properties, &key, &num_index, 0, &pos) == HASH_KEY_IS_STRING) {
+ if (zend_check_property_access(zobj, key TSRMLS_CC) == SUCCESS) {
+ zend_unmangle_property_name_ex(key->val, key->len, &class_name, &prop_name, (int*) &prop_len);
/* Not separating references */
- Z_ADDREF_PP(value);
- if (IS_INTERNED(key) && prop_name != key) {
- /* we can't use substring of interned string as a new key */
- char *tmp = estrndup(prop_name, prop_len);
- add_assoc_zval_ex(return_value, tmp, prop_len + 1, *value);
- efree(tmp);
- } else {
- add_assoc_zval_ex(return_value, prop_name, prop_len + 1, *value);
- }
+ Z_ADDREF_P(value);
+ add_assoc_zval_ex(return_value, prop_name, prop_len, value);
}
}
zend_hash_move_forward_ex(properties, &pos);
@@ -1048,8 +1023,8 @@ static int same_name(const char *key, const char *name, zend_uint name_len)
ZEND_FUNCTION(get_class_methods)
{
zval *klass;
- zval *method_name;
- zend_class_entry *ce = NULL, **pce;
+ zval method_name;
+ zend_class_entry *ce = NULL;
HashPosition pos;
zend_function *mptr;
@@ -1064,9 +1039,7 @@ ZEND_FUNCTION(get_class_methods)
}
ce = Z_OBJCE_P(klass);
} else if (Z_TYPE_P(klass) == IS_STRING) {
- if (zend_lookup_class(Z_STRVAL_P(klass), Z_STRLEN_P(klass), &pce TSRMLS_CC) == SUCCESS) {
- ce = *pce;
- }
+ ce = zend_lookup_class(Z_STR_P(klass) TSRMLS_CC);
}
if (!ce) {
@@ -1076,38 +1049,34 @@ ZEND_FUNCTION(get_class_methods)
array_init(return_value);
zend_hash_internal_pointer_reset_ex(&ce->function_table, &pos);
- while (zend_hash_get_current_data_ex(&ce->function_table, (void **) &mptr, &pos) == SUCCESS) {
+ while ((mptr = zend_hash_get_current_data_ptr_ex(&ce->function_table, &pos)) != NULL) {
if ((mptr->common.fn_flags & ZEND_ACC_PUBLIC)
|| (EG(scope) &&
(((mptr->common.fn_flags & ZEND_ACC_PROTECTED) &&
zend_check_protected(mptr->common.scope, EG(scope)))
|| ((mptr->common.fn_flags & ZEND_ACC_PRIVATE) &&
EG(scope) == mptr->common.scope)))) {
- char *key;
- uint key_len;
+ zend_string *key;
ulong num_index;
- uint len = strlen(mptr->common.function_name);
+ uint len = mptr->common.function_name->len;
/* Do not display old-style inherited constructors */
- if (zend_hash_get_current_key_ex(&ce->function_table, &key, &key_len, &num_index, 0, &pos) != HASH_KEY_IS_STRING) {
- MAKE_STD_ZVAL(method_name);
- ZVAL_STRINGL(method_name, mptr->common.function_name, len, 1);
- zend_hash_next_index_insert(return_value->value.ht, &method_name, sizeof(zval *), NULL);
+ if (zend_hash_get_current_key_ex(&ce->function_table, &key, &num_index, 0, &pos) != HASH_KEY_IS_STRING) {
+ ZVAL_STR(&method_name, STR_COPY(mptr->common.function_name));
+ zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &method_name);
} else if ((mptr->common.fn_flags & ZEND_ACC_CTOR) == 0 ||
mptr->common.scope == ce ||
- zend_binary_strcasecmp(key, key_len-1, mptr->common.function_name, len) == 0) {
+ zend_binary_strcasecmp(key->val, key->len, mptr->common.function_name->val, len) == 0) {
if (mptr->type == ZEND_USER_FUNCTION &&
*mptr->op_array.refcount > 1 &&
- (len != key_len - 1 ||
- !same_name(key, mptr->common.function_name, len))) {
- MAKE_STD_ZVAL(method_name);
- ZVAL_STRINGL(method_name, zend_find_alias_name(mptr->common.scope, key, key_len - 1), key_len - 1, 1);
- zend_hash_next_index_insert(return_value->value.ht, &method_name, sizeof(zval *), NULL);
+ (len != key->len ||
+ !same_name(key->val, mptr->common.function_name->val, len))) {
+ ZVAL_STR(&method_name, STR_COPY(zend_find_alias_name(mptr->common.scope, key)));
+ zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &method_name);
} else {
- MAKE_STD_ZVAL(method_name);
- ZVAL_STRINGL(method_name, mptr->common.function_name, len, 1);
- zend_hash_next_index_insert(return_value->value.ht, &method_name, sizeof(zval *), NULL);
+ ZVAL_STR(&method_name, STR_COPY(mptr->common.function_name));
+ zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &method_name);
}
}
}
@@ -1122,46 +1091,43 @@ ZEND_FUNCTION(get_class_methods)
ZEND_FUNCTION(method_exists)
{
zval *klass;
- char *method_name;
- int method_len;
- char *lcname;
- zend_class_entry * ce, **pce;
+ zend_string *method_name;
+ zend_string *lcname;
+ zend_class_entry * ce;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zs", &klass, &method_name, &method_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zS", &klass, &method_name) == FAILURE) {
return;
}
if (Z_TYPE_P(klass) == IS_OBJECT) {
ce = Z_OBJCE_P(klass);
} else if (Z_TYPE_P(klass) == IS_STRING) {
- if (zend_lookup_class(Z_STRVAL_P(klass), Z_STRLEN_P(klass), &pce TSRMLS_CC) == FAILURE) {
- RETURN_FALSE;
- }
- ce = *pce;
+ ce = zend_lookup_class(Z_STR_P(klass) TSRMLS_CC);
} else {
RETURN_FALSE;
}
- lcname = zend_str_tolower_dup(method_name, method_len);
- if (zend_hash_exists(&ce->function_table, lcname, method_len+1)) {
- efree(lcname);
+ lcname = STR_ALLOC(method_name->len, 0);
+ zend_str_tolower_copy(lcname->val, method_name->val, method_name->len);
+ if (zend_hash_exists(&ce->function_table, lcname)) {
+ STR_FREE(lcname);
RETURN_TRUE;
} else {
union _zend_function *func = NULL;
if (Z_TYPE_P(klass) == IS_OBJECT
&& Z_OBJ_HT_P(klass)->get_method != NULL
- && (func = Z_OBJ_HT_P(klass)->get_method(&klass, method_name, method_len, NULL TSRMLS_CC)) != NULL
+ && (func = Z_OBJ_HT_P(klass)->get_method(klass, method_name, NULL TSRMLS_CC)) != NULL
) {
if (func->type == ZEND_INTERNAL_FUNCTION
&& (func->common.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) != 0
) {
/* Returns true to the fake Closure's __invoke */
RETVAL_BOOL((func->common.scope == zend_ce_closure
- && (method_len == sizeof(ZEND_INVOKE_FUNC_NAME)-1)
- && memcmp(lcname, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) == 0) ? 1 : 0);
+ && (method_name->len == sizeof(ZEND_INVOKE_FUNC_NAME)-1)
+ && memcmp(lcname->val, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) == 0) ? 1 : 0);
- efree(lcname);
- efree((char*)((zend_internal_function*)func)->function_name);
+ STR_FREE(lcname);
+ STR_FREE(func->common.function_name);
efree(func);
return;
}
@@ -1179,26 +1145,21 @@ ZEND_FUNCTION(method_exists)
ZEND_FUNCTION(property_exists)
{
zval *object;
- char *property;
- int property_len;
- zend_class_entry *ce, **pce;
+ zend_string *property;
+ zend_class_entry *ce;
zend_property_info *property_info;
zval property_z;
- ulong h;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zs", &object, &property, &property_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zS", &object, &property) == FAILURE) {
return;
}
- if (property_len == 0) {
+ if (property == NULL) {
RETURN_FALSE;
}
if (Z_TYPE_P(object) == IS_STRING) {
- if (zend_lookup_class(Z_STRVAL_P(object), Z_STRLEN_P(object), &pce TSRMLS_CC) == FAILURE) {
- RETURN_FALSE;
- }
- ce = *pce;
+ ce = zend_lookup_class(Z_STR_P(object) TSRMLS_CC);
} else if (Z_TYPE_P(object) == IS_OBJECT) {
ce = Z_OBJCE_P(object);
} else {
@@ -1206,13 +1167,12 @@ ZEND_FUNCTION(property_exists)
RETURN_NULL();
}
- h = zend_get_hash_value(property, property_len+1);
- if (zend_hash_quick_find(&ce->properties_info, property, property_len+1, h, (void **) &property_info) == SUCCESS
+ if ((property_info = zend_hash_find_ptr(&ce->properties_info, property)) != NULL
&& (property_info->flags & ZEND_ACC_SHADOW) == 0) {
RETURN_TRUE;
}
- ZVAL_STRINGL(&property_z, property, property_len, 0);
+ ZVAL_STR(&property_z, property);
if (Z_TYPE_P(object) == IS_OBJECT &&
Z_OBJ_HANDLER_P(object, has_property) &&
@@ -1228,39 +1188,32 @@ ZEND_FUNCTION(property_exists)
Checks if the class exists */
ZEND_FUNCTION(class_exists)
{
- char *class_name, *lc_name;
- zend_class_entry **ce;
- int class_name_len;
- int found;
+ zend_string *class_name;
+ zend_string *lc_name;
+ zend_class_entry *ce;
zend_bool autoload = 1;
- ALLOCA_FLAG(use_heap)
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &class_name, &class_name_len, &autoload) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|b", &class_name, &autoload) == FAILURE) {
return;
}
if (!autoload) {
- char *name;
- int len;
-
- lc_name = do_alloca(class_name_len + 1, use_heap);
- zend_str_tolower_copy(lc_name, class_name, class_name_len);
-
- /* Ignore leading "\" */
- name = lc_name;
- len = class_name_len;
- if (lc_name[0] == '\\') {
- name = &lc_name[1];
- len--;
+ if (class_name->val[0] == '\\') {
+ /* Ignore leading "\" */
+ lc_name = STR_ALLOC(class_name->len - 1, 0);
+ zend_str_tolower_copy(lc_name->val, class_name->val + 1, class_name->len - 1);
+ } else {
+ lc_name = STR_ALLOC(class_name->len, 0);
+ zend_str_tolower_copy(lc_name->val, class_name->val, class_name->len);
}
-
- found = zend_hash_find(EG(class_table), name, len+1, (void **) &ce);
- free_alloca(lc_name, use_heap);
- RETURN_BOOL(found == SUCCESS && !(((*ce)->ce_flags & (ZEND_ACC_INTERFACE | ZEND_ACC_TRAIT)) > ZEND_ACC_EXPLICIT_ABSTRACT_CLASS));
+ ce = zend_hash_find_ptr(EG(class_table), lc_name);
+ STR_FREE(lc_name);
+ RETURN_BOOL(ce && !((ce->ce_flags & (ZEND_ACC_INTERFACE | ZEND_ACC_TRAIT)) > ZEND_ACC_EXPLICIT_ABSTRACT_CLASS));
}
- if (zend_lookup_class(class_name, class_name_len, &ce TSRMLS_CC) == SUCCESS) {
- RETURN_BOOL(((*ce)->ce_flags & (ZEND_ACC_INTERFACE | (ZEND_ACC_TRAIT - ZEND_ACC_EXPLICIT_ABSTRACT_CLASS))) == 0);
+ ce = zend_lookup_class(class_name TSRMLS_CC);
+ if (ce) {
+ RETURN_BOOL((ce->ce_flags & (ZEND_ACC_INTERFACE | (ZEND_ACC_TRAIT - ZEND_ACC_EXPLICIT_ABSTRACT_CLASS))) == 0);
} else {
RETURN_FALSE;
}
@@ -1271,39 +1224,31 @@ ZEND_FUNCTION(class_exists)
Checks if the class exists */
ZEND_FUNCTION(interface_exists)
{
- char *iface_name, *lc_name;
- zend_class_entry **ce;
- int iface_name_len;
- int found;
+ zend_string *iface_name, *lc_name;
+ zend_class_entry *ce;
zend_bool autoload = 1;
- ALLOCA_FLAG(use_heap)
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &iface_name, &iface_name_len, &autoload) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|b", &iface_name, &autoload) == FAILURE) {
return;
}
if (!autoload) {
- char *name;
- int len;
-
- lc_name = do_alloca(iface_name_len + 1, use_heap);
- zend_str_tolower_copy(lc_name, iface_name, iface_name_len);
-
- /* Ignore leading "\" */
- name = lc_name;
- len = iface_name_len;
- if (lc_name[0] == '\\') {
- name = &lc_name[1];
- len--;
+ if (iface_name->val[0] == '\\') {
+ /* Ignore leading "\" */
+ lc_name = STR_ALLOC(iface_name->len - 1, 0);
+ zend_str_tolower_copy(lc_name->val, iface_name->val + 1, iface_name->len - 1);
+ } else {
+ lc_name = STR_ALLOC(iface_name->len, 0);
+ zend_str_tolower_copy(lc_name->val, iface_name->val, iface_name->len);
}
-
- found = zend_hash_find(EG(class_table), name, len+1, (void **) &ce);
- free_alloca(lc_name, use_heap);
- RETURN_BOOL(found == SUCCESS && (*ce)->ce_flags & ZEND_ACC_INTERFACE);
+ ce = zend_hash_find_ptr(EG(class_table), lc_name);
+ STR_FREE(lc_name);
+ RETURN_BOOL(ce && ce->ce_flags & ZEND_ACC_INTERFACE);
}
- if (zend_lookup_class(iface_name, iface_name_len, &ce TSRMLS_CC) == SUCCESS) {
- RETURN_BOOL(((*ce)->ce_flags & ZEND_ACC_INTERFACE) > 0);
+ ce = zend_lookup_class(iface_name TSRMLS_CC);
+ if (ce) {
+ RETURN_BOOL((ce->ce_flags & ZEND_ACC_INTERFACE) > 0);
} else {
RETURN_FALSE;
}
@@ -1314,39 +1259,31 @@ ZEND_FUNCTION(interface_exists)
Checks if the trait exists */
ZEND_FUNCTION(trait_exists)
{
- char *trait_name, *lc_name;
- zend_class_entry **ce;
- int trait_name_len;
- int found;
+ zend_string *trait_name, *lc_name;
+ zend_class_entry *ce;
zend_bool autoload = 1;
- ALLOCA_FLAG(use_heap)
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &trait_name, &trait_name_len, &autoload) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|b", &trait_name, &autoload) == FAILURE) {
return;
}
if (!autoload) {
- char *name;
- int len;
-
- lc_name = do_alloca(trait_name_len + 1, use_heap);
- zend_str_tolower_copy(lc_name, trait_name, trait_name_len);
-
- /* Ignore leading "\" */
- name = lc_name;
- len = trait_name_len;
- if (lc_name[0] == '\\') {
- name = &lc_name[1];
- len--;
+ if (trait_name->val[0] == '\\') {
+ /* Ignore leading "\" */
+ lc_name = STR_ALLOC(trait_name->len - 1, 0);
+ zend_str_tolower_copy(lc_name->val, trait_name->val + 1, trait_name->len - 1);
+ } else {
+ lc_name = STR_ALLOC(trait_name->len, 0);
+ zend_str_tolower_copy(lc_name->val, trait_name->val, trait_name->len);
}
-
- found = zend_hash_find(EG(class_table), name, len+1, (void **) &ce);
- free_alloca(lc_name, use_heap);
- RETURN_BOOL(found == SUCCESS && (((*ce)->ce_flags & ZEND_ACC_TRAIT) > ZEND_ACC_EXPLICIT_ABSTRACT_CLASS));
+ ce = zend_hash_find_ptr(EG(class_table), lc_name);
+ STR_FREE(lc_name);
+ RETURN_BOOL(ce && ((ce->ce_flags & ZEND_ACC_TRAIT) > ZEND_ACC_EXPLICIT_ABSTRACT_CLASS));
}
- if (zend_lookup_class(trait_name, trait_name_len, &ce TSRMLS_CC) == SUCCESS) {
- RETURN_BOOL(((*ce)->ce_flags & ZEND_ACC_TRAIT) > ZEND_ACC_EXPLICIT_ABSTRACT_CLASS);
+ ce = zend_lookup_class(trait_name TSRMLS_CC);
+ if (ce) {
+ RETURN_BOOL((ce->ce_flags & ZEND_ACC_TRAIT) > ZEND_ACC_EXPLICIT_ABSTRACT_CLASS);
} else {
RETURN_FALSE;
}
@@ -1361,36 +1298,30 @@ ZEND_FUNCTION(function_exists)
char *name;
int name_len;
zend_function *func;
- char *lcname;
- zend_bool retval;
+ zend_string *lcname;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
return;
}
- lcname = zend_str_tolower_dup(name, name_len);
-
- /* Ignore leading "\" */
- name = lcname;
- if (lcname[0] == '\\') {
- name = &lcname[1];
- name_len--;
+ if (name[0] == '\\') {
+ /* Ignore leading "\" */
+ lcname = STR_ALLOC(name_len - 1, 0);
+ zend_str_tolower_copy(lcname->val, name + 1, name_len - 1);
+ } else {
+ lcname = STR_ALLOC(name_len, 0);
+ zend_str_tolower_copy(lcname->val, name, name_len);
}
-
- retval = (zend_hash_find(EG(function_table), name, name_len+1, (void **)&func) == SUCCESS);
- efree(lcname);
+ func = zend_hash_find_ptr(EG(function_table), lcname);
+ STR_FREE(lcname);
/*
* A bit of a hack, but not a bad one: we see if the handler of the function
* is actually one that displays "function is disabled" message.
*/
- if (retval && func->type == ZEND_INTERNAL_FUNCTION &&
- func->internal_function.handler == zif_display_disabled_function) {
- retval = 0;
- }
-
- RETURN_BOOL(retval);
+ RETURN_BOOL(func && (func->type != ZEND_INTERNAL_FUNCTION ||
+ func->internal_function.handler != zif_display_disabled_function));
}
/* }}} */
@@ -1398,21 +1329,21 @@ ZEND_FUNCTION(function_exists)
Creates an alias for user defined class */
ZEND_FUNCTION(class_alias)
{
- char *class_name, *alias_name;
- zend_class_entry **ce;
- int class_name_len, alias_name_len;
- int found;
+ zend_string *class_name;
+ char *alias_name;
+ zend_class_entry *ce;
+ int alias_name_len;
zend_bool autoload = 1;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|b", &class_name, &class_name_len, &alias_name, &alias_name_len, &autoload) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ss|b", &class_name, &alias_name, &alias_name_len, &autoload) == FAILURE) {
return;
}
- found = zend_lookup_class_ex(class_name, class_name_len, NULL, autoload, &ce TSRMLS_CC);
+ ce = zend_lookup_class_ex(class_name, NULL, autoload TSRMLS_CC);
- if (found == SUCCESS) {
- if ((*ce)->type == ZEND_USER_CLASS) {
- if (zend_register_class_alias_ex(alias_name, alias_name_len, *ce TSRMLS_CC) == SUCCESS) {
+ if (ce) {
+ if (ce->type == ZEND_USER_CLASS) {
+ if (zend_register_class_alias_ex(alias_name, alias_name_len, ce TSRMLS_CC) == SUCCESS) {
RETURN_TRUE;
} else {
zend_error(E_WARNING, "Cannot redeclare class %s", alias_name);
@@ -1423,7 +1354,7 @@ ZEND_FUNCTION(class_alias)
RETURN_FALSE;
}
} else {
- zend_error(E_WARNING, "Class '%s' not found", class_name);
+ zend_error(E_WARNING, "Class '%s' not found", class_name->val);
RETURN_FALSE;
}
}
@@ -1455,11 +1386,11 @@ ZEND_FUNCTION(leak_variable)
}
if (!leak_data) {
- zval_add_ref(&zv);
+ Z_ADDREF_P(zv);
} else if (Z_TYPE_P(zv) == IS_RESOURCE) {
- zend_list_addref(Z_RESVAL_P(zv));
+ Z_ADDREF_P(zv);
} else if (Z_TYPE_P(zv) == IS_OBJECT) {
- Z_OBJ_HANDLER_P(zv, add_ref)(zv TSRMLS_CC);
+ Z_ADDREF_P(zv);
} else {
zend_error(E_WARNING, "Leaking non-zval data is only applicable to resources and objects");
}
@@ -1482,8 +1413,7 @@ ZEND_FUNCTION(crash)
Returns an array with the file names that were include_once()'d */
ZEND_FUNCTION(get_included_files)
{
- char *entry;
- uint entry_len;
+ zend_string *entry;
if (zend_parse_parameters_none() == FAILURE) {
return;
@@ -1491,8 +1421,8 @@ ZEND_FUNCTION(get_included_files)
array_init(return_value);
zend_hash_internal_pointer_reset(&EG(included_files));
- while (zend_hash_get_current_key_ex(&EG(included_files), &entry, &entry_len, NULL, 0, NULL) == HASH_KEY_IS_STRING) {
- add_next_index_stringl(return_value, entry, entry_len-1, !IS_INTERNED(entry));
+ while (zend_hash_get_current_key_ex(&EG(included_files), &entry, NULL, 0, NULL) == HASH_KEY_IS_STRING) {
+ add_next_index_str(return_value, entry);
zend_hash_move_forward(&EG(included_files));
}
}
@@ -1551,20 +1481,19 @@ ZEND_FUNCTION(set_error_handler)
efree(error_handler_name);
}
- if (EG(user_error_handler)) {
- RETVAL_ZVAL(EG(user_error_handler), 1, 0);
+ if (Z_TYPE(EG(user_error_handler)) != IS_UNDEF) {
+ RETVAL_ZVAL(&EG(user_error_handler), 1, 0);
zend_stack_push(&EG(user_error_handlers_error_reporting), &EG(user_error_handler_error_reporting), sizeof(EG(user_error_handler_error_reporting)));
- zend_ptr_stack_push(&EG(user_error_handlers), EG(user_error_handler));
+ zend_stack_push(&EG(user_error_handlers), &EG(user_error_handler), sizeof(zval));
}
if (Z_TYPE_P(error_handler) == IS_NULL) { /* unset user-defined handler */
- EG(user_error_handler) = NULL;
+ ZVAL_UNDEF(&EG(user_error_handler));
return;
}
- ALLOC_ZVAL(EG(user_error_handler));
- MAKE_COPY_ZVAL(&error_handler, EG(user_error_handler));
+ ZVAL_DUP(&EG(user_error_handler), error_handler);
EG(user_error_handler_error_reporting) = (int)error_type;
}
/* }}} */
@@ -1574,19 +1503,23 @@ ZEND_FUNCTION(set_error_handler)
Restores the previously defined error handler function */
ZEND_FUNCTION(restore_error_handler)
{
- if (EG(user_error_handler)) {
- zval *zeh = EG(user_error_handler);
-
- EG(user_error_handler) = NULL;
+ if (Z_TYPE(EG(user_error_handler)) != IS_UNDEF) {
+ zval zeh;
+
+ ZVAL_COPY_VALUE(&zeh, &EG(user_error_handler));
+ ZVAL_UNDEF(&EG(user_error_handler));
zval_ptr_dtor(&zeh);
}
- if (zend_ptr_stack_num_elements(&EG(user_error_handlers))==0) {
- EG(user_error_handler) = NULL;
+ if (zend_stack_is_empty(&EG(user_error_handlers))) {
+ ZVAL_UNDEF(&EG(user_error_handler));
} else {
+ zval *tmp;
EG(user_error_handler_error_reporting) = zend_stack_int_top(&EG(user_error_handlers_error_reporting));
zend_stack_del_top(&EG(user_error_handlers_error_reporting));
- EG(user_error_handler) = zend_ptr_stack_pop(&EG(user_error_handlers));
+ zend_stack_top(&EG(user_error_handlers), (void**)&tmp);
+ ZVAL_COPY_VALUE(&EG(user_error_handler), tmp);
+ zend_stack_del_top(&EG(user_error_handlers));
}
RETURN_TRUE;
}
@@ -1614,19 +1547,18 @@ ZEND_FUNCTION(set_exception_handler)
efree(exception_handler_name);
}
- if (EG(user_exception_handler)) {
- RETVAL_ZVAL(EG(user_exception_handler), 1, 0);
+ if (Z_TYPE(EG(user_exception_handler)) != IS_UNDEF) {
+ RETVAL_ZVAL(&EG(user_exception_handler), 1, 0);
- zend_ptr_stack_push(&EG(user_exception_handlers), EG(user_exception_handler));
+ zend_stack_push(&EG(user_exception_handlers), &EG(user_exception_handler), sizeof(zval));
}
if (Z_TYPE_P(exception_handler) == IS_NULL) { /* unset user-defined handler */
- EG(user_exception_handler) = NULL;
+ ZVAL_UNDEF(&EG(user_exception_handler));
return;
}
- ALLOC_ZVAL(EG(user_exception_handler));
- MAKE_COPY_ZVAL(&exception_handler, EG(user_exception_handler))
+ ZVAL_DUP(&EG(user_exception_handler), exception_handler);
}
/* }}} */
@@ -1635,13 +1567,17 @@ ZEND_FUNCTION(set_exception_handler)
Restores the previously defined exception handler function */
ZEND_FUNCTION(restore_exception_handler)
{
- if (EG(user_exception_handler)) {
+ if (Z_TYPE(EG(user_exception_handler)) != IS_UNDEF) {
zval_ptr_dtor(&EG(user_exception_handler));
}
- if (zend_ptr_stack_num_elements(&EG(user_exception_handlers))==0) {
- EG(user_exception_handler) = NULL;
+ if (zend_stack_is_empty(&EG(user_exception_handlers))) {
+ ZVAL_UNDEF(&EG(user_exception_handler));
} else {
- EG(user_exception_handler) = zend_ptr_stack_pop(&EG(user_exception_handlers));
+ zval *tmp;
+
+ zend_stack_top(&EG(user_exception_handlers), (void**)&tmp);
+ ZVAL_COPY_VALUE(&EG(user_exception_handler), tmp);
+ zend_stack_del_top(&EG(user_exception_handlers));
}
RETURN_TRUE;
}
@@ -1655,14 +1591,14 @@ static int copy_class_or_interface_name(zend_class_entry **pce TSRMLS_DC, int nu
zend_uint comply_mask = (comply)? mask:0;
zend_class_entry *ce = *pce;
- if ((hash_key->nKeyLength==0 || hash_key->arKey[0]!=0)
+ if ((hash_key->key && hash_key->key->val[0] != 0)
&& (comply_mask == (ce->ce_flags & mask))) {
if (ce->refcount > 1 &&
- (ce->name_length != hash_key->nKeyLength - 1 ||
- !same_name(hash_key->arKey, ce->name, ce->name_length))) {
- add_next_index_stringl(array, hash_key->arKey, hash_key->nKeyLength - 1, 1);
+ (ce->name->len != hash_key->key->len - 1 ||
+ !same_name(hash_key->key->val, ce->name->val, ce->name->len))) {
+ add_next_index_str(array, hash_key->key);
} else {
- add_next_index_stringl(array, ce->name, ce->name_length, 1);
+ add_next_index_str(array, ce->name);
}
}
return ZEND_HASH_APPLY_KEEP;
@@ -1723,14 +1659,14 @@ static int copy_function_name(zend_function *func TSRMLS_DC, int num_args, va_li
zval *internal_ar = va_arg(args, zval *),
*user_ar = va_arg(args, zval *);
- if (hash_key->nKeyLength == 0 || hash_key->arKey[0] == 0) {
+ if (hash_key->key == NULL || hash_key->key->val[0] == 0) {
return 0;
}
if (func->type == ZEND_INTERNAL_FUNCTION) {
- add_next_index_stringl(internal_ar, hash_key->arKey, hash_key->nKeyLength-1, 1);
+ add_next_index_str(internal_ar, hash_key->key);
} else if (func->type == ZEND_USER_FUNCTION) {
- add_next_index_stringl(user_ar, hash_key->arKey, hash_key->nKeyLength-1, 1);
+ add_next_index_str(user_ar, hash_key->key);
}
return 0;
@@ -1741,23 +1677,21 @@ static int copy_function_name(zend_function *func TSRMLS_DC, int num_args, va_li
Returns an array of all defined functions */
ZEND_FUNCTION(get_defined_functions)
{
- zval *internal;
- zval *user;
+ zval internal, user, *ret;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
- MAKE_STD_ZVAL(internal);
- MAKE_STD_ZVAL(user);
-
- array_init(internal);
- array_init(user);
+ array_init(&internal);
+ array_init(&user);
array_init(return_value);
- zend_hash_apply_with_arguments(EG(function_table) TSRMLS_CC, (apply_func_args_t) copy_function_name, 2, internal, user);
+ zend_hash_apply_with_arguments(EG(function_table) TSRMLS_CC, (apply_func_args_t) copy_function_name, 2, &internal, &user);
- if (zend_hash_add(Z_ARRVAL_P(return_value), "internal", sizeof("internal"), (void **)&internal, sizeof(zval *), NULL) == FAILURE) {
+ ret = zend_hash_str_add(Z_ARRVAL_P(return_value), "internal", sizeof("internal")-1, &internal);
+
+ if (!ret) {
zval_ptr_dtor(&internal);
zval_ptr_dtor(&user);
zval_dtor(return_value);
@@ -1765,7 +1699,8 @@ ZEND_FUNCTION(get_defined_functions)
RETURN_FALSE;
}
- if (zend_hash_add(Z_ARRVAL_P(return_value), "user", sizeof("user"), (void **)&user, sizeof(zval *), NULL) == FAILURE) {
+ ret = zend_hash_str_add(Z_ARRVAL_P(return_value), "user", sizeof("user")-1, &user);
+ if (!ret) {
zval_ptr_dtor(&user);
zval_dtor(return_value);
zend_error(E_WARNING, "Cannot add user functions to return value from get_defined_functions()");
@@ -1785,8 +1720,7 @@ ZEND_FUNCTION(get_defined_vars)
array_init_size(return_value, zend_hash_num_elements(EG(active_symbol_table)));
- zend_hash_copy(Z_ARRVAL_P(return_value), EG(active_symbol_table),
- (copy_ctor_func_t)zval_add_ref, NULL, sizeof(zval *));
+ zend_hash_copy(Z_ARRVAL_P(return_value), EG(active_symbol_table), zval_add_ref);
}
/* }}} */
@@ -1796,8 +1730,9 @@ ZEND_FUNCTION(get_defined_vars)
Creates an anonymous function, and returns its name (funny, eh?) */
ZEND_FUNCTION(create_function)
{
- char *eval_code, *function_name, *function_args, *function_code;
- int eval_code_length, function_name_length, function_args_len, function_code_len;
+ zend_string *function_name;
+ char *eval_code, *function_args, *function_code;
+ int eval_code_length, function_args_len, function_code_len;
int retval;
char *eval_name;
@@ -1834,23 +1769,24 @@ ZEND_FUNCTION(create_function)
if (retval==SUCCESS) {
zend_function new_function, *func;
- if (zend_hash_find(EG(function_table), LAMBDA_TEMP_FUNCNAME, sizeof(LAMBDA_TEMP_FUNCNAME), (void **) &func)==FAILURE) {
+ func = zend_hash_str_find_ptr(EG(function_table), LAMBDA_TEMP_FUNCNAME, sizeof(LAMBDA_TEMP_FUNCNAME)-1);
+ if (!func) {
zend_error(E_ERROR, "Unexpected inconsistency in create_function()");
RETURN_FALSE;
}
new_function = *func;
function_add_ref(&new_function);
- function_name = (char *) emalloc(sizeof("0lambda_")+MAX_LENGTH_OF_LONG);
- function_name[0] = '\0';
+ function_name = STR_ALLOC(sizeof("0lambda_")+MAX_LENGTH_OF_LONG, 0);
+ function_name->val[0] = '\0';
do {
- function_name_length = 1 + snprintf(function_name + 1, sizeof("lambda_")+MAX_LENGTH_OF_LONG, "lambda_%d", ++EG(lambda_count));
- } while (zend_hash_add(EG(function_table), function_name, function_name_length+1, &new_function, sizeof(zend_function), NULL)==FAILURE);
- zend_hash_del(EG(function_table), LAMBDA_TEMP_FUNCNAME, sizeof(LAMBDA_TEMP_FUNCNAME));
- RETURN_STRINGL(function_name, function_name_length, 0);
+ function_name->len = snprintf(function_name->val + 1, sizeof("lambda_")+MAX_LENGTH_OF_LONG, "lambda_%d", ++EG(lambda_count));
+ } while (zend_hash_add_mem(EG(function_table), function_name, &new_function, sizeof(zend_function)) == NULL);
+ zend_hash_str_del(EG(function_table), LAMBDA_TEMP_FUNCNAME, sizeof(LAMBDA_TEMP_FUNCNAME)-1);
+ RETURN_STR(function_name);
} else {
- zend_hash_del(EG(function_table), LAMBDA_TEMP_FUNCNAME, sizeof(LAMBDA_TEMP_FUNCNAME));
+ zend_hash_str_del(EG(function_table), LAMBDA_TEMP_FUNCNAME, sizeof(LAMBDA_TEMP_FUNCNAME)-1);
RETURN_FALSE;
}
}
@@ -1862,7 +1798,7 @@ ZEND_FUNCTION(zend_test_func)
{
zval *arg1, *arg2;
- zend_get_parameters(ht, 2, &arg1, &arg2);
+ zend_get_parameters(ZEND_NUM_ARGS(), 2, &arg1, &arg2);
}
@@ -1885,11 +1821,11 @@ ZEND_FUNCTION(get_resource_type)
return;
}
- resource_type = zend_rsrc_list_get_rsrc_type(Z_LVAL_P(z_resource_type) TSRMLS_CC);
+ resource_type = zend_rsrc_list_get_rsrc_type(Z_RES_P(z_resource_type) TSRMLS_CC);
if (resource_type) {
- RETURN_STRING(resource_type, 1);
+ RETURN_STRING(resource_type);
} else {
- RETURN_STRING("Unknown", 1);
+ RETURN_STRING("Unknown");
}
}
/* }}} */
@@ -1912,18 +1848,15 @@ static int add_zendext_info(zend_extension *ext, void *arg TSRMLS_DC)
static int add_constant_info(zend_constant *constant, void *arg TSRMLS_DC)
{
zval *name_array = (zval *)arg;
- zval *const_val;
+ zval const_val;
if (!constant->name) {
/* skip special constants */
return 0;
}
- MAKE_STD_ZVAL(const_val);
- *const_val = constant->value;
- zval_copy_ctor(const_val);
- INIT_PZVAL(const_val);
- add_assoc_zval_ex(name_array, constant->name, constant->name_len, const_val);
+ ZVAL_DUP(&const_val, &constant->value);
+ add_assoc_zval_ex(name_array, constant->name->val, constant->name->len, &const_val);
return 0;
}
@@ -1965,17 +1898,17 @@ ZEND_FUNCTION(get_defined_constants)
HashPosition pos;
zend_constant *val;
int module_number;
- zval **modules;
+ zval *modules;
char **module_names;
zend_module_entry *module;
int i = 1;
- modules = ecalloc(zend_hash_num_elements(&module_registry) + 2, sizeof(zval *));
+ modules = ecalloc(zend_hash_num_elements(&module_registry) + 2, sizeof(zval));
module_names = emalloc((zend_hash_num_elements(&module_registry) + 2) * sizeof(char *));
module_names[0] = "internal";
zend_hash_internal_pointer_reset_ex(&module_registry, &pos);
- while (zend_hash_get_current_data_ex(&module_registry, (void *) &module, &pos) != FAILURE) {
+ while ((module = zend_hash_get_current_data_ptr_ex(&module_registry, &pos)) != NULL) {
module_names[module->module_number] = (char *)module->name;
i++;
zend_hash_move_forward_ex(&module_registry, &pos);
@@ -1983,8 +1916,8 @@ ZEND_FUNCTION(get_defined_constants)
module_names[i] = "user";
zend_hash_internal_pointer_reset_ex(EG(zend_constants), &pos);
- while (zend_hash_get_current_data_ex(EG(zend_constants), (void **) &val, &pos) != FAILURE) {
- zval *const_val;
+ while ((val = zend_hash_get_current_data_ptr_ex(EG(zend_constants), &pos)) != NULL) {
+ zval const_val;
if (!val->name) {
/* skip special constants */
@@ -2000,18 +1933,15 @@ ZEND_FUNCTION(get_defined_constants)
module_number = val->module_number;
}
- if (!modules[module_number]) {
- MAKE_STD_ZVAL(modules[module_number]);
- array_init(modules[module_number]);
- add_assoc_zval(return_value, module_names[module_number], modules[module_number]);
+ if (Z_TYPE(modules[module_number]) == IS_UNDEF) {
+ array_init(&modules[module_number]);
+ add_assoc_zval(return_value, module_names[module_number], &modules[module_number]);
}
- MAKE_STD_ZVAL(const_val);
- *const_val = val->value;
- zval_copy_ctor(const_val);
- INIT_PZVAL(const_val);
+ ZVAL_DUP(&const_val, &val->value);
+//??? INIT_PZVAL(const_val);
- add_assoc_zval_ex(modules[module_number], val->name, val->name_len, const_val);
+ add_assoc_zval_ex(&modules[module_number], val->name->val, val->name->len, &const_val);
next_constant:
zend_hash_move_forward_ex(EG(zend_constants), &pos);
}
@@ -2024,45 +1954,42 @@ next_constant:
/* }}} */
-static zval *debug_backtrace_get_args(void **curpos TSRMLS_DC)
+static void debug_backtrace_get_args(zval *curpos, zval *arg_array TSRMLS_DC)
{
- void **p = curpos;
- zval *arg_array, **arg;
- int arg_count = (int)(zend_uintptr_t) *p;
+ zval *p = curpos;
+ zval *arg;
+ int arg_count = Z_LVAL_P(p);
- MAKE_STD_ZVAL(arg_array);
array_init_size(arg_array, arg_count);
p -= arg_count;
while (--arg_count >= 0) {
- arg = (zval **) p++;
- if (*arg) {
- if (Z_TYPE_PP(arg) != IS_OBJECT) {
+ arg = p++;
+ if (arg) {
+ if (Z_TYPE_P(arg) != IS_OBJECT) {
SEPARATE_ZVAL_TO_MAKE_IS_REF(arg);
}
- Z_ADDREF_PP(arg);
- add_next_index_zval(arg_array, *arg);
+ Z_ADDREF_P(arg);
+ add_next_index_zval(arg_array, arg);
} else {
add_next_index_null(arg_array);
}
}
-
- return arg_array;
}
void debug_print_backtrace_args(zval *arg_array TSRMLS_DC)
{
- zval **tmp;
+ zval *tmp;
HashPosition iterator;
int i = 0;
- zend_hash_internal_pointer_reset_ex(arg_array->value.ht, &iterator);
- while (zend_hash_get_current_data_ex(arg_array->value.ht, (void **) &tmp, &iterator) == SUCCESS) {
+ zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(arg_array), &iterator);
+ while ((tmp = zend_hash_get_current_data_ex(Z_ARRVAL_P(arg_array), &iterator)) != NULL) {
if (i++) {
ZEND_PUTS(", ");
}
- zend_print_flat_zval_r(*tmp TSRMLS_CC);
- zend_hash_move_forward_ex(arg_array->value.ht, &iterator);
+ zend_print_flat_zval_r(tmp TSRMLS_CC);
+ zend_hash_move_forward_ex(Z_ARRVAL_P(arg_array), &iterator);
}
}
@@ -2073,10 +2000,10 @@ ZEND_FUNCTION(debug_print_backtrace)
int lineno, frameno = 0;
const char *function_name;
const char *filename;
- const char *class_name = NULL;
+ zend_string *class_name = NULL;
char *call_type;
const char *include_filename = NULL;
- zval *arg_array = NULL;
+ zval arg_array;
int indent = 0;
long options = 0;
long limit = 0;
@@ -2085,17 +2012,19 @@ ZEND_FUNCTION(debug_print_backtrace)
return;
}
+ ZVAL_UNDEF(&arg_array);
ptr = EG(current_execute_data);
/* skip debug_backtrace() */
ptr = ptr->prev_execute_data;
while (ptr && (limit == 0 || frameno < limit)) {
- const char *free_class_name = NULL;
+//??? const char *free_class_name = NULL;
frameno++;
- class_name = call_type = NULL;
- arg_array = NULL;
+ class_name = NULL;
+ call_type = NULL;
+ ZVAL_UNDEF(&arg_array);
skip = ptr;
/* skip internal handler */
@@ -2109,7 +2038,7 @@ ZEND_FUNCTION(debug_print_backtrace)
}
if (skip->op_array) {
- filename = skip->op_array->filename;
+ filename = skip->op_array->filename->val;
lineno = skip->opline->lineno;
} else {
filename = NULL;
@@ -2119,24 +2048,18 @@ ZEND_FUNCTION(debug_print_backtrace)
function_name = (ptr->function_state.function->common.scope &&
ptr->function_state.function->common.scope->trait_aliases) ?
zend_resolve_method_name(
- ptr->object ?
- Z_OBJCE_P(ptr->object) :
+ Z_TYPE(ptr->object) != IS_UNDEF ?
+ Z_OBJCE(ptr->object) :
ptr->function_state.function->common.scope,
- ptr->function_state.function) :
- ptr->function_state.function->common.function_name;
+ ptr->function_state.function)->val :
+ ptr->function_state.function->common.function_name->val;
if (function_name) {
- if (ptr->object) {
+ if (Z_TYPE(ptr->object) != IS_UNDEF) {
if (ptr->function_state.function->common.scope) {
class_name = ptr->function_state.function->common.scope->name;
} else {
- zend_uint class_name_len;
- int dup;
-
- dup = zend_get_object_classname(ptr->object, &class_name, &class_name_len TSRMLS_CC);
- if(!dup) {
- free_class_name = class_name;
- }
+ class_name = zend_get_object_classname(&ptr->object TSRMLS_CC);
}
call_type = "->";
@@ -2149,7 +2072,7 @@ ZEND_FUNCTION(debug_print_backtrace)
}
if ((! ptr->opline) || ((ptr->opline->opcode == ZEND_DO_FCALL_BY_NAME) || (ptr->opline->opcode == ZEND_DO_FCALL))) {
if (ptr->function_state.arguments && (options & DEBUG_BACKTRACE_IGNORE_ARGS) == 0) {
- arg_array = debug_backtrace_get_args(ptr->function_state.arguments TSRMLS_CC);
+ debug_backtrace_get_args(ptr->function_state.arguments, &arg_array TSRMLS_CC);
}
}
} else {
@@ -2187,20 +2110,19 @@ ZEND_FUNCTION(debug_print_backtrace)
}
if (build_filename_arg && include_filename) {
- MAKE_STD_ZVAL(arg_array);
- array_init(arg_array);
- add_next_index_string(arg_array, (char*)include_filename, 1);
+ array_init(&arg_array);
+ add_next_index_string(&arg_array, (char*)include_filename, 1);
}
call_type = NULL;
}
zend_printf("#%-2d ", indent);
if (class_name) {
- ZEND_PUTS(class_name);
+ ZEND_PUTS(class_name->val);
ZEND_PUTS(call_type);
}
zend_printf("%s(", function_name);
- if (arg_array) {
- debug_print_backtrace_args(arg_array TSRMLS_CC);
+ if (Z_TYPE(arg_array) != IS_UNDEF) {
+ debug_print_backtrace_args(&arg_array TSRMLS_CC);
zval_ptr_dtor(&arg_array);
}
if (filename) {
@@ -2215,7 +2137,7 @@ ZEND_FUNCTION(debug_print_backtrace)
break;
}
if (prev->op_array) {
- zend_printf(") called at [%s:%d]\n", prev->op_array->filename, prev->opline->lineno);
+ zend_printf(") called at [%s:%d]\n", prev->op_array->filename->val, prev->opline->lineno);
break;
}
prev = prev->prev_execute_data;
@@ -2227,9 +2149,9 @@ ZEND_FUNCTION(debug_print_backtrace)
include_filename = filename;
ptr = skip->prev_execute_data;
++indent;
- if (free_class_name) {
- efree((char*)free_class_name);
- }
+//??? if (free_class_name) {
+//??? efree((char*)free_class_name);
+//??? }
}
}
@@ -2241,9 +2163,9 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int
int lineno, frameno = 0;
const char *function_name;
const char *filename;
- const char *class_name;
+ zend_string *class_name;
const char *include_filename = NULL;
- zval *stack_frame;
+ zval stack_frame;
ptr = EG(current_execute_data);
@@ -2261,8 +2183,7 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int
while (ptr && (limit == 0 || frameno < limit)) {
frameno++;
- MAKE_STD_ZVAL(stack_frame);
- array_init(stack_frame);
+ array_init(&stack_frame);
skip = ptr;
/* skip internal handler */
@@ -2276,10 +2197,10 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int
}
if (skip->op_array) {
- filename = skip->op_array->filename;
+ filename = skip->op_array->filename->val;
lineno = skip->opline->lineno;
- add_assoc_string_ex(stack_frame, "file", sizeof("file"), (char*)filename, 1);
- add_assoc_long_ex(stack_frame, "line", sizeof("line"), lineno);
+ add_assoc_string_ex(&stack_frame, "file", sizeof("file")-1, (char*)filename, 1);
+ add_assoc_long_ex(&stack_frame, "line", sizeof("line")-1, lineno);
/* try to fetch args only if an FCALL was just made - elsewise we're in the middle of a function
* and debug_baktrace() might have been called by the error_handler. in this case we don't
@@ -2295,8 +2216,8 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int
break;
}
if (prev->op_array) {
- add_assoc_string_ex(stack_frame, "file", sizeof("file"), (char*)prev->op_array->filename, 1);
- add_assoc_long_ex(stack_frame, "line", sizeof("line"), prev->opline->lineno);
+ add_assoc_str_ex(&stack_frame, "file", sizeof("file")-1, prev->op_array->filename);
+ add_assoc_long_ex(&stack_frame, "line", sizeof("line")-1, prev->opline->lineno);
break;
}
prev = prev->prev_execute_data;
@@ -2307,41 +2228,40 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int
function_name = (ptr->function_state.function->common.scope &&
ptr->function_state.function->common.scope->trait_aliases) ?
zend_resolve_method_name(
- ptr->object ?
- Z_OBJCE_P(ptr->object) :
+ Z_TYPE(ptr->object) != IS_UNDEF ?
+ Z_OBJCE(ptr->object) :
ptr->function_state.function->common.scope,
- ptr->function_state.function) :
- ptr->function_state.function->common.function_name;
+ ptr->function_state.function)->val :
+ ptr->function_state.function->common.function_name->val;
if (function_name) {
- add_assoc_string_ex(stack_frame, "function", sizeof("function"), (char*)function_name, 1);
+ add_assoc_string_ex(&stack_frame, "function", sizeof("function")-1, (char*)function_name, 1);
- if (ptr->object && Z_TYPE_P(ptr->object) == IS_OBJECT) {
+ if (Z_TYPE(ptr->object) == IS_OBJECT) {
if (ptr->function_state.function->common.scope) {
- add_assoc_string_ex(stack_frame, "class", sizeof("class"), (char*)ptr->function_state.function->common.scope->name, 1);
+ add_assoc_str_ex(&stack_frame, "class", sizeof("class")-1, ptr->function_state.function->common.scope->name);
} else {
- zend_uint class_name_len;
- int dup;
-
- dup = zend_get_object_classname(ptr->object, &class_name, &class_name_len TSRMLS_CC);
- add_assoc_string_ex(stack_frame, "class", sizeof("class"), (char*)class_name, dup);
+ class_name = zend_get_object_classname(&ptr->object TSRMLS_CC);
+ add_assoc_str_ex(&stack_frame, "class", sizeof("class")-1, class_name);
}
if ((options & DEBUG_BACKTRACE_PROVIDE_OBJECT) != 0) {
- add_assoc_zval_ex(stack_frame, "object", sizeof("object"), ptr->object);
- Z_ADDREF_P(ptr->object);
+ add_assoc_zval_ex(&stack_frame, "object", sizeof("object")-1, &ptr->object);
+ Z_ADDREF(ptr->object);
}
- add_assoc_string_ex(stack_frame, "type", sizeof("type"), "->", 1);
+ add_assoc_string_ex(&stack_frame, "type", sizeof("type")-1, "->", 1);
} else if (ptr->function_state.function->common.scope) {
- add_assoc_string_ex(stack_frame, "class", sizeof("class"), (char*)ptr->function_state.function->common.scope->name, 1);
- add_assoc_string_ex(stack_frame, "type", sizeof("type"), "::", 1);
+ add_assoc_str_ex(&stack_frame, "class", sizeof("class")-1, ptr->function_state.function->common.scope->name);
+ add_assoc_string_ex(&stack_frame, "type", sizeof("type")-1, "::", 1);
}
if ((options & DEBUG_BACKTRACE_IGNORE_ARGS) == 0 &&
((! ptr->opline) || ((ptr->opline->opcode == ZEND_DO_FCALL_BY_NAME) || (ptr->opline->opcode == ZEND_DO_FCALL)))) {
if (ptr->function_state.arguments) {
- add_assoc_zval_ex(stack_frame, "args", sizeof("args"), debug_backtrace_get_args(ptr->function_state.arguments TSRMLS_CC));
+ zval args;
+ debug_backtrace_get_args(ptr->function_state.arguments, &args TSRMLS_CC);
+ add_assoc_zval_ex(&stack_frame, "args", sizeof("args")-1, &args TSRMLS_CC);
}
}
} else {
@@ -2379,23 +2299,22 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int
}
if (build_filename_arg && include_filename) {
- zval *arg_array;
+ zval arg_array;
- MAKE_STD_ZVAL(arg_array);
- array_init(arg_array);
+ array_init(&arg_array);
/* include_filename always points to the last filename of the last last called-function.
if we have called include in the frame above - this is the file we have included.
*/
- add_next_index_string(arg_array, (char*)include_filename, 1);
- add_assoc_zval_ex(stack_frame, "args", sizeof("args"), arg_array);
+ add_next_index_string(&arg_array, (char*)include_filename, 1);
+ add_assoc_zval_ex(&stack_frame, "args", sizeof("args")-1, &arg_array);
}
- add_assoc_string_ex(stack_frame, "function", sizeof("function"), (char*)function_name, 1);
+ add_assoc_string_ex(&stack_frame, "function", sizeof("function")-1, (char*)function_name, 1);
}
- add_next_index_zval(return_value, stack_frame);
+ add_next_index_zval(return_value, &stack_frame);
include_filename = filename;
@@ -2426,19 +2345,20 @@ ZEND_FUNCTION(extension_loaded)
{
char *extension_name;
int extension_name_len;
- char *lcname;
+ zend_string *lcname;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &extension_name, &extension_name_len) == FAILURE) {
return;
}
- lcname = zend_str_tolower_dup(extension_name, extension_name_len);
- if (zend_hash_exists(&module_registry, lcname, extension_name_len+1)) {
+ lcname = STR_ALLOC(extension_name_len, 0);
+ zend_str_tolower_copy(lcname->val, extension_name, extension_name_len);
+ if (zend_hash_exists(&module_registry, lcname)) {
RETVAL_TRUE;
} else {
RETVAL_FALSE;
}
- efree(lcname);
+ STR_FREE(lcname);
}
/* }}} */
@@ -2447,7 +2367,8 @@ ZEND_FUNCTION(extension_loaded)
Returns an array with the names of functions belonging to the named extension */
ZEND_FUNCTION(get_extension_funcs)
{
- char *extension_name, *lcname;
+ char *extension_name;
+ zend_string *lcname;
int extension_name_len, array;
zend_module_entry *module;
HashPosition iterator;
@@ -2456,13 +2377,14 @@ ZEND_FUNCTION(get_extension_funcs)
return;
}
if (strncasecmp(extension_name, "zend", sizeof("zend"))) {
- lcname = zend_str_tolower_dup(extension_name, extension_name_len);
+ lcname = STR_ALLOC(extension_name_len, 0);
+ zend_str_tolower_copy(lcname->val, extension_name, extension_name_len);
} else {
- lcname = estrdup("core");
+ lcname = STR_INIT("core", sizeof("core")-1, 0);
}
- if (zend_hash_find(&module_registry, lcname,
- extension_name_len+1, (void**)&module) == FAILURE) {
- efree(lcname);
+ module = zend_hash_find_ptr(&module_registry, lcname);
+ STR_FREE(lcname);
+ if (!module) {
RETURN_FALSE;
}
@@ -2474,20 +2396,18 @@ ZEND_FUNCTION(get_extension_funcs)
} else {
array = 0;
}
- while (zend_hash_get_current_data_ex(CG(function_table), (void **) &zif, &iterator) == SUCCESS) {
+ while ((zif = zend_hash_get_current_data_ptr_ex(CG(function_table), &iterator)) == SUCCESS) {
if (zif->common.type==ZEND_INTERNAL_FUNCTION
&& zif->internal_function.module == module) {
if (!array) {
array_init(return_value);
array = 1;
}
- add_next_index_string(return_value, zif->common.function_name, 1);
+ add_next_index_str(return_value, zif->common.function_name);
}
zend_hash_move_forward_ex(CG(function_table), &iterator);
}
- efree(lcname);
-
if (!array) {
RETURN_FALSE;
}
diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c
index d714b35b39..d0c0ebb4b3 100644
--- a/Zend/zend_closures.c
+++ b/Zend/zend_closures.c
@@ -37,7 +37,7 @@
typedef struct _zend_closure {
zend_object std;
zend_function func;
- zval *this_ptr;
+ zval this_ptr;
HashTable *debug_info;
} zend_closure;
@@ -48,24 +48,20 @@ static zend_object_handlers closure_handlers;
ZEND_METHOD(Closure, __invoke) /* {{{ */
{
zend_function *func = EG(current_execute_data)->function_state.function;
- zval ***arguments;
- zval *closure_result_ptr = NULL;
+ zval *arguments;
- arguments = emalloc(sizeof(zval**) * ZEND_NUM_ARGS());
+ arguments = emalloc(sizeof(zval) * ZEND_NUM_ARGS());
if (zend_get_parameters_array_ex(ZEND_NUM_ARGS(), arguments) == FAILURE) {
efree(arguments);
zend_error(E_RECOVERABLE_ERROR, "Cannot get arguments for calling closure");
RETVAL_FALSE;
- } else if (call_user_function_ex(CG(function_table), NULL, this_ptr, &closure_result_ptr, ZEND_NUM_ARGS(), arguments, 1, NULL TSRMLS_CC) == FAILURE) {
+ } else if (call_user_function_ex(CG(function_table), NULL, this_ptr, return_value, ZEND_NUM_ARGS(), arguments, 1, NULL TSRMLS_CC) == FAILURE) {
RETVAL_FALSE;
- } else if (closure_result_ptr) {
- zval_ptr_dtor(&return_value);
- *return_value_ptr = closure_result_ptr;
}
efree(arguments);
/* destruct the function also, then - we have allocated it in get_method */
- efree((char*)func->internal_function.function_name);
+ STR_RELEASE(func->internal_function.function_name);
efree(func);
}
/* }}} */
@@ -76,13 +72,13 @@ ZEND_METHOD(Closure, bind)
{
zval *newthis, *zclosure, *scope_arg = NULL;
zend_closure *closure;
- zend_class_entry *ce, **ce_p;
+ zend_class_entry *ce;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oo!|z", &zclosure, zend_ce_closure, &newthis, &scope_arg) == FAILURE) {
RETURN_NULL();
}
- closure = (zend_closure *)zend_object_store_get_object(zclosure TSRMLS_CC);
+ closure = (zend_closure *)Z_OBJ_P(zclosure);
if ((newthis != NULL) && (closure->func.common.fn_flags & ZEND_ACC_STATIC)) {
zend_error(E_WARNING, "Cannot bind an instance to a static closure");
@@ -94,32 +90,25 @@ ZEND_METHOD(Closure, bind)
} else if (Z_TYPE_P(scope_arg) == IS_NULL) {
ce = NULL;
} else {
- char *class_name;
- int class_name_len;
+ zend_string *class_name;
zval tmp_zval;
- INIT_ZVAL(tmp_zval);
if (Z_TYPE_P(scope_arg) == IS_STRING) {
- class_name = Z_STRVAL_P(scope_arg);
- class_name_len = Z_STRLEN_P(scope_arg);
+ class_name = Z_STR_P(scope_arg);
} else {
- tmp_zval = *scope_arg;
- zval_copy_ctor(&tmp_zval);
+ ZVAL_DUP(&tmp_zval, scope_arg);
convert_to_string(&tmp_zval);
- class_name = Z_STRVAL(tmp_zval);
- class_name_len = Z_STRLEN(tmp_zval);
+ class_name = Z_STR(tmp_zval);
}
- if ((class_name_len == sizeof("static") - 1) &&
- (memcmp("static", class_name, sizeof("static") - 1) == 0)) {
+ if ((class_name->len == sizeof("static") - 1) &&
+ (memcmp("static", class_name->val, sizeof("static") - 1) == 0)) {
ce = closure->func.common.scope;
}
- else if (zend_lookup_class_ex(class_name, class_name_len, NULL, 1, &ce_p TSRMLS_CC) == FAILURE) {
- zend_error(E_WARNING, "Class '%s' not found", class_name);
+ else if ((ce = zend_lookup_class_ex(class_name, NULL, 1 TSRMLS_CC)) == NULL) {
+ zend_error(E_WARNING, "Class '%s' not found", class_name->val);
zval_dtor(&tmp_zval);
RETURN_NULL();
- } else {
- ce = *ce_p;
}
zval_dtor(&tmp_zval);
}
@@ -140,13 +129,13 @@ static zend_function *zend_closure_get_constructor(zval *object TSRMLS_DC) /* {{
static int zend_closure_compare_objects(zval *o1, zval *o2 TSRMLS_DC) /* {{{ */
{
- return (Z_OBJ_HANDLE_P(o1) != Z_OBJ_HANDLE_P(o2));
+ return (Z_OBJ_P(o1) != Z_OBJ_P(o2));
}
/* }}} */
ZEND_API zend_function *zend_get_closure_invoke_method(zval *obj TSRMLS_DC) /* {{{ */
{
- zend_closure *closure = (zend_closure *)zend_object_store_get_object(obj TSRMLS_CC);
+ zend_closure *closure = (zend_closure *)Z_OBJ_P(obj);
zend_function *invoke = (zend_function*)emalloc(sizeof(zend_function));
invoke->common = closure->func.common;
@@ -155,47 +144,45 @@ ZEND_API zend_function *zend_get_closure_invoke_method(zval *obj TSRMLS_DC) /* {
invoke->internal_function.handler = ZEND_MN(Closure___invoke);
invoke->internal_function.module = 0;
invoke->internal_function.scope = zend_ce_closure;
- invoke->internal_function.function_name = estrndup(ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1);
+ invoke->internal_function.function_name = STR_INIT(ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1, 0);
return invoke;
}
/* }}} */
ZEND_API const zend_function *zend_get_closure_method_def(zval *obj TSRMLS_DC) /* {{{ */
{
- zend_closure *closure = (zend_closure *)zend_object_store_get_object(obj TSRMLS_CC);
+ zend_closure *closure = (zend_closure *)Z_OBJ_P(obj);
return &closure->func;
}
/* }}} */
ZEND_API zval* zend_get_closure_this_ptr(zval *obj TSRMLS_DC) /* {{{ */
{
- zend_closure *closure = (zend_closure *)zend_object_store_get_object(obj TSRMLS_CC);
- return closure->this_ptr;
+ zend_closure *closure = (zend_closure *)Z_OBJ_P(obj);
+ return &closure->this_ptr;
}
/* }}} */
-static zend_function *zend_closure_get_method(zval **object_ptr, char *method_name, int method_len, const zend_literal *key TSRMLS_DC) /* {{{ */
+static zend_function *zend_closure_get_method(zval *object_ptr, zend_string *method, const zend_literal *key TSRMLS_DC) /* {{{ */
{
- char *lc_name;
- ALLOCA_FLAG(use_heap)
+ zend_string *lc_name;
- lc_name = do_alloca(method_len + 1, use_heap);
- zend_str_tolower_copy(lc_name, method_name, method_len);
- if ((method_len == sizeof(ZEND_INVOKE_FUNC_NAME)-1) &&
+ lc_name = STR_ALLOC(method->len, 0);
+ zend_str_tolower_copy(lc_name->val, method->val, method->len);
+ if ((method->len == sizeof(ZEND_INVOKE_FUNC_NAME)-1) &&
memcmp(lc_name, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) == 0
) {
- free_alloca(lc_name, use_heap);
- return zend_get_closure_invoke_method(*object_ptr TSRMLS_CC);
+ STR_FREE(lc_name);
+ return zend_get_closure_invoke_method(object_ptr TSRMLS_CC);
}
- free_alloca(lc_name, use_heap);
- return std_object_handlers.get_method(object_ptr, method_name, method_len, key TSRMLS_CC);
+ STR_FREE(lc_name);
+ return std_object_handlers.get_method(object_ptr, method, key TSRMLS_CC);
}
/* }}} */
static zval *zend_closure_read_property(zval *object, zval *member, int type, const zend_literal *key TSRMLS_DC) /* {{{ */
{
ZEND_CLOSURE_PROPERTY_ERROR();
- Z_ADDREF(EG(uninitialized_zval));
return &EG(uninitialized_zval);
}
/* }}} */
@@ -206,7 +193,7 @@ static void zend_closure_write_property(zval *object, zval *member, zval *value,
}
/* }}} */
-static zval **zend_closure_get_property_ptr_ptr(zval *object, zval *member, int type, const zend_literal *key TSRMLS_DC) /* {{{ */
+static zval *zend_closure_get_property_ptr_ptr(zval *object, zval *member, int type, const zend_literal *key TSRMLS_DC) /* {{{ */
{
ZEND_CLOSURE_PROPERTY_ERROR();
return NULL;
@@ -228,7 +215,7 @@ static void zend_closure_unset_property(zval *object, zval *member, const zend_l
}
/* }}} */
-static void zend_closure_free_storage(void *object TSRMLS_DC) /* {{{ */
+static void zend_closure_free_storage(zend_object *object TSRMLS_DC) /* {{{ */
{
zend_closure *closure = (zend_closure *)object;
@@ -250,7 +237,7 @@ static void zend_closure_free_storage(void *object TSRMLS_DC) /* {{{ */
efree(closure->debug_info);
}
- if (closure->this_ptr) {
+ if (Z_TYPE(closure->this_ptr) != IS_UNDEF) {
zval_ptr_dtor(&closure->this_ptr);
}
@@ -258,34 +245,31 @@ static void zend_closure_free_storage(void *object TSRMLS_DC) /* {{{ */
}
/* }}} */
-static zend_object_value zend_closure_new(zend_class_entry *class_type TSRMLS_DC) /* {{{ */
+static zend_object *zend_closure_new(zend_class_entry *class_type TSRMLS_DC) /* {{{ */
{
zend_closure *closure;
- zend_object_value object;
closure = emalloc(sizeof(zend_closure));
memset(closure, 0, sizeof(zend_closure));
zend_object_std_init(&closure->std, class_type TSRMLS_CC);
+ closure->std.handlers = &closure_handlers;
- object.handle = zend_objects_store_put(closure, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) zend_closure_free_storage, NULL TSRMLS_CC);
- object.handlers = &closure_handlers;
-
- return object;
+ return (zend_object*)closure;
}
/* }}} */
-static zend_object_value zend_closure_clone(zval *zobject TSRMLS_DC) /* {{{ */
+static zend_object *zend_closure_clone(zval *zobject TSRMLS_DC) /* {{{ */
{
- zend_closure *closure = (zend_closure *)zend_object_store_get_object(zobject TSRMLS_CC);
+ zend_closure *closure = (zend_closure *)Z_OBJ_P(zobject);
zval result;
- zend_create_closure(&result, &closure->func, closure->func.common.scope, closure->this_ptr TSRMLS_CC);
- return Z_OBJVAL(result);
+ zend_create_closure(&result, &closure->func, closure->func.common.scope, &closure->this_ptr TSRMLS_CC);
+ return Z_OBJ(result);
}
/* }}} */
-int zend_closure_get_closure(zval *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zval **zobj_ptr TSRMLS_DC) /* {{{ */
+int zend_closure_get_closure(zval *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zval *zobj_ptr TSRMLS_DC) /* {{{ */
{
zend_closure *closure;
@@ -293,17 +277,17 @@ int zend_closure_get_closure(zval *obj, zend_class_entry **ce_ptr, zend_function
return FAILURE;
}
- closure = (zend_closure *)zend_object_store_get_object(obj TSRMLS_CC);
+ closure = (zend_closure *)Z_OBJ_P(obj);
*fptr_ptr = &closure->func;
- if (closure->this_ptr) {
+ if (Z_TYPE(closure->this_ptr) != IS_UNDEF) {
if (zobj_ptr) {
- *zobj_ptr = closure->this_ptr;
+ ZVAL_COPY_VALUE(zobj_ptr, &closure->this_ptr);
}
- *ce_ptr = Z_OBJCE_P(closure->this_ptr);
+ *ce_ptr = Z_OBJCE(closure->this_ptr);
} else {
if (zobj_ptr) {
- *zobj_ptr = NULL;
+ ZVAL_UNDEF(zobj_ptr);
}
*ce_ptr = closure->func.common.scope;
}
@@ -313,8 +297,8 @@ int zend_closure_get_closure(zval *obj, zend_class_entry **ce_ptr, zend_function
static HashTable *zend_closure_get_debug_info(zval *object, int *is_temp TSRMLS_DC) /* {{{ */
{
- zend_closure *closure = (zend_closure *)zend_object_store_get_object(object TSRMLS_CC);
- zval *val;
+ zend_closure *closure = (zend_closure *)Z_OBJ_P(object);
+ zval val;
struct _zend_arg_info *arg_info = closure->func.common.arg_info;
*is_temp = 0;
@@ -326,22 +310,20 @@ static HashTable *zend_closure_get_debug_info(zval *object, int *is_temp TSRMLS_
if (closure->debug_info->nApplyCount == 0) {
if (closure->func.type == ZEND_USER_FUNCTION && closure->func.op_array.static_variables) {
HashTable *static_variables = closure->func.op_array.static_variables;
- MAKE_STD_ZVAL(val);
- array_init(val);
- zend_hash_copy(Z_ARRVAL_P(val), static_variables, (copy_ctor_func_t)zval_add_ref, NULL, sizeof(zval*));
- zend_hash_update(closure->debug_info, "static", sizeof("static"), (void *) &val, sizeof(zval *), NULL);
+ array_init(&val);
+ zend_hash_copy(Z_ARRVAL(val), static_variables, zval_add_ref);
+ zend_hash_str_update(closure->debug_info, "static", sizeof("static")-1, &val);
}
- if (closure->this_ptr) {
- Z_ADDREF_P(closure->this_ptr);
- zend_symtable_update(closure->debug_info, "this", sizeof("this"), (void *) &closure->this_ptr, sizeof(zval *), NULL);
+ if (Z_TYPE(closure->this_ptr) != IS_UNDEF) {
+ Z_ADDREF(closure->this_ptr);
+ zend_hash_str_update(closure->debug_info, "this", sizeof("this")-1, &closure->this_ptr);
}
if (arg_info) {
zend_uint i, required = closure->func.common.required_num_args;
- MAKE_STD_ZVAL(val);
- array_init(val);
+ array_init(&val);
for (i = 0; i < closure->func.common.num_args; i++) {
char *name, *info;
@@ -356,12 +338,12 @@ static HashTable *zend_closure_get_debug_info(zval *object, int *is_temp TSRMLS_
i + 1);
}
info_len = zend_spprintf(&info, 0, "%s",
- i >= required ? "<optional>" : "<required>");
- add_assoc_stringl_ex(val, name, name_len + 1, info, info_len, 0);
+ i >= required ? "<optional>" : "<required>");
+ add_assoc_stringl_ex(&val, name, name_len, info, info_len, 0);
efree(name);
arg_info++;
}
- zend_hash_update(closure->debug_info, "parameter", sizeof("parameter"), (void *) &val, sizeof(zval *), NULL);
+ zend_hash_str_update(closure->debug_info, "parameter", sizeof("parameter")-1, &val);
}
}
@@ -369,12 +351,12 @@ static HashTable *zend_closure_get_debug_info(zval *object, int *is_temp TSRMLS_
}
/* }}} */
-static HashTable *zend_closure_get_gc(zval *obj, zval ***table, int *n TSRMLS_DC) /* {{{ */
+static HashTable *zend_closure_get_gc(zval *obj, zval **table, int *n TSRMLS_DC) /* {{{ */
{
- zend_closure *closure = (zend_closure *)zend_object_store_get_object(obj TSRMLS_CC);
+ zend_closure *closure = (zend_closure *)Z_OBJ_P(obj);
- *table = closure->this_ptr ? &closure->this_ptr : NULL;
- *n = closure->this_ptr ? 1 : 0;
+ *table = Z_TYPE(closure->this_ptr) != IS_NULL ? &closure->this_ptr : NULL;
+ *n = Z_TYPE(closure->this_ptr) != IS_NULL ? 1 : 0;
return (closure->func.type == ZEND_USER_FUNCTION) ?
closure->func.op_array.static_variables : NULL;
}
@@ -418,6 +400,8 @@ void zend_register_closure_ce(TSRMLS_D) /* {{{ */
zend_ce_closure->unserialize = zend_class_unserialize_deny;
memcpy(&closure_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
+ closure_handlers.free_obj = zend_closure_free_storage;
+ closure_handlers.clone_obj = NULL;
closure_handlers.get_constructor = zend_closure_get_constructor;
closure_handlers.get_method = zend_closure_get_method;
closure_handlers.write_property = zend_closure_write_property;
@@ -439,7 +423,7 @@ ZEND_API void zend_create_closure(zval *res, zend_function *func, zend_class_ent
object_init_ex(res, zend_ce_closure);
- closure = (zend_closure *)zend_object_store_get_object(res TSRMLS_CC);
+ closure = (zend_closure *)Z_OBJ_P(res);
closure->func = *func;
closure->func.common.prototype = NULL;
@@ -464,12 +448,12 @@ ZEND_API void zend_create_closure(zval *res, zend_function *func, zend_class_ent
/* verify that we aren't binding internal function to a wrong scope */
if(func->common.scope != NULL) {
if(scope && !instanceof_function(scope, func->common.scope TSRMLS_CC)) {
- zend_error(E_WARNING, "Cannot bind function %s::%s to scope class %s", func->common.scope->name, func->common.function_name, scope->name);
+ zend_error(E_WARNING, "Cannot bind function %s::%s to scope class %s", func->common.scope->name->val, func->common.function_name->val, scope->name->val);
scope = NULL;
}
if(scope && this_ptr && (func->common.fn_flags & ZEND_ACC_STATIC) == 0 &&
!instanceof_function(Z_OBJCE_P(this_ptr), closure->func.common.scope TSRMLS_CC)) {
- zend_error(E_WARNING, "Cannot bind function %s::%s to object of class %s", func->common.scope->name, func->common.function_name, Z_OBJCE_P(this_ptr)->name);
+ zend_error(E_WARNING, "Cannot bind function %s::%s to object of class %s", func->common.scope->name->val, func->common.function_name->val, Z_OBJCE_P(this_ptr)->name->val);
scope = NULL;
this_ptr = NULL;
}
@@ -487,14 +471,13 @@ ZEND_API void zend_create_closure(zval *res, zend_function *func, zend_class_ent
if (scope) {
closure->func.common.fn_flags |= ZEND_ACC_PUBLIC;
if (this_ptr && (closure->func.common.fn_flags & ZEND_ACC_STATIC) == 0) {
- closure->this_ptr = this_ptr;
- Z_ADDREF_P(this_ptr);
+ ZVAL_COPY(&closure->this_ptr, this_ptr);
} else {
closure->func.common.fn_flags |= ZEND_ACC_STATIC;
- closure->this_ptr = NULL;
+ ZVAL_UNDEF(&closure->this_ptr);
}
} else {
- closure->this_ptr = NULL;
+ ZVAL_UNDEF(&closure->this_ptr);
}
}
/* }}} */
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index f789e3397f..cffa756114 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -60,11 +60,6 @@
target = src; \
} while (0)
-#define CALCULATE_LITERAL_HASH(num) do { \
- zval *c = &CONSTANT(num); \
- Z_HASH_P(c) = str_hash(Z_STRVAL_P(c), Z_STRLEN_P(c)); \
- } while (0)
-
#define GET_CACHE_SLOT(literal) do { \
CG(active_op_array)->literals[literal].cache_slot = CG(active_op_array)->last_cache_slot++; \
if ((CG(active_op_array)->fn_flags & ZEND_ACC_INTERACTIVE) && CG(active_op_array)->run_time_cache) { \
@@ -104,31 +99,31 @@ ZEND_API zend_executor_globals executor_globals;
static void zend_duplicate_property_info(zend_property_info *property_info) /* {{{ */
{
- property_info->name = str_estrndup(property_info->name, property_info->name_length);
+ STR_ADDREF(property_info->name);
if (property_info->doc_comment) {
- property_info->doc_comment = estrndup(property_info->doc_comment, property_info->doc_comment_len);
+ STR_ADDREF(property_info->doc_comment);
}
}
/* }}} */
static void zend_duplicate_property_info_internal(zend_property_info *property_info) /* {{{ */
{
- property_info->name = str_strndup(property_info->name, property_info->name_length);
+ STR_ADDREF(property_info->name);
}
/* }}} */
static void zend_destroy_property_info(zend_property_info *property_info) /* {{{ */
{
- str_efree(property_info->name);
+ STR_RELEASE(property_info->name);
if (property_info->doc_comment) {
- efree((char*)property_info->doc_comment);
+ STR_RELEASE(property_info->doc_comment);
}
}
/* }}} */
static void zend_destroy_property_info_internal(zend_property_info *property_info) /* {{{ */
{
- str_free((char*)property_info->name);
+ STR_RELEASE(property_info->name);
}
/* }}} */
@@ -140,28 +135,22 @@ static void build_runtime_defined_function_key(zval *result, const char *name, i
char_pos_len = zend_sprintf(char_pos_buf, "%p", LANG_SCNG(yy_text));
if (CG(active_op_array)->filename) {
- filename = CG(active_op_array)->filename;
+ filename = CG(active_op_array)->filename->val;
} else {
filename = "-";
}
/* NULL, name length, filename length, last accepting char position length */
- Z_STRLEN_P(result) = 1+name_length+strlen(filename)+char_pos_len;
+ ZVAL_STR(result, STR_ALLOC(1+name_length+strlen(filename)+char_pos_len, 0));
/* must be binary safe */
- Z_STRVAL_P(result) = (char *) safe_emalloc(Z_STRLEN_P(result), 1, 1);
- Z_STRVAL_P(result)[0] = '\0';
sprintf(Z_STRVAL_P(result)+1, "%s%s%s", name, filename, char_pos_buf);
-
- result->type = IS_STRING;
- Z_SET_REFCOUNT_P(result, 1);
}
/* }}} */
static void init_compiler_declarables(TSRMLS_D) /* {{{ */
{
- Z_TYPE(CG(declarables).ticks) = IS_LONG;
- Z_LVAL(CG(declarables).ticks) = 0;
+ ZVAL_LONG(&CG(declarables).ticks, 0);
}
/* }}} */
@@ -193,7 +182,7 @@ void zend_init_compiler_data_structures(TSRMLS_D) /* {{{ */
zend_stack_init(&CG(list_stack));
CG(in_compilation) = 0;
CG(start_lineno) = 0;
- CG(current_namespace) = NULL;
+ ZVAL_UNDEF(&CG(current_namespace));
CG(in_namespace) = 0;
CG(has_bracketed_namespaces) = 0;
CG(current_import) = NULL;
@@ -243,29 +232,29 @@ void shutdown_compiler(TSRMLS_D) /* {{{ */
}
/* }}} */
-ZEND_API char *zend_set_compiled_filename(const char *new_compiled_filename TSRMLS_DC) /* {{{ */
+ZEND_API zend_string *zend_set_compiled_filename(zend_string *new_compiled_filename TSRMLS_DC) /* {{{ */
{
- char **pp, *p;
- int length = strlen(new_compiled_filename);
+ zend_string *p;
- if (zend_hash_find(&CG(filenames_table), new_compiled_filename, length+1, (void **) &pp) == SUCCESS) {
- CG(compiled_filename) = *pp;
- return *pp;
+ p = zend_hash_find_ptr(&CG(filenames_table), new_compiled_filename);
+ if (p != NULL) {
+ CG(compiled_filename) = p;
+ return p;
}
- p = estrndup(new_compiled_filename, length);
- zend_hash_update(&CG(filenames_table), new_compiled_filename, length+1, &p, sizeof(char *), (void **) &pp);
+ p = STR_COPY(new_compiled_filename);
+ zend_hash_update_ptr(&CG(filenames_table), new_compiled_filename, p);
CG(compiled_filename) = p;
return p;
}
/* }}} */
-ZEND_API void zend_restore_compiled_filename(char *original_compiled_filename TSRMLS_DC) /* {{{ */
+ZEND_API void zend_restore_compiled_filename(zend_string *original_compiled_filename TSRMLS_DC) /* {{{ */
{
CG(compiled_filename) = original_compiled_filename;
}
/* }}} */
-ZEND_API char *zend_get_compiled_filename(TSRMLS_D) /* {{{ */
+ZEND_API zend_string *zend_get_compiled_filename(TSRMLS_D) /* {{{ */
{
return CG(compiled_filename);
}
@@ -285,21 +274,20 @@ ZEND_API zend_bool zend_is_compiling(TSRMLS_D) /* {{{ */
static zend_uint get_temporary_variable(zend_op_array *op_array) /* {{{ */
{
- return (zend_uint)(zend_uintptr_t)EX_TMP_VAR_NUM(0, (op_array->T)++);
+ return (zend_uint)(zend_uintptr_t)EX_VAR_NUM_2(0, (op_array->T)++);
}
/* }}} */
-static int lookup_cv(zend_op_array *op_array, char* name, int name_len, ulong hash TSRMLS_DC) /* {{{ */
-{
+static int lookup_cv(zend_op_array *op_array, zend_string* name TSRMLS_DC) /* {{{ */{
int i = 0;
- ulong hash_value = hash ? hash : zend_inline_hash_func(name, name_len+1);
+ ulong hash_value = STR_HASH_VAL(name);
while (i < op_array->last_var) {
- if (op_array->vars[i].name == name ||
- (op_array->vars[i].hash_value == hash_value &&
- op_array->vars[i].name_len == name_len &&
- memcmp(op_array->vars[i].name, name, name_len) == 0)) {
- str_efree(name);
+ if (op_array->vars[i]->val == name->val ||
+ (op_array->vars[i]->h == hash_value &&
+ op_array->vars[i]->len == name->len &&
+ memcmp(op_array->vars[i]->val, name->val, name->len) == 0)) {
+ STR_RELEASE(name);
return i;
}
i++;
@@ -308,11 +296,10 @@ static int lookup_cv(zend_op_array *op_array, char* name, int name_len, ulong ha
op_array->last_var++;
if (op_array->last_var > CG(context).vars_size) {
CG(context).vars_size += 16; /* FIXME */
- op_array->vars = erealloc(op_array->vars, CG(context).vars_size * sizeof(zend_compiled_variable));
+ op_array->vars = erealloc(op_array->vars, CG(context).vars_size * sizeof(zend_string*));
}
- op_array->vars[i].name = zend_new_interned_string(name, name_len + 1, 1 TSRMLS_CC);
- op_array->vars[i].name_len = name_len;
- op_array->vars[i].hash_value = hash_value;
+
+ op_array->vars[i] = zend_new_interned_string(name TSRMLS_CC);
return i;
}
/* }}} */
@@ -323,7 +310,7 @@ void zend_del_literal(zend_op_array *op_array, int n) /* {{{ */
if (n + 1 == op_array->last_literal) {
op_array->last_literal--;
} else {
- Z_TYPE(CONSTANT_EX(op_array, n)) = IS_NULL;
+ ZVAL_UNDEF(&CONSTANT_EX(op_array, n));
}
}
/* }}} */
@@ -332,13 +319,12 @@ void zend_del_literal(zend_op_array *op_array, int n) /* {{{ */
static inline void zend_insert_literal(zend_op_array *op_array, const zval *zv, int literal_position TSRMLS_DC) /* {{{ */
{
if (Z_TYPE_P(zv) == IS_STRING || Z_TYPE_P(zv) == IS_CONSTANT) {
- zval *z = (zval*)zv;
- Z_STRVAL_P(z) = (char*)zend_new_interned_string(Z_STRVAL_P(zv), Z_STRLEN_P(zv) + 1, 1 TSRMLS_CC);
+ STR_HASH_VAL(Z_STR_P(zv));
+ zend_new_interned_string(Z_STR_P(zv) TSRMLS_CC);
}
- CONSTANT_EX(op_array, literal_position) = *zv;
- Z_SET_REFCOUNT(CONSTANT_EX(op_array, literal_position), 2);
- Z_SET_ISREF(CONSTANT_EX(op_array, literal_position));
- op_array->literals[literal_position].hash_value = 0;
+ ZVAL_COPY_VALUE(&CONSTANT_EX(op_array, literal_position), zv);
+//??? Z_SET_REFCOUNT(CONSTANT_EX(op_array, literal_position), 2);
+//??? Z_SET_ISREF(CONSTANT_EX(op_array, literal_position));
op_array->literals[literal_position].cache_slot = -1;
}
/* }}} */
@@ -376,9 +362,8 @@ int zend_append_individual_literal(zend_op_array *op_array, const zval *zv TSRML
int zend_add_func_name_literal(zend_op_array *op_array, const zval *zv TSRMLS_DC) /* {{{ */
{
int ret;
- char *lc_name;
+ zend_string *lc_name;
zval c;
- int lc_literal;
if (op_array->last_literal > 0 &&
&op_array->literals[op_array->last_literal - 1].constant == zv &&
@@ -389,10 +374,10 @@ int zend_add_func_name_literal(zend_op_array *op_array, const zval *zv TSRMLS_DC
ret = zend_add_literal(op_array, zv TSRMLS_CC);
}
- lc_name = zend_str_tolower_dup(Z_STRVAL_P(zv), Z_STRLEN_P(zv));
- ZVAL_STRINGL(&c, lc_name, Z_STRLEN_P(zv), 0);
- lc_literal = zend_add_literal(CG(active_op_array), &c TSRMLS_CC);
- CALCULATE_LITERAL_HASH(lc_literal);
+ lc_name = STR_ALLOC(Z_STRLEN_P(zv), 0);
+ zend_str_tolower_copy(lc_name->val, Z_STRVAL_P(zv), Z_STRLEN_P(zv));
+ ZVAL_STR(&c, lc_name);
+ zend_add_literal(CG(active_op_array), &c TSRMLS_CC);
return ret;
}
@@ -401,11 +386,10 @@ int zend_add_func_name_literal(zend_op_array *op_array, const zval *zv TSRMLS_DC
int zend_add_ns_func_name_literal(zend_op_array *op_array, const zval *zv TSRMLS_DC) /* {{{ */
{
int ret;
- char *lc_name;
+ zend_string *lc_name;
const char *ns_separator;
int lc_len;
zval c;
- int lc_literal;
if (op_array->last_literal > 0 &&
&op_array->literals[op_array->last_literal - 1].constant == zv &&
@@ -416,20 +400,20 @@ int zend_add_ns_func_name_literal(zend_op_array *op_array, const zval *zv TSRMLS
ret = zend_add_literal(op_array, zv TSRMLS_CC);
}
- lc_name = zend_str_tolower_dup(Z_STRVAL_P(zv), Z_STRLEN_P(zv));
- ZVAL_STRINGL(&c, lc_name, Z_STRLEN_P(zv), 0);
- lc_literal = zend_add_literal(CG(active_op_array), &c TSRMLS_CC);
- CALCULATE_LITERAL_HASH(lc_literal);
+ lc_name = STR_ALLOC(Z_STRLEN_P(zv), 0);
+ zend_str_tolower_copy(lc_name->val, Z_STRVAL_P(zv), Z_STRLEN_P(zv));
+ ZVAL_STR(&c, lc_name);
+ zend_add_literal(CG(active_op_array), &c TSRMLS_CC);
ns_separator = (const char*)zend_memrchr(Z_STRVAL_P(zv), '\\', Z_STRLEN_P(zv));
if (ns_separator != NULL) {
ns_separator += 1;
lc_len = Z_STRLEN_P(zv) - (ns_separator - Z_STRVAL_P(zv));
- lc_name = zend_str_tolower_dup(ns_separator, lc_len);
- ZVAL_STRINGL(&c, lc_name, lc_len, 0);
- lc_literal = zend_add_literal(CG(active_op_array), &c TSRMLS_CC);
- CALCULATE_LITERAL_HASH(lc_literal);
+ lc_name = STR_ALLOC(lc_len, 0);
+ zend_str_tolower_copy(lc_name->val, ns_separator, lc_len);
+ ZVAL_STR(&c, lc_name);
+ zend_add_literal(CG(active_op_array), &c TSRMLS_CC);
}
return ret;
@@ -439,10 +423,8 @@ int zend_add_ns_func_name_literal(zend_op_array *op_array, const zval *zv TSRMLS
int zend_add_class_name_literal(zend_op_array *op_array, const zval *zv TSRMLS_DC) /* {{{ */
{
int ret;
- char *lc_name;
- int lc_len;
+ zend_string *lc_name;
zval c;
- int lc_literal;
if (op_array->last_literal > 0 &&
&op_array->literals[op_array->last_literal - 1].constant == zv &&
@@ -454,15 +436,14 @@ int zend_add_class_name_literal(zend_op_array *op_array, const zval *zv TSRMLS_D
}
if (Z_STRVAL_P(zv)[0] == '\\') {
- lc_len = Z_STRLEN_P(zv) - 1;
- lc_name = zend_str_tolower_dup(Z_STRVAL_P(zv) + 1, lc_len);
+ lc_name = STR_ALLOC(Z_STRLEN_P(zv) - 1, 0);
+ zend_str_tolower_copy(lc_name->val, Z_STRVAL_P(zv) + 1, Z_STRLEN_P(zv) - 1);
} else {
- lc_len = Z_STRLEN_P(zv);
- lc_name = zend_str_tolower_dup(Z_STRVAL_P(zv), lc_len);
+ lc_name = STR_ALLOC(Z_STRLEN_P(zv), 0);
+ zend_str_tolower_copy(lc_name->val, Z_STRVAL_P(zv), Z_STRLEN_P(zv));
}
- ZVAL_STRINGL(&c, lc_name, lc_len, 0);
- lc_literal = zend_add_literal(CG(active_op_array), &c TSRMLS_CC);
- CALCULATE_LITERAL_HASH(lc_literal);
+ ZVAL_STR(&c, lc_name);
+ zend_add_literal(CG(active_op_array), &c TSRMLS_CC);
GET_CACHE_SLOT(ret);
@@ -472,8 +453,9 @@ int zend_add_class_name_literal(zend_op_array *op_array, const zval *zv TSRMLS_D
int zend_add_const_name_literal(zend_op_array *op_array, const zval *zv, int unqualified TSRMLS_DC) /* {{{ */
{
- int ret, tmp_literal;
- char *name, *tmp_name;
+ int ret;
+ char *name;
+ zend_string *tmp_name;
const char *ns_separator;
int name_len, ns_len;
zval c;
@@ -504,17 +486,16 @@ int zend_add_const_name_literal(zend_op_array *op_array, const zval *zv, int unq
if (ns_len) {
/* lowercased namespace name & original constant name */
- tmp_name = estrndup(name, name_len);
- zend_str_tolower(tmp_name, ns_len);
- ZVAL_STRINGL(&c, tmp_name, name_len, 0);
- tmp_literal = zend_add_literal(CG(active_op_array), &c TSRMLS_CC);
- CALCULATE_LITERAL_HASH(tmp_literal);
+ tmp_name = STR_INIT(name, name_len, 0);
+ zend_str_tolower(tmp_name->val, ns_len);
+ ZVAL_STR(&c, tmp_name);
+ zend_add_literal(CG(active_op_array), &c TSRMLS_CC);
/* lowercased namespace name & lowercased constant name */
- tmp_name = zend_str_tolower_dup(name, name_len);
- ZVAL_STRINGL(&c, tmp_name, name_len, 0);
- tmp_literal = zend_add_literal(CG(active_op_array), &c TSRMLS_CC);
- CALCULATE_LITERAL_HASH(tmp_literal);
+ tmp_name = STR_ALLOC(name_len, 0);
+ zend_str_tolower_copy(tmp_name->val, name, name_len);
+ ZVAL_STR(&c, tmp_name);
+ zend_add_literal(CG(active_op_array), &c TSRMLS_CC);
}
if (ns_len) {
@@ -527,24 +508,29 @@ int zend_add_const_name_literal(zend_op_array *op_array, const zval *zv, int unq
}
/* original constant name */
- tmp_name = estrndup(name, name_len);
- ZVAL_STRINGL(&c, tmp_name, name_len, 0);
- tmp_literal = zend_add_literal(CG(active_op_array), &c TSRMLS_CC);
- CALCULATE_LITERAL_HASH(tmp_literal);
+ tmp_name = STR_INIT(name, name_len, 0);
+ ZVAL_STR(&c, tmp_name);
+ zend_add_literal(CG(active_op_array), &c TSRMLS_CC);
/* lowercased constant name */
- tmp_name = zend_str_tolower_dup(name, name_len);
- ZVAL_STRINGL(&c, tmp_name, name_len, 0);
- tmp_literal = zend_add_literal(CG(active_op_array), &c TSRMLS_CC);
- CALCULATE_LITERAL_HASH(tmp_literal);
+ tmp_name = STR_ALLOC(name_len, 0);
+ zend_str_tolower_copy(tmp_name->val, name, name_len);
+ ZVAL_STR(&c, tmp_name);
+ zend_add_literal(CG(active_op_array), &c TSRMLS_CC);
return ret;
}
/* }}} */
-#define LITERAL_STRINGL(op, str, len, copy) do { \
+#define LITERAL_STR(op, str) do { \
zval _c; \
- ZVAL_STRINGL(&_c, str, len, copy); \
+ ZVAL_STR(&_c, str); \
+ op.constant = zend_add_literal(CG(active_op_array), &_c TSRMLS_CC); \
+ } while (0)
+
+#define LITERAL_STRINGL(op, str, len) do { \
+ zval _c; \
+ ZVAL_STRINGL(&_c, str, len); \
op.constant = zend_add_literal(CG(active_op_array), &_c TSRMLS_CC); \
} while (0)
@@ -562,7 +548,7 @@ int zend_add_const_name_literal(zend_op_array *op_array, const zval *zv, int unq
#define LITERAL_NULL(op) do { \
zval _c; \
- INIT_ZVAL( _c); \
+ ZVAL_NULL(&_c); \
op.constant = zend_add_literal(CG(active_op_array), &_c TSRMLS_CC); \
} while (0)
@@ -658,21 +644,18 @@ void fetch_simple_variable_ex(znode *result, znode *varname, int bp, zend_uchar
zend_llist *fetch_list_ptr;
if (varname->op_type == IS_CONST) {
- ulong hash;
-
if (Z_TYPE(varname->u.constant) != IS_STRING) {
convert_to_string(&varname->u.constant);
}
- hash = str_hash(Z_STRVAL(varname->u.constant), Z_STRLEN(varname->u.constant));
- if (!zend_is_auto_global_quick(Z_STRVAL(varname->u.constant), Z_STRLEN(varname->u.constant), hash TSRMLS_CC) &&
+ if (!zend_is_auto_global(Z_STR(varname->u.constant) TSRMLS_CC) &&
!(Z_STRLEN(varname->u.constant) == (sizeof("this")-1) &&
!memcmp(Z_STRVAL(varname->u.constant), "this", sizeof("this") - 1)) &&
(CG(active_op_array)->last == 0 ||
CG(active_op_array)->opcodes[CG(active_op_array)->last-1].opcode != ZEND_BEGIN_SILENCE)) {
result->op_type = IS_CV;
- result->u.op.var = lookup_cv(CG(active_op_array), Z_STRVAL(varname->u.constant), Z_STRLEN(varname->u.constant), hash TSRMLS_CC);
- Z_STRVAL(varname->u.constant) = (char*)CG(active_op_array)->vars[result->u.op.var].name;
+ result->u.op.var = lookup_cv(CG(active_op_array), Z_STR(varname->u.constant) TSRMLS_CC);
+ Z_STR(varname->u.constant) = CG(active_op_array)->vars[result->u.op.var];
result->EA = 0;
return;
}
@@ -694,8 +677,7 @@ void fetch_simple_variable_ex(znode *result, znode *varname, int bp, zend_uchar
opline_ptr->extended_value = ZEND_FETCH_LOCAL;
if (varname->op_type == IS_CONST) {
- CALCULATE_LITERAL_HASH(opline_ptr->op1.constant);
- if (zend_is_auto_global_quick(Z_STRVAL(varname->u.constant), Z_STRLEN(varname->u.constant), Z_HASH_P(&CONSTANT(opline_ptr->op1.constant)) TSRMLS_CC)) {
+ if (zend_is_auto_global(Z_STR(varname->u.constant) TSRMLS_CC)) {
opline_ptr->extended_value = ZEND_FETCH_GLOBAL;
}
}
@@ -737,8 +719,7 @@ void zend_do_fetch_static_member(znode *result, znode *class_name TSRMLS_DC) /*
opline.result_type = IS_VAR;
opline.result.var = get_temporary_variable(CG(active_op_array));
opline.op1_type = IS_CONST;
- LITERAL_STRINGL(opline.op1, estrdup(CG(active_op_array)->vars[result->u.op.var].name), CG(active_op_array)->vars[result->u.op.var].name_len, 0);
- CALCULATE_LITERAL_HASH(opline.op1.constant);
+ LITERAL_STR(opline.op1, STR_COPY(CG(active_op_array)->vars[result->u.op.var]));
GET_POLYMORPHIC_CACHE_SLOT(opline.op1.constant);
if (class_node.op_type == IS_CONST) {
opline.op2_type = IS_CONST;
@@ -762,8 +743,7 @@ void zend_do_fetch_static_member(znode *result, znode *class_name TSRMLS_DC) /*
opline.result_type = IS_VAR;
opline.result.var = get_temporary_variable(CG(active_op_array));
opline.op1_type = IS_CONST;
- LITERAL_STRINGL(opline.op1, estrdup(CG(active_op_array)->vars[opline_ptr->op1.var].name), CG(active_op_array)->vars[opline_ptr->op1.var].name_len, 0);
- CALCULATE_LITERAL_HASH(opline.op1.constant);
+ LITERAL_STR(opline.op1, STR_COPY(CG(active_op_array)->vars[opline_ptr->op1.var]));
GET_POLYMORPHIC_CACHE_SLOT(opline.op1.constant);
if (class_node.op_type == IS_CONST) {
opline.op2_type = IS_CONST;
@@ -832,8 +812,6 @@ void fetch_array_dim(znode *result, const znode *parent, const znode *dim TSRMLS
if (numeric) {
zval_dtor(&CONSTANT(opline.op2.constant));
ZVAL_LONG(&CONSTANT(opline.op2.constant), index);
- } else {
- CALCULATE_LITERAL_HASH(opline.op2.constant);
}
}
@@ -910,7 +888,7 @@ static zend_bool opline_is_fetch_this(const zend_op *opline TSRMLS_DC) /* {{{ */
if ((opline->opcode == ZEND_FETCH_W) && (opline->op1_type == IS_CONST)
&& (Z_TYPE(CONSTANT(opline->op1.constant)) == IS_STRING)
&& ((opline->extended_value & ZEND_FETCH_STATIC_MEMBER) != ZEND_FETCH_STATIC_MEMBER)
- && (Z_HASH_P(&CONSTANT(opline->op1.constant)) == THIS_HASHVAL)
+ && (Z_STRHASH(CONSTANT(opline->op1.constant)) == THIS_HASHVAL)
&& (Z_STRLEN(CONSTANT(opline->op1.constant)) == (sizeof("this")-1))
&& !memcmp(Z_STRVAL(CONSTANT(opline->op1.constant)), "this", sizeof("this") - 1)) {
return 1;
@@ -941,10 +919,8 @@ void zend_do_assign(znode *result, znode *variable, znode *value TSRMLS_DC) /* {
opline->result_type = IS_VAR;
opline->result.var = get_temporary_variable(CG(active_op_array));
opline->op1_type = IS_CONST;
- LITERAL_STRINGL(opline->op1,
- CG(active_op_array)->vars[value->u.op.var].name,
- CG(active_op_array)->vars[value->u.op.var].name_len, 1);
- CALCULATE_LITERAL_HASH(opline->op1.constant);
+ LITERAL_STR(opline->op1,
+ STR_COPY(CG(active_op_array)->vars[value->u.op.var]));
SET_UNUSED(opline->op2);
opline->extended_value = ZEND_FETCH_LOCAL;
GET_NODE(value, opline->result);
@@ -1319,8 +1295,8 @@ void zend_do_end_variable_parse(znode *variable, int type, int arg_offset TSRMLS
this_var = opline_ptr->result.var;
if (CG(active_op_array)->this_var == -1) {
- CG(active_op_array)->this_var = lookup_cv(CG(active_op_array), Z_STRVAL(CONSTANT(opline_ptr->op1.constant)), Z_STRLEN(CONSTANT(opline_ptr->op1.constant)), Z_HASH_P(&CONSTANT(opline_ptr->op1.constant)) TSRMLS_CC);
- Z_TYPE(CONSTANT(opline_ptr->op1.constant)) = IS_NULL;
+ CG(active_op_array)->this_var = lookup_cv(CG(active_op_array), Z_STR(CONSTANT(opline_ptr->op1.constant)) TSRMLS_CC);
+ ZVAL_UNDEF(&CONSTANT(opline_ptr->op1.constant));
} else {
zend_del_literal(CG(active_op_array), opline_ptr->op1.constant);
}
@@ -1331,7 +1307,7 @@ void zend_do_end_variable_parse(znode *variable, int type, int arg_offset TSRMLS
variable->u.op.var = CG(active_op_array)->this_var;
}
} else if (CG(active_op_array)->this_var == -1) {
- CG(active_op_array)->this_var = lookup_cv(CG(active_op_array), estrndup("this", sizeof("this")-1), sizeof("this")-1, THIS_HASHVAL TSRMLS_CC);
+ CG(active_op_array)->this_var = lookup_cv(CG(active_op_array), STR_INIT("this", sizeof("this")-1, 0) TSRMLS_CC);
}
}
@@ -1528,11 +1504,10 @@ int zend_do_verify_access_types(const znode *current_access_type, const znode *n
void zend_do_begin_function_declaration(znode *function_token, znode *function_name, int is_method, int return_reference, znode *fn_flags_znode TSRMLS_DC) /* {{{ */
{
zend_op_array op_array;
- char *name = Z_STRVAL(function_name->u.constant);
- int name_len = Z_STRLEN(function_name->u.constant);
+ zend_string *name = Z_STR(function_name->u.constant);
int function_begin_line = function_token->u.op.opline_num;
zend_uint fn_flags;
- const char *lcname;
+ zend_string *lcname;
zend_bool orig_interactive;
ALLOCA_FLAG(use_heap)
@@ -1548,7 +1523,7 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n
fn_flags = 0;
}
if ((fn_flags & ZEND_ACC_STATIC) && (fn_flags & ZEND_ACC_ABSTRACT) && !(CG(active_class_entry)->ce_flags & ZEND_ACC_INTERFACE)) {
- zend_error(E_STRICT, "Static function %s%s%s() should not be abstract", is_method ? CG(active_class_entry)->name : "", is_method ? "::" : "", Z_STRVAL(function_name->u.constant));
+ zend_error(E_STRICT, "Static function %s%s%s() should not be abstract", is_method ? CG(active_class_entry)->name->val : "", is_method ? "::" : "", Z_STRVAL(function_name->u.constant));
}
function_token->u.op_array = CG(active_op_array);
@@ -1570,12 +1545,11 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n
op_array.line_start = zend_get_compiled_lineno(TSRMLS_C);
if (is_method) {
- zend_ulong hash;
-
- lcname = zend_new_interned_string(zend_str_tolower_dup(name, name_len), name_len + 1, 1 TSRMLS_CC);
- hash = str_hash(lcname, name_len);
- if (zend_hash_quick_add(&CG(active_class_entry)->function_table, lcname, name_len+1, hash, &op_array, sizeof(zend_op_array), (void **) &CG(active_op_array)) == FAILURE) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare %s::%s()", CG(active_class_entry)->name, name);
+ lcname = STR_ALLOC(name->len, 0);
+ zend_str_tolower_copy(lcname->val, name->val, name->len);
+ lcname = zend_new_interned_string(lcname TSRMLS_CC);
+ if ((CG(active_op_array) = zend_hash_add_mem(&CG(active_class_entry)->function_table, lcname, &op_array, sizeof(zend_op_array))) == NULL) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare %s::%s()", CG(active_class_entry)->name->val, name->val);
}
zend_stack_push(&CG(context_stack), (void *) &CG(context), sizeof(CG(context)));
@@ -1590,35 +1564,35 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n
}
if (CG(active_class_entry)->ce_flags & ZEND_ACC_INTERFACE) {
- if ((name_len == sizeof(ZEND_CALL_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME)-1))) {
+ if ((name->len == sizeof(ZEND_CALL_FUNC_NAME)-1) && (!memcmp(lcname->val, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME)-1))) {
if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) {
zend_error(E_WARNING, "The magic method __call() must have public visibility and cannot be static");
}
- } else if ((name_len == sizeof(ZEND_CALLSTATIC_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_CALLSTATIC_FUNC_NAME, sizeof(ZEND_CALLSTATIC_FUNC_NAME)-1))) {
+ } else if ((name->len == sizeof(ZEND_CALLSTATIC_FUNC_NAME)-1) && (!memcmp(lcname->val, ZEND_CALLSTATIC_FUNC_NAME, sizeof(ZEND_CALLSTATIC_FUNC_NAME)-1))) {
if ((fn_flags & (ZEND_ACC_PPP_MASK ^ ZEND_ACC_PUBLIC)) || (fn_flags & ZEND_ACC_STATIC) == 0) {
zend_error(E_WARNING, "The magic method __callStatic() must have public visibility and be static");
}
- } else if ((name_len == sizeof(ZEND_GET_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_GET_FUNC_NAME, sizeof(ZEND_GET_FUNC_NAME)-1))) {
+ } else if ((name->len == sizeof(ZEND_GET_FUNC_NAME)-1) && (!memcmp(lcname->val, ZEND_GET_FUNC_NAME, sizeof(ZEND_GET_FUNC_NAME)-1))) {
if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) {
zend_error(E_WARNING, "The magic method __get() must have public visibility and cannot be static");
}
- } else if ((name_len == sizeof(ZEND_SET_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_SET_FUNC_NAME, sizeof(ZEND_SET_FUNC_NAME)-1))) {
+ } else if ((name->len == sizeof(ZEND_SET_FUNC_NAME)-1) && (!memcmp(lcname->val, ZEND_SET_FUNC_NAME, sizeof(ZEND_SET_FUNC_NAME)-1))) {
if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) {
zend_error(E_WARNING, "The magic method __set() must have public visibility and cannot be static");
}
- } else if ((name_len == sizeof(ZEND_UNSET_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_UNSET_FUNC_NAME, sizeof(ZEND_UNSET_FUNC_NAME)-1))) {
+ } else if ((name->len == sizeof(ZEND_UNSET_FUNC_NAME)-1) && (!memcmp(lcname->val, ZEND_UNSET_FUNC_NAME, sizeof(ZEND_UNSET_FUNC_NAME)-1))) {
if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) {
zend_error(E_WARNING, "The magic method __unset() must have public visibility and cannot be static");
}
- } else if ((name_len == sizeof(ZEND_ISSET_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_ISSET_FUNC_NAME, sizeof(ZEND_ISSET_FUNC_NAME)-1))) {
+ } else if ((name->len == sizeof(ZEND_ISSET_FUNC_NAME)-1) && (!memcmp(lcname->val, ZEND_ISSET_FUNC_NAME, sizeof(ZEND_ISSET_FUNC_NAME)-1))) {
if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) {
zend_error(E_WARNING, "The magic method __isset() must have public visibility and cannot be static");
}
- } else if ((name_len == sizeof(ZEND_TOSTRING_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_TOSTRING_FUNC_NAME, sizeof(ZEND_TOSTRING_FUNC_NAME)-1))) {
+ } else if ((name->len == sizeof(ZEND_TOSTRING_FUNC_NAME)-1) && (!memcmp(lcname->val, ZEND_TOSTRING_FUNC_NAME, sizeof(ZEND_TOSTRING_FUNC_NAME)-1))) {
if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) {
zend_error(E_WARNING, "The magic method __toString() must have public visibility and cannot be static");
}
- } else if ((name_len == sizeof(ZEND_INVOKE_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1))) {
+ } else if ((name->len == sizeof(ZEND_INVOKE_FUNC_NAME)-1) && (!memcmp(lcname->val, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1))) {
if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) {
zend_error(E_WARNING, "The magic method __invoke() must have public visibility and cannot be static");
}
@@ -1626,59 +1600,59 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n
} else {
char *class_lcname;
- class_lcname = do_alloca(CG(active_class_entry)->name_length + 1, use_heap);
- zend_str_tolower_copy(class_lcname, CG(active_class_entry)->name, CG(active_class_entry)->name_length);
+ class_lcname = do_alloca(CG(active_class_entry)->name->len + 1, use_heap);
+ zend_str_tolower_copy(class_lcname, CG(active_class_entry)->name->val, CG(active_class_entry)->name->len);
/* Improve after RC: cache the lowercase class name */
- if ((CG(active_class_entry)->name_length == name_len) && ((CG(active_class_entry)->ce_flags & ZEND_ACC_TRAIT) != ZEND_ACC_TRAIT) && (!memcmp(class_lcname, lcname, name_len))) {
+ if ((CG(active_class_entry)->name->len == name->len) && ((CG(active_class_entry)->ce_flags & ZEND_ACC_TRAIT) != ZEND_ACC_TRAIT) && (!memcmp(class_lcname, lcname->val, name->len))) {
if (!CG(active_class_entry)->constructor) {
CG(active_class_entry)->constructor = (zend_function *) CG(active_op_array);
}
- } else if ((name_len == sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)))) {
+ } else if ((name->len == sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) && (!memcmp(lcname->val, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)))) {
if (CG(active_class_entry)->constructor) {
- zend_error(E_STRICT, "Redefining already defined constructor for class %s", CG(active_class_entry)->name);
+ zend_error(E_STRICT, "Redefining already defined constructor for class %s", CG(active_class_entry)->name->val);
}
CG(active_class_entry)->constructor = (zend_function *) CG(active_op_array);
- } else if ((name_len == sizeof(ZEND_DESTRUCTOR_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_DESTRUCTOR_FUNC_NAME, sizeof(ZEND_DESTRUCTOR_FUNC_NAME)-1))) {
+ } else if ((name->len == sizeof(ZEND_DESTRUCTOR_FUNC_NAME)-1) && (!memcmp(lcname->val, ZEND_DESTRUCTOR_FUNC_NAME, sizeof(ZEND_DESTRUCTOR_FUNC_NAME)-1))) {
CG(active_class_entry)->destructor = (zend_function *) CG(active_op_array);
- } else if ((name_len == sizeof(ZEND_CLONE_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_CLONE_FUNC_NAME, sizeof(ZEND_CLONE_FUNC_NAME)-1))) {
+ } else if ((name->len == sizeof(ZEND_CLONE_FUNC_NAME)-1) && (!memcmp(lcname->val, ZEND_CLONE_FUNC_NAME, sizeof(ZEND_CLONE_FUNC_NAME)-1))) {
CG(active_class_entry)->clone = (zend_function *) CG(active_op_array);
- } else if ((name_len == sizeof(ZEND_CALL_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME)-1))) {
+ } else if ((name->len == sizeof(ZEND_CALL_FUNC_NAME)-1) && (!memcmp(lcname->val, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME)-1))) {
if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) {
zend_error(E_WARNING, "The magic method __call() must have public visibility and cannot be static");
}
CG(active_class_entry)->__call = (zend_function *) CG(active_op_array);
- } else if ((name_len == sizeof(ZEND_CALLSTATIC_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_CALLSTATIC_FUNC_NAME, sizeof(ZEND_CALLSTATIC_FUNC_NAME)-1))) {
+ } else if ((name->len == sizeof(ZEND_CALLSTATIC_FUNC_NAME)-1) && (!memcmp(lcname->val, ZEND_CALLSTATIC_FUNC_NAME, sizeof(ZEND_CALLSTATIC_FUNC_NAME)-1))) {
if ((fn_flags & (ZEND_ACC_PPP_MASK ^ ZEND_ACC_PUBLIC)) || (fn_flags & ZEND_ACC_STATIC) == 0) {
zend_error(E_WARNING, "The magic method __callStatic() must have public visibility and be static");
}
CG(active_class_entry)->__callstatic = (zend_function *) CG(active_op_array);
- } else if ((name_len == sizeof(ZEND_GET_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_GET_FUNC_NAME, sizeof(ZEND_GET_FUNC_NAME)-1))) {
+ } else if ((name->len == sizeof(ZEND_GET_FUNC_NAME)-1) && (!memcmp(lcname->val, ZEND_GET_FUNC_NAME, sizeof(ZEND_GET_FUNC_NAME)-1))) {
if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) {
zend_error(E_WARNING, "The magic method __get() must have public visibility and cannot be static");
}
CG(active_class_entry)->__get = (zend_function *) CG(active_op_array);
- } else if ((name_len == sizeof(ZEND_SET_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_SET_FUNC_NAME, sizeof(ZEND_SET_FUNC_NAME)-1))) {
+ } else if ((name->len == sizeof(ZEND_SET_FUNC_NAME)-1) && (!memcmp(lcname->val, ZEND_SET_FUNC_NAME, sizeof(ZEND_SET_FUNC_NAME)-1))) {
if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) {
zend_error(E_WARNING, "The magic method __set() must have public visibility and cannot be static");
}
CG(active_class_entry)->__set = (zend_function *) CG(active_op_array);
- } else if ((name_len == sizeof(ZEND_UNSET_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_UNSET_FUNC_NAME, sizeof(ZEND_UNSET_FUNC_NAME)-1))) {
+ } else if ((name->len == sizeof(ZEND_UNSET_FUNC_NAME)-1) && (!memcmp(lcname->val, ZEND_UNSET_FUNC_NAME, sizeof(ZEND_UNSET_FUNC_NAME)-1))) {
if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) {
zend_error(E_WARNING, "The magic method __unset() must have public visibility and cannot be static");
}
CG(active_class_entry)->__unset = (zend_function *) CG(active_op_array);
- } else if ((name_len == sizeof(ZEND_ISSET_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_ISSET_FUNC_NAME, sizeof(ZEND_ISSET_FUNC_NAME)-1))) {
+ } else if ((name->len == sizeof(ZEND_ISSET_FUNC_NAME)-1) && (!memcmp(lcname->val, ZEND_ISSET_FUNC_NAME, sizeof(ZEND_ISSET_FUNC_NAME)-1))) {
if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) {
zend_error(E_WARNING, "The magic method __isset() must have public visibility and cannot be static");
}
CG(active_class_entry)->__isset = (zend_function *) CG(active_op_array);
- } else if ((name_len == sizeof(ZEND_TOSTRING_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_TOSTRING_FUNC_NAME, sizeof(ZEND_TOSTRING_FUNC_NAME)-1))) {
+ } else if ((name->len == sizeof(ZEND_TOSTRING_FUNC_NAME)-1) && (!memcmp(lcname->val, ZEND_TOSTRING_FUNC_NAME, sizeof(ZEND_TOSTRING_FUNC_NAME)-1))) {
if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) {
zend_error(E_WARNING, "The magic method __toString() must have public visibility and cannot be static");
}
CG(active_class_entry)->__tostring = (zend_function *) CG(active_op_array);
- } else if ((name_len == sizeof(ZEND_INVOKE_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1))) {
+ } else if ((name->len == sizeof(ZEND_INVOKE_FUNC_NAME)-1) && (!memcmp(lcname->val, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1))) {
if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) {
zend_error(E_WARNING, "The magic method __invoke() must have public visibility and cannot be static");
}
@@ -1688,33 +1662,33 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n
free_alloca(class_lcname, use_heap);
}
- str_efree(lcname);
+ STR_RELEASE(lcname);
} else {
zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
zval key;
- zval **ns_name;
+ zval *ns_name;
- if (CG(current_namespace)) {
+ if (Z_TYPE(CG(current_namespace)) != IS_UNDEF) {
/* Prefix function name with current namespace name */
znode tmp;
- tmp.u.constant = *CG(current_namespace);
- zval_copy_ctor(&tmp.u.constant);
+ ZVAL_DUP(&tmp.u.constant, &CG(current_namespace));
zend_do_build_namespace_name(&tmp, &tmp, function_name TSRMLS_CC);
- op_array.function_name = Z_STRVAL(tmp.u.constant);
- name_len = Z_STRLEN(tmp.u.constant);
- lcname = zend_str_tolower_dup(Z_STRVAL(tmp.u.constant), name_len);
+ op_array.function_name = Z_STR(tmp.u.constant);
+ lcname = STR_ALLOC(Z_STRLEN(tmp.u.constant), 0);
+ zend_str_tolower_copy(lcname->val, Z_STRVAL(tmp.u.constant), Z_STRLEN(tmp.u.constant));
} else {
- lcname = zend_str_tolower_dup(name, name_len);
+ lcname = STR_ALLOC(name->len, 0);
+ zend_str_tolower_copy(lcname->val, name->val, name->len);
}
/* Function name must not conflict with import names */
if (CG(current_import_function) &&
- zend_hash_find(CG(current_import_function), lcname, Z_STRLEN(function_name->u.constant)+1, (void**)&ns_name) == SUCCESS) {
+ (ns_name = zend_hash_find(CG(current_import_function), lcname)) != NULL) {
- char *tmp = zend_str_tolower_dup(Z_STRVAL_PP(ns_name), Z_STRLEN_PP(ns_name));
+ char *tmp = zend_str_tolower_dup(Z_STRVAL_P(ns_name), Z_STRLEN_P(ns_name));
- if (Z_STRLEN_PP(ns_name) != Z_STRLEN(function_name->u.constant) ||
+ if (Z_STRLEN_P(ns_name) != Z_STRLEN(function_name->u.constant) ||
memcmp(tmp, lcname, Z_STRLEN(function_name->u.constant))) {
zend_error(E_COMPILE_ERROR, "Cannot declare function %s because the name is already in use", Z_STRVAL(function_name->u.constant));
}
@@ -1723,17 +1697,15 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n
opline->opcode = ZEND_DECLARE_FUNCTION;
opline->op1_type = IS_CONST;
- build_runtime_defined_function_key(&key, lcname, name_len TSRMLS_CC);
+ build_runtime_defined_function_key(&key, lcname->val, lcname->len TSRMLS_CC);
opline->op1.constant = zend_add_literal(CG(active_op_array), &key TSRMLS_CC);
- Z_HASH_P(&CONSTANT(opline->op1.constant)) = zend_hash_func(Z_STRVAL(CONSTANT(opline->op1.constant)), Z_STRLEN(CONSTANT(opline->op1.constant)));
opline->op2_type = IS_CONST;
- LITERAL_STRINGL(opline->op2, lcname, name_len, 1);
- CALCULATE_LITERAL_HASH(opline->op2.constant);
+ LITERAL_STR(opline->op2, STR_COPY(lcname));
opline->extended_value = ZEND_DECLARE_FUNCTION;
- zend_hash_quick_update(CG(function_table), Z_STRVAL(key), Z_STRLEN(key), Z_HASH_P(&CONSTANT(opline->op1.constant)), &op_array, sizeof(zend_op_array), (void **) &CG(active_op_array));
+ CG(active_op_array) = zend_hash_update_mem(CG(function_table), Z_STR(key), &op_array, sizeof(zend_op_array));
zend_stack_push(&CG(context_stack), (void *) &CG(context), sizeof(CG(context)));
zend_init_compiler_context(TSRMLS_C);
- str_efree(lcname);
+ STR_RELEASE(lcname);
}
if (CG(compiler_options) & ZEND_COMPILE_EXTENDED_INFO) {
@@ -1767,9 +1739,7 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n
if (CG(doc_comment)) {
CG(active_op_array)->doc_comment = CG(doc_comment);
- CG(active_op_array)->doc_comment_len = CG(doc_comment_len);
CG(doc_comment) = NULL;
- CG(doc_comment_len) = 0;
}
}
/* }}} */
@@ -1782,7 +1752,7 @@ void zend_do_begin_lambda_function_declaration(znode *result, znode *function_to
zend_op *current_op;
function_name.op_type = IS_CONST;
- ZVAL_STRINGL(&function_name.u.constant, "{closure}", sizeof("{closure}")-1, 1);
+ ZVAL_STRINGL(&function_name.u.constant, "{closure}", sizeof("{closure}")-1);
zend_do_begin_function_declaration(function_token, &function_name, 0, return_reference, NULL TSRMLS_CC);
@@ -1827,8 +1797,8 @@ void zend_do_end_function_declaration(const znode *function_token TSRMLS_DC) /*
} else {
/* we don't care if the function name is longer, in fact lowercasing only
* the beginning of the name speeds up the check process */
- name_len = strlen(CG(active_op_array)->function_name);
- zend_str_tolower_copy(lcname, CG(active_op_array)->function_name, MIN(name_len, sizeof(lcname)-1));
+ name_len = CG(active_op_array)->function_name->len;
+ zend_str_tolower_copy(lcname, CG(active_op_array)->function_name->val, MIN(name_len, sizeof(lcname)-1));
lcname[sizeof(lcname)-1] = '\0'; /* zend_str_tolower_copy won't necessarily set the zero byte */
if (name_len == sizeof(ZEND_AUTOLOAD_FUNC_NAME) - 1 && !memcmp(lcname, ZEND_AUTOLOAD_FUNC_NAME, sizeof(ZEND_AUTOLOAD_FUNC_NAME)) && CG(active_op_array)->num_args != 1) {
zend_error_noreturn(E_COMPILE_ERROR, "%s() must take exactly 1 argument", ZEND_AUTOLOAD_FUNC_NAME);
@@ -1851,14 +1821,14 @@ void zend_do_receive_param(zend_uchar op, znode *varname, const znode *initializ
zend_arg_info *cur_arg_info;
znode var;
- if (zend_is_auto_global(Z_STRVAL(varname->u.constant), Z_STRLEN(varname->u.constant) TSRMLS_CC)) {
+ if (zend_is_auto_global(Z_STR(varname->u.constant) TSRMLS_CC)) {
zend_error_noreturn(E_COMPILE_ERROR, "Cannot re-assign auto-global variable %s", Z_STRVAL(varname->u.constant));
} else {
var.op_type = IS_CV;
- var.u.op.var = lookup_cv(CG(active_op_array), Z_STRVAL(varname->u.constant), Z_STRLEN(varname->u.constant), 0 TSRMLS_CC);
- Z_STRVAL(varname->u.constant) = (char*)CG(active_op_array)->vars[var.u.op.var].name;
+ var.u.op.var = lookup_cv(CG(active_op_array), Z_STR(varname->u.constant) TSRMLS_CC);
+ Z_STR(varname->u.constant) = CG(active_op_array)->vars[var.u.op.var];
var.EA = 0;
- if (CG(active_op_array)->vars[var.u.op.var].hash_value == THIS_HASHVAL &&
+ if (Z_STRHASH(varname->u.constant) == THIS_HASHVAL &&
Z_STRLEN(varname->u.constant) == sizeof("this")-1 &&
!memcmp(Z_STRVAL(varname->u.constant), "this", sizeof("this")-1)) {
if (CG(active_op_array)->scope &&
@@ -1898,7 +1868,8 @@ void zend_do_receive_param(zend_uchar op, znode *varname, const znode *initializ
}
CG(active_op_array)->arg_info = erealloc(CG(active_op_array)->arg_info, sizeof(zend_arg_info)*(CG(active_op_array)->num_args));
cur_arg_info = &CG(active_op_array)->arg_info[CG(active_op_array)->num_args-1];
- cur_arg_info->name = zend_new_interned_string(estrndup(Z_STRVAL(varname->u.constant), Z_STRLEN(varname->u.constant)), Z_STRLEN(varname->u.constant) + 1, 1 TSRMLS_CC);
+//??? cur_arg_info->name = zend_new_interned_string(estrndup(Z_STRVAL(varname->u.constant), Z_STRLEN(varname->u.constant)), Z_STRLEN(varname->u.constant) + 1, 1 TSRMLS_CC);
+ cur_arg_info->name = estrndup(Z_STRVAL(varname->u.constant), Z_STRLEN(varname->u.constant));
cur_arg_info->name_len = Z_STRLEN(varname->u.constant);
cur_arg_info->type_hint = 0;
cur_arg_info->pass_by_reference = pass_by_reference;
@@ -1934,7 +1905,7 @@ void zend_do_receive_param(zend_uchar op, znode *varname, const znode *initializ
if (ZEND_FETCH_CLASS_DEFAULT == zend_get_class_fetch_type(Z_STRVAL(class_type->u.constant), Z_STRLEN(class_type->u.constant))) {
zend_resolve_class_name(class_type TSRMLS_CC);
}
- Z_STRVAL(class_type->u.constant) = (char*)zend_new_interned_string(Z_STRVAL(class_type->u.constant), Z_STRLEN(class_type->u.constant) + 1, 1 TSRMLS_CC);
+ Z_STR(class_type->u.constant) = zend_new_interned_string(Z_STR(class_type->u.constant) TSRMLS_CC);
cur_arg_info->class_name = Z_STRVAL(class_type->u.constant);
cur_arg_info->class_name_len = Z_STRLEN(class_type->u.constant);
if (op == ZEND_RECV_INIT) {
@@ -1953,12 +1924,12 @@ void zend_do_receive_param(zend_uchar op, znode *varname, const znode *initializ
int zend_do_begin_function_call(znode *function_name, zend_bool check_namespace TSRMLS_DC) /* {{{ */
{
zend_function *function;
- char *lcname;
+ zend_string *lcname;
char *is_compound = memchr(Z_STRVAL(function_name->u.constant), '\\', Z_STRLEN(function_name->u.constant));
zend_resolve_function_name(function_name, &check_namespace TSRMLS_CC);
- if (check_namespace && CG(current_namespace) && !is_compound) {
+ if (check_namespace && Z_TYPE(CG(current_namespace)) != IS_UNDEF && !is_compound) {
/* We assume we call function from the current namespace
if it is not prefixed. */
@@ -1968,16 +1939,17 @@ int zend_do_begin_function_call(znode *function_name, zend_bool check_namespace
return 1;
}
- lcname = zend_str_tolower_dup(Z_STRVAL(function_name->u.constant), Z_STRLEN(function_name->u.constant));
- if ((zend_hash_find(CG(function_table), lcname, Z_STRLEN(function_name->u.constant)+1, (void **) &function)==FAILURE) ||
+ lcname = STR_ALLOC(Z_STRLEN(function_name->u.constant), 0);
+ zend_str_tolower_copy(lcname->val, Z_STRVAL(function_name->u.constant), Z_STRLEN(function_name->u.constant));
+ if (((function = zend_hash_find_ptr(CG(function_table), lcname)) == NULL) ||
((CG(compiler_options) & ZEND_COMPILE_IGNORE_INTERNAL_FUNCTIONS) &&
(function->type == ZEND_INTERNAL_FUNCTION))) {
zend_do_begin_dynamic_function_call(function_name, 0 TSRMLS_CC);
efree(lcname);
return 1; /* Dynamic */
}
- efree(Z_STRVAL(function_name->u.constant));
- Z_STRVAL(function_name->u.constant) = lcname;
+ STR_RELEASE(Z_STR(function_name->u.constant));
+ Z_STR(function_name->u.constant) = lcname;
zend_stack_push(&CG(function_call_stack), (void *) &function, sizeof(zend_function *));
if (CG(context).nested_calls + 1 > CG(active_op_array)->nested_calls) {
@@ -2012,7 +1984,7 @@ void zend_do_begin_method_call(znode *left_bracket TSRMLS_DC) /* {{{ */
if (Z_TYPE(name) != IS_STRING) {
zend_error_noreturn(E_COMPILE_ERROR, "Method name must be a string");
}
- Z_STRVAL(name) = str_estrndup(Z_STRVAL(name), Z_STRLEN(name));
+ Z_STR(name) = STR_DUP(Z_STR(name), 0);
FREE_POLYMORPHIC_CACHE_SLOT(last_op->op2.constant);
last_op->op2.constant =
zend_add_func_name_literal(CG(active_op_array), &name TSRMLS_CC);
@@ -2097,8 +2069,9 @@ void zend_resolve_non_class_name(znode *element_name, zend_bool *check_namespace
{
znode tmp;
int len;
- zval **ns;
- char *lookup_name, *compound = memchr(Z_STRVAL(element_name->u.constant), '\\', Z_STRLEN(element_name->u.constant));
+ zval *ns;
+ zend_string *lookup_name;
+ char *compound = memchr(Z_STRVAL(element_name->u.constant), '\\', Z_STRLEN(element_name->u.constant));
if (Z_STRVAL(element_name->u.constant)[0] == '\\') {
/* name starts with \ so it is known and unambiguos, nothing to do here but shorten it */
@@ -2114,52 +2087,51 @@ void zend_resolve_non_class_name(znode *element_name, zend_bool *check_namespace
if (current_import_sub) {
len = Z_STRLEN(element_name->u.constant)+1;
if (case_sensitive) {
- lookup_name = estrndup(Z_STRVAL(element_name->u.constant), len);
+ lookup_name = STR_INIT(Z_STRVAL(element_name->u.constant), len, 0);
} else {
- lookup_name = zend_str_tolower_dup(Z_STRVAL(element_name->u.constant), len);
+ lookup_name = STR_ALLOC(len, 0);
+ zend_str_tolower_copy(lookup_name->val, Z_STRVAL(element_name->u.constant), len);
}
/* Check if function/const matches imported name */
- if (zend_hash_find(current_import_sub, lookup_name, len, (void**)&ns) == SUCCESS) {
+ if ((ns = zend_hash_find(current_import_sub, lookup_name)) != NULL) {
zval_dtor(&element_name->u.constant);
- element_name->u.constant = **ns;
zval_copy_ctor(&element_name->u.constant);
- efree(lookup_name);
+ STR_FREE(lookup_name);
*check_namespace = 0;
return;
}
- efree(lookup_name);
+ STR_FREE(lookup_name);
}
if (compound && CG(current_import)) {
len = compound - Z_STRVAL(element_name->u.constant);
/* namespace is always lowercase */
- lookup_name = zend_str_tolower_dup(Z_STRVAL(element_name->u.constant), len);
+ lookup_name = STR_ALLOC(len, 0);
+ zend_str_tolower_copy(lookup_name->val, Z_STRVAL(element_name->u.constant), len);
/* Check if first part of compound name is an import name */
- if (zend_hash_find(CG(current_import), lookup_name, len+1, (void**)&ns) == SUCCESS) {
+ if ((ns = zend_hash_find(CG(current_import), lookup_name)) != NULL) {
/* Substitute import name */
tmp.op_type = IS_CONST;
- tmp.u.constant = **ns;
- zval_copy_ctor(&tmp.u.constant);
+ ZVAL_DUP(&tmp.u.constant, ns);
len += 1;
Z_STRLEN(element_name->u.constant) -= len;
memmove(Z_STRVAL(element_name->u.constant), Z_STRVAL(element_name->u.constant)+len, Z_STRLEN(element_name->u.constant)+1);
zend_do_build_namespace_name(&tmp, &tmp, element_name TSRMLS_CC);
*element_name = tmp;
- efree(lookup_name);
+ STR_FREE(lookup_name);
*check_namespace = 0;
return;
}
- efree(lookup_name);
+ STR_FREE(lookup_name);
}
- if (CG(current_namespace)) {
+ if (Z_TYPE(CG(current_namespace)) != IS_UNDEF) {
tmp = *element_name;
- Z_STRLEN(tmp.u.constant) = sizeof("\\")-1 + Z_STRLEN(element_name->u.constant) + Z_STRLEN_P(CG(current_namespace));
- Z_STRVAL(tmp.u.constant) = (char *) emalloc(Z_STRLEN(tmp.u.constant)+1);
- memcpy(Z_STRVAL(tmp.u.constant), Z_STRVAL_P(CG(current_namespace)), Z_STRLEN_P(CG(current_namespace)));
- memcpy(&(Z_STRVAL(tmp.u.constant)[Z_STRLEN_P(CG(current_namespace))]), "\\", sizeof("\\")-1);
- memcpy(&(Z_STRVAL(tmp.u.constant)[Z_STRLEN_P(CG(current_namespace)) + sizeof("\\")-1]), Z_STRVAL(element_name->u.constant), Z_STRLEN(element_name->u.constant)+1);
- str_efree(Z_STRVAL(element_name->u.constant));
+ Z_STR(tmp.u.constant) = STR_ALLOC(sizeof("\\")-1 + Z_STRLEN(element_name->u.constant) + Z_STRLEN(CG(current_namespace)), 0);
+ memcpy(Z_STRVAL(tmp.u.constant), Z_STRVAL(CG(current_namespace)), Z_STRLEN(CG(current_namespace)));
+ memcpy(&(Z_STRVAL(tmp.u.constant)[Z_STRLEN(CG(current_namespace))]), "\\", sizeof("\\")-1);
+ memcpy(&(Z_STRVAL(tmp.u.constant)[Z_STRLEN(CG(current_namespace)) + sizeof("\\")-1]), Z_STRVAL(element_name->u.constant), Z_STRLEN(element_name->u.constant)+1);
+ STR_RELEASE(Z_STR(element_name->u.constant));
*element_name = tmp;
}
}
@@ -2192,7 +2164,7 @@ void zend_do_resolve_class_name(znode *result, znode *class_name, int is_static
}
zval_dtor(&class_name->u.constant);
class_name->op_type = IS_CONST;
- ZVAL_STRINGL(&class_name->u.constant, CG(active_class_entry)->name, CG(active_class_entry)->name_length, 1);
+ ZVAL_STR(&class_name->u.constant, STR_COPY(CG(active_class_entry)->name));
*result = *class_name;
break;
case ZEND_FETCH_CLASS_STATIC:
@@ -2210,7 +2182,7 @@ void zend_do_resolve_class_name(znode *result, znode *class_name, int is_static
);
}
constant_name.op_type = IS_CONST;
- ZVAL_STRINGL(&constant_name.u.constant, "class", sizeof("class")-1, 1);
+ ZVAL_STRINGL(&constant_name.u.constant, "class", sizeof("class")-1);
zend_do_fetch_constant(result, class_name, &constant_name, ZEND_RT, 1 TSRMLS_CC);
break;
case ZEND_FETCH_CLASS_DEFAULT:
@@ -2227,8 +2199,8 @@ void zend_do_resolve_class_name(znode *result, znode *class_name, int is_static
void zend_resolve_class_name(znode *class_name TSRMLS_DC) /* {{{ */
{
char *compound;
- char *lcname;
- zval **ns;
+ zend_string *lcname;
+ zval *ns;
znode tmp;
int len;
@@ -2237,11 +2209,10 @@ void zend_resolve_class_name(znode *class_name TSRMLS_DC) /* {{{ */
/* This is a compound class name that contains namespace prefix */
if (Z_STRVAL(class_name->u.constant)[0] == '\\') {
/* The STRING name has "\" prefix */
- Z_STRLEN(class_name->u.constant) -= 1;
- memmove(Z_STRVAL(class_name->u.constant), Z_STRVAL(class_name->u.constant)+1, Z_STRLEN(class_name->u.constant)+1);
- Z_STRVAL(class_name->u.constant) = erealloc(
- Z_STRVAL(class_name->u.constant),
- Z_STRLEN(class_name->u.constant) + 1);
+ memmove(Z_STRVAL(class_name->u.constant), Z_STRVAL(class_name->u.constant)+1, Z_STRLEN(class_name->u.constant)-1);
+ Z_STR(class_name->u.constant) = STR_EREALLOC(
+ Z_STR(class_name->u.constant),
+ Z_STRLEN(class_name->u.constant) - 1);
if (ZEND_FETCH_CLASS_DEFAULT != zend_get_class_fetch_type(Z_STRVAL(class_name->u.constant), Z_STRLEN(class_name->u.constant))) {
zend_error_noreturn(E_COMPILE_ERROR, "'\\%s' is an invalid class name", Z_STRVAL(class_name->u.constant));
@@ -2249,51 +2220,49 @@ void zend_resolve_class_name(znode *class_name TSRMLS_DC) /* {{{ */
} else {
if (CG(current_import)) {
len = compound - Z_STRVAL(class_name->u.constant);
- lcname = zend_str_tolower_dup(Z_STRVAL(class_name->u.constant), len);
+ lcname = STR_ALLOC(len, 0);
+ zend_str_tolower_copy(lcname->val, Z_STRVAL(class_name->u.constant), len);
/* Check if first part of compound name is an import name */
- if (zend_hash_find(CG(current_import), lcname, len+1, (void**)&ns) == SUCCESS) {
+ if ((ns = zend_hash_find(CG(current_import), lcname)) != NULL) {
/* Substitute import name */
tmp.op_type = IS_CONST;
- tmp.u.constant = **ns;
- zval_copy_ctor(&tmp.u.constant);
+ ZVAL_DUP(&tmp.u.constant, ns);
len += 1;
Z_STRLEN(class_name->u.constant) -= len;
memmove(Z_STRVAL(class_name->u.constant), Z_STRVAL(class_name->u.constant)+len, Z_STRLEN(class_name->u.constant)+1);
zend_do_build_namespace_name(&tmp, &tmp, class_name TSRMLS_CC);
*class_name = tmp;
- efree(lcname);
+ STR_FREE(lcname);
return;
}
- efree(lcname);
+ STR_FREE(lcname);
}
/* Here name is not prefixed with \ and not imported */
- if (CG(current_namespace)) {
+ if (Z_TYPE(CG(current_namespace)) != IS_UNDEF) {
tmp.op_type = IS_CONST;
- tmp.u.constant = *CG(current_namespace);
- zval_copy_ctor(&tmp.u.constant);
+ ZVAL_DUP(&tmp.u.constant, &CG(current_namespace));
zend_do_build_namespace_name(&tmp, &tmp, class_name TSRMLS_CC);
*class_name = tmp;
}
}
- } else if (CG(current_import) || CG(current_namespace)) {
+ } else if (CG(current_import) || Z_TYPE(CG(current_namespace)) != IS_UNDEF) {
/* this is a plain name (without \) */
- lcname = zend_str_tolower_dup(Z_STRVAL(class_name->u.constant), Z_STRLEN(class_name->u.constant));
+ lcname = STR_ALLOC(Z_STRLEN(class_name->u.constant), 0);
+ zend_str_tolower_copy(lcname->val, Z_STRVAL(class_name->u.constant), Z_STRLEN(class_name->u.constant));
if (CG(current_import) &&
- zend_hash_find(CG(current_import), lcname, Z_STRLEN(class_name->u.constant)+1, (void**)&ns) == SUCCESS) {
+ (ns = zend_hash_find(CG(current_import), lcname)) != NULL) {
/* The given name is an import name. Substitute it. */
zval_dtor(&class_name->u.constant);
- class_name->u.constant = **ns;
- zval_copy_ctor(&class_name->u.constant);
- } else if (CG(current_namespace)) {
+ ZVAL_DUP(&class_name->u.constant, ns);
+ } else if (Z_TYPE(CG(current_namespace)) != IS_UNDEF) {
/* plain name, no import - prepend current namespace to it */
tmp.op_type = IS_CONST;
- tmp.u.constant = *CG(current_namespace);
- zval_copy_ctor(&tmp.u.constant);
+ ZVAL_DUP(&tmp.u.constant, &CG(current_namespace));
zend_do_build_namespace_name(&tmp, &tmp, class_name TSRMLS_CC);
*class_name = tmp;
}
- efree(lcname);
+ STR_FREE(lcname);
}
}
/* }}} */
@@ -2351,7 +2320,7 @@ void zend_do_label(znode *label TSRMLS_DC) /* {{{ */
dest.brk_cont = CG(context).current_brk_cont;
dest.opline_num = get_next_op_number(CG(active_op_array));
- if (zend_hash_add(CG(context).labels, Z_STRVAL(label->u.constant), Z_STRLEN(label->u.constant) + 1, (void**)&dest, sizeof(zend_label), NULL) == FAILURE) {
+ if (zend_hash_add_mem(CG(context).labels, Z_STR(label->u.constant), &dest, sizeof(zend_label)) == NULL) {
zend_error_noreturn(E_COMPILE_ERROR, "Label '%s' already defined", Z_STRVAL(label->u.constant));
}
@@ -2372,7 +2341,7 @@ void zend_resolve_goto_label(zend_op_array *op_array, zend_op *opline, int pass2
label = &CONSTANT_EX(op_array, opline->op2.constant);
}
if (CG(context).labels == NULL ||
- zend_hash_find(CG(context).labels, Z_STRVAL_P(label), Z_STRLEN_P(label)+1, (void**)&dest) == FAILURE) {
+ (dest = zend_hash_find_ptr(CG(context).labels, Z_STR_P(label))) == NULL) {
if (pass2) {
CG(in_compilation) = 1;
@@ -2460,19 +2429,19 @@ void zend_do_build_full_name(znode *result, znode *prefix, znode *name, int is_c
}
if (is_class_member) {
- length = sizeof("::")-1 + Z_STRLEN(result->u.constant) + Z_STRLEN(name->u.constant);
- Z_STRVAL(result->u.constant) = str_erealloc(Z_STRVAL(result->u.constant), length+1);
- memcpy(&Z_STRVAL(result->u.constant)[Z_STRLEN(result->u.constant)], "::", sizeof("::")-1);
- memcpy(&Z_STRVAL(result->u.constant)[Z_STRLEN(result->u.constant) + sizeof("::")-1], Z_STRVAL(name->u.constant), Z_STRLEN(name->u.constant)+1);
- str_efree(Z_STRVAL(name->u.constant));
- Z_STRLEN(result->u.constant) = length;
+ int old_len = Z_STRLEN(result->u.constant);
+ length = sizeof("::")-1 + old_len + Z_STRLEN(name->u.constant);
+ Z_STR(result->u.constant) = STR_EREALLOC(Z_STR(result->u.constant), length);
+ memcpy(&Z_STRVAL(result->u.constant)[old_len], "::", sizeof("::")-1);
+ memcpy(&Z_STRVAL(result->u.constant)[old_len + sizeof("::")-1], Z_STRVAL(name->u.constant), Z_STRLEN(name->u.constant)+1);
+ STR_RELEASE(Z_STR(name->u.constant));
} else {
- length = sizeof("\\")-1 + Z_STRLEN(result->u.constant) + Z_STRLEN(name->u.constant);
- Z_STRVAL(result->u.constant) = str_erealloc(Z_STRVAL(result->u.constant), length+1);
- memcpy(&Z_STRVAL(result->u.constant)[Z_STRLEN(result->u.constant)], "\\", sizeof("\\")-1);
- memcpy(&Z_STRVAL(result->u.constant)[Z_STRLEN(result->u.constant) + sizeof("\\")-1], Z_STRVAL(name->u.constant), Z_STRLEN(name->u.constant)+1);
- str_efree(Z_STRVAL(name->u.constant));
- Z_STRLEN(result->u.constant) = length;
+ int old_len = Z_STRLEN(result->u.constant);
+ length = sizeof("\\")-1 + old_len + Z_STRLEN(name->u.constant);
+ Z_STR(result->u.constant) = STR_EREALLOC(Z_STR(result->u.constant), length);
+ memcpy(&Z_STRVAL(result->u.constant)[old_len], "\\", sizeof("\\")-1);
+ memcpy(&Z_STRVAL(result->u.constant)[old_len + sizeof("\\")-1], Z_STRVAL(name->u.constant), Z_STRLEN(name->u.constant)+1);
+ STR_RELEASE(Z_STR(name->u.constant));
}
}
/* }}} */
@@ -2558,7 +2527,7 @@ void zend_do_end_function_call(znode *function_name, znode *result, const znode
SET_NODE(opline->op1, function_name);
SET_UNUSED(opline->op2);
opline->op2.num = CG(context).nested_calls;
- CALCULATE_LITERAL_HASH(opline->op1.constant);
+//??? CALCULATE_LITERAL_HASH(opline->op1.constant);
GET_CACHE_SLOT(opline->op1.constant);
} else {
opline->opcode = ZEND_DO_FCALL_BY_NAME;
@@ -2708,7 +2677,7 @@ void zend_do_unpack_params(znode *params, int offset TSRMLS_DC) /* {{{ */
* computed at compile time, thus we need access to EX(call). In order to have it we
* retroactively emit a ZEND_INIT_FCALL_BY_NAME opcode. */
zval func_name;
- ZVAL_STRING(&func_name, (*function_ptr_ptr)->common.function_name, 1);
+ ZVAL_STR(&func_name, STR_COPY((*function_ptr_ptr)->common.function_name));
opline = get_next_op(CG(active_op_array) TSRMLS_CC);
opline->opcode = ZEND_INIT_FCALL_BY_NAME;
@@ -2985,8 +2954,8 @@ void zend_do_begin_catch(znode *catch_token, znode *class_name, znode *catch_var
opline->op1_type = IS_CONST;
opline->op1.constant = zend_add_class_name_literal(CG(active_op_array), &catch_class.u.constant TSRMLS_CC);
opline->op2_type = IS_CV;
- opline->op2.var = lookup_cv(CG(active_op_array), Z_STRVAL(catch_var->u.constant), Z_STRLEN(catch_var->u.constant), 0 TSRMLS_CC);
- Z_STRVAL(catch_var->u.constant) = (char*)CG(active_op_array)->vars[opline->op2.var].name;
+ opline->op2.var = lookup_cv(CG(active_op_array), Z_STR(catch_var->u.constant) TSRMLS_CC);
+ Z_STR(catch_var->u.constant) = CG(active_op_array)->vars[opline->op2.var];
opline->result.num = 0; /* 1 means it's the last catch in the block */
catch_token->u.op.opline_num = catch_op_number;
@@ -3061,11 +3030,10 @@ ZEND_API void function_add_ref(zend_function *function) /* {{{ */
(*op_array->refcount)++;
if (op_array->static_variables) {
HashTable *static_variables = op_array->static_variables;
- zval *tmp_zval;
ALLOC_HASHTABLE(op_array->static_variables);
zend_hash_init(op_array->static_variables, zend_hash_num_elements(static_variables), NULL, ZVAL_PTR_DTOR, 0);
- zend_hash_copy(op_array->static_variables, static_variables, (copy_ctor_func_t) zval_add_ref, (void *) &tmp_zval, sizeof(zval *));
+ zend_hash_copy(op_array->static_variables, static_variables, zval_add_ref);
}
op_array->run_time_cache = NULL;
}
@@ -3126,36 +3094,38 @@ static void do_inherit_parent_constructor(zend_class_entry *ce) /* {{{ */
if (ce->constructor) {
if (ce->parent->constructor && ce->parent->constructor->common.fn_flags & ZEND_ACC_FINAL) {
zend_error(E_ERROR, "Cannot override final %s::%s() with %s::%s()",
- ce->parent->name, ce->parent->constructor->common.function_name,
- ce->name, ce->constructor->common.function_name
+ ce->parent->name->val, ce->parent->constructor->common.function_name->val,
+ ce->name->val, ce->constructor->common.function_name->val
);
}
return;
}
- if (zend_hash_find(&ce->parent->function_table, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME), (void **)&function)==SUCCESS) {
+ if ((function = zend_hash_str_find_ptr(&ce->parent->function_table, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1)) != NULL) {
/* inherit parent's constructor */
- zend_hash_update(&ce->function_table, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME), function, sizeof(zend_function), (void**)&new_function);
+ new_function = zend_hash_str_update_mem(&ce->function_table, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1, function, sizeof(zend_function));
function_add_ref(new_function);
} else {
/* Don't inherit the old style constructor if we already have the new style constructor */
- char *lc_class_name;
- char *lc_parent_class_name;
-
- lc_class_name = zend_str_tolower_dup(ce->name, ce->name_length);
- if (!zend_hash_exists(&ce->function_table, lc_class_name, ce->name_length+1)) {
- lc_parent_class_name = zend_str_tolower_dup(ce->parent->name, ce->parent->name_length);
- if (!zend_hash_exists(&ce->function_table, lc_parent_class_name, ce->parent->name_length+1) &&
- zend_hash_find(&ce->parent->function_table, lc_parent_class_name, ce->parent->name_length+1, (void **)&function)==SUCCESS) {
+ zend_string *lc_class_name;
+ zend_string *lc_parent_class_name;
+
+ lc_class_name = STR_ALLOC(ce->name->len, 0);
+ zend_str_tolower_copy(lc_class_name->val, ce->name->val, ce->name->len);
+ if (!zend_hash_exists(&ce->function_table, lc_class_name)) {
+ lc_parent_class_name = STR_ALLOC(ce->parent->name->len, 0);
+ zend_str_tolower_copy(lc_parent_class_name->val, ce->parent->name->val, ce->parent->name->len);
+ if (!zend_hash_exists(&ce->function_table, lc_parent_class_name) &&
+ (function = zend_hash_find_ptr(&ce->parent->function_table, lc_parent_class_name)) != NULL) {
if (function->common.fn_flags & ZEND_ACC_CTOR) {
/* inherit parent's constructor */
- zend_hash_update(&ce->function_table, lc_parent_class_name, ce->parent->name_length+1, function, sizeof(zend_function), (void**)&new_function);
+ zend_hash_update_mem(&ce->function_table, lc_parent_class_name, function, sizeof(zend_function));
function_add_ref(new_function);
}
}
- efree(lc_parent_class_name);
+ STR_RELEASE(lc_parent_class_name);
}
- efree(lc_class_name);
+ STR_FREE(lc_class_name);
}
ce->constructor = ce->parent->constructor;
}
@@ -3255,50 +3225,54 @@ static zend_bool zend_do_perform_implementation_check(const zend_function *fe, c
}
if (fe_arg_info->class_name) {
- const char *fe_class_name, *proto_class_name;
- zend_uint fe_class_name_len, proto_class_name_len;
+ zend_string *fe_class_name, *proto_class_name;
if (!strcasecmp(fe_arg_info->class_name, "parent") && proto->common.scope) {
- fe_class_name = proto->common.scope->name;
- fe_class_name_len = proto->common.scope->name_length;
+ fe_class_name = STR_INIT(
+ proto->common.scope->name->val,
+ proto->common.scope->name->len, 0);
} else if (!strcasecmp(fe_arg_info->class_name, "self") && fe->common.scope) {
- fe_class_name = fe->common.scope->name;
- fe_class_name_len = fe->common.scope->name_length;
+ fe_class_name = STR_INIT(
+ fe->common.scope->name->val,
+ fe->common.scope->name->len, 0);
} else {
- fe_class_name = fe_arg_info->class_name;
- fe_class_name_len = fe_arg_info->class_name_len;
+ fe_class_name = STR_INIT(
+ fe_arg_info->class_name,
+ fe_arg_info->class_name_len, 0);
}
if (!strcasecmp(proto_arg_info->class_name, "parent") && proto->common.scope && proto->common.scope->parent) {
- proto_class_name = proto->common.scope->parent->name;
- proto_class_name_len = proto->common.scope->parent->name_length;
+ proto_class_name = STR_INIT(
+ proto->common.scope->parent->name->val,
+ proto->common.scope->parent->name->len, 0);
} else if (!strcasecmp(proto_arg_info->class_name, "self") && proto->common.scope) {
- proto_class_name = proto->common.scope->name;
- proto_class_name_len = proto->common.scope->name_length;
+ proto_class_name = STR_INIT(
+ proto->common.scope->name->val,
+ proto->common.scope->name->len, 0);
} else {
- proto_class_name = proto_arg_info->class_name;
- proto_class_name_len = proto_arg_info->class_name_len;
+ proto_class_name = STR_INIT(
+ proto_arg_info->class_name,
+ proto_arg_info->class_name_len, 0);
}
- if (strcasecmp(fe_class_name, proto_class_name)!=0) {
+ if (strcasecmp(fe_class_name->val, proto_class_name->val)!=0) {
const char *colon;
if (fe->common.type != ZEND_USER_FUNCTION) {
return 0;
- } else if (strchr(proto_class_name, '\\') != NULL ||
- (colon = zend_memrchr(fe_class_name, '\\', fe_class_name_len)) == NULL ||
- strcasecmp(colon+1, proto_class_name) != 0) {
- zend_class_entry **fe_ce, **proto_ce;
- int found, found2;
+ } else if (strchr(proto_class_name->val, '\\') != NULL ||
+ (colon = zend_memrchr(fe_class_name->val, '\\', fe_class_name->len)) == NULL ||
+ strcasecmp(colon+1, proto_class_name->val) != 0) {
+ zend_class_entry *fe_ce, *proto_ce;
- found = zend_lookup_class(fe_class_name, fe_class_name_len, &fe_ce TSRMLS_CC);
- found2 = zend_lookup_class(proto_class_name, proto_class_name_len, &proto_ce TSRMLS_CC);
+ fe_ce = zend_lookup_class(fe_class_name TSRMLS_CC);
+ proto_ce = zend_lookup_class(proto_class_name TSRMLS_CC);
/* Check for class alias */
- if (found != SUCCESS || found2 != SUCCESS ||
- (*fe_ce)->type == ZEND_INTERNAL_CLASS ||
- (*proto_ce)->type == ZEND_INTERNAL_CLASS ||
- *fe_ce != *proto_ce) {
+ if (!fe_ce || !proto_ce ||
+ fe_ce->type == ZEND_INTERNAL_CLASS ||
+ proto_ce->type == ZEND_INTERNAL_CLASS ||
+ fe_ce != proto_ce) {
return 0;
}
}
@@ -3337,16 +3311,16 @@ static char * zend_get_function_declaration(zend_function *fptr TSRMLS_DC) /* {{
}
if (fptr->common.scope) {
- memcpy(offset, fptr->common.scope->name, fptr->common.scope->name_length);
- offset += fptr->common.scope->name_length;
+ memcpy(offset, fptr->common.scope->name->val, fptr->common.scope->name->len);
+ offset += fptr->common.scope->name->len;
*(offset++) = ':';
*(offset++) = ':';
}
{
- size_t name_len = strlen(fptr->common.function_name);
+ size_t name_len = fptr->common.function_name->len;
REALLOC_BUF_IF_EXCEED(buf, offset, length, name_len);
- memcpy(offset, fptr->common.function_name, name_len);
+ memcpy(offset, fptr->common.function_name->val, name_len);
offset += name_len;
}
@@ -3361,11 +3335,11 @@ static char * zend_get_function_declaration(zend_function *fptr TSRMLS_DC) /* {{
const char *class_name;
zend_uint class_name_len;
if (!strcasecmp(arg_info->class_name, "self") && fptr->common.scope ) {
- class_name = fptr->common.scope->name;
- class_name_len = fptr->common.scope->name_length;
+ class_name = fptr->common.scope->name->val;
+ class_name_len = fptr->common.scope->name->len;
} else if (!strcasecmp(arg_info->class_name, "parent") && fptr->common.scope->parent) {
- class_name = fptr->common.scope->parent->name;
- class_name_len = fptr->common.scope->parent->name_length;
+ class_name = fptr->common.scope->parent->name->val;
+ class_name_len = fptr->common.scope->parent->name->len;
} else {
class_name = arg_info->class_name;
class_name_len = arg_info->class_name_len;
@@ -3431,40 +3405,39 @@ static char * zend_get_function_declaration(zend_function *fptr TSRMLS_DC) /* {{
}
}
if (precv && precv->opcode == ZEND_RECV_INIT && precv->op2_type != IS_UNUSED) {
- zval *zv, zv_copy;
+ zval zv, zv_copy;
int use_copy;
- ALLOC_ZVAL(zv);
- *zv = *precv->op2.zv;
- zval_copy_ctor(zv);
- INIT_PZVAL(zv);
+
+ ZVAL_DUP(&zv, precv->op2.zv);
+//??? INIT_PZVAL(zv);
zval_update_constant_ex(&zv, (void*)1, fptr->common.scope TSRMLS_CC);
- if (Z_TYPE_P(zv) == IS_BOOL) {
- if (Z_LVAL_P(zv)) {
+ if (Z_TYPE(zv) == IS_BOOL) {
+ if (Z_LVAL(zv)) {
memcpy(offset, "true", 4);
offset += 4;
} else {
memcpy(offset, "false", 5);
offset += 5;
}
- } else if (Z_TYPE_P(zv) == IS_NULL) {
+ } else if (Z_TYPE(zv) == IS_NULL) {
memcpy(offset, "NULL", 4);
offset += 4;
- } else if (Z_TYPE_P(zv) == IS_STRING) {
+ } else if (Z_TYPE(zv) == IS_STRING) {
*(offset++) = '\'';
- REALLOC_BUF_IF_EXCEED(buf, offset, length, MIN(Z_STRLEN_P(zv), 10));
- memcpy(offset, Z_STRVAL_P(zv), MIN(Z_STRLEN_P(zv), 10));
- offset += MIN(Z_STRLEN_P(zv), 10);
- if (Z_STRLEN_P(zv) > 10) {
+ REALLOC_BUF_IF_EXCEED(buf, offset, length, MIN(Z_STRLEN(zv), 10));
+ memcpy(offset, Z_STRVAL(zv), MIN(Z_STRLEN(zv), 10));
+ offset += MIN(Z_STRLEN(zv), 10);
+ if (Z_STRLEN(zv) > 10) {
*(offset++) = '.';
*(offset++) = '.';
*(offset++) = '.';
}
*(offset++) = '\'';
- } else if (Z_TYPE_P(zv) == IS_ARRAY) {
+ } else if (Z_TYPE(zv) == IS_ARRAY) {
memcpy(offset, "Array", 5);
offset += 5;
} else {
- zend_make_printable_zval(zv, &zv_copy, &use_copy);
+ zend_make_printable_zval(&zv, &zv_copy, &use_copy);
REALLOC_BUF_IF_EXCEED(buf, offset, length, Z_STRLEN(zv_copy));
memcpy(offset, Z_STRVAL(zv_copy), Z_STRLEN(zv_copy));
offset += Z_STRLEN(zv_copy);
@@ -3557,10 +3530,10 @@ static void do_inheritance_check_on_method(zend_function *child, zend_function *
if (!zend_do_perform_implementation_check(child, child->common.prototype TSRMLS_CC)) {
zend_error_noreturn(E_COMPILE_ERROR, "Declaration of %s::%s() must be compatible with %s", ZEND_FN_SCOPE_NAME(child), child->common.function_name, zend_get_function_declaration(child->common.prototype TSRMLS_CC));
}
- } else if (EG(error_reporting) & E_STRICT || EG(user_error_handler)) { /* Check E_STRICT (or custom error handler) before the check so that we save some time */
+ } else if (EG(error_reporting) & E_STRICT || Z_TYPE(EG(user_error_handler)) != IS_UNDEF) { /* Check E_STRICT (or custom error handler) before the check so that we save some time */
if (!zend_do_perform_implementation_check(child, parent TSRMLS_CC)) {
char *method_prototype = zend_get_function_declaration(parent TSRMLS_CC);
- zend_error(E_STRICT, "Declaration of %s::%s() should be compatible with %s", ZEND_FN_SCOPE_NAME(child), child->common.function_name, method_prototype);
+ zend_error(E_STRICT, "Declaration of %s::%s() should be compatible with %s", ZEND_FN_SCOPE_NAME(child), child->common.function_name->val, method_prototype);
efree(method_prototype);
}
}
@@ -3573,7 +3546,7 @@ static zend_bool do_inherit_method_check(HashTable *child_function_table, zend_f
zend_function *child;
TSRMLS_FETCH();
- if (zend_hash_quick_find(child_function_table, hash_key->arKey, hash_key->nKeyLength, hash_key->h, (void **) &child)==FAILURE) {
+ if ((child = zend_hash_find_ptr(child_function_table, hash_key->key)) == NULL) {
if (parent_flags & (ZEND_ACC_ABSTRACT)) {
child_ce->ce_flags |= ZEND_ACC_IMPLICIT_ABSTRACT_CLASS;
}
@@ -3592,10 +3565,10 @@ static zend_bool do_inherit_property_access_check(HashTable *target_ht, zend_pro
zend_class_entry *parent_ce = ce->parent;
if (parent_info->flags & (ZEND_ACC_PRIVATE|ZEND_ACC_SHADOW)) {
- if (zend_hash_quick_find(&ce->properties_info, hash_key->arKey, hash_key->nKeyLength, hash_key->h, (void **) &child_info)==SUCCESS) {
+ if ((child_info = zend_hash_find_ptr(&ce->properties_info, hash_key->key)) != NULL) {
child_info->flags |= ZEND_ACC_CHANGED;
} else {
- zend_hash_quick_update(&ce->properties_info, hash_key->arKey, hash_key->nKeyLength, hash_key->h, parent_info, sizeof(zend_property_info), (void **) &child_info);
+ child_info = zend_hash_update_mem(&ce->properties_info, hash_key->key, parent_info, sizeof(zend_property_info));
if(ce->type & ZEND_INTERNAL_CLASS) {
zend_duplicate_property_info_internal(child_info);
} else {
@@ -3607,11 +3580,11 @@ static zend_bool do_inherit_property_access_check(HashTable *target_ht, zend_pro
return 0; /* don't copy access information to child */
}
- if (zend_hash_quick_find(&ce->properties_info, hash_key->arKey, hash_key->nKeyLength, hash_key->h, (void **) &child_info)==SUCCESS) {
+ if ((child_info = zend_hash_find_ptr(&ce->properties_info, hash_key->key)) != NULL) {
if ((parent_info->flags & ZEND_ACC_STATIC) != (child_info->flags & ZEND_ACC_STATIC)) {
zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare %s%s::$%s as %s%s::$%s",
- (parent_info->flags & ZEND_ACC_STATIC) ? "static " : "non static ", parent_ce->name, hash_key->arKey,
- (child_info->flags & ZEND_ACC_STATIC) ? "static " : "non static ", ce->name, hash_key->arKey);
+ (parent_info->flags & ZEND_ACC_STATIC) ? "static " : "non static ", parent_ce->name->val, hash_key->key->val,
+ (child_info->flags & ZEND_ACC_STATIC) ? "static " : "non static ", ce->name->val, hash_key->key->val);
}
@@ -3620,11 +3593,11 @@ static zend_bool do_inherit_property_access_check(HashTable *target_ht, zend_pro
}
if ((child_info->flags & ZEND_ACC_PPP_MASK) > (parent_info->flags & ZEND_ACC_PPP_MASK)) {
- zend_error_noreturn(E_COMPILE_ERROR, "Access level to %s::$%s must be %s (as in class %s)%s", ce->name, hash_key->arKey, zend_visibility_string(parent_info->flags), parent_ce->name, (parent_info->flags&ZEND_ACC_PUBLIC) ? "" : " or weaker");
+ zend_error_noreturn(E_COMPILE_ERROR, "Access level to %s::$%s must be %s (as in class %s)%s", ce->name->val, hash_key->key->val, zend_visibility_string(parent_info->flags), parent_ce->name->val, (parent_info->flags&ZEND_ACC_PUBLIC) ? "" : " or weaker");
} else if ((child_info->flags & ZEND_ACC_STATIC) == 0) {
zval_ptr_dtor(&(ce->default_properties_table[parent_info->offset]));
ce->default_properties_table[parent_info->offset] = ce->default_properties_table[child_info->offset];
- ce->default_properties_table[child_info->offset] = NULL;
+ ZVAL_UNDEF(&ce->default_properties_table[child_info->offset]);
child_info->offset = parent_info->offset;
}
return 0; /* Don't copy from parent */
@@ -3637,10 +3610,10 @@ static zend_bool do_inherit_property_access_check(HashTable *target_ht, zend_pro
static inline void do_implement_interface(zend_class_entry *ce, zend_class_entry *iface TSRMLS_DC) /* {{{ */
{
if (!(ce->ce_flags & ZEND_ACC_INTERFACE) && iface->interface_gets_implemented && iface->interface_gets_implemented(iface, ce TSRMLS_CC) == FAILURE) {
- zend_error(E_CORE_ERROR, "Class %s could not implement interface %s", ce->name, iface->name);
+ zend_error(E_CORE_ERROR, "Class %s could not implement interface %s", ce->name->val, iface->name->val);
}
if (ce == iface) {
- zend_error(E_ERROR, "Interface %s cannot implement itself", ce->name);
+ zend_error(E_ERROR, "Interface %s cannot implement itself", ce->name->val);
}
}
/* }}} */
@@ -3693,10 +3666,10 @@ static void zval_internal_ctor(zval **p) /* {{{ */
/* }}} */
# define zval_property_ctor(parent_ce, ce) \
- ((void (*)(void *)) (((parent_ce)->type != (ce)->type) ? zval_internal_ctor : zval_add_ref))
+ (((parent_ce)->type != (ce)->type) ? zval_internal_ctor : zval_add_ref))
#else
# define zval_property_ctor(parent_ce, ce) \
- ((void (*)(void *)) zval_add_ref)
+ zval_add_ref
#endif
ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent_ce TSRMLS_DC) /* {{{ */
@@ -3735,7 +3708,7 @@ ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent
}
for (i = 0; i < parent_ce->default_properties_count; i++) {
ce->default_properties_table[i] = parent_ce->default_properties_table[i];
- if (ce->default_properties_table[i]) {
+ if (Z_TYPE(ce->default_properties_table[i]) != IS_UNDEF) {
#ifdef ZTS
if (parent_ce->type != ce->type) {
zval *p;
@@ -3747,7 +3720,7 @@ ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent
Z_ADDREF_P(ce->default_properties_table[i]);
}
#else
- Z_ADDREF_P(ce->default_properties_table[i]);
+ Z_ADDREF(ce->default_properties_table[i]);
#endif
}
}
@@ -3769,7 +3742,7 @@ ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent
for (i = 0; i < parent_ce->default_static_members_count; i++) {
SEPARATE_ZVAL_TO_MAKE_IS_REF(&CE_STATIC_MEMBERS(parent_ce)[i]);
ce->default_static_members_table[i] = CE_STATIC_MEMBERS(parent_ce)[i];
- Z_ADDREF_P(ce->default_static_members_table[i]);
+ Z_ADDREF(ce->default_static_members_table[i]);
}
ce->default_static_members_count += parent_ce->default_static_members_count;
ce->static_members_table = ce->default_static_members_table;
@@ -3787,7 +3760,7 @@ ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent
for (i = 0; i < parent_ce->default_static_members_count; i++) {
SEPARATE_ZVAL_TO_MAKE_IS_REF(&parent_ce->default_static_members_table[i]);
ce->default_static_members_table[i] = parent_ce->default_static_members_table[i];
- Z_ADDREF_P(ce->default_static_members_table[i]);
+ Z_ADDREF(ce->default_static_members_table[i]);
}
ce->default_static_members_count += parent_ce->default_static_members_count;
if (ce->type == ZEND_USER_CLASS) {
@@ -3797,7 +3770,7 @@ ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent
}
for (zend_hash_internal_pointer_reset(&ce->properties_info);
- zend_hash_get_current_data(&ce->properties_info, (void *) &property_info) == SUCCESS;
+ (property_info = zend_hash_get_current_data_ptr(&ce->properties_info)) != NULL;
zend_hash_move_forward(&ce->properties_info)) {
if (property_info->ce == ce) {
if (property_info->flags & ZEND_ACC_STATIC) {
@@ -3808,10 +3781,10 @@ ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent
}
}
- zend_hash_merge_ex(&ce->properties_info, &parent_ce->properties_info, (copy_ctor_func_t) (ce->type & ZEND_INTERNAL_CLASS ? zend_duplicate_property_info_internal : zend_duplicate_property_info), sizeof(zend_property_info), (merge_checker_func_t) do_inherit_property_access_check, ce);
+ zend_hash_merge_ex(&ce->properties_info, &parent_ce->properties_info, (copy_ctor_func_t) (ce->type & ZEND_INTERNAL_CLASS ? zend_duplicate_property_info_internal : zend_duplicate_property_info), (merge_checker_func_t) do_inherit_property_access_check, ce);
- zend_hash_merge(&ce->constants_table, &parent_ce->constants_table, zval_property_ctor(parent_ce, ce), NULL, sizeof(zval *), 0);
- zend_hash_merge_ex(&ce->function_table, &parent_ce->function_table, (copy_ctor_func_t) do_inherit_method, sizeof(zend_function), (merge_checker_func_t) do_inherit_method_check, ce);
+ zend_hash_merge(&ce->constants_table, &parent_ce->constants_table, zval_property_ctor(parent_ce, ce), 0);
+ zend_hash_merge_ex(&ce->function_table, &parent_ce->function_table, (copy_ctor_func_t) do_inherit_method, (merge_checker_func_t) do_inherit_method_check, ce);
do_inherit_parent_constructor(ce);
if (ce->ce_flags & ZEND_ACC_IMPLICIT_ABSTRACT_CLASS && ce->type == ZEND_INTERNAL_CLASS) {
@@ -3824,13 +3797,13 @@ ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent
}
/* }}} */
-static zend_bool do_inherit_constant_check(HashTable *child_constants_table, const zval **parent_constant, const zend_hash_key *hash_key, const zend_class_entry *iface) /* {{{ */
+static zend_bool do_inherit_constant_check(HashTable *child_constants_table, const zval *parent_constant, const zend_hash_key *hash_key, const zend_class_entry *iface) /* {{{ */
{
- zval **old_constant;
+ zval *old_constant;
- if (zend_hash_quick_find(child_constants_table, hash_key->arKey, hash_key->nKeyLength, hash_key->h, (void**)&old_constant) == SUCCESS) {
- if (*old_constant != *parent_constant) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot inherit previously-inherited or override constant %s from interface %s", hash_key->arKey, iface->name);
+ if ((old_constant = zend_hash_find(child_constants_table, hash_key->key)) != NULL) {
+ if (old_constant != parent_constant) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot inherit previously-inherited or override constant %s from interface %s", hash_key->key->val, iface->name->val);
}
return 0;
}
@@ -3838,11 +3811,11 @@ static zend_bool do_inherit_constant_check(HashTable *child_constants_table, con
}
/* }}} */
-static int do_interface_constant_check(zval **val TSRMLS_DC, int num_args, va_list args, const zend_hash_key *key) /* {{{ */
+static int do_interface_constant_check(zval *val TSRMLS_DC, int num_args, va_list args, const zend_hash_key *key) /* {{{ */
{
zend_class_entry **iface = va_arg(args, zend_class_entry**);
- do_inherit_constant_check(&(*iface)->constants_table, (const zval **) val, key, *iface);
+ do_inherit_constant_check(&(*iface)->constants_table, (const zval *) val, key, *iface);
return ZEND_HASH_APPLY_KEEP;
}
@@ -3879,8 +3852,8 @@ ZEND_API void zend_do_implement_interface(zend_class_entry *ce, zend_class_entry
}
ce->interfaces[ce->num_interfaces++] = iface;
- zend_hash_merge_ex(&ce->constants_table, &iface->constants_table, (copy_ctor_func_t) zval_add_ref, sizeof(zval *), (merge_checker_func_t) do_inherit_constant_check, iface);
- zend_hash_merge_ex(&ce->function_table, &iface->function_table, (copy_ctor_func_t) do_inherit_method, sizeof(zend_function), (merge_checker_func_t) do_inherit_method_check, ce);
+ zend_hash_merge_ex(&ce->constants_table, &iface->constants_table, (copy_ctor_func_t) zval_add_ref, (merge_checker_func_t) do_inherit_constant_check, iface);
+ zend_hash_merge_ex(&ce->function_table, &iface->function_table, (copy_ctor_func_t) do_inherit_method, (merge_checker_func_t) do_inherit_method_check, ce);
do_implement_interface(ce, iface TSRMLS_CC);
zend_do_inherit_interfaces(ce, iface TSRMLS_CC);
@@ -3929,58 +3902,57 @@ static zend_bool zend_traits_method_compatibility_check(zend_function *fn, zend_
}
/* }}} */
-static void zend_add_magic_methods(zend_class_entry* ce, const char* mname, uint mname_len, zend_function* fe TSRMLS_DC) /* {{{ */
+static void zend_add_magic_methods(zend_class_entry* ce, zend_string* mname, zend_function* fe TSRMLS_DC) /* {{{ */
{
- if (!strncmp(mname, ZEND_CLONE_FUNC_NAME, mname_len)) {
+ if (!strncmp(mname->val, ZEND_CLONE_FUNC_NAME, mname->len)) {
ce->clone = fe; fe->common.fn_flags |= ZEND_ACC_CLONE;
- } else if (!strncmp(mname, ZEND_CONSTRUCTOR_FUNC_NAME, mname_len)) {
+ } else if (!strncmp(mname->val, ZEND_CONSTRUCTOR_FUNC_NAME, mname->len)) {
if (ce->constructor) {
zend_error_noreturn(E_COMPILE_ERROR, "%s has colliding constructor definitions coming from traits", ce->name);
}
ce->constructor = fe; fe->common.fn_flags |= ZEND_ACC_CTOR;
- } else if (!strncmp(mname, ZEND_DESTRUCTOR_FUNC_NAME, mname_len)) {
+ } else if (!strncmp(mname->val, ZEND_DESTRUCTOR_FUNC_NAME, mname->len)) {
ce->destructor = fe; fe->common.fn_flags |= ZEND_ACC_DTOR;
- } else if (!strncmp(mname, ZEND_GET_FUNC_NAME, mname_len)) {
+ } else if (!strncmp(mname->val, ZEND_GET_FUNC_NAME, mname->len)) {
ce->__get = fe;
- } else if (!strncmp(mname, ZEND_SET_FUNC_NAME, mname_len)) {
+ } else if (!strncmp(mname->val, ZEND_SET_FUNC_NAME, mname->len)) {
ce->__set = fe;
- } else if (!strncmp(mname, ZEND_CALL_FUNC_NAME, mname_len)) {
+ } else if (!strncmp(mname->val, ZEND_CALL_FUNC_NAME, mname->len)) {
ce->__call = fe;
- } else if (!strncmp(mname, ZEND_UNSET_FUNC_NAME, mname_len)) {
+ } else if (!strncmp(mname->val, ZEND_UNSET_FUNC_NAME, mname->len)) {
ce->__unset = fe;
- } else if (!strncmp(mname, ZEND_ISSET_FUNC_NAME, mname_len)) {
+ } else if (!strncmp(mname->val, ZEND_ISSET_FUNC_NAME, mname->len)) {
ce->__isset = fe;
- } else if (!strncmp(mname, ZEND_CALLSTATIC_FUNC_NAME, mname_len)) {
+ } else if (!strncmp(mname->val, ZEND_CALLSTATIC_FUNC_NAME, mname->len)) {
ce->__callstatic = fe;
- } else if (!strncmp(mname, ZEND_TOSTRING_FUNC_NAME, mname_len)) {
+ } else if (!strncmp(mname->val, ZEND_TOSTRING_FUNC_NAME, mname->len)) {
ce->__tostring = fe;
- } else if (ce->name_length + 1 == mname_len) {
- char *lowercase_name = emalloc(ce->name_length + 1);
- zend_str_tolower_copy(lowercase_name, ce->name, ce->name_length);
- lowercase_name = (char*)zend_new_interned_string(lowercase_name, ce->name_length + 1, 1 TSRMLS_CC);
- if (!memcmp(mname, lowercase_name, mname_len)) {
+ } else if (ce->name->len + 1 == mname->len) {
+ zend_string *lowercase_name = STR_ALLOC(ce->name->len, 0);
+ zend_str_tolower_copy(lowercase_name->val, ce->name->val, ce->name->len);
+ lowercase_name = zend_new_interned_string(lowercase_name TSRMLS_CC);
+ if (!memcmp(mname->val, lowercase_name->val, mname->len)) {
if (ce->constructor) {
zend_error_noreturn(E_COMPILE_ERROR, "%s has colliding constructor definitions coming from traits", ce->name);
}
ce->constructor = fe;
fe->common.fn_flags |= ZEND_ACC_CTOR;
}
- str_efree(lowercase_name);
+ STR_RELEASE(lowercase_name);
}
}
/* }}} */
-static void zend_add_trait_method(zend_class_entry *ce, const char *name, const char *arKey, uint nKeyLength, zend_function *fn, HashTable **overriden TSRMLS_DC) /* {{{ */
+static void zend_add_trait_method(zend_class_entry *ce, const char *name, zend_string *key, zend_function *fn, HashTable **overriden TSRMLS_DC) /* {{{ */
{
zend_function *existing_fn = NULL;
- ulong h = zend_hash_func(arKey, nKeyLength);
- if (zend_hash_quick_find(&ce->function_table, arKey, nKeyLength, h, (void**) &existing_fn) == SUCCESS) {
+ if ((existing_fn = zend_hash_find_ptr(&ce->function_table, key)) != NULL) {
if (existing_fn->common.scope == ce) {
/* members from the current class override trait methods */
/* use temporary *overriden HashTable to detect hidden conflict */
if (*overriden) {
- if (zend_hash_quick_find(*overriden, arKey, nKeyLength, h, (void**) &existing_fn) == SUCCESS) {
+ if ((existing_fn = zend_hash_find_ptr(*overriden, key)) != NULL) {
if (existing_fn->common.fn_flags & ZEND_ACC_ABSTRACT) {
/* Make sure the trait method is compatible with previosly declared abstract method */
if (!zend_traits_method_compatibility_check(fn, existing_fn TSRMLS_CC)) {
@@ -4002,7 +3974,7 @@ static void zend_add_trait_method(zend_class_entry *ce, const char *name, const
ALLOC_HASHTABLE(*overriden);
zend_hash_init_ex(*overriden, 2, NULL, NULL, 0, 0);
}
- zend_hash_quick_update(*overriden, arKey, nKeyLength, h, fn, sizeof(zend_function), (void**)&fn);
+ fn = zend_hash_update_mem(*overriden, key, fn, sizeof(zend_function));
return;
} else if (existing_fn->common.fn_flags & ZEND_ACC_ABSTRACT) {
/* Make sure the trait method is compatible with previosly declared abstract method */
@@ -4038,8 +4010,8 @@ static void zend_add_trait_method(zend_class_entry *ce, const char *name, const
}
function_add_ref(fn);
- zend_hash_quick_update(&ce->function_table, arKey, nKeyLength, h, fn, sizeof(zend_function), (void**)&fn);
- zend_add_magic_methods(ce, arKey, nKeyLength, fn TSRMLS_CC);
+ fn = zend_hash_update_mem(&ce->function_table, key, fn, sizeof(zend_function));
+ zend_add_magic_methods(ce, key, fn TSRMLS_CC);
}
/* }}} */
@@ -4066,16 +4038,15 @@ static int zend_traits_copy_functions(zend_function *fn TSRMLS_DC, int num_args,
HashTable **overriden;
zend_trait_alias *alias, **alias_ptr;
HashTable *exclude_table;
- char *lcname;
+ zend_string *lcname;
unsigned int fnname_len;
zend_function fn_copy;
- void *dummy;
ce = va_arg(args, zend_class_entry*);
overriden = va_arg(args, HashTable**);
exclude_table = va_arg(args, HashTable*);
- fnname_len = hash_key->nKeyLength - 1;
+ fnname_len = hash_key->key->len;
/* apply aliases which are qualified with a class name, there should not be any ambiguity */
if (ce->trait_aliases) {
@@ -4085,8 +4056,8 @@ static int zend_traits_copy_functions(zend_function *fn TSRMLS_DC, int num_args,
/* Scope unset or equal to the function we compare to, and the alias applies to fn */
if (alias->alias != NULL
&& (!alias->trait_method->ce || fn->common.scope == alias->trait_method->ce)
- && alias->trait_method->mname_len == fnname_len
- && (zend_binary_strcasecmp(alias->trait_method->method_name, alias->trait_method->mname_len, hash_key->arKey, fnname_len) == 0)) {
+ && alias->trait_method->method_name->len == fnname_len
+ && (zend_binary_strcasecmp(alias->trait_method->method_name->val, alias->trait_method->method_name->len, hash_key->key->val, fnname_len) == 0)) {
fn_copy = *fn;
/* if it is 0, no modifieres has been changed */
@@ -4094,9 +4065,10 @@ static int zend_traits_copy_functions(zend_function *fn TSRMLS_DC, int num_args,
fn_copy.common.fn_flags = alias->modifiers | (fn->common.fn_flags ^ (fn->common.fn_flags & ZEND_ACC_PPP_MASK));
}
- lcname = zend_str_tolower_dup(alias->alias, alias->alias_len);
- zend_add_trait_method(ce, alias->alias, lcname, alias->alias_len+1, &fn_copy, overriden TSRMLS_CC);
- efree(lcname);
+ lcname = STR_ALLOC(alias->alias->len, 0);
+ zend_str_tolower_copy(lcname->val, alias->alias->val, alias->alias->len);
+ zend_add_trait_method(ce, alias->alias->val, lcname, &fn_copy, overriden TSRMLS_CC);
+ STR_FREE(lcname);
/* Record the trait from which this alias was resolved. */
if (!alias->trait_method->ce) {
@@ -4108,9 +4080,9 @@ static int zend_traits_copy_functions(zend_function *fn TSRMLS_DC, int num_args,
}
}
- lcname = (char *) hash_key->arKey;
+ lcname = hash_key->key;
- if (exclude_table == NULL || zend_hash_find(exclude_table, lcname, fnname_len, &dummy) == FAILURE) {
+ if (exclude_table == NULL || zend_hash_find(exclude_table, lcname) == NULL) {
/* is not in hashtable, thus, function is not to be excluded */
fn_copy = *fn;
@@ -4122,8 +4094,8 @@ static int zend_traits_copy_functions(zend_function *fn TSRMLS_DC, int num_args,
/* Scope unset or equal to the function we compare to, and the alias applies to fn */
if (alias->alias == NULL && alias->modifiers != 0
&& (!alias->trait_method->ce || fn->common.scope == alias->trait_method->ce)
- && (alias->trait_method->mname_len == fnname_len)
- && (zend_binary_strcasecmp(alias->trait_method->method_name, alias->trait_method->mname_len, lcname, fnname_len) == 0)) {
+ && (alias->trait_method->method_name->len == fnname_len)
+ && (zend_binary_strcasecmp(alias->trait_method->method_name->val, alias->trait_method->method_name->len, lcname->val, fnname_len) == 0)) {
fn_copy.common.fn_flags = alias->modifiers | (fn->common.fn_flags ^ (fn->common.fn_flags & ZEND_ACC_PPP_MASK));
@@ -4137,7 +4109,7 @@ static int zend_traits_copy_functions(zend_function *fn TSRMLS_DC, int num_args,
}
}
- zend_add_trait_method(ce, fn->common.function_name, lcname, fnname_len+1, &fn_copy, overriden TSRMLS_CC);
+ zend_add_trait_method(ce, fn->common.function_name->val, lcname, &fn_copy, overriden TSRMLS_CC);
}
return ZEND_HASH_APPLY_KEEP;
@@ -4166,7 +4138,7 @@ static void zend_traits_init_trait_structures(zend_class_entry *ce TSRMLS_DC) /*
size_t i, j = 0;
zend_trait_precedence *cur_precedence;
zend_trait_method_reference *cur_method_ref;
- char *lcname;
+ zend_string *lcname;
zend_bool method_exists;
/* resolve class references */
@@ -4176,24 +4148,25 @@ static void zend_traits_init_trait_structures(zend_class_entry *ce TSRMLS_DC) /*
/** Resolve classes for all precedence operations. */
if (cur_precedence->exclude_from_classes) {
cur_method_ref = cur_precedence->trait_method;
- if (!(cur_precedence->trait_method->ce = zend_fetch_class(cur_method_ref->class_name, cur_method_ref->cname_len,
+ if (!(cur_precedence->trait_method->ce = zend_fetch_class(cur_method_ref->class_name,
ZEND_FETCH_CLASS_TRAIT|ZEND_FETCH_CLASS_NO_AUTOLOAD TSRMLS_CC))) {
zend_error_noreturn(E_COMPILE_ERROR, "Could not find trait %s", cur_method_ref->class_name);
}
zend_check_trait_usage(ce, cur_precedence->trait_method->ce TSRMLS_CC);
/** Ensure that the prefered method is actually available. */
- lcname = zend_str_tolower_dup(cur_method_ref->method_name,
- cur_method_ref->mname_len);
+ lcname = STR_ALLOC(cur_method_ref->method_name->len, 0);
+ zend_str_tolower_copy(lcname->val,
+ cur_method_ref->method_name->val,
+ cur_method_ref->method_name->len);
method_exists = zend_hash_exists(&cur_method_ref->ce->function_table,
- lcname,
- cur_method_ref->mname_len + 1);
- efree(lcname);
+ lcname);
+ STR_FREE(lcname);
if (!method_exists) {
zend_error_noreturn(E_COMPILE_ERROR,
"A precedence rule was defined for %s::%s but this method does not exist",
- cur_method_ref->ce->name,
- cur_method_ref->method_name);
+ cur_method_ref->ce->name->val,
+ cur_method_ref->method_name->val);
}
/** With the other traits, we are more permissive.
@@ -4203,27 +4176,26 @@ static void zend_traits_init_trait_structures(zend_class_entry *ce TSRMLS_DC) /*
is consistent in itself.
*/
j = 0;
- while (cur_precedence->exclude_from_classes[j]) {
- char* class_name = (char*)cur_precedence->exclude_from_classes[j];
- zend_uint name_length = strlen(class_name);
+ while (cur_precedence->exclude_from_classes[j].class_name) {
+ zend_string* class_name = cur_precedence->exclude_from_classes[j].class_name;
- if (!(cur_precedence->exclude_from_classes[j] = zend_fetch_class(class_name, name_length, ZEND_FETCH_CLASS_TRAIT |ZEND_FETCH_CLASS_NO_AUTOLOAD TSRMLS_CC))) {
+ if (!(cur_precedence->exclude_from_classes[j].ce = zend_fetch_class(class_name, ZEND_FETCH_CLASS_TRAIT |ZEND_FETCH_CLASS_NO_AUTOLOAD TSRMLS_CC))) {
zend_error_noreturn(E_COMPILE_ERROR, "Could not find trait %s", class_name);
}
- zend_check_trait_usage(ce, cur_precedence->exclude_from_classes[j] TSRMLS_CC);
+ zend_check_trait_usage(ce, cur_precedence->exclude_from_classes[j].ce TSRMLS_CC);
/* make sure that the trait method is not from a class mentioned in
exclude_from_classes, for consistency */
- if (cur_precedence->trait_method->ce == cur_precedence->exclude_from_classes[i]) {
+ if (cur_precedence->trait_method->ce == cur_precedence->exclude_from_classes[i].ce) {
zend_error_noreturn(E_COMPILE_ERROR,
"Inconsistent insteadof definition. "
"The method %s is to be used from %s, but %s is also on the exclude list",
- cur_method_ref->method_name,
- cur_precedence->trait_method->ce->name,
- cur_precedence->trait_method->ce->name);
+ cur_method_ref->method_name->val,
+ cur_precedence->trait_method->ce->name->val,
+ cur_precedence->trait_method->ce->name->val);
}
- efree(class_name);
+ STR_FREE(class_name);
j++;
}
}
@@ -4237,17 +4209,19 @@ static void zend_traits_init_trait_structures(zend_class_entry *ce TSRMLS_DC) /*
/** For all aliases with an explicit class name, resolve the class now. */
if (ce->trait_aliases[i]->trait_method->class_name) {
cur_method_ref = ce->trait_aliases[i]->trait_method;
- if (!(cur_method_ref->ce = zend_fetch_class(cur_method_ref->class_name, cur_method_ref->cname_len, ZEND_FETCH_CLASS_TRAIT|ZEND_FETCH_CLASS_NO_AUTOLOAD TSRMLS_CC))) {
- zend_error_noreturn(E_COMPILE_ERROR, "Could not find trait %s", cur_method_ref->class_name);
+ if (!(cur_method_ref->ce = zend_fetch_class(cur_method_ref->class_name, ZEND_FETCH_CLASS_TRAIT|ZEND_FETCH_CLASS_NO_AUTOLOAD TSRMLS_CC))) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Could not find trait %s", cur_method_ref->class_name->val);
}
zend_check_trait_usage(ce, cur_method_ref->ce TSRMLS_CC);
/** And, ensure that the referenced method is resolvable, too. */
- lcname = zend_str_tolower_dup(cur_method_ref->method_name,
- cur_method_ref->mname_len);
+ lcname = STR_ALLOC(cur_method_ref->method_name->len, 0);
+ zend_str_tolower_copy(lcname->val,
+ cur_method_ref->method_name->val,
+ cur_method_ref->method_name->len);
method_exists = zend_hash_exists(&cur_method_ref->ce->function_table,
- lcname, cur_method_ref->mname_len + 1);
- efree(lcname);
+ lcname);
+ STR_FREE(lcname);
if (!method_exists) {
zend_error_noreturn(E_COMPILE_ERROR, "An alias was defined for %s::%s but this method does not exist", cur_method_ref->ce->name, cur_method_ref->method_name);
@@ -4269,16 +4243,18 @@ static void zend_traits_compile_exclude_table(HashTable* exclude_table, zend_tra
while (precedences[i]) {
if (precedences[i]->exclude_from_classes) {
j = 0;
- while (precedences[i]->exclude_from_classes[j]) {
- if (precedences[i]->exclude_from_classes[j] == trait) {
- zend_uint lcname_len = precedences[i]->trait_method->mname_len;
- char *lcname = zend_str_tolower_dup(precedences[i]->trait_method->method_name, lcname_len);
-
- if (zend_hash_add(exclude_table, lcname, lcname_len, NULL, 0, NULL) == FAILURE) {
- efree(lcname);
+ while (precedences[i]->exclude_from_classes[j].ce) {
+ if (precedences[i]->exclude_from_classes[j].ce == trait) {
+ zend_string *lcname = STR_ALLOC(precedences[i]->trait_method->method_name->len, 0);
+
+ zend_str_tolower_copy(lcname->val,
+ precedences[i]->trait_method->method_name->val,
+ precedences[i]->trait_method->method_name->len);
+ if (zend_hash_add_empty_element(exclude_table, lcname) == NULL) {
+ STR_RELEASE(lcname);
zend_error_noreturn(E_COMPILE_ERROR, "Failed to evaluate a trait precedence (%s). Method of trait %s was defined to be excluded multiple times", precedences[i]->trait_method->method_name, trait->name);
}
- efree(lcname);
+ STR_RELEASE(lcname);
}
++j;
}
@@ -4320,13 +4296,13 @@ static void zend_do_traits_method_binding(zend_class_entry *ce TSRMLS_DC) /* {{{
}
/* }}} */
-static zend_class_entry* find_first_definition(zend_class_entry *ce, size_t current_trait, const char* prop_name, int prop_name_length, ulong prop_hash, zend_class_entry *coliding_ce) /* {{{ */
+static zend_class_entry* find_first_definition(zend_class_entry *ce, size_t current_trait, zend_string *prop_name, zend_class_entry *coliding_ce) /* {{{ */
{
size_t i;
if (coliding_ce == ce) {
for (i = 0; i < current_trait; i++) {
- if (zend_hash_quick_exists(&ce->traits[i]->properties_info, prop_name, prop_name_length+1, prop_hash)) {
+ if (zend_hash_exists(&ce->traits[i]->properties_info, prop_name)) {
return ce->traits[i];
}
}
@@ -4342,13 +4318,10 @@ static void zend_do_traits_property_binding(zend_class_entry *ce TSRMLS_DC) /* {
zend_property_info *property_info;
zend_property_info *coliding_prop;
zval compare_result;
- const char* prop_name;
- int prop_name_length;
- ulong prop_hash;
+ zend_string* prop_name;
const char* class_name_unused;
zend_bool not_compatible;
zval* prop_value;
- char* doc_comment;
zend_uint flags;
/* In the following steps the properties are inserted into the property table
@@ -4358,27 +4331,28 @@ static void zend_do_traits_property_binding(zend_class_entry *ce TSRMLS_DC) /* {
*/
for (i = 0; i < ce->num_traits; i++) {
for (zend_hash_internal_pointer_reset(&ce->traits[i]->properties_info);
- zend_hash_get_current_data(&ce->traits[i]->properties_info, (void *) &property_info) == SUCCESS;
+ (property_info = zend_hash_get_current_data_ptr(&ce->traits[i]->properties_info)) != NULL;
zend_hash_move_forward(&ce->traits[i]->properties_info)) {
/* first get the unmangeld name if necessary,
* then check whether the property is already there
*/
flags = property_info->flags;
if ((flags & ZEND_ACC_PPP_MASK) == ZEND_ACC_PUBLIC) {
- prop_hash = property_info->h;
prop_name = property_info->name;
- prop_name_length = property_info->name_length;
} else {
+ const char *pname;
+ int pname_len;
+
/* for private and protected we need to unmangle the names */
- zend_unmangle_property_name_ex(property_info->name, property_info->name_length,
- &class_name_unused, &prop_name, &prop_name_length);
- prop_hash = zend_get_hash_value(prop_name, prop_name_length + 1);
+ zend_unmangle_property_name_ex(property_info->name->val, property_info->name->len,
+ &class_name_unused, &pname, &pname_len);
+ prop_name = STR_INIT(pname, pname_len, 0);
}
/* next: check for conflicts with current class */
- if (zend_hash_quick_find(&ce->properties_info, prop_name, prop_name_length+1, prop_hash, (void **) &coliding_prop) == SUCCESS) {
+ if ((coliding_prop = zend_hash_find_ptr(&ce->properties_info, prop_name)) != NULL) {
if (coliding_prop->flags & ZEND_ACC_SHADOW) {
- zend_hash_quick_del(&ce->properties_info, prop_name, prop_name_length+1, prop_hash);
+ zend_hash_del(&ce->properties_info, prop_name);
flags |= ZEND_ACC_CHANGED;
} else {
if ((coliding_prop->flags & (ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC))
@@ -4386,13 +4360,13 @@ static void zend_do_traits_property_binding(zend_class_entry *ce TSRMLS_DC) /* {
/* flags are identical, now the value needs to be checked */
if (flags & ZEND_ACC_STATIC) {
not_compatible = (FAILURE == compare_function(&compare_result,
- ce->default_static_members_table[coliding_prop->offset],
- ce->traits[i]->default_static_members_table[property_info->offset] TSRMLS_CC))
+ &ce->default_static_members_table[coliding_prop->offset],
+ &ce->traits[i]->default_static_members_table[property_info->offset] TSRMLS_CC))
|| (Z_LVAL(compare_result) != 0);
} else {
not_compatible = (FAILURE == compare_function(&compare_result,
- ce->default_properties_table[coliding_prop->offset],
- ce->traits[i]->default_properties_table[property_info->offset] TSRMLS_CC))
+ &ce->default_properties_table[coliding_prop->offset],
+ &ce->traits[i]->default_properties_table[property_info->offset] TSRMLS_CC))
|| (Z_LVAL(compare_result) != 0);
}
} else {
@@ -4403,17 +4377,17 @@ static void zend_do_traits_property_binding(zend_class_entry *ce TSRMLS_DC) /* {
if (not_compatible) {
zend_error_noreturn(E_COMPILE_ERROR,
"%s and %s define the same property ($%s) in the composition of %s. However, the definition differs and is considered incompatible. Class was composed",
- find_first_definition(ce, i, prop_name, prop_name_length, prop_hash, coliding_prop->ce)->name,
- property_info->ce->name,
- prop_name,
- ce->name);
+ find_first_definition(ce, i, prop_name, coliding_prop->ce)->name->val,
+ property_info->ce->name->val,
+ prop_name->val,
+ ce->name->val);
} else {
zend_error(E_STRICT,
"%s and %s define the same property ($%s) in the composition of %s. This might be incompatible, to improve maintainability consider using accessor methods in traits instead. Class was composed",
- find_first_definition(ce, i, prop_name, prop_name_length, prop_hash, coliding_prop->ce)->name,
- property_info->ce->name,
- prop_name,
- ce->name);
+ find_first_definition(ce, i, prop_name, coliding_prop->ce)->name->val,
+ property_info->ce->name->val,
+ prop_name->val,
+ ce->name->val);
continue;
}
}
@@ -4421,16 +4395,16 @@ static void zend_do_traits_property_binding(zend_class_entry *ce TSRMLS_DC) /* {
/* property not found, so lets add it */
if (flags & ZEND_ACC_STATIC) {
- prop_value = ce->traits[i]->default_static_members_table[property_info->offset];
+ prop_value = &ce->traits[i]->default_static_members_table[property_info->offset];
} else {
- prop_value = ce->traits[i]->default_properties_table[property_info->offset];
+ prop_value = &ce->traits[i]->default_properties_table[property_info->offset];
}
Z_ADDREF_P(prop_value);
- doc_comment = property_info->doc_comment ? estrndup(property_info->doc_comment, property_info->doc_comment_len) : NULL;
- zend_declare_property_ex(ce, prop_name, prop_name_length,
+//??? doc_comment = property_info->doc_comment ? STR_DUP(property_info->doc_comment, 0) : NULL;
+ zend_declare_property_ex(ce, prop_name,
prop_value, flags,
- doc_comment, property_info->doc_comment_len TSRMLS_CC);
+ property_info->doc_comment TSRMLS_CC);
}
}
}
@@ -4440,7 +4414,7 @@ static void zend_do_check_for_inconsistent_traits_aliasing(zend_class_entry *ce
{
int i = 0;
zend_trait_alias* cur_alias;
- char* lc_method_name;
+ zend_string* lc_method_name;
if (ce->trait_aliases) {
while (ce->trait_aliases[i]) {
@@ -4463,20 +4437,22 @@ static void zend_do_check_for_inconsistent_traits_aliasing(zend_class_entry *ce
2) it is just a plain old inconsitency/typo/bug
as in the case where alias is set. */
- lc_method_name = zend_str_tolower_dup(cur_alias->trait_method->method_name,
- cur_alias->trait_method->mname_len);
+ lc_method_name = STR_ALLOC(cur_alias->trait_method->method_name->len, 0);
+ zend_str_tolower_copy(
+ lc_method_name->val,
+ cur_alias->trait_method->method_name->val,
+ cur_alias->trait_method->method_name->len);
if (zend_hash_exists(&ce->function_table,
- lc_method_name,
- cur_alias->trait_method->mname_len+1)) {
- efree(lc_method_name);
+ lc_method_name)) {
+ STR_FREE(lc_method_name);
zend_error_noreturn(E_COMPILE_ERROR,
"The modifiers for the trait alias %s() need to be changed in the same statment in which the alias is defined. Error",
- cur_alias->trait_method->method_name);
+ cur_alias->trait_method->method_name->val);
} else {
- efree(lc_method_name);
+ STR_FREE(lc_method_name);
zend_error_noreturn(E_COMPILE_ERROR,
"The modifiers of the trait method %s() are changed, but this method does not exist. Error",
- cur_alias->trait_method->method_name);
+ cur_alias->trait_method->method_name->val);
}
}
@@ -4529,20 +4505,20 @@ ZEND_API int do_bind_function(const zend_op_array *op_array, zend_op *opline, Ha
op2 = opline->op2.zv;
}
- zend_hash_quick_find(function_table, Z_STRVAL_P(op1), Z_STRLEN_P(op1), Z_HASH_P(op1), (void *) &function);
- if (zend_hash_quick_add(function_table, Z_STRVAL_P(op2), Z_STRLEN_P(op2)+1, Z_HASH_P(op2), function, sizeof(zend_function), NULL)==FAILURE) {
+ function = zend_hash_find_ptr(function_table, Z_STR_P(op1));
+ if (zend_hash_add_mem(function_table, Z_STR_P(op2), function, sizeof(zend_function)) == NULL) {
int error_level = compile_time ? E_COMPILE_ERROR : E_ERROR;
zend_function *old_function;
- if (zend_hash_quick_find(function_table, Z_STRVAL_P(op2), Z_STRLEN_P(op2)+1, Z_HASH_P(op2), (void *) &old_function)==SUCCESS
+ if ((old_function = zend_hash_find_ptr(function_table, Z_STR_P(op2))) != NULL
&& old_function->type == ZEND_USER_FUNCTION
&& old_function->op_array.last > 0) {
zend_error(error_level, "Cannot redeclare %s() (previously declared in %s:%d)",
- function->common.function_name,
- old_function->op_array.filename,
+ function->common.function_name->val,
+ old_function->op_array.filename->val,
old_function->op_array.opcodes[0].lineno);
} else {
- zend_error(error_level, "Cannot redeclare %s()", function->common.function_name);
+ zend_error(error_level, "Cannot redeclare %s()", function->common.function_name->val);
}
return FAILURE;
} else {
@@ -4562,15 +4538,12 @@ void zend_prepare_reference(znode *result, znode *class_name, znode *method_name
zend_do_begin_class_declaration is also just using that string */
if (class_name) {
zend_resolve_class_name(class_name TSRMLS_CC);
- method_ref->class_name = Z_STRVAL(class_name->u.constant);
- method_ref->cname_len = Z_STRLEN(class_name->u.constant);
+ method_ref->class_name = Z_STR(class_name->u.constant);
} else {
method_ref->class_name = NULL;
- method_ref->cname_len = 0;
}
- method_ref->method_name = Z_STRVAL(method_name->u.constant);
- method_ref->mname_len = Z_STRLEN(method_name->u.constant);
+ method_ref->method_name = Z_STR(method_name->u.constant);
result->u.op.ptr = method_ref;
result->op_type = IS_TMP_VAR;
@@ -4597,8 +4570,7 @@ void zend_add_trait_alias(znode *method_reference, znode *modifiers, znode *alia
trait_alias->trait_method = (zend_trait_method_reference*)method_reference->u.op.ptr;
trait_alias->modifiers = Z_LVAL(modifiers->u.constant);
if (alias) {
- trait_alias->alias = Z_STRVAL(alias->u.constant);
- trait_alias->alias_len = Z_STRLEN(alias->u.constant);
+ trait_alias->alias = Z_STR(alias->u.constant);
} else {
trait_alias->alias = NULL;
}
@@ -4612,7 +4584,7 @@ void zend_add_trait_precedence(znode *method_reference, znode *trait_list TSRMLS
zend_trait_precedence *trait_precedence = emalloc(sizeof(zend_trait_precedence));
trait_precedence->trait_method = (zend_trait_method_reference*)method_reference->u.op.ptr;
- trait_precedence->exclude_from_classes = (zend_class_entry**) trait_list->u.op.ptr;
+ trait_precedence->exclude_from_classes = trait_list->u.op.ptr;
zend_add_to_list(&ce->trait_precedences, trait_precedence TSRMLS_CC);
}
@@ -4620,7 +4592,7 @@ void zend_add_trait_precedence(znode *method_reference, znode *trait_list TSRMLS
ZEND_API zend_class_entry *do_bind_class(const zend_op_array* op_array, const zend_op *opline, HashTable *class_table, zend_bool compile_time TSRMLS_DC) /* {{{ */
{
- zend_class_entry *ce, **pce;
+ zend_class_entry *ce;
zval *op1, *op2;
if (compile_time) {
@@ -4630,14 +4602,12 @@ ZEND_API zend_class_entry *do_bind_class(const zend_op_array* op_array, const ze
op1 = opline->op1.zv;
op2 = opline->op2.zv;
}
- if (zend_hash_quick_find(class_table, Z_STRVAL_P(op1), Z_STRLEN_P(op1), Z_HASH_P(op1), (void **) &pce)==FAILURE) {
+ if ((ce = zend_hash_find_ptr(class_table, Z_STR_P(op1))) == NULL) {
zend_error_noreturn(E_COMPILE_ERROR, "Internal Zend error - Missing class information for %s", Z_STRVAL_P(op1));
return NULL;
- } else {
- ce = *pce;
}
ce->refcount++;
- if (zend_hash_quick_add(class_table, Z_STRVAL_P(op2), Z_STRLEN_P(op2)+1, Z_HASH_P(op2), &ce, sizeof(zend_class_entry *), NULL)==FAILURE) {
+ if (zend_hash_add_ptr(class_table, Z_STR_P(op2), ce) == NULL) {
ce->refcount--;
if (!compile_time) {
/* If we're in compile time, in practice, it's quite possible
@@ -4645,7 +4615,7 @@ ZEND_API zend_class_entry *do_bind_class(const zend_op_array* op_array, const ze
* so we shut up about it. This allows the if (!defined('FOO')) { return; }
* approach to work.
*/
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare class %s", ce->name);
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare class %s", ce->name->val);
}
return NULL;
} else {
@@ -4659,8 +4629,7 @@ ZEND_API zend_class_entry *do_bind_class(const zend_op_array* op_array, const ze
ZEND_API zend_class_entry *do_bind_inherited_class(const zend_op_array *op_array, const zend_op *opline, HashTable *class_table, zend_class_entry *parent_ce, zend_bool compile_time TSRMLS_DC) /* {{{ */
{
- zend_class_entry *ce, **pce;
- int found_ce;
+ zend_class_entry *ce;
zval *op1, *op2;
if (compile_time) {
@@ -4671,9 +4640,9 @@ ZEND_API zend_class_entry *do_bind_inherited_class(const zend_op_array *op_array
op2 = opline->op2.zv;
}
- found_ce = zend_hash_quick_find(class_table, Z_STRVAL_P(op1), Z_STRLEN_P(op1), Z_HASH_P(op1), (void **) &pce);
+ ce = zend_hash_find_ptr(class_table, Z_STR_P(op1));
- if (found_ce == FAILURE) {
+ if (!ce) {
if (!compile_time) {
/* If we're in compile time, in practice, it's quite possible
* that we'll never reach this class declaration at runtime,
@@ -4683,8 +4652,6 @@ ZEND_API zend_class_entry *do_bind_inherited_class(const zend_op_array *op_array
zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare class %s", Z_STRVAL_P(op2));
}
return NULL;
- } else {
- ce = *pce;
}
if (parent_ce->ce_flags & ZEND_ACC_INTERFACE) {
@@ -4698,8 +4665,8 @@ ZEND_API zend_class_entry *do_bind_inherited_class(const zend_op_array *op_array
ce->refcount++;
/* Register the derived class */
- if (zend_hash_quick_add(class_table, Z_STRVAL_P(op2), Z_STRLEN_P(op2)+1, Z_HASH_P(op2), pce, sizeof(zend_class_entry *), NULL)==FAILURE) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare class %s", ce->name);
+ if (zend_hash_add_ptr(class_table, Z_STR_P(op2), ce) == NULL) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare class %s", ce->name->val);
}
return ce;
}
@@ -4731,12 +4698,12 @@ void zend_do_early_binding(TSRMLS_D) /* {{{ */
{
zend_op *fetch_class_opline = opline-1;
zval *parent_name;
- zend_class_entry **pce;
+ zend_class_entry *ce;
parent_name = &CONSTANT(fetch_class_opline->op2.constant);
- if ((zend_lookup_class(Z_STRVAL_P(parent_name), Z_STRLEN_P(parent_name), &pce TSRMLS_CC) == FAILURE) ||
+ if (((ce = zend_lookup_class(Z_STR_P(parent_name) TSRMLS_CC)) == NULL) ||
((CG(compiler_options) & ZEND_COMPILE_IGNORE_INTERNAL_CLASSES) &&
- ((*pce)->type == ZEND_INTERNAL_CLASS))) {
+ (ce->type == ZEND_INTERNAL_CLASS))) {
if (CG(compiler_options) & ZEND_COMPILE_DELAYED_BINDING) {
zend_uint *opline_num = &CG(active_op_array)->early_binding;
@@ -4750,7 +4717,7 @@ void zend_do_early_binding(TSRMLS_D) /* {{{ */
}
return;
}
- if (do_bind_inherited_class(CG(active_op_array), opline, CG(class_table), *pce, 1 TSRMLS_CC) == NULL) {
+ if (do_bind_inherited_class(CG(active_op_array), opline, CG(class_table), ce, 1 TSRMLS_CC) == NULL) {
return;
}
/* clear unnecessary ZEND_FETCH_CLASS opcode */
@@ -4772,7 +4739,7 @@ void zend_do_early_binding(TSRMLS_D) /* {{{ */
return;
}
- zend_hash_quick_del(table, Z_STRVAL(CONSTANT(opline->op1.constant)), Z_STRLEN(CONSTANT(opline->op1.constant)), Z_HASH_P(&CONSTANT(opline->op1.constant)));
+ zend_hash_del(table, Z_STR(CONSTANT(opline->op1.constant)));
zend_del_literal(CG(active_op_array), opline->op1.constant);
zend_del_literal(CG(active_op_array), opline->op2.constant);
MAKE_NOP(opline);
@@ -4784,12 +4751,12 @@ ZEND_API void zend_do_delayed_early_binding(const zend_op_array *op_array TSRMLS
if (op_array->early_binding != -1) {
zend_bool orig_in_compilation = CG(in_compilation);
zend_uint opline_num = op_array->early_binding;
- zend_class_entry **pce;
+ zend_class_entry *ce;
CG(in_compilation) = 1;
while (opline_num != -1) {
- if (zend_lookup_class(Z_STRVAL_P(op_array->opcodes[opline_num-1].op2.zv), Z_STRLEN_P(op_array->opcodes[opline_num-1].op2.zv), &pce TSRMLS_CC) == SUCCESS) {
- do_bind_inherited_class(op_array, &op_array->opcodes[opline_num], EG(class_table), *pce, 0 TSRMLS_CC);
+ if ((ce = zend_lookup_class(Z_STR_P(op_array->opcodes[opline_num-1].op2.zv) TSRMLS_CC)) != NULL) {
+ do_bind_inherited_class(op_array, &op_array->opcodes[opline_num], EG(class_table), ce, 0 TSRMLS_CC);
}
opline_num = op_array->opcodes[opline_num].result.opline_num;
}
@@ -5055,46 +5022,47 @@ void zend_do_begin_class_declaration(const znode *class_token, znode *class_name
zend_op *opline;
int doing_inheritance = 0;
zend_class_entry *new_class_entry;
- char *lcname;
+ zend_string *lcname;
int error = 0;
- zval **ns_name, key;
+ zval *ns_name, key;
if (CG(active_class_entry)) {
zend_error_noreturn(E_COMPILE_ERROR, "Class declarations may not be nested");
return;
}
- lcname = zend_str_tolower_dup(Z_STRVAL(class_name->u.constant), Z_STRLEN(class_name->u.constant));
+ lcname = STR_ALLOC(Z_STRLEN(class_name->u.constant), 0);
+ zend_str_tolower_copy(lcname->val, Z_STRVAL(class_name->u.constant), Z_STRLEN(class_name->u.constant));
- if (!(strcmp(lcname, "self") && strcmp(lcname, "parent"))) {
- efree(lcname);
+ if (!(strcmp(lcname->val, "self") && strcmp(lcname->val, "parent"))) {
+ STR_FREE(lcname);
zend_error_noreturn(E_COMPILE_ERROR, "Cannot use '%s' as class name as it is reserved", Z_STRVAL(class_name->u.constant));
}
/* Class name must not conflict with import names */
if (CG(current_import) &&
- zend_hash_find(CG(current_import), lcname, Z_STRLEN(class_name->u.constant)+1, (void**)&ns_name) == SUCCESS) {
+ (ns_name = zend_hash_find(CG(current_import), lcname)) != NULL) {
error = 1;
}
- if (CG(current_namespace)) {
+ if (Z_TYPE(CG(current_namespace)) != IS_UNDEF) {
/* Prefix class name with name of current namespace */
znode tmp;
tmp.op_type = IS_CONST;
- tmp.u.constant = *CG(current_namespace);
- zval_copy_ctor(&tmp.u.constant);
+ ZVAL_DUP(&tmp.u.constant, &CG(current_namespace));
zend_do_build_namespace_name(&tmp, &tmp, class_name TSRMLS_CC);
*class_name = tmp;
- efree(lcname);
- lcname = zend_str_tolower_dup(Z_STRVAL(class_name->u.constant), Z_STRLEN(class_name->u.constant));
+ STR_FREE(lcname);
+ STR_ALLOC(Z_STRLEN(class_name->u.constant), 0);
+ zend_str_tolower_copy(lcname->val, Z_STRVAL(class_name->u.constant), Z_STRLEN(class_name->u.constant));
}
if (error) {
- char *tmp = zend_str_tolower_dup(Z_STRVAL_PP(ns_name), Z_STRLEN_PP(ns_name));
+ char *tmp = zend_str_tolower_dup(Z_STRVAL_P(ns_name), Z_STRLEN_P(ns_name));
- if (Z_STRLEN_PP(ns_name) != Z_STRLEN(class_name->u.constant) ||
- memcmp(tmp, lcname, Z_STRLEN(class_name->u.constant))) {
+ if (Z_STRLEN_P(ns_name) != Z_STRLEN(class_name->u.constant) ||
+ memcmp(tmp, lcname->val, Z_STRLEN(class_name->u.constant))) {
zend_error_noreturn(E_COMPILE_ERROR, "Cannot declare class %s because the name is already in use", Z_STRVAL(class_name->u.constant));
}
efree(tmp);
@@ -5102,8 +5070,7 @@ void zend_do_begin_class_declaration(const znode *class_token, znode *class_name
new_class_entry = emalloc(sizeof(zend_class_entry));
new_class_entry->type = ZEND_USER_CLASS;
- new_class_entry->name = zend_new_interned_string(Z_STRVAL(class_name->u.constant), Z_STRLEN(class_name->u.constant) + 1, 1 TSRMLS_CC);
- new_class_entry->name_length = Z_STRLEN(class_name->u.constant);
+ new_class_entry->name = zend_new_interned_string(Z_STR(class_name->u.constant) TSRMLS_CC);
zend_initialize_class_data(new_class_entry, 1 TSRMLS_CC);
new_class_entry->info.user.filename = zend_get_compiled_filename(TSRMLS_C);
@@ -5129,9 +5096,8 @@ void zend_do_begin_class_declaration(const znode *class_token, znode *class_name
opline = get_next_op(CG(active_op_array) TSRMLS_CC);
opline->op1_type = IS_CONST;
- build_runtime_defined_function_key(&key, lcname, new_class_entry->name_length TSRMLS_CC);
+ build_runtime_defined_function_key(&key, lcname->val, lcname->len TSRMLS_CC);
opline->op1.constant = zend_add_literal(CG(active_op_array), &key TSRMLS_CC);
- Z_HASH_P(&CONSTANT(opline->op1.constant)) = zend_hash_func(Z_STRVAL(CONSTANT(opline->op1.constant)), Z_STRLEN(CONSTANT(opline->op1.constant)));
opline->op2_type = IS_CONST;
@@ -5147,10 +5113,9 @@ void zend_do_begin_class_declaration(const znode *class_token, znode *class_name
opline->opcode = ZEND_DECLARE_CLASS;
}
- LITERAL_STRINGL(opline->op2, lcname, new_class_entry->name_length, 0);
- CALCULATE_LITERAL_HASH(opline->op2.constant);
+ LITERAL_STR(opline->op2, lcname);
- zend_hash_quick_update(CG(class_table), Z_STRVAL(key), Z_STRLEN(key), Z_HASH_P(&CONSTANT(opline->op1.constant)), &new_class_entry, sizeof(zend_class_entry *), NULL);
+ zend_hash_update_ptr(CG(class_table), Z_STR(key), new_class_entry);
CG(active_class_entry) = new_class_entry;
opline->result.var = get_temporary_variable(CG(active_op_array));
@@ -5159,9 +5124,7 @@ void zend_do_begin_class_declaration(const znode *class_token, znode *class_name
if (CG(doc_comment)) {
CG(active_class_entry)->info.user.doc_comment = CG(doc_comment);
- CG(active_class_entry)->info.user.doc_comment_len = CG(doc_comment_len);
CG(doc_comment) = NULL;
- CG(doc_comment_len) = 0;
}
}
/* }}} */
@@ -5366,12 +5329,11 @@ ZEND_API int zend_unmangle_property_name_ex(const char *mangled_property, int le
}
/* }}} */
-void zend_do_declare_property(const znode *var_name, const znode *value, zend_uint access_type TSRMLS_DC) /* {{{ */
+void zend_do_declare_property(znode *var_name, const znode *value, zend_uint access_type TSRMLS_DC) /* {{{ */
{
- zval *property;
+ zval property;
zend_property_info *existing_property_info;
- char *comment = NULL;
- int comment_len = 0;
+ zend_string *comment = NULL;
if (CG(active_class_entry)->ce_flags & ZEND_ACC_INTERFACE) {
zend_error_noreturn(E_COMPILE_ERROR, "Interfaces may not include member variables");
@@ -5386,35 +5348,31 @@ void zend_do_declare_property(const znode *var_name, const znode *value, zend_ui
CG(active_class_entry)->name, Z_STRVAL(var_name->u.constant));
}
- if (zend_hash_find(&CG(active_class_entry)->properties_info, Z_STRVAL(var_name->u.constant), Z_STRLEN(var_name->u.constant)+1, (void **) &existing_property_info)==SUCCESS) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare %s::$%s", CG(active_class_entry)->name, Z_STRVAL(var_name->u.constant));
+ if ((existing_property_info = zend_hash_find_ptr(&CG(active_class_entry)->properties_info, Z_STR(var_name->u.constant))) != NULL) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare %s::$%s", CG(active_class_entry)->name->val, Z_STRVAL(var_name->u.constant));
}
- ALLOC_ZVAL(property);
if (value) {
- *property = value->u.constant;
+ ZVAL_COPY_VALUE(&property, &value->u.constant);
} else {
- INIT_PZVAL(property);
- Z_TYPE_P(property) = IS_NULL;
+ ZVAL_NULL(&property);
}
if (CG(doc_comment)) {
comment = CG(doc_comment);
- comment_len = CG(doc_comment_len);
CG(doc_comment) = NULL;
- CG(doc_comment_len) = 0;
}
- zend_declare_property_ex(CG(active_class_entry), zend_new_interned_string(Z_STRVAL(var_name->u.constant), Z_STRLEN(var_name->u.constant) + 1, 0 TSRMLS_CC), Z_STRLEN(var_name->u.constant), property, access_type, comment, comment_len TSRMLS_CC);
- efree(Z_STRVAL(var_name->u.constant));
+ Z_STR(var_name->u.constant) = zend_new_interned_string(Z_STR(var_name->u.constant) TSRMLS_CC);
+ zend_declare_property_ex(CG(active_class_entry), Z_STR(var_name->u.constant), &property, access_type, comment TSRMLS_CC);
+//??? efree(Z_STRVAL(var_name->u.constant));
}
/* }}} */
void zend_do_declare_class_constant(znode *var_name, const znode *value TSRMLS_DC) /* {{{ */
{
- zval *property;
- const char *cname = NULL;
- zend_ulong hash;
+ zval property;
+ zend_string *cname = NULL;
if(Z_TYPE(value->u.constant) == IS_CONSTANT_ARRAY) {
zend_error_noreturn(E_COMPILE_ERROR, "Arrays are not allowed in class constants");
@@ -5425,21 +5383,17 @@ void zend_do_declare_class_constant(znode *var_name, const znode *value TSRMLS_D
return;
}
- ALLOC_ZVAL(property);
- *property = value->u.constant;
+ ZVAL_COPY_VALUE(&property, &value->u.constant);
- cname = zend_new_interned_string(Z_STRVAL(var_name->u.constant), Z_STRLEN(var_name->u.constant)+1, 0 TSRMLS_CC);
- hash = str_hash(cname, Z_STRLEN(var_name->u.constant));
- if (zend_hash_quick_add(&CG(active_class_entry)->constants_table, cname, Z_STRLEN(var_name->u.constant)+1, hash, &property, sizeof(zval *), NULL) == FAILURE) {
- FREE_ZVAL(property);
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot redefine class constant %s::%s", CG(active_class_entry)->name, Z_STRVAL(var_name->u.constant));
+ cname = zend_new_interned_string(Z_STR(var_name->u.constant) TSRMLS_CC);
+ if (zend_hash_add(&CG(active_class_entry)->constants_table, cname, &property) == NULL) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot redefine class constant %s::%s", CG(active_class_entry)->name->val, Z_STRVAL(var_name->u.constant));
}
FREE_PNODE(var_name);
if (CG(doc_comment)) {
- efree(CG(doc_comment));
+ STR_RELEASE(CG(doc_comment));
CG(doc_comment) = NULL;
- CG(doc_comment_len) = 0;
}
}
/* }}} */
@@ -5485,7 +5439,7 @@ void zend_do_fetch_property(znode *result, znode *object, const znode *property
break;
}
if (opline_ptr->op2_type == IS_CONST && Z_TYPE(CONSTANT(opline_ptr->op2.constant)) == IS_STRING) {
- CALCULATE_LITERAL_HASH(opline_ptr->op2.constant);
+//??? CALCULATE_LITERAL_HASH(opline_ptr->op2.constant);
GET_POLYMORPHIC_CACHE_SLOT(opline_ptr->op2.constant);
}
GET_NODE(result, opline_ptr->result);
@@ -5510,7 +5464,7 @@ void zend_do_fetch_property(znode *result, znode *object, const znode *property
SET_NODE(opline.op1, object);
SET_NODE(opline.op2, property);
if (opline.op2_type == IS_CONST && Z_TYPE(CONSTANT(opline.op2.constant)) == IS_STRING) {
- CALCULATE_LITERAL_HASH(opline.op2.constant);
+//??? CALCULATE_LITERAL_HASH(opline.op2.constant);
GET_POLYMORPHIC_CACHE_SLOT(opline.op2.constant);
}
GET_NODE(result, opline.result);
@@ -5521,17 +5475,17 @@ void zend_do_fetch_property(znode *result, znode *object, const znode *property
void zend_do_halt_compiler_register(TSRMLS_D) /* {{{ */
{
- char *name, *cfilename;
+ char *name;
+ zend_string *cfilename;
char haltoff[] = "__COMPILER_HALT_OFFSET__";
- int len, clen;
+ int len;
if (CG(has_bracketed_namespaces) && CG(in_namespace)) {
zend_error_noreturn(E_COMPILE_ERROR, "__HALT_COMPILER() can only be used from the outermost scope");
}
cfilename = zend_get_compiled_filename(TSRMLS_C);
- clen = strlen(cfilename);
- zend_mangle_property_name(&name, &len, haltoff, sizeof(haltoff) - 1, cfilename, clen, 0);
+ zend_mangle_property_name(&name, &len, haltoff, sizeof(haltoff) - 1, cfilename->val, cfilename->len, 0);
zend_register_long_constant(name, len+1, zend_get_scanned_file_offset(TSRMLS_C), CONST_CS, 0 TSRMLS_CC);
pefree(name, 0);
@@ -5595,12 +5549,12 @@ void zend_do_end_new_object(znode *result, const znode *new_token, const znode *
static zend_constant* zend_get_ct_const(const zval *const_name, int all_internal_constants_substitution TSRMLS_DC) /* {{{ */
{
zend_constant *c = NULL;
+ char *lookup_name;
if (Z_STRVAL_P(const_name)[0] == '\\') {
- if (zend_hash_find(EG(zend_constants), Z_STRVAL_P(const_name)+1, Z_STRLEN_P(const_name), (void **) &c) == FAILURE) {
- char *lookup_name = zend_str_tolower_dup(Z_STRVAL_P(const_name)+1, Z_STRLEN_P(const_name)-1);
-
- if (zend_hash_find(EG(zend_constants), lookup_name, Z_STRLEN_P(const_name), (void **) &c)==SUCCESS) {
+ if ((c = zend_hash_str_find_ptr(EG(zend_constants), Z_STRVAL_P(const_name)+1, Z_STRLEN_P(const_name)-1)) == NULL) {
+ lookup_name = zend_str_tolower_dup(Z_STRVAL_P(const_name)+1, Z_STRLEN_P(const_name)-1);
+ if ((c = zend_hash_str_find_ptr(EG(zend_constants), lookup_name, Z_STRLEN_P(const_name)-1)) != NULL) {
if ((c->flags & CONST_CT_SUBST) && !(c->flags & CONST_CS)) {
efree(lookup_name);
return c;
@@ -5609,10 +5563,9 @@ static zend_constant* zend_get_ct_const(const zval *const_name, int all_internal
efree(lookup_name);
return NULL;
}
- } else if (zend_hash_find(EG(zend_constants), Z_STRVAL_P(const_name), Z_STRLEN_P(const_name)+1, (void **) &c) == FAILURE) {
- char *lookup_name = zend_str_tolower_dup(Z_STRVAL_P(const_name), Z_STRLEN_P(const_name));
-
- if (zend_hash_find(EG(zend_constants), lookup_name, Z_STRLEN_P(const_name)+1, (void **) &c)==SUCCESS) {
+ } else if ((c = zend_hash_find_ptr(EG(zend_constants), Z_STR_P(const_name))) == NULL) {
+ lookup_name = zend_str_tolower_dup(Z_STRVAL_P(const_name), Z_STRLEN_P(const_name));
+ if ((c = zend_hash_str_find_ptr(EG(zend_constants), lookup_name, Z_STRLEN_P(const_name))) != NULL) {
if ((c->flags & CONST_CT_SUBST) && !(c->flags & CONST_CS)) {
efree(lookup_name);
return c;
@@ -5643,7 +5596,7 @@ static int zend_constant_ct_subst(znode *result, zval *const_name, int all_inter
result->op_type = IS_CONST;
result->u.constant = c->value;
zval_copy_ctor(&result->u.constant);
- INIT_PZVAL(&result->u.constant);
+//??? INIT_PZVAL(&result->u.constant);
return 1;
}
return 0;
@@ -5692,7 +5645,7 @@ void zend_do_fetch_constant(znode *result, znode *constant_container, znode *con
SET_NODE(opline->op1, constant_container);
}
SET_NODE(opline->op2, constant_name);
- CALCULATE_LITERAL_HASH(opline->op2.constant);
+//??? CALCULATE_LITERAL_HASH(opline->op2.constant);
if (opline->op1_type == IS_CONST) {
GET_CACHE_SLOT(opline->op2.constant);
} else {
@@ -5745,7 +5698,7 @@ void zend_do_fetch_constant(znode *result, znode *constant_container, znode *con
opline->op2.constant = zend_add_const_name_literal(CG(active_op_array), &constant_name->u.constant, 0 TSRMLS_CC);
} else {
opline->extended_value = IS_CONSTANT_UNQUALIFIED;
- if (CG(current_namespace)) {
+ if (Z_TYPE(CG(current_namespace)) != IS_UNDEF) {
opline->extended_value |= IS_CONSTANT_IN_NAMESPACE;
opline->op2.constant = zend_add_const_name_literal(CG(active_op_array), &constant_name->u.constant, 1 TSRMLS_CC);
} else {
@@ -5781,8 +5734,8 @@ void zend_do_shell_exec(znode *result, const znode *cmd TSRMLS_DC) /* {{{ */
opline->opcode = ZEND_DO_FCALL;
opline->result.var = get_temporary_variable(CG(active_op_array));
opline->result_type = IS_VAR;
- LITERAL_STRINGL(opline->op1, estrndup("shell_exec", sizeof("shell_exec")-1), sizeof("shell_exec")-1, 0);
- CALCULATE_LITERAL_HASH(opline->op1.constant);
+ LITERAL_STR(opline->op1, STR_INIT("shell_exec", sizeof("shell_exec")-1, 0));
+//??? CALCULATE_LITERAL_HASH(opline->op1.constant);
opline->op1_type = IS_CONST;
GET_CACHE_SLOT(opline->op1.constant);
opline->extended_value = 1;
@@ -5820,7 +5773,7 @@ void zend_do_init_array(znode *result, const znode *expr, const znode *offset, z
zval_dtor(&CONSTANT(opline->op2.constant));
ZVAL_LONG(&CONSTANT(opline->op2.constant), index);
} else {
- CALCULATE_LITERAL_HASH(opline->op2.constant);
+//??? CALCULATE_LITERAL_HASH(opline->op2.constant);
}
}
} else {
@@ -5852,7 +5805,7 @@ void zend_do_add_array_element(znode *result, const znode *expr, const znode *of
zval_dtor(&CONSTANT(opline->op2.constant));
ZVAL_LONG(&CONSTANT(opline->op2.constant), index);
} else {
- CALCULATE_LITERAL_HASH(opline->op2.constant);
+//??? CALCULATE_LITERAL_HASH(opline->op2.constant);
}
}
} else {
@@ -5864,55 +5817,54 @@ void zend_do_add_array_element(znode *result, const znode *expr, const znode *of
void zend_do_add_static_array_element(znode *result, znode *offset, const znode *expr) /* {{{ */
{
- zval *element;
+ zval element;
- ALLOC_ZVAL(element);
- *element = expr->u.constant;
+ ZVAL_COPY_VALUE(&element, &expr->u.constant);
if (offset) {
switch (Z_TYPE(offset->u.constant) & IS_CONSTANT_TYPE_MASK) {
case IS_CONSTANT:
/* Ugly hack to denote that this value has a constant index */
- Z_TYPE_P(element) |= IS_CONSTANT_INDEX;
- Z_STRVAL(offset->u.constant) = erealloc(Z_STRVAL(offset->u.constant), Z_STRLEN(offset->u.constant)+3);
- Z_STRVAL(offset->u.constant)[Z_STRLEN(offset->u.constant)+1] = Z_TYPE(offset->u.constant);
- Z_STRVAL(offset->u.constant)[Z_STRLEN(offset->u.constant)+2] = 0;
- zend_symtable_update(Z_ARRVAL(result->u.constant), Z_STRVAL(offset->u.constant), Z_STRLEN(offset->u.constant)+3, &element, sizeof(zval *), NULL);
+ Z_TYPE(element) |= IS_CONSTANT_INDEX;
+//??? Z_STRVAL(offset->u.constant) = erealloc(Z_STRVAL(offset->u.constant), Z_STRLEN(offset->u.constant)+3);
+//??? Z_STRVAL(offset->u.constant)[Z_STRLEN(offset->u.constant)+1] = Z_TYPE(offset->u.constant);
+//??? Z_STRVAL(offset->u.constant)[Z_STRLEN(offset->u.constant)+2] = 0;
+//??? zend_symtable_update(Z_ARRVAL(result->u.constant), Z_STRVAL(offset->u.constant), Z_STRLEN(offset->u.constant)+3, &element, sizeof(zval *), NULL);
zval_dtor(&offset->u.constant);
break;
case IS_CONSTANT_AST: {
/* Another ugly hack to store the data about the AST in the array */
- char* key;
- int len = sizeof(zend_ast *);
- Z_TYPE_P(element) |= IS_CONSTANT_INDEX;
-
- key = emalloc(len + 2);
- *(zend_ast **)key = Z_AST(offset->u.constant);
- key[len] = Z_TYPE(offset->u.constant);
- key[len + 1] = 0;
- zend_symtable_update(Z_ARRVAL(result->u.constant), key, len + 2, &element, sizeof(zval *), NULL);
- efree(key);
+//??? char* key;
+//??? int len = sizeof(zend_ast *);
+ Z_TYPE(element) |= IS_CONSTANT_INDEX;
+
+//??? key = emalloc(len + 2);
+//??? *(zend_ast **)key = Z_AST(offset->u.constant);
+//??? key[len] = Z_TYPE(offset->u.constant);
+//??? key[len + 1] = 0;
+//??? zend_symtable_update(Z_ARRVAL(result->u.constant), key, len + 2, &element, sizeof(zval *), NULL);
+//??? efree(key);
break;
}
case IS_STRING:
- zend_symtable_update(Z_ARRVAL(result->u.constant), Z_STRVAL(offset->u.constant), Z_STRLEN(offset->u.constant)+1, &element, sizeof(zval *), NULL);
+ zend_symtable_update(Z_ARRVAL(result->u.constant), Z_STR(offset->u.constant), &element);
zval_dtor(&offset->u.constant);
break;
case IS_NULL:
- zend_symtable_update(Z_ARRVAL(result->u.constant), "", 1, &element, sizeof(zval *), NULL);
+ zend_symtable_update(Z_ARRVAL(result->u.constant), STR_EMPTY_ALLOC(), &element);
break;
case IS_LONG:
case IS_BOOL:
- zend_hash_index_update(Z_ARRVAL(result->u.constant), Z_LVAL(offset->u.constant), &element, sizeof(zval *), NULL);
+ zend_hash_index_update(Z_ARRVAL(result->u.constant), Z_LVAL(offset->u.constant), &element);
break;
case IS_DOUBLE:
- zend_hash_index_update(Z_ARRVAL(result->u.constant), zend_dval_to_lval(Z_DVAL(offset->u.constant)), &element, sizeof(zval *), NULL);
+ zend_hash_index_update(Z_ARRVAL(result->u.constant), zend_dval_to_lval(Z_DVAL(offset->u.constant)), &element);
break;
case IS_CONSTANT_ARRAY:
zend_error(E_ERROR, "Illegal offset type");
break;
}
} else {
- zend_hash_next_index_insert(Z_ARRVAL(result->u.constant), &element, sizeof(zval *), NULL);
+ zend_hash_next_index_insert(Z_ARRVAL(result->u.constant), &element);
}
}
/* }}} */
@@ -6052,17 +6004,15 @@ void zend_add_to_list(void *result, void *item TSRMLS_DC) /* {{{ */
void zend_do_fetch_static_variable(znode *varname, const znode *static_assignment, int fetch_type TSRMLS_DC) /* {{{ */
{
- zval *tmp;
+ zval tmp;
zend_op *opline;
znode lval;
znode result;
- ALLOC_ZVAL(tmp);
-
if (static_assignment) {
- *tmp = static_assignment->u.constant;
+ ZVAL_COPY_VALUE(&tmp, &static_assignment->u.constant);
} else {
- INIT_ZVAL(*tmp);
+ ZVAL_NULL(&tmp);
}
if (!CG(active_op_array)->static_variables) {
if (CG(active_op_array)->scope) {
@@ -6071,7 +6021,7 @@ void zend_do_fetch_static_variable(znode *varname, const znode *static_assignmen
ALLOC_HASHTABLE(CG(active_op_array)->static_variables);
zend_hash_init(CG(active_op_array)->static_variables, 2, NULL, ZVAL_PTR_DTOR, 0);
}
- zend_hash_update(CG(active_op_array)->static_variables, Z_STRVAL(varname->u.constant), Z_STRLEN(varname->u.constant)+1, &tmp, sizeof(zval *), NULL);
+ zend_hash_update(CG(active_op_array)->static_variables, Z_STR(varname->u.constant), &tmp);
if (varname->op_type == IS_CONST) {
if (Z_TYPE(varname->u.constant) != IS_STRING) {
@@ -6084,9 +6034,9 @@ void zend_do_fetch_static_variable(znode *varname, const znode *static_assignmen
opline->result_type = IS_VAR;
opline->result.var = get_temporary_variable(CG(active_op_array));
SET_NODE(opline->op1, varname);
- if (opline->op1_type == IS_CONST) {
- CALCULATE_LITERAL_HASH(opline->op1.constant);
- }
+//??? if (opline->op1_type == IS_CONST) {
+//??? CALCULATE_LITERAL_HASH(opline->op1.constant);
+//??? }
SET_UNUSED(opline->op2);
opline->extended_value = ZEND_FETCH_STATIC;
GET_NODE(&result, opline->result);
@@ -6122,8 +6072,8 @@ void zend_do_fetch_lexical_variable(znode *varname, zend_bool is_ref TSRMLS_DC)
value.op_type = IS_CONST;
ZVAL_NULL(&value.u.constant);
Z_TYPE(value.u.constant) |= is_ref ? IS_LEXICAL_REF : IS_LEXICAL_VAR;
- Z_SET_REFCOUNT_P(&value.u.constant, 1);
- Z_UNSET_ISREF_P(&value.u.constant);
+//??? Z_SET_REFCOUNT_P(&value.u.constant, 1);
+//??? Z_UNSET_ISREF_P(&value.u.constant);
zend_do_fetch_static_variable(varname, &value, is_ref ? ZEND_FETCH_STATIC : ZEND_FETCH_LEXICAL TSRMLS_CC);
}
@@ -6146,9 +6096,9 @@ void zend_do_fetch_global_variable(znode *varname, const znode *static_assignmen
opline->result_type = IS_VAR;
opline->result.var = get_temporary_variable(CG(active_op_array));
SET_NODE(opline->op1, varname);
- if (opline->op1_type == IS_CONST) {
- CALCULATE_LITERAL_HASH(opline->op1.constant);
- }
+//??? if (opline->op1_type == IS_CONST) {
+//??? CALCULATE_LITERAL_HASH(opline->op1.constant);
+//??? }
SET_UNUSED(opline->op2);
opline->extended_value = fetch_type;
GET_NODE(&result, opline->result);
@@ -6208,7 +6158,9 @@ void zend_do_indirect_references(znode *result, const znode *num_references, zno
fetch_simple_variable(result, variable, 1 TSRMLS_CC);
/* there is a chance someone is accessing $this */
if (CG(active_op_array)->scope && CG(active_op_array)->this_var == -1) {
- CG(active_op_array)->this_var = lookup_cv(CG(active_op_array), estrndup("this", sizeof("this")-1), sizeof("this")-1, THIS_HASHVAL TSRMLS_CC);
+ zend_string *key = STR_INIT("this", sizeof("this")-1, 0);
+ CG(active_op_array)->this_var = lookup_cv(CG(active_op_array), key TSRMLS_CC);
+ STR_RELEASE(key);
}
}
/* }}} */
@@ -6791,13 +6743,13 @@ void zend_do_ticks(TSRMLS_D) /* {{{ */
}
/* }}} */
-zend_bool zend_is_auto_global_quick(const char *name, uint name_len, ulong hash TSRMLS_DC) /* {{{ */
+zend_bool zend_is_auto_global(zend_string *name TSRMLS_DC) /* {{{ */
{
zend_auto_global *auto_global;
- if (zend_hash_quick_find(CG(auto_globals), name, name_len+1, hash, (void **) &auto_global)==SUCCESS) {
+ if ((auto_global = zend_hash_find_ptr(CG(auto_globals), name)) != NULL) {
if (auto_global->armed) {
- auto_global->armed = auto_global->auto_global_callback(auto_global->name, auto_global->name_len TSRMLS_CC);
+ auto_global->armed = auto_global->auto_global_callback(auto_global->name TSRMLS_CC);
}
return 1;
}
@@ -6805,22 +6757,15 @@ zend_bool zend_is_auto_global_quick(const char *name, uint name_len, ulong hash
}
/* }}} */
-zend_bool zend_is_auto_global(const char *name, uint name_len TSRMLS_DC) /* {{{ */
-{
- return zend_is_auto_global_quick(name, name_len, zend_hash_func(name, name_len+1) TSRMLS_CC);
-}
-/* }}} */
-
-int zend_register_auto_global(const char *name, uint name_len, zend_bool jit, zend_auto_global_callback auto_global_callback TSRMLS_DC) /* {{{ */
+int zend_register_auto_global(zend_string *name, zend_bool jit, zend_auto_global_callback auto_global_callback TSRMLS_DC) /* {{{ */
{
zend_auto_global auto_global;
- auto_global.name = zend_new_interned_string((char*)name, name_len + 1, 0 TSRMLS_CC);
- auto_global.name_len = name_len;
+ auto_global.name = zend_new_interned_string(name TSRMLS_CC);
auto_global.auto_global_callback = auto_global_callback;
auto_global.jit = jit;
- return zend_hash_add(CG(auto_globals), name, name_len+1, &auto_global, sizeof(zend_auto_global), NULL);
+ return zend_hash_add_mem(CG(auto_globals), name, &auto_global, sizeof(zend_auto_global)) != NULL ? SUCCESS : FAILURE;
}
/* }}} */
@@ -6829,7 +6774,7 @@ static int zend_auto_global_init(zend_auto_global *auto_global TSRMLS_DC) /* {{{
if (auto_global->jit) {
auto_global->armed = 1;
} else if (auto_global->auto_global_callback) {
- auto_global->armed = auto_global->auto_global_callback(auto_global->name, auto_global->name_len TSRMLS_CC);
+ auto_global->armed = auto_global->auto_global_callback(auto_global->name TSRMLS_CC);
} else {
auto_global->armed = 0;
}
@@ -6876,7 +6821,7 @@ again:
break;
}
- INIT_PZVAL(&zendlval->u.constant);
+//??? INIT_PZVAL(&zendlval->u.constant);
zendlval->op_type = IS_CONST;
return retval;
}
@@ -6913,7 +6858,6 @@ ZEND_API void zend_initialize_class_data(zend_class_entry *ce, zend_bool nullify
} else {
ce->static_members_table = ce->default_static_members_table;
ce->info.user.doc_comment = NULL;
- ce->info.user.doc_comment_len = 0;
}
ce->default_properties_count = 0;
@@ -6971,12 +6915,9 @@ int zend_get_class_fetch_type(const char *class_name, uint class_name_len) /* {{
}
/* }}} */
-ZEND_API const char* zend_get_compiled_variable_name(const zend_op_array *op_array, zend_uint var, int* name_len) /* {{{ */
+ZEND_API zend_string *zend_get_compiled_variable_name(const zend_op_array *op_array, zend_uint var) /* {{{ */
{
- if (name_len) {
- *name_len = op_array->vars[var].name_len;
- }
- return op_array->vars[var].name;
+ return op_array->vars[var];
}
/* }}} */
@@ -6987,21 +6928,21 @@ void zend_do_build_namespace_name(znode *result, znode *prefix, znode *name TSRM
if (Z_TYPE(result->u.constant) == IS_STRING &&
Z_STRLEN(result->u.constant) == 0) {
/* namespace\ */
- if (CG(current_namespace)) {
+ if (Z_TYPE(CG(current_namespace)) != IS_UNDEF) {
znode tmp;
zval_dtor(&result->u.constant);
tmp.op_type = IS_CONST;
- tmp.u.constant = *CG(current_namespace);
- zval_copy_ctor(&tmp.u.constant);
+ ZVAL_DUP(&tmp.u.constant, &CG(current_namespace));
zend_do_build_namespace_name(result, NULL, &tmp TSRMLS_CC);
}
}
} else {
result->op_type = IS_CONST;
- Z_TYPE(result->u.constant) = IS_STRING;
- Z_STRVAL(result->u.constant) = NULL;
- Z_STRLEN(result->u.constant) = 0;
+//??? Z_TYPE(result->u.constant) = IS_STRING;
+//??? Z_STRVAL(result->u.constant) = NULL;
+//??? Z_STRLEN(result->u.constant) = 0;
+ ZVAL_UNDEF(&result->u.constant);
}
/* prefix = result */
zend_do_build_full_name(NULL, result, name, 0 TSRMLS_CC);
@@ -7014,7 +6955,7 @@ void zend_do_begin_namespace(const znode *name, zend_bool with_bracket TSRMLS_DC
/* handle mixed syntax declaration or nested namespaces */
if (!CG(has_bracketed_namespaces)) {
- if (CG(current_namespace)) {
+ if (Z_TYPE(CG(current_namespace)) != IS_UNDEF) {
/* previous namespace declarations were unbracketed */
if (with_bracket) {
zend_error_noreturn(E_COMPILE_ERROR, "Cannot mix bracketed namespace declarations with unbracketed namespace declarations");
@@ -7024,12 +6965,12 @@ void zend_do_begin_namespace(const znode *name, zend_bool with_bracket TSRMLS_DC
/* previous namespace declarations were bracketed */
if (!with_bracket) {
zend_error_noreturn(E_COMPILE_ERROR, "Cannot mix bracketed namespace declarations with unbracketed namespace declarations");
- } else if (CG(current_namespace) || CG(in_namespace)) {
+ } else if (Z_TYPE(CG(current_namespace)) != IS_UNDEF || CG(in_namespace)) {
zend_error_noreturn(E_COMPILE_ERROR, "Namespace declarations cannot be nested");
}
}
- if (((!with_bracket && !CG(current_namespace)) || (with_bracket && !CG(has_bracketed_namespaces))) && CG(active_op_array)->last > 0) {
+ if (((!with_bracket && Z_TYPE(CG(current_namespace)) == IS_UNDEF) || (with_bracket && !CG(has_bracketed_namespaces))) && CG(active_op_array)->last > 0) {
/* ignore ZEND_EXT_STMT and ZEND_TICKS */
int num = CG(active_op_array)->last;
while (num > 0 &&
@@ -7057,17 +6998,14 @@ void zend_do_begin_namespace(const znode *name, zend_bool with_bracket TSRMLS_DC
}
efree(lcname);
- if (CG(current_namespace)) {
- zval_dtor(CG(current_namespace));
- } else {
- ALLOC_ZVAL(CG(current_namespace));
+ if (Z_TYPE(CG(current_namespace)) != IS_UNDEF) {
+ zval_dtor(&CG(current_namespace));
}
- *CG(current_namespace) = name->u.constant;
+ ZVAL_COPY_VALUE(&CG(current_namespace), &name->u.constant);
} else {
- if (CG(current_namespace)) {
- zval_dtor(CG(current_namespace));
- FREE_ZVAL(CG(current_namespace));
- CG(current_namespace) = NULL;
+ if (Z_TYPE(CG(current_namespace)) != IS_UNDEF) {
+ zval_dtor(&CG(current_namespace));
+ ZVAL_UNDEF(&CG(current_namespace));
}
}
@@ -7092,25 +7030,23 @@ void zend_do_begin_namespace(const znode *name, zend_bool with_bracket TSRMLS_DC
if (CG(doc_comment)) {
efree(CG(doc_comment));
CG(doc_comment) = NULL;
- CG(doc_comment_len) = 0;
}
}
/* }}} */
void zend_do_use(znode *ns_name, znode *new_name, int is_global TSRMLS_DC) /* {{{ */
{
- char *lcname;
- zval *name, *ns, tmp;
+ zend_string *lcname;
+ zval *name, ns, tmp;
zend_bool warn = 0;
- zend_class_entry **pce;
+ zend_class_entry *ce;
if (!CG(current_import)) {
CG(current_import) = emalloc(sizeof(HashTable));
zend_hash_init(CG(current_import), 0, NULL, ZVAL_PTR_DTOR, 0);
}
- MAKE_STD_ZVAL(ns);
- ZVAL_ZVAL(ns, &ns_name->u.constant, 0, 0);
+ ZVAL_ZVAL(&ns, &ns_name->u.constant, 0, 0);
if (new_name) {
name = &new_name->u.constant;
} else {
@@ -7119,55 +7055,57 @@ void zend_do_use(znode *ns_name, znode *new_name, int is_global TSRMLS_DC) /* {{
/* The form "use A\B" is eqivalent to "use A\B as B".
So we extract the last part of compound name to use as a new_name */
name = &tmp;
- p = zend_memrchr(Z_STRVAL_P(ns), '\\', Z_STRLEN_P(ns));
+ p = zend_memrchr(Z_STRVAL(ns), '\\', Z_STRLEN(ns));
if (p) {
- ZVAL_STRING(name, p+1, 1);
+//??? ZVAL_STRING(name, p+1, 1);
+ ZVAL_STRING(name, p+1);
} else {
- ZVAL_ZVAL(name, ns, 1, 0);
- warn = !is_global && !CG(current_namespace);
+ ZVAL_ZVAL(name, &ns, 1, 0);
+ warn = !is_global && Z_TYPE(CG(current_namespace)) == IS_UNDEF;
}
}
- lcname = zend_str_tolower_dup(Z_STRVAL_P(name), Z_STRLEN_P(name));
+ lcname = STR_ALLOC(Z_STRLEN_P(name), 0);
+ zend_str_tolower_copy(lcname->val, Z_STRVAL_P(name), Z_STRLEN_P(name));
if (((Z_STRLEN_P(name) == sizeof("self")-1) &&
- !memcmp(lcname, "self", sizeof("self")-1)) ||
+ !memcmp(lcname->val, "self", sizeof("self")-1)) ||
((Z_STRLEN_P(name) == sizeof("parent")-1) &&
- !memcmp(lcname, "parent", sizeof("parent")-1))) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot use %s as %s because '%s' is a special class name", Z_STRVAL_P(ns), Z_STRVAL_P(name), Z_STRVAL_P(name));
+ !memcmp(lcname->val, "parent", sizeof("parent")-1))) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot use %s as %s because '%s' is a special class name", Z_STRVAL(ns), Z_STRVAL_P(name), Z_STRVAL_P(name));
}
- if (CG(current_namespace)) {
+ if (Z_TYPE(CG(current_namespace)) != IS_UNDEF) {
/* Prefix import name with current namespace name to avoid conflicts with classes */
- char *c_ns_name = emalloc(Z_STRLEN_P(CG(current_namespace)) + 1 + Z_STRLEN_P(name) + 1);
+ zend_string *c_ns_name = STR_ALLOC(Z_STRLEN(CG(current_namespace)) + 1 + Z_STRLEN_P(name), 0);
- zend_str_tolower_copy(c_ns_name, Z_STRVAL_P(CG(current_namespace)), Z_STRLEN_P(CG(current_namespace)));
- c_ns_name[Z_STRLEN_P(CG(current_namespace))] = '\\';
- memcpy(c_ns_name+Z_STRLEN_P(CG(current_namespace))+1, lcname, Z_STRLEN_P(name)+1);
- if (zend_hash_exists(CG(class_table), c_ns_name, Z_STRLEN_P(CG(current_namespace)) + 1 + Z_STRLEN_P(name)+1)) {
- char *tmp2 = zend_str_tolower_dup(Z_STRVAL_P(ns), Z_STRLEN_P(ns));
+ zend_str_tolower_copy(c_ns_name->val, Z_STRVAL(CG(current_namespace)), Z_STRLEN(CG(current_namespace)));
+ c_ns_name->val[Z_STRLEN(CG(current_namespace))] = '\\';
+ memcpy(c_ns_name->val+Z_STRLEN(CG(current_namespace))+1, lcname, Z_STRLEN_P(name)+1);
+ if (zend_hash_exists(CG(class_table), c_ns_name)) {
+ char *tmp2 = zend_str_tolower_dup(Z_STRVAL(ns), Z_STRLEN(ns));
- if (Z_STRLEN_P(ns) != Z_STRLEN_P(CG(current_namespace)) + 1 + Z_STRLEN_P(name) ||
- memcmp(tmp2, c_ns_name, Z_STRLEN_P(ns))) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot use %s as %s because the name is already in use", Z_STRVAL_P(ns), Z_STRVAL_P(name));
+ if (Z_STRLEN(ns) != Z_STRLEN(CG(current_namespace)) + 1 + Z_STRLEN_P(name) ||
+ memcmp(tmp2, c_ns_name->val, Z_STRLEN(ns))) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot use %s as %s because the name is already in use", Z_STRVAL(ns), Z_STRVAL_P(name));
}
efree(tmp2);
}
- efree(c_ns_name);
- } else if (zend_hash_find(CG(class_table), lcname, Z_STRLEN_P(name)+1, (void**)&pce) == SUCCESS &&
- (*pce)->type == ZEND_USER_CLASS &&
- (*pce)->info.user.filename == CG(compiled_filename)) {
- char *c_tmp = zend_str_tolower_dup(Z_STRVAL_P(ns), Z_STRLEN_P(ns));
+ STR_FREE(c_ns_name);
+ } else if ((ce = zend_hash_find_ptr(CG(class_table), lcname)) != NULL &&
+ ce->type == ZEND_USER_CLASS &&
+ ce->info.user.filename == CG(compiled_filename)) {
+ char *c_tmp = zend_str_tolower_dup(Z_STRVAL(ns), Z_STRLEN(ns));
- if (Z_STRLEN_P(ns) != Z_STRLEN_P(name) ||
- memcmp(c_tmp, lcname, Z_STRLEN_P(ns))) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot use %s as %s because the name is already in use", Z_STRVAL_P(ns), Z_STRVAL_P(name));
+ if (Z_STRLEN(ns) != Z_STRLEN_P(name) ||
+ memcmp(c_tmp, lcname->val, Z_STRLEN(ns))) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot use %s as %s because the name is already in use", Z_STRVAL(ns), Z_STRVAL_P(name));
}
efree(c_tmp);
}
- if (zend_hash_add(CG(current_import), lcname, Z_STRLEN_P(name)+1, &ns, sizeof(zval*), NULL) != SUCCESS) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot use %s as %s because the name is already in use", Z_STRVAL_P(ns), Z_STRVAL_P(name));
+ if (zend_hash_add(CG(current_import), lcname, &ns) == NULL) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot use %s as %s because the name is already in use", Z_STRVAL(ns), Z_STRVAL_P(name));
}
if (warn) {
if (!strcmp(Z_STRVAL_P(name), "strict")) {
@@ -7182,12 +7120,11 @@ void zend_do_use(znode *ns_name, znode *new_name, int is_global TSRMLS_DC) /* {{
void zend_do_use_non_class(znode *ns_name, znode *new_name, int is_global, int is_function, zend_bool case_sensitive, HashTable *current_import_sub, HashTable *lookup_table TSRMLS_DC) /* {{{ */
{
- char *lookup_name;
- zval *name, *ns, tmp;
+ zend_string *lookup_name;
+ zval *name, ns, tmp;
zend_bool warn = 0;
- MAKE_STD_ZVAL(ns);
- ZVAL_ZVAL(ns, &ns_name->u.constant, 0, 0);
+ ZVAL_ZVAL(&ns, &ns_name->u.constant, 0, 0);
if (new_name) {
name = &new_name->u.constant;
} else {
@@ -7196,71 +7133,73 @@ void zend_do_use_non_class(znode *ns_name, znode *new_name, int is_global, int i
/* The form "use A\B" is eqivalent to "use A\B as B".
So we extract the last part of compound name to use as a new_name */
name = &tmp;
- p = zend_memrchr(Z_STRVAL_P(ns), '\\', Z_STRLEN_P(ns));
+ p = zend_memrchr(Z_STRVAL(ns), '\\', Z_STRLEN(ns));
if (p) {
- ZVAL_STRING(name, p+1, 1);
+//??? ZVAL_STRING(name, p+1, 1);
+ ZVAL_STRING(name, p+1);
} else {
- ZVAL_ZVAL(name, ns, 1, 0);
- warn = !is_global && !CG(current_namespace);
+ ZVAL_ZVAL(name, &ns, 1, 0);
+ warn = !is_global && Z_TYPE(CG(current_namespace)) == IS_UNDEF;
}
}
if (case_sensitive) {
- lookup_name = estrndup(Z_STRVAL_P(name), Z_STRLEN_P(name));
+ lookup_name = STR_DUP(Z_STR_P(name), 0);
} else {
- lookup_name = zend_str_tolower_dup(Z_STRVAL_P(name), Z_STRLEN_P(name));
+ lookup_name = STR_ALLOC(Z_STRLEN_P(name), 0);
+ zend_str_tolower_copy(lookup_name->val, Z_STRVAL_P(name), Z_STRLEN_P(name));
}
- if (CG(current_namespace)) {
+ if (Z_TYPE(CG(current_namespace)) != IS_UNDEF) {
/* Prefix import name with current namespace name to avoid conflicts with functions/consts */
- char *c_ns_name = emalloc(Z_STRLEN_P(CG(current_namespace)) + 1 + Z_STRLEN_P(name) + 1);
+ zend_string *c_ns_name = STR_ALLOC(Z_STRLEN(CG(current_namespace)) + 1 + Z_STRLEN_P(name), 0);
- zend_str_tolower_copy(c_ns_name, Z_STRVAL_P(CG(current_namespace)), Z_STRLEN_P(CG(current_namespace)));
- c_ns_name[Z_STRLEN_P(CG(current_namespace))] = '\\';
- memcpy(c_ns_name+Z_STRLEN_P(CG(current_namespace))+1, lookup_name, Z_STRLEN_P(name)+1);
- if (zend_hash_exists(lookup_table, c_ns_name, Z_STRLEN_P(CG(current_namespace)) + 1 + Z_STRLEN_P(name)+1)) {
- char *tmp2 = zend_str_tolower_dup(Z_STRVAL_P(ns), Z_STRLEN_P(ns));
+ zend_str_tolower_copy(c_ns_name->val, Z_STRVAL(CG(current_namespace)), Z_STRLEN(CG(current_namespace)));
+ c_ns_name->val[Z_STRLEN(CG(current_namespace))] = '\\';
+ memcpy(c_ns_name->val+Z_STRLEN(CG(current_namespace))+1, lookup_name, Z_STRLEN_P(name)+1);
+ if (zend_hash_exists(lookup_table, c_ns_name)) {
+ char *tmp2 = zend_str_tolower_dup(Z_STRVAL(ns), Z_STRLEN(ns));
- if (Z_STRLEN_P(ns) != Z_STRLEN_P(CG(current_namespace)) + 1 + Z_STRLEN_P(name) ||
- memcmp(tmp2, c_ns_name, Z_STRLEN_P(ns))) {
- zend_error(E_COMPILE_ERROR, "Cannot use %s %s as %s because the name is already in use", is_function ? "function" : "const", Z_STRVAL_P(ns), Z_STRVAL_P(name));
+ if (Z_STRLEN(ns) != Z_STRLEN(CG(current_namespace)) + 1 + Z_STRLEN_P(name) ||
+ memcmp(tmp2, c_ns_name->val, Z_STRLEN(ns))) {
+ zend_error(E_COMPILE_ERROR, "Cannot use %s %s as %s because the name is already in use", is_function ? "function" : "const", Z_STRVAL(ns), Z_STRVAL_P(name));
}
efree(tmp2);
}
- efree(c_ns_name);
+ STR_FREE(c_ns_name);
} else if (is_function) {
zend_function *function;
- if (zend_hash_find(lookup_table, lookup_name, Z_STRLEN_P(name)+1, (void **) &function) == SUCCESS && function->type == ZEND_USER_FUNCTION && strcmp(function->op_array.filename, CG(compiled_filename)) == 0) {
- char *c_tmp = zend_str_tolower_dup(Z_STRVAL_P(ns), Z_STRLEN_P(ns));
+ if ((function = zend_hash_find_ptr(lookup_table, lookup_name)) != NULL && function->type == ZEND_USER_FUNCTION && strcmp(function->op_array.filename->val, CG(compiled_filename)->val) == 0) {
+ char *c_tmp = zend_str_tolower_dup(Z_STRVAL(ns), Z_STRLEN(ns));
- if (Z_STRLEN_P(ns) != Z_STRLEN_P(name) ||
- memcmp(c_tmp, lookup_name, Z_STRLEN_P(ns))) {
- zend_error(E_COMPILE_ERROR, "Cannot use function %s as %s because the name is already in use", Z_STRVAL_P(ns), Z_STRVAL_P(name));
+ if (Z_STRLEN(ns) != Z_STRLEN_P(name) ||
+ memcmp(c_tmp, lookup_name->val, Z_STRLEN(ns))) {
+ zend_error(E_COMPILE_ERROR, "Cannot use function %s as %s because the name is already in use", Z_STRVAL(ns), Z_STRVAL_P(name));
}
efree(c_tmp);
}
} else {
- const char *filename;
+ zend_string *filename;
- if (zend_hash_find(lookup_table, lookup_name, Z_STRLEN_P(name)+1, (void **) &filename) == SUCCESS && strcmp(filename, CG(compiled_filename)) == 0) {
- char *c_tmp = zend_str_tolower_dup(Z_STRVAL_P(ns), Z_STRLEN_P(ns));
+ if ((filename = zend_hash_find_ptr(lookup_table, lookup_name)) != NULL && strcmp(filename->val, CG(compiled_filename)->val) == 0) {
+ char *c_tmp = zend_str_tolower_dup(Z_STRVAL(ns), Z_STRLEN(ns));
- if (Z_STRLEN_P(ns) != Z_STRLEN_P(name) ||
- memcmp(c_tmp, lookup_name, Z_STRLEN_P(ns))) {
- zend_error(E_COMPILE_ERROR, "Cannot use const %s as %s because the name is already in use", Z_STRVAL_P(ns), Z_STRVAL_P(name));
+ if (Z_STRLEN(ns) != Z_STRLEN_P(name) ||
+ memcmp(c_tmp, lookup_name->val, Z_STRLEN(ns))) {
+ zend_error(E_COMPILE_ERROR, "Cannot use const %s as %s because the name is already in use", Z_STRVAL(ns), Z_STRVAL_P(name));
}
efree(c_tmp);
}
}
- if (zend_hash_add(current_import_sub, lookup_name, Z_STRLEN_P(name)+1, &ns, sizeof(zval*), NULL) != SUCCESS) {
- zend_error(E_COMPILE_ERROR, "Cannot use %s %s as %s because the name is already in use", is_function ? "function" : "const", Z_STRVAL_P(ns), Z_STRVAL_P(name));
+ if (zend_hash_add(current_import_sub, lookup_name, &ns) == NULL) {
+ zend_error(E_COMPILE_ERROR, "Cannot use %s %s as %s because the name is already in use", is_function ? "function" : "const", Z_STRVAL(ns), Z_STRVAL_P(name));
}
if (warn) {
zend_error(E_WARNING, "The use %s statement with non-compound name '%s' has no effect", is_function ? "function" : "const", Z_STRVAL_P(name));
}
- efree(lookup_name);
+ STR_RELEASE(lookup_name);
zval_dtor(name);
}
/* }}} */
@@ -7290,7 +7229,7 @@ void zend_do_use_const(znode *ns_name, znode *new_name, int is_global TSRMLS_DC)
void zend_do_declare_constant(znode *name, znode *value TSRMLS_DC) /* {{{ */
{
zend_op *opline;
- zval **ns_name;
+ zval *ns_name;
if(Z_TYPE(value->u.constant) == IS_CONSTANT_ARRAY) {
zend_error_noreturn(E_COMPILE_ERROR, "Arrays are not allowed as constants");
@@ -7300,24 +7239,24 @@ void zend_do_declare_constant(znode *name, znode *value TSRMLS_DC) /* {{{ */
zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare constant '%s'", Z_STRVAL(name->u.constant));
}
- if (CG(current_namespace)) {
+ if (Z_TYPE(CG(current_namespace)) != IS_UNDEF) {
/* Prefix constant name with name of current namespace, lowercased */
znode tmp;
tmp.op_type = IS_CONST;
- tmp.u.constant = *CG(current_namespace);
- Z_STRVAL(tmp.u.constant) = zend_str_tolower_dup(Z_STRVAL(tmp.u.constant), Z_STRLEN(tmp.u.constant));
+ ZVAL_STR(&tmp.u.constant, STR_ALLOC(Z_STRLEN(CG(current_namespace)), 0));
+ zend_str_tolower_copy(Z_STRVAL(tmp.u.constant), Z_STRVAL(CG(current_namespace)), Z_STRLEN(CG(current_namespace)));
zend_do_build_namespace_name(&tmp, &tmp, name TSRMLS_CC);
*name = tmp;
}
/* Constant name must not conflict with import names */
if (CG(current_import_const) &&
- zend_hash_find(CG(current_import_const), Z_STRVAL(name->u.constant), Z_STRLEN(name->u.constant)+1, (void**)&ns_name) == SUCCESS) {
+ (ns_name = zend_hash_find(CG(current_import_const), Z_STR(name->u.constant))) != NULL) {
- char *tmp = estrndup(Z_STRVAL_PP(ns_name), Z_STRLEN_PP(ns_name));
+ char *tmp = estrndup(Z_STRVAL_P(ns_name), Z_STRLEN_P(ns_name));
- if (Z_STRLEN_PP(ns_name) != Z_STRLEN(name->u.constant) ||
+ if (Z_STRLEN_P(ns_name) != Z_STRLEN(name->u.constant) ||
memcmp(tmp, Z_STRVAL(name->u.constant), Z_STRLEN(name->u.constant))) {
zend_error(E_COMPILE_ERROR, "Cannot declare const %s because the name is already in use", Z_STRVAL(name->u.constant));
}
@@ -7330,7 +7269,7 @@ void zend_do_declare_constant(znode *name, znode *value TSRMLS_DC) /* {{{ */
SET_NODE(opline->op1, name);
SET_NODE(opline->op2, value);
- zend_hash_add(&CG(const_filenames), Z_STRVAL(name->u.constant), Z_STRLEN(name->u.constant)+1, CG(compiled_filename), strlen(CG(compiled_filename))+1, NULL);
+ zend_hash_add_ptr(&CG(const_filenames), Z_STR(name->u.constant), CG(compiled_filename));
}
/* }}} */
@@ -7345,10 +7284,9 @@ void zend_verify_namespace(TSRMLS_D) /* {{{ */
void zend_do_end_namespace(TSRMLS_D) /* {{{ */
{
CG(in_namespace) = 0;
- if (CG(current_namespace)) {
- zval_dtor(CG(current_namespace));
- FREE_ZVAL(CG(current_namespace));
- CG(current_namespace) = NULL;
+ if (Z_TYPE(CG(current_namespace)) != IS_UNDEF) {
+ zval_dtor(&CG(current_namespace));
+ ZVAL_UNDEF(&CG(current_namespace));
}
if (CG(current_import)) {
zend_hash_destroy(CG(current_import));
@@ -7378,14 +7316,14 @@ void zend_do_end_compilation(TSRMLS_D) /* {{{ */
void zend_do_constant_expression(znode *result, zend_ast *ast TSRMLS_DC) /* {{{ */
{
if (ast->kind == ZEND_CONST) {
- result->u.constant = *ast->u.val;
+ ZVAL_COPY_VALUE(&result->u.constant, &ast->u.val);
+//???
efree(ast);
} else if (zend_ast_is_ct_constant(ast)) {
zend_ast_evaluate(&result->u.constant, ast, NULL TSRMLS_CC);
zend_ast_destroy(ast);
} else {
- Z_TYPE(result->u.constant) = IS_CONSTANT_AST;
- Z_AST(result->u.constant) = ast;
+ ZVAL_NEW_AST(&result->u.constant, ast);
}
}
/* }}} */
diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h
index f884df1946..98be2b45ef 100644
--- a/Zend/zend_compile.h
+++ b/Zend/zend_compile.h
@@ -45,10 +45,9 @@
#define RESET_DOC_COMMENT() \
{ \
if (CG(doc_comment)) { \
- efree(CG(doc_comment)); \
+ STR_RELEASE(CG(doc_comment)); \
CG(doc_comment) = NULL; \
} \
- CG(doc_comment_len) = 0; \
}
typedef struct _zend_op_array zend_op_array;
@@ -68,13 +67,9 @@ typedef struct _zend_compiler_context {
typedef struct _zend_literal {
zval constant;
- zend_ulong hash_value;
zend_uint cache_slot;
} zend_literal;
-#define Z_HASH_P(zv) \
- (((zend_literal*)(zv))->hash_value)
-
typedef union _znode_op {
zend_uint constant;
zend_uint var;
@@ -222,12 +217,10 @@ char *zend_visibility_string(zend_uint fn_flags);
typedef struct _zend_property_info {
zend_uint flags;
- const char *name;
- int name_length;
+ zend_string *name;
ulong h;
int offset;
- const char *doc_comment;
- int doc_comment_len;
+ zend_string *doc_comment;
zend_class_entry *ce;
} zend_property_info;
@@ -237,6 +230,8 @@ typedef struct _zend_arg_info {
zend_uint name_len;
const char *class_name;
zend_uint class_name_len;
+//??? zend_string *name;
+//??? zend_string *class_name;
zend_uchar type_hint;
zend_uchar pass_by_reference;
zend_bool allow_null;
@@ -258,19 +253,13 @@ typedef struct _zend_internal_function_info {
zend_bool _is_variadic;
} zend_internal_function_info;
-typedef struct _zend_compiled_variable {
- const char *name;
- int name_len;
- ulong hash_value;
-} zend_compiled_variable;
-
struct _zend_op_array {
/* Common elements */
zend_uchar type;
- const char *function_name;
+ zend_string *function_name;
zend_class_entry *scope;
zend_uint fn_flags;
- union _zend_function *prototype;
+ zend_function *prototype;
zend_uint num_args;
zend_uint required_num_args;
zend_arg_info *arg_info;
@@ -281,7 +270,7 @@ struct _zend_op_array {
zend_op *opcodes;
zend_uint last;
- zend_compiled_variable *vars;
+ zend_string **vars;
int last_var;
zend_uint T;
@@ -301,11 +290,10 @@ struct _zend_op_array {
zend_uint this_var;
- const char *filename;
+ zend_string *filename;
zend_uint line_start;
zend_uint line_end;
- const char *doc_comment;
- zend_uint doc_comment_len;
+ zend_string *doc_comment;
zend_uint early_binding; /* the linked list of delayed declarations */
zend_literal *literals;
@@ -324,10 +312,10 @@ struct _zend_op_array {
typedef struct _zend_internal_function {
/* Common elements */
zend_uchar type;
- const char * function_name;
+ zend_string* function_name;
zend_class_entry *scope;
zend_uint fn_flags;
- union _zend_function *prototype;
+ zend_function *prototype;
zend_uint num_args;
zend_uint required_num_args;
zend_arg_info *arg_info;
@@ -337,14 +325,14 @@ typedef struct _zend_internal_function {
struct _zend_module_entry *module;
} zend_internal_function;
-#define ZEND_FN_SCOPE_NAME(function) ((function) && (function)->common.scope ? (function)->common.scope->name : "")
+#define ZEND_FN_SCOPE_NAME(function) ((function) && (function)->common.scope ? (function)->common.scope->name->val : "")
-typedef union _zend_function {
+union _zend_function {
zend_uchar type; /* MUST be the first element of this struct! */
struct {
zend_uchar type; /* never used */
- const char *function_name;
+ zend_string *function_name;
zend_class_entry *scope;
zend_uint fn_flags;
union _zend_function *prototype;
@@ -355,12 +343,12 @@ typedef union _zend_function {
zend_op_array op_array;
zend_internal_function internal_function;
-} zend_function;
+};
typedef struct _zend_function_state {
zend_function *function;
- void **arguments;
+ zval *arguments;
} zend_function_state;
@@ -377,12 +365,10 @@ typedef struct _list_llist_element {
znode value;
} list_llist_element;
-union _temp_variable;
-
typedef struct _call_slot {
zend_function *fbc;
- zval *object;
zend_class_entry *called_scope;
+ zval object;
zend_uint num_additional_args;
zend_bool is_ctor_call;
zend_bool is_ctor_result_used;
@@ -392,28 +378,28 @@ struct _zend_execute_data {
struct _zend_op *opline;
zend_function_state function_state;
zend_op_array *op_array;
- zval *object;
+ zval object;
HashTable *symbol_table;
struct _zend_execute_data *prev_execute_data;
- zval *old_error_reporting;
+ zval old_error_reporting;
zend_bool nested;
- zval **original_return_value;
- zend_class_entry *current_scope;
- zend_class_entry *current_called_scope;
- zval *current_this;
+//??? zval **original_return_value;
+//??? zend_class_entry *current_scope;
+//??? zend_class_entry *current_called_scope;
+//??? zval *current_this;
struct _zend_op *fast_ret; /* used by FAST_CALL/FAST_RET (finally keyword) */
- zval *delayed_exception;
+ zend_object *delayed_exception;
call_slot *call_slots;
call_slot *call;
};
#define EX(element) execute_data.element
-#define EX_TMP_VAR(ex, n) ((temp_variable*)(((char*)(ex)) + ((int)(n))))
-#define EX_TMP_VAR_NUM(ex, n) (EX_TMP_VAR(ex, 0) - (1 + (n)))
-
-#define EX_CV_NUM(ex, n) (((zval***)(((char*)(ex))+ZEND_MM_ALIGNED_SIZE(sizeof(zend_execute_data))))+(n))
+#define EX_VAR_2(ex, n) ((zval*)(((char*)(ex)) + ((int)(n))))
+#define EX_VAR_NUM_2(ex, n) (EX_VAR_2(ex, 0) - (1 + (n)))
+#define EX_VAR(n) EX_VAR_2(execute_data, n)
+#define EX_VAR_NUM(n) EX_VAR_NUM_2(execute_data, n)
#define IS_CONST (1<<0)
#define IS_TMP_VAR (1<<1)
@@ -439,9 +425,9 @@ ZEND_API int lex_scan(zval *zendlval TSRMLS_DC);
void startup_scanner(TSRMLS_D);
void shutdown_scanner(TSRMLS_D);
-ZEND_API char *zend_set_compiled_filename(const char *new_compiled_filename TSRMLS_DC);
-ZEND_API void zend_restore_compiled_filename(char *original_compiled_filename TSRMLS_DC);
-ZEND_API char *zend_get_compiled_filename(TSRMLS_D);
+ZEND_API zend_string *zend_set_compiled_filename(zend_string *new_compiled_filename TSRMLS_DC);
+ZEND_API void zend_restore_compiled_filename(zend_string *original_compiled_filename TSRMLS_DC);
+ZEND_API zend_string *zend_get_compiled_filename(TSRMLS_D);
ZEND_API int zend_get_compiled_lineno(TSRMLS_D);
ZEND_API size_t zend_get_scanned_file_offset(TSRMLS_D);
@@ -449,7 +435,7 @@ void zend_resolve_non_class_name(znode *element_name, zend_bool *check_namespace
void zend_resolve_function_name(znode *element_name, zend_bool *check_namespace TSRMLS_DC);
void zend_resolve_const_name(znode *element_name, zend_bool *check_namespace TSRMLS_DC);
void zend_resolve_class_name(znode *class_name TSRMLS_DC);
-ZEND_API const char* zend_get_compiled_variable_name(const zend_op_array *op_array, zend_uint var, int* name_len);
+ZEND_API zend_string *zend_get_compiled_variable_name(const zend_op_array *op_array, zend_uint var);
#ifdef ZTS
const char *zend_get_zendtext(TSRMLS_D);
@@ -573,7 +559,7 @@ void zend_do_default_before_statement(const znode *case_list, znode *default_tok
void zend_do_begin_class_declaration(const znode *class_token, znode *class_name, const znode *parent_class_name TSRMLS_DC);
void zend_do_end_class_declaration(const znode *class_token, const znode *parent_token TSRMLS_DC);
-void zend_do_declare_property(const znode *var_name, const znode *value, zend_uint access_type TSRMLS_DC);
+void zend_do_declare_property(znode *var_name, const znode *value, zend_uint access_type TSRMLS_DC);
void zend_do_declare_class_constant(znode *var_name, const znode *value TSRMLS_DC);
void zend_do_fetch_property(znode *result, znode *object, const znode *property TSRMLS_DC);
@@ -670,7 +656,7 @@ ZEND_API void function_add_ref(zend_function *function);
ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type TSRMLS_DC);
ZEND_API zend_op_array *compile_string(zval *source_string, char *filename TSRMLS_DC);
ZEND_API zend_op_array *compile_filename(int type, zval *filename TSRMLS_DC);
-ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval **retval, int file_count, ...);
+ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval *retval, int file_count, ...);
ZEND_API int open_file_for_scanning(zend_file_handle *file_handle TSRMLS_DC);
ZEND_API void init_op_array(zend_op_array *op_array, zend_uchar type, int initial_ops_size TSRMLS_DC);
ZEND_API void destroy_op_array(zend_op_array *op_array TSRMLS_DC);
@@ -692,8 +678,8 @@ ZEND_API void zend_mangle_property_name(char **dest, int *dest_length, const cha
zend_unmangle_property_name_ex(mangled_property, mangled_property_len, class_name, prop_name, NULL)
ZEND_API int zend_unmangle_property_name_ex(const char *mangled_property, int mangled_property_len, const char **class_name, const char **prop_name, int *prop_len);
-#define ZEND_FUNCTION_DTOR (void (*)(void *)) zend_function_dtor
-#define ZEND_CLASS_DTOR (void (*)(void *)) destroy_zend_class
+#define ZEND_FUNCTION_DTOR (void (*)(zval *)) zend_function_dtor
+#define ZEND_CLASS_DTOR (void (*)(zval *)) destroy_zend_class
zend_op *get_next_op(zend_op_array *op_array TSRMLS_DC);
void init_op(zend_op *op TSRMLS_DC);
@@ -710,19 +696,19 @@ ZEND_API char *zend_make_compiled_string_description(const char *name TSRMLS_DC)
ZEND_API void zend_initialize_class_data(zend_class_entry *ce, zend_bool nullify_handlers TSRMLS_DC);
int zend_get_class_fetch_type(const char *class_name, uint class_name_len);
-typedef zend_bool (*zend_auto_global_callback)(const char *name, uint name_len TSRMLS_DC);
+typedef zend_bool (*zend_auto_global_callback)(zend_string *name TSRMLS_DC);
typedef struct _zend_auto_global {
- const char *name;
- uint name_len;
+//??? const char *name;
+//??? uint name_len;
+ zend_string *name;
zend_auto_global_callback auto_global_callback;
zend_bool jit;
zend_bool armed;
} zend_auto_global;
-ZEND_API int zend_register_auto_global(const char *name, uint name_len, zend_bool jit, zend_auto_global_callback auto_global_callback TSRMLS_DC);
+ZEND_API int zend_register_auto_global(zend_string *name, zend_bool jit, zend_auto_global_callback auto_global_callback TSRMLS_DC);
ZEND_API void zend_activate_auto_globals(TSRMLS_D);
-ZEND_API zend_bool zend_is_auto_global(const char *name, uint name_len TSRMLS_DC);
-ZEND_API zend_bool zend_is_auto_global_quick(const char *name, uint name_len, ulong hashval TSRMLS_DC);
+ZEND_API zend_bool zend_is_auto_global(zend_string *name TSRMLS_DC);
ZEND_API size_t zend_dirname(char *path, size_t len);
int zendlex(znode *zendlval TSRMLS_DC);
diff --git a/Zend/zend_constants.c b/Zend/zend_constants.c
index 03762b50d7..a68f3f09a9 100644
--- a/Zend/zend_constants.c
+++ b/Zend/zend_constants.c
@@ -32,13 +32,17 @@ void free_zend_constant(zend_constant *c)
if (!(c->flags & CONST_PERSISTENT)) {
zval_dtor(&c->value);
}
- str_free(c->name);
+ STR_RELEASE(c->name);
}
-void copy_zend_constant(zend_constant *c)
+static void copy_zend_constant(zval *zv)
{
- c->name = str_strndup(c->name, c->name_len - 1);
+ zend_constant *c = Z_PTR_P(zv);
+
+ Z_PTR_P(zv) = pemalloc(sizeof(zend_constant), c->flags & CONST_PERSISTENT);
+ memcpy(Z_PTR_P(zv), c, sizeof(zend_constant));
+ c->name = STR_DUP(c->name, c->flags & CONST_PERSISTENT);
if (!(c->flags & CONST_PERSISTENT)) {
zval_copy_ctor(&c->value);
}
@@ -47,9 +51,7 @@ void copy_zend_constant(zend_constant *c)
void zend_copy_constants(HashTable *target, HashTable *source)
{
- zend_constant tmp_constant;
-
- zend_hash_copy(target, source, (copy_ctor_func_t) copy_zend_constant, &tmp_constant, sizeof(zend_constant));
+ zend_hash_copy(target, source, copy_zend_constant);
}
@@ -149,8 +151,8 @@ ZEND_API void zend_register_null_constant(const char *name, uint name_len, int f
ZVAL_NULL(&c.value);
c.flags = flags;
- c.name = zend_strndup(name, name_len-1);
- c.name_len = name_len;
+ // TODO: remove -1 ???
+ c.name = STR_INIT(name, name_len-1, flags & CONST_PERSISTENT);
c.module_number = module_number;
zend_register_constant(&c TSRMLS_CC);
}
@@ -161,8 +163,8 @@ ZEND_API void zend_register_bool_constant(const char *name, uint name_len, zend_
ZVAL_BOOL(&c.value, bval);
c.flags = flags;
- c.name = zend_strndup(name, name_len-1);
- c.name_len = name_len;
+ // TODO: remove -1 ???
+ c.name = STR_INIT(name, name_len-1, flags & CONST_PERSISTENT);
c.module_number = module_number;
zend_register_constant(&c TSRMLS_CC);
}
@@ -173,8 +175,8 @@ ZEND_API void zend_register_long_constant(const char *name, uint name_len, long
ZVAL_LONG(&c.value, lval);
c.flags = flags;
- c.name = zend_strndup(name, name_len-1);
- c.name_len = name_len;
+ // TODO: remove -1 ???
+ c.name = STR_INIT(name, name_len-1, flags & CONST_PERSISTENT);
c.module_number = module_number;
zend_register_constant(&c TSRMLS_CC);
}
@@ -186,8 +188,8 @@ ZEND_API void zend_register_double_constant(const char *name, uint name_len, dou
ZVAL_DOUBLE(&c.value, dval);
c.flags = flags;
- c.name = zend_strndup(name, name_len-1);
- c.name_len = name_len;
+ // TODO: remove -1 ???
+ c.name = STR_INIT(name, name_len-1, flags & CONST_PERSISTENT);
c.module_number = module_number;
zend_register_constant(&c TSRMLS_CC);
}
@@ -197,10 +199,11 @@ ZEND_API void zend_register_stringl_constant(const char *name, uint name_len, ch
{
zend_constant c;
- ZVAL_STRINGL(&c.value, strval, strlen, 0);
+//??? ZVAL_STRINGL(&c.value, strval, strlen, 0);
+ ZVAL_STRINGL(&c.value, strval, strlen);
c.flags = flags;
- c.name = zend_strndup(name, name_len-1);
- c.name_len = name_len;
+ // TODO: remove -1 ???
+ c.name = STR_INIT(name, name_len-1, flags & CONST_PERSISTENT);
c.module_number = module_number;
zend_register_constant(&c TSRMLS_CC);
}
@@ -211,45 +214,43 @@ ZEND_API void zend_register_string_constant(const char *name, uint name_len, cha
zend_register_stringl_constant(name, name_len, strval, strlen(strval), flags, module_number TSRMLS_CC);
}
-static int zend_get_special_constant(const char *name, uint name_len, zend_constant **c TSRMLS_DC)
+static zend_constant *zend_get_special_constant(const char *name, uint name_len TSRMLS_DC)
{
- int ret;
+ zend_constant *c;
static char haltoff[] = "__COMPILER_HALT_OFFSET__";
if (!EG(in_execution)) {
- return 0;
+ return NULL;
} else if (name_len == sizeof("__CLASS__")-1 &&
!memcmp(name, "__CLASS__", sizeof("__CLASS__")-1)) {
- zend_constant tmp;
/* Returned constants may be cached, so they have to be stored */
if (EG(scope) && EG(scope)->name) {
int const_name_len;
- char *const_name;
- ALLOCA_FLAG(use_heap)
+ zend_string *const_name;
- const_name_len = sizeof("\0__CLASS__") + EG(scope)->name_length;
- const_name = do_alloca(const_name_len, use_heap);
- memcpy(const_name, "\0__CLASS__", sizeof("\0__CLASS__")-1);
- zend_str_tolower_copy(const_name + sizeof("\0__CLASS__")-1, EG(scope)->name, EG(scope)->name_length);
- if (zend_hash_find(EG(zend_constants), const_name, const_name_len, (void**)c) == FAILURE) {
- zend_hash_add(EG(zend_constants), const_name, const_name_len, (void*)&tmp, sizeof(zend_constant), (void**)c);
- memset(*c, 0, sizeof(zend_constant));
- Z_STRVAL((**c).value) = estrndup(EG(scope)->name, EG(scope)->name_length);
- Z_STRLEN((**c).value) = EG(scope)->name_length;
- Z_TYPE((**c).value) = IS_STRING;
+ const_name_len = sizeof("\0__CLASS__") + EG(scope)->name->len;
+ const_name = STR_ALLOC(const_name_len, 0);
+ memcpy(const_name->val, "\0__CLASS__", sizeof("\0__CLASS__")-1);
+ zend_str_tolower_copy(const_name->val + sizeof("\0__CLASS__")-1, EG(scope)->name->val, EG(scope)->name->len);
+ if ((c = zend_hash_find_ptr(EG(zend_constants), const_name)) == NULL) {
+ c = emalloc(sizeof(zend_constant));
+ memset(c, 0, sizeof(zend_constant));
+ ZVAL_STR(&c->value, STR_COPY(EG(scope)->name));
+ zend_hash_add_ptr(EG(zend_constants), const_name, c);
}
- free_alloca(const_name, use_heap);
+ STR_RELEASE(const_name);
} else {
- if (zend_hash_find(EG(zend_constants), "\0__CLASS__", sizeof("\0__CLASS__"), (void**)c) == FAILURE) {
- zend_hash_add(EG(zend_constants), "\0__CLASS__", sizeof("\0__CLASS__"), (void*)&tmp, sizeof(zend_constant), (void**)c);
- memset(*c, 0, sizeof(zend_constant));
- Z_STRVAL((**c).value) = estrndup("", 0);
- Z_STRLEN((**c).value) = 0;
- Z_TYPE((**c).value) = IS_STRING;
+ zend_string *const_name = STR_INIT("\0__CLASS__", sizeof("\0__CLASS__")-1, 0);
+ if ((c = zend_hash_find_ptr(EG(zend_constants), const_name)) == NULL) {
+ c = emalloc(sizeof(zend_constant));
+ memset(c, 0, sizeof(zend_constant));
+ ZVAL_EMPTY_STRING(&c->value);
+ zend_hash_add_ptr(EG(zend_constants), const_name, c);
}
+ STR_RELEASE(const_name);
}
- return 1;
+ return c;
} else if (name_len == sizeof("__COMPILER_HALT_OFFSET__")-1 &&
!memcmp(name, "__COMPILER_HALT_OFFSET__", sizeof("__COMPILER_HALT_OFFSET__")-1)) {
const char *cfilename;
@@ -261,11 +262,11 @@ static int zend_get_special_constant(const char *name, uint name_len, zend_const
/* check for __COMPILER_HALT_OFFSET__ */
zend_mangle_property_name(&haltname, &len, haltoff,
sizeof("__COMPILER_HALT_OFFSET__") - 1, cfilename, clen, 0);
- ret = zend_hash_find(EG(zend_constants), haltname, len+1, (void **) c);
+ c = zend_hash_str_find_ptr(EG(zend_constants), haltname, len);
efree(haltname);
- return (ret == SUCCESS);
+ return c;
} else {
- return 0;
+ return NULL;
}
}
@@ -274,26 +275,21 @@ ZEND_API int zend_get_constant(const char *name, uint name_len, zval *result TSR
{
zend_constant *c;
int retval = 1;
- char *lookup_name;
- if (zend_hash_find(EG(zend_constants), name, name_len+1, (void **) &c) == FAILURE) {
- lookup_name = zend_str_tolower_dup(name, name_len);
-
- if (zend_hash_find(EG(zend_constants), lookup_name, name_len+1, (void **) &c)==SUCCESS) {
+ if ((c = zend_hash_str_find_ptr(EG(zend_constants), name, name_len)) == NULL) {
+ char *lcname = zend_str_tolower_dup(name, name_len);
+ if ((c = zend_hash_str_find_ptr(EG(zend_constants), lcname, name_len)) != NULL) {
if (c->flags & CONST_CS) {
retval=0;
}
} else {
- retval = zend_get_special_constant(name, name_len, &c TSRMLS_CC);
+ c = zend_get_special_constant(name, name_len TSRMLS_CC);
}
- efree(lookup_name);
+ efree(lcname);
}
if (retval) {
- *result = c->value;
- zval_copy_ctor(result);
- Z_SET_REFCOUNT_P(result, 1);
- Z_UNSET_ISREF_P(result);
+ ZVAL_DUP(result, &c->value);
}
return retval;
@@ -305,8 +301,8 @@ ZEND_API int zend_get_constant_ex(const char *name, uint name_len, zval *result,
int retval = 1;
const char *colon;
zend_class_entry *ce = NULL;
- char *class_name;
- zval **ret_constant;
+ zend_string *class_name;
+ zval *ret_constant;
/* Skip leading \\ */
if (name[0] == '\\') {
@@ -319,11 +315,12 @@ ZEND_API int zend_get_constant_ex(const char *name, uint name_len, zval *result,
colon > name && (*(colon - 1) == ':')) {
int class_name_len = colon - name - 1;
int const_name_len = name_len - class_name_len - 2;
- const char *constant_name = colon + 1;
- char *lcname;
+ zend_string *constant_name = STR_INIT(colon + 1, const_name_len, 0);
+ zend_string *lcname;
- class_name = estrndup(name, class_name_len);
- lcname = zend_str_tolower_dup(class_name, class_name_len);
+ class_name = STR_INIT(name, class_name_len, 0);
+ lcname = STR_ALLOC(class_name_len, 0);
+ zend_str_tolower_copy(lcname->val, name, class_name_len);
if (!scope) {
if (EG(in_execution)) {
scope = EG(scope);
@@ -333,16 +330,16 @@ ZEND_API int zend_get_constant_ex(const char *name, uint name_len, zval *result,
}
if (class_name_len == sizeof("self")-1 &&
- !memcmp(lcname, "self", sizeof("self")-1)) {
+ !memcmp(lcname->val, "self", sizeof("self")-1)) {
if (scope) {
ce = scope;
} else {
zend_error(E_ERROR, "Cannot access self:: when no class scope is active");
retval = 0;
}
- efree(lcname);
+ STR_FREE(lcname);
} else if (class_name_len == sizeof("parent")-1 &&
- !memcmp(lcname, "parent", sizeof("parent")-1)) {
+ !memcmp(lcname->val, "parent", sizeof("parent")-1)) {
if (!scope) {
zend_error(E_ERROR, "Cannot access parent:: when no class scope is active");
} else if (!scope->parent) {
@@ -350,30 +347,31 @@ ZEND_API int zend_get_constant_ex(const char *name, uint name_len, zval *result,
} else {
ce = scope->parent;
}
- efree(lcname);
+ STR_FREE(lcname);
} else if (class_name_len == sizeof("static")-1 &&
- !memcmp(lcname, "static", sizeof("static")-1)) {
+ !memcmp(lcname->val, "static", sizeof("static")-1)) {
if (EG(called_scope)) {
ce = EG(called_scope);
} else {
zend_error(E_ERROR, "Cannot access static:: when no class scope is active");
}
- efree(lcname);
+ STR_FREE(lcname);
} else {
- efree(lcname);
- ce = zend_fetch_class(class_name, class_name_len, flags TSRMLS_CC);
+ STR_FREE(lcname);
+ ce = zend_fetch_class(class_name, flags TSRMLS_CC);
}
if (retval && ce) {
- if (zend_hash_find(&ce->constants_table, constant_name, const_name_len+1, (void **) &ret_constant) != SUCCESS) {
+ if ((ret_constant = zend_hash_find(&ce->constants_table, constant_name)) == NULL) {
retval = 0;
if ((flags & ZEND_FETCH_CLASS_SILENT) == 0) {
- zend_error(E_ERROR, "Undefined class constant '%s::%s'", class_name, constant_name);
+ zend_error(E_ERROR, "Undefined class constant '%s::%s'", class_name->val, constant_name->val);
}
}
} else if (!ce) {
retval = 0;
}
- efree(class_name);
+ STR_FREE(class_name);
+ STR_FREE(constant_name);
goto finish;
}
@@ -383,35 +381,33 @@ ZEND_API int zend_get_constant_ex(const char *name, uint name_len, zval *result,
int prefix_len = colon - name;
int const_name_len = name_len - prefix_len - 1;
const char *constant_name = colon + 1;
- char *lcname;
+ zend_string *lcname;
int found_const = 0;
- lcname = zend_str_tolower_dup(name, prefix_len);
+ lcname = STR_ALLOC(prefix_len + 1 + const_name_len, 0);
+ zend_str_tolower_copy(lcname->val, name, prefix_len);
/* Check for namespace constant */
- /* Concatenate lowercase namespace name and constant name */
- lcname = erealloc(lcname, prefix_len + 1 + const_name_len + 1);
- lcname[prefix_len] = '\\';
- memcpy(lcname + prefix_len + 1, constant_name, const_name_len + 1);
+ lcname->val[prefix_len] = '\\';
+ memcpy(lcname->val + prefix_len + 1, constant_name, const_name_len + 1);
- if (zend_hash_find(EG(zend_constants), lcname, prefix_len + 1 + const_name_len + 1, (void **) &c) == SUCCESS) {
+ if ((c = zend_hash_find_ptr(EG(zend_constants), lcname)) != NULL) {
found_const = 1;
} else {
/* try lowercase */
- zend_str_tolower(lcname + prefix_len + 1, const_name_len);
- if (zend_hash_find(EG(zend_constants), lcname, prefix_len + 1 + const_name_len + 1, (void **) &c) == SUCCESS) {
+ zend_str_tolower(lcname->val + prefix_len + 1, const_name_len);
+ lcname->h = 0; // reuse ???
+ if ((c = zend_hash_find_ptr(EG(zend_constants), lcname)) != NULL) {
if ((c->flags & CONST_CS) == 0) {
found_const = 1;
}
}
}
- efree(lcname);
- if(found_const) {
- *result = c->value;
- zval_update_constant_ex(&result, (void*)1, NULL TSRMLS_CC);
+ STR_FREE(lcname);
+ if (found_const) {
+ ZVAL_COPY_VALUE(result, &c->value);
+ zval_update_constant_ex(result, (void*)1, NULL TSRMLS_CC);
zval_copy_ctor(result);
- Z_SET_REFCOUNT_P(result, 1);
- Z_UNSET_ISREF_P(result);
return 1;
}
/* name requires runtime resolution, need to check non-namespaced name */
@@ -424,9 +420,7 @@ ZEND_API int zend_get_constant_ex(const char *name, uint name_len, zval *result,
finish:
if (retval) {
zval_update_constant_ex(ret_constant, (void*)1, ce TSRMLS_CC);
- *result = **ret_constant;
- zval_copy_ctor(result);
- INIT_PZVAL(result);
+ ZVAL_DUP(result, ret_constant);
}
return retval;
@@ -439,28 +433,24 @@ zend_constant *zend_quick_get_constant(const zend_literal *key, ulong flags TSRM
{
zend_constant *c;
- if (zend_hash_quick_find(EG(zend_constants), Z_STRVAL(key->constant), Z_STRLEN(key->constant) + 1, key->hash_value, (void **) &c) == FAILURE) {
+ if ((c = zend_hash_find_ptr(EG(zend_constants), Z_STR(key->constant))) == NULL) {
key++;
- if (zend_hash_quick_find(EG(zend_constants), Z_STRVAL(key->constant), Z_STRLEN(key->constant) + 1, key->hash_value, (void **) &c) == FAILURE ||
+ if ((c = zend_hash_find_ptr(EG(zend_constants), Z_STR(key->constant))) == NULL ||
(c->flags & CONST_CS) != 0) {
if ((flags & (IS_CONSTANT_IN_NAMESPACE|IS_CONSTANT_UNQUALIFIED)) == (IS_CONSTANT_IN_NAMESPACE|IS_CONSTANT_UNQUALIFIED)) {
key++;
- if (zend_hash_quick_find(EG(zend_constants), Z_STRVAL(key->constant), Z_STRLEN(key->constant) + 1, key->hash_value, (void **) &c) == FAILURE) {
+ if ((c = zend_hash_find_ptr(EG(zend_constants), Z_STR(key->constant))) == NULL) {
key++;
- if (zend_hash_quick_find(EG(zend_constants), Z_STRVAL(key->constant), Z_STRLEN(key->constant) + 1, key->hash_value, (void **) &c) == FAILURE ||
+ if ((c = zend_hash_find_ptr(EG(zend_constants), Z_STR(key->constant))) == NULL ||
(c->flags & CONST_CS) != 0) {
key--;
- if (!zend_get_special_constant(Z_STRVAL(key->constant), Z_STRLEN(key->constant), &c TSRMLS_CC)) {
- return NULL;
- }
+ c = zend_get_special_constant(Z_STRVAL(key->constant), Z_STRLEN(key->constant) TSRMLS_CC);
}
}
} else {
key--;
- if (!zend_get_special_constant(Z_STRVAL(key->constant), Z_STRLEN(key->constant), &c TSRMLS_CC)) {
- return NULL;
- }
+ c = zend_get_special_constant(Z_STRVAL(key->constant), Z_STRLEN(key->constant) TSRMLS_CC);
}
}
}
@@ -469,53 +459,51 @@ zend_constant *zend_quick_get_constant(const zend_literal *key, ulong flags TSRM
ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC)
{
- char *lowercase_name = NULL;
- char *name;
+ zend_string *lowercase_name = NULL;
+ zend_string *name;
int ret = SUCCESS;
- ulong chash;
#if 0
printf("Registering constant for module %d\n", c->module_number);
#endif
if (!(c->flags & CONST_CS)) {
- /* keep in mind that c->name_len already contains the '\0' */
- lowercase_name = estrndup(c->name, c->name_len-1);
- zend_str_tolower(lowercase_name, c->name_len-1);
- lowercase_name = (char*)zend_new_interned_string(lowercase_name, c->name_len, 1 TSRMLS_CC);
+//??? /* keep in mind that c->name_len already contains the '\0' */
+ lowercase_name = STR_ALLOC(c->name->len, 0);
+ zend_str_tolower_copy(lowercase_name->val, c->name->val, c->name->len);
+ lowercase_name = zend_new_interned_string(lowercase_name TSRMLS_CC);
name = lowercase_name;
} else {
- char *slash = strrchr(c->name, '\\');
+ char *slash = strrchr(c->name->val, '\\');
if (slash) {
- lowercase_name = estrndup(c->name, c->name_len-1);
- zend_str_tolower(lowercase_name, slash-c->name);
- lowercase_name = (char*)zend_new_interned_string(lowercase_name, c->name_len, 1 TSRMLS_CC);
+ lowercase_name = STR_ALLOC(c->name->len, 0);
+ zend_str_tolower_copy(lowercase_name->val, c->name->val, c->name->len);
+ lowercase_name = zend_new_interned_string(lowercase_name TSRMLS_CC);
name = lowercase_name;
} else {
name = c->name;
}
}
- chash = str_hash(name, c->name_len-1);
/* Check if the user is trying to define the internal pseudo constant name __COMPILER_HALT_OFFSET__ */
- if ((c->name_len == sizeof("__COMPILER_HALT_OFFSET__")
- && !memcmp(name, "__COMPILER_HALT_OFFSET__", sizeof("__COMPILER_HALT_OFFSET__")-1))
- || zend_hash_quick_add(EG(zend_constants), name, c->name_len, chash, (void *) c, sizeof(zend_constant), NULL)==FAILURE) {
+ if ((c->name->len == sizeof("__COMPILER_HALT_OFFSET__")
+ && !memcmp(name->val, "__COMPILER_HALT_OFFSET__", sizeof("__COMPILER_HALT_OFFSET__")-1))
+ || zend_hash_add_mem(EG(zend_constants), name, c, sizeof(zend_constant)) == NULL) {
/* The internal __COMPILER_HALT_OFFSET__ is prefixed by NULL byte */
- if (c->name[0] == '\0' && c->name_len > sizeof("\0__COMPILER_HALT_OFFSET__")
- && memcmp(name, "\0__COMPILER_HALT_OFFSET__", sizeof("\0__COMPILER_HALT_OFFSET__")) == 0) {
- name++;
+ if (c->name->val[0] == '\0' && c->name->len > sizeof("\0__COMPILER_HALT_OFFSET__")
+ && memcmp(name->val, "\0__COMPILER_HALT_OFFSET__", sizeof("\0__COMPILER_HALT_OFFSET__")) == 0) {
+//??? name++;
}
- zend_error(E_NOTICE,"Constant %s already defined", name);
- str_free(c->name);
+ zend_error(E_NOTICE,"Constant %s already defined", name->val);
+ STR_RELEASE(c->name);
if (!(c->flags & CONST_PERSISTENT)) {
zval_dtor(&c->value);
}
ret = FAILURE;
}
if (lowercase_name) {
- str_efree(lowercase_name);
+ STR_RELEASE(lowercase_name);
}
return ret;
}
diff --git a/Zend/zend_constants.h b/Zend/zend_constants.h
index a40db3a8af..86c5d56f0a 100644
--- a/Zend/zend_constants.h
+++ b/Zend/zend_constants.h
@@ -33,8 +33,7 @@
typedef struct _zend_constant {
zval value;
int flags;
- char *name;
- uint name_len;
+ zend_string *name;
int module_number;
} zend_constant;
@@ -76,11 +75,10 @@ ZEND_API void zend_register_string_constant(const char *name, uint name_len, cha
ZEND_API void zend_register_stringl_constant(const char *name, uint name_len, char *strval, uint strlen, int flags, int module_number TSRMLS_DC);
ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC);
void zend_copy_constants(HashTable *target, HashTable *sourc);
-void copy_zend_constant(zend_constant *c);
zend_constant *zend_quick_get_constant(const zend_literal *key, ulong flags TSRMLS_DC);
END_EXTERN_C()
-#define ZEND_CONSTANT_DTOR (void (*)(void *)) free_zend_constant
+#define ZEND_CONSTANT_DTOR (void (*)(zval *)) free_zend_constant
#endif
diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c
index e973a67a92..938f885d0b 100644
--- a/Zend/zend_exceptions.c
+++ b/Zend/zend_exceptions.c
@@ -34,26 +34,29 @@ static zend_class_entry *error_exception_ce;
static zend_object_handlers default_exception_handlers;
ZEND_API void (*zend_throw_exception_hook)(zval *ex TSRMLS_DC);
-void zend_exception_set_previous(zval *exception, zval *add_previous TSRMLS_DC)
+void zend_exception_set_previous(zend_object *exception, zend_object *add_previous TSRMLS_DC)
{
- zval *previous;
+ zval tmp, *previous, zv, *pzv;
if (exception == add_previous || !add_previous || !exception) {
return;
}
- if (Z_TYPE_P(add_previous) != IS_OBJECT && !instanceof_function(Z_OBJCE_P(add_previous), default_exception_ce TSRMLS_CC)) {
+ ZVAL_OBJ(&tmp, add_previous);
+ if (!instanceof_function(Z_OBJCE(tmp), default_exception_ce TSRMLS_CC)) {
zend_error(E_ERROR, "Cannot set non exception as previous exception");
return;
}
- while (exception && exception != add_previous && Z_OBJ_HANDLE_P(exception) != Z_OBJ_HANDLE_P(add_previous)) {
- previous = zend_read_property(default_exception_ce, exception, "previous", sizeof("previous")-1, 1 TSRMLS_CC);
+ ZVAL_OBJ(&zv, exception);
+ pzv = &zv;
+ do {
+ previous = zend_read_property(default_exception_ce, pzv, "previous", sizeof("previous")-1, 1 TSRMLS_CC);
if (Z_TYPE_P(previous) == IS_NULL) {
- zend_update_property(default_exception_ce, exception, "previous", sizeof("previous")-1, add_previous TSRMLS_CC);
- Z_DELREF_P(add_previous);
+ zend_update_property(default_exception_ce, pzv, "previous", sizeof("previous")-1, &tmp TSRMLS_CC);
+ add_previous->gc.refcount--;
return;
}
- exception = previous;
- }
+ pzv = previous;
+ } while (pzv && Z_OBJ_P(pzv) != add_previous);
}
void zend_exception_save(TSRMLS_D) /* {{{ */
@@ -98,9 +101,9 @@ void zend_throw_exception_internal(zval *exception TSRMLS_DC) /* {{{ */
#endif /* HAVE_DTRACE */
if (exception != NULL) {
- zval *previous = EG(exception);
- zend_exception_set_previous(exception, EG(exception) TSRMLS_CC);
- EG(exception) = exception;
+ zend_object *previous = EG(exception);
+ zend_exception_set_previous(Z_OBJ_P(exception), EG(exception) TSRMLS_CC);
+ EG(exception) = Z_OBJ_P(exception);
if (previous) {
return;
}
@@ -129,13 +132,14 @@ void zend_throw_exception_internal(zval *exception TSRMLS_DC) /* {{{ */
ZEND_API void zend_clear_exception(TSRMLS_D) /* {{{ */
{
if (EG(prev_exception)) {
- zval_ptr_dtor(&EG(prev_exception));
+
+//??? zval_ptr_dtor(&EG(prev_exception));
EG(prev_exception) = NULL;
}
if (!EG(exception)) {
return;
}
- zval_ptr_dtor(&EG(exception));
+//??? zval_ptr_dtor(&EG(exception));
EG(exception) = NULL;
EG(current_execute_data)->opline = EG(opline_before_exception);
#if ZEND_DEBUG
@@ -144,37 +148,34 @@ ZEND_API void zend_clear_exception(TSRMLS_D) /* {{{ */
}
/* }}} */
-static zend_object_value zend_default_exception_new_ex(zend_class_entry *class_type, int skip_top_traces TSRMLS_DC) /* {{{ */
+static zend_object *zend_default_exception_new_ex(zend_class_entry *class_type, int skip_top_traces TSRMLS_DC) /* {{{ */
{
zval obj;
zend_object *object;
- zval *trace;
+ zval trace;
- Z_OBJVAL(obj) = zend_objects_new(&object, class_type TSRMLS_CC);
+ Z_OBJ(obj) = object = zend_objects_new(class_type TSRMLS_CC);
Z_OBJ_HT(obj) = &default_exception_handlers;
object_properties_init(object, class_type);
- ALLOC_ZVAL(trace);
- Z_UNSET_ISREF_P(trace);
- Z_SET_REFCOUNT_P(trace, 0);
- zend_fetch_debug_backtrace(trace, skip_top_traces, 0, 0 TSRMLS_CC);
+ zend_fetch_debug_backtrace(&trace, skip_top_traces, 0, 0 TSRMLS_CC);
zend_update_property_string(default_exception_ce, &obj, "file", sizeof("file")-1, zend_get_executed_filename(TSRMLS_C) TSRMLS_CC);
zend_update_property_long(default_exception_ce, &obj, "line", sizeof("line")-1, zend_get_executed_lineno(TSRMLS_C) TSRMLS_CC);
- zend_update_property(default_exception_ce, &obj, "trace", sizeof("trace")-1, trace TSRMLS_CC);
+ zend_update_property(default_exception_ce, &obj, "trace", sizeof("trace")-1, &trace TSRMLS_CC);
- return Z_OBJVAL(obj);
+ return object;
}
/* }}} */
-static zend_object_value zend_default_exception_new(zend_class_entry *class_type TSRMLS_DC) /* {{{ */
+static zend_object *zend_default_exception_new(zend_class_entry *class_type TSRMLS_DC) /* {{{ */
{
return zend_default_exception_new_ex(class_type, 0 TSRMLS_CC);
}
/* }}} */
-static zend_object_value zend_error_exception_new(zend_class_entry *class_type TSRMLS_DC) /* {{{ */
+static zend_object *zend_error_exception_new(zend_class_entry *class_type TSRMLS_DC) /* {{{ */
{
return zend_default_exception_new_ex(class_type, 2 TSRMLS_CC);
}
@@ -268,9 +269,8 @@ static void _default_exception_get_entry(zval *object, char *name, int name_len,
value = zend_read_property(default_exception_ce, object, name, name_len, 0 TSRMLS_CC);
- *return_value = *value;
- zval_copy_ctor(return_value);
- INIT_PZVAL(return_value);
+ ZVAL_DUP(return_value, value);
+//??? INIT_PZVAL(return_value);
}
/* }}} */
@@ -350,19 +350,21 @@ ZEND_METHOD(error_exception, getSeverity)
#define TRACE_APPEND_STR(val) \
TRACE_APPEND_STRL(val, sizeof(val)-1)
-#define TRACE_APPEND_KEY(key) \
- if (zend_hash_find(ht, key, sizeof(key), (void**)&tmp) == SUCCESS) { \
- if (Z_TYPE_PP(tmp) != IS_STRING) { \
- zend_error(E_WARNING, "Value for %s is no string", key); \
- TRACE_APPEND_STR("[unknown]"); \
- } else { \
- TRACE_APPEND_STRL(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp)); \
- } \
- }
+#define TRACE_APPEND_KEY(key) do { \
+ tmp = zend_hash_str_find(ht, key, sizeof(key)-1); \
+ if (tmp) { \
+ if (Z_TYPE_P(tmp) != IS_STRING) { \
+ zend_error(E_WARNING, "Value for %s is no string", key); \
+ TRACE_APPEND_STR("[unknown]"); \
+ } else { \
+ TRACE_APPEND_STRL(Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); \
+ } \
+ } \
+ } while (0)
/* }}} */
-static int _build_trace_args(zval **arg TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */
+static int _build_trace_args(zval *arg TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */
{
char **str;
int *len;
@@ -376,20 +378,20 @@ static int _build_trace_args(zval **arg TSRMLS_DC, int num_args, va_list args, z
* but that could cause some E_NOTICE and also damn long lines.
*/
- switch (Z_TYPE_PP(arg)) {
+ switch (Z_TYPE_P(arg)) {
case IS_NULL:
TRACE_APPEND_STR("NULL, ");
break;
case IS_STRING: {
int l_added;
TRACE_APPEND_CHR('\'');
- if (Z_STRLEN_PP(arg) > 15) {
- TRACE_APPEND_STRL(Z_STRVAL_PP(arg), 15);
+ if (Z_STRLEN_P(arg) > 15) {
+ TRACE_APPEND_STRL(Z_STRVAL_P(arg), 15);
TRACE_APPEND_STR("...', ");
l_added = 15 + 6 + 1; /* +1 because of while (--l_added) */
} else {
- l_added = Z_STRLEN_PP(arg);
- TRACE_APPEND_STRL(Z_STRVAL_PP(arg), l_added);
+ l_added = Z_STRLEN_P(arg);
+ TRACE_APPEND_STRL(Z_STRVAL_P(arg), l_added);
TRACE_APPEND_STR("', ");
l_added += 3 + 1;
}
@@ -401,7 +403,7 @@ static int _build_trace_args(zval **arg TSRMLS_DC, int num_args, va_list args, z
break;
}
case IS_BOOL:
- if (Z_LVAL_PP(arg)) {
+ if (Z_LVAL_P(arg)) {
TRACE_APPEND_STR("true, ");
} else {
TRACE_APPEND_STR("false, ");
@@ -411,7 +413,7 @@ static int _build_trace_args(zval **arg TSRMLS_DC, int num_args, va_list args, z
TRACE_APPEND_STR("Resource id #");
/* break; */
case IS_LONG: {
- long lval = Z_LVAL_PP(arg);
+ long lval = Z_LVAL_P(arg);
char s_tmp[MAX_LENGTH_OF_LONG + 1];
int l_tmp = zend_sprintf(s_tmp, "%ld", lval); /* SAFE */
TRACE_APPEND_STRL(s_tmp, l_tmp);
@@ -419,7 +421,7 @@ static int _build_trace_args(zval **arg TSRMLS_DC, int num_args, va_list args, z
break;
}
case IS_DOUBLE: {
- double dval = Z_DVAL_PP(arg);
+ double dval = Z_DVAL_P(arg);
char *s_tmp;
int l_tmp;
@@ -435,18 +437,16 @@ static int _build_trace_args(zval **arg TSRMLS_DC, int num_args, va_list args, z
TRACE_APPEND_STR("Array, ");
break;
case IS_OBJECT: {
- const char *class_name;
- zend_uint class_name_len;
- int dup;
+ zend_string *class_name;
TRACE_APPEND_STR("Object(");
- dup = zend_get_object_classname(*arg, &class_name, &class_name_len TSRMLS_CC);
+ class_name = zend_get_object_classname(arg TSRMLS_CC);
- TRACE_APPEND_STRL(class_name, class_name_len);
- if(!dup) {
- efree((char*)class_name);
- }
+ TRACE_APPEND_STRL(class_name->val, class_name->len);
+//??? if(!dup) {
+//??? efree((char*)class_name);
+//??? }
TRACE_APPEND_STR("), ");
break;
@@ -458,15 +458,15 @@ static int _build_trace_args(zval **arg TSRMLS_DC, int num_args, va_list args, z
}
/* }}} */
-static int _build_trace_string(zval **frame TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */
+static int _build_trace_string(zval *frame TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */
{
char *s_tmp, **str;
int *len, *num;
long line;
- HashTable *ht = Z_ARRVAL_PP(frame);
- zval **file, **tmp;
+ HashTable *ht = Z_ARRVAL_P(frame);
+ zval *file, *tmp;
- if (Z_TYPE_PP(frame) != IS_ARRAY) {
+ if (Z_TYPE_P(frame) != IS_ARRAY) {
zend_error(E_WARNING, "Expected array for frame %lu", hash_key->h);
return ZEND_HASH_APPLY_KEEP;
}
@@ -479,14 +479,16 @@ static int _build_trace_string(zval **frame TSRMLS_DC, int num_args, va_list arg
sprintf(s_tmp, "#%d ", (*num)++);
TRACE_APPEND_STRL(s_tmp, strlen(s_tmp));
efree(s_tmp);
- if (zend_hash_find(ht, "file", sizeof("file"), (void**)&file) == SUCCESS) {
- if (Z_TYPE_PP(file) != IS_STRING) {
+ file = zend_hash_str_find(ht, "file", sizeof("file")-1);
+ if (file) {
+ if (Z_TYPE_P(file) != IS_STRING) {
zend_error(E_WARNING, "Function name is no string");
TRACE_APPEND_STR("[unknown function]");
} else{
- if (zend_hash_find(ht, "line", sizeof("line"), (void**)&tmp) == SUCCESS) {
- if (Z_TYPE_PP(tmp) == IS_LONG) {
- line = Z_LVAL_PP(tmp);
+ tmp = zend_hash_str_find(ht, "line", sizeof("line")-1);
+ if (tmp) {
+ if (Z_TYPE_P(tmp) == IS_LONG) {
+ line = Z_LVAL_P(tmp);
} else {
zend_error(E_WARNING, "Line is no long");
line = 0;
@@ -494,8 +496,8 @@ static int _build_trace_string(zval **frame TSRMLS_DC, int num_args, va_list arg
} else {
line = 0;
}
- s_tmp = emalloc(Z_STRLEN_PP(file) + MAX_LENGTH_OF_LONG + 4 + 1);
- sprintf(s_tmp, "%s(%ld): ", Z_STRVAL_PP(file), line);
+ s_tmp = emalloc(Z_STRLEN_P(file) + MAX_LENGTH_OF_LONG + 4 + 1);
+ sprintf(s_tmp, "%s(%ld): ", Z_STRVAL_P(file), line);
TRACE_APPEND_STRL(s_tmp, strlen(s_tmp));
efree(s_tmp);
}
@@ -506,10 +508,11 @@ static int _build_trace_string(zval **frame TSRMLS_DC, int num_args, va_list arg
TRACE_APPEND_KEY("type");
TRACE_APPEND_KEY("function");
TRACE_APPEND_CHR('(');
- if (zend_hash_find(ht, "args", sizeof("args"), (void**)&tmp) == SUCCESS) {
- if (Z_TYPE_PP(tmp) == IS_ARRAY) {
+ tmp = zend_hash_str_find(ht, "args", sizeof("args")-1);
+ if (tmp) {
+ if (Z_TYPE_P(tmp) == IS_ARRAY) {
int last_len = *len;
- zend_hash_apply_with_arguments(Z_ARRVAL_PP(tmp) TSRMLS_CC, (apply_func_args_t)_build_trace_args, 2, str, len);
+ zend_hash_apply_with_arguments(Z_ARRVAL_P(tmp) TSRMLS_CC, (apply_func_args_t)_build_trace_args, 2, str, len);
if (last_len != *len) {
*len -= 2; /* remove last ', ' */
}
@@ -544,7 +547,8 @@ ZEND_METHOD(exception, getTraceAsString)
efree(s_tmp);
res[res_len] = '\0';
- RETURN_STRINGL(res, res_len, 0);
+//??? RETURN_STRINGL(res, res_len, 0);
+ RETURN_STRINGL(res, res_len);
}
/* }}} */
@@ -587,7 +591,7 @@ ZEND_METHOD(exception, __toString)
str = estrndup("", 0);
exception = getThis();
- ZVAL_STRINGL(&fname, "gettraceasstring", sizeof("gettraceasstring")-1, 1);
+ ZVAL_STRINGL(&fname, "gettraceasstring", sizeof("gettraceasstring")-1);
while (exception && Z_TYPE_P(exception) == IS_OBJECT) {
prev_str = str;
@@ -601,20 +605,20 @@ ZEND_METHOD(exception, __toString)
fci.size = sizeof(fci);
fci.function_table = &Z_OBJCE_P(exception)->function_table;
- fci.function_name = &fname;
+ ZVAL_COPY_VALUE(&fci.function_name, &fname);
fci.symbol_table = NULL;
fci.object_ptr = exception;
- fci.retval_ptr_ptr = &trace;
+//??? fci.retval_ptr_ptr = &trace;
fci.param_count = 0;
fci.params = NULL;
fci.no_separation = 1;
zend_call_function(&fci, NULL TSRMLS_CC);
- if (Z_TYPE_P(trace) != IS_STRING) {
- zval_ptr_dtor(&trace);
- trace = NULL;
- }
+//??? if (Z_TYPE_P(trace) != IS_STRING) {
+//??? zval_ptr_dtor(&trace);
+//??? trace = NULL;
+//??? }
if (Z_STRLEN(message) > 0) {
len = zend_spprintf(&str, 0, "exception '%s' with message '%s' in %s:%ld\nStack trace:\n%s%s%s",
@@ -634,9 +638,9 @@ ZEND_METHOD(exception, __toString)
exception = zend_read_property(default_exception_ce, exception, "previous", sizeof("previous")-1, 0 TSRMLS_CC);
- if (trace) {
- zval_ptr_dtor(&trace);
- }
+//??? if (trace) {
+//??? zval_ptr_dtor(&trace);
+//??? }
}
zval_dtor(&fname);
@@ -645,7 +649,8 @@ ZEND_METHOD(exception, __toString)
* the result in uncaught exception handlers without memleaks. */
zend_update_property_string(default_exception_ce, getThis(), "string", sizeof("string")-1, str TSRMLS_CC);
- RETURN_STRINGL(str, len, 0);
+//??? RETURN_STRINGL(str, len, 0);
+ RETURN_STRINGL(str, len);
}
/* }}} */
@@ -714,7 +719,7 @@ void zend_register_default_exception(TSRMLS_D) /* {{{ */
zend_declare_property_null(default_exception_ce, "previous", sizeof("previous")-1, ZEND_ACC_PRIVATE TSRMLS_CC);
INIT_CLASS_ENTRY(ce, "ErrorException", error_exception_functions);
- error_exception_ce = zend_register_internal_class_ex(&ce, default_exception_ce, NULL TSRMLS_CC);
+ error_exception_ce = zend_register_internal_class_ex(&ce, default_exception_ce TSRMLS_CC);
error_exception_ce->create_object = zend_error_exception_new;
zend_declare_property_long(error_exception_ce, "severity", sizeof("severity")-1, E_ERROR, ZEND_ACC_PROTECTED TSRMLS_CC);
}
@@ -732,11 +737,10 @@ ZEND_API zend_class_entry *zend_get_error_exception(TSRMLS_D) /* {{{ */
}
/* }}} */
-ZEND_API zval * zend_throw_exception(zend_class_entry *exception_ce, const char *message, long code TSRMLS_DC) /* {{{ */
+ZEND_API zend_object *zend_throw_exception(zend_class_entry *exception_ce, const char *message, long code TSRMLS_DC) /* {{{ */
{
- zval *ex;
+ zval ex;
- MAKE_STD_ZVAL(ex);
if (exception_ce) {
if (!instanceof_function(exception_ce, default_exception_ce TSRMLS_CC)) {
zend_error(E_NOTICE, "Exceptions must be derived from the Exception base class");
@@ -745,41 +749,43 @@ ZEND_API zval * zend_throw_exception(zend_class_entry *exception_ce, const char
} else {
exception_ce = default_exception_ce;
}
- object_init_ex(ex, exception_ce);
+ object_init_ex(&ex, exception_ce);
if (message) {
- zend_update_property_string(default_exception_ce, ex, "message", sizeof("message")-1, message TSRMLS_CC);
+ zend_update_property_string(default_exception_ce, &ex, "message", sizeof("message")-1, message TSRMLS_CC);
}
if (code) {
- zend_update_property_long(default_exception_ce, ex, "code", sizeof("code")-1, code TSRMLS_CC);
+ zend_update_property_long(default_exception_ce, &ex, "code", sizeof("code")-1, code TSRMLS_CC);
}
- zend_throw_exception_internal(ex TSRMLS_CC);
- return ex;
+ zend_throw_exception_internal(&ex TSRMLS_CC);
+ return Z_OBJ(ex);
}
/* }}} */
-ZEND_API zval * zend_throw_exception_ex(zend_class_entry *exception_ce, long code TSRMLS_DC, const char *format, ...) /* {{{ */
+ZEND_API zend_object *zend_throw_exception_ex(zend_class_entry *exception_ce, long code TSRMLS_DC, const char *format, ...) /* {{{ */
{
va_list arg;
char *message;
- zval *zexception;
+ zend_object *obj;
va_start(arg, format);
zend_vspprintf(&message, 0, format, arg);
va_end(arg);
- zexception = zend_throw_exception(exception_ce, message, code TSRMLS_CC);
+ obj = zend_throw_exception(exception_ce, message, code TSRMLS_CC);
efree(message);
- return zexception;
+ return obj;
}
/* }}} */
-ZEND_API zval * zend_throw_error_exception(zend_class_entry *exception_ce, const char *message, long code, int severity TSRMLS_DC) /* {{{ */
+ZEND_API zend_object *zend_throw_error_exception(zend_class_entry *exception_ce, const char *message, long code, int severity TSRMLS_DC) /* {{{ */
{
- zval *ex = zend_throw_exception(exception_ce, message, code TSRMLS_CC);
- zend_update_property_long(default_exception_ce, ex, "severity", sizeof("severity")-1, severity TSRMLS_CC);
- return ex;
+ zval ex;
+ zend_object *obj = zend_throw_exception(exception_ce, message, code TSRMLS_CC);
+ ZVAL_OBJ(&ex, obj);
+ zend_update_property_long(default_exception_ce, &ex, "severity", sizeof("severity")-1, severity TSRMLS_CC);
+ return obj;
}
/* }}} */
@@ -794,29 +800,36 @@ static void zend_error_va(int type, const char *file, uint lineno, const char *f
/* }}} */
/* This function doesn't return if it uses E_ERROR */
-ZEND_API void zend_exception_error(zval *exception, int severity TSRMLS_DC) /* {{{ */
+ZEND_API void zend_exception_error(zend_object *ex, int severity TSRMLS_DC) /* {{{ */
{
- zend_class_entry *ce_exception = Z_OBJCE_P(exception);
+ zval exception;
+ zend_class_entry *ce_exception;
+
+ ZVAL_OBJ(&exception, ex);
+ ce_exception = Z_OBJCE(exception);
if (instanceof_function(ce_exception, default_exception_ce TSRMLS_CC)) {
- zval *str, *file, *line;
+ zval tmp, *str, *file, *line;
EG(exception) = NULL;
- zend_call_method_with_0_params(&exception, ce_exception, NULL, "__tostring", &str);
+ zend_call_method_with_0_params(&exception, ce_exception, NULL, "__tostring", &tmp);
if (!EG(exception)) {
- if (Z_TYPE_P(str) != IS_STRING) {
- zend_error(E_WARNING, "%s::__toString() must return a string", ce_exception->name);
+ if (Z_TYPE(tmp) != IS_STRING) {
+ zend_error(E_WARNING, "%s::__toString() must return a string", ce_exception->name->val);
} else {
- zend_update_property_string(default_exception_ce, exception, "string", sizeof("string")-1, EG(exception) ? ce_exception->name : Z_STRVAL_P(str) TSRMLS_CC);
+ zend_update_property_string(default_exception_ce, &exception, "string", sizeof("string")-1, EG(exception) ? ce_exception->name->val : Z_STRVAL(tmp) TSRMLS_CC);
}
}
- zval_ptr_dtor(&str);
+ zval_ptr_dtor(&tmp);
if (EG(exception)) {
+ zval zv;
+
+ ZVAL_OBJ(&zv, EG(exception));
/* do the best we can to inform about the inner exception */
if (instanceof_function(ce_exception, default_exception_ce TSRMLS_CC)) {
- file = zend_read_property(default_exception_ce, EG(exception), "file", sizeof("file")-1, 1 TSRMLS_CC);
- line = zend_read_property(default_exception_ce, EG(exception), "line", sizeof("line")-1, 1 TSRMLS_CC);
+ file = zend_read_property(default_exception_ce, &zv, "file", sizeof("file")-1, 1 TSRMLS_CC);
+ line = zend_read_property(default_exception_ce, &zv, "line", sizeof("line")-1, 1 TSRMLS_CC);
convert_to_string(file);
file = (Z_STRLEN_P(file) > 0) ? file : NULL;
@@ -825,12 +838,12 @@ ZEND_API void zend_exception_error(zval *exception, int severity TSRMLS_DC) /* {
file = NULL;
line = NULL;
}
- zend_error_va(E_WARNING, file ? Z_STRVAL_P(file) : NULL, line ? Z_LVAL_P(line) : 0, "Uncaught %s in exception handling during call to %s::__tostring()", Z_OBJCE_P(EG(exception))->name, ce_exception->name);
+ zend_error_va(E_WARNING, file ? Z_STRVAL_P(file) : NULL, line ? Z_LVAL_P(line) : 0, "Uncaught %s in exception handling during call to %s::__tostring()", Z_OBJCE(zv)->name->val, ce_exception->name->val);
}
- str = zend_read_property(default_exception_ce, exception, "string", sizeof("string")-1, 1 TSRMLS_CC);
- file = zend_read_property(default_exception_ce, exception, "file", sizeof("file")-1, 1 TSRMLS_CC);
- line = zend_read_property(default_exception_ce, exception, "line", sizeof("line")-1, 1 TSRMLS_CC);
+ str = zend_read_property(default_exception_ce, &exception, "string", sizeof("string")-1, 1 TSRMLS_CC);
+ file = zend_read_property(default_exception_ce, &exception, "file", sizeof("file")-1, 1 TSRMLS_CC);
+ line = zend_read_property(default_exception_ce, &exception, "line", sizeof("line")-1, 1 TSRMLS_CC);
convert_to_string(str);
convert_to_string(file);
@@ -838,7 +851,7 @@ ZEND_API void zend_exception_error(zval *exception, int severity TSRMLS_DC) /* {
zend_error_va(severity, (Z_STRLEN_P(file) > 0) ? Z_STRVAL_P(file) : NULL, Z_LVAL_P(line), "Uncaught %s\n thrown", Z_STRVAL_P(str));
} else {
- zend_error(severity, "Uncaught exception '%s'", ce_exception->name);
+ zend_error(severity, "Uncaught exception '%s'", ce_exception->name->val);
}
}
/* }}} */
diff --git a/Zend/zend_exceptions.h b/Zend/zend_exceptions.h
index 2ce9c1295c..24113d6f8d 100644
--- a/Zend/zend_exceptions.h
+++ b/Zend/zend_exceptions.h
@@ -26,7 +26,7 @@
BEGIN_EXTERN_C()
-ZEND_API void zend_exception_set_previous(zval *exception, zval *add_previous TSRMLS_DC);
+ZEND_API void zend_exception_set_previous(zend_object *exception, zend_object *add_previous TSRMLS_DC);
ZEND_API void zend_exception_save(TSRMLS_D);
ZEND_API void zend_exception_restore(TSRMLS_D);
@@ -40,17 +40,17 @@ ZEND_API void zend_register_default_classes(TSRMLS_D);
/* exception_ce NULL or zend_exception_get_default() or a derived class
* message NULL or the message of the exception */
-ZEND_API zval * zend_throw_exception(zend_class_entry *exception_ce, const char *message, long code TSRMLS_DC);
-ZEND_API zval * zend_throw_exception_ex(zend_class_entry *exception_ce, long code TSRMLS_DC, const char *format, ...);
+ZEND_API zend_object *zend_throw_exception(zend_class_entry *exception_ce, const char *message, long code TSRMLS_DC);
+ZEND_API zend_object *zend_throw_exception_ex(zend_class_entry *exception_ce, long code TSRMLS_DC, const char *format, ...);
ZEND_API void zend_throw_exception_object(zval *exception TSRMLS_DC);
ZEND_API void zend_clear_exception(TSRMLS_D);
-ZEND_API zval * zend_throw_error_exception(zend_class_entry *exception_ce, const char *message, long code, int severity TSRMLS_DC);
+ZEND_API zend_object *zend_throw_error_exception(zend_class_entry *exception_ce, const char *message, long code, int severity TSRMLS_DC);
extern ZEND_API void (*zend_throw_exception_hook)(zval *ex TSRMLS_DC);
/* show an exception using zend_error(severity,...), severity should be E_ERROR */
-ZEND_API void zend_exception_error(zval *exception, int severity TSRMLS_DC);
+ZEND_API void zend_exception_error(zend_object *exception, int severity TSRMLS_DC);
/* do not export, in php it's available thru spprintf directly */
int zend_spprintf(char **message, int max_len, const char *format, ...);
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index 31caceecbe..33af58d242 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -62,39 +62,50 @@ static void zend_extension_fcall_end_handler(const zend_extension *extension, ze
#define RETURN_VALUE_USED(opline) (!((opline)->result_type & EXT_TYPE_UNUSED))
-#define EX_T(offset) (*EX_TMP_VAR(execute_data, offset))
-#define EX_CV(var) (*EX_CV_NUM(execute_data, var))
-
#define TEMP_VAR_STACK_LIMIT 2000
static zend_always_inline void zend_pzval_unlock_func(zval *z, zend_free_op *should_free, int unref TSRMLS_DC)
{
- if (!Z_DELREF_P(z)) {
- Z_SET_REFCOUNT_P(z, 1);
- Z_UNSET_ISREF_P(z);
- should_free->var = z;
+ should_free->var = 0;
+ if (Z_REFCOUNTED_P(z)) {
+ if (!Z_DELREF_P(z)) {
+ Z_SET_REFCOUNT_P(z, 1);
+//??? Z_UNSET_ISREF_P(z);
+ if (Z_ISREF_P(z)) {
+ zend_reference *ref = Z_REF_P(z);
+ ZVAL_COPY_VALUE(z, &ref->val);
+ efree(ref);
+ }
+ should_free->var = z;
/* should_free->is_var = 1; */
- } else {
- should_free->var = 0;
- if (unref && Z_ISREF_P(z) && Z_REFCOUNT_P(z) == 1) {
- Z_UNSET_ISREF_P(z);
+ } else {
+ if (unref && Z_ISREF_P(z) && Z_REFCOUNT_P(z) == 1) {
+//??? Z_UNSET_ISREF_P(z);
+ if (Z_ISREF_P(z)) {
+ zend_reference *ref = Z_REF_P(z);
+ ZVAL_COPY_VALUE(z, &ref->val);
+ efree(ref);
+ }
+ }
}
}
}
static zend_always_inline void zend_pzval_unlock_free_func(zval *z TSRMLS_DC)
{
- if (!Z_DELREF_P(z)) {
- ZEND_ASSERT(z != &EG(uninitialized_zval));
- GC_REMOVE_ZVAL_FROM_BUFFER(z);
- zval_dtor(z);
- efree(z);
+ if (Z_REFCOUNTED_P(z)) {
+ if (!Z_DELREF_P(z)) {
+ ZEND_ASSERT(z != &EG(uninitialized_zval));
+ GC_REMOVE_ZVAL_FROM_BUFFER(z);
+ zval_dtor(z);
+ efree(z);
+ }
}
}
#undef zval_ptr_dtor
-#define zval_ptr_dtor(pzv) i_zval_ptr_dtor(*(pzv) ZEND_FILE_LINE_CC TSRMLS_CC)
-#define zval_ptr_dtor_nogc(pzv) i_zval_ptr_dtor_nogc(*(pzv) ZEND_FILE_LINE_CC TSRMLS_CC)
+#define zval_ptr_dtor(zv) i_zval_ptr_dtor(zv ZEND_FILE_LINE_CC TSRMLS_CC)
+#define zval_ptr_dtor_nogc(zv) i_zval_ptr_dtor_nogc(zv ZEND_FILE_LINE_CC TSRMLS_CC)
#define PZVAL_UNLOCK(z, f) zend_pzval_unlock_func(z, f, 1 TSRMLS_CC)
#define PZVAL_UNLOCK_EX(z, f, u) zend_pzval_unlock_func(z, f, u TSRMLS_CC)
@@ -123,18 +134,18 @@ static zend_always_inline void zend_pzval_unlock_free_func(zval *z TSRMLS_DC)
if ((zend_uintptr_t)should_free.var & 1L) { \
zval_dtor((zval*)((zend_uintptr_t)should_free.var & ~1L)); \
} else { \
- zval_ptr_dtor_nogc(&should_free.var); \
+ zval_ptr_dtor_nogc(should_free.var); \
} \
}
#define FREE_OP_IF_VAR(should_free) \
if (should_free.var != NULL && (((zend_uintptr_t)should_free.var & 1L) == 0)) { \
- zval_ptr_dtor_nogc(&should_free.var); \
+ zval_ptr_dtor_nogc(should_free.var); \
}
#define FREE_OP_VAR_PTR(should_free) \
if (should_free.var) { \
- zval_ptr_dtor_nogc(&should_free.var); \
+ zval_ptr_dtor_nogc(should_free.var); \
}
#define TMP_FREE(z) (zval*)(((zend_uintptr_t)(z)) | 1L)
@@ -143,10 +154,9 @@ static zend_always_inline void zend_pzval_unlock_free_func(zval *z TSRMLS_DC)
#define MAKE_REAL_ZVAL_PTR(val) \
do { \
- zval *_tmp; \
- ALLOC_ZVAL(_tmp); \
- INIT_PZVAL_COPY(_tmp, (val)); \
- (val) = _tmp; \
+ zval _tmp; \
+ ZVAL_COPY_VALUE(&_tmp, (val)); \
+ (val) = &_tmp; \
} while (0)
/* End of zend_execute_locks.h */
@@ -167,179 +177,178 @@ static zend_always_inline void zend_pzval_unlock_free_func(zval *z TSRMLS_DC)
#undef EX
#define EX(element) execute_data->element
-ZEND_API zval** zend_get_compiled_variable_value(const zend_execute_data *execute_data, zend_uint var)
+ZEND_API zval* zend_get_compiled_variable_value(const zend_execute_data *execute_data, zend_uint var)
{
- return EX_CV(var);
+ return EX_VAR_NUM(var);
}
static zend_always_inline zval *_get_zval_ptr_tmp(zend_uint var, const zend_execute_data *execute_data, zend_free_op *should_free TSRMLS_DC)
{
- return should_free->var = &EX_T(var).tmp_var;
+ return should_free->var = EX_VAR(var);
}
static zend_always_inline zval *_get_zval_ptr_var(zend_uint var, const zend_execute_data *execute_data, zend_free_op *should_free TSRMLS_DC)
{
- zval *ptr = EX_T(var).var.ptr;
-
- return should_free->var = ptr;
+ return should_free->var = EX_VAR(var);
}
-static zend_never_inline zval **_get_zval_cv_lookup(zval ***ptr, zend_uint var, int type TSRMLS_DC)
+static zend_never_inline zval *_get_zval_cv_lookup(zend_uint var, int type TSRMLS_DC)
{
- zend_compiled_variable *cv = &CV_DEF_OF(var);
+ zend_string *cv = CV_DEF_OF(var);
+ zval *ret;
+ // TODO: IS_INDIRECT handling ???
if (!EG(active_symbol_table) ||
- zend_hash_quick_find(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, (void **)ptr)==FAILURE) {
+ (ret = zend_hash_find(EG(active_symbol_table), cv)) == NULL) {
switch (type) {
case BP_VAR_R:
case BP_VAR_UNSET:
- zend_error(E_NOTICE, "Undefined variable: %s", cv->name);
+ zend_error(E_NOTICE, "Undefined variable: %s", cv->val);
/* break missing intentionally */
case BP_VAR_IS:
- return &EG(uninitialized_zval_ptr);
+ return &EG(uninitialized_zval);
break;
case BP_VAR_RW:
- zend_error(E_NOTICE, "Undefined variable: %s", cv->name);
+ zend_error(E_NOTICE, "Undefined variable: %s", cv->val);
/* break missing intentionally */
case BP_VAR_W:
- Z_ADDREF(EG(uninitialized_zval));
- if (!EG(active_symbol_table)) {
- *ptr = (zval**)EX_CV_NUM(EG(current_execute_data), EG(active_op_array)->last_var + var);
- **ptr = &EG(uninitialized_zval);
- } else {
- zend_hash_quick_update(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **)ptr);
+ ret = EX_VAR_2(EG(current_execute_data), var);
+ ZVAL_NULL(ret);
+ if (EG(active_symbol_table)) {
+ ret = zend_hash_update(EG(active_symbol_table), cv, ret);
}
break;
}
}
- return *ptr;
+ return ret;
}
-static zend_never_inline zval **_get_zval_cv_lookup_BP_VAR_R(zval ***ptr, zend_uint var TSRMLS_DC)
+static zend_never_inline zval *_get_zval_cv_lookup_BP_VAR_R(zend_uint var TSRMLS_DC)
{
- zend_compiled_variable *cv = &CV_DEF_OF(var);
+ zend_string *cv = CV_DEF_OF(var);
+ zval *ret;
if (!EG(active_symbol_table) ||
- zend_hash_quick_find(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, (void **)ptr)==FAILURE) {
- zend_error(E_NOTICE, "Undefined variable: %s", cv->name);
- return &EG(uninitialized_zval_ptr);
+ (ret = zend_hash_find(EG(active_symbol_table), cv)) == NULL) {
+ zend_error(E_NOTICE, "Undefined variable: %s", cv->val);
+ return &EG(uninitialized_zval);
}
- return *ptr;
+ return ret;
}
-static zend_never_inline zval **_get_zval_cv_lookup_BP_VAR_UNSET(zval ***ptr, zend_uint var TSRMLS_DC)
+static zend_never_inline zval *_get_zval_cv_lookup_BP_VAR_UNSET(zend_uint var TSRMLS_DC)
{
- zend_compiled_variable *cv = &CV_DEF_OF(var);
+ zend_string *cv = CV_DEF_OF(var);
+ zval *ret;
if (!EG(active_symbol_table) ||
- zend_hash_quick_find(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, (void **)ptr)==FAILURE) {
- zend_error(E_NOTICE, "Undefined variable: %s", cv->name);
- return &EG(uninitialized_zval_ptr);
+ (ret = zend_hash_find(EG(active_symbol_table), cv)) == NULL) {
+ zend_error(E_NOTICE, "Undefined variable: %s", cv->val);
+ return &EG(uninitialized_zval);
}
- return *ptr;
+ return ret;
}
-static zend_never_inline zval **_get_zval_cv_lookup_BP_VAR_IS(zval ***ptr, zend_uint var TSRMLS_DC)
+static zend_never_inline zval *_get_zval_cv_lookup_BP_VAR_IS(zend_uint var TSRMLS_DC)
{
- zend_compiled_variable *cv = &CV_DEF_OF(var);
+ zend_string *cv = CV_DEF_OF(var);
+ zval *ret;
if (!EG(active_symbol_table) ||
- zend_hash_quick_find(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, (void **)ptr)==FAILURE) {
- return &EG(uninitialized_zval_ptr);
+ (ret = zend_hash_find(EG(active_symbol_table), cv)) == NULL) {
+ return &EG(uninitialized_zval);
}
- return *ptr;
+ return ret;
}
-static zend_never_inline zval **_get_zval_cv_lookup_BP_VAR_RW(zval ***ptr, zend_uint var TSRMLS_DC)
+static zend_never_inline zval *_get_zval_cv_lookup_BP_VAR_RW(zend_uint var TSRMLS_DC)
{
- zend_compiled_variable *cv = &CV_DEF_OF(var);
+ zend_string *cv = CV_DEF_OF(var);
+ zval *ret;
if (!EG(active_symbol_table)) {
- Z_ADDREF(EG(uninitialized_zval));
- *ptr = (zval**)EX_CV_NUM(EG(current_execute_data), EG(active_op_array)->last_var + var);
- **ptr = &EG(uninitialized_zval);
- zend_error(E_NOTICE, "Undefined variable: %s", cv->name);
- } else if (zend_hash_quick_find(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, (void **)ptr)==FAILURE) {
- Z_ADDREF(EG(uninitialized_zval));
- zend_hash_quick_update(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **)ptr);
- zend_error(E_NOTICE, "Undefined variable: %s", cv->name);
- }
- return *ptr;
+ ret = EX_VAR_2(EG(current_execute_data), var);
+ ZVAL_NULL(ret);
+ zend_error(E_NOTICE, "Undefined variable: %s", cv->val);
+ } else if ((ret = zend_hash_find(EG(active_symbol_table), cv)) == NULL) {
+ ret = zend_hash_update(EG(active_symbol_table), cv, &EG(uninitialized_zval));
+ zend_error(E_NOTICE, "Undefined variable: %s", cv->val);
+ }
+ return ret;
}
-static zend_never_inline zval **_get_zval_cv_lookup_BP_VAR_W(zval ***ptr, zend_uint var TSRMLS_DC)
+static zend_never_inline zval *_get_zval_cv_lookup_BP_VAR_W(zend_uint var TSRMLS_DC)
{
- zend_compiled_variable *cv = &CV_DEF_OF(var);
+ zend_string *cv = CV_DEF_OF(var);
+ zval *ret;
if (!EG(active_symbol_table)) {
- Z_ADDREF(EG(uninitialized_zval));
- *ptr = (zval**)EX_CV_NUM(EG(current_execute_data), EG(active_op_array)->last_var + var);
- **ptr = &EG(uninitialized_zval);
- } else if (zend_hash_quick_find(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, (void **)ptr)==FAILURE) {
- Z_ADDREF(EG(uninitialized_zval));
- zend_hash_quick_update(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **)ptr);
- }
- return *ptr;
+ ret = EX_VAR_2(EG(current_execute_data), var);
+ ZVAL_NULL(ret);
+ } else if ((ret = zend_hash_find(EG(active_symbol_table), cv)) == NULL) {
+ ret = zend_hash_update(EG(active_symbol_table), cv, &EG(uninitialized_zval));
+ }
+ return ret;
}
static zend_always_inline zval *_get_zval_ptr_cv(zend_uint var, int type TSRMLS_DC)
{
- zval ***ptr = EX_CV_NUM(EG(current_execute_data), var);
+ zval *ret = EX_VAR_NUM_2(EG(current_execute_data), var);
- if (UNEXPECTED(*ptr == NULL)) {
- return *_get_zval_cv_lookup(ptr, var, type TSRMLS_CC);
+ if (UNEXPECTED(Z_TYPE_P(ret) == IS_UNDEF)) {
+ return _get_zval_cv_lookup(var, type TSRMLS_CC);
}
- return **ptr;
+ return ret;
}
static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_R(const zend_execute_data *execute_data, zend_uint var TSRMLS_DC)
{
- zval ***ptr = EX_CV_NUM(execute_data, var);
+ zval *ret = EX_VAR_NUM(var);
- if (UNEXPECTED(*ptr == NULL)) {
- return *_get_zval_cv_lookup_BP_VAR_R(ptr, var TSRMLS_CC);
+ if (UNEXPECTED(Z_TYPE_P(ret) == IS_UNDEF)) {
+ return _get_zval_cv_lookup_BP_VAR_R(var TSRMLS_CC);
}
- return **ptr;
+ return ret;
}
static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_UNSET(const zend_execute_data *execute_data, zend_uint var TSRMLS_DC)
{
- zval ***ptr = EX_CV_NUM(execute_data, var);
+ zval *ret = EX_VAR_NUM(var);
- if (UNEXPECTED(*ptr == NULL)) {
- return *_get_zval_cv_lookup_BP_VAR_UNSET(ptr, var TSRMLS_CC);
+ if (UNEXPECTED(Z_TYPE_P(ret) == IS_UNDEF)) {
+ return _get_zval_cv_lookup_BP_VAR_UNSET(var TSRMLS_CC);
}
- return **ptr;
+ return ret;
}
static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_IS(const zend_execute_data *execute_data, zend_uint var TSRMLS_DC)
{
- zval ***ptr = EX_CV_NUM(execute_data, var);
+ zval *ret = EX_VAR_NUM(var);
- if (UNEXPECTED(*ptr == NULL)) {
- return *_get_zval_cv_lookup_BP_VAR_IS(ptr, var TSRMLS_CC);
+ if (UNEXPECTED(Z_TYPE_P(ret) == IS_UNDEF)) {
+ return _get_zval_cv_lookup_BP_VAR_IS(var TSRMLS_CC);
}
- return **ptr;
+ return ret;
}
static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_RW(const zend_execute_data *execute_data, zend_uint var TSRMLS_DC)
{
- zval ***ptr = EX_CV_NUM(execute_data, var);
+ zval *ret = EX_VAR_NUM(var);
- if (UNEXPECTED(*ptr == NULL)) {
- return *_get_zval_cv_lookup_BP_VAR_RW(ptr, var TSRMLS_CC);
+ if (UNEXPECTED(Z_TYPE_P(ret) == IS_UNDEF)) {
+ return _get_zval_cv_lookup_BP_VAR_RW(var TSRMLS_CC);
}
- return **ptr;
+ return ret;
}
static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_W(const zend_execute_data *execute_data, zend_uint var TSRMLS_DC)
{
- zval ***ptr = EX_CV_NUM(execute_data, var);
+ zval *ret = EX_VAR_NUM(var);
- if (UNEXPECTED(*ptr == NULL)) {
- return *_get_zval_cv_lookup_BP_VAR_W(ptr, var TSRMLS_CC);
+ if (UNEXPECTED(Z_TYPE_P(ret) == IS_UNDEF)) {
+ return _get_zval_cv_lookup_BP_VAR_W(var TSRMLS_CC);
}
- return **ptr;
+ return ret;
}
static inline zval *_get_zval_ptr(int op_type, const znode_op *node, const zend_execute_data *execute_data, zend_free_op *should_free, int type TSRMLS_DC)
@@ -351,8 +360,8 @@ static inline zval *_get_zval_ptr(int op_type, const znode_op *node, const zend_
return node->zv;
break;
case IS_TMP_VAR:
- should_free->var = TMP_FREE(&EX_T(node->var).tmp_var);
- return &EX_T(node->var).tmp_var;
+ should_free->var = TMP_FREE(EX_VAR(node->var));
+ return EX_VAR(node->var);
break;
case IS_VAR:
return _get_zval_ptr_var(node->var, execute_data, should_free TSRMLS_CC);
@@ -370,6 +379,8 @@ static inline zval *_get_zval_ptr(int op_type, const znode_op *node, const zend_
return NULL;
}
+//???
+#if 0
static zend_always_inline zval **_get_zval_ptr_ptr_var(zend_uint var, const zend_execute_data *execute_data, zend_free_op *should_free TSRMLS_DC)
{
zval** ptr_ptr = EX_T(var).var.ptr_ptr;
@@ -383,120 +394,23 @@ static zend_always_inline zval **_get_zval_ptr_ptr_var(zend_uint var, const zend
return ptr_ptr;
}
-static zend_always_inline zval **_get_zval_ptr_ptr_var_fast(zend_uint var, const zend_execute_data *execute_data, zend_free_op *should_free TSRMLS_DC)
+static zend_always_inline zval *_get_zval_ptr_var_fast(zend_uint var, const zend_execute_data *execute_data, zend_free_op *should_free TSRMLS_DC)
{
- zval** ptr_ptr = EX_T(var).var.ptr_ptr;
+ zval* ptr = EX_VAR(var);
- if (EXPECTED(ptr_ptr != NULL)) {
- should_free->var = *ptr_ptr;
+ if (EXPECTED(Z_TYPE_P(ptr) != IS_STR_OFFSET)) {
+ should_free->var = ptr;
} else {
/* string offset */
- should_free->var = EX_T(var).str_offset.str;
- }
- return ptr_ptr;
-}
-
-static zend_always_inline zval **_get_zval_ptr_ptr_cv(zend_uint var, int type TSRMLS_DC)
-{
- zval ***ptr = EX_CV_NUM(EG(current_execute_data), var);
-
- if (UNEXPECTED(*ptr == NULL)) {
- return _get_zval_cv_lookup(ptr, var, type TSRMLS_CC);
- }
- return *ptr;
-}
-
-static zend_always_inline zval **_get_zval_ptr_ptr_cv_BP_VAR_R(const zend_execute_data *execute_data, zend_uint var TSRMLS_DC)
-{
- zval ***ptr = EX_CV_NUM(execute_data, var);
-
- if (UNEXPECTED(*ptr == NULL)) {
- return _get_zval_cv_lookup_BP_VAR_R(ptr, var TSRMLS_CC);
- }
- return *ptr;
-}
-
-static zend_always_inline zval **_get_zval_ptr_ptr_cv_BP_VAR_UNSET(const zend_execute_data *execute_data, zend_uint var TSRMLS_DC)
-{
- zval ***ptr = EX_CV_NUM(execute_data, var);
-
- if (UNEXPECTED(*ptr == NULL)) {
- return _get_zval_cv_lookup_BP_VAR_UNSET(ptr, var TSRMLS_CC);
- }
- return *ptr;
-}
-
-static zend_always_inline zval **_get_zval_ptr_ptr_cv_BP_VAR_IS(const zend_execute_data *execute_data, zend_uint var TSRMLS_DC)
-{
- zval ***ptr = EX_CV_NUM(execute_data, var);
-
- if (UNEXPECTED(*ptr == NULL)) {
- return _get_zval_cv_lookup_BP_VAR_IS(ptr, var TSRMLS_CC);
- }
- return *ptr;
-}
-
-static zend_always_inline zval **_get_zval_ptr_ptr_cv_BP_VAR_RW(const zend_execute_data *execute_data, zend_uint var TSRMLS_DC)
-{
- zval ***ptr = EX_CV_NUM(execute_data, var);
-
- if (UNEXPECTED(*ptr == NULL)) {
- return _get_zval_cv_lookup_BP_VAR_RW(ptr, var TSRMLS_CC);
- }
- return *ptr;
-}
-
-static zend_always_inline zval **_get_zval_ptr_ptr_cv_BP_VAR_W(const zend_execute_data *execute_data, zend_uint var TSRMLS_DC)
-{
- zval ***ptr = EX_CV_NUM(execute_data, var);
-
- if (UNEXPECTED(*ptr == NULL)) {
- return _get_zval_cv_lookup_BP_VAR_W(ptr, var TSRMLS_CC);
- }
- return *ptr;
-}
-
-static inline zval **_get_zval_ptr_ptr(int op_type, const znode_op *node, const zend_execute_data *execute_data, zend_free_op *should_free, int type TSRMLS_DC)
-{
- if (op_type == IS_CV) {
- should_free->var = 0;
- return _get_zval_ptr_ptr_cv(node->var, type TSRMLS_CC);
- } else if (op_type == IS_VAR) {
- return _get_zval_ptr_ptr_var(node->var, execute_data, should_free TSRMLS_CC);
- } else {
- should_free->var = 0;
- return NULL;
+ should_free->var = Z_STR_OFFSET_P(EX_VAR(var))->str;
}
+ return ptr;
}
+#endif
static zend_always_inline zval *_get_obj_zval_ptr_unused(TSRMLS_D)
{
- if (EXPECTED(EG(This) != NULL)) {
- return EG(This);
- } else {
- zend_error_noreturn(E_ERROR, "Using $this when not in object context");
- return NULL;
- }
-}
-
-static inline zval **_get_obj_zval_ptr_ptr(int op_type, const znode_op *op, const zend_execute_data *execute_data, zend_free_op *should_free, int type TSRMLS_DC)
-{
- if (op_type == IS_UNUSED) {
- if (EXPECTED(EG(This) != NULL)) {
- /* this should actually never be modified, _ptr_ptr is modified only when
- the object is empty */
- should_free->var = 0;
- return &EG(This);
- } else {
- zend_error_noreturn(E_ERROR, "Using $this when not in object context");
- }
- }
- return get_zval_ptr_ptr(op_type, op, execute_data, should_free, type);
-}
-
-static zend_always_inline zval **_get_obj_zval_ptr_ptr_unused(TSRMLS_D)
-{
- if (EXPECTED(EG(This) != NULL)) {
+ if (EXPECTED(Z_TYPE(EG(This)) != IS_UNDEF)) {
return &EG(This);
} else {
zend_error_noreturn(E_ERROR, "Using $this when not in object context");
@@ -507,9 +421,9 @@ static zend_always_inline zval **_get_obj_zval_ptr_ptr_unused(TSRMLS_D)
static inline zval *_get_obj_zval_ptr(int op_type, znode_op *op, const zend_execute_data *execute_data, zend_free_op *should_free, int type TSRMLS_DC)
{
if (op_type == IS_UNUSED) {
- if (EXPECTED(EG(This) != NULL)) {
+ if (EXPECTED(Z_TYPE(EG(This)) != IS_UNDEF)) {
should_free->var = 0;
- return EG(This);
+ return &EG(This);
} else {
zend_error_noreturn(E_ERROR, "Using $this when not in object context");
}
@@ -517,67 +431,42 @@ static inline zval *_get_obj_zval_ptr(int op_type, znode_op *op, const zend_exec
return get_zval_ptr(op_type, op, execute_data, should_free, type);
}
-static void zend_assign_to_variable_reference(zval **variable_ptr_ptr, zval **value_ptr_ptr TSRMLS_DC)
+static void zend_assign_to_variable_reference(zval *variable_ptr, zval *value_ptr TSRMLS_DC)
{
- zval *variable_ptr = *variable_ptr_ptr;
- zval *value_ptr = *value_ptr_ptr;
-
if (variable_ptr == &EG(error_zval) || value_ptr == &EG(error_zval)) {
- variable_ptr_ptr = &EG(uninitialized_zval_ptr);
- } else if (variable_ptr != value_ptr) {
- if (!PZVAL_IS_REF(value_ptr)) {
- /* break it away */
- Z_DELREF_P(value_ptr);
- if (Z_REFCOUNT_P(value_ptr)>0) {
- ALLOC_ZVAL(*value_ptr_ptr);
- ZVAL_COPY_VALUE(*value_ptr_ptr, value_ptr);
- value_ptr = *value_ptr_ptr;
- zendi_zval_copy_ctor(*value_ptr);
- }
- Z_SET_REFCOUNT_P(value_ptr, 1);
- Z_SET_ISREF_P(value_ptr);
- }
-
- *variable_ptr_ptr = value_ptr;
+ ZVAL_NULL(variable_ptr);
+ } else if (EXPECTED(variable_ptr != value_ptr)) {
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(value_ptr);
Z_ADDREF_P(value_ptr);
-
- zval_ptr_dtor(&variable_ptr);
+ zval_ptr_dtor(variable_ptr);
+ ZVAL_COPY_VALUE(variable_ptr, value_ptr);
} else if (!Z_ISREF_P(variable_ptr)) {
- if (variable_ptr_ptr == value_ptr_ptr) {
- SEPARATE_ZVAL(variable_ptr_ptr);
- } else if (variable_ptr==&EG(uninitialized_zval)
- || Z_REFCOUNT_P(variable_ptr)>2) {
- /* we need to separate */
- Z_SET_REFCOUNT_P(variable_ptr, Z_REFCOUNT_P(variable_ptr) - 2);
- ALLOC_ZVAL(*variable_ptr_ptr);
- ZVAL_COPY_VALUE(*variable_ptr_ptr, variable_ptr);
- zval_copy_ctor(*variable_ptr_ptr);
- *value_ptr_ptr = *variable_ptr_ptr;
- Z_SET_REFCOUNT_PP(variable_ptr_ptr, 2);
- }
- Z_SET_ISREF_PP(variable_ptr_ptr);
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(value_ptr);
+ Z_ADDREF_P(value_ptr);
+ ZVAL_COPY_VALUE(variable_ptr, value_ptr);
}
}
/* this should modify object only if it's empty */
-static inline void make_real_object(zval **object_ptr TSRMLS_DC)
+static inline void make_real_object(zval *object_ptr TSRMLS_DC)
{
- if (Z_TYPE_PP(object_ptr) == IS_NULL
- || (Z_TYPE_PP(object_ptr) == IS_BOOL && Z_LVAL_PP(object_ptr) == 0)
- || (Z_TYPE_PP(object_ptr) == IS_STRING && Z_STRLEN_PP(object_ptr) == 0)
+ if (Z_TYPE_P(object_ptr) == IS_NULL
+ || (Z_TYPE_P(object_ptr) == IS_BOOL && Z_LVAL_P(object_ptr) == 0)
+ || (Z_TYPE_P(object_ptr) == IS_STRING && Z_STRLEN_P(object_ptr) == 0)
) {
SEPARATE_ZVAL_IF_NOT_REF(object_ptr);
- zval_dtor(*object_ptr);
- object_init(*object_ptr);
+ zval_dtor(object_ptr);
+ object_init(object_ptr);
zend_error(E_WARNING, "Creating default object from empty value");
}
}
-ZEND_API char * zend_verify_arg_class_kind(const zend_arg_info *cur_arg_info, ulong fetch_type, const char **class_name, zend_class_entry **pce TSRMLS_DC)
+ZEND_API char * zend_verify_arg_class_kind(const zend_arg_info *cur_arg_info, ulong fetch_type, char **class_name, zend_class_entry **pce TSRMLS_DC)
{
- *pce = zend_fetch_class(cur_arg_info->class_name, cur_arg_info->class_name_len, (fetch_type | ZEND_FETCH_CLASS_AUTO | ZEND_FETCH_CLASS_NO_AUTOLOAD) TSRMLS_CC);
-
- *class_name = (*pce) ? (*pce)->name: cur_arg_info->class_name;
+ zend_string *key = STR_INIT(cur_arg_info->class_name, cur_arg_info->class_name_len, 0);
+ *pce = zend_fetch_class(key, (fetch_type | ZEND_FETCH_CLASS_AUTO | ZEND_FETCH_CLASS_NO_AUTOLOAD) TSRMLS_CC);
+ STR_FREE(key);
+ *class_name = (*pce) ? (*pce)->name->val : (char*)cur_arg_info->class_name;
if (*pce && (*pce)->ce_flags & ZEND_ACC_INTERFACE) {
return "implement interface ";
} else {
@@ -588,20 +477,20 @@ ZEND_API char * zend_verify_arg_class_kind(const zend_arg_info *cur_arg_info, ul
ZEND_API int zend_verify_arg_error(int error_type, const zend_function *zf, zend_uint arg_num, const char *need_msg, const char *need_kind, const char *given_msg, const char *given_kind TSRMLS_DC)
{
zend_execute_data *ptr = EG(current_execute_data)->prev_execute_data;
- const char *fname = zf->common.function_name;
- char *fsep;
+ const char *fname = zf->common.function_name->val;
+ const char *fsep;
const char *fclass;
if (zf->common.scope) {
fsep = "::";
- fclass = zf->common.scope->name;
+ fclass = zf->common.scope->name->val;
} else {
fsep = "";
fclass = "";
}
if (ptr && ptr->op_array) {
- zend_error(error_type, "Argument %d passed to %s%s%s() must %s%s, %s%s given, called in %s on line %d and defined", arg_num, fclass, fsep, fname, need_msg, need_kind, given_msg, given_kind, ptr->op_array->filename, ptr->opline->lineno);
+ zend_error(error_type, "Argument %d passed to %s%s%s() must %s%s, %s%s given, called in %s on line %d and defined", arg_num, fclass, fsep, fname, need_msg, need_kind, given_msg, given_kind, ptr->op_array->filename->val, ptr->opline->lineno);
} else {
zend_error(error_type, "Argument %d passed to %s%s%s() must %s%s, %s%s given", arg_num, fclass, fsep, fname, need_msg, need_kind, given_msg, given_kind);
}
@@ -627,7 +516,7 @@ static inline int zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zva
}
if (cur_arg_info->class_name) {
- const char *class_name;
+ char *class_name;
if (!arg) {
need_msg = zend_verify_arg_class_kind(cur_arg_info, fetch_type, &class_name, &ce TSRMLS_CC);
@@ -636,7 +525,7 @@ static inline int zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zva
if (Z_TYPE_P(arg) == IS_OBJECT) {
need_msg = zend_verify_arg_class_kind(cur_arg_info, fetch_type, &class_name, &ce TSRMLS_CC);
if (!ce || !instanceof_function(Z_OBJCE_P(arg), ce TSRMLS_CC)) {
- return zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, need_msg, class_name, "instance of ", Z_OBJCE_P(arg)->name TSRMLS_CC);
+ return zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, need_msg, class_name, "instance of ", Z_OBJCE_P(arg)->name->val TSRMLS_CC);
}
} else if (Z_TYPE_P(arg) != IS_NULL || !cur_arg_info->allow_null) {
need_msg = zend_verify_arg_class_kind(cur_arg_info, fetch_type, &class_name, &ce TSRMLS_CC);
@@ -670,17 +559,15 @@ static inline int zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zva
return 1;
}
-static inline void zend_assign_to_object(zval **retval, zval **object_ptr, zval *property_name, int value_type, znode_op *value_op, const zend_execute_data *execute_data, int opcode, const zend_literal *key TSRMLS_DC)
+static inline void zend_assign_to_object(zval *retval, zval *object, zval *property_name, int value_type, znode_op *value_op, const zend_execute_data *execute_data, int opcode, const zend_literal *key TSRMLS_DC)
{
- zval *object = *object_ptr;
zend_free_op free_value;
zval *value = get_zval_ptr(value_type, value_op, execute_data, &free_value, BP_VAR_R);
if (Z_TYPE_P(object) != IS_OBJECT) {
if (object == &EG(error_zval)) {
if (retval) {
- *retval = &EG(uninitialized_zval);
- PZVAL_LOCK(*retval);
+ ZVAL_NULL(retval);
}
FREE_OP(free_value);
return;
@@ -688,16 +575,14 @@ static inline void zend_assign_to_object(zval **retval, zval **object_ptr, zval
if (Z_TYPE_P(object) == IS_NULL ||
(Z_TYPE_P(object) == IS_BOOL && Z_LVAL_P(object) == 0) ||
(Z_TYPE_P(object) == IS_STRING && Z_STRLEN_P(object) == 0)) {
- SEPARATE_ZVAL_IF_NOT_REF(object_ptr);
- object = *object_ptr;
+ SEPARATE_ZVAL_IF_NOT_REF(object);
Z_ADDREF_P(object);
zend_error(E_WARNING, "Creating default object from empty value");
- if (Z_REFCOUNT_P(object) == 1) {
+ if (Z_REFCOUNTED_P(object) && Z_REFCOUNT_P(object) == 1) {
/* object was removed by error handler, nothing to assign to */
- zval_ptr_dtor(&object);
+ zval_ptr_dtor(object);
if (retval) {
- *retval = &EG(uninitialized_zval);
- PZVAL_LOCK(*retval);
+ ZVAL_NULL(retval);
}
FREE_OP(free_value);
return;
@@ -708,8 +593,7 @@ static inline void zend_assign_to_object(zval **retval, zval **object_ptr, zval
} else {
zend_error(E_WARNING, "Attempt to assign property of non-object");
if (retval) {
- *retval = &EG(uninitialized_zval);
- PZVAL_LOCK(*retval);
+ ZVAL_NULL(retval);
}
FREE_OP(free_value);
return;
@@ -717,36 +601,32 @@ static inline void zend_assign_to_object(zval **retval, zval **object_ptr, zval
}
/* separate our value if necessary */
- if (value_type == IS_TMP_VAR) {
- zval *orig_value = value;
-
- ALLOC_ZVAL(value);
- ZVAL_COPY_VALUE(value, orig_value);
- Z_UNSET_ISREF_P(value);
- Z_SET_REFCOUNT_P(value, 0);
- } else if (value_type == IS_CONST) {
- zval *orig_value = value;
-
- ALLOC_ZVAL(value);
- ZVAL_COPY_VALUE(value, orig_value);
- Z_UNSET_ISREF_P(value);
- Z_SET_REFCOUNT_P(value, 0);
- zval_copy_ctor(value);
+//??? if (value_type == IS_TMP_VAR) {
+//??? ALLOC_ZVAL(value);
+//??? ZVAL_COPY_VALUE(value, orig_value);
+//??? Z_UNSET_ISREF_P(value);
+//??? Z_SET_REFCOUNT_P(value, 0);
+//??? } else if (value_type == IS_CONST) {
+//??? zval *orig_value = value;
+//???
+//??? ALLOC_ZVAL(value);
+//??? ZVAL_COPY_VALUE(value, orig_value);
+//??? Z_UNSET_ISREF_P(value);
+//??? Z_SET_REFCOUNT_P(value, 0);
+//??? zval_copy_ctor(value);
+//??? }
+
+ if (Z_REFCOUNTED_P(value)) {
+ Z_ADDREF_P(value);
}
-
-
- Z_ADDREF_P(value);
if (opcode == ZEND_ASSIGN_OBJ) {
if (!Z_OBJ_HT_P(object)->write_property) {
zend_error(E_WARNING, "Attempt to assign property of non-object");
if (retval) {
- *retval = &EG(uninitialized_zval);
- PZVAL_LOCK(&EG(uninitialized_zval));
+ ZVAL_NULL(retval);
}
- if (value_type == IS_TMP_VAR) {
- FREE_ZVAL(value);
- } else if (value_type == IS_CONST) {
- zval_ptr_dtor(&value);
+ if (value_type == IS_CONST) {
+ zval_ptr_dtor(value);
}
FREE_OP(free_value);
return;
@@ -760,141 +640,138 @@ static inline void zend_assign_to_object(zval **retval, zval **object_ptr, zval
Z_OBJ_HT_P(object)->write_dimension(object, property_name, value TSRMLS_CC);
}
- if (retval && !EG(exception)) {
- *retval = value;
- PZVAL_LOCK(value);
+ if (retval && EG(exception) != NULL) {
+ ZVAL_COPY(retval, value);
}
- zval_ptr_dtor(&value);
+ zval_ptr_dtor(value);
FREE_OP_IF_VAR(free_value);
}
-static inline int zend_assign_to_string_offset(const temp_variable *T, const zval *value, int value_type TSRMLS_DC)
+static inline int zend_assign_to_string_offset(zval *str_offset, zval *value, int value_type TSRMLS_DC)
{
- zval *str = T->str_offset.str;
- zend_uint offset = T->str_offset.offset;
- if (Z_TYPE_P(str) == IS_STRING) {
- if ((int)offset < 0) {
- zend_error(E_WARNING, "Illegal string offset: %d", offset);
- return 0;
- }
+ zend_string *str = Z_STR_OFFSET_P(str_offset)->str;
+ zend_uint offset = Z_STR_OFFSET_P(str_offset)->offset;
- if (offset >= Z_STRLEN_P(str)) {
- Z_STRVAL_P(str) = str_erealloc(Z_STRVAL_P(str), offset+1+1);
- memset(Z_STRVAL_P(str) + Z_STRLEN_P(str), ' ', offset - Z_STRLEN_P(str));
- Z_STRVAL_P(str)[offset+1] = 0;
- Z_STRLEN_P(str) = offset+1;
- } else if (IS_INTERNED(Z_STRVAL_P(str))) {
- Z_STRVAL_P(str) = estrndup(Z_STRVAL_P(str), Z_STRLEN_P(str));
- }
+ if ((int)offset < 0) {
+ zend_error(E_WARNING, "Illegal string offset: %d", offset);
+ return 0;
+ }
+
+ if (offset >= str->len) {
+ str = STR_EREALLOC(str, offset + 1);
+ memset(str->val + str->len, ' ', offset - str->len);
+ str->val[offset+1] = 0;
+ } else if (IS_INTERNED(str)) {
+ str = STR_DUP(str, 0);
+ }
- if (Z_TYPE_P(value) != IS_STRING) {
- zval tmp;
+ if (Z_TYPE_P(value) != IS_STRING) {
+ zval tmp;
- ZVAL_COPY_VALUE(&tmp, value);
- if (value_type != IS_TMP_VAR) {
- zval_copy_ctor(&tmp);
- }
- convert_to_string(&tmp);
- Z_STRVAL_P(str)[offset] = Z_STRVAL(tmp)[0];
- str_efree(Z_STRVAL(tmp));
- } else {
- Z_STRVAL_P(str)[offset] = Z_STRVAL_P(value)[0];
- if (value_type == IS_TMP_VAR) {
- /* we can safely free final_value here
- * because separation is done only
- * in case value_type == IS_VAR */
- str_efree(Z_STRVAL_P(value));
- }
+ ZVAL_COPY_VALUE(&tmp, value);
+ if (value_type != IS_TMP_VAR) {
+ zval_copy_ctor(&tmp);
+ }
+ convert_to_string(&tmp);
+ str->val[offset] = Z_STRVAL(tmp)[0];
+ zval_dtor(&tmp);
+ } else {
+ str->val[offset] = Z_STRVAL_P(value)[0];
+ if (value_type == IS_TMP_VAR) {
+ /* we can safely free final_value here
+ * because separation is done only
+ * in case value_type == IS_VAR */
+ zval_dtor(value);
}
- /*
- * the value of an assignment to a string offset is undefined
- T(result->u.var).var = &T->str_offset.str;
- */
}
+ /*
+ * the value of an assignment to a string offset is undefined
+ T(result->u.var).var = &T->str_offset.str;
+ */
return 1;
}
-
-static inline zval* zend_assign_tmp_to_variable(zval **variable_ptr_ptr, zval *value TSRMLS_DC)
+static inline zval* zend_assign_tmp_to_variable(zval *variable_ptr, zval *value TSRMLS_DC)
{
- zval *variable_ptr = *variable_ptr_ptr;
- zval garbage;
+ if (Z_ISREF_P(variable_ptr)) {
+ variable_ptr = Z_REFVAL_P(variable_ptr);
+ }
if (Z_TYPE_P(variable_ptr) == IS_OBJECT &&
UNEXPECTED(Z_OBJ_HANDLER_P(variable_ptr, set) != NULL)) {
- Z_OBJ_HANDLER_P(variable_ptr, set)(variable_ptr_ptr, value TSRMLS_CC);
+ Z_OBJ_HANDLER_P(variable_ptr, set)(variable_ptr, value TSRMLS_CC);
return variable_ptr;
}
- if (UNEXPECTED(Z_REFCOUNT_P(variable_ptr) > 1) &&
- EXPECTED(!PZVAL_IS_REF(variable_ptr))) {
- /* we need to split */
+ if (EXPECTED(!Z_REFCOUNTED_P(variable_ptr))) {
+ ZVAL_COPY_VALUE(variable_ptr, value);
+ } else if (UNEXPECTED(Z_REFCOUNT_P(variable_ptr) > 1)) {
+ /* we need to split */
Z_DELREF_P(variable_ptr);
GC_ZVAL_CHECK_POSSIBLE_ROOT(variable_ptr);
- ALLOC_ZVAL(variable_ptr);
- INIT_PZVAL_COPY(variable_ptr, value);
- *variable_ptr_ptr = variable_ptr;
- return variable_ptr;
+ ZVAL_COPY_VALUE(variable_ptr, value);
} else {
- if (EXPECTED(Z_TYPE_P(variable_ptr) <= IS_BOOL)) {
- /* nothing to destroy */
- ZVAL_COPY_VALUE(variable_ptr, value);
- } else {
- ZVAL_COPY_VALUE(&garbage, variable_ptr);
- ZVAL_COPY_VALUE(variable_ptr, value);
- _zval_dtor_func(&garbage ZEND_FILE_LINE_CC);
- }
- return variable_ptr;
+ zval garbage;
+
+ ZVAL_COPY_VALUE(&garbage, variable_ptr);
+ ZVAL_COPY_VALUE(variable_ptr, value);
+ _zval_dtor_func(&garbage ZEND_FILE_LINE_CC);
}
+ return variable_ptr;
}
-static inline zval* zend_assign_const_to_variable(zval **variable_ptr_ptr, zval *value TSRMLS_DC)
+static inline zval* zend_assign_const_to_variable(zval *variable_ptr, zval *value TSRMLS_DC)
{
- zval *variable_ptr = *variable_ptr_ptr;
- zval garbage;
+ if (Z_ISREF_P(variable_ptr)) {
+ variable_ptr = Z_REFVAL_P(variable_ptr);
+ }
if (Z_TYPE_P(variable_ptr) == IS_OBJECT &&
UNEXPECTED(Z_OBJ_HANDLER_P(variable_ptr, set) != NULL)) {
- Z_OBJ_HANDLER_P(variable_ptr, set)(variable_ptr_ptr, value TSRMLS_CC);
+ Z_OBJ_HANDLER_P(variable_ptr, set)(variable_ptr, value TSRMLS_CC);
return variable_ptr;
}
- if (UNEXPECTED(Z_REFCOUNT_P(variable_ptr) > 1) &&
- EXPECTED(!PZVAL_IS_REF(variable_ptr))) {
+ if (EXPECTED(!Z_REFCOUNTED_P(variable_ptr))) {
+ ZVAL_COPY_VALUE(variable_ptr, value);
+ if (Z_REFCOUNTED_P(value)) {
+ zval_copy_ctor(variable_ptr);
+ }
+ } else if (UNEXPECTED(Z_REFCOUNT_P(variable_ptr) > 1)) {
/* we need to split */
Z_DELREF_P(variable_ptr);
GC_ZVAL_CHECK_POSSIBLE_ROOT(variable_ptr);
- ALLOC_ZVAL(variable_ptr);
- INIT_PZVAL_COPY(variable_ptr, value);
- zval_copy_ctor(variable_ptr);
- *variable_ptr_ptr = variable_ptr;
- return variable_ptr;
+ ZVAL_COPY_VALUE(variable_ptr, value);
+ if (Z_REFCOUNTED_P(value)) {
+ zval_copy_ctor(variable_ptr);
+ }
} else {
- if (EXPECTED(Z_TYPE_P(variable_ptr) <= IS_BOOL)) {
- /* nothing to destroy */
- ZVAL_COPY_VALUE(variable_ptr, value);
- zendi_zval_copy_ctor(*variable_ptr);
- } else {
- ZVAL_COPY_VALUE(&garbage, variable_ptr);
- ZVAL_COPY_VALUE(variable_ptr, value);
- zendi_zval_copy_ctor(*variable_ptr);
- _zval_dtor_func(&garbage ZEND_FILE_LINE_CC);
+ zval garbage;
+
+ ZVAL_COPY_VALUE(&garbage, variable_ptr);
+ ZVAL_COPY_VALUE(variable_ptr, value);
+ if (Z_REFCOUNTED_P(value)) {
+ zval_copy_ctor(variable_ptr);
}
- return variable_ptr;
+ _zval_dtor_func(&garbage ZEND_FILE_LINE_CC);
}
+ return variable_ptr;
}
-static inline zval* zend_assign_to_variable(zval **variable_ptr_ptr, zval *value TSRMLS_DC)
+static inline zval* zend_assign_to_variable(zval *variable_ptr, zval *value TSRMLS_DC)
{
- zval *variable_ptr = *variable_ptr_ptr;
- zval garbage;
+ if (Z_ISREF_P(variable_ptr)) {
+ variable_ptr = Z_REFVAL_P(variable_ptr);
+ }
if (Z_TYPE_P(variable_ptr) == IS_OBJECT &&
UNEXPECTED(Z_OBJ_HANDLER_P(variable_ptr, set) != NULL)) {
- Z_OBJ_HANDLER_P(variable_ptr, set)(variable_ptr_ptr, value TSRMLS_CC);
+ Z_OBJ_HANDLER_P(variable_ptr, set)(variable_ptr, value TSRMLS_CC);
return variable_ptr;
}
+//???
+#if 0
if (EXPECTED(!PZVAL_IS_REF(variable_ptr))) {
if (Z_REFCOUNT_P(variable_ptr)==1) {
if (UNEXPECTED(variable_ptr == value)) {
@@ -930,17 +807,17 @@ static inline zval* zend_assign_to_variable(zval **variable_ptr_ptr, zval *value
copy_value:
if (EXPECTED(Z_TYPE_P(variable_ptr) <= IS_BOOL)) {
/* nothing to destroy */
- ZVAL_COPY_VALUE(variable_ptr, value);
- zendi_zval_copy_ctor(*variable_ptr);
+ ZVAL_DUP(variable_ptr, value);
} else {
ZVAL_COPY_VALUE(&garbage, variable_ptr);
- ZVAL_COPY_VALUE(variable_ptr, value);
- zendi_zval_copy_ctor(*variable_ptr);
+ ZVAL_DUP(variable_ptr, value);
_zval_dtor_func(&garbage ZEND_FILE_LINE_CC);
}
}
return variable_ptr;
}
+#endif
+ return variable_ptr;
}
/* Utility Functions for Extensions */
@@ -979,7 +856,7 @@ static inline HashTable *zend_get_target_symbol_table(int fetch_type TSRMLS_DC)
break;
case ZEND_FETCH_GLOBAL:
case ZEND_FETCH_GLOBAL_LOCK:
- return &EG(symbol_table);
+ return &EG(symbol_table).ht;
break;
case ZEND_FETCH_STATIC:
if (!EG(active_op_array)->static_variables) {
@@ -993,50 +870,38 @@ static inline HashTable *zend_get_target_symbol_table(int fetch_type TSRMLS_DC)
return NULL;
}
-static inline zval **zend_fetch_dimension_address_inner(HashTable *ht, const zval *dim, int dim_type, int type TSRMLS_DC)
+static inline zval *zend_fetch_dimension_address_inner(HashTable *ht, const zval *dim, int dim_type, int type TSRMLS_DC)
{
- zval **retval;
- char *offset_key;
- int offset_key_length;
+ zval *retval;
+ zend_string *offset_key;
ulong hval;
switch (dim->type) {
case IS_NULL:
- offset_key = "";
- offset_key_length = 0;
- hval = zend_inline_hash_func("", 1);
+ offset_key = STR_EMPTY_ALLOC();
goto fetch_string_dim;
case IS_STRING:
-
- offset_key = dim->value.str.val;
- offset_key_length = dim->value.str.len;
-
- if (dim_type == IS_CONST) {
- hval = Z_HASH_P(dim);
- } else {
- ZEND_HANDLE_NUMERIC_EX(offset_key, offset_key_length+1, hval, goto num_index);
- hval = str_hash(offset_key, offset_key_length);
+ offset_key = Z_STR_P(dim);
+ if (dim_type != IS_CONST) {
+ ZEND_HANDLE_NUMERIC_EX(offset_key->val, offset_key->len, hval, goto num_index);
}
fetch_string_dim:
- if (zend_hash_quick_find(ht, offset_key, offset_key_length+1, hval, (void **) &retval) == FAILURE) {
+ retval = zend_hash_find(ht, offset_key);
+ if (retval == NULL) {
switch (type) {
case BP_VAR_R:
- zend_error(E_NOTICE, "Undefined index: %s", offset_key);
+ zend_error(E_NOTICE, "Undefined index: %s", offset_key->val);
/* break missing intentionally */
case BP_VAR_UNSET:
case BP_VAR_IS:
- retval = &EG(uninitialized_zval_ptr);
+ retval = &EG(uninitialized_zval);
break;
case BP_VAR_RW:
- zend_error(E_NOTICE,"Undefined index: %s", offset_key);
+ zend_error(E_NOTICE,"Undefined index: %s", offset_key->val);
/* break missing intentionally */
- case BP_VAR_W: {
- zval *new_zval = &EG(uninitialized_zval);
-
- Z_ADDREF_P(new_zval);
- zend_hash_quick_update(ht, offset_key, offset_key_length+1, hval, &new_zval, sizeof(zval *), (void **) &retval);
- }
+ case BP_VAR_W:
+ retval = zend_hash_update(ht, offset_key, &EG(uninitialized_zval));
break;
}
}
@@ -1051,25 +916,22 @@ fetch_string_dim:
case IS_LONG:
hval = Z_LVAL_P(dim);
num_index:
- if (zend_hash_index_find(ht, hval, (void **) &retval) == FAILURE) {
+ retval = zend_hash_index_find(ht, hval);
+ if (retval == NULL) {
switch (type) {
case BP_VAR_R:
zend_error(E_NOTICE,"Undefined offset: %ld", hval);
/* break missing intentionally */
case BP_VAR_UNSET:
case BP_VAR_IS:
- retval = &EG(uninitialized_zval_ptr);
+ retval = &EG(uninitialized_zval);
break;
case BP_VAR_RW:
zend_error(E_NOTICE,"Undefined offset: %ld", hval);
/* break missing intentionally */
- case BP_VAR_W: {
- zval *new_zval = &EG(uninitialized_zval);
-
- Z_ADDREF_P(new_zval);
- zend_hash_index_update(ht, hval, &new_zval, sizeof(zval *), (void **) &retval);
- }
- break;
+ case BP_VAR_W:
+ retval = zend_hash_index_update(ht, hval, &EG(uninitialized_zval));
+ break;
}
}
break;
@@ -1077,58 +939,50 @@ num_index:
default:
zend_error(E_WARNING, "Illegal offset type");
return (type == BP_VAR_W || type == BP_VAR_RW) ?
- &EG(error_zval_ptr) : &EG(uninitialized_zval_ptr);
+ &EG(error_zval) : &EG(uninitialized_zval);
}
return retval;
}
-static void zend_fetch_dimension_address(temp_variable *result, zval **container_ptr, zval *dim, int dim_type, int type TSRMLS_DC)
+static void zend_fetch_dimension_address(zval *result, zval *container, zval *dim, int dim_type, int type TSRMLS_DC)
{
- zval *container = *container_ptr;
- zval **retval;
+ zval *retval;
- switch (Z_TYPE_P(container)) {
+ if (Z_ISREF_P(container)) {
+ container = Z_REFVAL_P(container);
+ }
+ switch (Z_TYPE_P(container)) {
case IS_ARRAY:
- if (type != BP_VAR_UNSET && Z_REFCOUNT_P(container)>1 && !PZVAL_IS_REF(container)) {
- SEPARATE_ZVAL(container_ptr);
- container = *container_ptr;
+ if (type != BP_VAR_UNSET) {
+ SEPARATE_ZVAL(container);
}
fetch_from_array:
if (dim == NULL) {
- zval *new_zval = &EG(uninitialized_zval);
-
- Z_ADDREF_P(new_zval);
- if (zend_hash_next_index_insert(Z_ARRVAL_P(container), &new_zval, sizeof(zval *), (void **) &retval) == FAILURE) {
+ retval = zend_hash_next_index_insert(Z_ARRVAL_P(container), &EG(uninitialized_zval));
+ if (retval == NULL) {
zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied");
- retval = &EG(error_zval_ptr);
- Z_DELREF_P(new_zval);
+ retval = &EG(error_zval);
}
} else {
retval = zend_fetch_dimension_address_inner(Z_ARRVAL_P(container), dim, dim_type, type TSRMLS_CC);
}
- result->var.ptr_ptr = retval;
- PZVAL_LOCK(*retval);
+ ZVAL_COPY(result, retval);
return;
break;
case IS_NULL:
if (container == &EG(error_zval)) {
- result->var.ptr_ptr = &EG(error_zval_ptr);
- PZVAL_LOCK(EG(error_zval_ptr));
+ result = &EG(error_zval);
} else if (type != BP_VAR_UNSET) {
convert_to_array:
- if (!PZVAL_IS_REF(container)) {
- SEPARATE_ZVAL(container_ptr);
- container = *container_ptr;
- }
+ SEPARATE_ZVAL_IF_NOT_REF(container);
zval_dtor(container);
array_init(container);
goto fetch_from_array;
} else {
/* for read-mode only */
- result->var.ptr_ptr = &EG(uninitialized_zval_ptr);
- PZVAL_LOCK(EG(uninitialized_zval_ptr));
+ ZVAL_NULL(result);
}
return;
break;
@@ -1144,7 +998,7 @@ convert_to_array:
}
if (type != BP_VAR_UNSET) {
- SEPARATE_ZVAL_IF_NOT_REF(container_ptr);
+ SEPARATE_ZVAL_IF_NOT_REF(container);
}
if (Z_TYPE_P(dim) != IS_LONG) {
@@ -1156,7 +1010,7 @@ convert_to_array:
break;
}
if (type != BP_VAR_UNSET) {
- zend_error(E_WARNING, "Illegal string offset '%s'", dim->value.str.val);
+ zend_error(E_WARNING, "Illegal string offset '%s'", Z_STRVAL_P(dim));
}
break;
@@ -1170,16 +1024,12 @@ convert_to_array:
break;
}
- tmp = *dim;
- zval_copy_ctor(&tmp);
+ ZVAL_DUP(&tmp, dim);
convert_to_long(&tmp);
dim = &tmp;
}
- container = *container_ptr;
- result->str_offset.str = container;
- PZVAL_LOCK(container);
- result->str_offset.offset = Z_LVAL_P(dim);
- result->str_offset.ptr_ptr = NULL;
+ ZVAL_STR_OFFSET(result, Z_STR_P(container), Z_LVAL_P(dim));
+ Z_ADDREF_P(container);
return;
}
break;
@@ -1190,38 +1040,37 @@ convert_to_array:
} else {
zval *overloaded_result;
- if (dim_type == IS_TMP_VAR) {
- zval *orig = dim;
- MAKE_REAL_ZVAL_PTR(dim);
- ZVAL_NULL(orig);
- }
+//??? if (dim_type == IS_TMP_VAR) {
+//??? zval *orig = dim;
+//??? MAKE_REAL_ZVAL_PTR(dim);
+//??? ZVAL_NULL(orig);
+//??? }
overloaded_result = Z_OBJ_HT_P(container)->read_dimension(container, dim, type TSRMLS_CC);
if (overloaded_result) {
- if (!Z_ISREF_P(overloaded_result)) {
- if (Z_REFCOUNT_P(overloaded_result) > 0) {
- zval *tmp = overloaded_result;
-
- ALLOC_ZVAL(overloaded_result);
- ZVAL_COPY_VALUE(overloaded_result, tmp);
- zval_copy_ctor(overloaded_result);
- Z_UNSET_ISREF_P(overloaded_result);
- Z_SET_REFCOUNT_P(overloaded_result, 0);
- }
- if (Z_TYPE_P(overloaded_result) != IS_OBJECT) {
- zend_class_entry *ce = Z_OBJCE_P(container);
- zend_error(E_NOTICE, "Indirect modification of overloaded element of %s has no effect", ce->name);
- }
- }
- AI_SET_PTR(result, overloaded_result);
- PZVAL_LOCK(overloaded_result);
+//??? if (!Z_ISREF_P(overloaded_result)) {
+//??? if (Z_REFCOUNT_P(overloaded_result) > 0) {
+//??? zval *tmp = overloaded_result;
+//???
+//??? ALLOC_ZVAL(overloaded_result);
+//??? ZVAL_DUP(overloaded_result, tmp);
+//??? Z_UNSET_ISREF_P(overloaded_result);
+//??? Z_SET_REFCOUNT_P(overloaded_result, 0);
+//??? }
+//??? if (Z_TYPE_P(overloaded_result) != IS_OBJECT) {
+//??? zend_class_entry *ce = Z_OBJCE_P(container);
+//??? zend_error(E_NOTICE, "Indirect modification of overloaded element of %s has no effect", ce->name);
+//??? }
+//??? }
+//??? AI_SET_PTR(result, overloaded_result);
+//??? PZVAL_LOCK(overloaded_result);
+ ZVAL_COPY(result, overloaded_result);
} else {
- result->var.ptr_ptr = &EG(error_zval_ptr);
- PZVAL_LOCK(EG(error_zval_ptr));
- }
- if (dim_type == IS_TMP_VAR) {
- zval_ptr_dtor(&dim);
+ result = &EG(error_zval);
}
+//??? if (dim_type == IS_TMP_VAR) {
+//??? zval_ptr_dtor(&dim);
+//??? }
}
return;
break;
@@ -1235,37 +1084,33 @@ convert_to_array:
default:
if (type == BP_VAR_UNSET) {
zend_error(E_WARNING, "Cannot unset offset in a non-array variable");
- result->var.ptr_ptr = &EG(uninitialized_zval_ptr);
- PZVAL_LOCK(EG(uninitialized_zval_ptr));
+ ZVAL_NULL(result);
} else {
zend_error(E_WARNING, "Cannot use a scalar value as an array");
- result->var.ptr_ptr = &EG(error_zval_ptr);
- PZVAL_LOCK(EG(error_zval_ptr));
+ ZVAL_NULL(result);
}
break;
}
}
-static void zend_fetch_dimension_address_read(temp_variable *result, zval *container, zval *dim, int dim_type, int type TSRMLS_DC)
+static void zend_fetch_dimension_address_read(zval *result, zval *container, zval *dim, int dim_type, int type TSRMLS_DC)
{
- zval **retval;
+ zval *retval;
switch (Z_TYPE_P(container)) {
case IS_ARRAY:
retval = zend_fetch_dimension_address_inner(Z_ARRVAL_P(container), dim, dim_type, type TSRMLS_CC);
- result->var.ptr = *retval;
- PZVAL_LOCK(*retval);
+ ZVAL_COPY(result, retval);
return;
case IS_NULL:
- result->var.ptr = &EG(uninitialized_zval);
- PZVAL_LOCK(&EG(uninitialized_zval));
+ ZVAL_NULL(result);
return;
case IS_STRING: {
zval tmp;
- zval *ptr;
+ zend_string *str;
if (Z_TYPE_P(dim) != IS_LONG) {
switch(Z_TYPE_P(dim)) {
@@ -1275,7 +1120,7 @@ static void zend_fetch_dimension_address_read(temp_variable *result, zval *conta
break;
}
if (type != BP_VAR_IS) {
- zend_error(E_WARNING, "Illegal string offset '%s'", dim->value.str.val);
+ zend_error(E_WARNING, "Illegal string offset '%s'", Z_STRVAL_P(dim));
}
break;
case IS_DOUBLE:
@@ -1290,29 +1135,20 @@ static void zend_fetch_dimension_address_read(temp_variable *result, zval *conta
break;
}
- ZVAL_COPY_VALUE(&tmp, dim);
- zval_copy_ctor(&tmp);
+ ZVAL_DUP(&tmp, dim);
convert_to_long(&tmp);
dim = &tmp;
}
- ALLOC_ZVAL(ptr);
- INIT_PZVAL(ptr);
- Z_TYPE_P(ptr) = IS_STRING;
-
if (Z_LVAL_P(dim) < 0 || Z_STRLEN_P(container) <= Z_LVAL_P(dim)) {
if (type != BP_VAR_IS) {
zend_error(E_NOTICE, "Uninitialized string offset: %ld", Z_LVAL_P(dim));
}
- Z_STRVAL_P(ptr) = STR_EMPTY_ALLOC();
- Z_STRLEN_P(ptr) = 0;
+ str = STR_EMPTY_ALLOC();
} else {
- Z_STRVAL_P(ptr) = (char*)emalloc(2);
- Z_STRVAL_P(ptr)[0] = Z_STRVAL_P(container)[Z_LVAL_P(dim)];
- Z_STRVAL_P(ptr)[1] = 0;
- Z_STRLEN_P(ptr) = 1;
+ str = STR_INIT(Z_STRVAL_P(container) + Z_LVAL_P(dim), 1, 0);
}
- result->var.ptr = ptr;
+ ZVAL_STR(result, str);
return;
}
break;
@@ -1323,43 +1159,37 @@ static void zend_fetch_dimension_address_read(temp_variable *result, zval *conta
} else {
zval *overloaded_result;
- if (dim_type == IS_TMP_VAR) {
- zval *orig = dim;
- MAKE_REAL_ZVAL_PTR(dim);
- ZVAL_NULL(orig);
- }
+//??? if (dim_type == IS_TMP_VAR) {
+//??? zval *orig = dim;
+//??? MAKE_REAL_ZVAL_PTR(dim);
+//??? ZVAL_NULL(orig);
+//??? }
overloaded_result = Z_OBJ_HT_P(container)->read_dimension(container, dim, type TSRMLS_CC);
if (result) {
if (overloaded_result) {
- result->var.ptr = overloaded_result;
- PZVAL_LOCK(overloaded_result);
+ ZVAL_COPY(result, overloaded_result);
} else {
- result->var.ptr = &EG(uninitialized_zval);
- PZVAL_LOCK(&EG(uninitialized_zval));
+ ZVAL_NULL(result);
}
}
- if (dim_type == IS_TMP_VAR) {
- zval_ptr_dtor(&dim);
- }
+//??? if (dim_type == IS_TMP_VAR) {
+//??? zval_ptr_dtor(&dim);
+//??? }
}
return;
default:
- result->var.ptr = &EG(uninitialized_zval);
- PZVAL_LOCK(&EG(uninitialized_zval));
+ ZVAL_NULL(result);
return;
}
}
-static void zend_fetch_property_address(temp_variable *result, zval **container_ptr, zval *prop_ptr, const zend_literal *key, int type TSRMLS_DC)
+static void zend_fetch_property_address(zval *result, zval *container, zval *prop_ptr, const zend_literal *key, int type TSRMLS_DC)
{
- zval *container = *container_ptr;;
-
if (Z_TYPE_P(container) != IS_OBJECT) {
if (container == &EG(error_zval)) {
- result->var.ptr_ptr = &EG(error_zval_ptr);
- PZVAL_LOCK(EG(error_zval_ptr));
+ result = &EG(error_zval);
return;
}
@@ -1368,44 +1198,35 @@ static void zend_fetch_property_address(temp_variable *result, zval **container_
((Z_TYPE_P(container) == IS_NULL ||
(Z_TYPE_P(container) == IS_BOOL && Z_LVAL_P(container)==0) ||
(Z_TYPE_P(container) == IS_STRING && Z_STRLEN_P(container)==0)))) {
- if (!PZVAL_IS_REF(container)) {
- SEPARATE_ZVAL(container_ptr);
- container = *container_ptr;
+ if (!Z_ISREF_P(container)) {
+ SEPARATE_ZVAL(container);
}
object_init(container);
} else {
zend_error(E_WARNING, "Attempt to modify property of non-object");
- result->var.ptr_ptr = &EG(error_zval_ptr);
- PZVAL_LOCK(EG(error_zval_ptr));
+ result = &EG(error_zval);
return;
}
}
if (Z_OBJ_HT_P(container)->get_property_ptr_ptr) {
- zval **ptr_ptr = Z_OBJ_HT_P(container)->get_property_ptr_ptr(container, prop_ptr, type, key TSRMLS_CC);
- if (NULL == ptr_ptr) {
- zval *ptr;
-
+ zval *ptr = Z_OBJ_HT_P(container)->get_property_ptr_ptr(container, prop_ptr, type, key TSRMLS_CC);
+ if (NULL == ptr) {
if (Z_OBJ_HT_P(container)->read_property &&
(ptr = Z_OBJ_HT_P(container)->read_property(container, prop_ptr, type, key TSRMLS_CC)) != NULL) {
- AI_SET_PTR(result, ptr);
- PZVAL_LOCK(ptr);
+ ZVAL_COPY(result, ptr);
} else {
zend_error_noreturn(E_ERROR, "Cannot access undefined property for object with overloaded property access");
}
} else {
- result->var.ptr_ptr = ptr_ptr;
- PZVAL_LOCK(*ptr_ptr);
+ ZVAL_COPY(result, ptr);
}
} else if (Z_OBJ_HT_P(container)->read_property) {
zval *ptr = Z_OBJ_HT_P(container)->read_property(container, prop_ptr, type, key TSRMLS_CC);
-
- AI_SET_PTR(result, ptr);
- PZVAL_LOCK(ptr);
+ ZVAL_COPY(result, ptr);
} else {
zend_error(E_WARNING, "This object doesn't support property references");
- result->var.ptr_ptr = &EG(error_zval_ptr);
- PZVAL_LOCK(EG(error_zval_ptr));
+ result = &EG(error_zval);
}
}
@@ -1425,12 +1246,12 @@ static inline zend_brk_cont_element* zend_brk_cont(int nest_levels, int array_of
switch (brk_opline->opcode) {
case ZEND_SWITCH_FREE:
if (!(brk_opline->extended_value & EXT_TYPE_FREE_ON_RETURN)) {
- zval_ptr_dtor(&EX_T(brk_opline->op1.var).var.ptr);
+ zval_ptr_dtor(EX_VAR(brk_opline->op1.var));
}
break;
case ZEND_FREE:
if (!(brk_opline->extended_value & EXT_TYPE_FREE_ON_RETURN)) {
- zendi_zval_dtor(EX_T(brk_opline->op1.var).tmp_var);
+ zval_dtor(EX_VAR(brk_opline->op1.var));
}
break;
}
@@ -1478,14 +1299,14 @@ ZEND_API void execute_internal(zend_execute_data *execute_data_ptr, zend_fcall_i
{
if (fci != NULL) {
execute_data_ptr->function_state.function->internal_function.handler(
- fci->param_count, *fci->retval_ptr_ptr, fci->retval_ptr_ptr,
+ fci->param_count, fci->retval,
fci->object_ptr, 1 TSRMLS_CC
);
} else {
- zval **return_value_ptr = &EX_TMP_VAR(execute_data_ptr, execute_data_ptr->opline->result.var)->var.ptr;
+ zval *return_value = EX_VAR_2(execute_data_ptr, execute_data_ptr->opline->result.var);
execute_data_ptr->function_state.function->internal_function.handler(
- execute_data_ptr->opline->extended_value, *return_value_ptr, return_value_ptr,
- execute_data_ptr->object, return_value_used TSRMLS_CC
+ execute_data_ptr->opline->extended_value, return_value,
+ &execute_data_ptr->object, return_value_used TSRMLS_CC
);
}
}
@@ -1506,12 +1327,10 @@ void zend_clean_and_cache_symbol_table(HashTable *symbol_table TSRMLS_DC) /* {{{
static zend_always_inline void i_free_compiled_variables(zend_execute_data *execute_data TSRMLS_DC) /* {{{ */
{
- zval ***cv = EX_CV_NUM(execute_data, 0);
- zval ***end = cv + EX(op_array)->last_var;
+ zval *cv = EX_VAR_NUM_2(execute_data, 0);
+ zval *end = cv + EX(op_array)->last_var;
while (cv != end) {
- if (*cv) {
- zval_ptr_dtor(*cv);
- }
+ zval_ptr_dtor(cv);
cv++;
}
}
@@ -1538,20 +1357,15 @@ void zend_free_compiled_variables(zend_execute_data *execute_data TSRMLS_DC) /*
* +========================================+ |
* |
* +========================================+ |
- * | TMP_VAR[op_arrat->T-1] | |
- * | ... | |
- * EX_TMP_VAR_NUM(0) ----> | TMP_VAR[0] | |
- * +----------------------------------------+ |
* EG(current_execute_data) -> | zend_execute_data | |
* | EX(prev_execute_data) |----+
* +----------------------------------------+
- * EX_CV_NUM(0) ---------> | CV[0] |--+
- * | ... | |
- * | CV[op_array->last_var-1] | |
- * +----------------------------------------+ |
- * | Optional slot for CV[0] zval* |<-+
+ * EX_CV_NUM(0) ---------> | VAR[0] |
+ * | ... |
+ * | VAR[op_array->last_var-1] |
+ * | VAR[op_array->last_var] |
* | ... |
- * | ...for CV [op_array->last_var-1] zval* |
+ * | VAR[op_array->T-1] |
* +----------------------------------------+
* EX(call_slots) -> | CALL_SLOT[0] |
* | ... |
@@ -1581,11 +1395,10 @@ static zend_always_inline zend_execute_data *i_create_execute_data_from_op_array
* half the actual zval*s (which would otherwise be in the symbol table).
*/
size_t execute_data_size = ZEND_MM_ALIGNED_SIZE(sizeof(zend_execute_data));
- size_t CVs_size = ZEND_MM_ALIGNED_SIZE(sizeof(zval **) * op_array->last_var * (EG(active_symbol_table) ? 1 : 2));
- size_t Ts_size = ZEND_MM_ALIGNED_SIZE(sizeof(temp_variable)) * op_array->T;
+ size_t vars_size = ZEND_MM_ALIGNED_SIZE(sizeof(zval)) * (op_array->last_var + op_array->T);
size_t call_slots_size = ZEND_MM_ALIGNED_SIZE(sizeof(call_slot)) * op_array->nested_calls;
- size_t stack_size = ZEND_MM_ALIGNED_SIZE(sizeof(zval*)) * op_array->used_stack;
- size_t total_size = execute_data_size + Ts_size + CVs_size + call_slots_size + stack_size;
+ size_t stack_size = ZEND_MM_ALIGNED_SIZE(sizeof(zval)) * op_array->used_stack;
+ size_t total_size = execute_data_size + vars_size + call_slots_size + stack_size;
/*
* Normally the execute_data is allocated on the VM stack (because it does
@@ -1608,44 +1421,42 @@ static zend_always_inline zend_execute_data *i_create_execute_data_from_op_array
EG(argument_stack) = zend_vm_stack_new_page((total_size + (sizeof(void*) - 1)) / sizeof(void*));
EG(argument_stack)->prev = NULL;
- execute_data = (zend_execute_data*)((char*)ZEND_VM_STACK_ELEMETS(EG(argument_stack)) + args_size + execute_data_size + Ts_size);
+ execute_data = (zend_execute_data*)((char*)ZEND_VM_STACK_ELEMETS(EG(argument_stack)) + args_size + execute_data_size + vars_size);
/* copy prev_execute_data */
EX(prev_execute_data) = (zend_execute_data*)((char*)ZEND_VM_STACK_ELEMETS(EG(argument_stack)) + args_size);
memset(EX(prev_execute_data), 0, sizeof(zend_execute_data));
EX(prev_execute_data)->function_state.function = (zend_function*)op_array;
- EX(prev_execute_data)->function_state.arguments = (void**)((char*)ZEND_VM_STACK_ELEMETS(EG(argument_stack)) + ZEND_MM_ALIGNED_SIZE(sizeof(zval*)) * args_count);
+ EX(prev_execute_data)->function_state.arguments = (zval*)((char*)ZEND_VM_STACK_ELEMETS(EG(argument_stack)) + ZEND_MM_ALIGNED_SIZE(sizeof(zval)) * args_count);
/* copy arguments */
- *EX(prev_execute_data)->function_state.arguments = (void*)(zend_uintptr_t)args_count;
+ ZVAL_LONG(EX(prev_execute_data)->function_state.arguments, args_count);
if (args_count > 0) {
- zval **arg_src = (zval**)zend_vm_stack_get_arg_ex(EG(current_execute_data), 1);
- zval **arg_dst = (zval**)zend_vm_stack_get_arg_ex(EX(prev_execute_data), 1);
+ zval *arg_src = zend_vm_stack_get_arg_ex(EG(current_execute_data), 1);
+ zval *arg_dst = zend_vm_stack_get_arg_ex(EX(prev_execute_data), 1);
int i;
for (i = 0; i < args_count; i++) {
- arg_dst[i] = arg_src[i];
- Z_ADDREF_P(arg_dst[i]);
+ ZVAL_COPY(arg_dst + i, arg_src + i);
}
}
} else {
execute_data = zend_vm_stack_alloc(total_size TSRMLS_CC);
- execute_data = (zend_execute_data*)((char*)execute_data + Ts_size);
EX(prev_execute_data) = EG(current_execute_data);
}
- memset(EX_CV_NUM(execute_data, 0), 0, sizeof(zval **) * op_array->last_var);
+ memset(EX_VAR_NUM_2(execute_data, 0), 0, sizeof(zval) * op_array->last_var);
- EX(call_slots) = (call_slot*)((char *)execute_data + execute_data_size + CVs_size);
+ EX(call_slots) = (call_slot*)((char *)execute_data + execute_data_size + vars_size);
EX(op_array) = op_array;
- EG(argument_stack)->top = zend_vm_stack_frame_base(execute_data);
+ EG(argument_stack)->top = (zval*)zend_vm_stack_frame_base(execute_data);
- EX(object) = NULL;
- EX(current_this) = NULL;
- EX(old_error_reporting) = NULL;
+ ZVAL_UNDEF(&EX(object));
+//??? EX(current_this) = NULL;
+ ZVAL_UNDEF(&EX(old_error_reporting));
EX(symbol_table) = EG(active_symbol_table);
EX(call) = NULL;
EG(current_execute_data) = execute_data;
@@ -1656,14 +1467,14 @@ static zend_always_inline zend_execute_data *i_create_execute_data_from_op_array
op_array->run_time_cache = ecalloc(op_array->last_cache_slot, sizeof(void*));
}
- if (op_array->this_var != -1 && EG(This)) {
- Z_ADDREF_P(EG(This)); /* For $this pointer */
+ if (op_array->this_var != -1 && Z_TYPE(EG(This)) != IS_UNDEF) {
if (!EG(active_symbol_table)) {
- EX_CV(op_array->this_var) = (zval **) EX_CV_NUM(execute_data, op_array->last_var + op_array->this_var);
- *EX_CV(op_array->this_var) = EG(This);
+ ZVAL_COPY(EX_VAR(op_array->this_var), &EG(This));
} else {
- if (zend_hash_add(EG(active_symbol_table), "this", sizeof("this"), &EG(This), sizeof(zval *), (void **) EX_CV_NUM(execute_data, op_array->this_var))==FAILURE) {
- Z_DELREF_P(EG(This));
+ ZVAL_COPY(EX_VAR(op_array->this_var), &EG(This));
+ zval *zv = zend_hash_str_add(EG(active_symbol_table), "this", sizeof("this")-1, EX_VAR(op_array->this_var));
+ if (zv) {
+ Z_ADDREF(EG(This));
}
}
}
@@ -1691,16 +1502,16 @@ static zend_always_inline zend_bool zend_is_by_ref_func_arg_fetch(zend_op *oplin
}
/* }}} */
-static void **zend_vm_stack_push_args_with_copy(int count TSRMLS_DC) /* {{{ */
+static zval *zend_vm_stack_push_args_with_copy(int count TSRMLS_DC) /* {{{ */
{
zend_vm_stack p = EG(argument_stack);
zend_vm_stack_extend(count + 1 TSRMLS_CC);
EG(argument_stack)->top += count;
- *(EG(argument_stack)->top) = (void*)(zend_uintptr_t)count;
+ ZVAL_LONG(EG(argument_stack)->top, count);
while (count-- > 0) {
- void *data = *(--p->top);
+ zval *data = --p->top;
if (UNEXPECTED(p->top == ZEND_VM_STACK_ELEMETS(p))) {
zend_vm_stack r = p;
@@ -1709,19 +1520,19 @@ static void **zend_vm_stack_push_args_with_copy(int count TSRMLS_DC) /* {{{ */
p = p->prev;
efree(r);
}
- *(ZEND_VM_STACK_ELEMETS(EG(argument_stack)) + count) = data;
+ ZVAL_COPY_VALUE(ZEND_VM_STACK_ELEMETS(EG(argument_stack)) + count, data);
}
return EG(argument_stack)->top++;
}
/* }}} */
-static zend_always_inline void** zend_vm_stack_push_args(int count TSRMLS_DC) /* {{{ */
+static zend_always_inline zval *zend_vm_stack_push_args(int count TSRMLS_DC) /* {{{ */
{
if (UNEXPECTED(EG(argument_stack)->top - ZEND_VM_STACK_ELEMETS(EG(argument_stack)) < count)
|| UNEXPECTED(EG(argument_stack)->top == EG(argument_stack)->end)) {
return zend_vm_stack_push_args_with_copy(count TSRMLS_CC);
}
- *(EG(argument_stack)->top) = (void*)(zend_uintptr_t)count;
+ ZVAL_LONG(EG(argument_stack)->top, count);
return EG(argument_stack)->top++;
}
/* }}} */
@@ -1779,10 +1590,6 @@ ZEND_API zval *zend_get_zval_ptr(int op_type, const znode_op *node, const zend_e
return get_zval_ptr(op_type, node, execute_data, should_free, type);
}
-ZEND_API zval **zend_get_zval_ptr_ptr(int op_type, const znode_op *node, const zend_execute_data *execute_data, zend_free_op *should_free, int type TSRMLS_DC) {
- return get_zval_ptr_ptr(op_type, node, execute_data, should_free, type);
-}
-
/*
* Local variables:
* tab-width: 4
diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h
index e79b945cc7..96f06d6968 100644
--- a/Zend/zend_execute.h
+++ b/Zend/zend_execute.h
@@ -27,26 +27,25 @@
#include "zend_operators.h"
#include "zend_variables.h"
-typedef union _temp_variable {
- zval tmp_var;
- struct {
- zval **ptr_ptr;
- zval *ptr;
- zend_bool fcall_returned_reference;
- } var;
- struct {
- zval **ptr_ptr; /* shared with var.ptr_ptr */
- zval *str;
- zend_uint offset;
- } str_offset;
- struct {
- zval **ptr_ptr; /* shared with var.ptr_ptr */
- zval *ptr; /* shared with var.ptr */
- HashPointer fe_pos;
- } fe;
- zend_class_entry *class_entry;
-} temp_variable;
-
+//???typedef union _temp_variable {
+//??? zval tmp_var;
+//??? struct {
+//??? zval **ptr_ptr;
+//??? zval *ptr;
+//??? zend_bool fcall_returned_reference;
+//??? } var;
+//??? struct {
+//??? zval **ptr_ptr; /* shared with var.ptr_ptr */
+//??? zval *str;
+//??? zend_uint offset;
+//??? } str_offset;
+//??? struct {
+//??? zval **ptr_ptr; /* shared with var.ptr_ptr */
+//??? zval *ptr; /* shared with var.ptr */
+//??? HashPointer fe_pos;
+//??? } fe;
+//??? zend_class_entry *class_entry;
+//???} temp_variable;
BEGIN_EXTERN_C()
struct _zend_fcall_info;
@@ -61,14 +60,14 @@ ZEND_API void zend_execute(zend_op_array *op_array TSRMLS_DC);
ZEND_API void execute_ex(zend_execute_data *execute_data TSRMLS_DC);
ZEND_API void execute_internal(zend_execute_data *execute_data_ptr, struct _zend_fcall_info *fci, int return_value_used TSRMLS_DC);
ZEND_API int zend_is_true(zval *op TSRMLS_DC);
-ZEND_API int zend_lookup_class(const char *name, int name_length, zend_class_entry ***ce TSRMLS_DC);
-ZEND_API int zend_lookup_class_ex(const char *name, int name_length, const zend_literal *key, int use_autoload, zend_class_entry ***ce TSRMLS_DC);
+ZEND_API zend_class_entry *zend_lookup_class(zend_string *name TSRMLS_DC);
+ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, const zend_literal *key, int use_autoload TSRMLS_DC);
ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSRMLS_DC);
ZEND_API int zend_eval_stringl(char *str, int str_len, zval *retval_ptr, char *string_name TSRMLS_DC);
ZEND_API int zend_eval_string_ex(char *str, zval *retval_ptr, char *string_name, int handle_exceptions TSRMLS_DC);
ZEND_API int zend_eval_stringl_ex(char *str, int str_len, zval *retval_ptr, char *string_name, int handle_exceptions TSRMLS_DC);
-ZEND_API char * zend_verify_arg_class_kind(const zend_arg_info *cur_arg_info, ulong fetch_type, const char **class_name, zend_class_entry **pce TSRMLS_DC);
+ZEND_API char * zend_verify_arg_class_kind(const zend_arg_info *cur_arg_info, ulong fetch_type, char **class_name, zend_class_entry **pce TSRMLS_DC);
ZEND_API int zend_verify_arg_error(int error_type, const zend_function *zf, zend_uint arg_num, const char *need_msg, const char *need_kind, const char *given_msg, const char *given_kind TSRMLS_DC);
static zend_always_inline void i_zval_ptr_dtor(zval *zval_ptr ZEND_FILE_LINE_DC TSRMLS_DC)
@@ -79,8 +78,11 @@ static zend_always_inline void i_zval_ptr_dtor(zval *zval_ptr ZEND_FILE_LINE_DC
zval_dtor(zval_ptr);
efree_rel(zval_ptr);
} else {
- if (Z_REFCOUNT_P(zval_ptr) == 1) {
- Z_UNSET_ISREF_P(zval_ptr);
+ if (Z_REFCOUNT_P(zval_ptr) == 1 && Z_TYPE_P(zval_ptr) == IS_REFERENCE) {
+ /* convert reference to regular value */
+ zend_reference *ref = Z_REF_P(zval_ptr);
+ *zval_ptr = ref->val;
+ efree_rel(ref);
}
GC_ZVAL_CHECK_POSSIBLE_ROOT(zval_ptr);
@@ -95,8 +97,11 @@ static zend_always_inline void i_zval_ptr_dtor_nogc(zval *zval_ptr ZEND_FILE_LIN
zval_dtor(zval_ptr);
efree_rel(zval_ptr);
} else {
- if (Z_REFCOUNT_P(zval_ptr) == 1) {
- Z_UNSET_ISREF_P(zval_ptr);
+ if (Z_REFCOUNT_P(zval_ptr) == 1 && Z_TYPE_P(zval_ptr) == IS_REFERENCE) {
+ /* convert reference to regular value */
+ zend_reference *ref = Z_REF_P(zval_ptr);
+ *zval_ptr = ref->val;
+ efree_rel(ref);
}
}
}
@@ -142,7 +147,7 @@ static zend_always_inline int i_zend_is_true(zval *op TSRMLS_DC)
/* for safety - avoid loop */
convert_to_boolean(tmp);
result = Z_LVAL_P(tmp);
- zval_ptr_dtor(&tmp);
+ zval_ptr_dtor(tmp);
break;
}
}
@@ -156,22 +161,22 @@ static zend_always_inline int i_zend_is_true(zval *op TSRMLS_DC)
return result;
}
-ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC);
-ZEND_API int zval_update_constant_inline_change(zval **pp, void *arg TSRMLS_DC);
-ZEND_API int zval_update_constant_no_inline_change(zval **pp, void *arg TSRMLS_DC);
-ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *scope TSRMLS_DC);
+ZEND_API int zval_update_constant(zval *pp, void *arg TSRMLS_DC);
+ZEND_API int zval_update_constant_inline_change(zval *pp, void *arg TSRMLS_DC);
+ZEND_API int zval_update_constant_no_inline_change(zval *pp, void *arg TSRMLS_DC);
+ZEND_API int zval_update_constant_ex(zval *pp, void *arg, zend_class_entry *scope TSRMLS_DC);
/* dedicated Zend executor functions - do not use! */
#define ZEND_VM_STACK_PAGE_SIZE ((16 * 1024) - 16)
struct _zend_vm_stack {
- void **top;
- void **end;
+ zval *top;
+ zval *end;
zend_vm_stack prev;
};
#define ZEND_VM_STACK_ELEMETS(stack) \
- ((void**)(((char*)(stack)) + ZEND_MM_ALIGNED_SIZE(sizeof(struct _zend_vm_stack))))
+ ((zval*)(((char*)(stack)) + ZEND_MM_ALIGNED_SIZE(sizeof(struct _zend_vm_stack))))
#define ZEND_VM_STACK_GROW_IF_NEEDED(count) \
do { \
@@ -213,124 +218,86 @@ static zend_always_inline void zend_vm_stack_extend(int count TSRMLS_DC)
EG(argument_stack) = p;
}
-static zend_always_inline void **zend_vm_stack_top(TSRMLS_D)
+static zend_always_inline zval *zend_vm_stack_top(TSRMLS_D)
{
return EG(argument_stack)->top;
}
-static zend_always_inline void zend_vm_stack_push(void *ptr TSRMLS_DC)
+static zend_always_inline void zend_vm_stack_push(zval *ptr TSRMLS_DC)
{
- *(EG(argument_stack)->top++) = ptr;
+ *(EG(argument_stack)->top++) = *ptr;
}
-static zend_always_inline void *zend_vm_stack_pop(TSRMLS_D)
+static zend_always_inline zval *zend_vm_stack_pop(TSRMLS_D)
{
- void *el = *(--EG(argument_stack)->top);
-
- return el;
+ return --EG(argument_stack)->top;
}
static zend_always_inline void *zend_vm_stack_alloc(size_t size TSRMLS_DC)
{
- void *ret;
-
- size = (size + (sizeof(void*) - 1)) / sizeof(void*);
-
- /* the following comparison must be optimized out at compile time */
- if (ZEND_MM_ALIGNMENT > sizeof(void*)) {
- int extra = (ZEND_MM_ALIGNMENT - ((zend_uintptr_t)EG(argument_stack)->top & (ZEND_MM_ALIGNMENT - 1))) / sizeof(void*);
-
- if (UNEXPECTED(size + extra + ZEND_MM_ALIGNED_SIZE(sizeof(void*)) / sizeof(void*) >
- (zend_uintptr_t)(EG(argument_stack)->end - EG(argument_stack)->top))) {
- zend_vm_stack_extend(size TSRMLS_CC);
- } else {
- void **old_top = EG(argument_stack)->top;
+ zval *ret;
+ int count = (size + (sizeof(zval) - 1)) / sizeof(zval);
- EG(argument_stack)->top += extra;
- /* store old top on the stack */
- *EG(argument_stack)->top = (void*)old_top;
- EG(argument_stack)->top += ZEND_MM_ALIGNED_SIZE(sizeof(void*)) / sizeof(void*);
- }
- } else {
- ZEND_VM_STACK_GROW_IF_NEEDED((int)size);
- }
+ ZEND_VM_STACK_GROW_IF_NEEDED(count);
ret = (void*)EG(argument_stack)->top;
- EG(argument_stack)->top += size;
+ EG(argument_stack)->top += count;
return ret;
}
-static zend_always_inline void** zend_vm_stack_frame_base(zend_execute_data *ex)
+static zend_always_inline zval* zend_vm_stack_frame_base(zend_execute_data *ex)
{
- return (void**)((char*)ex->call_slots +
- ZEND_MM_ALIGNED_SIZE(sizeof(call_slot)) * ex->op_array->nested_calls);
-}
-
-static zend_always_inline void zend_vm_stack_free_int(void *ptr TSRMLS_DC)
-{
- if (UNEXPECTED(ZEND_VM_STACK_ELEMETS(EG(argument_stack)) == (void**)ptr)) {
- zend_vm_stack p = EG(argument_stack);
-
- EG(argument_stack) = p->prev;
- efree(p);
- } else {
- EG(argument_stack)->top = (void**)ptr;
- }
+//??? return (void**)((char*)ex->call_slots +
+//??? ZEND_MM_ALIGNED_SIZE(sizeof(call_slot)) * ex->op_array->nested_calls);
+ return NULL;
}
static zend_always_inline void zend_vm_stack_free(void *ptr TSRMLS_DC)
{
- if (UNEXPECTED(ZEND_VM_STACK_ELEMETS(EG(argument_stack)) == (void**)ptr)) {
+ if (UNEXPECTED((void*)ZEND_VM_STACK_ELEMETS(EG(argument_stack)) == ptr)) {
zend_vm_stack p = EG(argument_stack);
EG(argument_stack) = p->prev;
efree(p);
} else {
- /* the following comparison must be optimized out at compile time */
- if (ZEND_MM_ALIGNMENT > sizeof(void*)) {
- ptr = (void*)(((char*)ptr) - ZEND_MM_ALIGNED_SIZE(sizeof(void*)));
- EG(argument_stack)->top = *(void***)ptr;
- } else {
- EG(argument_stack)->top = (void**)ptr;
- }
+ EG(argument_stack)->top = (zval*)ptr;
}
}
static zend_always_inline void zend_vm_stack_clear_multiple(int nested TSRMLS_DC)
{
- void **p = EG(argument_stack)->top - 1;
- void **end = p - (int)(zend_uintptr_t)*p;
+ zval *p = EG(argument_stack)->top - 1;
+ zval *end = p - Z_LVAL_P(p);
while (p != end) {
- zval *q = (zval *) *(--p);
- *p = NULL;
- i_zval_ptr_dtor(q ZEND_FILE_LINE_CC TSRMLS_CC);
+ p--;
+ i_zval_ptr_dtor(p ZEND_FILE_LINE_CC TSRMLS_CC);
}
if (nested) {
EG(argument_stack)->top = p;
} else {
- zend_vm_stack_free_int(p TSRMLS_CC);
+ zend_vm_stack_free(p TSRMLS_CC);
}
}
static zend_always_inline int zend_vm_stack_get_args_count_ex(zend_execute_data *ex)
{
if (ex) {
- void **p = ex->function_state.arguments;
- return (int)(zend_uintptr_t) *p;
+ zval *p = ex->function_state.arguments;
+ return Z_LVAL_P(p);
} else {
return 0;
}
}
-static zend_always_inline zval** zend_vm_stack_get_arg_ex(zend_execute_data *ex, int requested_arg)
+static zend_always_inline zval* zend_vm_stack_get_arg_ex(zend_execute_data *ex, int requested_arg)
{
- void **p = ex->function_state.arguments;
- int arg_count = (int)(zend_uintptr_t) *p;
+ zval *p = ex->function_state.arguments;
+ int arg_count = Z_LVAL_P(p);
if (UNEXPECTED(requested_arg > arg_count)) {
return NULL;
}
- return (zval**)p - arg_count + requested_arg - 1;
+ return (zval*)p - arg_count + requested_arg - 1;
}
static zend_always_inline int zend_vm_stack_get_args_count(TSRMLS_D)
@@ -338,7 +305,7 @@ static zend_always_inline int zend_vm_stack_get_args_count(TSRMLS_D)
return zend_vm_stack_get_args_count_ex(EG(current_execute_data)->prev_execute_data);
}
-static zend_always_inline zval** zend_vm_stack_get_arg(int requested_arg TSRMLS_DC)
+static zend_always_inline zval* zend_vm_stack_get_arg(int requested_arg TSRMLS_DC)
{
return zend_vm_stack_get_arg_ex(EG(current_execute_data)->prev_execute_data, requested_arg);
}
@@ -356,8 +323,8 @@ ZEND_API zend_bool zend_is_executing(TSRMLS_D);
ZEND_API void zend_set_timeout(long seconds, int reset_signals);
ZEND_API void zend_unset_timeout(TSRMLS_D);
ZEND_API void zend_timeout(int dummy);
-ZEND_API zend_class_entry *zend_fetch_class(const char *class_name, uint class_name_len, int fetch_type TSRMLS_DC);
-ZEND_API zend_class_entry *zend_fetch_class_by_name(const char *class_name, uint class_name_len, const zend_literal *key, int fetch_type TSRMLS_DC);
+ZEND_API zend_class_entry *zend_fetch_class(zend_string *class_name, int fetch_type TSRMLS_DC);
+ZEND_API zend_class_entry *zend_fetch_class_by_name(zend_string *class_name, const zend_literal *key, int fetch_type TSRMLS_DC);
void zend_verify_abstract_class(zend_class_entry *ce TSRMLS_DC);
#ifdef ZEND_WIN32
@@ -367,17 +334,14 @@ void zend_shutdown_timeout_thread(void);
#define WM_UNREGISTER_ZEND_TIMEOUT (WM_USER+2)
#endif
-#define zendi_zval_copy_ctor(p) zval_copy_ctor(&(p))
-#define zendi_zval_dtor(p) zval_dtor(&(p))
-
#define active_opline (*EG(opline_ptr))
/* The following tries to resolve the classname of a zval of type object.
* Since it is slow it should be only used in error messages.
*/
-#define Z_OBJ_CLASS_NAME_P(zval) ((zval) && Z_TYPE_P(zval) == IS_OBJECT && Z_OBJ_HT_P(zval)->get_class_entry != NULL && Z_OBJ_HT_P(zval)->get_class_entry(zval TSRMLS_CC) ? Z_OBJ_HT_P(zval)->get_class_entry(zval TSRMLS_CC)->name : "")
+#define Z_OBJ_CLASS_NAME_P(zval) ((zval) && Z_TYPE_P(zval) == IS_OBJECT && Z_OBJ_HT_P(zval)->get_class_entry != NULL && Z_OBJ_HT_P(zval)->get_class_entry(zval TSRMLS_CC) ? Z_OBJ_HT_P(zval)->get_class_entry(zval TSRMLS_CC)->name->val : "")
-ZEND_API zval** zend_get_compiled_variable_value(const zend_execute_data *execute_data_ptr, zend_uint var);
+ZEND_API zval* zend_get_compiled_variable_value(const zend_execute_data *execute_data_ptr, zend_uint var);
#define ZEND_USER_OPCODE_CONTINUE 0 /* execute next opcode */
#define ZEND_USER_OPCODE_RETURN 1 /* exit from executor (return from function) */
@@ -397,7 +361,6 @@ typedef struct _zend_free_op {
} zend_free_op;
ZEND_API zval *zend_get_zval_ptr(int op_type, const znode_op *node, const zend_execute_data *execute_data, zend_free_op *should_free, int type TSRMLS_DC);
-ZEND_API zval **zend_get_zval_ptr_ptr(int op_type, const znode_op *node, const zend_execute_data *execute_data, zend_free_op *should_free, int type TSRMLS_DC);
ZEND_API int zend_do_fcall(ZEND_OPCODE_HANDLER_ARGS);
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index 3988074779..c2be5c90c3 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -26,7 +26,7 @@
#include "zend_compile.h"
#include "zend_execute.h"
#include "zend_API.h"
-#include "zend_ptr_stack.h"
+#include "zend_stack.h"
#include "zend_constants.h"
#include "zend_extensions.h"
#include "zend_exceptions.h"
@@ -42,8 +42,8 @@ ZEND_API void (*zend_execute_ex)(zend_execute_data *execute_data TSRMLS_DC);
ZEND_API void (*zend_execute_internal)(zend_execute_data *execute_data_ptr, zend_fcall_info *fci, int return_value_used TSRMLS_DC);
/* true globals */
-ZEND_API const zend_fcall_info empty_fcall_info = { 0, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0 };
-ZEND_API const zend_fcall_info_cache empty_fcall_info_cache = { 0, NULL, NULL, NULL, NULL };
+//???ZEND_API const zend_fcall_info empty_fcall_info = { 0, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0 };
+//???ZEND_API const zend_fcall_info_cache empty_fcall_info_cache = { 0, NULL, NULL, NULL, NULL };
#ifdef ZEND_WIN32
#include <process.h>
@@ -131,17 +131,14 @@ void init_executor(TSRMLS_D) /* {{{ */
{
zend_init_fpu(TSRMLS_C);
- INIT_ZVAL(EG(uninitialized_zval));
+ ZVAL_NULL(&EG(uninitialized_zval));
/* trick to make uninitialized_zval never be modified, passed by ref, etc. */
- Z_ADDREF(EG(uninitialized_zval));
- INIT_ZVAL(EG(error_zval));
- EG(uninitialized_zval_ptr)=&EG(uninitialized_zval);
- EG(error_zval_ptr)=&EG(error_zval);
+ ZVAL_NULL(&EG(error_zval));
/* destroys stack frame, therefore makes core dumps worthless */
#if 0&&ZEND_DEBUG
original_sigsegv_handler = signal(SIGSEGV, zend_handle_sigsegv);
#endif
- EG(return_value_ptr_ptr) = NULL;
+//??? EG(return_value_ptr_ptr) = NULL;
EG(symtable_cache_ptr) = EG(symtable_cache) - 1;
EG(symtable_cache_limit) = EG(symtable_cache) + SYMTABLE_CACHE_SIZE - 1;
@@ -158,8 +155,8 @@ void init_executor(TSRMLS_D) /* {{{ */
zend_vm_stack_init(TSRMLS_C);
zend_vm_stack_push((void *) NULL TSRMLS_CC);
- zend_hash_init(&EG(symbol_table), 50, NULL, ZVAL_PTR_DTOR, 0);
- EG(active_symbol_table) = &EG(symbol_table);
+ zend_hash_init(&EG(symbol_table).ht, 50, NULL, ZVAL_PTR_DTOR, 0);
+ EG(active_symbol_table) = &EG(symbol_table).ht;
zend_llist_apply(&zend_extensions, (llist_apply_func_t) zend_extension_activator TSRMLS_CC);
EG(opline_ptr) = NULL;
@@ -168,13 +165,13 @@ void init_executor(TSRMLS_D) /* {{{ */
EG(ticks_count) = 0;
- EG(user_error_handler) = NULL;
+ ZVAL_UNDEF(&EG(user_error_handler));
EG(current_execute_data) = NULL;
zend_stack_init(&EG(user_error_handlers_error_reporting));
- zend_ptr_stack_init(&EG(user_error_handlers));
- zend_ptr_stack_init(&EG(user_exception_handlers));
+ zend_stack_init(&EG(user_error_handlers));
+ zend_stack_init(&EG(user_exception_handlers));
zend_objects_store_init(&EG(objects_store), 1024);
@@ -189,7 +186,7 @@ void init_executor(TSRMLS_D) /* {{{ */
EG(scope) = NULL;
EG(called_scope) = NULL;
- EG(This) = NULL;
+ ZVAL_UNDEF(&EG(This));
EG(active_op_array) = NULL;
@@ -198,9 +195,9 @@ void init_executor(TSRMLS_D) /* {{{ */
}
/* }}} */
-static int zval_call_destructor(zval **zv TSRMLS_DC) /* {{{ */
+static int zval_call_destructor(zval *zv TSRMLS_DC) /* {{{ */
{
- if (Z_TYPE_PP(zv) == IS_OBJECT && Z_REFCOUNT_PP(zv) == 1) {
+ if (Z_TYPE_P(zv) == IS_OBJECT && Z_REFCOUNT_P(zv) == 1) {
return ZEND_HASH_APPLY_REMOVE;
} else {
return ZEND_HASH_APPLY_KEEP;
@@ -213,9 +210,9 @@ void shutdown_destructors(TSRMLS_D) /* {{{ */
zend_try {
int symbols;
do {
- symbols = zend_hash_num_elements(&EG(symbol_table));
- zend_hash_reverse_apply(&EG(symbol_table), (apply_func_t) zval_call_destructor TSRMLS_CC);
- } while (symbols != zend_hash_num_elements(&EG(symbol_table)));
+ symbols = zend_hash_num_elements(&EG(symbol_table).ht);
+ zend_hash_reverse_apply(&EG(symbol_table).ht, (apply_func_t) zval_call_destructor TSRMLS_CC);
+ } while (symbols != zend_hash_num_elements(&EG(symbol_table).ht));
zend_objects_store_call_destructors(&EG(objects_store) TSRMLS_CC);
} zend_catch {
/* if we couldn't destruct cleanly, mark all objects as destructed anyway */
@@ -244,29 +241,29 @@ void shutdown_executor(TSRMLS_D) /* {{{ */
}
*/
zend_llist_apply(&zend_extensions, (llist_apply_func_t) zend_extension_deactivator TSRMLS_CC);
- zend_hash_graceful_reverse_destroy(&EG(symbol_table));
+ zend_hash_graceful_reverse_destroy(&EG(symbol_table).ht);
} zend_end_try();
zend_try {
zval *zeh;
/* remove error handlers before destroying classes and functions,
* so that if handler used some class, crash would not happen */
- if (EG(user_error_handler)) {
- zeh = EG(user_error_handler);
- EG(user_error_handler) = NULL;
- zval_ptr_dtor(&zeh);
+ if (Z_TYPE(EG(user_error_handler)) != IS_UNDEF) {
+ zeh = &EG(user_error_handler);
+ ZVAL_UNDEF(&EG(user_error_handler));
+ zval_ptr_dtor(zeh);
}
- if (EG(user_exception_handler)) {
- zeh = EG(user_exception_handler);
- EG(user_exception_handler) = NULL;
- zval_ptr_dtor(&zeh);
+ if (Z_TYPE(EG(user_exception_handler)) != IS_UNDEF) {
+ zeh = &EG(user_exception_handler);
+ ZVAL_UNDEF(&EG(user_exception_handler));
+ zval_ptr_dtor(zeh);
}
zend_stack_destroy(&EG(user_error_handlers_error_reporting));
zend_stack_init(&EG(user_error_handlers_error_reporting));
- zend_ptr_stack_clean(&EG(user_error_handlers), ZVAL_DESTRUCTOR, 1);
- zend_ptr_stack_clean(&EG(user_exception_handlers), ZVAL_DESTRUCTOR, 1);
+ zend_stack_clean(&EG(user_error_handlers), (void (*)(void *))ZVAL_DESTRUCTOR, 1);
+ zend_stack_clean(&EG(user_exception_handlers), (void (*)(void *))ZVAL_DESTRUCTOR, 1);
} zend_end_try();
zend_try {
@@ -322,8 +319,8 @@ void shutdown_executor(TSRMLS_D) /* {{{ */
zend_hash_destroy(&EG(included_files));
zend_stack_destroy(&EG(user_error_handlers_error_reporting));
- zend_ptr_stack_destroy(&EG(user_error_handlers));
- zend_ptr_stack_destroy(&EG(user_exception_handlers));
+ zend_stack_destroy(&EG(user_error_handlers));
+ zend_stack_destroy(&EG(user_exception_handlers));
zend_objects_store_destroy(&EG(objects_store));
if (EG(in_autoload)) {
zend_hash_destroy(EG(in_autoload));
@@ -355,7 +352,7 @@ ZEND_API const char *get_active_class_name(const char **space TSRMLS_DC) /* {{{
if (space) {
*space = ce ? "::" : "";
}
- return ce ? ce->name : "";
+ return ce ? ce->name->val : "";
}
default:
if (space) {
@@ -373,7 +370,7 @@ ZEND_API const char *get_active_function_name(TSRMLS_D) /* {{{ */
}
switch (EG(current_execute_data)->function_state.function->type) {
case ZEND_USER_FUNCTION: {
- const char *function_name = ((zend_op_array *) EG(current_execute_data)->function_state.function)->function_name;
+ const char *function_name = ((zend_op_array *) EG(current_execute_data)->function_state.function)->function_name->val;
if (function_name) {
return function_name;
@@ -383,7 +380,7 @@ ZEND_API const char *get_active_function_name(TSRMLS_D) /* {{{ */
}
break;
case ZEND_INTERNAL_FUNCTION:
- return ((zend_internal_function *) EG(current_execute_data)->function_state.function)->function_name;
+ return ((zend_internal_function *) EG(current_execute_data)->function_state.function)->function_name->val;
break;
default:
return NULL;
@@ -394,7 +391,7 @@ ZEND_API const char *get_active_function_name(TSRMLS_D) /* {{{ */
ZEND_API const char *zend_get_executed_filename(TSRMLS_D) /* {{{ */
{
if (EG(active_op_array)) {
- return EG(active_op_array)->filename;
+ return EG(active_op_array)->filename->val;
} else {
return "[no active file]";
}
@@ -421,24 +418,23 @@ ZEND_API zend_bool zend_is_executing(TSRMLS_D) /* {{{ */
}
/* }}} */
-ZEND_API void _zval_ptr_dtor(zval **zval_ptr ZEND_FILE_LINE_DC) /* {{{ */
+ZEND_API void _zval_ptr_dtor(zval *zval_ptr ZEND_FILE_LINE_DC) /* {{{ */
{
TSRMLS_FETCH();
- i_zval_ptr_dtor(*zval_ptr ZEND_FILE_LINE_RELAY_CC TSRMLS_CC);
+ i_zval_ptr_dtor(zval_ptr ZEND_FILE_LINE_RELAY_CC TSRMLS_CC);
}
/* }}} */
-ZEND_API void _zval_internal_ptr_dtor(zval **zval_ptr ZEND_FILE_LINE_DC) /* {{{ */
+ZEND_API void _zval_internal_ptr_dtor(zval *zval_ptr ZEND_FILE_LINE_DC) /* {{{ */
{
-#if DEBUG_ZEND>=2
- printf("Reducing refcount for %x (%x): %d->%d\n", *zval_ptr, zval_ptr, Z_REFCOUNT_PP(zval_ptr), Z_REFCOUNT_PP(zval_ptr) - 1);
-#endif
- Z_DELREF_PP(zval_ptr);
- if (Z_REFCOUNT_PP(zval_ptr) == 0) {
- zval_internal_dtor(*zval_ptr);
- free(*zval_ptr);
- } else if (Z_REFCOUNT_PP(zval_ptr) == 1) {
- Z_UNSET_ISREF_PP(zval_ptr);
+ Z_DELREF_P(zval_ptr);
+ if (Z_REFCOUNT_P(zval_ptr) == 0) {
+ zval_internal_dtor(zval_ptr);
+ } else if (Z_REFCOUNT_P(zval_ptr) == 1) {
+//??? Z_UNSET_ISREF_P(zval_ptr);
+ zend_reference *ref = Z_REF_P(zval_ptr);
+ ZVAL_COPY_VALUE(zval_ptr, Z_REFVAL_P(zval_ptr));
+ efree(ref);
}
}
/* }}} */
@@ -456,22 +452,19 @@ ZEND_API int zend_is_true(zval *op TSRMLS_DC) /* {{{ */
#define Z_REAL_TYPE_P(p) (Z_TYPE_P(p) & ~IS_VISITED_CONSTANT)
#define MARK_CONSTANT_VISITED(p) Z_TYPE_P(p) |= IS_VISITED_CONSTANT
-static void zval_deep_copy(zval **p)
+static void zval_deep_copy(zval *p)
{
- zval *value;
-
- ALLOC_ZVAL(value);
- *value = **p;
- Z_TYPE_P(value) &= ~IS_CONSTANT_INDEX;
- zval_copy_ctor(value);
- Z_TYPE_P(value) = Z_TYPE_PP(p);
- INIT_PZVAL(value);
- *p = value;
+ zval value;
+
+ ZVAL_COPY_VALUE(&value, p);
+ Z_TYPE(value) &= ~IS_CONSTANT_INDEX;
+ zval_copy_ctor(&value);
+ Z_TYPE(value) = Z_TYPE_P(p);
+ ZVAL_COPY_VALUE(p, &value);
}
-ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *scope TSRMLS_DC) /* {{{ */
+ZEND_API int zval_update_constant_ex(zval *p, void *arg, zend_class_entry *scope TSRMLS_DC) /* {{{ */
{
- zval *p = *pp;
zend_bool inline_change = (zend_bool) (zend_uintptr_t) arg;
zval const_value;
char *colon;
@@ -480,29 +473,28 @@ ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *sco
zend_error(E_ERROR, "Cannot declare self-referencing constant '%s'", Z_STRVAL_P(p));
} else if ((Z_TYPE_P(p) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT) {
int refcount;
- zend_uchar is_ref;
+//??? zend_uchar is_ref;
- SEPARATE_ZVAL_IF_NOT_REF(pp);
- p = *pp;
+ SEPARATE_ZVAL_IF_NOT_REF(p);
MARK_CONSTANT_VISITED(p);
refcount = Z_REFCOUNT_P(p);
- is_ref = Z_ISREF_P(p);
+//??? is_ref = Z_ISREF_P(p);
- if (!zend_get_constant_ex(p->value.str.val, p->value.str.len, &const_value, scope, Z_REAL_TYPE_P(p) TSRMLS_CC)) {
+ if (!zend_get_constant_ex(Z_STRVAL_P(p), Z_STRLEN_P(p), &const_value, scope, Z_REAL_TYPE_P(p) TSRMLS_CC)) {
char *actual = Z_STRVAL_P(p);
if ((colon = (char*)zend_memrchr(Z_STRVAL_P(p), ':', Z_STRLEN_P(p)))) {
zend_error(E_ERROR, "Undefined class constant '%s'", Z_STRVAL_P(p));
Z_STRLEN_P(p) -= ((colon - Z_STRVAL_P(p)) + 1);
- if (inline_change) {
- colon = estrndup(colon, Z_STRLEN_P(p));
- str_efree(Z_STRVAL_P(p));
- Z_STRVAL_P(p) = colon;
- } else {
- Z_STRVAL_P(p) = colon + 1;
- }
+//??? if (inline_change) {
+ zend_string *tmp = STR_INIT(colon, Z_STRLEN_P(p), 0);
+ STR_RELEASE(Z_STR_P(p));
+ Z_STR_P(p) = tmp;
+//??? } else {
+//??? Z_STRVAL_P(p) = colon + 1;
+//??? }
} else {
char *save = actual, *slash;
int actual_len = Z_STRLEN_P(p);
@@ -510,9 +502,9 @@ ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *sco
actual = slash + 1;
actual_len -= (actual - Z_STRVAL_P(p));
if (inline_change) {
- actual = estrndup(actual, actual_len);
- Z_STRVAL_P(p) = actual;
- Z_STRLEN_P(p) = actual_len;
+ zend_string *s = STR_INIT(actual, actual_len, 0);
+ STR_RELEASE(Z_STR_P(p));
+ Z_STR_P(p) = s;
}
}
if (actual[0] == '\\') {
@@ -534,64 +526,59 @@ ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *sco
if (fix_save) {
save--;
}
- if (inline_change) {
- str_efree(save);
- }
+//??? if (inline_change) {
+//??? str_efree(save);
+//??? }
save = NULL;
}
- if (inline_change && save && save != actual) {
- str_efree(save);
- }
+//??? if (inline_change && save && save != actual) {
+//??? str_efree(save);
+//??? }
zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", actual, actual);
p->type = IS_STRING;
if (!inline_change) {
- Z_STRVAL_P(p) = actual;
- Z_STRLEN_P(p) = actual_len;
- zval_copy_ctor(p);
+ ZVAL_STRINGL(p, actual, actual_len);
}
}
} else {
- if (inline_change) {
- str_efree(Z_STRVAL_P(p));
- }
+//??? if (inline_change) {
+//??? str_efree(Z_STRVAL_P(p));
+//??? }
*p = const_value;
}
Z_SET_REFCOUNT_P(p, refcount);
- Z_SET_ISREF_TO_P(p, is_ref);
+//??? Z_SET_ISREF_TO_P(p, is_ref);
} else if (Z_TYPE_P(p) == IS_CONSTANT_ARRAY) {
- zval **element, *new_val;
- char *str_index;
- uint str_index_len;
+ zval *element, new_val;
+ zend_string *str_index;
ulong num_index;
int ret;
- SEPARATE_ZVAL_IF_NOT_REF(pp);
- p = *pp;
- Z_TYPE_P(p) = IS_ARRAY;
+ SEPARATE_ZVAL_IF_NOT_REF(p);
+ Z_TYPE_P(p) = IS_ARRAY;
if (!inline_change) {
- zval *tmp;
- HashTable *tmp_ht = NULL;
-
- ALLOC_HASHTABLE(tmp_ht);
- zend_hash_init(tmp_ht, zend_hash_num_elements(Z_ARRVAL_P(p)), NULL, ZVAL_PTR_DTOR, 0);
- zend_hash_copy(tmp_ht, Z_ARRVAL_P(p), (copy_ctor_func_t) zval_deep_copy, (void *) &tmp, sizeof(zval *));
- Z_ARRVAL_P(p) = tmp_ht;
+ HashTable *ht = Z_ARRVAL_P(p);
+ ZVAL_NEW_ARR(p);
+ zend_hash_init(Z_ARRVAL_P(p), zend_hash_num_elements(ht), NULL, ZVAL_PTR_DTOR, 0);
+ zend_hash_copy(Z_ARRVAL_P(p), ht, (copy_ctor_func_t) zval_deep_copy);
}
/* First go over the array and see if there are any constant indices */
zend_hash_internal_pointer_reset(Z_ARRVAL_P(p));
- while (zend_hash_get_current_data(Z_ARRVAL_P(p), (void **) &element) == SUCCESS) {
- if (!(Z_TYPE_PP(element) & IS_CONSTANT_INDEX)) {
+ while ((element = zend_hash_get_current_data(Z_ARRVAL_P(p))) != NULL) {
+ if (!(Z_TYPE_P(element) & IS_CONSTANT_INDEX)) {
zend_hash_move_forward(Z_ARRVAL_P(p));
continue;
}
- Z_TYPE_PP(element) &= ~IS_CONSTANT_INDEX;
- if (zend_hash_get_current_key_ex(Z_ARRVAL_P(p), &str_index, &str_index_len, &num_index, 0, NULL) != HASH_KEY_IS_STRING) {
+ Z_TYPE_P(element) &= ~IS_CONSTANT_INDEX;
+ if (zend_hash_get_current_key_ex(Z_ARRVAL_P(p), &str_index, &num_index, 0, NULL) != HASH_KEY_IS_STRING) {
zend_hash_move_forward(Z_ARRVAL_P(p));
continue;
}
+//???
+#if 0
if (str_index[str_index_len - 2] == IS_CONSTANT_AST) {
zend_ast_evaluate(&const_value, *(zend_ast **)str_index, scope TSRMLS_CC);
zend_ast_destroy(*(zend_ast **)str_index);
@@ -624,33 +611,30 @@ ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *sco
}
ZVAL_STRINGL(&const_value, str_index, str_index_len-3, 1);
}
+#endif
- if (Z_REFCOUNT_PP(element) > 1) {
- ALLOC_ZVAL(new_val);
- *new_val = **element;
- zval_copy_ctor(new_val);
- Z_SET_REFCOUNT_P(new_val, 1);
- Z_UNSET_ISREF_P(new_val);
+ if (Z_REFCOUNT_P(element) > 1) {
+ ZVAL_DUP(&new_val, element);
/* preserve this bit for inheritance */
- Z_TYPE_PP(element) |= IS_CONSTANT_INDEX;
+ Z_TYPE_P(element) |= IS_CONSTANT_INDEX;
zval_ptr_dtor(element);
- *element = new_val;
+ ZVAL_COPY_VALUE(element, &new_val);
}
switch (Z_TYPE(const_value)) {
case IS_STRING:
- ret = zend_symtable_update_current_key(Z_ARRVAL_P(p), Z_STRVAL(const_value), Z_STRLEN(const_value) + 1, HASH_UPDATE_KEY_IF_BEFORE);
+ ret = zend_symtable_update_current_key(Z_ARRVAL_P(p), Z_STR(const_value), HASH_UPDATE_KEY_IF_BEFORE);
break;
case IS_BOOL:
case IS_LONG:
- ret = zend_hash_update_current_key_ex(Z_ARRVAL_P(p), HASH_KEY_IS_LONG, NULL, 0, Z_LVAL(const_value), HASH_UPDATE_KEY_IF_BEFORE, NULL);
+ ret = zend_hash_update_current_key_ex(Z_ARRVAL_P(p), HASH_KEY_IS_LONG, NULL, Z_LVAL(const_value), HASH_UPDATE_KEY_IF_BEFORE, NULL);
break;
case IS_DOUBLE:
- ret = zend_hash_update_current_key_ex(Z_ARRVAL_P(p), HASH_KEY_IS_LONG, NULL, 0, zend_dval_to_lval(Z_DVAL(const_value)), HASH_UPDATE_KEY_IF_BEFORE, NULL);
+ ret = zend_hash_update_current_key_ex(Z_ARRVAL_P(p), HASH_KEY_IS_LONG, NULL, zend_dval_to_lval(Z_DVAL(const_value)), HASH_UPDATE_KEY_IF_BEFORE, NULL);
break;
case IS_NULL:
- ret = zend_hash_update_current_key_ex(Z_ARRVAL_P(p), HASH_KEY_IS_STRING, "", 1, 0, HASH_UPDATE_KEY_IF_BEFORE, NULL);
+ ret = zend_hash_update_current_key_ex(Z_ARRVAL_P(p), HASH_KEY_IS_STRING, STR_EMPTY_ALLOC(), 0, HASH_UPDATE_KEY_IF_BEFORE, NULL);
break;
default:
ret = SUCCESS;
@@ -664,12 +648,11 @@ ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *sco
zend_hash_apply_with_argument(Z_ARRVAL_P(p), (apply_func_arg_t) zval_update_constant_inline_change, (void *) scope TSRMLS_CC);
zend_hash_internal_pointer_reset(Z_ARRVAL_P(p));
} else if (Z_TYPE_P(p) == IS_CONSTANT_AST) {
- SEPARATE_ZVAL_IF_NOT_REF(pp);
- p = *pp;
+ SEPARATE_ZVAL_IF_NOT_REF(p);
- zend_ast_evaluate(&const_value, Z_AST_P(p), scope TSRMLS_CC);
+ zend_ast_evaluate(&const_value, Z_ASTVAL_P(p), scope TSRMLS_CC);
if (inline_change) {
- zend_ast_destroy(Z_AST_P(p));
+ zend_ast_destroy(Z_ASTVAL_P(p));
}
ZVAL_COPY_VALUE(p, &const_value);
}
@@ -677,45 +660,40 @@ ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *sco
}
/* }}} */
-ZEND_API int zval_update_constant_inline_change(zval **pp, void *scope TSRMLS_DC) /* {{{ */
+ZEND_API int zval_update_constant_inline_change(zval *pp, void *scope TSRMLS_DC) /* {{{ */
{
return zval_update_constant_ex(pp, (void*)1, scope TSRMLS_CC);
}
/* }}} */
-ZEND_API int zval_update_constant_no_inline_change(zval **pp, void *scope TSRMLS_DC) /* {{{ */
+ZEND_API int zval_update_constant_no_inline_change(zval *pp, void *scope TSRMLS_DC) /* {{{ */
{
return zval_update_constant_ex(pp, (void*)0, scope TSRMLS_CC);
}
/* }}} */
-ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC) /* {{{ */
+ZEND_API int zval_update_constant(zval *pp, void *arg TSRMLS_DC) /* {{{ */
{
return zval_update_constant_ex(pp, arg, NULL TSRMLS_CC);
}
/* }}} */
-int call_user_function(HashTable *function_table, zval **object_pp, zval *function_name, zval *retval_ptr, zend_uint param_count, zval *params[] TSRMLS_DC) /* {{{ */
+int call_user_function(HashTable *function_table, zval *object, zval *function_name, zval *retval_ptr, zend_uint param_count, zval params[] TSRMLS_DC) /* {{{ */
{
- zval ***params_array;
+ zval *params_array;
zend_uint i;
int ex_retval;
- zval *local_retval_ptr = NULL;
if (param_count) {
- params_array = (zval ***) emalloc(sizeof(zval **)*param_count);
+ params_array = (zval *) emalloc(sizeof(zval) * param_count);
for (i=0; i<param_count; i++) {
- params_array[i] = &params[i];
+ ZVAL_COPY_VALUE(&params_array[i], &params[i]);
}
} else {
params_array = NULL;
}
- ex_retval = call_user_function_ex(function_table, object_pp, function_name, &local_retval_ptr, param_count, params_array, 1, NULL TSRMLS_CC);
- if (local_retval_ptr) {
- COPY_PZVAL_TO_ZVAL(*retval_ptr, local_retval_ptr);
- } else {
- INIT_ZVAL(*retval_ptr);
- }
+ ZVAL_UNDEF(retval_ptr);
+ ex_retval = call_user_function_ex(function_table, object, function_name, retval_ptr, param_count, params_array, 1, NULL TSRMLS_CC);
if (params_array) {
efree(params_array);
}
@@ -723,15 +701,15 @@ int call_user_function(HashTable *function_table, zval **object_pp, zval *functi
}
/* }}} */
-int call_user_function_ex(HashTable *function_table, zval **object_pp, zval *function_name, zval **retval_ptr_ptr, zend_uint param_count, zval **params[], int no_separation, HashTable *symbol_table TSRMLS_DC) /* {{{ */
+int call_user_function_ex(HashTable *function_table, zval *object, zval *function_name, zval *retval_ptr, zend_uint param_count, zval params[], int no_separation, HashTable *symbol_table TSRMLS_DC) /* {{{ */
{
zend_fcall_info fci;
fci.size = sizeof(fci);
fci.function_table = function_table;
- fci.object_ptr = object_pp ? *object_pp : NULL;
- fci.function_name = function_name;
- fci.retval_ptr_ptr = retval_ptr_ptr;
+ fci.object_ptr = object;
+ ZVAL_COPY_VALUE(&fci.function_name, function_name);
+ fci.retval = retval_ptr;
fci.param_count = param_count;
fci.params = params;
fci.no_separation = (zend_bool) no_separation;
@@ -744,7 +722,7 @@ int call_user_function_ex(HashTable *function_table, zval **object_pp, zval *fun
int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TSRMLS_DC) /* {{{ */
{
zend_uint i;
- zval **original_return_value;
+//??? zval **original_return_value;
HashTable *calling_symbol_table;
zend_op_array *original_op_array;
zend_op **original_opline_ptr;
@@ -752,11 +730,11 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
zend_class_entry *current_called_scope;
zend_class_entry *calling_scope = NULL;
zend_class_entry *called_scope = NULL;
- zval *current_this;
+ zval current_this;
zend_execute_data execute_data;
zend_fcall_info_cache fci_cache_local;
- *fci->retval_ptr_ptr = NULL;
+ fci->retval = NULL;
if (!EG(active)) {
return FAILURE; /* executor is already inactive */
@@ -779,7 +757,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
execute_data = *EG(current_execute_data);
EX(op_array) = NULL;
EX(opline) = NULL;
- EX(object) = NULL;
+ ZVAL_UNDEF(&EX(object));
} else {
/* This only happens when we're called outside any execute()'s
* It shouldn't be strictly necessary to NULL execute_data out,
@@ -796,7 +774,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
fci_cache = &fci_cache_local;
}
- if (!zend_is_callable_ex(fci->function_name, fci->object_ptr, IS_CALLABLE_CHECK_SILENT, &callable_name, NULL, fci_cache, &error TSRMLS_CC)) {
+ if (!zend_is_callable_ex(&fci->function_name, fci->object_ptr, IS_CALLABLE_CHECK_SILENT, &callable_name, NULL, fci_cache, &error TSRMLS_CC)) {
if (error) {
zend_error(E_WARNING, "Invalid callback %s, %s", callable_name, error);
efree(error);
@@ -820,11 +798,11 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
calling_scope = fci_cache->calling_scope;
called_scope = fci_cache->called_scope;
fci->object_ptr = fci_cache->object_ptr;
- EX(object) = fci->object_ptr;
- if (fci->object_ptr && Z_TYPE_P(fci->object_ptr) == IS_OBJECT &&
- (!EG(objects_store).object_buckets || !EG(objects_store).object_buckets[Z_OBJ_HANDLE_P(fci->object_ptr)].valid)) {
- return FAILURE;
- }
+ ZVAL_COPY_VALUE(&EX(object), fci->object_ptr);
+//??? if (fci->object_ptr && Z_TYPE_P(fci->object_ptr) == IS_OBJECT &&
+//??? (!EG(objects_store).object_buckets || !EG(objects_store).object_buckets[Z_OBJ_HANDLE_P(fci->object_ptr)].valid)) {
+//??? return FAILURE;
+//??? }
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) {
@@ -832,20 +810,20 @@ 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_DEPRECATED) {
zend_error(E_DEPRECATED, "Function %s%s%s() is deprecated",
- EX(function_state).function->common.scope ? EX(function_state).function->common.scope->name : "",
+ EX(function_state).function->common.scope ? EX(function_state).function->common.scope->name->val : "",
EX(function_state).function->common.scope ? "::" : "",
- EX(function_state).function->common.function_name);
+ EX(function_state).function->common.function_name->val);
}
}
ZEND_VM_STACK_GROW_IF_NEEDED(fci->param_count + 1);
for (i=0; i<fci->param_count; i++) {
- zval *param;
+ zval *param, tmp;
if (ARG_SHOULD_BE_SENT_BY_REF(EX(function_state).function, i + 1)) {
- if (!PZVAL_IS_REF(*fci->params[i]) && Z_REFCOUNT_PP(fci->params[i]) > 1) {
- zval *new_zval;
+ if (!Z_ISREF(fci->params[i]) && Z_REFCOUNT(fci->params[i]) > 1) {
+ zval new_zval;
if (fci->no_separation &&
!ARG_MAY_BE_SENT_BY_REF(EX(function_state).function, i + 1)) {
@@ -857,36 +835,30 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
zend_error(E_WARNING, "Parameter %d to %s%s%s() expected to be a reference, value given",
i+1,
- EX(function_state).function->common.scope ? EX(function_state).function->common.scope->name : "",
+ EX(function_state).function->common.scope ? EX(function_state).function->common.scope->name->val : "",
EX(function_state).function->common.scope ? "::" : "",
- EX(function_state).function->common.function_name);
+ EX(function_state).function->common.function_name->val);
return FAILURE;
}
- ALLOC_ZVAL(new_zval);
- *new_zval = **fci->params[i];
- zval_copy_ctor(new_zval);
- Z_SET_REFCOUNT_P(new_zval, 1);
- Z_DELREF_PP(fci->params[i]);
- *fci->params[i] = new_zval;
+ ZVAL_DUP(&new_zval, &fci->params[i]);
+ Z_DELREF(fci->params[i]);
+ ZVAL_COPY_VALUE(&fci->params[i], &new_zval);
}
- Z_ADDREF_PP(fci->params[i]);
- Z_SET_ISREF_PP(fci->params[i]);
- param = *fci->params[i];
- } else if (PZVAL_IS_REF(*fci->params[i]) &&
+ Z_ADDREF(fci->params[i]);
+//??? Z_SET_ISREF_PP(fci->params[i]);
+ param = &fci->params[i];
+ } else if (Z_ISREF(fci->params[i]) &&
/* don't separate references for __call */
(EX(function_state).function->common.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) == 0 ) {
- ALLOC_ZVAL(param);
- *param = **(fci->params[i]);
- INIT_PZVAL(param);
- zval_copy_ctor(param);
- } else if (*fci->params[i] != &EG(uninitialized_zval)) {
- Z_ADDREF_PP(fci->params[i]);
- param = *fci->params[i];
- } else {
- ALLOC_ZVAL(param);
- *param = **(fci->params[i]);
- INIT_PZVAL(param);
+ param = &tmp;
+ ZVAL_DUP(param, &fci->params[i]);
+//??? } else if (*fci->params[i] != &EG(uninitialized_zval)) {
+ Z_ADDREF(fci->params[i]);
+ param = &fci->params[i];
+//??? } else {
+//??? param = &tmp;
+//??? ZVAL_COPY_VALUE(param, &fci->params[i]);
}
zend_vm_stack_push(param TSRMLS_CC);
}
@@ -897,7 +869,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
current_scope = EG(scope);
EG(scope) = calling_scope;
- current_this = EG(This);
+ ZVAL_COPY_VALUE(&current_this, &EG(This));
current_called_scope = EG(called_scope);
if (called_scope) {
@@ -908,24 +880,24 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
if (fci->object_ptr) {
if ((EX(function_state).function->common.fn_flags & ZEND_ACC_STATIC)) {
- EG(This) = NULL;
+ ZVAL_UNDEF(&EG(This));
} else {
- EG(This) = fci->object_ptr;
+ ZVAL_COPY_VALUE(&EG(This), fci->object_ptr);
- if (!PZVAL_IS_REF(EG(This))) {
- Z_ADDREF_P(EG(This)); /* For $this pointer */
+ if (!Z_ISREF(EG(This))) {
+ Z_ADDREF(EG(This)); /* For $this pointer */
} else {
- zval *this_ptr;
-
- ALLOC_ZVAL(this_ptr);
- *this_ptr = *EG(This);
- INIT_PZVAL(this_ptr);
- zval_copy_ctor(this_ptr);
- EG(This) = this_ptr;
+//??? zval *this_ptr;
+//???
+//??? ALLOC_ZVAL(this_ptr);
+//??? *this_ptr = *EG(This);
+//??? INIT_PZVAL(this_ptr);
+//??? zval_copy_ctor(this_ptr);
+//??? EG(This) = this_ptr;
}
}
} else {
- EG(This) = NULL;
+ ZVAL_UNDEF(&EG(This));
}
EX(prev_execute_data) = EG(current_execute_data);
@@ -940,14 +912,14 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
EG(active_symbol_table) = NULL;
}
- original_return_value = EG(return_value_ptr_ptr);
+//??? original_return_value = EG(return_value_ptr_ptr);
original_op_array = EG(active_op_array);
- EG(return_value_ptr_ptr) = fci->retval_ptr_ptr;
+//??? EG(return_value_ptr_ptr) = fci->retval_ptr_ptr;
EG(active_op_array) = (zend_op_array *) EX(function_state).function;
original_opline_ptr = EG(opline_ptr);
if (EG(active_op_array)->fn_flags & ZEND_ACC_GENERATOR) {
- *fci->retval_ptr_ptr = zend_generator_create_zval(EG(active_op_array) TSRMLS_CC);
+//??? *fci->retval_ptr_ptr = zend_generator_create_zval(EG(active_op_array) TSRMLS_CC);
} else {
zend_execute(EG(active_op_array) TSRMLS_CC);
}
@@ -957,17 +929,17 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
}
EG(active_symbol_table) = calling_symbol_table;
EG(active_op_array) = original_op_array;
- EG(return_value_ptr_ptr)=original_return_value;
+//??? EG(return_value_ptr_ptr)=original_return_value;
EG(opline_ptr) = original_opline_ptr;
} else if (EX(function_state).function->type == ZEND_INTERNAL_FUNCTION) {
int call_via_handler = (EX(function_state).function->common.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) != 0;
- ALLOC_INIT_ZVAL(*fci->retval_ptr_ptr);
+//??? ALLOC_INIT_ZVAL(*fci->retval_ptr_ptr);
if (EX(function_state).function->common.scope) {
EG(scope) = EX(function_state).function->common.scope;
}
if (EXPECTED(zend_execute_internal == NULL)) {
/* saves one function call if zend_execute_internal is not used */
- EX(function_state).function->internal_function.handler(fci->param_count, *fci->retval_ptr_ptr, fci->retval_ptr_ptr, fci->object_ptr, 1 TSRMLS_CC);
+ EX(function_state).function->internal_function.handler(fci->param_count, fci->retval, fci->object_ptr, 1 TSRMLS_CC);
} else {
zend_execute_internal(&execute_data, fci, 1 TSRMLS_CC);
}
@@ -977,9 +949,9 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
{
INIT_PZVAL(*fci->retval_ptr_ptr);
}*/
- if (EG(exception) && fci->retval_ptr_ptr) {
- zval_ptr_dtor(fci->retval_ptr_ptr);
- *fci->retval_ptr_ptr = NULL;
+ if (EG(exception) && fci->retval) {
+ zval_ptr_dtor(fci->retval);
+ ZVAL_UNDEF(fci->retval);
}
if (call_via_handler) {
@@ -987,11 +959,11 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
fci_cache->initialized = 0;
}
} else { /* ZEND_OVERLOADED_FUNCTION */
- ALLOC_INIT_ZVAL(*fci->retval_ptr_ptr);
+//??? ALLOC_INIT_ZVAL(*fci->retval_ptr_ptr);
/* Not sure what should be done here if it's a static method */
if (fci->object_ptr) {
- Z_OBJ_HT_P(fci->object_ptr)->call_method(EX(function_state).function->common.function_name, fci->param_count, *fci->retval_ptr_ptr, fci->retval_ptr_ptr, fci->object_ptr, 1 TSRMLS_CC);
+ Z_OBJ_HT_P(fci->object_ptr)->call_method(EX(function_state).function->common.function_name, fci->param_count, fci->retval, fci->object_ptr, 1 TSRMLS_CC);
} else {
zend_error_noreturn(E_ERROR, "Cannot call overloaded function for non-object");
}
@@ -1001,19 +973,17 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
}
efree(EX(function_state).function);
- if (EG(exception) && fci->retval_ptr_ptr) {
- zval_ptr_dtor(fci->retval_ptr_ptr);
- *fci->retval_ptr_ptr = NULL;
+ if (EG(exception) && fci->retval) {
+ zval_ptr_dtor(fci->retval);
+ ZVAL_UNDEF(fci->retval);
}
}
zend_vm_stack_clear_multiple(0 TSRMLS_CC);
- if (EG(This)) {
- zval_ptr_dtor(&EG(This));
- }
+ zval_ptr_dtor(&EG(This));
EG(called_scope) = current_called_scope;
EG(scope) = current_scope;
- EG(This) = current_this;
+ ZVAL_COPY_VALUE(&EG(This), &current_this);
EG(current_execute_data) = EX(prev_execute_data);
if (EG(exception)) {
@@ -1023,47 +993,38 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
}
/* }}} */
-ZEND_API int zend_lookup_class_ex(const char *name, int name_length, const zend_literal *key, int use_autoload, zend_class_entry ***ce TSRMLS_DC) /* {{{ */
+ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, const zend_literal *key, int use_autoload TSRMLS_DC) /* {{{ */
{
- zval **args[1];
- zval autoload_function;
- zval *class_name_ptr;
- zval *retval_ptr = NULL;
- int retval, lc_length;
- char *lc_name;
- char *lc_free;
+ zend_class_entry *ce = NULL;
+ zval args[1];
+ zval local_retval;
+ int retval;
+ zend_string *lc_name;
zend_fcall_info fcall_info;
zend_fcall_info_cache fcall_cache;
- char dummy = 1;
- ulong hash;
- ALLOCA_FLAG(use_heap)
if (key) {
- lc_name = Z_STRVAL(key->constant);
- lc_length = Z_STRLEN(key->constant) + 1;
- hash = key->hash_value;
+ lc_name = Z_STR(key->constant);
} else {
- if (name == NULL || !name_length) {
- return FAILURE;
+ if (name == NULL || !name->len) {
+ return NULL;
}
- lc_free = lc_name = do_alloca(name_length + 1, use_heap);
- zend_str_tolower_copy(lc_name, name, name_length);
- lc_length = name_length + 1;
-
- if (lc_name[0] == '\\') {
- lc_name += 1;
- lc_length -= 1;
+ if (name->val[0] == '\\') {
+ lc_name = STR_ALLOC(name->len - 1, 0);
+ zend_str_tolower_copy(lc_name->val, name->val + 1, name->len - 1);
+ } else {
+ lc_name = STR_ALLOC(name->len, 0);
+ zend_str_tolower_copy(lc_name->val, name->val, name->len);
}
-
- hash = zend_inline_hash_func(lc_name, lc_length);
}
- if (zend_hash_quick_find(EG(class_table), lc_name, lc_length, hash, (void **) ce) == SUCCESS) {
+ ce = zend_hash_find_ptr(EG(class_table), lc_name);
+ if (ce) {
if (!key) {
- free_alloca(lc_free, use_heap);
+ STR_FREE(lc_name);
}
- return SUCCESS;
+ return ce;
}
/* The compiler is not-reentrant. Make sure we __autoload() only during run-time
@@ -1071,17 +1032,17 @@ ZEND_API int zend_lookup_class_ex(const char *name, int name_length, const zend_
*/
if (!use_autoload || zend_is_compiling(TSRMLS_C)) {
if (!key) {
- free_alloca(lc_free, use_heap);
+ STR_FREE(lc_name);
}
- return FAILURE;
+ return NULL;
}
/* Verify class name before passing it to __autoload() */
- if (strspn(name, "0123456789_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377\\") != name_length) {
+ if (strspn(name->val, "0123456789_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377\\") != name->len) {
if (!key) {
- free_alloca(lc_free, use_heap);
+ STR_FREE(lc_name);
}
- return FAILURE;
+ return NULL;
}
if (EG(in_autoload) == NULL) {
@@ -1089,30 +1050,26 @@ ZEND_API int zend_lookup_class_ex(const char *name, int name_length, const zend_
zend_hash_init(EG(in_autoload), 0, NULL, NULL, 0);
}
- if (zend_hash_quick_add(EG(in_autoload), lc_name, lc_length, hash, (void**)&dummy, sizeof(char), NULL) == FAILURE) {
+ if (zend_hash_add_empty_element(EG(in_autoload), lc_name) == NULL) {
if (!key) {
- free_alloca(lc_free, use_heap);
+ STR_FREE(lc_name);
}
- return FAILURE;
+ return NULL;
}
- ZVAL_STRINGL(&autoload_function, ZEND_AUTOLOAD_FUNC_NAME, sizeof(ZEND_AUTOLOAD_FUNC_NAME) - 1, 0);
+ ZVAL_UNDEF(&local_retval);
- ALLOC_ZVAL(class_name_ptr);
- INIT_PZVAL(class_name_ptr);
- if (name[0] == '\\') {
- ZVAL_STRINGL(class_name_ptr, name+1, name_length-1, 1);
+ if (name->val[0] == '\\') {
+ ZVAL_STRINGL(&args[0], name->val + 1, name->len - 1);
} else {
- ZVAL_STRINGL(class_name_ptr, name, name_length, 1);
+ ZVAL_STR(&args[0], STR_COPY(name));
}
- args[0] = &class_name_ptr;
-
fcall_info.size = sizeof(fcall_info);
fcall_info.function_table = EG(function_table);
- fcall_info.function_name = &autoload_function;
+ ZVAL_STRINGL(&fcall_info.function_name, ZEND_AUTOLOAD_FUNC_NAME, sizeof(ZEND_AUTOLOAD_FUNC_NAME) - 1);
fcall_info.symbol_table = NULL;
- fcall_info.retval_ptr_ptr = &retval_ptr;
+ fcall_info.retval = &local_retval;
fcall_info.param_count = 1;
fcall_info.params = args;
fcall_info.object_ptr = NULL;
@@ -1130,27 +1087,25 @@ ZEND_API int zend_lookup_class_ex(const char *name, int name_length, const zend_
EG(autoload_func) = fcall_cache.function_handler;
- zval_ptr_dtor(&class_name_ptr);
+ zval_ptr_dtor(&args[0]);
- zend_hash_quick_del(EG(in_autoload), lc_name, lc_length, hash);
+ zend_hash_del(EG(in_autoload), lc_name);
- if (retval_ptr) {
- zval_ptr_dtor(&retval_ptr);
- }
+ zval_ptr_dtor(&local_retval);
if (retval == SUCCESS) {
- retval = zend_hash_quick_find(EG(class_table), lc_name, lc_length, hash, (void **) ce);
+ ce = zend_hash_find_ptr(EG(class_table), lc_name);
}
if (!key) {
- free_alloca(lc_free, use_heap);
+ STR_FREE(lc_name);
}
- return retval;
+ return ce;
}
/* }}} */
-ZEND_API int zend_lookup_class(const char *name, int name_length, zend_class_entry ***ce TSRMLS_DC) /* {{{ */
+ZEND_API zend_class_entry *zend_lookup_class(zend_string *name TSRMLS_DC) /* {{{ */
{
- return zend_lookup_class_ex(name, name_length, NULL, 1, ce TSRMLS_CC);
+ return zend_lookup_class_ex(name, NULL, 1 TSRMLS_CC);
}
/* }}} */
@@ -1163,17 +1118,14 @@ ZEND_API int zend_eval_stringl(char *str, int str_len, zval *retval_ptr, char *s
int retval;
if (retval_ptr) {
- Z_STRLEN(pv) = str_len + sizeof("return ;") - 1;
- Z_STRVAL(pv) = emalloc(Z_STRLEN(pv) + 1);
+ ZVAL_STR(&pv, STR_ALLOC(str_len + sizeof("return ;"), 1));
memcpy(Z_STRVAL(pv), "return ", sizeof("return ") - 1);
memcpy(Z_STRVAL(pv) + sizeof("return ") - 1, str, str_len);
Z_STRVAL(pv)[Z_STRLEN(pv) - 1] = ';';
Z_STRVAL(pv)[Z_STRLEN(pv)] = '\0';
} else {
- Z_STRLEN(pv) = str_len;
- Z_STRVAL(pv) = str;
+ ZVAL_STRINGL(&pv, str, str_len);
}
- Z_TYPE(pv) = IS_STRING;
/*printf("Evaluating '%s'\n", pv.value.str.val);*/
@@ -1183,12 +1135,12 @@ ZEND_API int zend_eval_stringl(char *str, int str_len, zval *retval_ptr, char *s
CG(compiler_options) = original_compiler_options;
if (new_op_array) {
- zval *local_retval_ptr=NULL;
- zval **original_return_value_ptr_ptr = EG(return_value_ptr_ptr);
+//??? zval *local_retval_ptr=NULL;
+//??? zval **original_return_value_ptr_ptr = EG(return_value_ptr_ptr);
zend_op **original_opline_ptr = EG(opline_ptr);
int orig_interactive = CG(interactive);
- EG(return_value_ptr_ptr) = &local_retval_ptr;
+//??? EG(return_value_ptr_ptr) = &local_retval_ptr;
EG(active_op_array) = new_op_array;
EG(no_extensions)=1;
if (!EG(active_symbol_table)) {
@@ -1205,24 +1157,24 @@ ZEND_API int zend_eval_stringl(char *str, int str_len, zval *retval_ptr, char *s
} zend_end_try();
CG(interactive) = orig_interactive;
- if (local_retval_ptr) {
- if (retval_ptr) {
- COPY_PZVAL_TO_ZVAL(*retval_ptr, local_retval_ptr);
- } else {
- zval_ptr_dtor(&local_retval_ptr);
- }
- } else {
- if (retval_ptr) {
- INIT_ZVAL(*retval_ptr);
- }
- }
+//??? if (local_retval_ptr) {
+//??? if (retval_ptr) {
+//??? COPY_PZVAL_TO_ZVAL(*retval_ptr, local_retval_ptr);
+//??? } else {
+//??? zval_ptr_dtor(&local_retval_ptr);
+//??? }
+//??? } else {
+//??? if (retval_ptr) {
+//??? INIT_ZVAL(*retval_ptr);
+//??? }
+//??? }
EG(no_extensions)=0;
EG(opline_ptr) = original_opline_ptr;
EG(active_op_array) = original_active_op_array;
destroy_op_array(new_op_array TSRMLS_CC);
efree(new_op_array);
- EG(return_value_ptr_ptr) = original_return_value_ptr_ptr;
+//??? EG(return_value_ptr_ptr) = original_return_value_ptr_ptr;
retval = SUCCESS;
} else {
retval = FAILURE;
@@ -1316,7 +1268,7 @@ void execute_new_code(TSRMLS_D) /* {{{ */
zend_release_labels(1 TSRMLS_CC);
- EG(return_value_ptr_ptr) = NULL;
+//??? EG(return_value_ptr_ptr) = NULL;
EG(active_op_array) = CG(active_op_array);
orig_interactive = CG(interactive);
CG(interactive) = 0;
@@ -1545,9 +1497,9 @@ void zend_unset_timeout(TSRMLS_D) /* {{{ */
}
/* }}} */
-zend_class_entry *zend_fetch_class(const char *class_name, uint class_name_len, int fetch_type TSRMLS_DC) /* {{{ */
+zend_class_entry *zend_fetch_class(zend_string *class_name, int fetch_type TSRMLS_DC) /* {{{ */
{
- zend_class_entry **pce;
+ zend_class_entry *ce;
int use_autoload = (fetch_type & ZEND_FETCH_CLASS_NO_AUTOLOAD) == 0;
int silent = (fetch_type & ZEND_FETCH_CLASS_SILENT) != 0;
@@ -1574,7 +1526,7 @@ check_fetch_type:
}
return EG(called_scope);
case ZEND_FETCH_CLASS_AUTO: {
- fetch_type = zend_get_class_fetch_type(class_name, class_name_len);
+ fetch_type = zend_get_class_fetch_type(class_name->val, class_name->len);
if (fetch_type!=ZEND_FETCH_CLASS_DEFAULT) {
goto check_fetch_type;
}
@@ -1582,44 +1534,44 @@ check_fetch_type:
break;
}
- if (zend_lookup_class_ex(class_name, class_name_len, NULL, use_autoload, &pce TSRMLS_CC) == FAILURE) {
+ if ((ce = zend_lookup_class_ex(class_name, NULL, use_autoload TSRMLS_CC)) == NULL) {
if (use_autoload) {
if (!silent && !EG(exception)) {
if (fetch_type == ZEND_FETCH_CLASS_INTERFACE) {
- zend_error(E_ERROR, "Interface '%s' not found", class_name);
+ zend_error(E_ERROR, "Interface '%s' not found", class_name->val);
} else if (fetch_type == ZEND_FETCH_CLASS_TRAIT) {
- zend_error(E_ERROR, "Trait '%s' not found", class_name);
+ zend_error(E_ERROR, "Trait '%s' not found", class_name->val);
} else {
- zend_error(E_ERROR, "Class '%s' not found", class_name);
+ zend_error(E_ERROR, "Class '%s' not found", class_name->val);
}
}
}
return NULL;
}
- return *pce;
+ return ce;
}
/* }}} */
-zend_class_entry *zend_fetch_class_by_name(const char *class_name, uint class_name_len, const zend_literal *key, int fetch_type TSRMLS_DC) /* {{{ */
+zend_class_entry *zend_fetch_class_by_name(zend_string *class_name, const zend_literal *key, int fetch_type TSRMLS_DC) /* {{{ */
{
- zend_class_entry **pce;
+ zend_class_entry *ce;
int use_autoload = (fetch_type & ZEND_FETCH_CLASS_NO_AUTOLOAD) == 0;
- if (zend_lookup_class_ex(class_name, class_name_len, key, use_autoload, &pce TSRMLS_CC) == FAILURE) {
+ if ((ce = zend_lookup_class_ex(class_name, key, use_autoload TSRMLS_CC)) == NULL) {
if (use_autoload) {
if ((fetch_type & ZEND_FETCH_CLASS_SILENT) == 0 && !EG(exception)) {
if ((fetch_type & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_INTERFACE) {
- zend_error(E_ERROR, "Interface '%s' not found", class_name);
+ zend_error(E_ERROR, "Interface '%s' not found", class_name->val);
} else if ((fetch_type & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_TRAIT) {
- zend_error(E_ERROR, "Trait '%s' not found", class_name);
+ zend_error(E_ERROR, "Trait '%s' not found", class_name->val);
} else {
- zend_error(E_ERROR, "Class '%s' not found", class_name);
+ zend_error(E_ERROR, "Class '%s' not found", class_name->val);
}
}
}
return NULL;
}
- return *pce;
+ return ce;
}
/* }}} */
@@ -1628,7 +1580,7 @@ zend_class_entry *zend_fetch_class_by_name(const char *class_name, uint class_na
#define DISPLAY_ABSTRACT_FN(idx) \
ai.afn[idx] ? ZEND_FN_SCOPE_NAME(ai.afn[idx]) : "", \
ai.afn[idx] ? "::" : "", \
- ai.afn[idx] ? ai.afn[idx]->common.function_name : "", \
+ ai.afn[idx] ? ai.afn[idx]->common.function_name->val : "", \
ai.afn[idx] && ai.afn[idx + 1] ? ", " : (ai.afn[idx] && ai.cnt > MAX_ABSTRACT_INFO_CNT ? ", ..." : "")
typedef struct _zend_abstract_info {
@@ -1669,7 +1621,7 @@ void zend_verify_abstract_class(zend_class_entry *ce TSRMLS_DC) /* {{{ */
if (ai.cnt) {
zend_error(E_ERROR, "Class %s contains %d abstract method%s and must therefore be declared abstract or implement the remaining methods (" MAX_ABSTRACT_INFO_FMT MAX_ABSTRACT_INFO_FMT MAX_ABSTRACT_INFO_FMT ")",
- ce->name, ai.cnt,
+ ce->name->val, ai.cnt,
ai.cnt > 1 ? "s" : "",
DISPLAY_ABSTRACT_FN(0),
DISPLAY_ABSTRACT_FN(1),
@@ -1688,26 +1640,25 @@ ZEND_API void zend_reset_all_cv(HashTable *symbol_table TSRMLS_DC) /* {{{ */
for (ex = EG(current_execute_data); ex; ex = ex->prev_execute_data) {
if (ex->op_array && ex->symbol_table == symbol_table) {
for (i = 0; i < ex->op_array->last_var; i++) {
- *EX_CV_NUM(ex, i) = NULL;
+ ZVAL_UNDEF(EX_VAR_NUM_2(ex, i));
}
}
}
}
/* }}} */
-ZEND_API void zend_delete_variable(zend_execute_data *ex, HashTable *ht, const char *name, int name_len, ulong hash_value TSRMLS_DC) /* {{{ */
+ZEND_API void zend_delete_variable(zend_execute_data *ex, HashTable *ht, zend_string *name TSRMLS_DC) /* {{{ */
{
- if (zend_hash_quick_del(ht, name, name_len, hash_value) == SUCCESS) {
- name_len--;
+ if (zend_hash_del(ht, name) == SUCCESS) {
while (ex && ex->symbol_table == ht) {
int i;
if (ex->op_array) {
for (i = 0; i < ex->op_array->last_var; i++) {
- if (ex->op_array->vars[i].hash_value == hash_value &&
- ex->op_array->vars[i].name_len == name_len &&
- !memcmp(ex->op_array->vars[i].name, name, name_len)) {
- *EX_CV_NUM(ex, i) = NULL;
+ if (ex->op_array->vars[i]->h == name->h &&
+ ex->op_array->vars[i]->len == name->len &&
+ !memcmp(ex->op_array->vars[i]->val, name->val, name->len)) {
+ ZVAL_NULL(EX_VAR_NUM_2(ex, i));
break;
}
}
@@ -1718,37 +1669,31 @@ ZEND_API void zend_delete_variable(zend_execute_data *ex, HashTable *ht, const c
}
/* }}} */
-ZEND_API int zend_delete_global_variable_ex(const char *name, int name_len, ulong hash_value TSRMLS_DC) /* {{{ */
+ZEND_API int zend_delete_global_variable(zend_string *name TSRMLS_DC) /* {{{ */
{
zend_execute_data *ex;
- if (zend_hash_quick_exists(&EG(symbol_table), name, name_len + 1, hash_value)) {
+ if (zend_hash_del(&EG(symbol_table).ht, name) == SUCCESS) {
for (ex = EG(current_execute_data); ex; ex = ex->prev_execute_data) {
- if (ex->op_array && ex->symbol_table == &EG(symbol_table)) {
+ if (ex->op_array && ex->symbol_table == &EG(symbol_table).ht) {
int i;
for (i = 0; i < ex->op_array->last_var; i++) {
- if (ex->op_array->vars[i].hash_value == hash_value &&
- ex->op_array->vars[i].name_len == name_len &&
- !memcmp(ex->op_array->vars[i].name, name, name_len)
+ if (ex->op_array->vars[i]->h == name->h &&
+ ex->op_array->vars[i]->len == name->len &&
+ !memcmp(ex->op_array->vars[i]->val, name->val, name->len)
) {
- *EX_CV_NUM(ex, i) = NULL;
+ ZVAL_UNDEF(EX_VAR_NUM_2(ex, i));
break;
}
}
}
}
- return zend_hash_quick_del(&EG(symbol_table), name, name_len + 1, hash_value);
+ return SUCCESS;
}
return FAILURE;
}
/* }}} */
-ZEND_API int zend_delete_global_variable(const char *name, int name_len TSRMLS_DC) /* {{{ */
-{
- return zend_delete_global_variable_ex(name, name_len, zend_inline_hash_func(name, name_len + 1) TSRMLS_CC);
-}
-/* }}} */
-
ZEND_API void zend_rebuild_symbol_table(TSRMLS_D) /* {{{ */
{
zend_uint i;
@@ -1778,20 +1723,16 @@ ZEND_API void zend_rebuild_symbol_table(TSRMLS_D) /* {{{ */
ex->symbol_table = EG(active_symbol_table);
if (ex->op_array->this_var != -1 &&
- !*EX_CV_NUM(ex, ex->op_array->this_var) &&
- EG(This)) {
- *EX_CV_NUM(ex, ex->op_array->this_var) = (zval**)EX_CV_NUM(ex, ex->op_array->last_var + ex->op_array->this_var);
- **EX_CV_NUM(ex, ex->op_array->this_var) = EG(This);
+ Z_TYPE_P(EX_VAR_NUM_2(ex, ex->op_array->this_var)) == IS_UNDEF &&
+ Z_TYPE(EG(This)) != IS_UNDEF) {
+ ZVAL_COPY_VALUE(EX_VAR_NUM_2(ex, ex->op_array->this_var), &EG(This));
}
for (i = 0; i < ex->op_array->last_var; i++) {
- if (*EX_CV_NUM(ex, i)) {
- zend_hash_quick_update(EG(active_symbol_table),
- ex->op_array->vars[i].name,
- ex->op_array->vars[i].name_len + 1,
- ex->op_array->vars[i].hash_value,
- (void**)*EX_CV_NUM(ex, i),
- sizeof(zval*),
- (void**)EX_CV_NUM(ex, i));
+ if (Z_TYPE_P(EX_VAR_NUM_2(ex, i)) != IS_UNDEF) {
+ // TODO: use INDIRECT???
+ zend_hash_update(EG(active_symbol_table),
+ ex->op_array->vars[i],
+ EX_VAR_NUM_2(ex, i));
}
}
}
diff --git a/Zend/zend_gc.c b/Zend/zend_gc.c
index 76217e369d..4b31f979da 100644
--- a/Zend/zend_gc.c
+++ b/Zend/zend_gc.c
@@ -30,6 +30,18 @@ ZEND_API int gc_globals_id;
ZEND_API zend_gc_globals gc_globals;
#endif
+#define GC_REMOVE_FROM_BUFFER(current) \
+ gc_remove_from_buffer((current) TSRMLS_CC)
+
+static zend_always_inline void gc_remove_from_buffer(gc_root_buffer *root TSRMLS_DC)
+{
+ root->next->prev = root->prev;
+ root->prev->next = root->next;
+ root->prev = GC_G(unused);
+ GC_G(unused) = root;
+ GC_BENCH_DEC(root_buf_length);
+}
+
static void root_buffer_dtor(zend_gc_globals *gc_globals TSRMLS_DC)
{
if (gc_globals->buf) {
@@ -108,7 +120,7 @@ ZEND_API void gc_reset(TSRMLS_D)
if (GC_G(buf)) {
GC_G(unused) = NULL;
- GC_G(first_unused) = GC_G(buf);
+ GC_G(first_unused) = GC_G(buf) + 1;
GC_G(zval_to_free) = NULL;
} else {
@@ -127,29 +139,23 @@ ZEND_API void gc_init(TSRMLS_D)
}
}
-ZEND_API void gc_zval_possible_root(zval *zv TSRMLS_DC)
+ZEND_API void gc_zval_possible_root(zend_refcounted *ref TSRMLS_DC)
{
if (UNEXPECTED(GC_G(free_list) != NULL &&
- GC_ZVAL_ADDRESS(zv) != NULL &&
- GC_ZVAL_GET_COLOR(zv) == GC_BLACK) &&
- (GC_ZVAL_ADDRESS(zv) < GC_G(buf) ||
- GC_ZVAL_ADDRESS(zv) >= GC_G(last_unused))) {
+ GC_ADDRESS(ref->u.v.buffer) &&
+ GC_GET_COLOR(ref->u.v.buffer) == GC_BLACK &&
+ GC_ADDRESS(ref->u.v.buffer) >= GC_G(last_unused) - GC_G(buf))) {
/* The given zval is a garbage that is going to be deleted by
* currently running GC */
return;
}
- if (zv->type == IS_OBJECT) {
- GC_ZOBJ_CHECK_POSSIBLE_ROOT(zv);
- return;
- }
-
GC_BENCH_INC(zval_possible_root);
- if (GC_ZVAL_GET_COLOR(zv) != GC_PURPLE) {
- GC_ZVAL_SET_PURPLE(zv);
+ if (GC_GET_COLOR(ref->u.v.buffer) != GC_PURPLE) {
+ GC_SET_PURPLE(ref->u.v.buffer);
- if (!GC_ZVAL_ADDRESS(zv)) {
+ if (!GC_ADDRESS(ref->u.v.buffer)) {
gc_root_buffer *newRoot = GC_G(unused);
if (newRoot) {
@@ -159,17 +165,17 @@ ZEND_API void gc_zval_possible_root(zval *zv TSRMLS_DC)
GC_G(first_unused)++;
} else {
if (!GC_G(gc_enabled)) {
- GC_ZVAL_SET_BLACK(zv);
+ GC_SET_BLACK(ref->u.v.buffer);
return;
}
- zv->refcount__gc++;
+ ref->refcount++;
gc_collect_cycles(TSRMLS_C);
- zv->refcount__gc--;
+ ref->refcount--;
newRoot = GC_G(unused);
if (!newRoot) {
return;
}
- GC_ZVAL_SET_PURPLE(zv);
+ GC_SET_PURPLE(ref->u.v.buffer);
GC_G(unused) = newRoot->prev;
}
@@ -178,10 +184,9 @@ ZEND_API void gc_zval_possible_root(zval *zv TSRMLS_DC)
GC_G(roots).next->prev = newRoot;
GC_G(roots).next = newRoot;
- GC_ZVAL_SET_ADDRESS(zv, newRoot);
+ GC_SET_ADDRESS(ref->u.v.buffer, newRoot - GC_G(buf));
- newRoot->handle = 0;
- newRoot->u.pz = zv;
+ newRoot->ref = ref;
GC_BENCH_INC(zval_buffered);
GC_BENCH_INC(root_buf_length);
@@ -190,6 +195,8 @@ ZEND_API void gc_zval_possible_root(zval *zv TSRMLS_DC)
}
}
+//???
+#if 0
ZEND_API void gc_zobj_possible_root(zval *zv TSRMLS_DC)
{
struct _store_object *obj;
@@ -245,33 +252,37 @@ ZEND_API void gc_zobj_possible_root(zval *zv TSRMLS_DC)
}
}
}
+#endif
-ZEND_API void gc_remove_zval_from_buffer(zval *zv TSRMLS_DC)
+ZEND_API void gc_remove_zval_from_buffer(zend_refcounted *ref TSRMLS_DC)
{
- gc_root_buffer* root_buffer = GC_ADDRESS(((zval_gc_info*)zv)->u.buffered);
+//??? gc_root_buffer* root_buffer = GC_ADDRESS(ref->u.v.buffer);
if (UNEXPECTED(GC_G(free_list) != NULL &&
- GC_ZVAL_GET_COLOR(zv) == GC_BLACK) &&
- (GC_ZVAL_ADDRESS(zv) < GC_G(buf) ||
- GC_ZVAL_ADDRESS(zv) >= GC_G(last_unused))) {
+ GC_GET_COLOR(ref->u.v.buffer) == GC_BLACK &&
+ GC_ADDRESS(ref->u.v.buffer) >= GC_G(last_unused) - GC_G(buf))) {
/* The given zval is a garbage that is going to be deleted by
* currently running GC */
- if (GC_G(next_to_free) == (zval_gc_info*)zv) {
- GC_G(next_to_free) = ((zval_gc_info*)zv)->u.next;
- }
+//??? if (GC_G(next_to_free) == (zval_gc_info*)zv) {
+//??? GC_G(next_to_free) = ((zval_gc_info*)zv)->u.next;
+//??? }
return;
}
GC_BENCH_INC(zval_remove_from_buffer);
- GC_REMOVE_FROM_BUFFER(root_buffer);
- ((zval_gc_info*)zv)->u.buffered = NULL;
+ GC_REMOVE_FROM_BUFFER(GC_G(buf) + GC_ADDRESS(ref->u.v.buffer));
+ ref->u.v.buffer = 0;
}
+//???
+#if 0
static void zval_scan_black(zval *pz TSRMLS_DC)
{
+ HashTable *ht;
+ uint idx;
Bucket *p;
tail_call:
- p = NULL;
+ ht = NULL;
GC_ZVAL_SET_BLACK(pz);
if (Z_TYPE_P(pz) == IS_OBJECT && EG(objects_store).object_buckets) {
@@ -306,32 +317,35 @@ tail_call:
if (!props) {
return;
}
- p = props->pListHead;
+ ht = props;
}
}
} else if (Z_TYPE_P(pz) == IS_ARRAY) {
if (Z_ARRVAL_P(pz) != &EG(symbol_table)) {
- p = Z_ARRVAL_P(pz)->pListHead;
+ ht = Z_ARRVAL_P(pz);
}
}
- while (p != NULL) {
- pz = *(zval**)p->pData;
+ if (!ht) return;
+ for (idx = 0; idx < ht->nNumUsed; idx++) {
+ p = ht->arData + idx;
+ if (!p->xData) continue;
+ pz = (zval*)p->xData;
if (Z_TYPE_P(pz) != IS_ARRAY || Z_ARRVAL_P(pz) != &EG(symbol_table)) {
pz->refcount__gc++;
}
if (GC_ZVAL_GET_COLOR(pz) != GC_BLACK) {
- if (p->pListNext == NULL) {
+ if (idx == ht->nNumUsed-1) {
goto tail_call;
} else {
zval_scan_black(pz TSRMLS_CC);
}
}
- p = p->pListNext;
}
}
static void zobj_scan_black(struct _store_object *obj, zval *pz TSRMLS_DC)
{
+ uint idx;
Bucket *p;
zend_object_get_gc_t get_gc;
@@ -356,27 +370,29 @@ static void zobj_scan_black(struct _store_object *obj, zval *pz TSRMLS_DC)
if (!props) {
return;
}
- p = props->pListHead;
- while (p != NULL) {
- pz = *(zval**)p->pData;
+ for (idx = 0; idx < props->nNumUsed; idx++) {
+ p = props->arData + idx;
+ if (!p->xData) continue;
+ pz = (zval*)p->xData;
if (Z_TYPE_P(pz) != IS_ARRAY || Z_ARRVAL_P(pz) != &EG(symbol_table)) {
pz->refcount__gc++;
}
if (GC_ZVAL_GET_COLOR(pz) != GC_BLACK) {
zval_scan_black(pz TSRMLS_CC);
}
- p = p->pListNext;
}
}
}
static void zval_mark_grey(zval *pz TSRMLS_DC)
{
+ HashTable *ht;
+ uint idx;
Bucket *p;
tail_call:
if (GC_ZVAL_GET_COLOR(pz) != GC_GREY) {
- p = NULL;
+ ht = NULL;
GC_BENCH_INC(zval_marked_grey);
GC_ZVAL_SET_COLOR(pz, GC_GREY);
@@ -411,33 +427,36 @@ tail_call:
if (!props) {
return;
}
- p = props->pListHead;
+ ht = props;
}
}
} else if (Z_TYPE_P(pz) == IS_ARRAY) {
if (Z_ARRVAL_P(pz) == &EG(symbol_table)) {
GC_ZVAL_SET_BLACK(pz);
} else {
- p = Z_ARRVAL_P(pz)->pListHead;
+ ht = Z_ARRVAL_P(pz);
}
}
- while (p != NULL) {
- pz = *(zval**)p->pData;
+ if (!ht) return;
+ for (idx = 0; idx < ht->nNumUsed; idx++) {
+ p = ht->arData + idx;
+ if (!p->xData) continue;
+ pz = (zval*)p->xData;
if (Z_TYPE_P(pz) != IS_ARRAY || Z_ARRVAL_P(pz) != &EG(symbol_table)) {
pz->refcount__gc--;
}
- if (p->pListNext == NULL) {
+ if (idx == ht->nNumUsed-1) {
goto tail_call;
} else {
zval_mark_grey(pz TSRMLS_CC);
}
- p = p->pListNext;
}
}
}
static void zobj_mark_grey(struct _store_object *obj, zval *pz TSRMLS_DC)
{
+ uint idx;
Bucket *p;
zend_object_get_gc_t get_gc;
@@ -462,14 +481,14 @@ static void zobj_mark_grey(struct _store_object *obj, zval *pz TSRMLS_DC)
if (!props) {
return;
}
- p = props->pListHead;
- while (p != NULL) {
- pz = *(zval**)p->pData;
+ for (idx = 0; idx < props->nNumUsed; idx++) {
+ p = props->arData + idx;
+ if (!p->xData) continue;
+ pz = (zval*)p->xData;
if (Z_TYPE_P(pz) != IS_ARRAY || Z_ARRVAL_P(pz) != &EG(symbol_table)) {
pz->refcount__gc--;
}
zval_mark_grey(pz TSRMLS_CC);
- p = p->pListNext;
}
}
}
@@ -510,11 +529,13 @@ static void gc_mark_roots(TSRMLS_D)
static void zval_scan(zval *pz TSRMLS_DC)
{
+ HashTable *ht;
+ uint idx;
Bucket *p;
tail_call:
if (GC_ZVAL_GET_COLOR(pz) == GC_GREY) {
- p = NULL;
+ ht = NULL;
if (pz->refcount__gc > 0) {
zval_scan_black(pz TSRMLS_CC);
} else {
@@ -548,7 +569,7 @@ tail_call:
if (!props) {
return;
}
- p = props->pListHead;
+ ht = props;
}
}
}
@@ -556,24 +577,27 @@ tail_call:
if (Z_ARRVAL_P(pz) == &EG(symbol_table)) {
GC_ZVAL_SET_BLACK(pz);
} else {
- p = Z_ARRVAL_P(pz)->pListHead;
+ ht = Z_ARRVAL_P(pz);
}
}
}
- while (p != NULL) {
- if (p->pListNext == NULL) {
- pz = *(zval**)p->pData;
+ if (!ht) return;
+ for (idx = 0; idx < ht->nNumUsed; idx++) {
+ p = ht->arData + idx;
+ if (!p->xData) continue;
+ if (idx == ht->nNumUsed-1) {
+ pz = (zval*)p->xData;
goto tail_call;
} else {
- zval_scan(*(zval**)p->pData TSRMLS_CC);
+ zval_scan((zval*)p->xData TSRMLS_CC);
}
- p = p->pListNext;
}
}
}
static void zobj_scan(zval *pz TSRMLS_DC)
{
+ uint idx;
Bucket *p;
zend_object_get_gc_t get_gc;
@@ -600,10 +624,10 @@ static void zobj_scan(zval *pz TSRMLS_DC)
if (!props) {
return;
}
- p = props->pListHead;
- while (p != NULL) {
- zval_scan(*(zval**)p->pData TSRMLS_CC);
- p = p->pListNext;
+ for (idx = 0; idx < props->nNumUsed; idx++) {
+ p = props->arData + idx;
+ if (!p->xData) continue;
+ zval_scan((zval*)p->xData TSRMLS_CC);
}
}
}
@@ -632,11 +656,13 @@ static void gc_scan_roots(TSRMLS_D)
static void zval_collect_white(zval *pz TSRMLS_DC)
{
+ HashTable *ht;
+ uint idx;
Bucket *p;
tail_call:
if (((zval_gc_info*)(pz))->u.buffered == (gc_root_buffer*)GC_WHITE) {
- p = NULL;
+ ht = NULL;
GC_ZVAL_SET_BLACK(pz);
if (Z_TYPE_P(pz) == IS_OBJECT && EG(objects_store).object_buckets) {
@@ -678,12 +704,12 @@ tail_call:
if (!props) {
return;
}
- p = props->pListHead;
+ ht = props;
}
}
} else {
if (Z_TYPE_P(pz) == IS_ARRAY) {
- p = Z_ARRVAL_P(pz)->pListHead;
+ ht = Z_ARRVAL_P(pz);
}
}
@@ -692,23 +718,27 @@ tail_call:
((zval_gc_info*)pz)->u.next = GC_G(zval_to_free);
GC_G(zval_to_free) = (zval_gc_info*)pz;
- while (p != NULL) {
- pz = *(zval**)p->pData;
+ if (!ht) return;
+
+ for (idx = 0; idx < ht->nNumUsed; idx++) {
+ p = ht->arData + idx;
+ if (!p->xData) continue;
+ pz = (zval*)p->xData;
if (Z_TYPE_P(pz) != IS_ARRAY || Z_ARRVAL_P(pz) != &EG(symbol_table)) {
pz->refcount__gc++;
}
- if (p->pListNext == NULL) {
+ if (idx == ht->nNumUsed-1) {
goto tail_call;
} else {
zval_collect_white(pz TSRMLS_CC);
}
- p = p->pListNext;
}
}
}
static void zobj_collect_white(zval *pz TSRMLS_DC)
{
+ uint idx;
Bucket *p;
if (EG(objects_store).object_buckets) {
@@ -737,14 +767,14 @@ static void zobj_collect_white(zval *pz TSRMLS_DC)
if (!props) {
return;
}
- p = props->pListHead;
- while (p != NULL) {
- pz = *(zval**)p->pData;
+ for (idx = 0; idx < props->nNumUsed; idx++) {
+ p = props->arData + idx;
+ if (!p->xData) continue;
+ pz = (zval*)p->xData;
if (Z_TYPE_P(pz) != IS_ARRAY || Z_ARRVAL_P(pz) != &EG(symbol_table)) {
pz->refcount__gc++;
}
zval_collect_white(pz TSRMLS_CC);
- p = p->pListNext;
}
}
}
@@ -776,11 +806,15 @@ static void gc_collect_roots(TSRMLS_D)
current = current->next;
}
}
+#endif
#define FREE_LIST_END ((zval_gc_info*)(~(zend_uintptr_t)GC_COLOR))
ZEND_API int gc_collect_cycles(TSRMLS_D)
{
+//???
+ return 0;
+#if 0
int count = 0;
if (GC_G(roots).next != &GC_G(roots)) {
@@ -857,6 +891,7 @@ ZEND_API int gc_collect_cycles(TSRMLS_D)
}
return count;
+#endif
}
/*
diff --git a/Zend/zend_gc.h b/Zend/zend_gc.h
index ac5f6350a2..2f3a399c99 100644
--- a/Zend/zend_gc.h
+++ b/Zend/zend_gc.h
@@ -40,62 +40,45 @@
# define GC_BENCH_PEAK(peak, counter)
#endif
-#define GC_COLOR 0x03
+#define GC_COLOR 0xc000
-#define GC_BLACK 0x00
-#define GC_WHITE 0x01
-#define GC_GREY 0x02
-#define GC_PURPLE 0x03
+#define GC_BLACK 0x0000
+#define GC_WHITE 0x8000
+#define GC_GREY 0x4000
+#define GC_PURPLE 0xc000
#define GC_ADDRESS(v) \
- ((gc_root_buffer*)(((zend_uintptr_t)(v)) & ~GC_COLOR))
+ ((v) & ~GC_COLOR)
#define GC_SET_ADDRESS(v, a) \
- (v) = ((gc_root_buffer*)((((zend_uintptr_t)(v)) & GC_COLOR) | ((zend_uintptr_t)(a))))
+ do {(v) = ((v) & GC_COLOR) | (a);} while (0)
#define GC_GET_COLOR(v) \
(((zend_uintptr_t)(v)) & GC_COLOR)
#define GC_SET_COLOR(v, c) \
- (v) = ((gc_root_buffer*)((((zend_uintptr_t)(v)) & ~GC_COLOR) | (c)))
+ do {(v) = ((v) & ~GC_COLOR) | (c);} while (0)
#define GC_SET_BLACK(v) \
- (v) = ((gc_root_buffer*)(((zend_uintptr_t)(v)) & ~GC_COLOR))
+ do {(v) = (v) & ~GC_COLOR;} while (0)
#define GC_SET_PURPLE(v) \
- (v) = ((gc_root_buffer*)(((zend_uintptr_t)(v)) | GC_PURPLE))
+ do {(v) = (v) | GC_COLOR;} while (0)
-#define GC_ZVAL_INIT(z) \
- ((zval_gc_info*)(z))->u.buffered = NULL
#define GC_ZVAL_ADDRESS(v) \
- GC_ADDRESS(((zval_gc_info*)(v))->u.buffered)
+ GC_ADDRESS(Z_GC_BUFFER_P(v))
#define GC_ZVAL_SET_ADDRESS(v, a) \
- GC_SET_ADDRESS(((zval_gc_info*)(v))->u.buffered, (a))
+ GC_SET_ADDRESS(Z_GC_BUFFER_P(v), (a))
#define GC_ZVAL_GET_COLOR(v) \
- GC_GET_COLOR(((zval_gc_info*)(v))->u.buffered)
+ GC_GET_COLOR(Z_GC_BUFFER_P(v))
#define GC_ZVAL_SET_COLOR(v, c) \
- GC_SET_COLOR(((zval_gc_info*)(v))->u.buffered, (c))
+ GC_SET_COLOR(Z_GC_BUFFER_P(v), (c))
#define GC_ZVAL_SET_BLACK(v) \
- GC_SET_BLACK(((zval_gc_info*)(v))->u.buffered)
+ GC_SET_BLACK(Z_GC_BUFFER_P(v))
#define GC_ZVAL_SET_PURPLE(v) \
- GC_SET_PURPLE(((zval_gc_info*)(v))->u.buffered)
-
-#define GC_OBJ_INIT(z) \
- (z)->buffered = NULL
+ GC_SET_PURPLE(Z_GC_BUFFER_P(v))
typedef struct _gc_root_buffer {
struct _gc_root_buffer *prev; /* double-linked list */
struct _gc_root_buffer *next;
- zend_object_handle handle; /* must be 0 for zval */
- union {
- zval *pz;
- const zend_object_handlers *handlers;
- } u;
+ zend_refcounted *ref;
} gc_root_buffer;
-typedef struct _zval_gc_info {
- zval z;
- union {
- gc_root_buffer *buffered;
- struct _zval_gc_info *next;
- } u;
-} zval_gc_info;
-
typedef struct _zend_gc_globals {
zend_bool gc_enabled;
zend_bool gc_active;
@@ -106,9 +89,9 @@ typedef struct _zend_gc_globals {
gc_root_buffer *first_unused; /* pointer to first unused buffer */
gc_root_buffer *last_unused; /* pointer to last unused buffer */
- zval_gc_info *zval_to_free; /* temporary list of zvals to free */
- zval_gc_info *free_list;
- zval_gc_info *next_to_free;
+ zend_refcounted *zval_to_free; /* temporary list of zvals to free */
+ zend_refcounted *free_list;
+ zend_refcounted *next_to_free;
zend_uint gc_runs;
zend_uint collected;
@@ -140,9 +123,8 @@ extern ZEND_API zend_gc_globals gc_globals;
BEGIN_EXTERN_C()
ZEND_API int gc_collect_cycles(TSRMLS_D);
-ZEND_API void gc_zval_possible_root(zval *zv TSRMLS_DC);
-ZEND_API void gc_zobj_possible_root(zval *zv TSRMLS_DC);
-ZEND_API void gc_remove_zval_from_buffer(zval *zv TSRMLS_DC);
+ZEND_API void gc_zval_possible_root(zend_refcounted *ref TSRMLS_DC);
+ZEND_API void gc_remove_zval_from_buffer(zend_refcounted *ref TSRMLS_DC);
ZEND_API void gc_globals_ctor(TSRMLS_D);
ZEND_API void gc_globals_dtor(TSRMLS_D);
ZEND_API void gc_init(TSRMLS_D);
@@ -152,88 +134,19 @@ END_EXTERN_C()
#define GC_ZVAL_CHECK_POSSIBLE_ROOT(z) \
gc_zval_check_possible_root((z) TSRMLS_CC)
-#define GC_REMOVE_FROM_BUFFER(current) \
- gc_remove_from_buffer((current) TSRMLS_CC)
-
-#define GC_REMOVE_ZVAL_FROM_BUFFER(z) \
- if (GC_ADDRESS(((zval_gc_info*)z)->u.buffered)) { \
- gc_remove_zval_from_buffer(z TSRMLS_CC); \
- }
-
-#define GC_ZOBJ_CHECK_POSSIBLE_ROOT(zobject) \
- do { \
- if (EXPECTED(EG(objects_store).object_buckets != NULL) && \
- EG(objects_store).object_buckets[Z_OBJ_HANDLE_P(zobject)].valid) { \
- gc_zobj_possible_root(zobject TSRMLS_CC); \
- } \
- } while (0)
-
-#define GC_REMOVE_ZOBJ_FROM_BUFFER(obj) \
- do { \
- if (GC_ADDRESS((obj)->buffered) && !GC_G(gc_active)) { \
- GC_BENCH_INC(zobj_remove_from_buffer); \
- GC_REMOVE_FROM_BUFFER(GC_ADDRESS((obj)->buffered)); \
- (obj)->buffered = NULL; \
- } \
+#define GC_REMOVE_ZVAL_FROM_BUFFER(z) do { \
+ if (GC_ZVAL_ADDRESS(z)) { \
+ gc_remove_zval_from_buffer(Z_COUNTED_P(z) TSRMLS_CC); \
+ } \
} while (0)
static zend_always_inline void gc_zval_check_possible_root(zval *z TSRMLS_DC)
{
- if (z->type == IS_ARRAY || z->type == IS_OBJECT) {
- gc_zval_possible_root(z TSRMLS_CC);
+ if (Z_TYPE_P(z) == IS_ARRAY || Z_TYPE_P(z) == IS_OBJECT) {
+ gc_zval_possible_root(Z_COUNTED_P(z) TSRMLS_CC);
}
}
-static zend_always_inline void gc_remove_from_buffer(gc_root_buffer *root TSRMLS_DC)
-{
- root->next->prev = root->prev;
- root->prev->next = root->next;
- root->prev = GC_G(unused);
- GC_G(unused) = root;
- GC_BENCH_DEC(root_buf_length);
-}
-
-#define ALLOC_PERMANENT_ZVAL(z) \
- do { \
- (z) = (zval*)malloc(sizeof(zval_gc_info)); \
- GC_ZVAL_INIT(z); \
- } while (0)
-
-/* The following macros override macros from zend_alloc.h */
-#undef ALLOC_ZVAL
-#define ALLOC_ZVAL(z) \
- do { \
- (z) = (zval*)emalloc(sizeof(zval_gc_info)); \
- GC_ZVAL_INIT(z); \
- } while (0)
-
-#undef FREE_ZVAL
-#define FREE_ZVAL(z) \
- do { \
- GC_REMOVE_ZVAL_FROM_BUFFER(z); \
- efree(z); \
- } while (0)
-
-#undef ALLOC_ZVAL_REL
-#define ALLOC_ZVAL_REL(z) \
- do { \
- (z) = (zval*)emalloc_rel(sizeof(zval_gc_info)); \
- GC_ZVAL_INIT(z); \
- } while (0)
-
-#undef FREE_ZVAL_REL
-#define FREE_ZVAL_REL(z) \
- do { \
- GC_REMOVE_ZVAL_FROM_BUFFER(z); \
- efree_rel(z); \
- } while (0)
-
-#define FREE_ZVAL_EX(z) \
- efree(z)
-
-#define FREE_ZVAL_REL_EX(z) \
- efree_rel(z)
-
#endif /* ZEND_GC_H */
/*
diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c
index 7d7c330710..e379e98968 100644
--- a/Zend/zend_generators.c
+++ b/Zend/zend_generators.c
@@ -27,7 +27,7 @@
ZEND_API zend_class_entry *zend_ce_generator;
static zend_object_handlers zend_generator_handlers;
-static zend_object_value zend_generator_create(zend_class_entry *class_type TSRMLS_DC);
+static zend_object *zend_generator_create(zend_class_entry *class_type TSRMLS_DC);
static void zend_generator_cleanup_unfinished_execution(zend_generator *generator TSRMLS_DC) /* {{{ */
{
@@ -35,7 +35,7 @@ static void zend_generator_cleanup_unfinished_execution(zend_generator *generato
zend_op_array *op_array = execute_data->op_array;
if (generator->send_target) {
- Z_DELREF_PP(generator->send_target);
+ Z_DELREF_P(generator->send_target);
generator->send_target = NULL;
}
@@ -60,14 +60,14 @@ static void zend_generator_cleanup_unfinished_execution(zend_generator *generato
switch (brk_opline->opcode) {
case ZEND_SWITCH_FREE:
{
- temp_variable *var = EX_TMP_VAR(execute_data, brk_opline->op1.var);
- zval_ptr_dtor(&var->var.ptr);
+ zval *var = EX_VAR_2(execute_data, brk_opline->op1.var);
+ zval_ptr_dtor(var);
}
break;
case ZEND_FREE:
{
- temp_variable *var = EX_TMP_VAR(execute_data, brk_opline->op1.var);
- zval_dtor(&var->tmp_var);
+ zval *var = EX_VAR_2(execute_data, brk_opline->op1.var);
+ zval_dtor(var);
}
break;
}
@@ -77,20 +77,18 @@ static void zend_generator_cleanup_unfinished_execution(zend_generator *generato
/* Clear any backed up stack arguments */
{
- void **ptr = generator->stack->top - 1;
- void **end = zend_vm_stack_frame_base(execute_data);
+ zval *ptr = generator->stack->top - 1;
+ zval *end = zend_vm_stack_frame_base(execute_data);
for (; ptr >= end; --ptr) {
- zval_ptr_dtor((zval **) ptr);
+ zval_ptr_dtor((zval*) ptr);
}
}
/* If yield was used as a function argument there may be active
* method calls those objects need to be freed */
while (execute_data->call >= execute_data->call_slots) {
- if (execute_data->call->object) {
- zval_ptr_dtor(&execute_data->call->object);
- }
+ zval_ptr_dtor(&execute_data->call->object);
execute_data->call--;
}
}
@@ -98,14 +96,14 @@ static void zend_generator_cleanup_unfinished_execution(zend_generator *generato
ZEND_API void zend_generator_close(zend_generator *generator, zend_bool finished_execution TSRMLS_DC) /* {{{ */
{
- if (generator->value) {
+ if (Z_TYPE(generator->value) != IS_UNDEF) {
zval_ptr_dtor(&generator->value);
- generator->value = NULL;
+ ZVAL_UNDEF(&generator->value);
}
- if (generator->key) {
+ if (Z_TYPE(generator->key) != IS_UNDEF) {
zval_ptr_dtor(&generator->key);
- generator->key = NULL;
+ ZVAL_UNDEF(&generator->key);
}
if (generator->execute_data) {
@@ -118,9 +116,9 @@ ZEND_API void zend_generator_close(zend_generator *generator, zend_bool finished
zend_clean_and_cache_symbol_table(execute_data->symbol_table TSRMLS_CC);
}
- if (execute_data->current_this) {
- zval_ptr_dtor(&execute_data->current_this);
- }
+//??? if (execute_data->current_this) {
+//??? zval_ptr_dtor(&execute_data->current_this);
+//??? }
/* A fatal error / die occurred during the generator execution. Trying to clean
* up the stack may not be safe in this case. */
@@ -133,11 +131,11 @@ ZEND_API void zend_generator_close(zend_generator *generator, zend_bool finished
* generator (for func_get_args) so those have to be freed too. */
{
zend_execute_data *prev_execute_data = execute_data->prev_execute_data;
- void **arguments = prev_execute_data->function_state.arguments;
+ zval *arguments = prev_execute_data->function_state.arguments;
if (arguments) {
- int arguments_count = (int) (zend_uintptr_t) *arguments;
- zval **arguments_start = (zval **) (arguments - arguments_count);
+ int arguments_count = Z_LVAL_P(arguments);
+ zval *arguments_start = arguments - arguments_count;
int i;
for (i = 0; i < arguments_count; ++i) {
@@ -164,8 +162,9 @@ ZEND_API void zend_generator_close(zend_generator *generator, zend_bool finished
}
/* }}} */
-static void zend_generator_dtor_storage(zend_generator *generator, zend_object_handle handle TSRMLS_DC) /* {{{ */
+static void zend_generator_dtor_storage(zend_object *object TSRMLS_DC) /* {{{ */
{
+ zend_generator *generator = (zend_generator*) object;
zend_execute_data *ex = generator->execute_data;
zend_uint op_num, finally_op_num;
int i;
@@ -203,8 +202,10 @@ static void zend_generator_dtor_storage(zend_generator *generator, zend_object_h
}
/* }}} */
-static void zend_generator_free_storage(zend_generator *generator TSRMLS_DC) /* {{{ */
+static void zend_generator_free_storage(zend_object *object TSRMLS_DC) /* {{{ */
{
+ zend_generator *generator = (zend_generator*) object;
+
zend_generator_close(generator, 0 TSRMLS_CC);
zend_object_std_dtor(&generator->std TSRMLS_CC);
@@ -212,10 +213,9 @@ static void zend_generator_free_storage(zend_generator *generator TSRMLS_DC) /*
}
/* }}} */
-static zend_object_value zend_generator_create(zend_class_entry *class_type TSRMLS_DC) /* {{{ */
+static zend_object *zend_generator_create(zend_class_entry *class_type TSRMLS_DC) /* {{{ */
{
zend_generator *generator;
- zend_object_value object;
generator = emalloc(sizeof(zend_generator));
memset(generator, 0, sizeof(zend_generator));
@@ -224,33 +224,26 @@ static zend_object_value zend_generator_create(zend_class_entry *class_type TSRM
generator->largest_used_integer_key = -1;
zend_object_std_init(&generator->std, class_type TSRMLS_CC);
+ generator->std.handlers = &zend_generator_handlers;
- object.handle = zend_objects_store_put(generator,
- (zend_objects_store_dtor_t) zend_generator_dtor_storage,
- (zend_objects_free_object_storage_t) zend_generator_free_storage,
- NULL TSRMLS_CC
- );
- object.handlers = &zend_generator_handlers;
-
- return object;
+ return (zend_object*)generator;
}
/* }}} */
-static void copy_closure_static_var(zval **var TSRMLS_DC, int num_args, va_list args, zend_hash_key *key) /* {{{ */
+static void copy_closure_static_var(zval *var TSRMLS_DC, int num_args, va_list args, zend_hash_key *key) /* {{{ */
{
HashTable *target = va_arg(args, HashTable *);
SEPARATE_ZVAL_TO_MAKE_IS_REF(var);
- Z_ADDREF_PP(var);
- zend_hash_quick_update(target, key->arKey, key->nKeyLength, key->h, var, sizeof(zval *), NULL);
+ Z_ADDREF_P(var);
+ zend_hash_update(target, key->key, var);
}
/* }}} */
/* Requires globals EG(scope), EG(current_scope), EG(This),
* EG(active_symbol_table) and EG(current_execute_data). */
-ZEND_API zval *zend_generator_create_zval(zend_op_array *op_array TSRMLS_DC) /* {{{ */
+ZEND_API void zend_generator_create_zval(zend_op_array *op_array, zval *return_value TSRMLS_DC) /* {{{ */
{
- zval *return_value;
zend_generator *generator;
zend_execute_data *current_execute_data;
zend_op **opline_ptr;
@@ -294,26 +287,23 @@ ZEND_API zval *zend_generator_create_zval(zend_op_array *op_array TSRMLS_DC) /*
EG(current_execute_data) = current_execute_data;
EG(opline_ptr) = opline_ptr;
- ALLOC_INIT_ZVAL(return_value);
object_init_ex(return_value, zend_ce_generator);
- if (EG(This)) {
- Z_ADDREF_P(EG(This));
+ if (Z_TYPE(EG(This)) != IS_UNDEF) {
+ Z_ADDREF(EG(This));
}
/* Back up executor globals. */
- execute_data->current_scope = EG(scope);
- execute_data->current_called_scope = EG(called_scope);
+//??? execute_data->current_scope = EG(scope);
+//??? execute_data->current_called_scope = EG(called_scope);
execute_data->symbol_table = EG(active_symbol_table);
- execute_data->current_this = EG(This);
+//??? execute_data->current_this = EG(This);
/* Save execution context in generator object. */
- generator = (zend_generator *) zend_object_store_get_object(return_value TSRMLS_CC);
+ generator = (zend_generator *) Z_OBJ_P(return_value);
generator->execute_data = execute_data;
generator->stack = EG(argument_stack);
EG(argument_stack) = current_stack;
-
- return return_value;
}
/* }}} */
@@ -341,28 +331,30 @@ ZEND_API void zend_generator_resume(zend_generator *generator TSRMLS_DC) /* {{{
{
/* Backup executor globals */
- zval **original_return_value_ptr_ptr = EG(return_value_ptr_ptr);
+//??? zval **original_return_value_ptr_ptr = EG(return_value_ptr_ptr);
zend_execute_data *original_execute_data = EG(current_execute_data);
zend_op **original_opline_ptr = EG(opline_ptr);
zend_op_array *original_active_op_array = EG(active_op_array);
HashTable *original_active_symbol_table = EG(active_symbol_table);
- zval *original_This = EG(This);
+ zval original_This;
zend_class_entry *original_scope = EG(scope);
zend_class_entry *original_called_scope = EG(called_scope);
zend_vm_stack original_stack = EG(argument_stack);
+ ZVAL_COPY_VALUE(&original_This, &EG(This));
+
/* We (mis)use the return_value_ptr_ptr to provide the generator object
* to the executor, so YIELD will be able to set the yielded value */
- EG(return_value_ptr_ptr) = (zval **) generator;
+//??? EG(return_value_ptr_ptr) = (zval **) generator;
/* Set executor globals */
EG(current_execute_data) = generator->execute_data;
EG(opline_ptr) = &generator->execute_data->opline;
EG(active_op_array) = generator->execute_data->op_array;
EG(active_symbol_table) = generator->execute_data->symbol_table;
- EG(This) = generator->execute_data->current_this;
- EG(scope) = generator->execute_data->current_scope;
- EG(called_scope) = generator->execute_data->current_called_scope;
+//??? EG(This) = generator->execute_data->current_this;
+//??? EG(scope) = generator->execute_data->current_scope;
+//??? EG(called_scope) = generator->execute_data->current_called_scope;
EG(argument_stack) = generator->stack;
/* We want the backtrace to look as if the generator function was
@@ -379,7 +371,7 @@ ZEND_API void zend_generator_resume(zend_generator *generator TSRMLS_DC) /* {{{
generator->flags &= ~ZEND_GENERATOR_CURRENTLY_RUNNING;
/* Restore executor globals */
- EG(return_value_ptr_ptr) = original_return_value_ptr_ptr;
+//??? EG(return_value_ptr_ptr) = original_return_value_ptr_ptr;
EG(current_execute_data) = original_execute_data;
EG(opline_ptr) = original_opline_ptr;
EG(active_op_array) = original_active_op_array;
@@ -400,7 +392,7 @@ ZEND_API void zend_generator_resume(zend_generator *generator TSRMLS_DC) /* {{{
static void zend_generator_ensure_initialized(zend_generator *generator TSRMLS_DC) /* {{{ */
{
- if (generator->execute_data && !generator->value) {
+ if (generator->execute_data && Z_TYPE(generator->value) == IS_UNDEF) {
zend_generator_resume(generator TSRMLS_CC);
generator->flags |= ZEND_GENERATOR_AT_FIRST_YIELD;
}
@@ -427,7 +419,7 @@ ZEND_METHOD(Generator, rewind)
return;
}
- generator = (zend_generator *) zend_object_store_get_object(getThis() TSRMLS_CC);
+ generator = (zend_generator *) Z_OBJ_P(getThis());
zend_generator_rewind(generator TSRMLS_CC);
}
@@ -443,11 +435,11 @@ ZEND_METHOD(Generator, valid)
return;
}
- generator = (zend_generator *) zend_object_store_get_object(getThis() TSRMLS_CC);
+ generator = (zend_generator *) Z_OBJ_P(getThis());
zend_generator_ensure_initialized(generator TSRMLS_CC);
- RETURN_BOOL(generator->value != NULL);
+ RETURN_BOOL(Z_TYPE(generator->value) != IS_UNDEF);
}
/* }}} */
@@ -461,12 +453,12 @@ ZEND_METHOD(Generator, current)
return;
}
- generator = (zend_generator *) zend_object_store_get_object(getThis() TSRMLS_CC);
+ generator = (zend_generator *) Z_OBJ_P(getThis());
zend_generator_ensure_initialized(generator TSRMLS_CC);
- if (generator->value) {
- RETURN_ZVAL_FAST(generator->value);
+ if (Z_TYPE(generator->value) != IS_UNDEF) {
+ RETURN_ZVAL_FAST(&generator->value);
}
}
/* }}} */
@@ -481,12 +473,12 @@ ZEND_METHOD(Generator, key)
return;
}
- generator = (zend_generator *) zend_object_store_get_object(getThis() TSRMLS_CC);
+ generator = (zend_generator *) Z_OBJ_P(getThis());
zend_generator_ensure_initialized(generator TSRMLS_CC);
- if (generator->key) {
- RETURN_ZVAL_FAST(generator->key);
+ if (Z_TYPE(generator->key) != IS_UNDEF) {
+ RETURN_ZVAL_FAST(&generator->key);
}
}
/* }}} */
@@ -501,7 +493,7 @@ ZEND_METHOD(Generator, next)
return;
}
- generator = (zend_generator *) zend_object_store_get_object(getThis() TSRMLS_CC);
+ generator = (zend_generator *) Z_OBJ_P(getThis());
zend_generator_ensure_initialized(generator TSRMLS_CC);
@@ -520,7 +512,7 @@ ZEND_METHOD(Generator, send)
return;
}
- generator = (zend_generator *) zend_object_store_get_object(getThis() TSRMLS_CC);
+ generator = (zend_generator *) Z_OBJ_P(getThis());
zend_generator_ensure_initialized(generator TSRMLS_CC);
@@ -531,15 +523,15 @@ ZEND_METHOD(Generator, send)
/* Put sent value in the target VAR slot, if it is used */
if (generator->send_target) {
- Z_DELREF_PP(generator->send_target);
+ Z_DELREF_P(generator->send_target);
Z_ADDREF_P(value);
- *generator->send_target = value;
+ ZVAL_COPY_VALUE(generator->send_target, value);
}
zend_generator_resume(generator TSRMLS_CC);
- if (generator->value) {
- RETURN_ZVAL_FAST(generator->value);
+ if (Z_TYPE(generator->value) != IS_UNDEF) {
+ RETURN_ZVAL_FAST(&generator->value);
}
}
/* }}} */
@@ -548,17 +540,16 @@ ZEND_METHOD(Generator, send)
* Throws an exception into the generator */
ZEND_METHOD(Generator, throw)
{
- zval *exception, *exception_copy;
+ zval *exception, exception_copy;
zend_generator *generator;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &exception) == FAILURE) {
return;
}
- ALLOC_ZVAL(exception_copy);
- MAKE_COPY_ZVAL(&exception, exception_copy);
+ ZVAL_COPY_VALUE(&exception_copy, exception);
- generator = (zend_generator *) zend_object_store_get_object(getThis() TSRMLS_CC);
+ generator = (zend_generator *) Z_OBJ_P(getThis());
zend_generator_ensure_initialized(generator TSRMLS_CC);
@@ -567,19 +558,19 @@ ZEND_METHOD(Generator, throw)
zend_execute_data *current_execute_data = EG(current_execute_data);
EG(current_execute_data) = generator->execute_data;
- zend_throw_exception_object(exception_copy TSRMLS_CC);
+ zend_throw_exception_object(&exception_copy TSRMLS_CC);
EG(current_execute_data) = current_execute_data;
zend_generator_resume(generator TSRMLS_CC);
- if (generator->value) {
- RETURN_ZVAL_FAST(generator->value);
+ if (Z_TYPE(generator->value) != IS_UNDEF) {
+ RETURN_ZVAL_FAST(&generator->value);
}
} else {
/* If the generator is already closed throw the exception in the
* current context */
- zend_throw_exception_object(exception_copy TSRMLS_CC);
+ zend_throw_exception_object(&exception_copy TSRMLS_CC);
}
}
/* }}} */
@@ -606,7 +597,7 @@ static void zend_generator_iterator_dtor(zend_object_iterator *iterator TSRMLS_D
{
zval *object = ((zend_generator_iterator *) iterator)->object;
- zval_ptr_dtor(&object);
+ zval_ptr_dtor(object);
}
/* }}} */
@@ -616,21 +607,17 @@ static int zend_generator_iterator_valid(zend_object_iterator *iterator TSRMLS_D
zend_generator_ensure_initialized(generator TSRMLS_CC);
- return generator->value != NULL ? SUCCESS : FAILURE;
+ return Z_TYPE(generator->value) != IS_UNDEF ? SUCCESS : FAILURE;
}
/* }}} */
-static void zend_generator_iterator_get_data(zend_object_iterator *iterator, zval ***data TSRMLS_DC) /* {{{ */
+static zval *zend_generator_iterator_get_data(zend_object_iterator *iterator TSRMLS_DC) /* {{{ */
{
zend_generator *generator = (zend_generator *) iterator->data;
zend_generator_ensure_initialized(generator TSRMLS_CC);
- if (generator->value) {
- *data = &generator->value;
- } else {
- *data = NULL;
- }
+ return &generator->value;
}
/* }}} */
@@ -640,8 +627,8 @@ static void zend_generator_iterator_get_key(zend_object_iterator *iterator, zval
zend_generator_ensure_initialized(generator TSRMLS_CC);
- if (generator->key) {
- ZVAL_ZVAL(key, generator->key, 1, 0);
+ if (Z_TYPE(generator->key) != IS_UNDEF) {
+ ZVAL_ZVAL(key, &generator->key, 1, 0);
} else {
ZVAL_NULL(key);
}
@@ -680,7 +667,7 @@ zend_object_iterator *zend_generator_get_iterator(zend_class_entry *ce, zval *ob
zend_generator_iterator *iterator;
zend_generator *generator;
- generator = (zend_generator *) zend_object_store_get_object(object TSRMLS_CC);
+ generator = (zend_generator *) Z_OBJ_P(object);
if (!generator->execute_data) {
zend_throw_exception(NULL, "Cannot traverse an already closed generator", 0 TSRMLS_CC);
@@ -745,8 +732,10 @@ void zend_register_generator_ce(TSRMLS_D) /* {{{ */
zend_ce_generator->iterator_funcs.funcs = &zend_generator_iterator_functions;
memcpy(&zend_generator_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
- zend_generator_handlers.get_constructor = zend_generator_get_constructor;
+ zend_generator_handlers.free_obj = zend_generator_free_storage;
+ zend_generator_handlers.dtor_obj = zend_generator_dtor_storage;
zend_generator_handlers.clone_obj = NULL;
+ zend_generator_handlers.get_constructor = zend_generator_get_constructor;
}
/* }}} */
diff --git a/Zend/zend_generators.h b/Zend/zend_generators.h
index 2373a1a7c8..d466061457 100644
--- a/Zend/zend_generators.h
+++ b/Zend/zend_generators.h
@@ -45,11 +45,11 @@ typedef struct _zend_generator {
zend_vm_stack stack;
/* Current value */
- zval *value;
+ zval value;
/* Current key */
- zval *key;
+ zval key;
/* Variable to put sent value into */
- zval **send_target;
+ zval *send_target;
/* Largest used integer key for auto-incrementing keys */
long largest_used_integer_key;
@@ -62,7 +62,7 @@ static const zend_uchar ZEND_GENERATOR_FORCED_CLOSE = 0x2;
static const zend_uchar ZEND_GENERATOR_AT_FIRST_YIELD = 0x4;
void zend_register_generator_ce(TSRMLS_D);
-ZEND_API zval *zend_generator_create_zval(zend_op_array *op_array TSRMLS_DC);
+ZEND_API void zend_generator_create_zval(zend_op_array *op_array, zval *return_value TSRMLS_DC);
ZEND_API void zend_generator_close(zend_generator *generator, zend_bool finished_execution TSRMLS_DC);
ZEND_API void zend_generator_resume(zend_generator *generator TSRMLS_DC);
diff --git a/Zend/zend_globals.h b/Zend/zend_globals.h
index 31dd9af619..ee9c1a2f33 100644
--- a/Zend/zend_globals.h
+++ b/Zend/zend_globals.h
@@ -85,7 +85,7 @@ struct _zend_compiler_globals {
zend_stack function_call_stack;
- char *compiled_filename;
+ zend_string *compiled_filename;
int zend_lineno;
@@ -124,12 +124,11 @@ struct _zend_compiler_globals {
zend_uint access_type;
- char *doc_comment;
- zend_uint doc_comment_len;
+ zend_string *doc_comment;
zend_uint compiler_options; /* set of ZEND_COMPILE_* constants */
- zval *current_namespace;
+ zval current_namespace;
HashTable *current_import;
HashTable *current_import_function;
HashTable *current_import_const;
@@ -141,14 +140,7 @@ struct _zend_compiler_globals {
zend_compiler_context context;
zend_stack context_stack;
- /* interned strings */
- char *interned_strings_start;
- char *interned_strings_end;
- char *interned_strings_top;
- char *interned_strings_snapshot_top;
-#ifndef ZTS
- char *interned_empty_string;
-#endif
+ zend_string *empty_string;
HashTable interned_strings;
@@ -166,13 +158,10 @@ struct _zend_compiler_globals {
struct _zend_executor_globals {
- zval **return_value_ptr_ptr;
+//??? zval **return_value_ptr_ptr;
zval uninitialized_zval;
- zval *uninitialized_zval_ptr;
-
zval error_zval;
- zval *error_zval_ptr;
/* symbol table cache */
HashTable *symtable_cache[SYMTABLE_CACHE_SIZE];
@@ -182,7 +171,7 @@ struct _zend_executor_globals {
zend_op **opline_ptr;
HashTable *active_symbol_table;
- HashTable symbol_table; /* main symbol table */
+ zend_array symbol_table; /* main symbol table */
HashTable included_files; /* files already included */
@@ -201,7 +190,7 @@ struct _zend_executor_globals {
zend_class_entry *scope;
zend_class_entry *called_scope; /* Scope of the calling class */
- zval *This;
+ zval This;
long precision;
@@ -226,11 +215,11 @@ struct _zend_executor_globals {
zend_vm_stack argument_stack;
int user_error_handler_error_reporting;
- zval *user_error_handler;
- zval *user_exception_handler;
+ zval user_error_handler;
+ zval user_exception_handler;
zend_stack user_error_handlers_error_reporting;
- zend_ptr_stack user_error_handlers;
- zend_ptr_stack user_exception_handlers;
+ zend_stack user_error_handlers;
+ zend_stack user_exception_handlers;
zend_error_handling_t error_handling;
zend_class_entry *exception_class;
@@ -245,7 +234,7 @@ struct _zend_executor_globals {
zend_ini_entry *error_reporting_ini_entry;
zend_objects_store objects_store;
- zval *exception, *prev_exception;
+ zend_object *exception, *prev_exception;
zend_op *opline_before_exception;
zend_op exception_op[3];
@@ -313,6 +302,9 @@ struct _zend_php_scanner_globals {
zend_encoding_filter input_filter;
zend_encoding_filter output_filter;
const zend_encoding *script_encoding;
+
+ /* initial string length after scanning to first variable */
+ int scanned_string_len;
};
#endif /* ZEND_GLOBALS_H */
diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c
index 829cd33641..901f6de43a 100644
--- a/Zend/zend_hash.c
+++ b/Zend/zend_hash.c
@@ -22,39 +22,21 @@
#include "zend.h"
#include "zend_globals.h"
-#define CONNECT_TO_BUCKET_DLLIST(element, list_head) \
- (element)->pNext = (list_head); \
- (element)->pLast = NULL; \
- if ((element)->pNext) { \
- (element)->pNext->pLast = (element); \
- }
-
-#define CONNECT_TO_GLOBAL_DLLIST(element, ht) \
- (element)->pListLast = (ht)->pListTail; \
- (ht)->pListTail = (element); \
- (element)->pListNext = NULL; \
- if ((element)->pListLast != NULL) { \
- (element)->pListLast->pListNext = (element); \
- } \
- if (!(ht)->pListHead) { \
- (ht)->pListHead = (element); \
- } \
- if ((ht)->pInternalPointer == NULL) { \
- (ht)->pInternalPointer = (element); \
- }
-
#if ZEND_DEBUG
-#define HT_OK 0
-#define HT_IS_DESTROYING 1
-#define HT_DESTROYED 2
-#define HT_CLEANING 3
+/*
+#define HASH_MASK_CONSISTENCY 0x60
+*/
+#define HT_OK 0x00
+#define HT_IS_DESTROYING 0x20
+#define HT_DESTROYED 0x40
+#define HT_CLEANING 0x60
static void _zend_is_inconsistent(const HashTable *ht, const char *file, int line)
{
- if (ht->inconsistent==HT_OK) {
+ if ((ht->flags & HASH_MASK_CONSISTENCY) == HT_OK) {
return;
}
- switch (ht->inconsistent) {
+ switch ((ht->flags & HASH_MASK_CONSISTENCY)) {
case HT_IS_DESTROYING:
zend_output_debug_string(1, "%s(%d) : ht=%p is being destroyed", file, line, ht);
break;
@@ -71,75 +53,47 @@ static void _zend_is_inconsistent(const HashTable *ht, const char *file, int lin
zend_bailout();
}
#define IS_CONSISTENT(a) _zend_is_inconsistent(a, __FILE__, __LINE__);
-#define SET_INCONSISTENT(n) ht->inconsistent = n;
+#define SET_INCONSISTENT(n) do { \
+ (ht)->flags |= n; \
+ } while (0)
#else
#define IS_CONSISTENT(a)
#define SET_INCONSISTENT(n)
#endif
#define HASH_PROTECT_RECURSION(ht) \
- if ((ht)->bApplyProtection) { \
+ if ((ht)->flags & HASH_FLAG_APPLY_PROTECTION) { \
if ((ht)->nApplyCount++ >= 3) { \
zend_error(E_ERROR, "Nesting level too deep - recursive dependency?"); \
} \
}
-
#define HASH_UNPROTECT_RECURSION(ht) \
- if ((ht)->bApplyProtection) { \
+ if ((ht)->flags & HASH_FLAG_APPLY_PROTECTION) { \
(ht)->nApplyCount--; \
}
-
#define ZEND_HASH_IF_FULL_DO_RESIZE(ht) \
- if ((ht)->nNumOfElements > (ht)->nTableSize) { \
+ if ((ht)->nNumUsed >= (ht)->nTableSize) { \
zend_hash_do_resize(ht); \
}
static void zend_hash_do_resize(HashTable *ht);
-ZEND_API ulong zend_hash_func(const char *arKey, uint nKeyLength)
-{
- return zend_inline_hash_func(arKey, nKeyLength);
-}
-
-
-#define UPDATE_DATA(ht, p, pData, nDataSize) \
- if (nDataSize == sizeof(void*)) { \
- if ((p)->pData != &(p)->pDataPtr) { \
- pefree_rel((p)->pData, (ht)->persistent); \
- } \
- memcpy(&(p)->pDataPtr, pData, sizeof(void *)); \
- (p)->pData = &(p)->pDataPtr; \
- } else { \
- if ((p)->pData == &(p)->pDataPtr) { \
- (p)->pData = (void *) pemalloc_rel(nDataSize, (ht)->persistent); \
- (p)->pDataPtr=NULL; \
- } else { \
- (p)->pData = (void *) perealloc_rel((p)->pData, nDataSize, (ht)->persistent); \
- /* (p)->pDataPtr is already NULL so no need to initialize it */ \
- } \
- memcpy((p)->pData, pData, nDataSize); \
- }
-
-#define INIT_DATA(ht, p, pData, nDataSize); \
- if (nDataSize == sizeof(void*)) { \
- memcpy(&(p)->pDataPtr, pData, sizeof(void *)); \
- (p)->pData = &(p)->pDataPtr; \
- } else { \
- (p)->pData = (void *) pemalloc_rel(nDataSize, (ht)->persistent);\
- memcpy((p)->pData, pData, nDataSize); \
- (p)->pDataPtr=NULL; \
- }
-
-#define CHECK_INIT(ht) do { \
- if (UNEXPECTED((ht)->nTableMask == 0)) { \
- (ht)->arBuckets = (Bucket **) pecalloc((ht)->nTableSize, sizeof(Bucket *), (ht)->persistent); \
+#define CHECK_INIT(ht, packed) do { \
+ if (UNEXPECTED((ht)->nTableMask == 0)) { \
+ (ht)->arData = (Bucket *) pecalloc((ht)->nTableSize, sizeof(Bucket), (ht)->flags & HASH_FLAG_PERSISTENT); \
+ if (packed) { \
+ (ht)->flags |= HASH_FLAG_PACKED; \
+ } else { \
+ (ht)->arHash = (zend_uint*) pecalloc((ht)->nTableSize, sizeof(zend_uint), (ht)->flags & HASH_FLAG_PERSISTENT); \
+ memset((ht)->arHash, INVALID_IDX, (ht)->nTableSize * sizeof(zend_uint)); \
+ } \
(ht)->nTableMask = (ht)->nTableSize - 1; \
} \
} while (0)
-static const Bucket *uninitialized_bucket = NULL;
+static const zend_uint uninitialized_bucket = {INVALID_IDX};
ZEND_API int _zend_hash_init(HashTable *ht, uint nSize, dtor_func_t pDestructor, zend_bool persistent ZEND_FILE_LINE_DC)
{
@@ -159,104 +113,136 @@ ZEND_API int _zend_hash_init(HashTable *ht, uint nSize, dtor_func_t pDestructor,
ht->nTableMask = 0; /* 0 means that ht->arBuckets is uninitialized */
ht->pDestructor = pDestructor;
- ht->arBuckets = (Bucket**)&uninitialized_bucket;
- ht->pListHead = NULL;
- ht->pListTail = NULL;
+ ht->arData = NULL;
+ ht->arHash = (zend_uint*)&uninitialized_bucket;
+ ht->nNumUsed = 0;
ht->nNumOfElements = 0;
ht->nNextFreeElement = 0;
- ht->pInternalPointer = NULL;
- ht->persistent = persistent;
+ ht->nInternalPointer = INVALID_IDX;
+ ht->flags = HASH_FLAG_APPLY_PROTECTION;
+ if (persistent) {
+ ht->flags |= HASH_FLAG_PERSISTENT;
+ }
ht->nApplyCount = 0;
- ht->bApplyProtection = 1;
return SUCCESS;
}
+static void zend_hash_packed_grow(HashTable *ht)
+{
+ HANDLE_BLOCK_INTERRUPTIONS();
+ ht->arData = (Bucket *) perealloc(ht->arData, (ht->nTableSize << 1) * sizeof(Bucket), ht->flags & HASH_FLAG_PERSISTENT);
+ memset(ht->arData + ht->nTableSize, 0, sizeof(Bucket) * ht->nTableSize);
+ ht->nTableSize = (ht->nTableSize << 1);
+ ht->nTableMask = ht->nTableSize - 1;
+ HANDLE_UNBLOCK_INTERRUPTIONS();
+}
+
+ZEND_API void zend_hash_packed_to_hash(HashTable *ht)
+{
+ HANDLE_BLOCK_INTERRUPTIONS();
+ ht->flags &= ~HASH_FLAG_PACKED;
+ ht->arHash = (zend_uint*) pecalloc(ht->nTableSize, sizeof(zend_uint), ht->flags & HASH_FLAG_PERSISTENT);
+ zend_hash_rehash(ht);
+ HANDLE_UNBLOCK_INTERRUPTIONS();
+}
+
+ZEND_API void zend_hash_to_packed(HashTable *ht)
+{
+ HANDLE_BLOCK_INTERRUPTIONS();
+ ht->flags |= HASH_FLAG_PACKED;
+ pefree(ht->arHash, ht->flags & HASH_FLAG_PERSISTENT);
+ ht->arHash = (zend_uint*)&uninitialized_bucket;
+ HANDLE_UNBLOCK_INTERRUPTIONS();
+}
ZEND_API int _zend_hash_init_ex(HashTable *ht, uint nSize, dtor_func_t pDestructor, zend_bool persistent, zend_bool bApplyProtection ZEND_FILE_LINE_DC)
{
int retval = _zend_hash_init(ht, nSize, pDestructor, persistent ZEND_FILE_LINE_CC);
- ht->bApplyProtection = bApplyProtection;
+ if (!bApplyProtection) {
+ ht->flags &= ~HASH_FLAG_APPLY_PROTECTION;
+ }
return retval;
}
ZEND_API void zend_hash_set_apply_protection(HashTable *ht, zend_bool bApplyProtection)
{
- ht->bApplyProtection = bApplyProtection;
+ if (bApplyProtection) {
+ ht->flags |= HASH_FLAG_APPLY_PROTECTION;
+ } else {
+ ht->flags &= ~HASH_FLAG_APPLY_PROTECTION;
+ }
}
-
-
-ZEND_API int _zend_hash_add_or_update(HashTable *ht, const char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC)
+static zend_always_inline Bucket *zend_hash_find_bucket(const HashTable *ht, zend_string *key)
{
ulong h;
uint nIndex;
+ uint idx;
Bucket *p;
-#ifdef ZEND_SIGNALS
- TSRMLS_FETCH();
-#endif
- IS_CONSISTENT(ht);
-
- ZEND_ASSERT(nKeyLength != 0);
+ h = STR_HASH_VAL(key);
+ nIndex = h & ht->nTableMask;
+ idx = ht->arHash[nIndex];
+ while (idx != INVALID_IDX) {
+ p = ht->arData + idx;
+ if ((p->key == key) || /* check for the the same interned string */
+ (p->h == h &&
+ p->key &&
+ p->key->len == key->len &&
+ memcmp(p->key->val, key->val, key->len) == 0)) {
+ return p;
+ }
+ idx = p->val.u.next;
+ }
+ return NULL;
+}
- CHECK_INIT(ht);
+static zend_always_inline Bucket *zend_hash_str_find_bucket(const HashTable *ht, const char *str, int len, ulong h)
+{
+ uint nIndex;
+ uint idx;
+ Bucket *p;
- h = zend_inline_hash_func(arKey, nKeyLength);
nIndex = h & ht->nTableMask;
-
- p = ht->arBuckets[nIndex];
- while (p != NULL) {
- if (p->arKey == arKey ||
- ((p->h == h) && (p->nKeyLength == nKeyLength) && !memcmp(p->arKey, arKey, nKeyLength))) {
- if (flag & HASH_ADD) {
- return FAILURE;
- }
- ZEND_ASSERT(p->pData != pData);
- HANDLE_BLOCK_INTERRUPTIONS();
- if (ht->pDestructor) {
- ht->pDestructor(p->pData);
- }
- UPDATE_DATA(ht, p, pData, nDataSize);
- if (pDest) {
- *pDest = p->pData;
- }
- HANDLE_UNBLOCK_INTERRUPTIONS();
- return SUCCESS;
+ idx = ht->arHash[nIndex];
+ while (idx != INVALID_IDX) {
+ p = ht->arData + idx;
+ if ((p->h == h)
+ && p->key
+ && (p->key->len == len)
+ && !memcmp(p->key->val, str, len)) {
+ return p;
}
- p = p->pNext;
- }
-
- if (IS_INTERNED(arKey)) {
- p = (Bucket *) pemalloc(sizeof(Bucket), ht->persistent);
- p->arKey = arKey;
- } else {
- p = (Bucket *) pemalloc(sizeof(Bucket) + nKeyLength, ht->persistent);
- p->arKey = (const char*)(p + 1);
- memcpy((char*)p->arKey, arKey, nKeyLength);
- }
- p->nKeyLength = nKeyLength;
- INIT_DATA(ht, p, pData, nDataSize);
- p->h = h;
- CONNECT_TO_BUCKET_DLLIST(p, ht->arBuckets[nIndex]);
- if (pDest) {
- *pDest = p->pData;
+ idx = p->val.u.next;
}
+ return NULL;
+}
- HANDLE_BLOCK_INTERRUPTIONS();
- CONNECT_TO_GLOBAL_DLLIST(p, ht);
- ht->arBuckets[nIndex] = p;
- HANDLE_UNBLOCK_INTERRUPTIONS();
+static zend_always_inline Bucket *zend_hash_index_find_bucket(const HashTable *ht, ulong h)
+{
+ uint nIndex;
+ uint idx;
+ Bucket *p;
- ht->nNumOfElements++;
- ZEND_HASH_IF_FULL_DO_RESIZE(ht); /* If the Hash table is full, resize it */
- return SUCCESS;
+ nIndex = h & ht->nTableMask;
+ idx = ht->arHash[nIndex];
+ while (idx != INVALID_IDX) {
+ p = ht->arData + idx;
+ if (p->h == h && !p->key) {
+ return p;
+ }
+ idx = p->val.u.next;
+ }
+ return NULL;
}
-ZEND_API int _zend_hash_quick_add_or_update(HashTable *ht, const char *arKey, uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC)
+ZEND_API zval *_zend_hash_add_or_update(HashTable *ht, zend_string *key, zval *pData, int flag ZEND_FILE_LINE_DC)
{
+ ulong h;
uint nIndex;
+ uint idx;
Bucket *p;
#ifdef ZEND_SIGNALS
TSRMLS_FETCH();
@@ -264,148 +250,199 @@ ZEND_API int _zend_hash_quick_add_or_update(HashTable *ht, const char *arKey, ui
IS_CONSISTENT(ht);
- ZEND_ASSERT(nKeyLength != 0);
-
- CHECK_INIT(ht);
- nIndex = h & ht->nTableMask;
-
- p = ht->arBuckets[nIndex];
- while (p != NULL) {
- if (p->arKey == arKey ||
- ((p->h == h) && (p->nKeyLength == nKeyLength) && !memcmp(p->arKey, arKey, nKeyLength))) {
- if (flag & HASH_ADD) {
- return FAILURE;
- }
- ZEND_ASSERT(p->pData != pData);
- HANDLE_BLOCK_INTERRUPTIONS();
- if (ht->pDestructor) {
- ht->pDestructor(p->pData);
- }
- UPDATE_DATA(ht, p, pData, nDataSize);
- if (pDest) {
- *pDest = p->pData;
- }
- HANDLE_UNBLOCK_INTERRUPTIONS();
- return SUCCESS;
- }
- p = p->pNext;
- }
-
- if (IS_INTERNED(arKey)) {
- p = (Bucket *) pemalloc(sizeof(Bucket), ht->persistent);
- p->arKey = arKey;
- } else {
- p = (Bucket *) pemalloc(sizeof(Bucket) + nKeyLength, ht->persistent);
- p->arKey = (const char*)(p + 1);
- memcpy((char*)p->arKey, arKey, nKeyLength);
+ CHECK_INIT(ht, 0);
+ if (ht->flags & HASH_FLAG_PACKED) {
+ zend_hash_packed_to_hash(ht);
}
- p->nKeyLength = nKeyLength;
- INIT_DATA(ht, p, pData, nDataSize);
- p->h = h;
-
- CONNECT_TO_BUCKET_DLLIST(p, ht->arBuckets[nIndex]);
+ h = STR_HASH_VAL(key);
+ p = zend_hash_find_bucket(ht, key);
- if (pDest) {
- *pDest = p->pData;
+ if (p) {
+ if (flag & HASH_ADD) {
+ return NULL;
+ }
+ ZEND_ASSERT(&p->val != pData);
+ HANDLE_BLOCK_INTERRUPTIONS();
+ if (ht->pDestructor) {
+ ht->pDestructor(&p->val);
+ }
+ p->val = *pData;
+ HANDLE_UNBLOCK_INTERRUPTIONS();
+ return &p->val;
}
+
+ ZEND_HASH_IF_FULL_DO_RESIZE(ht); /* If the Hash table is full, resize it */
HANDLE_BLOCK_INTERRUPTIONS();
- ht->arBuckets[nIndex] = p;
- CONNECT_TO_GLOBAL_DLLIST(p, ht);
+ idx = ht->nNumUsed++;
+ ht->nNumOfElements++;
+ if (ht->nInternalPointer == INVALID_IDX) {
+ ht->nInternalPointer = idx;
+ }
+ p = ht->arData + idx;
+ p->h = h;
+ p->key = key;
+ STR_ADDREF(key);
+ p->val = *pData;
+ nIndex = h & ht->nTableMask;
+ p->val.u.next = ht->arHash[nIndex];
+ ht->arHash[nIndex] = idx;
HANDLE_UNBLOCK_INTERRUPTIONS();
- ht->nNumOfElements++;
- ZEND_HASH_IF_FULL_DO_RESIZE(ht); /* If the Hash table is full, resize it */
- return SUCCESS;
+ return &p->val;
}
+ZEND_API zval *_zend_hash_str_add_or_update(HashTable *ht, const char *str, int len, zval *pData, int flag ZEND_FILE_LINE_DC)
+{
+ zend_string *key = STR_INIT(str, len, ht->flags & HASH_FLAG_PERSISTENT);
+ zval *ret = _zend_hash_add_or_update(ht, key, pData, flag ZEND_FILE_LINE_CC);
+ STR_RELEASE(key);
+ return ret;
+}
-ZEND_API int zend_hash_add_empty_element(HashTable *ht, const char *arKey, uint nKeyLength)
+ZEND_API zval *zend_hash_add_empty_element(HashTable *ht, zend_string *key)
{
- void *dummy = (void *) 1;
+
+ zval dummy;
- return zend_hash_add(ht, arKey, nKeyLength, &dummy, sizeof(void *), NULL);
+ ZVAL_NULL(&dummy);
+ return zend_hash_add(ht, key, &dummy);
}
+ZEND_API zval *zend_hash_str_add_empty_element(HashTable *ht, const char *str, int len)
+{
+
+ zval dummy;
+
+ ZVAL_NULL(&dummy);
+ return zend_hash_str_add(ht, str, len, &dummy);
+}
-ZEND_API int _zend_hash_index_update_or_next_insert(HashTable *ht, ulong h, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC)
+ZEND_API zval *_zend_hash_index_update_or_next_insert(HashTable *ht, ulong h, zval *pData, int flag ZEND_FILE_LINE_DC)
{
uint nIndex;
+ uint idx;
Bucket *p;
#ifdef ZEND_SIGNALS
TSRMLS_FETCH();
#endif
IS_CONSISTENT(ht);
- CHECK_INIT(ht);
if (flag & HASH_NEXT_INSERT) {
h = ht->nNextFreeElement;
}
- nIndex = h & ht->nTableMask;
+ CHECK_INIT(ht, h >= 0 && h < ht->nTableSize);
- p = ht->arBuckets[nIndex];
- while (p != NULL) {
- if ((p->nKeyLength == 0) && (p->h == h)) {
- if (flag & HASH_NEXT_INSERT || flag & HASH_ADD) {
- return FAILURE;
+ if (ht->flags & HASH_FLAG_PACKED) {
+ if (h >= 0 && h < ht->nTableSize) {
+ p = ht->arData + h;
+ if (Z_TYPE(p->val) != IS_UNDEF) {
+ if (ht->pDestructor) {
+ ht->pDestructor(&p->val);
+ }
+ p->val = *pData;
+ HANDLE_UNBLOCK_INTERRUPTIONS();
+ if ((long)h >= (long)ht->nNextFreeElement) {
+ ht->nNextFreeElement = h < LONG_MAX ? h + 1 : LONG_MAX;
+ }
+ return &p->val;
+ }
+ if (h >= ht->nNumUsed) { /* we have to keep the order :( */
+ goto new_packed;
+ } else {
+ goto convert_to_hash;
}
- ZEND_ASSERT(p->pData != pData);
+ } else if (h >= ht->nNumUsed && /* we have to keep the order :( */
+ h < ht->nTableSize * 2 &&
+ ht->nTableSize - ht->nNumOfElements < ht->nTableSize / 2) {
+ zend_hash_packed_grow(ht);
+new_packed:
HANDLE_BLOCK_INTERRUPTIONS();
- if (ht->pDestructor) {
- ht->pDestructor(p->pData);
+ if (h >= ht->nNumUsed) {
+ ht->nNumUsed = h + 1;
+ }
+ ht->nNumOfElements++;
+ if (ht->nInternalPointer == INVALID_IDX) {
+ ht->nInternalPointer = h;
}
- UPDATE_DATA(ht, p, pData, nDataSize);
- HANDLE_UNBLOCK_INTERRUPTIONS();
if ((long)h >= (long)ht->nNextFreeElement) {
ht->nNextFreeElement = h < LONG_MAX ? h + 1 : LONG_MAX;
}
- if (pDest) {
- *pDest = p->pData;
- }
- return SUCCESS;
+ p = ht->arData + h;
+ p->h = h;
+ p->key = NULL;
+ p->val = *pData;
+ p->val.u.next = INVALID_IDX;
+
+ HANDLE_UNBLOCK_INTERRUPTIONS();
+
+ return &p->val;
+ } else {
+convert_to_hash:
+ zend_hash_packed_to_hash(ht);
}
- p = p->pNext;
}
- p = (Bucket *) pemalloc_rel(sizeof(Bucket), ht->persistent);
- p->arKey = NULL;
- p->nKeyLength = 0; /* Numeric indices are marked by making the nKeyLength == 0 */
- p->h = h;
- INIT_DATA(ht, p, pData, nDataSize);
- if (pDest) {
- *pDest = p->pData;
+
+ p = zend_hash_index_find_bucket(ht, h);
+ if (p) {
+ if (flag & HASH_NEXT_INSERT || flag & HASH_ADD) {
+ return NULL;
+ }
+ ZEND_ASSERT(&p->val != pData);
+ HANDLE_BLOCK_INTERRUPTIONS();
+ if (ht->pDestructor) {
+ ht->pDestructor(&p->val);
+ }
+ p->val = *pData;
+ HANDLE_UNBLOCK_INTERRUPTIONS();
+ if ((long)h >= (long)ht->nNextFreeElement) {
+ ht->nNextFreeElement = h < LONG_MAX ? h + 1 : LONG_MAX;
+ }
+ return &p->val;
}
- CONNECT_TO_BUCKET_DLLIST(p, ht->arBuckets[nIndex]);
+ ZEND_HASH_IF_FULL_DO_RESIZE(ht); /* If the Hash table is full, resize it */
HANDLE_BLOCK_INTERRUPTIONS();
- ht->arBuckets[nIndex] = p;
- CONNECT_TO_GLOBAL_DLLIST(p, ht);
- HANDLE_UNBLOCK_INTERRUPTIONS();
-
+ idx = ht->nNumUsed++;
+ ht->nNumOfElements++;
+ if (ht->nInternalPointer == INVALID_IDX) {
+ ht->nInternalPointer = idx;
+ }
if ((long)h >= (long)ht->nNextFreeElement) {
ht->nNextFreeElement = h < LONG_MAX ? h + 1 : LONG_MAX;
}
- ht->nNumOfElements++;
- ZEND_HASH_IF_FULL_DO_RESIZE(ht);
- return SUCCESS;
+ p = ht->arData + idx;
+ p->h = h;
+ p->key = NULL;
+ nIndex = h & ht->nTableMask;
+ p->val = *pData;
+ p->val.u.next = ht->arHash[nIndex];
+ ht->arHash[nIndex] = idx;
+ HANDLE_UNBLOCK_INTERRUPTIONS();
+
+ return &p->val;
}
static void zend_hash_do_resize(HashTable *ht)
{
- Bucket **t;
#ifdef ZEND_SIGNALS
TSRMLS_FETCH();
#endif
IS_CONSISTENT(ht);
- if ((ht->nTableSize << 1) > 0) { /* Let's double the table size */
- t = (Bucket **) perealloc(ht->arBuckets, (ht->nTableSize << 1) * sizeof(Bucket *), ht->persistent);
+ if (ht->nNumUsed < ht->nNumOfElements) {
HANDLE_BLOCK_INTERRUPTIONS();
- ht->arBuckets = t;
+ zend_hash_rehash(ht);
+ HANDLE_UNBLOCK_INTERRUPTIONS();
+ } else if ((ht->nTableSize << 1) > 0) { /* Let's double the table size */
+ HANDLE_BLOCK_INTERRUPTIONS();
+ ht->arData = (Bucket *) perealloc(ht->arData, (ht->nTableSize << 1) * sizeof(Bucket), ht->flags & HASH_FLAG_PERSISTENT);
+ ht->arHash = (zend_uint *) perealloc(ht->arHash, (ht->nTableSize << 1) * sizeof(zend_uint), ht->flags & HASH_FLAG_PERSISTENT);
ht->nTableSize = (ht->nTableSize << 1);
ht->nTableMask = ht->nTableSize - 1;
zend_hash_rehash(ht);
@@ -416,107 +453,230 @@ static void zend_hash_do_resize(HashTable *ht)
ZEND_API int zend_hash_rehash(HashTable *ht)
{
Bucket *p;
- uint nIndex;
+ uint nIndex, i, j;
IS_CONSISTENT(ht);
+ memset(ht->arHash, INVALID_IDX, ht->nTableSize * sizeof(zend_uint));
+
if (UNEXPECTED(ht->nNumOfElements == 0)) {
return SUCCESS;
}
- memset(ht->arBuckets, 0, ht->nTableSize * sizeof(Bucket *));
- p = ht->pListHead;
- while (p != NULL) {
- nIndex = p->h & ht->nTableMask;
- CONNECT_TO_BUCKET_DLLIST(p, ht->arBuckets[nIndex]);
- ht->arBuckets[nIndex] = p;
- p = p->pListNext;
+ for (i = 0, j = 0; i < ht->nNumUsed; i++) {
+ p = ht->arData + i;
+ if (Z_TYPE(p->val) == IS_UNDEF) continue;
+ if (i != j) {
+ ht->arData[j] = ht->arData[i];
+ if (ht->nInternalPointer == i) {
+ ht->nInternalPointer = j;
+ }
+ }
+ nIndex = ht->arData[j].h & ht->nTableMask;
+ ht->arData[j].val.u.next = ht->arHash[nIndex];
+ ht->arHash[nIndex] = j;
+ j++;
}
+ ht->nNumUsed = j;
return SUCCESS;
}
-ZEND_API int zend_hash_del_key_or_index(HashTable *ht, const char *arKey, uint nKeyLength, ulong h, int flag)
+static zend_always_inline void _zend_hash_del_el_ex(HashTable *ht, uint idx, Bucket *p, Bucket *prev)
+{
+ if (!(ht->flags & HASH_FLAG_PACKED)) {
+ if (prev) {
+ prev->val.u.next = p->val.u.next;
+ } else {
+ ht->arHash[p->h & ht->nTableMask] = p->val.u.next;
+ }
+ }
+ if (ht->nNumUsed - 1 == idx) {
+ do {
+ ht->nNumUsed--;
+ } while (ht->nNumUsed > 0 && (Z_TYPE(ht->arData[ht->nNumUsed-1].val) == IS_UNDEF));
+ }
+ ht->nNumOfElements--;
+ if (ht->nInternalPointer == idx) {
+ while (1) {
+ idx++;
+ if (idx >= ht->nNumUsed) {
+ ht->nInternalPointer = INVALID_IDX;
+ break;
+ } else if (Z_TYPE(ht->arData[idx].val) != IS_UNDEF) {
+ ht->nInternalPointer = idx;
+ break;
+ }
+ }
+ }
+ if (ht->pDestructor) {
+ ht->pDestructor(&p->val);
+ }
+//??? if (ht->flags & HASH_FLAG_BIG_DATA) {
+//??? pefree(p->xData, ht->flags & HASH_FLAG_PERSISTENT);
+//??? }
+ if (p->key) {
+ STR_RELEASE(p->key);
+ }
+ Z_TYPE(p->val) = IS_UNDEF;
+}
+
+static zend_always_inline void _zend_hash_del_el(HashTable *ht, uint idx, Bucket *p)
{
uint nIndex;
+ Bucket *prev = NULL;
+
+ if (!(ht->flags & HASH_FLAG_PACKED)) {
+ nIndex = p->h & ht->nTableMask;
+ idx = ht->arHash[nIndex];
+ if (p != ht->arData + idx) {
+ prev = ht->arData + idx;
+ while (ht->arData + prev->val.u.next != p) {
+ idx = prev->val.u.next;
+ prev = ht->arData + idx;
+ }
+ idx = prev->val.u.next;
+ }
+ }
+
+ _zend_hash_del_el_ex(ht, idx, p, prev);
+}
+
+ZEND_API int zend_hash_del(HashTable *ht, zend_string *key)
+{
+ ulong h;
+ uint nIndex;
+ uint idx;
Bucket *p;
+ Bucket *prev = NULL;
#ifdef ZEND_SIGNALS
TSRMLS_FETCH();
#endif
IS_CONSISTENT(ht);
- if (flag == HASH_DEL_KEY) {
- h = zend_inline_hash_func(arKey, nKeyLength);
+ h = STR_HASH_VAL(key);
+ nIndex = h & ht->nTableMask;
+
+ idx = ht->arHash[nIndex];
+ while (idx != INVALID_IDX) {
+ p = ht->arData + idx;
+ if ((p->key == key) ||
+ (p->h == h &&
+ p->key &&
+ p->key->len == key->len &&
+ memcmp(p->key->val, key->val, key->len) == 0)) {
+ HANDLE_BLOCK_INTERRUPTIONS();
+ _zend_hash_del_el_ex(ht, idx, p, prev);
+ HANDLE_UNBLOCK_INTERRUPTIONS();
+ return SUCCESS;
+ }
+ prev = p;
+ idx = p->val.u.next;
}
+ return FAILURE;
+}
+
+ZEND_API int zend_hash_str_del(HashTable *ht, const char *str, int len)
+{
+ ulong h;
+ uint nIndex;
+ uint idx;
+ Bucket *p;
+ Bucket *prev = NULL;
+#ifdef ZEND_SIGNALS
+ TSRMLS_FETCH();
+#endif
+
+ IS_CONSISTENT(ht);
+
+ h = zend_inline_hash_func(str, len + 1);
nIndex = h & ht->nTableMask;
- p = ht->arBuckets[nIndex];
- while (p != NULL) {
+ idx = ht->arHash[nIndex];
+ while (idx != INVALID_IDX) {
+ p = ht->arData + idx;
if ((p->h == h)
- && (p->nKeyLength == nKeyLength)
- && ((p->nKeyLength == 0) /* Numeric index (short circuits the memcmp() check) */
- || !memcmp(p->arKey, arKey, nKeyLength))) { /* String index */
+ && p->key
+ && (p->key->len == len)
+ && !memcmp(p->key->val, str, len)) {
HANDLE_BLOCK_INTERRUPTIONS();
- if (p == ht->arBuckets[nIndex]) {
- ht->arBuckets[nIndex] = p->pNext;
- } else {
- p->pLast->pNext = p->pNext;
- }
- if (p->pNext) {
- p->pNext->pLast = p->pLast;
- }
- if (p->pListLast != NULL) {
- p->pListLast->pListNext = p->pListNext;
- } else {
- /* Deleting the head of the list */
- ht->pListHead = p->pListNext;
- }
- if (p->pListNext != NULL) {
- p->pListNext->pListLast = p->pListLast;
- } else {
- ht->pListTail = p->pListLast;
- }
- if (ht->pInternalPointer == p) {
- ht->pInternalPointer = p->pListNext;
- }
- ht->nNumOfElements--;
- if (ht->pDestructor) {
- ht->pDestructor(p->pData);
- }
- if (p->pData != &p->pDataPtr) {
- pefree(p->pData, ht->persistent);
- }
- pefree(p, ht->persistent);
+ _zend_hash_del_el_ex(ht, idx, p, prev);
HANDLE_UNBLOCK_INTERRUPTIONS();
return SUCCESS;
}
- p = p->pNext;
+ prev = p;
+ idx = p->val.u.next;
}
return FAILURE;
}
+ZEND_API int zend_hash_index_del(HashTable *ht, ulong h)
+{
+ uint nIndex;
+ uint idx;
+ Bucket *p;
+ Bucket *prev = NULL;
+#ifdef ZEND_SIGNALS
+ TSRMLS_FETCH();
+#endif
+
+ IS_CONSISTENT(ht);
+
+ if (ht->flags & HASH_FLAG_PACKED) {
+ if (h >=0 && h < ht->nTableSize) {
+ p = ht->arData + h;
+ if (Z_TYPE(p->val) != IS_UNDEF) {
+ HANDLE_BLOCK_INTERRUPTIONS();
+ _zend_hash_del_el_ex(ht, h, p, NULL);
+ HANDLE_UNBLOCK_INTERRUPTIONS();
+ return SUCCESS;
+ }
+ }
+ return FAILURE;
+ }
+ nIndex = h & ht->nTableMask;
+
+ idx = ht->arHash[nIndex];
+ while (idx != INVALID_IDX) {
+ p = ht->arData + idx;
+ if ((p->h == h) && (p->key == NULL)) {
+ HANDLE_BLOCK_INTERRUPTIONS();
+ _zend_hash_del_el_ex(ht, idx, p, prev);
+ HANDLE_UNBLOCK_INTERRUPTIONS();
+ return SUCCESS;
+ }
+ prev = p;
+ idx = p->val.u.next;
+ }
+ return FAILURE;
+}
ZEND_API void zend_hash_destroy(HashTable *ht)
{
- Bucket *p, *q;
+ uint idx;
+ Bucket *p;
IS_CONSISTENT(ht);
SET_INCONSISTENT(HT_IS_DESTROYING);
- p = ht->pListHead;
- while (p != NULL) {
- q = p;
- p = p->pListNext;
+ for (idx = 0 ; idx < ht->nNumUsed; idx++) {
+ p = ht->arData + idx;
+ if (Z_TYPE(p->val) == IS_UNDEF) continue;
if (ht->pDestructor) {
- ht->pDestructor(q->pData);
+ ht->pDestructor(&p->val);
}
- if (q->pData != &q->pDataPtr) {
- pefree(q->pData, ht->persistent);
+//??? if (ht->flags & HASH_FLAG_BIG_DATA) {
+//??? pefree(p->xData, ht->flags & HASH_FLAG_PERSISTENT);
+//??? }
+ if (p->key) {
+ STR_RELEASE(p->key);
}
- pefree(q, ht->persistent);
}
if (ht->nTableMask) {
- pefree(ht->arBuckets, ht->persistent);
+ pefree(ht->arData, ht->flags & HASH_FLAG_PERSISTENT);
+ if (!(ht->flags & HASH_FLAG_PACKED)) {
+ pefree(ht->arHash, ht->flags & HASH_FLAG_PERSISTENT);
+ }
}
SET_INCONSISTENT(HT_DESTROYED);
@@ -525,31 +685,33 @@ ZEND_API void zend_hash_destroy(HashTable *ht)
ZEND_API void zend_hash_clean(HashTable *ht)
{
- Bucket *p, *q;
+ uint idx;
+ Bucket *p;
IS_CONSISTENT(ht);
- p = ht->pListHead;
-
- if (ht->nTableMask) {
- memset(ht->arBuckets, 0, ht->nTableSize*sizeof(Bucket *));
+ for (idx = 0; idx < ht->nNumUsed; idx++) {
+ p = ht->arData + idx;
+ if (Z_TYPE(p->val) == IS_UNDEF) continue;
+ if (ht->pDestructor) {
+ ht->pDestructor(&p->val);
+ }
+//??? if (ht->flags & HASH_FLAG_BIG_DATA) {
+//??? pefree(p->xData, ht->flags & HASH_FLAG_PERSISTENT);
+//??? }
+ if (p->key) {
+ STR_RELEASE(p->key);
+ }
}
- ht->pListHead = NULL;
- ht->pListTail = NULL;
+ ht->nNumUsed = 0;
ht->nNumOfElements = 0;
ht->nNextFreeElement = 0;
- ht->pInternalPointer = NULL;
-
- while (p != NULL) {
- q = p;
- p = p->pListNext;
- if (ht->pDestructor) {
- ht->pDestructor(q->pData);
- }
- if (q->pData != &q->pDataPtr) {
- pefree(q->pData, ht->persistent);
+ ht->nInternalPointer = INVALID_IDX;
+ if (ht->nTableMask) {
+ memset(ht->arData, 0, ht->nTableSize*sizeof(Bucket));
+ if (!(ht->flags & HASH_FLAG_PACKED)) {
+ memset(ht->arHash, INVALID_IDX, ht->nTableSize * sizeof(zend_uint));
}
- pefree(q, ht->persistent);
}
}
@@ -558,70 +720,35 @@ ZEND_API void zend_hash_clean(HashTable *ht)
* next bucket. The hash *may* be altered during that time, the
* returned value will still be valid.
*/
-static Bucket *zend_hash_apply_deleter(HashTable *ht, Bucket *p)
+static void zend_hash_apply_deleter(HashTable *ht, uint idx, Bucket *p)
{
- Bucket *retval;
#ifdef ZEND_SIGNALS
TSRMLS_FETCH();
#endif
HANDLE_BLOCK_INTERRUPTIONS();
- if (p->pLast) {
- p->pLast->pNext = p->pNext;
- } else {
- uint nIndex;
-
- nIndex = p->h & ht->nTableMask;
- ht->arBuckets[nIndex] = p->pNext;
- }
- if (p->pNext) {
- p->pNext->pLast = p->pLast;
- } else {
- /* Nothing to do as this list doesn't have a tail */
- }
-
- if (p->pListLast != NULL) {
- p->pListLast->pListNext = p->pListNext;
- } else {
- /* Deleting the head of the list */
- ht->pListHead = p->pListNext;
- }
- if (p->pListNext != NULL) {
- p->pListNext->pListLast = p->pListLast;
- } else {
- ht->pListTail = p->pListLast;
- }
- if (ht->pInternalPointer == p) {
- ht->pInternalPointer = p->pListNext;
- }
- ht->nNumOfElements--;
+ _zend_hash_del_el(ht, idx, p);
HANDLE_UNBLOCK_INTERRUPTIONS();
-
- if (ht->pDestructor) {
- ht->pDestructor(p->pData);
- }
- if (p->pData != &p->pDataPtr) {
- pefree(p->pData, ht->persistent);
- }
- retval = p->pListNext;
- pefree(p, ht->persistent);
-
- return retval;
}
ZEND_API void zend_hash_graceful_destroy(HashTable *ht)
{
+ uint idx;
Bucket *p;
IS_CONSISTENT(ht);
- p = ht->pListHead;
- while (p != NULL) {
- p = zend_hash_apply_deleter(ht, p);
+ for (idx = 0; idx < ht->nNumUsed; idx++) {
+ p = ht->arData + idx;
+ if (Z_TYPE(p->val) == IS_UNDEF) continue;
+ zend_hash_apply_deleter(ht, idx, p);
}
if (ht->nTableMask) {
- pefree(ht->arBuckets, ht->persistent);
+ pefree(ht->arData, ht->flags & HASH_FLAG_PERSISTENT);
+ if (!(ht->flags & HASH_FLAG_PACKED)) {
+ pefree(ht->arHash, ht->flags & HASH_FLAG_PERSISTENT);
+ }
}
SET_INCONSISTENT(HT_DESTROYED);
@@ -629,18 +756,24 @@ ZEND_API void zend_hash_graceful_destroy(HashTable *ht)
ZEND_API void zend_hash_graceful_reverse_destroy(HashTable *ht)
{
+ uint idx;
Bucket *p;
IS_CONSISTENT(ht);
- p = ht->pListTail;
- while (p != NULL) {
- zend_hash_apply_deleter(ht, p);
- p = ht->pListTail;
+ idx = ht->nNumUsed;
+ while (idx > 0) {
+ idx--;
+ p = ht->arData + idx;
+ if (Z_TYPE(p->val) == IS_UNDEF) continue;
+ zend_hash_apply_deleter(ht, idx, p);
}
if (ht->nTableMask) {
- pefree(ht->arBuckets, ht->persistent);
+ pefree(ht->arData, ht->flags & HASH_FLAG_PERSISTENT);
+ if (!(ht->flags & HASH_FLAG_PACKED)) {
+ pefree(ht->arHash, ht->flags & HASH_FLAG_PERSISTENT);
+ }
}
SET_INCONSISTENT(HT_DESTROYED);
@@ -657,19 +790,21 @@ ZEND_API void zend_hash_graceful_reverse_destroy(HashTable *ht)
ZEND_API void zend_hash_apply(HashTable *ht, apply_func_t apply_func TSRMLS_DC)
{
+ uint idx;
Bucket *p;
+ int result;
IS_CONSISTENT(ht);
HASH_PROTECT_RECURSION(ht);
- p = ht->pListHead;
- while (p != NULL) {
- int result = apply_func(p->pData TSRMLS_CC);
+ for (idx = 0; idx < ht->nNumUsed; idx++) {
+ p = ht->arData + idx;
+ if (Z_TYPE(p->val) == IS_UNDEF) continue;
+
+ result = apply_func(&p->val TSRMLS_CC);
if (result & ZEND_HASH_APPLY_REMOVE) {
- p = zend_hash_apply_deleter(ht, p);
- } else {
- p = p->pListNext;
+ zend_hash_apply_deleter(ht, idx, p);
}
if (result & ZEND_HASH_APPLY_STOP) {
break;
@@ -681,19 +816,21 @@ ZEND_API void zend_hash_apply(HashTable *ht, apply_func_t apply_func TSRMLS_DC)
ZEND_API void zend_hash_apply_with_argument(HashTable *ht, apply_func_arg_t apply_func, void *argument TSRMLS_DC)
{
+ uint idx;
Bucket *p;
+ int result;
IS_CONSISTENT(ht);
HASH_PROTECT_RECURSION(ht);
- p = ht->pListHead;
- while (p != NULL) {
- int result = apply_func(p->pData, argument TSRMLS_CC);
+ for (idx = 0; idx < ht->nNumUsed; idx++) {
+ p = ht->arData + idx;
+ if (Z_TYPE(p->val) == IS_UNDEF) continue;
+
+ result = apply_func(&p->val, argument TSRMLS_CC);
if (result & ZEND_HASH_APPLY_REMOVE) {
- p = zend_hash_apply_deleter(ht, p);
- } else {
- p = p->pListNext;
+ zend_hash_apply_deleter(ht, idx, p);
}
if (result & ZEND_HASH_APPLY_STOP) {
break;
@@ -705,27 +842,27 @@ ZEND_API void zend_hash_apply_with_argument(HashTable *ht, apply_func_arg_t appl
ZEND_API void zend_hash_apply_with_arguments(HashTable *ht TSRMLS_DC, apply_func_args_t apply_func, int num_args, ...)
{
+ uint idx;
Bucket *p;
va_list args;
zend_hash_key hash_key;
+ int result;
IS_CONSISTENT(ht);
HASH_PROTECT_RECURSION(ht);
- p = ht->pListHead;
- while (p != NULL) {
- int result;
+ for (idx = 0; idx < ht->nNumUsed; idx++) {
+ p = ht->arData + idx;
+ if (Z_TYPE(p->val) == IS_UNDEF) continue;
va_start(args, num_args);
- hash_key.arKey = p->arKey;
- hash_key.nKeyLength = p->nKeyLength;
hash_key.h = p->h;
- result = apply_func(p->pData TSRMLS_CC, num_args, args, &hash_key);
+ hash_key.key = p->key;
+
+ result = apply_func(&p->val TSRMLS_CC, num_args, args, &hash_key);
if (result & ZEND_HASH_APPLY_REMOVE) {
- p = zend_hash_apply_deleter(ht, p);
- } else {
- p = p->pListNext;
+ zend_hash_apply_deleter(ht, idx, p);
}
if (result & ZEND_HASH_APPLY_STOP) {
va_end(args);
@@ -740,19 +877,23 @@ ZEND_API void zend_hash_apply_with_arguments(HashTable *ht TSRMLS_DC, apply_func
ZEND_API void zend_hash_reverse_apply(HashTable *ht, apply_func_t apply_func TSRMLS_DC)
{
- Bucket *p, *q;
+ uint idx;
+ Bucket *p;
+ int result;
IS_CONSISTENT(ht);
HASH_PROTECT_RECURSION(ht);
- p = ht->pListTail;
- while (p != NULL) {
- int result = apply_func(p->pData TSRMLS_CC);
+ idx = ht->nNumUsed;
+ while (idx > 0) {
+ idx--;
+ p = ht->arData + idx;
+ if (Z_TYPE(p->val) == IS_UNDEF) continue;
+
+ result = apply_func(&p->val TSRMLS_CC);
- q = p;
- p = p->pListLast;
if (result & ZEND_HASH_APPLY_REMOVE) {
- zend_hash_apply_deleter(ht, q);
+ zend_hash_apply_deleter(ht, idx, p);
}
if (result & ZEND_HASH_APPLY_STOP) {
break;
@@ -762,92 +903,116 @@ ZEND_API void zend_hash_reverse_apply(HashTable *ht, apply_func_t apply_func TSR
}
-ZEND_API void zend_hash_copy(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size)
+ZEND_API void zend_hash_copy(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor)
{
+ uint idx;
Bucket *p;
- void *new_entry;
+ zval *new_entry;
zend_bool setTargetPointer;
IS_CONSISTENT(source);
IS_CONSISTENT(target);
- setTargetPointer = !target->pInternalPointer;
- p = source->pListHead;
- while (p) {
- if (setTargetPointer && source->pInternalPointer == p) {
- target->pInternalPointer = NULL;
+ setTargetPointer = (target->nInternalPointer == INVALID_IDX);
+ for (idx = 0; idx < source->nNumUsed; idx++) {
+ p = source->arData + idx;
+ if (Z_TYPE(p->val) == IS_UNDEF) continue;
+
+ if (setTargetPointer && source->nInternalPointer == idx) {
+ target->nInternalPointer = INVALID_IDX;
}
- if (p->nKeyLength) {
- zend_hash_quick_update(target, p->arKey, p->nKeyLength, p->h, p->pData, size, &new_entry);
+ if (p->key) {
+ new_entry = zend_hash_update(target, p->key, &p->val);
} else {
- zend_hash_index_update(target, p->h, p->pData, size, &new_entry);
+ new_entry = zend_hash_index_update(target, p->h, &p->val);
}
if (pCopyConstructor) {
pCopyConstructor(new_entry);
}
- p = p->pListNext;
}
- if (!target->pInternalPointer) {
- target->pInternalPointer = target->pListHead;
+ if (target->nInternalPointer == INVALID_IDX && target->nNumOfElements > 0) {
+ idx = 0;
+ while (Z_TYPE(target->arData[idx].val) == IS_UNDEF) {
+ idx++;
+ }
+ target->nInternalPointer = idx;
}
}
-ZEND_API void _zend_hash_merge(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size, int overwrite ZEND_FILE_LINE_DC)
+ZEND_API void _zend_hash_merge(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, int overwrite ZEND_FILE_LINE_DC)
{
+ uint idx;
Bucket *p;
- void *t;
+ zval *t;
int mode = (overwrite?HASH_UPDATE:HASH_ADD);
IS_CONSISTENT(source);
IS_CONSISTENT(target);
- p = source->pListHead;
- while (p) {
- if (p->nKeyLength>0) {
- if (_zend_hash_quick_add_or_update(target, p->arKey, p->nKeyLength, p->h, p->pData, size, &t, mode ZEND_FILE_LINE_RELAY_CC)==SUCCESS && pCopyConstructor) {
+ for (idx = 0; idx < source->nNumUsed; idx++) {
+ p = source->arData + idx;
+ if (Z_TYPE(p->val) == IS_UNDEF) continue;
+ if (p->key) {
+ t = _zend_hash_add_or_update(target, p->key, &p->val, mode ZEND_FILE_LINE_RELAY_CC);
+ if (t && pCopyConstructor) {
pCopyConstructor(t);
}
} else {
- if ((mode==HASH_UPDATE || !zend_hash_index_exists(target, p->h)) && zend_hash_index_update(target, p->h, p->pData, size, &t)==SUCCESS && pCopyConstructor) {
- pCopyConstructor(t);
+ if ((mode==HASH_UPDATE || !zend_hash_index_exists(target, p->h))) {
+ t = zend_hash_index_update(target, p->h, &p->val);
+ if (t && pCopyConstructor) {
+ pCopyConstructor(t);
+ }
}
}
- p = p->pListNext;
}
- target->pInternalPointer = target->pListHead;
+ if (target->nNumOfElements > 0) {
+ idx = 0;
+ while (Z_TYPE(target->arData[idx].val) == IS_UNDEF) {
+ idx++;
+ }
+ target->nInternalPointer = idx;
+ }
}
-static zend_bool zend_hash_replace_checker_wrapper(HashTable *target, void *source_data, Bucket *p, void *pParam, merge_checker_func_t merge_checker_func)
+static zend_bool zend_hash_replace_checker_wrapper(HashTable *target, zval *source_data, Bucket *p, void *pParam, merge_checker_func_t merge_checker_func)
{
zend_hash_key hash_key;
- hash_key.arKey = p->arKey;
- hash_key.nKeyLength = p->nKeyLength;
hash_key.h = p->h;
+ hash_key.key = p->key;
return merge_checker_func(target, source_data, &hash_key, pParam);
}
-ZEND_API void zend_hash_merge_ex(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, uint size, merge_checker_func_t pMergeSource, void *pParam)
+ZEND_API void zend_hash_merge_ex(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, merge_checker_func_t pMergeSource, void *pParam)
{
+ uint idx;
Bucket *p;
- void *t;
+ zval *t;
IS_CONSISTENT(source);
IS_CONSISTENT(target);
- p = source->pListHead;
- while (p) {
- if (zend_hash_replace_checker_wrapper(target, p->pData, p, pParam, pMergeSource)) {
- if (zend_hash_quick_update(target, p->arKey, p->nKeyLength, p->h, p->pData, size, &t)==SUCCESS && pCopyConstructor) {
+ for (idx = 0; idx < source->nNumUsed; idx++) {
+ p = source->arData + idx;
+ if (Z_TYPE(p->val) == IS_UNDEF) continue;
+ if (zend_hash_replace_checker_wrapper(target, &p->val, p, pParam, pMergeSource)) {
+ t = zend_hash_update(target, p->key, &p->val);
+ if (t && pCopyConstructor) {
pCopyConstructor(t);
}
}
- p = p->pListNext;
}
- target->pInternalPointer = target->pListHead;
+ if (target->nNumOfElements > 0) {
+ idx = 0;
+ while (Z_TYPE(target->arData[idx].val) == IS_UNDEF) {
+ idx++;
+ }
+ target->nInternalPointer = idx;
+ }
}
@@ -855,139 +1020,104 @@ ZEND_API void zend_hash_merge_ex(HashTable *target, HashTable *source, copy_ctor
* data is returned in pData. The reason is that there's no reason
* someone using the hash table might not want to have NULL data
*/
-ZEND_API int zend_hash_find(const HashTable *ht, const char *arKey, uint nKeyLength, void **pData)
+ZEND_API zval *zend_hash_find(const HashTable *ht, zend_string *key)
{
- ulong h;
- uint nIndex;
Bucket *p;
IS_CONSISTENT(ht);
- h = zend_inline_hash_func(arKey, nKeyLength);
- nIndex = h & ht->nTableMask;
-
- p = ht->arBuckets[nIndex];
- while (p != NULL) {
- if (p->arKey == arKey ||
- ((p->h == h) && (p->nKeyLength == nKeyLength) && !memcmp(p->arKey, arKey, nKeyLength))) {
- *pData = p->pData;
- return SUCCESS;
- }
- p = p->pNext;
+ if (ht->flags & HASH_FLAG_PACKED) {
+ return NULL;
}
- return FAILURE;
-}
+ p = zend_hash_find_bucket(ht, key);
+ return p ? &p->val : NULL;
+}
-ZEND_API int zend_hash_quick_find(const HashTable *ht, const char *arKey, uint nKeyLength, ulong h, void **pData)
+ZEND_API zval *zend_hash_str_find(const HashTable *ht, const char *str, int len)
{
- uint nIndex;
+ ulong h;
Bucket *p;
- ZEND_ASSERT(nKeyLength != 0);
-
IS_CONSISTENT(ht);
- nIndex = h & ht->nTableMask;
-
- p = ht->arBuckets[nIndex];
- while (p != NULL) {
- if (p->arKey == arKey ||
- ((p->h == h) && (p->nKeyLength == nKeyLength) && !memcmp(p->arKey, arKey, nKeyLength))) {
- *pData = p->pData;
- return SUCCESS;
- }
- p = p->pNext;
+ if (ht->flags & HASH_FLAG_PACKED) {
+ return NULL;
}
- return FAILURE;
-}
+ h = zend_inline_hash_func(str, len + 1);
+ p = zend_hash_str_find_bucket(ht, str, len, h);
+ return p ? &p->val : NULL;
+}
-ZEND_API int zend_hash_exists(const HashTable *ht, const char *arKey, uint nKeyLength)
+ZEND_API int zend_hash_exists(const HashTable *ht, zend_string *key)
{
- ulong h;
- uint nIndex;
Bucket *p;
IS_CONSISTENT(ht);
- h = zend_inline_hash_func(arKey, nKeyLength);
- nIndex = h & ht->nTableMask;
-
- p = ht->arBuckets[nIndex];
- while (p != NULL) {
- if (p->arKey == arKey ||
- ((p->h == h) && (p->nKeyLength == nKeyLength) && !memcmp(p->arKey, arKey, nKeyLength))) {
- return 1;
- }
- p = p->pNext;
+ if (ht->flags & HASH_FLAG_PACKED) {
+ return 0;
}
- return 0;
-}
+ p = zend_hash_find_bucket(ht, key);
+ return p ? 1 : 0;
+}
-ZEND_API int zend_hash_quick_exists(const HashTable *ht, const char *arKey, uint nKeyLength, ulong h)
+ZEND_API int zend_hash_str_exists(const HashTable *ht, const char *str, int len)
{
- uint nIndex;
+ ulong h;
Bucket *p;
- ZEND_ASSERT(nKeyLength != 0);
-
IS_CONSISTENT(ht);
- nIndex = h & ht->nTableMask;
-
- p = ht->arBuckets[nIndex];
- while (p != NULL) {
- if (p->arKey == arKey ||
- ((p->h == h) && (p->nKeyLength == nKeyLength) && !memcmp(p->arKey, arKey, nKeyLength))) {
- return 1;
- }
- p = p->pNext;
+ if (ht->flags & HASH_FLAG_PACKED) {
+ return 0;
}
- return 0;
+ h = zend_inline_hash_func(str, len + 1);
+ p = zend_hash_str_find_bucket(ht, str, len, h);
+ return p ? 1 : 0;
}
-
-ZEND_API int zend_hash_index_find(const HashTable *ht, ulong h, void **pData)
+ZEND_API zval *zend_hash_index_find(const HashTable *ht, ulong h)
{
- uint nIndex;
Bucket *p;
IS_CONSISTENT(ht);
- nIndex = h & ht->nTableMask;
-
- p = ht->arBuckets[nIndex];
- while (p != NULL) {
- if ((p->h == h) && (p->nKeyLength == 0)) {
- *pData = p->pData;
- return SUCCESS;
+ if (ht->flags & HASH_FLAG_PACKED) {
+ if (h >= 0 && h < ht->nTableSize) {
+ p = ht->arData + h;
+ if (Z_TYPE(p->val) != IS_UNDEF) {
+ return &p->val;
+ }
}
- p = p->pNext;
+ return NULL;
}
- return FAILURE;
+
+ p = zend_hash_index_find_bucket(ht, h);
+ return p ? &p->val : NULL;
}
ZEND_API int zend_hash_index_exists(const HashTable *ht, ulong h)
{
- uint nIndex;
Bucket *p;
IS_CONSISTENT(ht);
- nIndex = h & ht->nTableMask;
-
- p = ht->arBuckets[nIndex];
- while (p != NULL) {
- if ((p->h == h) && (p->nKeyLength == 0)) {
- return 1;
+ if (ht->flags & HASH_FLAG_PACKED) {
+ if (h >= 0 && h < ht->nTableSize) {
+ if (Z_TYPE(ht->arData[h].val) != IS_UNDEF) {
+ return 1;
+ }
}
- p = p->pNext;
+ return 0;
}
- return 0;
+
+ p = zend_hash_index_find_bucket(ht, h);
+ return p ? 1 : 0;
}
@@ -1001,9 +1131,10 @@ ZEND_API int zend_hash_num_elements(const HashTable *ht)
ZEND_API int zend_hash_get_pointer(const HashTable *ht, HashPointer *ptr)
{
- ptr->pos = ht->pInternalPointer;
- if (ht->pInternalPointer) {
- ptr->h = ht->pInternalPointer->h;
+ ptr->pos = ht->nInternalPointer;
+ ptr->ht = (HashTable*)ht;
+ if (ht->nInternalPointer != INVALID_IDX) {
+ ptr->h = ht->arData[ht->nInternalPointer].h;
return 1;
} else {
ptr->h = 0;
@@ -1013,19 +1144,36 @@ ZEND_API int zend_hash_get_pointer(const HashTable *ht, HashPointer *ptr)
ZEND_API int zend_hash_set_pointer(HashTable *ht, const HashPointer *ptr)
{
- if (ptr->pos == NULL) {
- ht->pInternalPointer = NULL;
- } else if (ht->pInternalPointer != ptr->pos) {
- Bucket *p;
+ uint idx;
+ if (ptr->pos == INVALID_IDX) {
+ ht->nInternalPointer = INVALID_IDX;
+ } else if (ptr->ht != ht) {
IS_CONSISTENT(ht);
- p = ht->arBuckets[ptr->h & ht->nTableMask];
- while (p != NULL) {
- if (p == ptr->pos) {
- ht->pInternalPointer = p;
+ for (idx = 0; idx < ht->nNumUsed; idx++) {
+ if (Z_TYPE(ht->arData[idx].val) != IS_UNDEF) {
+ ht->nInternalPointer = idx;
+ return 0;
+ }
+ }
+ idx = INVALID_IDX;
+ return 0;
+ } else if (ht->nInternalPointer != ptr->pos) {
+ IS_CONSISTENT(ht);
+ if (ht->flags & HASH_FLAG_PACKED) {
+ if (Z_TYPE(ht->arData[ptr->h].val) != IS_UNDEF) {
+ ht->nInternalPointer = ptr->h;
return 1;
}
- p = p->pNext;
+ } else {
+ idx = ht->arHash[ptr->h & ht->nTableMask];
+ while (idx != INVALID_IDX) {
+ if (idx == ptr->pos) {
+ ht->nInternalPointer = idx;
+ return 1;
+ }
+ idx = ht->arData[idx].val.u.next;
+ }
}
return 0;
}
@@ -1034,12 +1182,25 @@ ZEND_API int zend_hash_set_pointer(HashTable *ht, const HashPointer *ptr)
ZEND_API void zend_hash_internal_pointer_reset_ex(HashTable *ht, HashPosition *pos)
{
+ uint idx;
+
IS_CONSISTENT(ht);
- if (pos)
- *pos = ht->pListHead;
- else
- ht->pInternalPointer = ht->pListHead;
+ for (idx = 0; idx < ht->nNumUsed; idx++) {
+ if (Z_TYPE(ht->arData[idx].val) != IS_UNDEF) {
+ if (pos) {
+ *pos = idx;
+ } else {
+ ht->nInternalPointer = idx;
+ }
+ return;
+ }
+ }
+ if (pos) {
+ *pos = INVALID_IDX;
+ } else {
+ ht->nInternalPointer = INVALID_IDX;
+ }
}
@@ -1048,60 +1209,94 @@ ZEND_API void zend_hash_internal_pointer_reset_ex(HashTable *ht, HashPosition *p
*/
ZEND_API void zend_hash_internal_pointer_end_ex(HashTable *ht, HashPosition *pos)
{
+ uint idx;
+
IS_CONSISTENT(ht);
- if (pos)
- *pos = ht->pListTail;
- else
- ht->pInternalPointer = ht->pListTail;
+ idx = ht->nNumUsed;
+ while (idx > 0) {
+ idx--;
+ if (Z_TYPE(ht->arData[idx].val) != IS_UNDEF) {
+ if (pos) {
+ *pos = idx;
+ } else {
+ ht->nInternalPointer = idx;
+ }
+ return;
+ }
+ }
+ if (pos) {
+ *pos = INVALID_IDX;
+ } else {
+ ht->nInternalPointer = INVALID_IDX;
+ }
}
ZEND_API int zend_hash_move_forward_ex(HashTable *ht, HashPosition *pos)
{
- HashPosition *current = pos ? pos : &ht->pInternalPointer;
+ HashPosition *current = pos ? pos : &ht->nInternalPointer;
+ uint idx = *current;
IS_CONSISTENT(ht);
- if (*current) {
- *current = (*current)->pListNext;
- return SUCCESS;
- } else
- return FAILURE;
+ if (idx != INVALID_IDX) {
+ while (1) {
+ idx++;
+ if (idx >= ht->nNumUsed) {
+ *current = INVALID_IDX;
+ return SUCCESS;
+ }
+ if (Z_TYPE(ht->arData[idx].val) != IS_UNDEF) {
+ *current = idx;
+ return SUCCESS;
+ }
+ }
+ } else {
+ return FAILURE;
+ }
}
ZEND_API int zend_hash_move_backwards_ex(HashTable *ht, HashPosition *pos)
{
- HashPosition *current = pos ? pos : &ht->pInternalPointer;
+ HashPosition *current = pos ? pos : &ht->nInternalPointer;
+ uint idx = *current;
IS_CONSISTENT(ht);
- if (*current) {
- *current = (*current)->pListLast;
- return SUCCESS;
- } else
- return FAILURE;
+ if (idx != INVALID_IDX) {
+ while (idx > 0) {
+ idx--;
+ if (Z_TYPE(ht->arData[idx].val) != IS_UNDEF) {
+ *current = idx;
+ return SUCCESS;
+ }
+ }
+ *current = INVALID_IDX;
+ return SUCCESS;
+ } else {
+ return FAILURE;
+ }
}
/* This function should be made binary safe */
-ZEND_API int zend_hash_get_current_key_ex(const HashTable *ht, char **str_index, uint *str_length, ulong *num_index, zend_bool duplicate, HashPosition *pos)
+ZEND_API int zend_hash_get_current_key_ex(const HashTable *ht, zend_string **str_index, ulong *num_index, zend_bool duplicate, HashPosition *pos)
{
+ uint idx;
Bucket *p;
- p = pos ? (*pos) : ht->pInternalPointer;
+ idx = pos ? (*pos) : ht->nInternalPointer;
IS_CONSISTENT(ht);
- if (p) {
- if (p->nKeyLength) {
+ if (idx != INVALID_IDX) {
+ p = ht->arData + idx;
+ if (p->key) {
if (duplicate) {
- *str_index = estrndup(p->arKey, p->nKeyLength - 1);
+ *str_index = STR_DUP(p->key, 0);
} else {
- *str_index = (char*)p->arKey;
- }
- if (str_length) {
- *str_length = p->nKeyLength;
+ *str_index = p->key;
}
return HASH_KEY_IS_STRING;
} else {
@@ -1112,35 +1307,40 @@ ZEND_API int zend_hash_get_current_key_ex(const HashTable *ht, char **str_index,
return HASH_KEY_NON_EXISTENT;
}
-ZEND_API void zend_hash_get_current_key_zval_ex(const HashTable *ht, zval *key, HashPosition *pos) {
+ZEND_API void zend_hash_get_current_key_zval_ex(const HashTable *ht, zval *key, HashPosition *pos)
+{
+ uint idx;
Bucket *p;
IS_CONSISTENT(ht);
- p = pos ? (*pos) : ht->pInternalPointer;
+ idx = pos ? (*pos) : ht->nInternalPointer;
- if (!p) {
+ if (idx == INVALID_IDX) {
Z_TYPE_P(key) = IS_NULL;
- } else if (p->nKeyLength) {
- Z_TYPE_P(key) = IS_STRING;
- Z_STRVAL_P(key) = IS_INTERNED(p->arKey) ? (char*)p->arKey : estrndup(p->arKey, p->nKeyLength - 1);
- Z_STRLEN_P(key) = p->nKeyLength - 1;
} else {
- Z_TYPE_P(key) = IS_LONG;
- Z_LVAL_P(key) = p->h;
+ p = ht->arData + idx;
+ if (p->key) {
+ ZVAL_STR(key, p->key);
+ STR_ADDREF(p->key);
+ } else {
+ ZVAL_LONG(key, p->h);
+ }
}
}
ZEND_API int zend_hash_get_current_key_type_ex(HashTable *ht, HashPosition *pos)
{
+ uint idx;
Bucket *p;
- p = pos ? (*pos) : ht->pInternalPointer;
+ idx = pos ? (*pos) : ht->nInternalPointer;
IS_CONSISTENT(ht);
- if (p) {
- if (p->nKeyLength) {
+ if (idx != INVALID_IDX) {
+ p = ht->arData + idx;
+ if (p->key) {
return HASH_KEY_IS_STRING;
} else {
return HASH_KEY_IS_LONG;
@@ -1150,74 +1350,73 @@ ZEND_API int zend_hash_get_current_key_type_ex(HashTable *ht, HashPosition *pos)
}
-ZEND_API int zend_hash_get_current_data_ex(HashTable *ht, void **pData, HashPosition *pos)
+ZEND_API zval *zend_hash_get_current_data_ex(HashTable *ht, HashPosition *pos)
{
+ uint idx;
Bucket *p;
- p = pos ? (*pos) : ht->pInternalPointer;
+ idx = pos ? (*pos) : ht->nInternalPointer;
IS_CONSISTENT(ht);
- if (p) {
- *pData = p->pData;
- return SUCCESS;
+ if (idx != INVALID_IDX) {
+ p = ht->arData + idx;
+ return &p->val;
} else {
- return FAILURE;
+ return NULL;
}
}
/* This function changes key of current element without changing elements'
* order. If element with target key already exists, it will be deleted first.
*/
-ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, const char *str_index, uint str_length, ulong num_index, int mode, HashPosition *pos)
+ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, zend_string *str_index, ulong num_index, int mode, HashPosition *pos)
{
+ uint idx1, idx2;
Bucket *p, *q;
ulong h;
#ifdef ZEND_SIGNALS
TSRMLS_FETCH();
#endif
- p = pos ? (*pos) : ht->pInternalPointer;
+ idx1 = pos ? (*pos) : ht->nInternalPointer;
IS_CONSISTENT(ht);
- if (p) {
+ if (idx1 != INVALID_IDX) {
+ p = ht->arData + idx1;
if (key_type == HASH_KEY_IS_LONG) {
- str_length = 0;
- if (!p->nKeyLength && p->h == num_index) {
+ if (p->h == num_index && p->key == NULL) {
return SUCCESS;
}
- q = ht->arBuckets[num_index & ht->nTableMask];
- while (q != NULL) {
- if (!q->nKeyLength && q->h == num_index) {
+ idx2 = ht->arHash[num_index & ht->nTableMask];
+ while (idx2 != INVALID_IDX) {
+ q = ht->arData + idx2;
+ if (q->h == num_index && q->key == NULL) {
break;
}
- q = q->pNext;
+ idx2 = q->val.u.next;
}
} else if (key_type == HASH_KEY_IS_STRING) {
- if (IS_INTERNED(str_index)) {
- h = INTERNED_HASH(str_index);
- } else {
- h = zend_inline_hash_func(str_index, str_length);
- }
-
- if (p->arKey == str_index ||
- (p->nKeyLength == str_length &&
- p->h == h &&
- memcmp(p->arKey, str_index, str_length) == 0)) {
+ h = STR_HASH_VAL(str_index);
+ if (p->key == str_index ||
+ (p->h == h &&
+ p->key &&
+ p->key->len == str_index->len &&
+ memcmp(p->key->val, str_index->val, str_index->len) == 0)) {
return SUCCESS;
}
- q = ht->arBuckets[h & ht->nTableMask];
-
- while (q != NULL) {
- if (q->arKey == str_index ||
- (q->h == h && q->nKeyLength == str_length &&
- memcmp(q->arKey, str_index, str_length) == 0)) {
+ idx2 = ht->arHash[h & ht->nTableMask];
+ while (idx2 != INVALID_IDX) {
+ q = ht->arData + idx2;
+ if (q->key == str_index ||
+ (q->h == h && q->key && q->key->len == str_index->len &&
+ memcmp(q->key->val, str_index->val, str_index->len) == 0)) {
break;
}
- q = q->pNext;
+ idx2 = q->val.u.next;
}
} else {
return FAILURE;
@@ -1225,150 +1424,49 @@ ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, const
HANDLE_BLOCK_INTERRUPTIONS();
- if (q) {
+ if (idx2 != INVALID_IDX) {
+ /* we have another bucket with the key equal to new one */
if (mode != HASH_UPDATE_KEY_ANYWAY) {
- Bucket *r = p->pListLast;
- int found = HASH_UPDATE_KEY_IF_BEFORE;
-
- while (r) {
- if (r == q) {
- found = HASH_UPDATE_KEY_IF_AFTER;
- break;
- }
- r = r->pListLast;
- }
+ int found = (idx1 < idx2) ? HASH_UPDATE_KEY_IF_BEFORE : HASH_UPDATE_KEY_IF_AFTER;
+
if (mode & found) {
/* delete current bucket */
- if (p == ht->arBuckets[p->h & ht->nTableMask]) {
- ht->arBuckets[p->h & ht->nTableMask] = p->pNext;
- } else {
- p->pLast->pNext = p->pNext;
- }
- if (p->pNext) {
- p->pNext->pLast = p->pLast;
- }
- if (p->pListLast != NULL) {
- p->pListLast->pListNext = p->pListNext;
- } else {
- /* Deleting the head of the list */
- ht->pListHead = p->pListNext;
- }
- if (p->pListNext != NULL) {
- p->pListNext->pListLast = p->pListLast;
- } else {
- ht->pListTail = p->pListLast;
- }
- if (ht->pInternalPointer == p) {
- ht->pInternalPointer = p->pListNext;
- }
- ht->nNumOfElements--;
- if (ht->pDestructor) {
- ht->pDestructor(p->pData);
- }
- if (p->pData != &p->pDataPtr) {
- pefree(p->pData, ht->persistent);
- }
- pefree(p, ht->persistent);
+ _zend_hash_del_el(ht, idx1, p);
HANDLE_UNBLOCK_INTERRUPTIONS();
return FAILURE;
}
}
/* delete another bucket with the same key */
- if (q == ht->arBuckets[q->h & ht->nTableMask]) {
- ht->arBuckets[q->h & ht->nTableMask] = q->pNext;
- } else {
- q->pLast->pNext = q->pNext;
- }
- if (q->pNext) {
- q->pNext->pLast = q->pLast;
- }
- if (q->pListLast != NULL) {
- q->pListLast->pListNext = q->pListNext;
- } else {
- /* Deleting the head of the list */
- ht->pListHead = q->pListNext;
- }
- if (q->pListNext != NULL) {
- q->pListNext->pListLast = q->pListLast;
- } else {
- ht->pListTail = q->pListLast;
- }
- if (ht->pInternalPointer == q) {
- ht->pInternalPointer = q->pListNext;
- }
- ht->nNumOfElements--;
- if (ht->pDestructor) {
- ht->pDestructor(q->pData);
- }
- if (q->pData != &q->pDataPtr) {
- pefree(q->pData, ht->persistent);
- }
- pefree(q, ht->persistent);
- }
-
- if (p->pNext) {
- p->pNext->pLast = p->pLast;
- }
- if (p->pLast) {
- p->pLast->pNext = p->pNext;
- } else {
- ht->arBuckets[p->h & ht->nTableMask] = p->pNext;
- }
-
- if ((IS_INTERNED(p->arKey) != IS_INTERNED(str_index)) ||
- (!IS_INTERNED(p->arKey) && p->nKeyLength != str_length)) {
- Bucket *q;
-
- if (IS_INTERNED(str_index)) {
- q = (Bucket *) pemalloc(sizeof(Bucket), ht->persistent);
- } else {
- q = (Bucket *) pemalloc(sizeof(Bucket) + str_length, ht->persistent);
- }
-
- q->nKeyLength = str_length;
- if (p->pData == &p->pDataPtr) {
- q->pData = &q->pDataPtr;
- } else {
- q->pData = p->pData;
- }
- q->pDataPtr = p->pDataPtr;
- q->pListNext = p->pListNext;
- q->pListLast = p->pListLast;
- if (q->pListNext) {
- p->pListNext->pListLast = q;
- } else {
- ht->pListTail = q;
- }
- if (q->pListLast) {
- p->pListLast->pListNext = q;
- } else {
- ht->pListHead = q;
- }
- if (ht->pInternalPointer == p) {
- ht->pInternalPointer = q;
- }
- if (pos) {
- *pos = q;
- }
- pefree(p, ht->persistent);
- p = q;
+ _zend_hash_del_el(ht, idx2, q);
}
+ /* remove old key from hash */
+ if (ht->arHash[p->h & ht->nTableMask] == idx1) {
+ ht->arHash[p->h & ht->nTableMask] = p->val.u.next;
+ } else {
+ uint idx3 = ht->arHash[p->h & ht->nTableMask];
+ while (ht->arData[idx3].val.u.next != idx1) {
+ idx3 = ht->arData[idx3].val.u.next;
+ }
+ ht->arData[idx3].val.u.next = p->val.u.next;
+ }
+
+ /* update key */
+ if (p->key) {
+ STR_RELEASE(p->key);
+ }
if (key_type == HASH_KEY_IS_LONG) {
p->h = num_index;
+ p->key = NULL;
} else {
p->h = h;
- p->nKeyLength = str_length;
- if (IS_INTERNED(str_index)) {
- p->arKey = str_index;
- } else {
- p->arKey = (const char*)(p+1);
- memcpy((char*)p->arKey, str_index, str_length);
- }
+ p->key = str_index;
+ STR_ADDREF(str_index);
}
- CONNECT_TO_BUCKET_DLLIST(p, ht->arBuckets[p->h & ht->nTableMask]);
- ht->arBuckets[p->h & ht->nTableMask] = p;
+ /* insert new key into hash */
+ p->val.u.next = ht->arHash[p->h & ht->nTableMask];
+ ht->arHash[p->h & ht->nTableMask] = idx1;
HANDLE_UNBLOCK_INTERRUPTIONS();
return SUCCESS;
@@ -1380,7 +1478,6 @@ ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, const
ZEND_API int zend_hash_sort(HashTable *ht, sort_func_t sort_func,
compare_func_t compar, int renumber TSRMLS_DC)
{
- Bucket **arTmp;
Bucket *p;
int i, j;
@@ -1389,59 +1486,65 @@ ZEND_API int zend_hash_sort(HashTable *ht, sort_func_t sort_func,
if (!(ht->nNumOfElements>1) && !(renumber && ht->nNumOfElements>0)) { /* Doesn't require sorting */
return SUCCESS;
}
- arTmp = (Bucket **) pemalloc(ht->nNumOfElements * sizeof(Bucket *), ht->persistent);
- p = ht->pListHead;
- i = 0;
- while (p) {
- arTmp[i] = p;
- p = p->pListNext;
- i++;
- }
-
- (*sort_func)((void *) arTmp, i, sizeof(Bucket *), compar TSRMLS_CC);
- HANDLE_BLOCK_INTERRUPTIONS();
- ht->pListHead = arTmp[0];
- ht->pListTail = NULL;
- ht->pInternalPointer = ht->pListHead;
-
- arTmp[0]->pListLast = NULL;
- if (i > 1) {
- arTmp[0]->pListNext = arTmp[1];
- for (j = 1; j < i-1; j++) {
- arTmp[j]->pListLast = arTmp[j-1];
- arTmp[j]->pListNext = arTmp[j+1];
- }
- arTmp[j]->pListLast = arTmp[j-1];
- arTmp[j]->pListNext = NULL;
+ if (ht->nNumUsed == ht->nNumOfElements) {
+ i = ht->nNumUsed;
} else {
- arTmp[0]->pListNext = NULL;
+ for (j = 0, i = 0; j < ht->nNumUsed; j++) {
+ p = ht->arData + j;
+ if (Z_TYPE(p->val) == IS_UNDEF) continue;
+ if (i != j) {
+ ht->arData[i] = *p;
+ }
+ i++;
+ }
}
- ht->pListTail = arTmp[i-1];
- pefree(arTmp, ht->persistent);
- HANDLE_UNBLOCK_INTERRUPTIONS();
+ (*sort_func)((void *) ht->arData, i, sizeof(Bucket), compar TSRMLS_CC);
+
+ HANDLE_BLOCK_INTERRUPTIONS();
+ ht->nNumUsed = i;
+ ht->nInternalPointer = 0;
if (renumber) {
- p = ht->pListHead;
- i=0;
- while (p != NULL) {
- p->nKeyLength = 0;
- p->h = i++;
- p = p->pListNext;
+ for (j = 0; j < i; j++) {
+ p = ht->arData + j;
+ p->h = j;
+ if (p->key) {
+ STR_RELEASE(p->key);
+ p->key = NULL;
+ }
}
+ }
+ if (renumber) {
ht->nNextFreeElement = i;
- zend_hash_rehash(ht);
}
+ if (ht->flags & HASH_FLAG_PACKED) {
+ if (!renumber) {
+ zend_hash_packed_to_hash(ht);
+ }
+ } else {
+ if (renumber) {
+ ht->flags |= HASH_FLAG_PACKED;
+ pefree(ht->arHash, ht->flags & HASH_FLAG_PERSISTENT);
+ ht->arHash = (zend_uint*)&uninitialized_bucket;
+ } else {
+ zend_hash_rehash(ht);
+ }
+ }
+
+ HANDLE_UNBLOCK_INTERRUPTIONS();
+
return SUCCESS;
}
ZEND_API int zend_hash_compare(HashTable *ht1, HashTable *ht2, compare_func_t compar, zend_bool ordered TSRMLS_DC)
{
+ uint idx1, idx2;
Bucket *p1, *p2 = NULL;
int result;
- void *pData2;
+ zval *pData2;
IS_CONSISTENT(ht1);
IS_CONSISTENT(ht2);
@@ -1456,64 +1559,68 @@ ZEND_API int zend_hash_compare(HashTable *ht1, HashTable *ht2, compare_func_t co
return result;
}
- p1 = ht1->pListHead;
- if (ordered) {
- p2 = ht2->pListHead;
- }
+ for (idx1 = 0, idx2 = 0; idx1 < ht1->nNumUsed; idx1++) {
+ p1 = ht1->arData + idx1;
+ if (Z_TYPE(p1->val) == IS_UNDEF) continue;
- while (p1) {
- if (ordered && !p2) {
- HASH_UNPROTECT_RECURSION(ht1);
- HASH_UNPROTECT_RECURSION(ht2);
- return 1; /* That's not supposed to happen */
- }
if (ordered) {
- if (p1->nKeyLength==0 && p2->nKeyLength==0) { /* numeric indices */
+ while (1) {
+ p2 = ht2->arData + idx2;
+ if (idx2 == ht2->nNumUsed) {
+ HASH_UNPROTECT_RECURSION(ht1);
+ HASH_UNPROTECT_RECURSION(ht2);
+ return 1; /* That's not supposed to happen */
+ }
+ if (p2) break;
+ idx2++;
+ }
+ if (p1->key == NULL && p2->key == NULL) { /* numeric indices */
result = p1->h - p2->h;
- if (result!=0) {
+ if (result != 0) {
HASH_UNPROTECT_RECURSION(ht1);
HASH_UNPROTECT_RECURSION(ht2);
return result;
}
} else { /* string indices */
- result = p1->nKeyLength - p2->nKeyLength;
- if (result!=0) {
+ result = (p1->key ? p1->key->len : 0) - (p2->key ? p2->key->len : 0);
+ if (result != 0) {
HASH_UNPROTECT_RECURSION(ht1);
HASH_UNPROTECT_RECURSION(ht2);
return result;
}
- result = memcmp(p1->arKey, p2->arKey, p1->nKeyLength);
- if (result!=0) {
+ result = memcmp(p1->key->val, p2->key->val, p1->key->len);
+ if (result != 0) {
HASH_UNPROTECT_RECURSION(ht1);
HASH_UNPROTECT_RECURSION(ht2);
return result;
}
}
- pData2 = p2->pData;
+ pData2 = &p2->val;
} else {
- if (p1->nKeyLength==0) { /* numeric index */
- if (zend_hash_index_find(ht2, p1->h, &pData2)==FAILURE) {
+ if (p1->key == NULL) { /* numeric index */
+ pData2 = zend_hash_index_find(ht2, p1->h);
+ if (pData2 == NULL) {
HASH_UNPROTECT_RECURSION(ht1);
HASH_UNPROTECT_RECURSION(ht2);
return 1;
}
} else { /* string index */
- if (zend_hash_quick_find(ht2, p1->arKey, p1->nKeyLength, p1->h, &pData2)==FAILURE) {
+ pData2 = zend_hash_find(ht2, p1->key);
+ if (pData2 == NULL) {
HASH_UNPROTECT_RECURSION(ht1);
HASH_UNPROTECT_RECURSION(ht2);
return 1;
}
}
}
- result = compar(p1->pData, pData2 TSRMLS_CC);
- if (result!=0) {
+ result = compar(&p1->val, pData2 TSRMLS_CC);
+ if (result != 0) {
HASH_UNPROTECT_RECURSION(ht1);
HASH_UNPROTECT_RECURSION(ht2);
return result;
}
- p1 = p1->pListNext;
if (ordered) {
- p2 = p2->pListNext;
+ idx2++;
}
}
@@ -1523,31 +1630,41 @@ ZEND_API int zend_hash_compare(HashTable *ht1, HashTable *ht2, compare_func_t co
}
-ZEND_API int zend_hash_minmax(const HashTable *ht, compare_func_t compar, int flag, void **pData TSRMLS_DC)
+ZEND_API zval *zend_hash_minmax(const HashTable *ht, compare_func_t compar, int flag TSRMLS_DC)
{
+ uint idx;
Bucket *p, *res;
IS_CONSISTENT(ht);
if (ht->nNumOfElements == 0 ) {
- *pData=NULL;
- return FAILURE;
+ return NULL;
}
- res = p = ht->pListHead;
- while ((p = p->pListNext)) {
+ idx = 0;
+ while (1) {
+ if (idx == ht->nNumUsed) {
+ return NULL;
+ }
+ if (Z_TYPE(ht->arData[idx].val) != IS_UNDEF) break;
+ idx++;
+ }
+ res = ht->arData + idx;
+ for (; idx < ht->nNumUsed; idx++) {
+ p = ht->arData + idx;
+ if (Z_TYPE(p->val) == IS_UNDEF) continue;
+
if (flag) {
- if (compar(&res, &p TSRMLS_CC) < 0) { /* max */
+ if (compar(res, p TSRMLS_CC) < 0) { /* max */
res = p;
}
} else {
- if (compar(&res, &p TSRMLS_CC) > 0) { /* min */
+ if (compar(res, p TSRMLS_CC) > 0) { /* min */
res = p;
}
}
}
- *pData = res->pData;
- return SUCCESS;
+ return &res->val;
}
ZEND_API ulong zend_hash_next_free_element(const HashTable *ht)
@@ -1558,44 +1675,6 @@ ZEND_API ulong zend_hash_next_free_element(const HashTable *ht)
}
-
-#if ZEND_DEBUG
-void zend_hash_display_pListTail(const HashTable *ht)
-{
- Bucket *p;
-
- p = ht->pListTail;
- while (p != NULL) {
- zend_output_debug_string(0, "pListTail has key %s\n", p->arKey);
- p = p->pListLast;
- }
-}
-
-void zend_hash_display(const HashTable *ht)
-{
- Bucket *p;
- uint i;
-
- if (UNEXPECTED(ht->nNumOfElements == 0)) {
- zend_output_debug_string(0, "The hash is empty");
- return;
- }
- for (i = 0; i < ht->nTableSize; i++) {
- p = ht->arBuckets[i];
- while (p != NULL) {
- zend_output_debug_string(0, "%s <==> 0x%lX\n", p->arKey, p->h);
- p = p->pNext;
- }
- }
-
- p = ht->pListTail;
- while (p != NULL) {
- zend_output_debug_string(0, "%s <==> 0x%lX\n", p->arKey, p->h);
- p = p->pListLast;
- }
-}
-#endif
-
/*
* Local variables:
* tab-width: 4
diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h
index d990c16674..64461545c8 100644
--- a/Zend/zend_hash.h
+++ b/Zend/zend_hash.h
@@ -34,65 +34,32 @@
#define HASH_ADD (1<<1)
#define HASH_NEXT_INSERT (1<<2)
-#define HASH_DEL_KEY 0
-#define HASH_DEL_INDEX 1
-#define HASH_DEL_KEY_QUICK 2
-
#define HASH_UPDATE_KEY_IF_NONE 0
#define HASH_UPDATE_KEY_IF_BEFORE 1
#define HASH_UPDATE_KEY_IF_AFTER 2
#define HASH_UPDATE_KEY_ANYWAY 3
-typedef ulong (*hash_func_t)(const char *arKey, uint nKeyLength);
-typedef int (*compare_func_t)(const void *, const void * TSRMLS_DC);
-typedef void (*sort_func_t)(void *, size_t, register size_t, compare_func_t TSRMLS_DC);
-typedef void (*dtor_func_t)(void *pDest);
-typedef void (*copy_ctor_func_t)(void *pElement);
-typedef void (*copy_ctor_param_func_t)(void *pElement, void *pParam);
-
-struct _hashtable;
-
-typedef struct bucket {
- ulong h; /* Used for numeric indexing */
- uint nKeyLength;
- void *pData;
- void *pDataPtr;
- struct bucket *pListNext;
- struct bucket *pListLast;
- struct bucket *pNext;
- struct bucket *pLast;
- const char *arKey;
-} Bucket;
-
-typedef struct _hashtable {
- uint nTableSize;
- uint nTableMask;
- uint nNumOfElements;
- ulong nNextFreeElement;
- Bucket *pInternalPointer; /* Used for element traversal */
- Bucket *pListHead;
- Bucket *pListTail;
- Bucket **arBuckets;
- dtor_func_t pDestructor;
- zend_bool persistent;
- unsigned char nApplyCount;
- zend_bool bApplyProtection;
-#if ZEND_DEBUG
- int inconsistent;
-#endif
-} HashTable;
+#define INVALID_IDX ((uint)-1)
+#define HASH_FLAG_PERSISTENT (1<<0)
+#define HASH_FLAG_APPLY_PROTECTION (1<<1)
+#define HASH_FLAG_PACKED (1<<2)
+
+#define HASH_MASK_CONSISTENCY 0x60
+
+typedef int (*compare_func_t)(const void *, const void * TSRMLS_DC);
+typedef void (*sort_func_t)(void *, size_t, size_t, compare_func_t TSRMLS_DC);
+typedef void (*dtor_func_t)(zval *pDest);
+typedef void (*copy_ctor_func_t)(zval *pElement);
typedef struct _zend_hash_key {
- const char *arKey;
- uint nKeyLength;
- ulong h;
+ ulong h;
+ zend_string *key;
} zend_hash_key;
+typedef zend_bool (*merge_checker_func_t)(HashTable *target_ht, zval *source_data, zend_hash_key *hash_key, void *pParam);
-typedef zend_bool (*merge_checker_func_t)(HashTable *target_ht, void *source_data, zend_hash_key *hash_key, void *pParam);
-
-typedef Bucket* HashPosition;
+typedef uint HashPosition;
BEGIN_EXTERN_C()
@@ -104,35 +71,38 @@ ZEND_API void zend_hash_clean(HashTable *ht);
#define zend_hash_init(ht, nSize, pHashFunction, pDestructor, persistent) _zend_hash_init((ht), (nSize), (pDestructor), (persistent) ZEND_FILE_LINE_CC)
#define zend_hash_init_ex(ht, nSize, pHashFunction, pDestructor, persistent, bApplyProtection) _zend_hash_init_ex((ht), (nSize), (pDestructor), (persistent), (bApplyProtection) ZEND_FILE_LINE_CC)
-/* additions/updates/changes */
-ZEND_API int _zend_hash_add_or_update(HashTable *ht, const char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC);
-#define zend_hash_update(ht, arKey, nKeyLength, pData, nDataSize, pDest) \
- _zend_hash_add_or_update(ht, arKey, nKeyLength, pData, nDataSize, pDest, HASH_UPDATE ZEND_FILE_LINE_CC)
-#define zend_hash_add(ht, arKey, nKeyLength, pData, nDataSize, pDest) \
- _zend_hash_add_or_update(ht, arKey, nKeyLength, pData, nDataSize, pDest, HASH_ADD ZEND_FILE_LINE_CC)
-
-ZEND_API int _zend_hash_quick_add_or_update(HashTable *ht, const char *arKey, uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC);
-#define zend_hash_quick_update(ht, arKey, nKeyLength, h, pData, nDataSize, pDest) \
- _zend_hash_quick_add_or_update(ht, arKey, nKeyLength, h, pData, nDataSize, pDest, HASH_UPDATE ZEND_FILE_LINE_CC)
-#define zend_hash_quick_add(ht, arKey, nKeyLength, h, pData, nDataSize, pDest) \
- _zend_hash_quick_add_or_update(ht, arKey, nKeyLength, h, pData, nDataSize, pDest, HASH_ADD ZEND_FILE_LINE_CC)
-
-ZEND_API int _zend_hash_index_update_or_next_insert(HashTable *ht, ulong h, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC);
-#define zend_hash_index_update(ht, h, pData, nDataSize, pDest) \
- _zend_hash_index_update_or_next_insert(ht, h, pData, nDataSize, pDest, HASH_UPDATE ZEND_FILE_LINE_CC)
-#define zend_hash_next_index_insert(ht, pData, nDataSize, pDest) \
- _zend_hash_index_update_or_next_insert(ht, 0, pData, nDataSize, pDest, HASH_NEXT_INSERT ZEND_FILE_LINE_CC)
-
-ZEND_API int zend_hash_add_empty_element(HashTable *ht, const char *arKey, uint nKeyLength);
+ZEND_API void zend_hash_packed_to_hash(HashTable *ht);
+ZEND_API void zend_hash_to_packed(HashTable *ht);
+/* additions/updates/changes */
+ZEND_API zval *_zend_hash_add_or_update(HashTable *ht, zend_string *key, zval *pData, int flag ZEND_FILE_LINE_DC);
+#define zend_hash_update(ht, key, pData) \
+ _zend_hash_add_or_update(ht, key, pData, HASH_UPDATE ZEND_FILE_LINE_CC)
+#define zend_hash_add(ht, key, pData) \
+ _zend_hash_add_or_update(ht, key, pData, HASH_ADD ZEND_FILE_LINE_CC)
+
+ZEND_API zval *_zend_hash_str_add_or_update(HashTable *ht, const char *key, int len, zval *pData, int flag ZEND_FILE_LINE_DC);
+#define zend_hash_str_update(ht, key, len, pData) \
+ _zend_hash_str_add_or_update(ht, key, len, pData, HASH_UPDATE ZEND_FILE_LINE_CC)
+#define zend_hash_str_add(ht, key, len, pData) \
+ _zend_hash_str_add_or_update(ht, key, len, pData, HASH_ADD ZEND_FILE_LINE_CC)
+
+ZEND_API zval *_zend_hash_index_update_or_next_insert(HashTable *ht, ulong h, zval *pData, int flag ZEND_FILE_LINE_DC);
+#define zend_hash_index_update(ht, h, pData) \
+ _zend_hash_index_update_or_next_insert(ht, h, pData, HASH_UPDATE ZEND_FILE_LINE_CC)
+#define zend_hash_next_index_insert(ht, pData) \
+ _zend_hash_index_update_or_next_insert(ht, 0, pData, HASH_NEXT_INSERT ZEND_FILE_LINE_CC)
+
+ZEND_API zval *zend_hash_add_empty_element(HashTable *ht, zend_string *key);
+ZEND_API zval *zend_hash_str_add_empty_element(HashTable *ht, const char *key, int len);
#define ZEND_HASH_APPLY_KEEP 0
#define ZEND_HASH_APPLY_REMOVE 1<<0
#define ZEND_HASH_APPLY_STOP 1<<1
-typedef int (*apply_func_t)(void *pDest TSRMLS_DC);
-typedef int (*apply_func_arg_t)(void *pDest, void *argument TSRMLS_DC);
-typedef int (*apply_func_args_t)(void *pDest TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key);
+typedef int (*apply_func_t)(zval *pDest TSRMLS_DC);
+typedef int (*apply_func_arg_t)(zval *pDest, void *argument TSRMLS_DC);
+typedef int (*apply_func_args_t)(zval *pDest TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key);
ZEND_API void zend_hash_graceful_destroy(HashTable *ht);
ZEND_API void zend_hash_graceful_reverse_destroy(HashTable *ht);
@@ -150,24 +120,18 @@ ZEND_API void zend_hash_reverse_apply(HashTable *ht, apply_func_t apply_func TSR
/* Deletes */
-ZEND_API int zend_hash_del_key_or_index(HashTable *ht, const char *arKey, uint nKeyLength, ulong h, int flag);
-#define zend_hash_del(ht, arKey, nKeyLength) \
- zend_hash_del_key_or_index(ht, arKey, nKeyLength, 0, HASH_DEL_KEY)
-#define zend_hash_quick_del(ht, arKey, nKeyLength, h) \
- zend_hash_del_key_or_index(ht, arKey, nKeyLength, h, HASH_DEL_KEY_QUICK)
-#define zend_hash_index_del(ht, h) \
- zend_hash_del_key_or_index(ht, NULL, 0, h, HASH_DEL_INDEX)
-#define zend_get_hash_value \
- zend_hash_func
+ZEND_API int zend_hash_del(HashTable *ht, zend_string *key);
+ZEND_API int zend_hash_str_del(HashTable *ht, const char *key, int len);
+ZEND_API int zend_hash_index_del(HashTable *ht, ulong h);
/* Data retreival */
-ZEND_API int zend_hash_find(const HashTable *ht, const char *arKey, uint nKeyLength, void **pData);
-ZEND_API int zend_hash_quick_find(const HashTable *ht, const char *arKey, uint nKeyLength, ulong h, void **pData);
-ZEND_API int zend_hash_index_find(const HashTable *ht, ulong h, void **pData);
+ZEND_API zval *zend_hash_find(const HashTable *ht, zend_string *key);
+ZEND_API zval *zend_hash_str_find(const HashTable *ht, const char *key, int len);
+ZEND_API zval *zend_hash_index_find(const HashTable *ht, ulong h);
/* Misc */
-ZEND_API int zend_hash_exists(const HashTable *ht, const char *arKey, uint nKeyLength);
-ZEND_API int zend_hash_quick_exists(const HashTable *ht, const char *arKey, uint nKeyLength, ulong h);
+ZEND_API int zend_hash_exists(const HashTable *ht, zend_string *key);
+ZEND_API int zend_hash_str_exists(const HashTable *ht, const char *str, int len);
ZEND_API int zend_hash_index_exists(const HashTable *ht, ulong h);
ZEND_API ulong zend_hash_next_free_element(const HashTable *ht);
@@ -176,16 +140,17 @@ ZEND_API ulong zend_hash_next_free_element(const HashTable *ht);
(zend_hash_get_current_key_type_ex(ht, pos) == HASH_KEY_NON_EXISTENT ? FAILURE : SUCCESS)
ZEND_API int zend_hash_move_forward_ex(HashTable *ht, HashPosition *pos);
ZEND_API int zend_hash_move_backwards_ex(HashTable *ht, HashPosition *pos);
-ZEND_API int zend_hash_get_current_key_ex(const HashTable *ht, char **str_index, uint *str_length, ulong *num_index, zend_bool duplicate, HashPosition *pos);
+ZEND_API int zend_hash_get_current_key_ex(const HashTable *ht, zend_string **str_index, ulong *num_index, zend_bool duplicate, HashPosition *pos);
ZEND_API void zend_hash_get_current_key_zval_ex(const HashTable *ht, zval *key, HashPosition *pos);
ZEND_API int zend_hash_get_current_key_type_ex(HashTable *ht, HashPosition *pos);
-ZEND_API int zend_hash_get_current_data_ex(HashTable *ht, void **pData, HashPosition *pos);
+ZEND_API zval *zend_hash_get_current_data_ex(HashTable *ht, HashPosition *pos);
ZEND_API void zend_hash_internal_pointer_reset_ex(HashTable *ht, HashPosition *pos);
ZEND_API void zend_hash_internal_pointer_end_ex(HashTable *ht, HashPosition *pos);
-ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, const char *str_index, uint str_length, ulong num_index, int mode, HashPosition *pos);
+ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, zend_string *str_index, ulong num_index, int mode, HashPosition *pos);
typedef struct _HashPointer {
HashPosition pos;
+ HashTable *ht;
ulong h;
} HashPointer;
@@ -204,8 +169,8 @@ ZEND_API int zend_hash_set_pointer(HashTable *ht, const HashPointer *ptr);
zend_hash_get_current_key_zval_ex(ht, key, NULL)
#define zend_hash_get_current_key_type(ht) \
zend_hash_get_current_key_type_ex(ht, NULL)
-#define zend_hash_get_current_data(ht, pData) \
- zend_hash_get_current_data_ex(ht, pData, NULL)
+#define zend_hash_get_current_data(ht) \
+ zend_hash_get_current_data_ex(ht, NULL)
#define zend_hash_internal_pointer_reset(ht) \
zend_hash_internal_pointer_reset_ex(ht, NULL)
#define zend_hash_internal_pointer_end(ht) \
@@ -214,85 +179,20 @@ ZEND_API int zend_hash_set_pointer(HashTable *ht, const HashPointer *ptr);
zend_hash_update_current_key_ex(ht, key_type, str_index, str_length, num_index, HASH_UPDATE_KEY_ANYWAY, NULL)
/* Copying, merging and sorting */
-ZEND_API void zend_hash_copy(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size);
-ZEND_API void _zend_hash_merge(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size, int overwrite ZEND_FILE_LINE_DC);
-ZEND_API void zend_hash_merge_ex(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, uint size, merge_checker_func_t pMergeSource, void *pParam);
+ZEND_API void zend_hash_copy(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor);
+ZEND_API void _zend_hash_merge(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, int overwrite ZEND_FILE_LINE_DC);
+ZEND_API void zend_hash_merge_ex(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, merge_checker_func_t pMergeSource, void *pParam);
ZEND_API int zend_hash_sort(HashTable *ht, sort_func_t sort_func, compare_func_t compare_func, int renumber TSRMLS_DC);
ZEND_API int zend_hash_compare(HashTable *ht1, HashTable *ht2, compare_func_t compar, zend_bool ordered TSRMLS_DC);
-ZEND_API int zend_hash_minmax(const HashTable *ht, compare_func_t compar, int flag, void **pData TSRMLS_DC);
+ZEND_API zval *zend_hash_minmax(const HashTable *ht, compare_func_t compar, int flag TSRMLS_DC);
-#define zend_hash_merge(target, source, pCopyConstructor, tmp, size, overwrite) \
- _zend_hash_merge(target, source, pCopyConstructor, tmp, size, overwrite ZEND_FILE_LINE_CC)
+#define zend_hash_merge(target, source, pCopyConstructor, overwrite) \
+ _zend_hash_merge(target, source, pCopyConstructor, overwrite ZEND_FILE_LINE_CC)
ZEND_API int zend_hash_num_elements(const HashTable *ht);
ZEND_API int zend_hash_rehash(HashTable *ht);
-/*
- * DJBX33A (Daniel J. Bernstein, Times 33 with Addition)
- *
- * This is Daniel J. Bernstein's popular `times 33' hash function as
- * posted by him years ago on comp.lang.c. It basically uses a function
- * like ``hash(i) = hash(i-1) * 33 + str[i]''. This is one of the best
- * known hash functions for strings. Because it is both computed very
- * fast and distributes very well.
- *
- * The magic of number 33, i.e. why it works better than many other
- * constants, prime or not, has never been adequately explained by
- * anyone. So I try an explanation: if one experimentally tests all
- * multipliers between 1 and 256 (as RSE did now) one detects that even
- * numbers are not useable at all. The remaining 128 odd numbers
- * (except for the number 1) work more or less all equally well. They
- * all distribute in an acceptable way and this way fill a hash table
- * with an average percent of approx. 86%.
- *
- * If one compares the Chi^2 values of the variants, the number 33 not
- * even has the best value. But the number 33 and a few other equally
- * good numbers like 17, 31, 63, 127 and 129 have nevertheless a great
- * advantage to the remaining numbers in the large set of possible
- * multipliers: their multiply operation can be replaced by a faster
- * operation based on just one shift plus either a single addition
- * or subtraction operation. And because a hash function has to both
- * distribute good _and_ has to be very fast to compute, those few
- * numbers should be preferred and seems to be the reason why Daniel J.
- * Bernstein also preferred it.
- *
- *
- * -- Ralf S. Engelschall <rse@engelschall.com>
- */
-
-static inline ulong zend_inline_hash_func(const char *arKey, uint nKeyLength)
-{
- register ulong hash = 5381;
-
- /* variant with the hash unrolled eight times */
- for (; nKeyLength >= 8; nKeyLength -= 8) {
- hash = ((hash << 5) + hash) + *arKey++;
- hash = ((hash << 5) + hash) + *arKey++;
- hash = ((hash << 5) + hash) + *arKey++;
- hash = ((hash << 5) + hash) + *arKey++;
- hash = ((hash << 5) + hash) + *arKey++;
- hash = ((hash << 5) + hash) + *arKey++;
- hash = ((hash << 5) + hash) + *arKey++;
- hash = ((hash << 5) + hash) + *arKey++;
- }
- switch (nKeyLength) {
- case 7: hash = ((hash << 5) + hash) + *arKey++; /* fallthrough... */
- case 6: hash = ((hash << 5) + hash) + *arKey++; /* fallthrough... */
- case 5: hash = ((hash << 5) + hash) + *arKey++; /* fallthrough... */
- case 4: hash = ((hash << 5) + hash) + *arKey++; /* fallthrough... */
- case 3: hash = ((hash << 5) + hash) + *arKey++; /* fallthrough... */
- case 2: hash = ((hash << 5) + hash) + *arKey++; /* fallthrough... */
- case 1: hash = ((hash << 5) + hash) + *arKey++; break;
- case 0: break;
-EMPTY_SWITCH_DEFAULT_CASE()
- }
- return hash;
-}
-
-
-ZEND_API ulong zend_hash_func(const char *arKey, uint nKeyLength);
-
#if ZEND_DEBUG
/* debug */
void zend_hash_display_pListTail(const HashTable *ht);
@@ -348,41 +248,210 @@ END_EXTERN_C()
ZEND_HANDLE_NUMERIC_EX(key, length, idx, return func); \
} while (0)
-static inline int zend_symtable_update(HashTable *ht, const char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest) \
+static inline zval *zend_symtable_update(HashTable *ht, zend_string *key, zval *pData)
{
- ZEND_HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_update(ht, idx, pData, nDataSize, pDest));
- return zend_hash_update(ht, arKey, nKeyLength, pData, nDataSize, pDest);
+ ZEND_HANDLE_NUMERIC(key->val, key->len+1, zend_hash_index_update(ht, idx, pData));
+ return zend_hash_update(ht, key, pData);
}
-static inline int zend_symtable_del(HashTable *ht, const char *arKey, uint nKeyLength)
+static inline int zend_symtable_del(HashTable *ht, zend_string *key)
{
- ZEND_HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_del(ht, idx));
- return zend_hash_del(ht, arKey, nKeyLength);
+ ZEND_HANDLE_NUMERIC(key->val, key->len+1, zend_hash_index_del(ht, idx));
+ return zend_hash_del(ht, key);
}
-static inline int zend_symtable_find(HashTable *ht, const char *arKey, uint nKeyLength, void **pData)
+static inline zval *zend_symtable_find(HashTable *ht, zend_string *key)
{
- ZEND_HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_find(ht, idx, pData));
- return zend_hash_find(ht, arKey, nKeyLength, pData);
+ ZEND_HANDLE_NUMERIC(key->val, key->len+1, zend_hash_index_find(ht, idx));
+ return zend_hash_find(ht, key);
}
-static inline int zend_symtable_exists(HashTable *ht, const char *arKey, uint nKeyLength)
+static inline int zend_symtable_exists(HashTable *ht, zend_string *key)
+{
+ ZEND_HANDLE_NUMERIC(key->val, key->len+1, zend_hash_index_exists(ht, idx));
+ return zend_hash_exists(ht, key);
+}
+
+static inline zval *zend_symtable_str_update(HashTable *ht, const char *str, int len, zval *pData)
{
- ZEND_HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_exists(ht, idx));
- return zend_hash_exists(ht, arKey, nKeyLength);
+ ZEND_HANDLE_NUMERIC(str, len+1, zend_hash_index_update(ht, idx, pData));
+ return zend_hash_str_update(ht, str, len, pData);
}
-static inline int zend_symtable_update_current_key_ex(HashTable *ht, const char *arKey, uint nKeyLength, int mode, HashPosition *pos)
+
+static inline int zend_symtable_str_del(HashTable *ht, const char *str, int len)
{
- ZEND_HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_update_current_key_ex(ht, HASH_KEY_IS_LONG, NULL, 0, idx, mode, pos));
- return zend_hash_update_current_key_ex(ht, HASH_KEY_IS_STRING, arKey, nKeyLength, 0, mode, pos);
+ ZEND_HANDLE_NUMERIC(str, len+1, zend_hash_index_del(ht, idx));
+ return zend_hash_str_del(ht, str, len);
+}
+
+
+static inline zval *zend_symtable_str_find(HashTable *ht, const char *str, int len)
+{
+ ZEND_HANDLE_NUMERIC(str, len+1, zend_hash_index_find(ht, idx));
+ return zend_hash_str_find(ht, str, len);
+}
+
+
+static inline int zend_symtable_str_exists(HashTable *ht, const char *str, int len)
+{
+ ZEND_HANDLE_NUMERIC(str, len+1, zend_hash_index_exists(ht, idx));
+ return zend_hash_str_exists(ht, str, len);
+}
+
+static inline int zend_symtable_update_current_key_ex(HashTable *ht, zend_string *key, int mode, HashPosition *pos)
+{
+ZEND_HANDLE_NUMERIC(key->val, key->len+1, zend_hash_update_current_key_ex(ht, HASH_KEY_IS_LONG, NULL, idx, mode, pos));
+ return zend_hash_update_current_key_ex(ht, HASH_KEY_IS_STRING, key, 0, mode, pos);
+}
+#define zend_symtable_update_current_key(ht, key, mode) \
+ zend_symtable_update_current_key_ex(ht, key, mode, NULL)
+
+static inline void *zend_hash_add_ptr(HashTable *ht, zend_string *key, void *pData)
+{
+ zval tmp, *zv;
+
+ ZVAL_PTR(&tmp, pData);
+ zv = zend_hash_add(ht, key, &tmp);
+ return zv ? Z_PTR_P(zv) : NULL;
+}
+
+static inline void *zend_hash_str_add_ptr(HashTable *ht, const char *str, int len, void *pData)
+{
+ zval tmp, *zv;
+
+ ZVAL_PTR(&tmp, pData);
+ zv = zend_hash_str_add(ht, str, len, &tmp);
+ return zv ? Z_PTR_P(zv) : NULL;
+}
+
+static inline void *zend_hash_update_ptr(HashTable *ht, zend_string *key, void *pData)
+{
+ zval tmp, *zv;
+
+ ZVAL_PTR(&tmp, pData);
+ zv = zend_hash_update(ht, key, &tmp);
+ return zv ? Z_PTR_P(zv) : NULL;
+}
+
+static inline void *zend_hash_str_update_ptr(HashTable *ht, const char *str, int len, void *pData)
+{
+ zval tmp, *zv;
+
+ ZVAL_PTR(&tmp, pData);
+ zv = zend_hash_str_update(ht, str, len, &tmp);
+ return zv ? Z_PTR_P(zv) : NULL;
+}
+
+static inline void *zend_hash_add_mem(HashTable *ht, zend_string *key, void *pData, size_t size)
+{
+ void *p;
+
+ p = pemalloc(size, ht->flags & HASH_FLAG_PERSISTENT);
+ memcpy(p, pData, size);
+ return zend_hash_add_ptr(ht, key, p);
+}
+
+static inline void *zend_hash_str_add_mem(HashTable *ht, const char *str, int len, void *pData, size_t size)
+{
+ void *p;
+
+ p = pemalloc(size, ht->flags & HASH_FLAG_PERSISTENT);
+ memcpy(p, pData, size);
+ return zend_hash_str_add_ptr(ht, str, len, p);
+}
+
+static inline void *zend_hash_update_mem(HashTable *ht, zend_string *key, void *pData, size_t size)
+{
+ void *p;
+
+ p = pemalloc(size, ht->flags & HASH_FLAG_PERSISTENT);
+ memcpy(p, pData, size);
+ return zend_hash_update_ptr(ht, key, p);
+}
+
+static inline void *zend_hash_str_update_mem(HashTable *ht, const char *str, int len, void *pData, size_t size)
+{
+ void *p;
+
+ p = pemalloc(size, ht->flags & HASH_FLAG_PERSISTENT);
+ memcpy(p, pData, size);
+ return zend_hash_str_update_ptr(ht, str, len, p);
+}
+
+static inline void *zend_hash_index_update_ptr(HashTable *ht, ulong h, void *pData)
+{
+ zval tmp, *zv;
+
+ ZVAL_PTR(&tmp, pData);
+ zv = zend_hash_index_update(ht, h, &tmp);
+ return zv ? Z_PTR_P(zv) : NULL;
+}
+
+static inline void *zend_hash_next_index_insert_ptr(HashTable *ht, void *pData)
+{
+ zval tmp, *zv;
+
+ ZVAL_PTR(&tmp, pData);
+ zv = zend_hash_next_index_insert(ht, &tmp);
+ return zv ? Z_PTR_P(zv) : NULL;
+}
+
+static inline void *zend_hash_index_update_mem(HashTable *ht, ulong h, void *pData, size_t size)
+{
+ void *p;
+
+ p = pemalloc(size, ht->flags & HASH_FLAG_PERSISTENT);
+ memcpy(p, pData, size);
+ return zend_hash_index_update_ptr(ht, h, p);
+}
+
+static inline void *zend_hash_next_index_insert_mem(HashTable *ht, void *pData, size_t size)
+{
+ void *p;
+
+ p = pemalloc(size, ht->flags & HASH_FLAG_PERSISTENT);
+ memcpy(p, pData, size);
+ return zend_hash_next_index_insert_ptr(ht, p);
+}
+
+static inline void *zend_hash_find_ptr(HashTable *ht, zend_string *key)
+{
+ zval *zv;
+
+ zv = zend_hash_find(ht, key);
+ return zv ? Z_PTR_P(zv) : NULL;
+}
+
+static inline void *zend_hash_str_find_ptr(HashTable *ht, const char *str, int len)
+{
+ zval *zv;
+
+ zv = zend_hash_str_find(ht, str, len);
+ return zv ? Z_PTR_P(zv) : NULL;
+}
+
+static inline void *zend_hash_index_find_ptr(HashTable *ht, ulong h)
+{
+ zval *zv;
+
+ zv = zend_hash_index_find(ht, h);
+ return zv ? Z_PTR_P(zv) : NULL;
+}
+
+static inline void *zend_hash_get_current_data_ptr_ex(HashTable *ht, HashPosition *pos)
+{
+ zval *zv;
+
+ zv = zend_hash_get_current_data_ptr_ex(ht, pos);
+ return zv ? Z_PTR_P(zv) : NULL;
}
-#define zend_symtable_update_current_key(ht,arKey,nKeyLength,mode) \
- zend_symtable_update_current_key_ex(ht, arKey, nKeyLength, mode, NULL)
+#define zend_hash_get_current_data_ptr(ht) \
+ zend_hash_get_current_data_ptr_ex(ht, NULL)
#endif /* ZEND_HASH_H */
diff --git a/Zend/zend_highlight.c b/Zend/zend_highlight.c
index ffec587806..03bf6611f6 100644
--- a/Zend/zend_highlight.c
+++ b/Zend/zend_highlight.c
@@ -150,7 +150,7 @@ ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini
case T_DOC_COMMENT:
break;
default:
- efree(token.value.str.val);
+ STR_RELEASE(Z_STR(token));
break;
}
}
@@ -211,7 +211,7 @@ ZEND_API void zend_strip(TSRMLS_D)
break;
default:
- efree(token.value.str.val);
+ STR_RELEASE(Z_STR(token));
break;
}
}
diff --git a/Zend/zend_indent.c b/Zend/zend_indent.c
index 38ce669083..5d627d4c1d 100644
--- a/Zend/zend_indent.c
+++ b/Zend/zend_indent.c
@@ -138,7 +138,7 @@ dflt_printout:
case T_WHITESPACE:
break;
default:
- efree(token.value.str.val);
+ STR_RELEASE(Z_STR(token));
break;
}
}
diff --git a/Zend/zend_ini.c b/Zend/zend_ini.c
index f286ccd157..a4adb46639 100644
--- a/Zend/zend_ini.c
+++ b/Zend/zend_ini.c
@@ -150,17 +150,17 @@ static int ini_key_compare(const void *a, const void *b TSRMLS_DC) /* {{{ */
const Bucket *f;
const Bucket *s;
- f = *((const Bucket **) a);
- s = *((const Bucket **) b);
+ f = (const Bucket *) a;
+ s = (const Bucket *) b;
- 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 */
+ if (!f->key && !s->key) { /* both numeric */
+ return ZEND_NORMALIZE_BOOL(f->h - s->h);
+ } else if (!f->key) { /* f is numeric, s is not */
return -1;
- } else if (s->nKeyLength == 0) { /* s is numeric, f is not */
+ } else if (!s->key) { /* s is numeric, f is not */
return 1;
} else { /* both strings */
- return zend_binary_strcasecmp(f->arKey, f->nKeyLength, s->arKey, s->nKeyLength);
+ return zend_binary_strcasecmp(f->key->val, f->key->len, s->key->val, s->key->len);
}
}
/* }}} */
@@ -198,7 +198,7 @@ ZEND_API int zend_register_ini_entries(const zend_ini_entry *ini_entry, int modu
while (p->name) {
config_directive_success = 0;
- if (zend_hash_add(directives, p->name, p->name_length, (void*)p, sizeof(zend_ini_entry), (void **) &hashed_ini_entry) == FAILURE) {
+ if ((hashed_ini_entry = zend_hash_str_add_mem(directives, p->name, p->name_length, (void*)p, sizeof(zend_ini_entry))) == NULL) {
zend_unregister_ini_entries(module_number TSRMLS_CC);
return FAILURE;
}
@@ -244,22 +244,22 @@ ZEND_API void zend_ini_refresh_caches(int stage TSRMLS_DC) /* {{{ */
/* }}} */
#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) /* {{{ */
+ZEND_API int zend_alter_ini_entry(zend_string *name, char *new_value, uint new_value_length, int modify_type, int stage) /* {{{ */
{
TSRMLS_FETCH();
- return zend_alter_ini_entry_ex(name, name_length, new_value, new_value_length, modify_type, stage, 0 TSRMLS_CC);
+ return zend_alter_ini_entry_ex(name, new_value, new_value_length, modify_type, stage, 0 TSRMLS_CC);
}
/* }}} */
-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 TSRMLS_DC) /* {{{ */
+ZEND_API int zend_alter_ini_entry_ex(zend_string *name, char *new_value, uint new_value_length, int modify_type, int stage, int force_change TSRMLS_DC) /* {{{ */
{
zend_ini_entry *ini_entry;
char *duplicate;
zend_bool modifiable;
zend_bool modified;
- if (zend_hash_find(EG(ini_directives), name, name_length, (void **) &ini_entry) == FAILURE) {
+ if ((ini_entry = zend_hash_find_ptr(EG(ini_directives), name)) == NULL) {
return FAILURE;
}
@@ -285,7 +285,7 @@ ZEND_API int zend_alter_ini_entry_ex(char *name, uint name_length, char *new_val
ini_entry->orig_value_length = ini_entry->value_length;
ini_entry->orig_modifiable = modifiable;
ini_entry->modified = 1;
- zend_hash_add(EG(modified_ini_directives), name, name_length, &ini_entry, sizeof(zend_ini_entry*), NULL);
+ zend_hash_add_ptr(EG(modified_ini_directives), name, ini_entry);
}
duplicate = estrndup(new_value, new_value_length);
@@ -306,19 +306,19 @@ ZEND_API int zend_alter_ini_entry_ex(char *name, uint name_length, char *new_val
}
/* }}} */
-ZEND_API int zend_restore_ini_entry(char *name, uint name_length, int stage) /* {{{ */
+ZEND_API int zend_restore_ini_entry(zend_string *name, int stage) /* {{{ */
{
zend_ini_entry *ini_entry;
TSRMLS_FETCH();
- if (zend_hash_find(EG(ini_directives), name, name_length, (void **) &ini_entry) == FAILURE ||
+ if ((ini_entry = zend_hash_find_ptr(EG(ini_directives), name)) == NULL ||
(stage == ZEND_INI_STAGE_RUNTIME && (ini_entry->modifiable & ZEND_INI_USER) == 0)) {
return FAILURE;
}
if (EG(modified_ini_directives)) {
if (zend_restore_ini_entry_cb(ini_entry, stage TSRMLS_CC) == 0) {
- zend_hash_del(EG(modified_ini_directives), name, name_length);
+ zend_hash_del(EG(modified_ini_directives), name);
} else {
return FAILURE;
}
@@ -332,7 +332,8 @@ ZEND_API int zend_ini_register_displayer(char *name, uint name_length, void (*di
{
zend_ini_entry *ini_entry;
- if (zend_hash_find(registered_zend_ini_directives, name, name_length, (void **) &ini_entry) == FAILURE) {
+ ini_entry = zend_hash_str_find_ptr(registered_zend_ini_directives, name, name_length);
+ if (ini_entry == NULL) {
return FAILURE;
}
@@ -350,7 +351,8 @@ 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) {
+ ini_entry = zend_hash_str_find_ptr(EG(ini_directives), name, name_length);
+ if (ini_entry) {
if (orig && ini_entry->modified) {
return (ini_entry->orig_value ? strtol(ini_entry->orig_value, NULL, 0) : 0);
} else {
@@ -367,7 +369,8 @@ 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) {
+ ini_entry = zend_hash_str_find_ptr(EG(ini_directives), name, name_length);
+ if (ini_entry) {
if (orig && ini_entry->modified) {
return (double) (ini_entry->orig_value ? zend_strtod(ini_entry->orig_value, NULL) : 0.0);
} else {
@@ -384,7 +387,8 @@ ZEND_API char *zend_ini_string_ex(char *name, uint name_length, int orig, zend_b
zend_ini_entry *ini_entry;
TSRMLS_FETCH();
- if (zend_hash_find(EG(ini_directives), name, name_length, (void **) &ini_entry) == SUCCESS) {
+ ini_entry = zend_hash_str_find_ptr(EG(ini_directives), name, name_length);
+ if (ini_entry) {
if (exists) {
*exists = 1;
}
diff --git a/Zend/zend_ini.h b/Zend/zend_ini.h
index 0fe4c3161f..86308f1929 100644
--- a/Zend/zend_ini.h
+++ b/Zend/zend_ini.h
@@ -94,9 +94,9 @@ ZEND_API void zend_ini_sort_entries(TSRMLS_D);
ZEND_API int zend_register_ini_entries(const zend_ini_entry *ini_entry, int module_number TSRMLS_DC);
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 TSRMLS_DC);
-ZEND_API int zend_restore_ini_entry(char *name, uint name_length, int stage);
+ZEND_API int zend_alter_ini_entry(zend_string *name, char *new_value, uint new_value_length, int modify_type, int stage);
+ZEND_API int zend_alter_ini_entry_ex(zend_string *name, char *new_value, uint new_value_length, int modify_type, int stage, int force_change TSRMLS_DC);
+ZEND_API int zend_restore_ini_entry(zend_string *name, int stage);
ZEND_API void display_ini_entries(zend_module_entry *module);
ZEND_API long zend_ini_long(char *name, uint name_length, int orig);
diff --git a/Zend/zend_ini_parser.y b/Zend/zend_ini_parser.y
index 3823efd413..73a0b257b6 100644
--- a/Zend/zend_ini_parser.y
+++ b/Zend/zend_ini_parser.y
@@ -49,6 +49,7 @@ static void zend_ini_do_op(char type, zval *result, zval *op1, zval *op2)
{
int i_result;
int i_op1, i_op2;
+ int str_len;
char str_result[MAX_LENGTH_OF_LONG];
i_op1 = atoi(Z_STRVAL_P(op1));
@@ -81,11 +82,8 @@ static void zend_ini_do_op(char type, zval *result, zval *op1, zval *op2)
break;
}
- Z_STRLEN_P(result) = zend_sprintf(str_result, "%d", i_result);
- Z_STRVAL_P(result) = (char *) malloc(Z_STRLEN_P(result)+1);
- memcpy(Z_STRVAL_P(result), str_result, Z_STRLEN_P(result));
- Z_STRVAL_P(result)[Z_STRLEN_P(result)] = 0;
- Z_TYPE_P(result) = IS_STRING;
+ str_len = zend_sprintf(str_result, "%d", i_result);
+ ZVAL_PSTRINGL(result, str_result, str_len);
}
/* }}} */
@@ -93,10 +91,7 @@ static void zend_ini_do_op(char type, zval *result, zval *op1, zval *op2)
*/
static void zend_ini_init_string(zval *result)
{
- Z_STRVAL_P(result) = malloc(1);
- Z_STRVAL_P(result)[0] = 0;
- Z_STRLEN_P(result) = 0;
- Z_TYPE_P(result) = IS_STRING;
+ ZVAL_EMPTY_PSTRING(result);
}
/* }}} */
@@ -106,11 +101,10 @@ static void zend_ini_add_string(zval *result, zval *op1, zval *op2)
{
int length = Z_STRLEN_P(op1) + Z_STRLEN_P(op2);
- Z_STRVAL_P(result) = (char *) realloc(Z_STRVAL_P(op1), length+1);
+ ZVAL_STR(result, STR_ALLOC(length, 1));
+ memcpy(Z_STRVAL_P(result), Z_STRVAL_P(op1), Z_STRLEN_P(op1));
memcpy(Z_STRVAL_P(result)+Z_STRLEN_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op2));
Z_STRVAL_P(result)[length] = 0;
- Z_STRLEN_P(result) = length;
- Z_TYPE_P(result) = IS_STRING;
}
/* }}} */
@@ -125,9 +119,7 @@ static void zend_ini_get_constant(zval *result, zval *name TSRMLS_DC)
&& zend_get_constant(Z_STRVAL_P(name), Z_STRLEN_P(name), &z_constant TSRMLS_CC)) {
/* z_constant is emalloc()'d */
convert_to_string(&z_constant);
- Z_STRVAL_P(result) = zend_strndup(Z_STRVAL(z_constant), Z_STRLEN(z_constant));
- Z_STRLEN_P(result) = Z_STRLEN(z_constant);
- Z_TYPE_P(result) = Z_TYPE(z_constant);
+ ZVAL_PSTRINGL(result, Z_STRVAL(z_constant), Z_STRLEN(z_constant));
zval_dtor(&z_constant);
free(Z_STRVAL_P(name));
} else {
@@ -145,13 +137,11 @@ static void zend_ini_get_var(zval *result, zval *name TSRMLS_DC)
/* Fetch configuration option value */
if (zend_get_configuration_directive(Z_STRVAL_P(name), Z_STRLEN_P(name)+1, &curval) == SUCCESS) {
- Z_STRVAL_P(result) = zend_strndup(Z_STRVAL(curval), Z_STRLEN(curval));
- Z_STRLEN_P(result) = Z_STRLEN(curval);
+ ZVAL_PSTRINGL(result, Z_STRVAL(curval), Z_STRLEN(curval));
/* ..or if not found, try ENV */
} else if ((envvar = zend_getenv(Z_STRVAL_P(name), Z_STRLEN_P(name) TSRMLS_CC)) != NULL ||
(envvar = getenv(Z_STRVAL_P(name))) != NULL) {
- Z_STRVAL_P(result) = strdup(envvar);
- Z_STRLEN_P(result) = strlen(envvar);
+ ZVAL_PSTRING(result, envvar);
} else {
zend_ini_init_string(result);
}
@@ -160,7 +150,7 @@ static void zend_ini_get_var(zval *result, zval *name TSRMLS_DC)
/* {{{ ini_error()
*/
-static void ini_error(char *msg)
+static void ini_error(const char *msg)
{
char *error_buf;
int error_buf_len;
diff --git a/Zend/zend_ini_scanner.c b/Zend/zend_ini_scanner.c
index c73f3cedda..d956243963 100644
--- a/Zend/zend_ini_scanner.c
+++ b/Zend/zend_ini_scanner.c
@@ -1,4663 +1,4661 @@
-/* Generated by re2c 0.13.5 */
-#line 1 "Zend/zend_ini_scanner.l"
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.00 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.zend.com/license/2_00.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Zeev Suraski <zeev@zend.com> |
- | Jani Taskinen <jani@php.net> |
- | Marcus Boerger <helly@php.net> |
- | Nuno Lopes <nlopess@php.net> |
- | Scott MacVicar <scottmac@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include <errno.h>
-#include "zend.h"
-#include "zend_globals.h"
-#include <zend_ini_parser.h>
-#include "zend_ini_scanner.h"
-
-#if 0
-# define YYDEBUG(s, c) printf("state: %d char: %c\n", s, c)
-#else
-# define YYDEBUG(s, c)
-#endif
-
-#include "zend_ini_scanner_defs.h"
-
-#define YYCTYPE unsigned char
-/* allow the scanner to read one null byte after the end of the string (from ZEND_MMAP_AHEAD)
- * so that if will be able to terminate to match the current token (e.g. non-enclosed string) */
-#define YYFILL(n) { if (YYCURSOR > YYLIMIT) return 0; }
-#define YYCURSOR SCNG(yy_cursor)
-#define YYLIMIT SCNG(yy_limit)
-#define YYMARKER SCNG(yy_marker)
-
-#define YYGETCONDITION() SCNG(yy_state)
-#define YYSETCONDITION(s) SCNG(yy_state) = s
-
-#define STATE(name) yyc##name
-
-/* emulate flex constructs */
-#define BEGIN(state) YYSETCONDITION(STATE(state))
-#define YYSTATE YYGETCONDITION()
-#define yytext ((char*)SCNG(yy_text))
-#define yyleng SCNG(yy_leng)
-#define yyless(x) do { YYCURSOR = (unsigned char*)yytext + x; \
- yyleng = (unsigned int)x; } while(0)
-
-/* #define yymore() goto yymore_restart */
-
-/* perform sanity check. If this message is triggered you should
- increase the ZEND_MMAP_AHEAD value in the zend_streams.h file */
-#define YYMAXFILL 6
-#if ZEND_MMAP_AHEAD < (YYMAXFILL + 1)
-# error ZEND_MMAP_AHEAD should be greater than YYMAXFILL
-#endif
-
-
-/* How it works (for the core ini directives):
- * ===========================================
- *
- * 1. Scanner scans file for tokens and passes them to parser.
- * 2. Parser parses the tokens and passes the name/value pairs to the callback
- * function which stores them in the configuration hash table.
- * 3. Later REGISTER_INI_ENTRIES() is called which triggers the actual
- * registering of ini entries and uses zend_get_configuration_directive()
- * to fetch the previously stored name/value pair from configuration hash table
- * and registers the static ini entries which match the name to the value
- * into EG(ini_directives) hash table.
- * 4. PATH section entries are used per-request from down to top, each overriding
- * previous if one exists. zend_alter_ini_entry() is called for each entry.
- * Settings in PATH section are ZEND_INI_SYSTEM accessible and thus mimics the
- * php_admin_* directives used within Apache httpd.conf when PHP is compiled as
- * module for Apache.
- * 5. User defined ini files (like .htaccess for apache) are parsed for each request and
- * stored in separate hash defined by SAPI.
- */
-
-/* TODO: (ordered by importance :-)
- * ===============================================================================
- *
- * - Separate constant lookup totally from plain strings (using CONSTANT pattern)
- * - Add #if .. #else .. #endif and ==, !=, <, > , <=, >= operators
- * - Add #include "some.ini"
- * - Allow variables to refer to options also when using parse_ini_file()
- *
- */
-
-/* Globals Macros */
-#define SCNG INI_SCNG
-#ifdef ZTS
-ZEND_API ts_rsrc_id ini_scanner_globals_id;
-#else
-ZEND_API zend_ini_scanner_globals ini_scanner_globals;
-#endif
-
-/* Eat leading whitespace */
-#define EAT_LEADING_WHITESPACE() \
- while (yytext[0]) { \
- if (yytext[0] == ' ' || yytext[0] == '\t') { \
- SCNG(yy_text)++; \
- yyleng--; \
- } else { \
- break; \
- } \
- }
-
-/* Eat trailing whitespace + extra char */
-#define EAT_TRAILING_WHITESPACE_EX(ch) \
- while (yyleng > 0 && ( \
- (ch != 'X' && yytext[yyleng - 1] == ch) || \
- yytext[yyleng - 1] == '\n' || \
- yytext[yyleng - 1] == '\r' || \
- yytext[yyleng - 1] == '\t' || \
- yytext[yyleng - 1] == ' ') \
- ) { \
- yyleng--; \
- }
-
-/* Eat trailing whitespace */
-#define EAT_TRAILING_WHITESPACE() EAT_TRAILING_WHITESPACE_EX('X')
-
-#define zend_ini_copy_value(retval, str, len) { \
- Z_STRVAL_P(retval) = zend_strndup(str, len); \
- Z_STRLEN_P(retval) = len; \
- Z_TYPE_P(retval) = IS_STRING; \
-}
-
-#define RETURN_TOKEN(type, str, len) { \
- zend_ini_copy_value(ini_lval, str, len); \
- return type; \
-}
-
-static void _yy_push_state(int new_state TSRMLS_DC)
-{
- zend_stack_push(&SCNG(state_stack), (void *) &YYGETCONDITION(), sizeof(int));
- YYSETCONDITION(new_state);
-}
-
-#define yy_push_state(state_and_tsrm) _yy_push_state(yyc##state_and_tsrm)
-
-static void yy_pop_state(TSRMLS_D)
-{
- int *stack_state;
- zend_stack_top(&SCNG(state_stack), (void **) &stack_state);
- YYSETCONDITION(*stack_state);
- zend_stack_del_top(&SCNG(state_stack));
-}
-
-static void yy_scan_buffer(char *str, unsigned int len TSRMLS_DC)
-{
- YYCURSOR = (YYCTYPE*)str;
- SCNG(yy_start) = YYCURSOR;
- YYLIMIT = YYCURSOR + len;
-}
-
-#define ini_filename SCNG(filename)
-
-/* {{{ init_ini_scanner()
-*/
-static int init_ini_scanner(int scanner_mode, zend_file_handle *fh TSRMLS_DC)
-{
- /* Sanity check */
- if (scanner_mode != ZEND_INI_SCANNER_NORMAL && scanner_mode != ZEND_INI_SCANNER_RAW) {
- zend_error(E_WARNING, "Invalid scanner mode");
- return FAILURE;
- }
-
- SCNG(lineno) = 1;
- SCNG(scanner_mode) = scanner_mode;
- SCNG(yy_in) = fh;
-
- if (fh != NULL) {
- ini_filename = zend_strndup(fh->filename, strlen(fh->filename));
- } else {
- ini_filename = NULL;
- }
-
- zend_stack_init(&SCNG(state_stack));
- BEGIN(INITIAL);
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ shutdown_ini_scanner()
-*/
-void shutdown_ini_scanner(TSRMLS_D)
-{
- zend_stack_destroy(&SCNG(state_stack));
- if (ini_filename) {
- free(ini_filename);
- }
-}
-/* }}} */
-
-/* {{{ zend_ini_scanner_get_lineno()
-*/
-int zend_ini_scanner_get_lineno(TSRMLS_D)
-{
- return SCNG(lineno);
-}
-/* }}} */
-
-/* {{{ zend_ini_scanner_get_filename()
-*/
-char *zend_ini_scanner_get_filename(TSRMLS_D)
-{
- return ini_filename ? ini_filename : "Unknown";
-}
-/* }}} */
-
-/* {{{ zend_ini_open_file_for_scanning()
-*/
-int zend_ini_open_file_for_scanning(zend_file_handle *fh, int scanner_mode TSRMLS_DC)
-{
- char *buf;
- size_t size;
-
- if (zend_stream_fixup(fh, &buf, &size TSRMLS_CC) == FAILURE) {
- return FAILURE;
- }
-
- if (init_ini_scanner(scanner_mode, fh TSRMLS_CC) == FAILURE) {
- zend_file_handle_dtor(fh TSRMLS_CC);
- return FAILURE;
- }
-
- yy_scan_buffer(buf, size TSRMLS_CC);
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ zend_ini_prepare_string_for_scanning()
-*/
-int zend_ini_prepare_string_for_scanning(char *str, int scanner_mode TSRMLS_DC)
-{
- int len = strlen(str);
-
- if (init_ini_scanner(scanner_mode, NULL TSRMLS_CC) == FAILURE) {
- return FAILURE;
- }
-
- yy_scan_buffer(str, len TSRMLS_CC);
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ zend_ini_escape_string()
- */
-static void zend_ini_escape_string(zval *lval, char *str, int len, char quote_type TSRMLS_DC)
-{
- register char *s, *t;
- char *end;
-
- zend_ini_copy_value(lval, str, len);
-
- /* convert escape sequences */
- s = t = Z_STRVAL_P(lval);
- end = s + Z_STRLEN_P(lval);
-
- while (s < end) {
- if (*s == '\\') {
- s++;
- if (s >= end) {
- *t++ = '\\';
- continue;
- }
- switch (*s) {
- case '"':
- if (*s != quote_type) {
- *t++ = '\\';
- *t++ = *s;
- break;
- }
- case '\\':
- case '$':
- *t++ = *s;
- Z_STRLEN_P(lval)--;
- break;
- default:
- *t++ = '\\';
- *t++ = *s;
- break;
- }
- } else {
- *t++ = *s;
- }
- if (*s == '\n' || (*s == '\r' && (*(s+1) != '\n'))) {
- SCNG(lineno)++;
- }
- s++;
- }
- *t = 0;
-}
-/* }}} */
-
-int ini_lex(zval *ini_lval TSRMLS_DC)
-{
-restart:
- SCNG(yy_text) = YYCURSOR;
-
-/* yymore_restart: */
- /* detect EOF */
- if (YYCURSOR >= YYLIMIT) {
- if (YYSTATE == STATE(ST_VALUE) || YYSTATE == STATE(ST_RAW)) {
- BEGIN(INITIAL);
- return END_OF_LINE;
- }
- return 0;
- }
-
- /* Eat any UTF-8 BOM we find in the first 3 bytes */
- if (YYCURSOR == SCNG(yy_start) && YYCURSOR + 3 < YYLIMIT) {
- if (memcmp(YYCURSOR, "\xef\xbb\xbf", 3) == 0) {
- YYCURSOR += 3;
- goto restart;
- }
- }
-
-#line 337 "Zend/zend_ini_scanner.c"
-{
- YYCTYPE yych;
- unsigned int yyaccept = 0;
- if (YYGETCONDITION() < 4) {
- if (YYGETCONDITION() < 2) {
- if (YYGETCONDITION() < 1) {
- goto yyc_INITIAL;
- } else {
- goto yyc_ST_OFFSET;
- }
- } else {
- if (YYGETCONDITION() < 3) {
- goto yyc_ST_SECTION_VALUE;
- } else {
- goto yyc_ST_VALUE;
- }
- }
- } else {
- if (YYGETCONDITION() < 6) {
- if (YYGETCONDITION() < 5) {
- goto yyc_ST_SECTION_RAW;
- } else {
- goto yyc_ST_DOUBLE_QUOTES;
- }
- } else {
- if (YYGETCONDITION() < 7) {
- goto yyc_ST_VARNAME;
- } else {
- goto yyc_ST_RAW;
- }
- }
- }
-/* *********************************** */
-yyc_INITIAL:
- {
- static const unsigned char yybm[] = {
- 144, 144, 144, 144, 144, 144, 144, 144,
- 144, 160, 0, 144, 144, 0, 144, 144,
- 144, 144, 144, 144, 144, 144, 144, 144,
- 144, 144, 144, 144, 144, 144, 144, 144,
- 240, 128, 128, 144, 128, 144, 128, 144,
- 128, 128, 144, 144, 144, 144, 144, 144,
- 144, 144, 144, 144, 144, 144, 144, 144,
- 144, 144, 144, 128, 144, 128, 144, 144,
- 144, 144, 144, 144, 144, 144, 144, 144,
- 144, 144, 144, 144, 144, 144, 144, 144,
- 144, 144, 144, 144, 144, 144, 144, 144,
- 144, 144, 144, 128, 144, 144, 128, 144,
- 144, 144, 144, 144, 144, 144, 144, 144,
- 144, 144, 144, 144, 144, 144, 144, 144,
- 144, 144, 144, 144, 144, 144, 144, 144,
- 144, 144, 144, 128, 128, 128, 128, 144,
- 144, 144, 144, 144, 144, 144, 144, 144,
- 144, 144, 144, 144, 144, 144, 144, 144,
- 144, 144, 144, 144, 144, 144, 144, 144,
- 144, 144, 144, 144, 144, 144, 144, 144,
- 144, 144, 144, 144, 144, 144, 144, 144,
- 144, 144, 144, 144, 144, 144, 144, 144,
- 144, 144, 144, 144, 144, 144, 144, 144,
- 144, 144, 144, 144, 144, 144, 144, 144,
- 144, 144, 144, 144, 144, 144, 144, 144,
- 144, 144, 144, 144, 144, 144, 144, 144,
- 144, 144, 144, 144, 144, 144, 144, 144,
- 144, 144, 144, 144, 144, 144, 144, 144,
- 144, 144, 144, 144, 144, 144, 144, 144,
- 144, 144, 144, 144, 144, 144, 144, 144,
- 144, 144, 144, 144, 144, 144, 144, 144,
- 144, 144, 144, 144, 144, 144, 144, 144,
- };
-
- YYDEBUG(0, *YYCURSOR);
- YYFILL(5);
- yych = *YYCURSOR;
- YYDEBUG(-1, yych);
- switch (yych) {
- case '\t': goto yy4;
- case '\n': goto yy6;
- case '\r': goto yy8;
- case ' ': goto yy9;
- case '!':
- case '"':
- case '$':
- case '&':
- case '(':
- case ')':
- case '^':
- case '{':
- case '|':
- case '}':
- case '~': goto yy10;
- case '#': goto yy12;
- case '%':
- case '\'':
- case '*':
- case '+':
- case ',':
- case '-':
- case '.':
- case '/':
- case ':':
- case '<':
- case '>':
- case '?':
- case '@':
- case ']': goto yy13;
- case ';': goto yy14;
- case '=': goto yy16;
- case 'F':
- case 'f': goto yy18;
- case 'N':
- case 'n': goto yy19;
- case 'O':
- case 'o': goto yy20;
- case 'T':
- case 't': goto yy21;
- case 'Y':
- case 'y': goto yy22;
- case '[': goto yy23;
- default: goto yy2;
- }
-yy2:
- YYDEBUG(2, *YYCURSOR);
- ++YYCURSOR;
- yych = *YYCURSOR;
- goto yy26;
-yy3:
- YYDEBUG(3, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 429 "Zend/zend_ini_scanner.l"
- { /* Get option name */
- /* Eat leading whitespace */
- EAT_LEADING_WHITESPACE();
-
- /* Eat trailing whitespace */
- EAT_TRAILING_WHITESPACE();
-
- RETURN_TOKEN(TC_LABEL, yytext, yyleng);
-}
-#line 476 "Zend/zend_ini_scanner.c"
-yy4:
- YYDEBUG(4, *YYCURSOR);
- yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- goto yy68;
-yy5:
- YYDEBUG(5, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 575 "Zend/zend_ini_scanner.l"
- {
- /* eat whitespace */
- goto restart;
-}
-#line 490 "Zend/zend_ini_scanner.c"
-yy6:
- YYDEBUG(6, *YYCURSOR);
- ++YYCURSOR;
-yy7:
- YYDEBUG(7, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 580 "Zend/zend_ini_scanner.l"
- {
- SCNG(lineno)++;
- return END_OF_LINE;
-}
-#line 502 "Zend/zend_ini_scanner.c"
-yy8:
- YYDEBUG(8, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == '\n') goto yy71;
- goto yy7;
-yy9:
- YYDEBUG(9, *YYCURSOR);
- yyaccept = 1;
- yych = *(YYMARKER = ++YYCURSOR);
- if (yych <= ' ') {
- if (yych <= '\n') {
- if (yych <= 0x08) goto yy26;
- if (yych <= '\t') goto yy67;
- goto yy71;
- } else {
- if (yych == '\r') goto yy72;
- if (yych <= 0x1F) goto yy26;
- goto yy69;
- }
- } else {
- if (yych <= ':') {
- if (yych == '#') goto yy58;
- goto yy26;
- } else {
- if (yych <= ';') goto yy53;
- if (yych == '=') goto yy51;
- goto yy26;
- }
- }
-yy10:
- YYDEBUG(10, *YYCURSOR);
- ++YYCURSOR;
- YYDEBUG(11, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 503 "Zend/zend_ini_scanner.l"
- { /* Disallow these chars outside option values */
- return yytext[0];
-}
-#line 541 "Zend/zend_ini_scanner.c"
-yy12:
- YYDEBUG(12, *YYCURSOR);
- yyaccept = 1;
- yych = *(YYMARKER = ++YYCURSOR);
- goto yy59;
-yy13:
- YYDEBUG(13, *YYCURSOR);
- yych = *++YYCURSOR;
- goto yy26;
-yy14:
- YYDEBUG(14, *YYCURSOR);
- yyaccept = 2;
- yych = *(YYMARKER = ++YYCURSOR);
- goto yy54;
- YYDEBUG(15, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 603 "Zend/zend_ini_scanner.l"
- {
- return 0;
-}
-#line 562 "Zend/zend_ini_scanner.c"
-yy16:
- YYDEBUG(16, *YYCURSOR);
- ++YYCURSOR;
- yych = *YYCURSOR;
- goto yy52;
-yy17:
- YYDEBUG(17, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 439 "Zend/zend_ini_scanner.l"
- { /* Start option value */
- if (SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW) {
- yy_push_state(ST_RAW TSRMLS_CC);
- } else {
- yy_push_state(ST_VALUE TSRMLS_CC);
- }
- return '=';
-}
-#line 580 "Zend/zend_ini_scanner.c"
-yy18:
- YYDEBUG(18, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'A') goto yy48;
- if (yych == 'a') goto yy48;
- goto yy26;
-yy19:
- YYDEBUG(19, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych <= 'U') {
- if (yych == 'O') goto yy44;
- if (yych <= 'T') goto yy26;
- goto yy45;
- } else {
- if (yych <= 'o') {
- if (yych <= 'n') goto yy26;
- goto yy44;
- } else {
- if (yych == 'u') goto yy45;
- goto yy26;
- }
- }
-yy20:
- YYDEBUG(20, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych <= 'N') {
- if (yych == 'F') goto yy38;
- if (yych <= 'M') goto yy26;
- goto yy31;
- } else {
- if (yych <= 'f') {
- if (yych <= 'e') goto yy26;
- goto yy38;
- } else {
- if (yych == 'n') goto yy31;
- goto yy26;
- }
- }
-yy21:
- YYDEBUG(21, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'R') goto yy36;
- if (yych == 'r') goto yy36;
- goto yy26;
-yy22:
- YYDEBUG(22, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'E') goto yy27;
- if (yych == 'e') goto yy27;
- goto yy26;
-yy23:
- YYDEBUG(23, *YYCURSOR);
- ++YYCURSOR;
- YYDEBUG(24, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 358 "Zend/zend_ini_scanner.l"
- { /* Section start */
- /* Enter section data lookup state */
- if (SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW) {
- yy_push_state(ST_SECTION_RAW TSRMLS_CC);
- } else {
- yy_push_state(ST_SECTION_VALUE TSRMLS_CC);
- }
- return TC_SECTION;
-}
-#line 646 "Zend/zend_ini_scanner.c"
-yy25:
- YYDEBUG(25, *YYCURSOR);
- ++YYCURSOR;
- YYFILL(1);
- yych = *YYCURSOR;
-yy26:
- YYDEBUG(26, *YYCURSOR);
- if (yybm[0+yych] & 16) {
- goto yy25;
- }
- if (yych == '[') goto yy28;
- goto yy3;
-yy27:
- YYDEBUG(27, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'S') goto yy31;
- if (yych == 's') goto yy31;
- goto yy26;
-yy28:
- YYDEBUG(28, *YYCURSOR);
- ++YYCURSOR;
- YYFILL(1);
- yych = *YYCURSOR;
- YYDEBUG(29, *YYCURSOR);
- if (yybm[0+yych] & 32) {
- goto yy28;
- }
- YYDEBUG(30, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 383 "Zend/zend_ini_scanner.l"
- { /* Start of option with offset */
- /* Eat leading whitespace */
- EAT_LEADING_WHITESPACE();
-
- /* Eat trailing whitespace and [ */
- EAT_TRAILING_WHITESPACE_EX('[');
-
- /* Enter offset lookup state */
- yy_push_state(ST_OFFSET TSRMLS_CC);
-
- RETURN_TOKEN(TC_OFFSET, yytext, yyleng);
-}
-#line 689 "Zend/zend_ini_scanner.c"
-yy31:
- YYDEBUG(31, *YYCURSOR);
- ++YYCURSOR;
- YYFILL(1);
- yych = *YYCURSOR;
- YYDEBUG(32, *YYCURSOR);
- if (yybm[0+yych] & 64) {
- goto yy31;
- }
- if (yych <= '\'') {
- if (yych <= ' ') {
- if (yych <= '\n') {
- if (yych <= 0x08) goto yy25;
- if (yych <= '\t') goto yy34;
- } else {
- if (yych != '\r') goto yy25;
- }
- } else {
- if (yych <= '$') {
- if (yych == '#') goto yy25;
- } else {
- if (yych != '&') goto yy25;
- }
- }
- } else {
- if (yych <= 'Z') {
- if (yych <= ';') {
- if (yych <= ')') goto yy33;
- if (yych <= ':') goto yy25;
- } else {
- if (yych != '=') goto yy25;
- }
- } else {
- if (yych <= '^') {
- if (yych <= '[') goto yy28;
- if (yych <= ']') goto yy25;
- } else {
- if (yych <= 'z') goto yy25;
- if (yych >= 0x7F) goto yy25;
- }
- }
- }
-yy33:
- YYDEBUG(33, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 421 "Zend/zend_ini_scanner.l"
- { /* TRUE value (when used outside option value/offset this causes parse error!) */
- RETURN_TOKEN(BOOL_TRUE, "1", 1);
-}
-#line 739 "Zend/zend_ini_scanner.c"
-yy34:
- YYDEBUG(34, *YYCURSOR);
- ++YYCURSOR;
- YYFILL(1);
- yych = *YYCURSOR;
- YYDEBUG(35, *YYCURSOR);
- if (yych == '\t') goto yy34;
- if (yych == ' ') goto yy34;
- goto yy33;
-yy36:
- YYDEBUG(36, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'U') goto yy37;
- if (yych != 'u') goto yy26;
-yy37:
- YYDEBUG(37, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'E') goto yy31;
- if (yych == 'e') goto yy31;
- goto yy26;
-yy38:
- YYDEBUG(38, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'F') goto yy39;
- if (yych != 'f') goto yy26;
-yy39:
- YYDEBUG(39, *YYCURSOR);
- ++YYCURSOR;
- YYFILL(1);
- yych = *YYCURSOR;
- YYDEBUG(40, *YYCURSOR);
- if (yych <= '&') {
- if (yych <= 0x1F) {
- if (yych <= '\n') {
- if (yych <= 0x08) goto yy25;
- if (yych <= '\t') goto yy42;
- } else {
- if (yych != '\r') goto yy25;
- }
- } else {
- if (yych <= '#') {
- if (yych <= ' ') goto yy39;
- if (yych >= '#') goto yy25;
- } else {
- if (yych == '%') goto yy25;
- }
- }
- } else {
- if (yych <= '=') {
- if (yych <= ':') {
- if (yych <= '\'') goto yy25;
- if (yych >= '*') goto yy25;
- } else {
- if (yych == '<') goto yy25;
- }
- } else {
- if (yych <= ']') {
- if (yych == '[') goto yy28;
- goto yy25;
- } else {
- if (yych <= '^') goto yy41;
- if (yych <= 'z') goto yy25;
- if (yych >= 0x7F) goto yy25;
- }
- }
- }
-yy41:
- YYDEBUG(41, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 425 "Zend/zend_ini_scanner.l"
- { /* FALSE value (when used outside option value/offset this causes parse error!)*/
- RETURN_TOKEN(BOOL_FALSE, "", 0);
-}
-#line 813 "Zend/zend_ini_scanner.c"
-yy42:
- YYDEBUG(42, *YYCURSOR);
- ++YYCURSOR;
- YYFILL(1);
- yych = *YYCURSOR;
- YYDEBUG(43, *YYCURSOR);
- if (yych == '\t') goto yy42;
- if (yych == ' ') goto yy42;
- goto yy41;
-yy44:
- YYDEBUG(44, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych <= '\'') {
- if (yych <= 0x1F) {
- if (yych <= '\n') {
- if (yych <= 0x08) goto yy26;
- if (yych <= '\t') goto yy42;
- goto yy41;
- } else {
- if (yych == '\r') goto yy41;
- goto yy26;
- }
- } else {
- if (yych <= '#') {
- if (yych <= ' ') goto yy39;
- if (yych <= '"') goto yy41;
- goto yy26;
- } else {
- if (yych == '%') goto yy26;
- if (yych <= '&') goto yy41;
- goto yy26;
- }
- }
- } else {
- if (yych <= 'N') {
- if (yych <= ';') {
- if (yych <= ')') goto yy41;
- if (yych <= ':') goto yy26;
- goto yy41;
- } else {
- if (yych == '=') goto yy41;
- if (yych <= 'M') goto yy26;
- goto yy47;
- }
- } else {
- if (yych <= 'm') {
- if (yych == '^') goto yy41;
- goto yy26;
- } else {
- if (yych <= 'n') goto yy47;
- if (yych <= 'z') goto yy26;
- if (yych <= '~') goto yy41;
- goto yy26;
- }
- }
- }
-yy45:
- YYDEBUG(45, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'L') goto yy46;
- if (yych != 'l') goto yy26;
-yy46:
- YYDEBUG(46, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'L') goto yy39;
- if (yych == 'l') goto yy39;
- goto yy26;
-yy47:
- YYDEBUG(47, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'E') goto yy39;
- if (yych == 'e') goto yy39;
- goto yy26;
-yy48:
- YYDEBUG(48, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'L') goto yy49;
- if (yych != 'l') goto yy26;
-yy49:
- YYDEBUG(49, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'S') goto yy50;
- if (yych != 's') goto yy26;
-yy50:
- YYDEBUG(50, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == 'E') goto yy39;
- if (yych == 'e') goto yy39;
- goto yy26;
-yy51:
- YYDEBUG(51, *YYCURSOR);
- ++YYCURSOR;
- YYFILL(1);
- yych = *YYCURSOR;
-yy52:
- YYDEBUG(52, *YYCURSOR);
- if (yych == '\t') goto yy51;
- if (yych == ' ') goto yy51;
- goto yy17;
-yy53:
- YYDEBUG(53, *YYCURSOR);
- ++YYCURSOR;
- YYFILL(2);
- yych = *YYCURSOR;
-yy54:
- YYDEBUG(54, *YYCURSOR);
- if (yybm[0+yych] & 128) {
- goto yy53;
- }
- if (yych >= '\r') goto yy57;
-yy55:
- YYDEBUG(55, *YYCURSOR);
- ++YYCURSOR;
-yy56:
- YYDEBUG(56, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 585 "Zend/zend_ini_scanner.l"
- { /* Comment */
- BEGIN(INITIAL);
- SCNG(lineno)++;
- return END_OF_LINE;
-}
-#line 936 "Zend/zend_ini_scanner.c"
-yy57:
- YYDEBUG(57, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == '\n') goto yy55;
- goto yy56;
-yy58:
- YYDEBUG(58, *YYCURSOR);
- yyaccept = 1;
- YYMARKER = ++YYCURSOR;
- YYFILL(2);
- yych = *YYCURSOR;
-yy59:
- YYDEBUG(59, *YYCURSOR);
- if (yych <= '\'') {
- if (yych <= ' ') {
- if (yych <= '\n') {
- if (yych <= 0x08) goto yy58;
- if (yych >= '\n') goto yy64;
- } else {
- if (yych == '\r') goto yy66;
- goto yy58;
- }
- } else {
- if (yych <= '$') {
- if (yych == '#') goto yy58;
- } else {
- if (yych != '&') goto yy58;
- }
- }
- } else {
- if (yych <= 'Z') {
- if (yych <= ';') {
- if (yych <= ')') goto yy60;
- if (yych <= ':') goto yy58;
- } else {
- if (yych != '=') goto yy58;
- }
- } else {
- if (yych <= '^') {
- if (yych <= '[') goto yy62;
- if (yych <= ']') goto yy58;
- } else {
- if (yych <= 'z') goto yy58;
- if (yych >= 0x7F) goto yy58;
- }
- }
- }
-yy60:
- YYDEBUG(60, *YYCURSOR);
- ++YYCURSOR;
- YYFILL(2);
- yych = *YYCURSOR;
- YYDEBUG(61, *YYCURSOR);
- if (yych == '\n') goto yy64;
- if (yych == '\r') goto yy66;
- goto yy60;
-yy62:
- YYDEBUG(62, *YYCURSOR);
- yyaccept = 3;
- YYMARKER = ++YYCURSOR;
- YYFILL(2);
- yych = *YYCURSOR;
- YYDEBUG(63, *YYCURSOR);
- if (yych <= '\f') {
- if (yych <= 0x08) goto yy60;
- if (yych <= '\t') goto yy62;
- if (yych >= '\v') goto yy60;
- } else {
- if (yych <= '\r') goto yy66;
- if (yych == ' ') goto yy62;
- goto yy60;
- }
-yy64:
- YYDEBUG(64, *YYCURSOR);
- ++YYCURSOR;
-yy65:
- YYDEBUG(65, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 591 "Zend/zend_ini_scanner.l"
- { /* #Comment */
- zend_error(E_DEPRECATED, "Comments starting with '#' are deprecated in %s on line %d", zend_ini_scanner_get_filename(TSRMLS_C), SCNG(lineno));
- BEGIN(INITIAL);
- SCNG(lineno)++;
- return END_OF_LINE;
-}
-#line 1022 "Zend/zend_ini_scanner.c"
-yy66:
- YYDEBUG(66, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == '\n') goto yy64;
- goto yy65;
-yy67:
- YYDEBUG(67, *YYCURSOR);
- yyaccept = 0;
- YYMARKER = ++YYCURSOR;
- YYFILL(2);
- yych = *YYCURSOR;
-yy68:
- YYDEBUG(68, *YYCURSOR);
- if (yych <= ' ') {
- if (yych <= '\n') {
- if (yych <= 0x08) goto yy5;
- if (yych <= '\t') goto yy67;
- goto yy71;
- } else {
- if (yych == '\r') goto yy72;
- if (yych <= 0x1F) goto yy5;
- goto yy67;
- }
- } else {
- if (yych <= ':') {
- if (yych == '#') goto yy60;
- goto yy5;
- } else {
- if (yych <= ';') goto yy53;
- if (yych == '=') goto yy51;
- goto yy5;
- }
- }
-yy69:
- YYDEBUG(69, *YYCURSOR);
- yyaccept = 1;
- YYMARKER = ++YYCURSOR;
- YYFILL(2);
- yych = *YYCURSOR;
- YYDEBUG(70, *YYCURSOR);
- if (yych <= '&') {
- if (yych <= 0x1F) {
- if (yych <= '\n') {
- if (yych <= 0x08) goto yy25;
- if (yych <= '\t') goto yy67;
- } else {
- if (yych == '\r') goto yy72;
- goto yy25;
- }
- } else {
- if (yych <= '#') {
- if (yych <= ' ') goto yy69;
- if (yych <= '"') goto yy3;
- goto yy58;
- } else {
- if (yych == '%') goto yy25;
- goto yy3;
- }
- }
- } else {
- if (yych <= '=') {
- if (yych <= ':') {
- if (yych <= '\'') goto yy25;
- if (yych <= ')') goto yy3;
- goto yy25;
- } else {
- if (yych <= ';') goto yy53;
- if (yych <= '<') goto yy25;
- goto yy51;
- }
- } else {
- if (yych <= ']') {
- if (yych == '[') goto yy28;
- goto yy25;
- } else {
- if (yych <= '^') goto yy3;
- if (yych <= 'z') goto yy25;
- if (yych <= '~') goto yy3;
- goto yy25;
- }
- }
- }
-yy71:
- YYDEBUG(71, *YYCURSOR);
- yych = *++YYCURSOR;
- goto yy7;
-yy72:
- YYDEBUG(72, *YYCURSOR);
- ++YYCURSOR;
- if ((yych = *YYCURSOR) == '\n') goto yy71;
- goto yy7;
- }
-/* *********************************** */
-yyc_ST_DOUBLE_QUOTES:
- {
- static const unsigned char yybm[] = {
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 128, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 128, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- };
- YYDEBUG(73, *YYCURSOR);
- YYFILL(2);
- yych = *YYCURSOR;
- if (yych == '"') goto yy77;
- if (yych == '$') goto yy79;
- YYDEBUG(75, *YYCURSOR);
- ++YYCURSOR;
-yy76:
- YYDEBUG(76, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 535 "Zend/zend_ini_scanner.l"
- { /* Escape double quoted string contents */
- if (YYCURSOR > YYLIMIT) {
- return 0;
- }
-
- while (YYCURSOR < YYLIMIT) {
- switch (*YYCURSOR++) {
- case '"':
- if (YYCURSOR < YYLIMIT && YYCURSOR[-2] == '\\' && *YYCURSOR != '\r' && *YYCURSOR != '\n') {
- continue;
- }
- break;
- case '$':
- if (*YYCURSOR == '{') {
- break;
- }
- continue;
- case '\\':
- if (YYCURSOR < YYLIMIT && *YYCURSOR != '"') {
- YYCURSOR++;
- }
- /* fall through */
- default:
- continue;
- }
-
- YYCURSOR--;
- break;
- }
-
- yyleng = YYCURSOR - SCNG(yy_text);
-
- zend_ini_escape_string(ini_lval, yytext, yyleng, '"' TSRMLS_CC);
- return TC_QUOTED_STRING;
-}
-#line 1198 "Zend/zend_ini_scanner.c"
-yy77:
- YYDEBUG(77, *YYCURSOR);
- ++YYCURSOR;
- yych = *YYCURSOR;
- goto yy83;
-yy78:
- YYDEBUG(78, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 530 "Zend/zend_ini_scanner.l"
- { /* Double quoted '"' string ends */
- yy_pop_state(TSRMLS_C);
- return '"';
-}
-#line 1212 "Zend/zend_ini_scanner.c"
-yy79:
- YYDEBUG(79, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych != '{') goto yy76;
- YYDEBUG(80, *YYCURSOR);
- ++YYCURSOR;
- YYDEBUG(81, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 401 "Zend/zend_ini_scanner.l"
- { /* Variable start */
- yy_push_state(ST_VARNAME TSRMLS_CC);
- return TC_DOLLAR_CURLY;
-}
-#line 1226 "Zend/zend_ini_scanner.c"
-yy82:
- YYDEBUG(82, *YYCURSOR);
- ++YYCURSOR;
- YYFILL(1);
- yych = *YYCURSOR;
-yy83:
- YYDEBUG(83, *YYCURSOR);
- if (yybm[0+yych] & 128) {
- goto yy82;
- }
- goto yy78;
- }
-/* *********************************** */
-yyc_ST_OFFSET:
- {
- static const unsigned char yybm[] = {
- 66, 66, 66, 66, 66, 66, 66, 66,
- 66, 194, 64, 66, 66, 64, 66, 66,
- 66, 66, 66, 66, 66, 66, 66, 66,
- 66, 66, 66, 66, 66, 66, 66, 66,
- 194, 66, 64, 66, 68, 66, 66, 0,
- 66, 66, 66, 66, 66, 66, 66, 66,
- 114, 114, 114, 114, 114, 114, 114, 114,
- 114, 114, 66, 64, 66, 66, 66, 66,
- 66, 82, 82, 82, 82, 82, 82, 82,
- 82, 82, 82, 82, 82, 82, 82, 82,
- 82, 82, 82, 82, 82, 82, 82, 82,
- 82, 82, 82, 66, 72, 64, 66, 82,
- 66, 82, 82, 82, 82, 82, 82, 82,
- 82, 82, 82, 82, 82, 82, 82, 82,
- 82, 82, 82, 82, 82, 82, 82, 82,
- 82, 82, 82, 66, 66, 66, 66, 66,
- 66, 66, 66, 66, 66, 66, 66, 66,
- 66, 66, 66, 66, 66, 66, 66, 66,
- 66, 66, 66, 66, 66, 66, 66, 66,
- 66, 66, 66, 66, 66, 66, 66, 66,
- 66, 66, 66, 66, 66, 66, 66, 66,
- 66, 66, 66, 66, 66, 66, 66, 66,
- 66, 66, 66, 66, 66, 66, 66, 66,
- 66, 66, 66, 66, 66, 66, 66, 66,
- 66, 66, 66, 66, 66, 66, 66, 66,
- 66, 66, 66, 66, 66, 66, 66, 66,
- 66, 66, 66, 66, 66, 66, 66, 66,
- 66, 66, 66, 66, 66, 66, 66, 66,
- 66, 66, 66, 66, 66, 66, 66, 66,
- 66, 66, 66, 66, 66, 66, 66, 66,
- 66, 66, 66, 66, 66, 66, 66, 66,
- 66, 66, 66, 66, 66, 66, 66, 66,
- };
- YYDEBUG(84, *YYCURSOR);
- YYFILL(2);
- yych = *YYCURSOR;
- if (yych <= '-') {
- if (yych <= ' ') {
- if (yych <= '\n') {
- if (yych <= 0x08) goto yy86;
- if (yych <= '\t') goto yy88;
- goto yy89;
- } else {
- if (yych == '\r') goto yy89;
- if (yych >= ' ') goto yy88;
- }
- } else {
- if (yych <= '$') {
- if (yych == '"') goto yy91;
- if (yych >= '$') goto yy93;
- } else {
- if (yych == '\'') goto yy94;
- if (yych >= '-') goto yy95;
- }
- }
- } else {
- if (yych <= 'Z') {
- if (yych <= '9') {
- if (yych <= '.') goto yy96;
- if (yych >= '0') goto yy97;
- } else {
- if (yych == ';') goto yy89;
- if (yych >= 'A') goto yy99;
- }
- } else {
- if (yych <= '^') {
- if (yych <= '[') goto yy86;
- if (yych <= '\\') goto yy101;
- if (yych <= ']') goto yy102;
- } else {
- if (yych == '`') goto yy86;
- if (yych <= 'z') goto yy99;
- }
- }
- }
-yy86:
- YYDEBUG(86, *YYCURSOR);
- yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- goto yy105;
-yy87:
- YYDEBUG(87, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 521 "Zend/zend_ini_scanner.l"
- { /* Get rest as section/offset value */
- RETURN_TOKEN(TC_STRING, yytext, yyleng);
-}
-#line 1330 "Zend/zend_ini_scanner.c"
-yy88:
- YYDEBUG(88, *YYCURSOR);
- yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- if (yybm[0+yych] & 128) {
- goto yy131;
- }
- if (yych == '"') goto yy133;
- if (yych == ']') goto yy134;
- goto yy105;
-yy89:
- YYDEBUG(89, *YYCURSOR);
- ++YYCURSOR;
-yy90:
- YYDEBUG(90, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 603 "Zend/zend_ini_scanner.l"
- {
- return 0;
-}
-#line 1351 "Zend/zend_ini_scanner.c"
-yy91:
- YYDEBUG(91, *YYCURSOR);
- ++YYCURSOR;
-yy92:
- YYDEBUG(92, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 525 "Zend/zend_ini_scanner.l"
- { /* Double quoted '"' string start */
- yy_push_state(ST_DOUBLE_QUOTES TSRMLS_CC);
- return '"';
-}
-#line 1363 "Zend/zend_ini_scanner.c"
-yy93:
- YYDEBUG(93, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych <= '\\') {
- if (yych <= 0x00) goto yy90;
- if (yych <= '[') goto yy104;
- goto yy109;
- } else {
- if (yych == '{') goto yy129;
- goto yy104;
- }
-yy94:
- YYDEBUG(94, *YYCURSOR);
- yyaccept = 1;
- yych = *(YYMARKER = ++YYCURSOR);
- if (yybm[0+yych] & 64) {
- goto yy125;
- }
- goto yy90;
-yy95:
- YYDEBUG(95, *YYCURSOR);
- yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- if (yych <= '/') goto yy105;
- if (yych <= '9') goto yy123;
- goto yy105;
-yy96:
- YYDEBUG(96, *YYCURSOR);
- yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- if (yych <= '/') goto yy105;
- if (yych <= '9') goto yy121;
- goto yy105;
-yy97:
- YYDEBUG(97, *YYCURSOR);
- yyaccept = 2;
- yych = *(YYMARKER = ++YYCURSOR);
- if (yych <= '\'') {
- if (yych <= '\r') {
- if (yych == '\n') goto yy98;
- if (yych <= '\f') goto yy105;
- } else {
- if (yych == '"') goto yy98;
- if (yych <= '&') goto yy105;
- }
- } else {
- if (yych <= '9') {
- if (yych == '.') goto yy117;
- if (yych <= '/') goto yy105;
- goto yy119;
- } else {
- if (yych <= ';') {
- if (yych <= ':') goto yy105;
- } else {
- if (yych != ']') goto yy105;
- }
- }
- }
-yy98:
- YYDEBUG(98, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 499 "Zend/zend_ini_scanner.l"
- { /* Get number option value as string */
- RETURN_TOKEN(TC_NUMBER, yytext, yyleng);
-}
-#line 1429 "Zend/zend_ini_scanner.c"
-yy99:
- YYDEBUG(99, *YYCURSOR);
- yyaccept = 3;
- yych = *(YYMARKER = ++YYCURSOR);
- if (yybm[0+yych] & 16) {
- goto yy115;
- }
- if (yych <= '"') {
- if (yych <= '\f') {
- if (yych != '\n') goto yy105;
- } else {
- if (yych <= '\r') goto yy100;
- if (yych <= '!') goto yy105;
- }
- } else {
- if (yych <= ':') {
- if (yych != '\'') goto yy105;
- } else {
- if (yych <= ';') goto yy100;
- if (yych != ']') goto yy105;
- }
- }
-yy100:
- YYDEBUG(100, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 495 "Zend/zend_ini_scanner.l"
- { /* Get constant option value */
- RETURN_TOKEN(TC_CONSTANT, yytext, yyleng);
-}
-#line 1459 "Zend/zend_ini_scanner.c"
-yy101:
- YYDEBUG(101, *YYCURSOR);
- yych = *++YYCURSOR;
- goto yy104;
-yy102:
- YYDEBUG(102, *YYCURSOR);
- ++YYCURSOR;
-yy103:
- YYDEBUG(103, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 396 "Zend/zend_ini_scanner.l"
- { /* End of section or an option offset */
- BEGIN(INITIAL);
- return ']';
-}
-#line 1475 "Zend/zend_ini_scanner.c"
-yy104:
- YYDEBUG(104, *YYCURSOR);
- yyaccept = 0;
- YYMARKER = ++YYCURSOR;
- YYFILL(1);
- yych = *YYCURSOR;
-yy105:
- YYDEBUG(105, *YYCURSOR);
- if (yybm[0+yych] & 2) {
- goto yy104;
- }
- if (yych == '$') goto yy107;
- if (yych != '\\') goto yy87;
-yy106:
- YYDEBUG(106, *YYCURSOR);
- ++YYCURSOR;
- YYFILL(1);
- yych = *YYCURSOR;
- goto yy104;
-yy107:
- YYDEBUG(107, *YYCURSOR);
- ++YYCURSOR;
- YYFILL(1);
- yych = *YYCURSOR;
- if (yych <= '\\') {
- if (yych <= 0x00) goto yy108;
- if (yych <= '[') goto yy104;
- goto yy109;
- } else {
- if (yych != '{') goto yy104;
- }
-yy108:
- YYDEBUG(108, *YYCURSOR);
- YYCURSOR = YYMARKER;
- if (yyaccept <= 1) {
- if (yyaccept <= 0) {
- goto yy87;
- } else {
- goto yy90;
- }
- } else {
- if (yyaccept <= 2) {
- goto yy98;
- } else {
- goto yy100;
- }
- }
-yy109:
- YYDEBUG(109, *YYCURSOR);
- ++YYCURSOR;
- YYFILL(1);
- yych = *YYCURSOR;
- if (yybm[0+yych] & 4) {
- goto yy110;
- }
- if (yych == '\\') goto yy112;
- goto yy104;
-yy110:
- YYDEBUG(110, *YYCURSOR);
- ++YYCURSOR;
- YYFILL(1);
- yych = *YYCURSOR;
- YYDEBUG(111, *YYCURSOR);
- if (yybm[0+yych] & 4) {
- goto yy110;
- }
- if (yych == '\\') goto yy114;
- goto yy104;
-yy112:
- YYDEBUG(112, *YYCURSOR);
- ++YYCURSOR;
- YYFILL(1);
- yych = *YYCURSOR;
- YYDEBUG(113, *YYCURSOR);
- if (yybm[0+yych] & 4) {
- goto yy110;
- }
- if (yych == '\\') goto yy112;
- goto yy104;
-yy114:
- YYDEBUG(114, *YYCURSOR);
- ++YYCURSOR;
- YYFILL(1);
- yych = *YYCURSOR;
- if (yybm[0+yych] & 4) {
- goto yy110;
- }
- if (yych == '\\') goto yy112;
- goto yy104;
-yy115:
- YYDEBUG(115, *YYCURSOR);
- yyaccept = 3;
- YYMARKER = ++YYCURSOR;
- YYFILL(1);
- yych = *YYCURSOR;
- YYDEBUG(116, *YYCURSOR);
- if (yybm[0+yych] & 16) {
- goto yy115;
- }
- if (yych <= '$') {
- if (yych <= '\r') {
- if (yych == '\n') goto yy100;
- if (yych <= '\f') goto yy104;
- goto yy100;
- } else {
- if (yych == '"') goto yy100;
- if (yych <= '#') goto yy104;
- goto yy107;
- }
- } else {
- if (yych <= ';') {
- if (yych == '\'') goto yy100;
- if (yych <= ':') goto yy104;
- goto yy100;
- } else {
- if (yych <= '[') goto yy104;
- if (yych <= '\\') goto yy106;
- if (yych <= ']') goto yy100;
- goto yy104;
- }
- }
-yy117:
- YYDEBUG(117, *YYCURSOR);
- yyaccept = 2;
- YYMARKER = ++YYCURSOR;
- YYFILL(1);
- yych = *YYCURSOR;
- YYDEBUG(118, *YYCURSOR);
- if (yybm[0+yych] & 32) {
- goto yy117;
- }
- if (yych <= '$') {
- if (yych <= '\r') {
- if (yych == '\n') goto yy98;
- if (yych <= '\f') goto yy104;
- goto yy98;
- } else {
- if (yych == '"') goto yy98;
- if (yych <= '#') goto yy104;
- goto yy107;
- }
- } else {
- if (yych <= ';') {
- if (yych == '\'') goto yy98;
- if (yych <= ':') goto yy104;
- goto yy98;
- } else {
- if (yych <= '[') goto yy104;
- if (yych <= '\\') goto yy106;
- if (yych <= ']') goto yy98;
- goto yy104;
- }
- }
-yy119:
- YYDEBUG(119, *YYCURSOR);
- yyaccept = 2;
- YYMARKER = ++YYCURSOR;
- YYFILL(1);
- yych = *YYCURSOR;
- YYDEBUG(120, *YYCURSOR);
- if (yych <= '\'') {
- if (yych <= '!') {
- if (yych <= '\n') {
- if (yych <= '\t') goto yy104;
- goto yy98;
- } else {
- if (yych == '\r') goto yy98;
- goto yy104;
- }
- } else {
- if (yych <= '#') {
- if (yych <= '"') goto yy98;
- goto yy104;
- } else {
- if (yych <= '$') goto yy107;
- if (yych <= '&') goto yy104;
- goto yy98;
- }
- }
- } else {
- if (yych <= ':') {
- if (yych <= '.') {
- if (yych <= '-') goto yy104;
- goto yy117;
- } else {
- if (yych <= '/') goto yy104;
- if (yych <= '9') goto yy119;
- goto yy104;
- }
- } else {
- if (yych <= '[') {
- if (yych <= ';') goto yy98;
- goto yy104;
- } else {
- if (yych <= '\\') goto yy106;
- if (yych <= ']') goto yy98;
- goto yy104;
- }
- }
- }
-yy121:
- YYDEBUG(121, *YYCURSOR);
- yyaccept = 2;
- YYMARKER = ++YYCURSOR;
- YYFILL(1);
- yych = *YYCURSOR;
- YYDEBUG(122, *YYCURSOR);
- if (yych <= '&') {
- if (yych <= '\r') {
- if (yych == '\n') goto yy98;
- if (yych <= '\f') goto yy104;
- goto yy98;
- } else {
- if (yych <= '"') {
- if (yych <= '!') goto yy104;
- goto yy98;
- } else {
- if (yych == '$') goto yy107;
- goto yy104;
- }
- }
- } else {
- if (yych <= ':') {
- if (yych <= '\'') goto yy98;
- if (yych <= '/') goto yy104;
- if (yych <= '9') goto yy121;
- goto yy104;
- } else {
- if (yych <= '[') {
- if (yych <= ';') goto yy98;
- goto yy104;
- } else {
- if (yych <= '\\') goto yy106;
- if (yych <= ']') goto yy98;
- goto yy104;
- }
- }
- }
-yy123:
- YYDEBUG(123, *YYCURSOR);
- yyaccept = 2;
- YYMARKER = ++YYCURSOR;
- YYFILL(1);
- yych = *YYCURSOR;
- YYDEBUG(124, *YYCURSOR);
- if (yych <= '&') {
- if (yych <= '\r') {
- if (yych == '\n') goto yy98;
- if (yych <= '\f') goto yy104;
- goto yy98;
- } else {
- if (yych <= '"') {
- if (yych <= '!') goto yy104;
- goto yy98;
- } else {
- if (yych == '$') goto yy107;
- goto yy104;
- }
- }
- } else {
- if (yych <= ':') {
- if (yych <= '\'') goto yy98;
- if (yych <= '/') goto yy104;
- if (yych <= '9') goto yy123;
- goto yy104;
- } else {
- if (yych <= '[') {
- if (yych <= ';') goto yy98;
- goto yy104;
- } else {
- if (yych <= '\\') goto yy106;
- if (yych <= ']') goto yy98;
- goto yy104;
- }
- }
- }
-yy125:
- YYDEBUG(125, *YYCURSOR);
- ++YYCURSOR;
- YYFILL(1);
- yych = *YYCURSOR;
- YYDEBUG(126, *YYCURSOR);
- if (yybm[0+yych] & 64) {
- goto yy125;
- }
- YYDEBUG(127, *YYCURSOR);
- ++YYCURSOR;
- YYDEBUG(128, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 368 "Zend/zend_ini_scanner.l"
- { /* Raw string */
- /* Eat leading and trailing single quotes */
- if (yytext[0] == '\'' && yytext[yyleng - 1] == '\'') {
- SCNG(yy_text)++;
- yyleng = yyleng - 2;
- }
- RETURN_TOKEN(TC_RAW, yytext, yyleng);
-}
-#line 1774 "Zend/zend_ini_scanner.c"
-yy129:
- YYDEBUG(129, *YYCURSOR);
- ++YYCURSOR;
- YYDEBUG(130, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 401 "Zend/zend_ini_scanner.l"
- { /* Variable start */
- yy_push_state(ST_VARNAME TSRMLS_CC);
- return TC_DOLLAR_CURLY;
-}
-#line 1785 "Zend/zend_ini_scanner.c"
-yy131:
- YYDEBUG(131, *YYCURSOR);
- yyaccept = 0;
- YYMARKER = ++YYCURSOR;
- YYFILL(1);
- yych = *YYCURSOR;
- YYDEBUG(132, *YYCURSOR);
- if (yybm[0+yych] & 128) {
- goto yy131;
- }
- if (yych <= '$') {
- if (yych <= '\r') {
- if (yych == '\n') goto yy87;
- if (yych <= '\f') goto yy104;
- goto yy87;
- } else {
- if (yych == '"') goto yy133;
- if (yych <= '#') goto yy104;
- goto yy107;
- }
- } else {
- if (yych <= ';') {
- if (yych == '\'') goto yy87;
- if (yych <= ':') goto yy104;
- goto yy87;
- } else {
- if (yych <= '[') goto yy104;
- if (yych <= '\\') goto yy106;
- if (yych <= ']') goto yy134;
- goto yy104;
- }
- }
-yy133:
- YYDEBUG(133, *YYCURSOR);
- yych = *++YYCURSOR;
- goto yy92;
-yy134:
- YYDEBUG(134, *YYCURSOR);
- ++YYCURSOR;
- yych = *YYCURSOR;
- goto yy103;
- }
-/* *********************************** */
-yyc_ST_RAW:
- {
- static const unsigned char yybm[] = {
- 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 192, 0, 64, 64, 0, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64,
- 192, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64,
- };
- YYDEBUG(135, *YYCURSOR);
- YYFILL(3);
- yych = *YYCURSOR;
- if (yych <= '\f') {
- if (yych <= 0x08) {
- if (yych >= 0x01) goto yy139;
- } else {
- if (yych <= '\t') goto yy141;
- if (yych <= '\n') goto yy142;
- goto yy139;
- }
- } else {
- if (yych <= ' ') {
- if (yych <= '\r') goto yy144;
- if (yych <= 0x1F) goto yy139;
- goto yy141;
- } else {
- if (yych == ';') goto yy145;
- goto yy139;
- }
- }
- YYDEBUG(137, *YYCURSOR);
- ++YYCURSOR;
- YYDEBUG(138, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 598 "Zend/zend_ini_scanner.l"
- { /* End of option value (if EOF is reached before EOL */
- BEGIN(INITIAL);
- return END_OF_LINE;
-}
-#line 1895 "Zend/zend_ini_scanner.c"
-yy139:
- YYDEBUG(139, *YYCURSOR);
- ++YYCURSOR;
-yy140:
- YYDEBUG(140, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 448 "Zend/zend_ini_scanner.l"
- { /* Raw value, only used when SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW. */
- char *sc = NULL;
- while (YYCURSOR < YYLIMIT) {
- switch (*YYCURSOR) {
- case '\n':
- case '\r':
- goto end_raw_value_chars;
- break;
- case ';':
- if (sc == NULL) {
- sc = YYCURSOR;
- }
- /* no break */
- default:
- YYCURSOR++;
- break;
- }
- }
-end_raw_value_chars:
- yyleng = YYCURSOR - SCNG(yy_text);
-
- /* Eat trailing semicolons */
- while (yytext[yyleng - 1] == ';') {
- yyleng--;
- }
-
- /* Eat leading and trailing double quotes */
- if (yytext[0] == '"' && yytext[yyleng - 1] == '"') {
- SCNG(yy_text)++;
- yyleng = yyleng - 2;
- } else if (sc) {
- YYCURSOR = sc;
- yyleng = YYCURSOR - SCNG(yy_text);
- }
- RETURN_TOKEN(TC_RAW, yytext, yyleng);
-}
-#line 1939 "Zend/zend_ini_scanner.c"
-yy141:
- YYDEBUG(141, *YYCURSOR);
- yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- if (yych <= '\r') {
- if (yych <= 0x08) goto yy140;
- if (yych <= '\n') goto yy153;
- if (yych <= '\f') goto yy140;
- goto yy153;
- } else {
- if (yych <= ' ') {
- if (yych <= 0x1F) goto yy140;
- goto yy153;
- } else {
- if (yych == ';') goto yy153;
- goto yy140;
- }
- }
-yy142:
- YYDEBUG(142, *YYCURSOR);
- ++YYCURSOR;
-yy143:
- YYDEBUG(143, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 489 "Zend/zend_ini_scanner.l"
- { /* End of option value */
- BEGIN(INITIAL);
- SCNG(lineno)++;
- return END_OF_LINE;
-}
-#line 1970 "Zend/zend_ini_scanner.c"
-yy144:
- YYDEBUG(144, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == '\n') goto yy151;
- goto yy143;
-yy145:
- YYDEBUG(145, *YYCURSOR);
- yyaccept = 1;
- yych = *(YYMARKER = ++YYCURSOR);
- goto yy147;
-yy146:
- YYDEBUG(146, *YYCURSOR);
- ++YYCURSOR;
- YYFILL(2);
- yych = *YYCURSOR;
-yy147:
- YYDEBUG(147, *YYCURSOR);
- if (yybm[0+yych] & 64) {
- goto yy146;
- }
- if (yych >= '\r') goto yy150;
-yy148:
- YYDEBUG(148, *YYCURSOR);
- ++YYCURSOR;
-yy149:
- YYDEBUG(149, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 585 "Zend/zend_ini_scanner.l"
- { /* Comment */
- BEGIN(INITIAL);
- SCNG(lineno)++;
- return END_OF_LINE;
-}
-#line 2004 "Zend/zend_ini_scanner.c"
-yy150:
- YYDEBUG(150, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == '\n') goto yy148;
- goto yy149;
-yy151:
- YYDEBUG(151, *YYCURSOR);
- yych = *++YYCURSOR;
- goto yy143;
-yy152:
- YYDEBUG(152, *YYCURSOR);
- yyaccept = 2;
- YYMARKER = ++YYCURSOR;
- YYFILL(2);
- yych = *YYCURSOR;
-yy153:
- YYDEBUG(153, *YYCURSOR);
- if (yybm[0+yych] & 128) {
- goto yy152;
- }
- if (yych <= '\f') {
- if (yych == '\n') goto yy151;
- } else {
- if (yych <= '\r') goto yy155;
- if (yych == ';') goto yy146;
- }
- YYDEBUG(154, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 575 "Zend/zend_ini_scanner.l"
- {
- /* eat whitespace */
- goto restart;
-}
-#line 2038 "Zend/zend_ini_scanner.c"
-yy155:
- YYDEBUG(155, *YYCURSOR);
- ++YYCURSOR;
- if ((yych = *YYCURSOR) == '\n') goto yy151;
- goto yy143;
- }
-/* *********************************** */
-yyc_ST_SECTION_RAW:
- {
- static const unsigned char yybm[] = {
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 192, 0, 128, 128, 0, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 192, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 0, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- };
- YYDEBUG(156, *YYCURSOR);
- YYFILL(3);
- yych = *YYCURSOR;
- if (yych <= '\f') {
- if (yych == '\n') goto yy160;
- } else {
- if (yych <= '\r') goto yy160;
- if (yych == ']') goto yy162;
- }
- YYDEBUG(158, *YYCURSOR);
- ++YYCURSOR;
- yych = *YYCURSOR;
- goto yy169;
-yy159:
- YYDEBUG(159, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 485 "Zend/zend_ini_scanner.l"
- { /* Raw value, only used when SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW. */
- RETURN_TOKEN(TC_RAW, yytext, yyleng);
-}
-#line 2102 "Zend/zend_ini_scanner.c"
-yy160:
- YYDEBUG(160, *YYCURSOR);
- ++YYCURSOR;
- YYDEBUG(161, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 603 "Zend/zend_ini_scanner.l"
- {
- return 0;
-}
-#line 2112 "Zend/zend_ini_scanner.c"
-yy162:
- YYDEBUG(162, *YYCURSOR);
- ++YYCURSOR;
- yych = *YYCURSOR;
- goto yy165;
-yy163:
- YYDEBUG(163, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 377 "Zend/zend_ini_scanner.l"
- { /* End of section */
- BEGIN(INITIAL);
- SCNG(lineno)++;
- return ']';
-}
-#line 2127 "Zend/zend_ini_scanner.c"
-yy164:
- YYDEBUG(164, *YYCURSOR);
- ++YYCURSOR;
- YYFILL(2);
- yych = *YYCURSOR;
-yy165:
- YYDEBUG(165, *YYCURSOR);
- if (yybm[0+yych] & 64) {
- goto yy164;
- }
- if (yych == '\n') goto yy166;
- if (yych == '\r') goto yy167;
- goto yy163;
-yy166:
- YYDEBUG(166, *YYCURSOR);
- yych = *++YYCURSOR;
- goto yy163;
-yy167:
- YYDEBUG(167, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == '\n') goto yy166;
- goto yy163;
-yy168:
- YYDEBUG(168, *YYCURSOR);
- ++YYCURSOR;
- YYFILL(1);
- yych = *YYCURSOR;
-yy169:
- YYDEBUG(169, *YYCURSOR);
- if (yybm[0+yych] & 128) {
- goto yy168;
- }
- goto yy159;
- }
-/* *********************************** */
-yyc_ST_SECTION_VALUE:
- {
- static const unsigned char yybm[] = {
- 132, 132, 132, 132, 132, 132, 132, 132,
- 132, 134, 128, 132, 132, 128, 132, 132,
- 132, 132, 132, 132, 132, 132, 132, 132,
- 132, 132, 132, 132, 132, 132, 132, 132,
- 134, 132, 128, 132, 136, 132, 132, 0,
- 132, 132, 132, 132, 132, 132, 132, 132,
- 228, 228, 228, 228, 228, 228, 228, 228,
- 228, 228, 132, 128, 132, 132, 132, 132,
- 132, 164, 164, 164, 164, 164, 164, 164,
- 164, 164, 164, 164, 164, 164, 164, 164,
- 164, 164, 164, 164, 164, 164, 164, 164,
- 164, 164, 164, 132, 144, 128, 132, 164,
- 132, 164, 164, 164, 164, 164, 164, 164,
- 164, 164, 164, 164, 164, 164, 164, 164,
- 164, 164, 164, 164, 164, 164, 164, 164,
- 164, 164, 164, 132, 132, 132, 132, 132,
- 132, 132, 132, 132, 132, 132, 132, 132,
- 132, 132, 132, 132, 132, 132, 132, 132,
- 132, 132, 132, 132, 132, 132, 132, 132,
- 132, 132, 132, 132, 132, 132, 132, 132,
- 132, 132, 132, 132, 132, 132, 132, 132,
- 132, 132, 132, 132, 132, 132, 132, 132,
- 132, 132, 132, 132, 132, 132, 132, 132,
- 132, 132, 132, 132, 132, 132, 132, 132,
- 132, 132, 132, 132, 132, 132, 132, 132,
- 132, 132, 132, 132, 132, 132, 132, 132,
- 132, 132, 132, 132, 132, 132, 132, 132,
- 132, 132, 132, 132, 132, 132, 132, 132,
- 132, 132, 132, 132, 132, 132, 132, 132,
- 132, 132, 132, 132, 132, 132, 132, 132,
- 132, 132, 132, 132, 132, 132, 132, 132,
- 132, 132, 132, 132, 132, 132, 132, 132,
- };
- YYDEBUG(170, *YYCURSOR);
- YYFILL(3);
- yych = *YYCURSOR;
- if (yych <= '-') {
- if (yych <= ' ') {
- if (yych <= '\n') {
- if (yych <= 0x08) goto yy172;
- if (yych <= '\t') goto yy174;
- goto yy175;
- } else {
- if (yych == '\r') goto yy175;
- if (yych >= ' ') goto yy174;
- }
- } else {
- if (yych <= '$') {
- if (yych == '"') goto yy177;
- if (yych >= '$') goto yy179;
- } else {
- if (yych == '\'') goto yy180;
- if (yych >= '-') goto yy181;
- }
- }
- } else {
- if (yych <= 'Z') {
- if (yych <= '9') {
- if (yych <= '.') goto yy182;
- if (yych >= '0') goto yy183;
- } else {
- if (yych == ';') goto yy175;
- if (yych >= 'A') goto yy185;
- }
- } else {
- if (yych <= '^') {
- if (yych <= '[') goto yy172;
- if (yych <= '\\') goto yy187;
- if (yych <= ']') goto yy188;
- } else {
- if (yych == '`') goto yy172;
- if (yych <= 'z') goto yy185;
- }
- }
- }
-yy172:
- YYDEBUG(172, *YYCURSOR);
- yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- goto yy195;
-yy173:
- YYDEBUG(173, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 521 "Zend/zend_ini_scanner.l"
- { /* Get rest as section/offset value */
- RETURN_TOKEN(TC_STRING, yytext, yyleng);
-}
-#line 2253 "Zend/zend_ini_scanner.c"
-yy174:
- YYDEBUG(174, *YYCURSOR);
- yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- if (yych <= 0x1F) {
- if (yych == '\t') goto yy221;
- goto yy195;
- } else {
- if (yych <= ' ') goto yy221;
- if (yych == '"') goto yy223;
- goto yy195;
- }
-yy175:
- YYDEBUG(175, *YYCURSOR);
- ++YYCURSOR;
-yy176:
- YYDEBUG(176, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 603 "Zend/zend_ini_scanner.l"
- {
- return 0;
-}
-#line 2276 "Zend/zend_ini_scanner.c"
-yy177:
- YYDEBUG(177, *YYCURSOR);
- ++YYCURSOR;
-yy178:
- YYDEBUG(178, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 525 "Zend/zend_ini_scanner.l"
- { /* Double quoted '"' string start */
- yy_push_state(ST_DOUBLE_QUOTES TSRMLS_CC);
- return '"';
-}
-#line 2288 "Zend/zend_ini_scanner.c"
-yy179:
- YYDEBUG(179, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych <= '\\') {
- if (yych <= 0x00) goto yy176;
- if (yych <= '[') goto yy194;
- goto yy199;
- } else {
- if (yych == '{') goto yy219;
- goto yy194;
- }
-yy180:
- YYDEBUG(180, *YYCURSOR);
- yyaccept = 1;
- yych = *(YYMARKER = ++YYCURSOR);
- if (yybm[0+yych] & 128) {
- goto yy215;
- }
- goto yy176;
-yy181:
- YYDEBUG(181, *YYCURSOR);
- yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- if (yych <= '/') goto yy195;
- if (yych <= '9') goto yy213;
- goto yy195;
-yy182:
- YYDEBUG(182, *YYCURSOR);
- yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- if (yych <= '/') goto yy195;
- if (yych <= '9') goto yy211;
- goto yy195;
-yy183:
- YYDEBUG(183, *YYCURSOR);
- yyaccept = 2;
- yych = *(YYMARKER = ++YYCURSOR);
- if (yych <= '\'') {
- if (yych <= '\r') {
- if (yych == '\n') goto yy184;
- if (yych <= '\f') goto yy195;
- } else {
- if (yych == '"') goto yy184;
- if (yych <= '&') goto yy195;
- }
- } else {
- if (yych <= '9') {
- if (yych == '.') goto yy207;
- if (yych <= '/') goto yy195;
- goto yy209;
- } else {
- if (yych <= ';') {
- if (yych <= ':') goto yy195;
- } else {
- if (yych != ']') goto yy195;
- }
- }
- }
-yy184:
- YYDEBUG(184, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 499 "Zend/zend_ini_scanner.l"
- { /* Get number option value as string */
- RETURN_TOKEN(TC_NUMBER, yytext, yyleng);
-}
-#line 2354 "Zend/zend_ini_scanner.c"
-yy185:
- YYDEBUG(185, *YYCURSOR);
- yyaccept = 3;
- yych = *(YYMARKER = ++YYCURSOR);
- if (yybm[0+yych] & 32) {
- goto yy205;
- }
- if (yych <= '"') {
- if (yych <= '\f') {
- if (yych != '\n') goto yy195;
- } else {
- if (yych <= '\r') goto yy186;
- if (yych <= '!') goto yy195;
- }
- } else {
- if (yych <= ':') {
- if (yych != '\'') goto yy195;
- } else {
- if (yych <= ';') goto yy186;
- if (yych != ']') goto yy195;
- }
- }
-yy186:
- YYDEBUG(186, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 495 "Zend/zend_ini_scanner.l"
- { /* Get constant option value */
- RETURN_TOKEN(TC_CONSTANT, yytext, yyleng);
-}
-#line 2384 "Zend/zend_ini_scanner.c"
-yy187:
- YYDEBUG(187, *YYCURSOR);
- yych = *++YYCURSOR;
- goto yy194;
-yy188:
- YYDEBUG(188, *YYCURSOR);
- ++YYCURSOR;
- yych = *YYCURSOR;
- goto yy191;
-yy189:
- YYDEBUG(189, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 377 "Zend/zend_ini_scanner.l"
- { /* End of section */
- BEGIN(INITIAL);
- SCNG(lineno)++;
- return ']';
-}
-#line 2403 "Zend/zend_ini_scanner.c"
-yy190:
- YYDEBUG(190, *YYCURSOR);
- ++YYCURSOR;
- YYFILL(2);
- yych = *YYCURSOR;
-yy191:
- YYDEBUG(191, *YYCURSOR);
- if (yybm[0+yych] & 2) {
- goto yy190;
- }
- if (yych == '\n') goto yy192;
- if (yych == '\r') goto yy193;
- goto yy189;
-yy192:
- YYDEBUG(192, *YYCURSOR);
- yych = *++YYCURSOR;
- goto yy189;
-yy193:
- YYDEBUG(193, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == '\n') goto yy192;
- goto yy189;
-yy194:
- YYDEBUG(194, *YYCURSOR);
- yyaccept = 0;
- YYMARKER = ++YYCURSOR;
- YYFILL(1);
- yych = *YYCURSOR;
-yy195:
- YYDEBUG(195, *YYCURSOR);
- if (yybm[0+yych] & 4) {
- goto yy194;
- }
- if (yych == '$') goto yy197;
- if (yych != '\\') goto yy173;
-yy196:
- YYDEBUG(196, *YYCURSOR);
- ++YYCURSOR;
- YYFILL(1);
- yych = *YYCURSOR;
- goto yy194;
-yy197:
- YYDEBUG(197, *YYCURSOR);
- ++YYCURSOR;
- YYFILL(1);
- yych = *YYCURSOR;
- if (yych <= '\\') {
- if (yych <= 0x00) goto yy198;
- if (yych <= '[') goto yy194;
- goto yy199;
- } else {
- if (yych != '{') goto yy194;
- }
-yy198:
- YYDEBUG(198, *YYCURSOR);
- YYCURSOR = YYMARKER;
- if (yyaccept <= 1) {
- if (yyaccept <= 0) {
- goto yy173;
- } else {
- goto yy176;
- }
- } else {
- if (yyaccept <= 2) {
- goto yy184;
- } else {
- goto yy186;
- }
- }
-yy199:
- YYDEBUG(199, *YYCURSOR);
- ++YYCURSOR;
- YYFILL(1);
- yych = *YYCURSOR;
- if (yybm[0+yych] & 8) {
- goto yy200;
- }
- if (yych == '\\') goto yy202;
- goto yy194;
-yy200:
- YYDEBUG(200, *YYCURSOR);
- ++YYCURSOR;
- YYFILL(1);
- yych = *YYCURSOR;
- YYDEBUG(201, *YYCURSOR);
- if (yybm[0+yych] & 8) {
- goto yy200;
- }
- if (yych == '\\') goto yy204;
- goto yy194;
-yy202:
- YYDEBUG(202, *YYCURSOR);
- ++YYCURSOR;
- YYFILL(1);
- yych = *YYCURSOR;
- YYDEBUG(203, *YYCURSOR);
- if (yybm[0+yych] & 8) {
- goto yy200;
- }
- if (yych == '\\') goto yy202;
- goto yy194;
-yy204:
- YYDEBUG(204, *YYCURSOR);
- ++YYCURSOR;
- YYFILL(1);
- yych = *YYCURSOR;
- if (yybm[0+yych] & 8) {
- goto yy200;
- }
- if (yych == '\\') goto yy202;
- goto yy194;
-yy205:
- YYDEBUG(205, *YYCURSOR);
- yyaccept = 3;
- YYMARKER = ++YYCURSOR;
- YYFILL(1);
- yych = *YYCURSOR;
- YYDEBUG(206, *YYCURSOR);
- if (yybm[0+yych] & 32) {
- goto yy205;
- }
- if (yych <= '$') {
- if (yych <= '\r') {
- if (yych == '\n') goto yy186;
- if (yych <= '\f') goto yy194;
- goto yy186;
- } else {
- if (yych == '"') goto yy186;
- if (yych <= '#') goto yy194;
- goto yy197;
- }
- } else {
- if (yych <= ';') {
- if (yych == '\'') goto yy186;
- if (yych <= ':') goto yy194;
- goto yy186;
- } else {
- if (yych <= '[') goto yy194;
- if (yych <= '\\') goto yy196;
- if (yych <= ']') goto yy186;
- goto yy194;
- }
- }
-yy207:
- YYDEBUG(207, *YYCURSOR);
- yyaccept = 2;
- YYMARKER = ++YYCURSOR;
- YYFILL(1);
- yych = *YYCURSOR;
- YYDEBUG(208, *YYCURSOR);
- if (yybm[0+yych] & 64) {
- goto yy207;
- }
- if (yych <= '$') {
- if (yych <= '\r') {
- if (yych == '\n') goto yy184;
- if (yych <= '\f') goto yy194;
- goto yy184;
- } else {
- if (yych == '"') goto yy184;
- if (yych <= '#') goto yy194;
- goto yy197;
- }
- } else {
- if (yych <= ';') {
- if (yych == '\'') goto yy184;
- if (yych <= ':') goto yy194;
- goto yy184;
- } else {
- if (yych <= '[') goto yy194;
- if (yych <= '\\') goto yy196;
- if (yych <= ']') goto yy184;
- goto yy194;
- }
- }
-yy209:
- YYDEBUG(209, *YYCURSOR);
- yyaccept = 2;
- YYMARKER = ++YYCURSOR;
- YYFILL(1);
- yych = *YYCURSOR;
- YYDEBUG(210, *YYCURSOR);
- if (yych <= '\'') {
- if (yych <= '!') {
- if (yych <= '\n') {
- if (yych <= '\t') goto yy194;
- goto yy184;
- } else {
- if (yych == '\r') goto yy184;
- goto yy194;
- }
- } else {
- if (yych <= '#') {
- if (yych <= '"') goto yy184;
- goto yy194;
- } else {
- if (yych <= '$') goto yy197;
- if (yych <= '&') goto yy194;
- goto yy184;
- }
- }
- } else {
- if (yych <= ':') {
- if (yych <= '.') {
- if (yych <= '-') goto yy194;
- goto yy207;
- } else {
- if (yych <= '/') goto yy194;
- if (yych <= '9') goto yy209;
- goto yy194;
- }
- } else {
- if (yych <= '[') {
- if (yych <= ';') goto yy184;
- goto yy194;
- } else {
- if (yych <= '\\') goto yy196;
- if (yych <= ']') goto yy184;
- goto yy194;
- }
- }
- }
-yy211:
- YYDEBUG(211, *YYCURSOR);
- yyaccept = 2;
- YYMARKER = ++YYCURSOR;
- YYFILL(1);
- yych = *YYCURSOR;
- YYDEBUG(212, *YYCURSOR);
- if (yych <= '&') {
- if (yych <= '\r') {
- if (yych == '\n') goto yy184;
- if (yych <= '\f') goto yy194;
- goto yy184;
- } else {
- if (yych <= '"') {
- if (yych <= '!') goto yy194;
- goto yy184;
- } else {
- if (yych == '$') goto yy197;
- goto yy194;
- }
- }
- } else {
- if (yych <= ':') {
- if (yych <= '\'') goto yy184;
- if (yych <= '/') goto yy194;
- if (yych <= '9') goto yy211;
- goto yy194;
- } else {
- if (yych <= '[') {
- if (yych <= ';') goto yy184;
- goto yy194;
- } else {
- if (yych <= '\\') goto yy196;
- if (yych <= ']') goto yy184;
- goto yy194;
- }
- }
- }
-yy213:
- YYDEBUG(213, *YYCURSOR);
- yyaccept = 2;
- YYMARKER = ++YYCURSOR;
- YYFILL(1);
- yych = *YYCURSOR;
- YYDEBUG(214, *YYCURSOR);
- if (yych <= '&') {
- if (yych <= '\r') {
- if (yych == '\n') goto yy184;
- if (yych <= '\f') goto yy194;
- goto yy184;
- } else {
- if (yych <= '"') {
- if (yych <= '!') goto yy194;
- goto yy184;
- } else {
- if (yych == '$') goto yy197;
- goto yy194;
- }
- }
- } else {
- if (yych <= ':') {
- if (yych <= '\'') goto yy184;
- if (yych <= '/') goto yy194;
- if (yych <= '9') goto yy213;
- goto yy194;
- } else {
- if (yych <= '[') {
- if (yych <= ';') goto yy184;
- goto yy194;
- } else {
- if (yych <= '\\') goto yy196;
- if (yych <= ']') goto yy184;
- goto yy194;
- }
- }
- }
-yy215:
- YYDEBUG(215, *YYCURSOR);
- ++YYCURSOR;
- YYFILL(1);
- yych = *YYCURSOR;
- YYDEBUG(216, *YYCURSOR);
- if (yybm[0+yych] & 128) {
- goto yy215;
- }
- YYDEBUG(217, *YYCURSOR);
- ++YYCURSOR;
- YYDEBUG(218, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 368 "Zend/zend_ini_scanner.l"
- { /* Raw string */
- /* Eat leading and trailing single quotes */
- if (yytext[0] == '\'' && yytext[yyleng - 1] == '\'') {
- SCNG(yy_text)++;
- yyleng = yyleng - 2;
- }
- RETURN_TOKEN(TC_RAW, yytext, yyleng);
-}
-#line 2724 "Zend/zend_ini_scanner.c"
-yy219:
- YYDEBUG(219, *YYCURSOR);
- ++YYCURSOR;
- YYDEBUG(220, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 401 "Zend/zend_ini_scanner.l"
- { /* Variable start */
- yy_push_state(ST_VARNAME TSRMLS_CC);
- return TC_DOLLAR_CURLY;
-}
-#line 2735 "Zend/zend_ini_scanner.c"
-yy221:
- YYDEBUG(221, *YYCURSOR);
- yyaccept = 0;
- YYMARKER = ++YYCURSOR;
- YYFILL(1);
- yych = *YYCURSOR;
- YYDEBUG(222, *YYCURSOR);
- if (yych <= '"') {
- if (yych <= '\f') {
- if (yych <= 0x08) goto yy194;
- if (yych <= '\t') goto yy221;
- if (yych <= '\n') goto yy173;
- goto yy194;
- } else {
- if (yych <= 0x1F) {
- if (yych <= '\r') goto yy173;
- goto yy194;
- } else {
- if (yych <= ' ') goto yy221;
- if (yych <= '!') goto yy194;
- }
- }
- } else {
- if (yych <= ':') {
- if (yych <= '$') {
- if (yych <= '#') goto yy194;
- goto yy197;
- } else {
- if (yych == '\'') goto yy173;
- goto yy194;
- }
- } else {
- if (yych <= '[') {
- if (yych <= ';') goto yy173;
- goto yy194;
- } else {
- if (yych <= '\\') goto yy196;
- if (yych <= ']') goto yy173;
- goto yy194;
- }
- }
- }
-yy223:
- YYDEBUG(223, *YYCURSOR);
- ++YYCURSOR;
- yych = *YYCURSOR;
- goto yy178;
- }
-/* *********************************** */
-yyc_ST_VALUE:
- {
- static const unsigned char yybm[] = {
- 160, 162, 162, 162, 162, 162, 162, 162,
- 162, 176, 128, 162, 162, 128, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162,
- 176, 160, 160, 162, 168, 162, 160, 32,
- 160, 160, 162, 162, 162, 162, 162, 162,
- 230, 230, 230, 230, 230, 230, 230, 230,
- 230, 230, 162, 160, 162, 160, 162, 162,
- 162, 166, 166, 166, 166, 166, 166, 166,
- 166, 166, 166, 166, 166, 166, 166, 166,
- 166, 166, 166, 166, 166, 166, 166, 166,
- 166, 166, 166, 162, 162, 162, 160, 166,
- 162, 166, 166, 166, 166, 166, 166, 166,
- 166, 166, 166, 166, 166, 166, 166, 166,
- 166, 166, 166, 166, 166, 166, 166, 166,
- 166, 166, 166, 162, 160, 162, 160, 162,
- 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162,
- };
- YYDEBUG(224, *YYCURSOR);
- YYFILL(6);
- yych = *YYCURSOR;
- YYDEBUG(-1, yych);
- switch (yych) {
- case 0x00: goto yy226;
- case '\t':
- case ' ': goto yy230;
- case '\n': goto yy232;
- case '\r': goto yy234;
- case '!':
- case '&':
- case '(':
- case ')':
- case '^':
- case '|':
- case '~': goto yy235;
- case '"': goto yy237;
- case '$': goto yy239;
- case '\'': goto yy240;
- case '-': goto yy241;
- case '.': goto yy242;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': goto yy243;
- case ';': goto yy245;
- case '=': goto yy246;
- case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'G':
- case 'H':
- case 'I':
- case 'J':
- case 'K':
- case 'L':
- case 'M':
- case 'P':
- case 'Q':
- case 'R':
- case 'S':
- case 'U':
- case 'V':
- case 'W':
- case 'X':
- case 'Z':
- case '_':
- case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'g':
- case 'h':
- case 'i':
- case 'j':
- case 'k':
- case 'l':
- case 'm':
- case 'p':
- case 'q':
- case 'r':
- case 's':
- case 'u':
- case 'v':
- case 'w':
- case 'x':
- case 'z': goto yy248;
- case 'F':
- case 'f': goto yy250;
- case 'N':
- case 'n': goto yy251;
- case 'O':
- case 'o': goto yy252;
- case 'T':
- case 't': goto yy253;
- case 'Y':
- case 'y': goto yy254;
- default: goto yy228;
- }
-yy226:
- YYDEBUG(226, *YYCURSOR);
- ++YYCURSOR;
-yy227:
- YYDEBUG(227, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 598 "Zend/zend_ini_scanner.l"
- { /* End of option value (if EOF is reached before EOL */
- BEGIN(INITIAL);
- return END_OF_LINE;
-}
-#line 2921 "Zend/zend_ini_scanner.c"
-yy228:
- YYDEBUG(228, *YYCURSOR);
- yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- goto yy256;
-yy229:
- YYDEBUG(229, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 517 "Zend/zend_ini_scanner.l"
- { /* Get everything else as option/offset value */
- RETURN_TOKEN(TC_STRING, yytext, yyleng);
-}
-#line 2934 "Zend/zend_ini_scanner.c"
-yy230:
- YYDEBUG(230, *YYCURSOR);
- yyaccept = 1;
- yych = *(YYMARKER = ++YYCURSOR);
- goto yy306;
-yy231:
- YYDEBUG(231, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 571 "Zend/zend_ini_scanner.l"
- {
- RETURN_TOKEN(TC_WHITESPACE, yytext, yyleng);
-}
-#line 2947 "Zend/zend_ini_scanner.c"
-yy232:
- YYDEBUG(232, *YYCURSOR);
- ++YYCURSOR;
-yy233:
- YYDEBUG(233, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 489 "Zend/zend_ini_scanner.l"
- { /* End of option value */
- BEGIN(INITIAL);
- SCNG(lineno)++;
- return END_OF_LINE;
-}
-#line 2960 "Zend/zend_ini_scanner.c"
-yy234:
- YYDEBUG(234, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == '\n') goto yy304;
- goto yy233;
-yy235:
- YYDEBUG(235, *YYCURSOR);
- ++YYCURSOR;
- yych = *YYCURSOR;
- goto yy303;
-yy236:
- YYDEBUG(236, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 507 "Zend/zend_ini_scanner.l"
- { /* Boolean operators */
- return yytext[0];
-}
-#line 2978 "Zend/zend_ini_scanner.c"
-yy237:
- YYDEBUG(237, *YYCURSOR);
- ++YYCURSOR;
-yy238:
- YYDEBUG(238, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 525 "Zend/zend_ini_scanner.l"
- { /* Double quoted '"' string start */
- yy_push_state(ST_DOUBLE_QUOTES TSRMLS_CC);
- return '"';
-}
-#line 2990 "Zend/zend_ini_scanner.c"
-yy239:
- YYDEBUG(239, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych <= '\\') {
- if (yych <= 0x00) goto yy227;
- if (yych <= '[') goto yy255;
- goto yy262;
- } else {
- if (yych == '{') goto yy300;
- goto yy255;
- }
-yy240:
- YYDEBUG(240, *YYCURSOR);
- yyaccept = 2;
- yych = *(YYMARKER = ++YYCURSOR);
- if (yybm[0+yych] & 128) {
- goto yy296;
- }
- goto yy227;
-yy241:
- YYDEBUG(241, *YYCURSOR);
- yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- if (yych <= '/') goto yy256;
- if (yych <= '9') goto yy294;
- goto yy256;
-yy242:
- YYDEBUG(242, *YYCURSOR);
- yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- if (yych <= '/') goto yy256;
- if (yych <= '9') goto yy292;
- goto yy256;
-yy243:
- YYDEBUG(243, *YYCURSOR);
- yyaccept = 3;
- yych = *(YYMARKER = ++YYCURSOR);
- if (yych <= '/') {
- if (yych <= 0x1F) {
- if (yych <= '\n') {
- if (yych <= 0x00) goto yy244;
- if (yych <= 0x08) goto yy256;
- } else {
- if (yych != '\r') goto yy256;
- }
- } else {
- if (yych <= ')') {
- if (yych <= '"') goto yy244;
- if (yych <= '%') goto yy256;
- } else {
- if (yych == '.') goto yy288;
- goto yy256;
- }
- }
- } else {
- if (yych <= ']') {
- if (yych <= ';') {
- if (yych <= '9') goto yy290;
- if (yych <= ':') goto yy256;
- } else {
- if (yych != '=') goto yy256;
- }
- } else {
- if (yych <= '|') {
- if (yych <= '^') goto yy244;
- if (yych <= '{') goto yy256;
- } else {
- if (yych != '~') goto yy256;
- }
- }
- }
-yy244:
- YYDEBUG(244, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 499 "Zend/zend_ini_scanner.l"
- { /* Get number option value as string */
- RETURN_TOKEN(TC_NUMBER, yytext, yyleng);
-}
-#line 3069 "Zend/zend_ini_scanner.c"
-yy245:
- YYDEBUG(245, *YYCURSOR);
- yyaccept = 2;
- yych = *(YYMARKER = ++YYCURSOR);
- goto yy284;
-yy246:
- YYDEBUG(246, *YYCURSOR);
- ++YYCURSOR;
- YYDEBUG(247, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 511 "Zend/zend_ini_scanner.l"
- { /* Make = used in option value to trigger error */
- yyless(0);
- BEGIN(INITIAL);
- return END_OF_LINE;
-}
-#line 3086 "Zend/zend_ini_scanner.c"
-yy248:
- YYDEBUG(248, *YYCURSOR);
- yyaccept = 4;
- yych = *(YYMARKER = ++YYCURSOR);
- if (yybm[0+yych] & 4) {
- goto yy257;
- }
- if (yych <= ':') {
- if (yych <= '\r') {
- if (yych <= 0x08) {
- if (yych >= 0x01) goto yy256;
- } else {
- if (yych <= '\n') goto yy249;
- if (yych <= '\f') goto yy256;
- }
- } else {
- if (yych <= '"') {
- if (yych <= 0x1F) goto yy256;
- } else {
- if (yych <= '%') goto yy256;
- if (yych >= '*') goto yy256;
- }
- }
- } else {
- if (yych <= '^') {
- if (yych <= '<') {
- if (yych >= '<') goto yy256;
- } else {
- if (yych <= '=') goto yy249;
- if (yych <= ']') goto yy256;
- }
- } else {
- if (yych <= '|') {
- if (yych <= '{') goto yy256;
- } else {
- if (yych != '~') goto yy256;
- }
- }
- }
-yy249:
- YYDEBUG(249, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 495 "Zend/zend_ini_scanner.l"
- { /* Get constant option value */
- RETURN_TOKEN(TC_CONSTANT, yytext, yyleng);
-}
-#line 3133 "Zend/zend_ini_scanner.c"
-yy250:
- YYDEBUG(250, *YYCURSOR);
- yyaccept = 4;
- yych = *(YYMARKER = ++YYCURSOR);
- if (yych <= '<') {
- if (yych <= '"') {
- if (yych <= '\n') {
- if (yych <= 0x00) goto yy249;
- if (yych <= 0x08) goto yy256;
- goto yy249;
- } else {
- if (yych == '\r') goto yy249;
- if (yych <= 0x1F) goto yy256;
- goto yy249;
- }
- } else {
- if (yych <= '/') {
- if (yych <= '%') goto yy256;
- if (yych <= ')') goto yy249;
- goto yy256;
- } else {
- if (yych <= '9') goto yy257;
- if (yych == ';') goto yy249;
- goto yy256;
- }
- }
- } else {
- if (yych <= '_') {
- if (yych <= 'A') {
- if (yych <= '=') goto yy249;
- if (yych <= '@') goto yy256;
- goto yy280;
- } else {
- if (yych <= 'Z') goto yy257;
- if (yych <= ']') goto yy256;
- if (yych <= '^') goto yy249;
- goto yy257;
- }
- } else {
- if (yych <= '{') {
- if (yych <= '`') goto yy256;
- if (yych <= 'a') goto yy280;
- if (yych <= 'z') goto yy257;
- goto yy256;
- } else {
- if (yych == '}') goto yy256;
- if (yych <= '~') goto yy249;
- goto yy256;
- }
- }
- }
-yy251:
- YYDEBUG(251, *YYCURSOR);
- yyaccept = 4;
- yych = *(YYMARKER = ++YYCURSOR);
- if (yych <= 'N') {
- if (yych <= '%') {
- if (yych <= '\f') {
- if (yych <= 0x00) goto yy249;
- if (yych <= 0x08) goto yy256;
- if (yych <= '\n') goto yy249;
- goto yy256;
- } else {
- if (yych <= '\r') goto yy249;
- if (yych <= 0x1F) goto yy256;
- if (yych <= '"') goto yy249;
- goto yy256;
- }
- } else {
- if (yych <= ':') {
- if (yych <= ')') goto yy249;
- if (yych <= '/') goto yy256;
- if (yych <= '9') goto yy257;
- goto yy256;
- } else {
- if (yych <= '<') {
- if (yych <= ';') goto yy249;
- goto yy256;
- } else {
- if (yych <= '=') goto yy249;
- if (yych <= '@') goto yy256;
- goto yy257;
- }
- }
- }
- } else {
- if (yych <= 'n') {
- if (yych <= 'Z') {
- if (yych <= 'O') goto yy276;
- if (yych == 'U') goto yy277;
- goto yy257;
- } else {
- if (yych <= '^') {
- if (yych <= ']') goto yy256;
- goto yy249;
- } else {
- if (yych == '`') goto yy256;
- goto yy257;
- }
- }
- } else {
- if (yych <= 'z') {
- if (yych <= 'o') goto yy276;
- if (yych == 'u') goto yy277;
- goto yy257;
- } else {
- if (yych <= '|') {
- if (yych <= '{') goto yy256;
- goto yy249;
- } else {
- if (yych == '~') goto yy249;
- goto yy256;
- }
- }
- }
- }
-yy252:
- YYDEBUG(252, *YYCURSOR);
- yyaccept = 4;
- yych = *(YYMARKER = ++YYCURSOR);
- if (yych <= 'E') {
- if (yych <= '%') {
- if (yych <= '\f') {
- if (yych <= 0x00) goto yy249;
- if (yych <= 0x08) goto yy256;
- if (yych <= '\n') goto yy249;
- goto yy256;
- } else {
- if (yych <= '\r') goto yy249;
- if (yych <= 0x1F) goto yy256;
- if (yych <= '"') goto yy249;
- goto yy256;
- }
- } else {
- if (yych <= ':') {
- if (yych <= ')') goto yy249;
- if (yych <= '/') goto yy256;
- if (yych <= '9') goto yy257;
- goto yy256;
- } else {
- if (yych <= '<') {
- if (yych <= ';') goto yy249;
- goto yy256;
- } else {
- if (yych <= '=') goto yy249;
- if (yych <= '@') goto yy256;
- goto yy257;
- }
- }
- }
- } else {
- if (yych <= 'e') {
- if (yych <= 'Z') {
- if (yych <= 'F') goto yy271;
- if (yych == 'N') goto yy265;
- goto yy257;
- } else {
- if (yych <= '^') {
- if (yych <= ']') goto yy256;
- goto yy249;
- } else {
- if (yych == '`') goto yy256;
- goto yy257;
- }
- }
- } else {
- if (yych <= 'z') {
- if (yych <= 'f') goto yy271;
- if (yych == 'n') goto yy265;
- goto yy257;
- } else {
- if (yych <= '|') {
- if (yych <= '{') goto yy256;
- goto yy249;
- } else {
- if (yych == '~') goto yy249;
- goto yy256;
- }
- }
- }
- }
-yy253:
- YYDEBUG(253, *YYCURSOR);
- yyaccept = 4;
- yych = *(YYMARKER = ++YYCURSOR);
- if (yych <= '=') {
- if (yych <= '"') {
- if (yych <= '\n') {
- if (yych <= 0x00) goto yy249;
- if (yych <= 0x08) goto yy256;
- goto yy249;
- } else {
- if (yych == '\r') goto yy249;
- if (yych <= 0x1F) goto yy256;
- goto yy249;
- }
- } else {
- if (yych <= '9') {
- if (yych <= '%') goto yy256;
- if (yych <= ')') goto yy249;
- if (yych <= '/') goto yy256;
- goto yy257;
- } else {
- if (yych == ';') goto yy249;
- if (yych <= '<') goto yy256;
- goto yy249;
- }
- }
- } else {
- if (yych <= '`') {
- if (yych <= 'Z') {
- if (yych <= '@') goto yy256;
- if (yych == 'R') goto yy269;
- goto yy257;
- } else {
- if (yych <= ']') goto yy256;
- if (yych <= '^') goto yy249;
- if (yych <= '_') goto yy257;
- goto yy256;
- }
- } else {
- if (yych <= '{') {
- if (yych == 'r') goto yy269;
- if (yych <= 'z') goto yy257;
- goto yy256;
- } else {
- if (yych == '}') goto yy256;
- if (yych <= '~') goto yy249;
- goto yy256;
- }
- }
- }
-yy254:
- YYDEBUG(254, *YYCURSOR);
- yyaccept = 4;
- yych = *(YYMARKER = ++YYCURSOR);
- if (yych <= '=') {
- if (yych <= '"') {
- if (yych <= '\n') {
- if (yych <= 0x00) goto yy249;
- if (yych <= 0x08) goto yy256;
- goto yy249;
- } else {
- if (yych == '\r') goto yy249;
- if (yych <= 0x1F) goto yy256;
- goto yy249;
- }
- } else {
- if (yych <= '9') {
- if (yych <= '%') goto yy256;
- if (yych <= ')') goto yy249;
- if (yych <= '/') goto yy256;
- goto yy257;
- } else {
- if (yych == ';') goto yy249;
- if (yych <= '<') goto yy256;
- goto yy249;
- }
- }
- } else {
- if (yych <= '`') {
- if (yych <= 'Z') {
- if (yych <= '@') goto yy256;
- if (yych == 'E') goto yy259;
- goto yy257;
- } else {
- if (yych <= ']') goto yy256;
- if (yych <= '^') goto yy249;
- if (yych <= '_') goto yy257;
- goto yy256;
- }
- } else {
- if (yych <= '{') {
- if (yych == 'e') goto yy259;
- if (yych <= 'z') goto yy257;
- goto yy256;
- } else {
- if (yych == '}') goto yy256;
- if (yych <= '~') goto yy249;
- goto yy256;
- }
- }
- }
-yy255:
- YYDEBUG(255, *YYCURSOR);
- yyaccept = 0;
- YYMARKER = ++YYCURSOR;
- YYFILL(1);
- yych = *YYCURSOR;
-yy256:
- YYDEBUG(256, *YYCURSOR);
- if (yybm[0+yych] & 2) {
- goto yy255;
- }
- if (yych == '$') goto yy260;
- goto yy229;
-yy257:
- YYDEBUG(257, *YYCURSOR);
- yyaccept = 4;
- YYMARKER = ++YYCURSOR;
- YYFILL(1);
- yych = *YYCURSOR;
- YYDEBUG(258, *YYCURSOR);
- if (yybm[0+yych] & 4) {
- goto yy257;
- }
- if (yych <= ')') {
- if (yych <= '\r') {
- if (yych <= 0x08) {
- if (yych <= 0x00) goto yy249;
- goto yy255;
- } else {
- if (yych <= '\n') goto yy249;
- if (yych <= '\f') goto yy255;
- goto yy249;
- }
- } else {
- if (yych <= '#') {
- if (yych <= 0x1F) goto yy255;
- if (yych <= '"') goto yy249;
- goto yy255;
- } else {
- if (yych <= '$') goto yy260;
- if (yych <= '%') goto yy255;
- goto yy249;
- }
- }
- } else {
- if (yych <= ']') {
- if (yych <= ';') {
- if (yych <= ':') goto yy255;
- goto yy249;
- } else {
- if (yych == '=') goto yy249;
- goto yy255;
- }
- } else {
- if (yych <= '|') {
- if (yych <= '^') goto yy249;
- if (yych <= '{') goto yy255;
- goto yy249;
- } else {
- if (yych == '~') goto yy249;
- goto yy255;
- }
- }
- }
-yy259:
- YYDEBUG(259, *YYCURSOR);
- yyaccept = 4;
- yych = *(YYMARKER = ++YYCURSOR);
- if (yych <= '=') {
- if (yych <= '"') {
- if (yych <= '\n') {
- if (yych <= 0x00) goto yy249;
- if (yych <= 0x08) goto yy256;
- goto yy249;
- } else {
- if (yych == '\r') goto yy249;
- if (yych <= 0x1F) goto yy256;
- goto yy249;
- }
- } else {
- if (yych <= '9') {
- if (yych <= '%') goto yy256;
- if (yych <= ')') goto yy249;
- if (yych <= '/') goto yy256;
- goto yy257;
- } else {
- if (yych == ';') goto yy249;
- if (yych <= '<') goto yy256;
- goto yy249;
- }
- }
- } else {
- if (yych <= '`') {
- if (yych <= 'Z') {
- if (yych <= '@') goto yy256;
- if (yych == 'S') goto yy265;
- goto yy257;
- } else {
- if (yych <= ']') goto yy256;
- if (yych <= '^') goto yy249;
- if (yych <= '_') goto yy257;
- goto yy256;
- }
- } else {
- if (yych <= '{') {
- if (yych == 's') goto yy265;
- if (yych <= 'z') goto yy257;
- goto yy256;
- } else {
- if (yych == '}') goto yy256;
- if (yych <= '~') goto yy249;
- goto yy256;
- }
- }
- }
-yy260:
- YYDEBUG(260, *YYCURSOR);
- ++YYCURSOR;
- YYFILL(1);
- yych = *YYCURSOR;
- if (yych <= '\\') {
- if (yych <= 0x00) goto yy261;
- if (yych <= '[') goto yy255;
- goto yy262;
- } else {
- if (yych != '{') goto yy255;
- }
-yy261:
- YYDEBUG(261, *YYCURSOR);
- YYCURSOR = YYMARKER;
- if (yyaccept <= 3) {
- if (yyaccept <= 1) {
- if (yyaccept <= 0) {
- goto yy229;
- } else {
- goto yy231;
- }
- } else {
- if (yyaccept <= 2) {
- goto yy227;
- } else {
- goto yy244;
- }
- }
- } else {
- if (yyaccept <= 5) {
- if (yyaccept <= 4) {
- goto yy249;
- } else {
- goto yy266;
- }
- } else {
- goto yy273;
- }
- }
-yy262:
- YYDEBUG(262, *YYCURSOR);
- ++YYCURSOR;
- YYFILL(1);
- yych = *YYCURSOR;
- if (yybm[0+yych] & 8) {
- goto yy263;
- }
- goto yy255;
-yy263:
- YYDEBUG(263, *YYCURSOR);
- ++YYCURSOR;
- YYFILL(1);
- yych = *YYCURSOR;
- YYDEBUG(264, *YYCURSOR);
- if (yybm[0+yych] & 8) {
- goto yy263;
- }
- if (yych <= 0x00) goto yy229;
- if (yych == '\\') goto yy262;
- goto yy255;
-yy265:
- YYDEBUG(265, *YYCURSOR);
- yyaccept = 5;
- yych = *(YYMARKER = ++YYCURSOR);
- if (yybm[0+yych] & 16) {
- goto yy267;
- }
- if (yych <= ';') {
- if (yych <= ' ') {
- if (yych <= '\n') {
- if (yych <= 0x00) goto yy266;
- if (yych <= '\t') goto yy256;
- } else {
- if (yych != '\r') goto yy256;
- }
- } else {
- if (yych <= ')') {
- if (yych <= '"') goto yy266;
- if (yych <= '%') goto yy256;
- } else {
- if (yych <= '/') goto yy256;
- if (yych <= '9') goto yy257;
- if (yych <= ':') goto yy256;
- }
- }
- } else {
- if (yych <= '_') {
- if (yych <= '@') {
- if (yych != '=') goto yy256;
- } else {
- if (yych <= 'Z') goto yy257;
- if (yych <= ']') goto yy256;
- if (yych >= '_') goto yy257;
- }
- } else {
- if (yych <= '{') {
- if (yych <= '`') goto yy256;
- if (yych <= 'z') goto yy257;
- goto yy256;
- } else {
- if (yych == '}') goto yy256;
- if (yych >= 0x7F) goto yy256;
- }
- }
- }
-yy266:
- YYDEBUG(266, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 421 "Zend/zend_ini_scanner.l"
- { /* TRUE value (when used outside option value/offset this causes parse error!) */
- RETURN_TOKEN(BOOL_TRUE, "1", 1);
-}
-#line 3645 "Zend/zend_ini_scanner.c"
-yy267:
- YYDEBUG(267, *YYCURSOR);
- ++YYCURSOR;
- YYFILL(1);
- yych = *YYCURSOR;
- YYDEBUG(268, *YYCURSOR);
- if (yybm[0+yych] & 16) {
- goto yy267;
- }
- goto yy266;
-yy269:
- YYDEBUG(269, *YYCURSOR);
- yyaccept = 4;
- yych = *(YYMARKER = ++YYCURSOR);
- if (yych <= '=') {
- if (yych <= '"') {
- if (yych <= '\n') {
- if (yych <= 0x00) goto yy249;
- if (yych <= 0x08) goto yy256;
- goto yy249;
- } else {
- if (yych == '\r') goto yy249;
- if (yych <= 0x1F) goto yy256;
- goto yy249;
- }
- } else {
- if (yych <= '9') {
- if (yych <= '%') goto yy256;
- if (yych <= ')') goto yy249;
- if (yych <= '/') goto yy256;
- goto yy257;
- } else {
- if (yych == ';') goto yy249;
- if (yych <= '<') goto yy256;
- goto yy249;
- }
- }
- } else {
- if (yych <= '`') {
- if (yych <= 'Z') {
- if (yych <= '@') goto yy256;
- if (yych != 'U') goto yy257;
- } else {
- if (yych <= ']') goto yy256;
- if (yych <= '^') goto yy249;
- if (yych <= '_') goto yy257;
- goto yy256;
- }
- } else {
- if (yych <= '{') {
- if (yych == 'u') goto yy270;
- if (yych <= 'z') goto yy257;
- goto yy256;
- } else {
- if (yych == '}') goto yy256;
- if (yych <= '~') goto yy249;
- goto yy256;
- }
- }
- }
-yy270:
- YYDEBUG(270, *YYCURSOR);
- yyaccept = 4;
- yych = *(YYMARKER = ++YYCURSOR);
- if (yych <= '=') {
- if (yych <= '"') {
- if (yych <= '\n') {
- if (yych <= 0x00) goto yy249;
- if (yych <= 0x08) goto yy256;
- goto yy249;
- } else {
- if (yych == '\r') goto yy249;
- if (yych <= 0x1F) goto yy256;
- goto yy249;
- }
- } else {
- if (yych <= '9') {
- if (yych <= '%') goto yy256;
- if (yych <= ')') goto yy249;
- if (yych <= '/') goto yy256;
- goto yy257;
- } else {
- if (yych == ';') goto yy249;
- if (yych <= '<') goto yy256;
- goto yy249;
- }
- }
- } else {
- if (yych <= '`') {
- if (yych <= 'Z') {
- if (yych <= '@') goto yy256;
- if (yych == 'E') goto yy265;
- goto yy257;
- } else {
- if (yych <= ']') goto yy256;
- if (yych <= '^') goto yy249;
- if (yych <= '_') goto yy257;
- goto yy256;
- }
- } else {
- if (yych <= '{') {
- if (yych == 'e') goto yy265;
- if (yych <= 'z') goto yy257;
- goto yy256;
- } else {
- if (yych == '}') goto yy256;
- if (yych <= '~') goto yy249;
- goto yy256;
- }
- }
- }
-yy271:
- YYDEBUG(271, *YYCURSOR);
- yyaccept = 4;
- yych = *(YYMARKER = ++YYCURSOR);
- if (yych <= '=') {
- if (yych <= '"') {
- if (yych <= '\n') {
- if (yych <= 0x00) goto yy249;
- if (yych <= 0x08) goto yy256;
- goto yy249;
- } else {
- if (yych == '\r') goto yy249;
- if (yych <= 0x1F) goto yy256;
- goto yy249;
- }
- } else {
- if (yych <= '9') {
- if (yych <= '%') goto yy256;
- if (yych <= ')') goto yy249;
- if (yych <= '/') goto yy256;
- goto yy257;
- } else {
- if (yych == ';') goto yy249;
- if (yych <= '<') goto yy256;
- goto yy249;
- }
- }
- } else {
- if (yych <= '`') {
- if (yych <= 'Z') {
- if (yych <= '@') goto yy256;
- if (yych != 'F') goto yy257;
- } else {
- if (yych <= ']') goto yy256;
- if (yych <= '^') goto yy249;
- if (yych <= '_') goto yy257;
- goto yy256;
- }
- } else {
- if (yych <= '{') {
- if (yych == 'f') goto yy272;
- if (yych <= 'z') goto yy257;
- goto yy256;
- } else {
- if (yych == '}') goto yy256;
- if (yych <= '~') goto yy249;
- goto yy256;
- }
- }
- }
-yy272:
- YYDEBUG(272, *YYCURSOR);
- yyaccept = 6;
- yych = *(YYMARKER = ++YYCURSOR);
- if (yybm[0+yych] & 4) {
- goto yy257;
- }
- if (yych <= ')') {
- if (yych <= '\f') {
- if (yych <= 0x08) {
- if (yych >= 0x01) goto yy256;
- } else {
- if (yych <= '\t') goto yy274;
- if (yych >= '\v') goto yy256;
- }
- } else {
- if (yych <= ' ') {
- if (yych <= '\r') goto yy273;
- if (yych <= 0x1F) goto yy256;
- goto yy274;
- } else {
- if (yych <= '"') goto yy273;
- if (yych <= '%') goto yy256;
- }
- }
- } else {
- if (yych <= ']') {
- if (yych <= ';') {
- if (yych <= ':') goto yy256;
- } else {
- if (yych != '=') goto yy256;
- }
- } else {
- if (yych <= '|') {
- if (yych <= '^') goto yy273;
- if (yych <= '{') goto yy256;
- } else {
- if (yych != '~') goto yy256;
- }
- }
- }
-yy273:
- YYDEBUG(273, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 425 "Zend/zend_ini_scanner.l"
- { /* FALSE value (when used outside option value/offset this causes parse error!)*/
- RETURN_TOKEN(BOOL_FALSE, "", 0);
-}
-#line 3855 "Zend/zend_ini_scanner.c"
-yy274:
- YYDEBUG(274, *YYCURSOR);
- ++YYCURSOR;
- YYFILL(1);
- yych = *YYCURSOR;
- YYDEBUG(275, *YYCURSOR);
- if (yych == '\t') goto yy274;
- if (yych == ' ') goto yy274;
- goto yy273;
-yy276:
- YYDEBUG(276, *YYCURSOR);
- yyaccept = 6;
- yych = *(YYMARKER = ++YYCURSOR);
- if (yych <= '<') {
- if (yych <= ' ') {
- if (yych <= '\n') {
- if (yych <= 0x00) goto yy273;
- if (yych <= 0x08) goto yy256;
- if (yych <= '\t') goto yy274;
- goto yy273;
- } else {
- if (yych == '\r') goto yy273;
- if (yych <= 0x1F) goto yy256;
- goto yy274;
- }
- } else {
- if (yych <= '/') {
- if (yych <= '"') goto yy273;
- if (yych <= '%') goto yy256;
- if (yych <= ')') goto yy273;
- goto yy256;
- } else {
- if (yych <= '9') goto yy257;
- if (yych == ';') goto yy273;
- goto yy256;
- }
- }
- } else {
- if (yych <= '_') {
- if (yych <= 'N') {
- if (yych <= '=') goto yy273;
- if (yych <= '@') goto yy256;
- if (yych <= 'M') goto yy257;
- goto yy279;
- } else {
- if (yych <= 'Z') goto yy257;
- if (yych <= ']') goto yy256;
- if (yych <= '^') goto yy273;
- goto yy257;
- }
- } else {
- if (yych <= 'z') {
- if (yych <= '`') goto yy256;
- if (yych == 'n') goto yy279;
- goto yy257;
- } else {
- if (yych <= '|') {
- if (yych <= '{') goto yy256;
- goto yy273;
- } else {
- if (yych == '~') goto yy273;
- goto yy256;
- }
- }
- }
- }
-yy277:
- YYDEBUG(277, *YYCURSOR);
- yyaccept = 4;
- yych = *(YYMARKER = ++YYCURSOR);
- if (yych <= '=') {
- if (yych <= '"') {
- if (yych <= '\n') {
- if (yych <= 0x00) goto yy249;
- if (yych <= 0x08) goto yy256;
- goto yy249;
- } else {
- if (yych == '\r') goto yy249;
- if (yych <= 0x1F) goto yy256;
- goto yy249;
- }
- } else {
- if (yych <= '9') {
- if (yych <= '%') goto yy256;
- if (yych <= ')') goto yy249;
- if (yych <= '/') goto yy256;
- goto yy257;
- } else {
- if (yych == ';') goto yy249;
- if (yych <= '<') goto yy256;
- goto yy249;
- }
- }
- } else {
- if (yych <= '`') {
- if (yych <= 'Z') {
- if (yych <= '@') goto yy256;
- if (yych != 'L') goto yy257;
- } else {
- if (yych <= ']') goto yy256;
- if (yych <= '^') goto yy249;
- if (yych <= '_') goto yy257;
- goto yy256;
- }
- } else {
- if (yych <= '{') {
- if (yych == 'l') goto yy278;
- if (yych <= 'z') goto yy257;
- goto yy256;
- } else {
- if (yych == '}') goto yy256;
- if (yych <= '~') goto yy249;
- goto yy256;
- }
- }
- }
-yy278:
- YYDEBUG(278, *YYCURSOR);
- yyaccept = 4;
- yych = *(YYMARKER = ++YYCURSOR);
- if (yych <= '=') {
- if (yych <= '"') {
- if (yych <= '\n') {
- if (yych <= 0x00) goto yy249;
- if (yych <= 0x08) goto yy256;
- goto yy249;
- } else {
- if (yych == '\r') goto yy249;
- if (yych <= 0x1F) goto yy256;
- goto yy249;
- }
- } else {
- if (yych <= '9') {
- if (yych <= '%') goto yy256;
- if (yych <= ')') goto yy249;
- if (yych <= '/') goto yy256;
- goto yy257;
- } else {
- if (yych == ';') goto yy249;
- if (yych <= '<') goto yy256;
- goto yy249;
- }
- }
- } else {
- if (yych <= '`') {
- if (yych <= 'Z') {
- if (yych <= '@') goto yy256;
- if (yych == 'L') goto yy272;
- goto yy257;
- } else {
- if (yych <= ']') goto yy256;
- if (yych <= '^') goto yy249;
- if (yych <= '_') goto yy257;
- goto yy256;
- }
- } else {
- if (yych <= '{') {
- if (yych == 'l') goto yy272;
- if (yych <= 'z') goto yy257;
- goto yy256;
- } else {
- if (yych == '}') goto yy256;
- if (yych <= '~') goto yy249;
- goto yy256;
- }
- }
- }
-yy279:
- YYDEBUG(279, *YYCURSOR);
- yyaccept = 4;
- yych = *(YYMARKER = ++YYCURSOR);
- if (yych <= '=') {
- if (yych <= '"') {
- if (yych <= '\n') {
- if (yych <= 0x00) goto yy249;
- if (yych <= 0x08) goto yy256;
- goto yy249;
- } else {
- if (yych == '\r') goto yy249;
- if (yych <= 0x1F) goto yy256;
- goto yy249;
- }
- } else {
- if (yych <= '9') {
- if (yych <= '%') goto yy256;
- if (yych <= ')') goto yy249;
- if (yych <= '/') goto yy256;
- goto yy257;
- } else {
- if (yych == ';') goto yy249;
- if (yych <= '<') goto yy256;
- goto yy249;
- }
- }
- } else {
- if (yych <= '`') {
- if (yych <= 'Z') {
- if (yych <= '@') goto yy256;
- if (yych == 'E') goto yy272;
- goto yy257;
- } else {
- if (yych <= ']') goto yy256;
- if (yych <= '^') goto yy249;
- if (yych <= '_') goto yy257;
- goto yy256;
- }
- } else {
- if (yych <= '{') {
- if (yych == 'e') goto yy272;
- if (yych <= 'z') goto yy257;
- goto yy256;
- } else {
- if (yych == '}') goto yy256;
- if (yych <= '~') goto yy249;
- goto yy256;
- }
- }
- }
-yy280:
- YYDEBUG(280, *YYCURSOR);
- yyaccept = 4;
- yych = *(YYMARKER = ++YYCURSOR);
- if (yych <= '=') {
- if (yych <= '"') {
- if (yych <= '\n') {
- if (yych <= 0x00) goto yy249;
- if (yych <= 0x08) goto yy256;
- goto yy249;
- } else {
- if (yych == '\r') goto yy249;
- if (yych <= 0x1F) goto yy256;
- goto yy249;
- }
- } else {
- if (yych <= '9') {
- if (yych <= '%') goto yy256;
- if (yych <= ')') goto yy249;
- if (yych <= '/') goto yy256;
- goto yy257;
- } else {
- if (yych == ';') goto yy249;
- if (yych <= '<') goto yy256;
- goto yy249;
- }
- }
- } else {
- if (yych <= '`') {
- if (yych <= 'Z') {
- if (yych <= '@') goto yy256;
- if (yych != 'L') goto yy257;
- } else {
- if (yych <= ']') goto yy256;
- if (yych <= '^') goto yy249;
- if (yych <= '_') goto yy257;
- goto yy256;
- }
- } else {
- if (yych <= '{') {
- if (yych == 'l') goto yy281;
- if (yych <= 'z') goto yy257;
- goto yy256;
- } else {
- if (yych == '}') goto yy256;
- if (yych <= '~') goto yy249;
- goto yy256;
- }
- }
- }
-yy281:
- YYDEBUG(281, *YYCURSOR);
- yyaccept = 4;
- yych = *(YYMARKER = ++YYCURSOR);
- if (yych <= '=') {
- if (yych <= '"') {
- if (yych <= '\n') {
- if (yych <= 0x00) goto yy249;
- if (yych <= 0x08) goto yy256;
- goto yy249;
- } else {
- if (yych == '\r') goto yy249;
- if (yych <= 0x1F) goto yy256;
- goto yy249;
- }
- } else {
- if (yych <= '9') {
- if (yych <= '%') goto yy256;
- if (yych <= ')') goto yy249;
- if (yych <= '/') goto yy256;
- goto yy257;
- } else {
- if (yych == ';') goto yy249;
- if (yych <= '<') goto yy256;
- goto yy249;
- }
- }
- } else {
- if (yych <= '`') {
- if (yych <= 'Z') {
- if (yych <= '@') goto yy256;
- if (yych != 'S') goto yy257;
- } else {
- if (yych <= ']') goto yy256;
- if (yych <= '^') goto yy249;
- if (yych <= '_') goto yy257;
- goto yy256;
- }
- } else {
- if (yych <= '{') {
- if (yych == 's') goto yy282;
- if (yych <= 'z') goto yy257;
- goto yy256;
- } else {
- if (yych == '}') goto yy256;
- if (yych <= '~') goto yy249;
- goto yy256;
- }
- }
- }
-yy282:
- YYDEBUG(282, *YYCURSOR);
- yyaccept = 4;
- yych = *(YYMARKER = ++YYCURSOR);
- if (yych <= '=') {
- if (yych <= '"') {
- if (yych <= '\n') {
- if (yych <= 0x00) goto yy249;
- if (yych <= 0x08) goto yy256;
- goto yy249;
- } else {
- if (yych == '\r') goto yy249;
- if (yych <= 0x1F) goto yy256;
- goto yy249;
- }
- } else {
- if (yych <= '9') {
- if (yych <= '%') goto yy256;
- if (yych <= ')') goto yy249;
- if (yych <= '/') goto yy256;
- goto yy257;
- } else {
- if (yych == ';') goto yy249;
- if (yych <= '<') goto yy256;
- goto yy249;
- }
- }
- } else {
- if (yych <= '`') {
- if (yych <= 'Z') {
- if (yych <= '@') goto yy256;
- if (yych == 'E') goto yy272;
- goto yy257;
- } else {
- if (yych <= ']') goto yy256;
- if (yych <= '^') goto yy249;
- if (yych <= '_') goto yy257;
- goto yy256;
- }
- } else {
- if (yych <= '{') {
- if (yych == 'e') goto yy272;
- if (yych <= 'z') goto yy257;
- goto yy256;
- } else {
- if (yych == '}') goto yy256;
- if (yych <= '~') goto yy249;
- goto yy256;
- }
- }
- }
-yy283:
- YYDEBUG(283, *YYCURSOR);
- ++YYCURSOR;
- YYFILL(2);
- yych = *YYCURSOR;
-yy284:
- YYDEBUG(284, *YYCURSOR);
- if (yybm[0+yych] & 32) {
- goto yy283;
- }
- if (yych >= '\r') goto yy287;
-yy285:
- YYDEBUG(285, *YYCURSOR);
- ++YYCURSOR;
-yy286:
- YYDEBUG(286, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 585 "Zend/zend_ini_scanner.l"
- { /* Comment */
- BEGIN(INITIAL);
- SCNG(lineno)++;
- return END_OF_LINE;
-}
-#line 4248 "Zend/zend_ini_scanner.c"
-yy287:
- YYDEBUG(287, *YYCURSOR);
- yych = *++YYCURSOR;
- if (yych == '\n') goto yy285;
- goto yy286;
-yy288:
- YYDEBUG(288, *YYCURSOR);
- yyaccept = 3;
- YYMARKER = ++YYCURSOR;
- YYFILL(1);
- yych = *YYCURSOR;
- YYDEBUG(289, *YYCURSOR);
- if (yybm[0+yych] & 64) {
- goto yy288;
- }
- if (yych <= ')') {
- if (yych <= '\r') {
- if (yych <= 0x08) {
- if (yych <= 0x00) goto yy244;
- goto yy255;
- } else {
- if (yych <= '\n') goto yy244;
- if (yych <= '\f') goto yy255;
- goto yy244;
- }
- } else {
- if (yych <= '#') {
- if (yych <= 0x1F) goto yy255;
- if (yych <= '"') goto yy244;
- goto yy255;
- } else {
- if (yych <= '$') goto yy260;
- if (yych <= '%') goto yy255;
- goto yy244;
- }
- }
- } else {
- if (yych <= ']') {
- if (yych <= ';') {
- if (yych <= ':') goto yy255;
- goto yy244;
- } else {
- if (yych == '=') goto yy244;
- goto yy255;
- }
- } else {
- if (yych <= '|') {
- if (yych <= '^') goto yy244;
- if (yych <= '{') goto yy255;
- goto yy244;
- } else {
- if (yych == '~') goto yy244;
- goto yy255;
- }
- }
- }
-yy290:
- YYDEBUG(290, *YYCURSOR);
- yyaccept = 3;
- YYMARKER = ++YYCURSOR;
- YYFILL(1);
- yych = *YYCURSOR;
- YYDEBUG(291, *YYCURSOR);
- if (yych <= '.') {
- if (yych <= 0x1F) {
- if (yych <= '\n') {
- if (yych <= 0x00) goto yy244;
- if (yych <= 0x08) goto yy255;
- goto yy244;
- } else {
- if (yych == '\r') goto yy244;
- goto yy255;
- }
- } else {
- if (yych <= '$') {
- if (yych <= '"') goto yy244;
- if (yych <= '#') goto yy255;
- goto yy260;
- } else {
- if (yych <= '%') goto yy255;
- if (yych <= ')') goto yy244;
- if (yych <= '-') goto yy255;
- goto yy288;
- }
- }
- } else {
- if (yych <= '=') {
- if (yych <= ':') {
- if (yych <= '/') goto yy255;
- if (yych <= '9') goto yy290;
- goto yy255;
- } else {
- if (yych == '<') goto yy255;
- goto yy244;
- }
- } else {
- if (yych <= '{') {
- if (yych == '^') goto yy244;
- goto yy255;
- } else {
- if (yych == '}') goto yy255;
- if (yych <= '~') goto yy244;
- goto yy255;
- }
- }
- }
-yy292:
- YYDEBUG(292, *YYCURSOR);
- yyaccept = 3;
- YYMARKER = ++YYCURSOR;
- YYFILL(1);
- yych = *YYCURSOR;
- YYDEBUG(293, *YYCURSOR);
- if (yych <= '/') {
- if (yych <= 0x1F) {
- if (yych <= '\n') {
- if (yych <= 0x00) goto yy244;
- if (yych <= 0x08) goto yy255;
- goto yy244;
- } else {
- if (yych == '\r') goto yy244;
- goto yy255;
- }
- } else {
- if (yych <= '$') {
- if (yych <= '"') goto yy244;
- if (yych <= '#') goto yy255;
- goto yy260;
- } else {
- if (yych <= '%') goto yy255;
- if (yych <= ')') goto yy244;
- goto yy255;
- }
- }
- } else {
- if (yych <= ']') {
- if (yych <= ';') {
- if (yych <= '9') goto yy292;
- if (yych <= ':') goto yy255;
- goto yy244;
- } else {
- if (yych == '=') goto yy244;
- goto yy255;
- }
- } else {
- if (yych <= '|') {
- if (yych <= '^') goto yy244;
- if (yych <= '{') goto yy255;
- goto yy244;
- } else {
- if (yych == '~') goto yy244;
- goto yy255;
- }
- }
- }
-yy294:
- YYDEBUG(294, *YYCURSOR);
- yyaccept = 3;
- YYMARKER = ++YYCURSOR;
- YYFILL(1);
- yych = *YYCURSOR;
- YYDEBUG(295, *YYCURSOR);
- if (yych <= '/') {
- if (yych <= 0x1F) {
- if (yych <= '\n') {
- if (yych <= 0x00) goto yy244;
- if (yych <= 0x08) goto yy255;
- goto yy244;
- } else {
- if (yych == '\r') goto yy244;
- goto yy255;
- }
- } else {
- if (yych <= '$') {
- if (yych <= '"') goto yy244;
- if (yych <= '#') goto yy255;
- goto yy260;
- } else {
- if (yych <= '%') goto yy255;
- if (yych <= ')') goto yy244;
- goto yy255;
- }
- }
- } else {
- if (yych <= ']') {
- if (yych <= ';') {
- if (yych <= '9') goto yy294;
- if (yych <= ':') goto yy255;
- goto yy244;
- } else {
- if (yych == '=') goto yy244;
- goto yy255;
- }
- } else {
- if (yych <= '|') {
- if (yych <= '^') goto yy244;
- if (yych <= '{') goto yy255;
- goto yy244;
- } else {
- if (yych == '~') goto yy244;
- goto yy255;
- }
- }
- }
-yy296:
- YYDEBUG(296, *YYCURSOR);
- ++YYCURSOR;
- YYFILL(1);
- yych = *YYCURSOR;
- YYDEBUG(297, *YYCURSOR);
- if (yybm[0+yych] & 128) {
- goto yy296;
- }
- YYDEBUG(298, *YYCURSOR);
- ++YYCURSOR;
- YYDEBUG(299, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 368 "Zend/zend_ini_scanner.l"
- { /* Raw string */
- /* Eat leading and trailing single quotes */
- if (yytext[0] == '\'' && yytext[yyleng - 1] == '\'') {
- SCNG(yy_text)++;
- yyleng = yyleng - 2;
- }
- RETURN_TOKEN(TC_RAW, yytext, yyleng);
-}
-#line 4475 "Zend/zend_ini_scanner.c"
-yy300:
- YYDEBUG(300, *YYCURSOR);
- ++YYCURSOR;
- YYDEBUG(301, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 401 "Zend/zend_ini_scanner.l"
- { /* Variable start */
- yy_push_state(ST_VARNAME TSRMLS_CC);
- return TC_DOLLAR_CURLY;
-}
-#line 4486 "Zend/zend_ini_scanner.c"
-yy302:
- YYDEBUG(302, *YYCURSOR);
- ++YYCURSOR;
- YYFILL(1);
- yych = *YYCURSOR;
-yy303:
- YYDEBUG(303, *YYCURSOR);
- if (yych == '\t') goto yy302;
- if (yych == ' ') goto yy302;
- goto yy236;
-yy304:
- YYDEBUG(304, *YYCURSOR);
- yych = *++YYCURSOR;
- goto yy233;
-yy305:
- YYDEBUG(305, *YYCURSOR);
- yyaccept = 1;
- YYMARKER = ++YYCURSOR;
- YYFILL(2);
- yych = *YYCURSOR;
-yy306:
- YYDEBUG(306, *YYCURSOR);
- if (yych <= 0x1F) {
- if (yych <= '\n') {
- if (yych <= 0x08) goto yy231;
- if (yych <= '\t') goto yy305;
- goto yy304;
- } else {
- if (yych == '\r') goto yy308;
- goto yy231;
- }
- } else {
- if (yych <= '"') {
- if (yych <= ' ') goto yy305;
- if (yych <= '!') goto yy231;
- } else {
- if (yych == ';') goto yy283;
- goto yy231;
- }
- }
- YYDEBUG(307, *YYCURSOR);
- yych = *++YYCURSOR;
- goto yy238;
-yy308:
- YYDEBUG(308, *YYCURSOR);
- ++YYCURSOR;
- if ((yych = *YYCURSOR) == '\n') goto yy304;
- goto yy233;
- }
-/* *********************************** */
-yyc_ST_VARNAME:
- {
- static const unsigned char yybm[] = {
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 0, 0, 128, 128, 0, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 0, 0, 128, 0, 128, 0, 128,
- 0, 0, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 0, 128, 0, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 0, 128, 128, 0, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 0, 0, 0, 0, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- };
- YYDEBUG(309, *YYCURSOR);
- YYFILL(2);
- yych = *YYCURSOR;
- if (yych <= ')') {
- if (yych <= '"') {
- if (yych <= '\f') {
- if (yych <= 0x08) goto yy311;
- if (yych <= '\n') goto yy313;
- } else {
- if (yych <= '\r') goto yy313;
- if (yych >= '!') goto yy313;
- }
- } else {
- if (yych <= '%') {
- if (yych == '$') goto yy313;
- } else {
- if (yych != '\'') goto yy313;
- }
- }
- } else {
- if (yych <= '[') {
- if (yych <= '<') {
- if (yych == ';') goto yy313;
- } else {
- if (yych <= '=') goto yy313;
- if (yych >= '[') goto yy313;
- }
- } else {
- if (yych <= 'z') {
- if (yych == '^') goto yy313;
- } else {
- if (yych == '}') goto yy315;
- if (yych <= '~') goto yy313;
- }
- }
- }
-yy311:
- YYDEBUG(311, *YYCURSOR);
- ++YYCURSOR;
- yych = *YYCURSOR;
- goto yy318;
-yy312:
- YYDEBUG(312, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 406 "Zend/zend_ini_scanner.l"
- { /* Variable name */
- /* Eat leading whitespace */
- EAT_LEADING_WHITESPACE();
-
- /* Eat trailing whitespace */
- EAT_TRAILING_WHITESPACE();
-
- RETURN_TOKEN(TC_VARNAME, yytext, yyleng);
-}
-#line 4627 "Zend/zend_ini_scanner.c"
-yy313:
- YYDEBUG(313, *YYCURSOR);
- ++YYCURSOR;
- YYDEBUG(314, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 603 "Zend/zend_ini_scanner.l"
- {
- return 0;
-}
-#line 4637 "Zend/zend_ini_scanner.c"
-yy315:
- YYDEBUG(315, *YYCURSOR);
- ++YYCURSOR;
- YYDEBUG(316, *YYCURSOR);
- yyleng = YYCURSOR - SCNG(yy_text);
-#line 416 "Zend/zend_ini_scanner.l"
- { /* Variable end */
- yy_pop_state(TSRMLS_C);
- return '}';
-}
-#line 4648 "Zend/zend_ini_scanner.c"
-yy317:
- YYDEBUG(317, *YYCURSOR);
- ++YYCURSOR;
- YYFILL(1);
- yych = *YYCURSOR;
-yy318:
- YYDEBUG(318, *YYCURSOR);
- if (yybm[0+yych] & 128) {
- goto yy317;
- }
- goto yy312;
- }
-}
-#line 607 "Zend/zend_ini_scanner.l"
-
-}
+/* Generated by re2c 0.13.5 */
+#line 1 "Zend/zend_ini_scanner.l"
+/*
+ +----------------------------------------------------------------------+
+ | Zend Engine |
+ +----------------------------------------------------------------------+
+ | Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 2.00 of the Zend license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.zend.com/license/2_00.txt. |
+ | If you did not receive a copy of the Zend license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@zend.com so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Zeev Suraski <zeev@zend.com> |
+ | Jani Taskinen <jani@php.net> |
+ | Marcus Boerger <helly@php.net> |
+ | Nuno Lopes <nlopess@php.net> |
+ | Scott MacVicar <scottmac@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $Id$ */
+
+#include <errno.h>
+#include "zend.h"
+#include "zend_globals.h"
+#include <zend_ini_parser.h>
+#include "zend_ini_scanner.h"
+
+#if 0
+# define YYDEBUG(s, c) printf("state: %d char: %c\n", s, c)
+#else
+# define YYDEBUG(s, c)
+#endif
+
+#include "zend_ini_scanner_defs.h"
+
+#define YYCTYPE unsigned char
+/* allow the scanner to read one null byte after the end of the string (from ZEND_MMAP_AHEAD)
+ * so that if will be able to terminate to match the current token (e.g. non-enclosed string) */
+#define YYFILL(n) { if (YYCURSOR > YYLIMIT) return 0; }
+#define YYCURSOR SCNG(yy_cursor)
+#define YYLIMIT SCNG(yy_limit)
+#define YYMARKER SCNG(yy_marker)
+
+#define YYGETCONDITION() SCNG(yy_state)
+#define YYSETCONDITION(s) SCNG(yy_state) = s
+
+#define STATE(name) yyc##name
+
+/* emulate flex constructs */
+#define BEGIN(state) YYSETCONDITION(STATE(state))
+#define YYSTATE YYGETCONDITION()
+#define yytext ((char*)SCNG(yy_text))
+#define yyleng SCNG(yy_leng)
+#define yyless(x) do { YYCURSOR = (unsigned char*)yytext + x; \
+ yyleng = (unsigned int)x; } while(0)
+
+/* #define yymore() goto yymore_restart */
+
+/* perform sanity check. If this message is triggered you should
+ increase the ZEND_MMAP_AHEAD value in the zend_streams.h file */
+#define YYMAXFILL 6
+#if ZEND_MMAP_AHEAD < (YYMAXFILL + 1)
+# error ZEND_MMAP_AHEAD should be greater than YYMAXFILL
+#endif
+
+
+/* How it works (for the core ini directives):
+ * ===========================================
+ *
+ * 1. Scanner scans file for tokens and passes them to parser.
+ * 2. Parser parses the tokens and passes the name/value pairs to the callback
+ * function which stores them in the configuration hash table.
+ * 3. Later REGISTER_INI_ENTRIES() is called which triggers the actual
+ * registering of ini entries and uses zend_get_configuration_directive()
+ * to fetch the previously stored name/value pair from configuration hash table
+ * and registers the static ini entries which match the name to the value
+ * into EG(ini_directives) hash table.
+ * 4. PATH section entries are used per-request from down to top, each overriding
+ * previous if one exists. zend_alter_ini_entry() is called for each entry.
+ * Settings in PATH section are ZEND_INI_SYSTEM accessible and thus mimics the
+ * php_admin_* directives used within Apache httpd.conf when PHP is compiled as
+ * module for Apache.
+ * 5. User defined ini files (like .htaccess for apache) are parsed for each request and
+ * stored in separate hash defined by SAPI.
+ */
+
+/* TODO: (ordered by importance :-)
+ * ===============================================================================
+ *
+ * - Separate constant lookup totally from plain strings (using CONSTANT pattern)
+ * - Add #if .. #else .. #endif and ==, !=, <, > , <=, >= operators
+ * - Add #include "some.ini"
+ * - Allow variables to refer to options also when using parse_ini_file()
+ *
+ */
+
+/* Globals Macros */
+#define SCNG INI_SCNG
+#ifdef ZTS
+ZEND_API ts_rsrc_id ini_scanner_globals_id;
+#else
+ZEND_API zend_ini_scanner_globals ini_scanner_globals;
+#endif
+
+/* Eat leading whitespace */
+#define EAT_LEADING_WHITESPACE() \
+ while (yytext[0]) { \
+ if (yytext[0] == ' ' || yytext[0] == '\t') { \
+ SCNG(yy_text)++; \
+ yyleng--; \
+ } else { \
+ break; \
+ } \
+ }
+
+/* Eat trailing whitespace + extra char */
+#define EAT_TRAILING_WHITESPACE_EX(ch) \
+ while (yyleng > 0 && ( \
+ (ch != 'X' && yytext[yyleng - 1] == ch) || \
+ yytext[yyleng - 1] == '\n' || \
+ yytext[yyleng - 1] == '\r' || \
+ yytext[yyleng - 1] == '\t' || \
+ yytext[yyleng - 1] == ' ') \
+ ) { \
+ yyleng--; \
+ }
+
+/* Eat trailing whitespace */
+#define EAT_TRAILING_WHITESPACE() EAT_TRAILING_WHITESPACE_EX('X')
+
+#define zend_ini_copy_value(retval, str, len) \
+ ZVAL_STR(retval, STR_INIT(str, len, 1))
+
+
+#define RETURN_TOKEN(type, str, len) { \
+ zend_ini_copy_value(ini_lval, str, len); \
+ return type; \
+}
+
+static void _yy_push_state(int new_state TSRMLS_DC)
+{
+ zend_stack_push(&SCNG(state_stack), (void *) &YYGETCONDITION(), sizeof(int));
+ YYSETCONDITION(new_state);
+}
+
+#define yy_push_state(state_and_tsrm) _yy_push_state(yyc##state_and_tsrm)
+
+static void yy_pop_state(TSRMLS_D)
+{
+ int *stack_state;
+ zend_stack_top(&SCNG(state_stack), (void **) &stack_state);
+ YYSETCONDITION(*stack_state);
+ zend_stack_del_top(&SCNG(state_stack));
+}
+
+static void yy_scan_buffer(char *str, unsigned int len TSRMLS_DC)
+{
+ YYCURSOR = (YYCTYPE*)str;
+ SCNG(yy_start) = YYCURSOR;
+ YYLIMIT = YYCURSOR + len;
+}
+
+#define ini_filename SCNG(filename)
+
+/* {{{ init_ini_scanner()
+*/
+static int init_ini_scanner(int scanner_mode, zend_file_handle *fh TSRMLS_DC)
+{
+ /* Sanity check */
+ if (scanner_mode != ZEND_INI_SCANNER_NORMAL && scanner_mode != ZEND_INI_SCANNER_RAW) {
+ zend_error(E_WARNING, "Invalid scanner mode");
+ return FAILURE;
+ }
+
+ SCNG(lineno) = 1;
+ SCNG(scanner_mode) = scanner_mode;
+ SCNG(yy_in) = fh;
+
+ if (fh != NULL) {
+ ini_filename = zend_strndup(fh->filename, strlen(fh->filename));
+ } else {
+ ini_filename = NULL;
+ }
+
+ zend_stack_init(&SCNG(state_stack));
+ BEGIN(INITIAL);
+
+ return SUCCESS;
+}
+/* }}} */
+
+/* {{{ shutdown_ini_scanner()
+*/
+void shutdown_ini_scanner(TSRMLS_D)
+{
+ zend_stack_destroy(&SCNG(state_stack));
+ if (ini_filename) {
+ free(ini_filename);
+ }
+}
+/* }}} */
+
+/* {{{ zend_ini_scanner_get_lineno()
+*/
+int zend_ini_scanner_get_lineno(TSRMLS_D)
+{
+ return SCNG(lineno);
+}
+/* }}} */
+
+/* {{{ zend_ini_scanner_get_filename()
+*/
+char *zend_ini_scanner_get_filename(TSRMLS_D)
+{
+ return ini_filename ? ini_filename : "Unknown";
+}
+/* }}} */
+
+/* {{{ zend_ini_open_file_for_scanning()
+*/
+int zend_ini_open_file_for_scanning(zend_file_handle *fh, int scanner_mode TSRMLS_DC)
+{
+ char *buf;
+ size_t size;
+
+ if (zend_stream_fixup(fh, &buf, &size TSRMLS_CC) == FAILURE) {
+ return FAILURE;
+ }
+
+ if (init_ini_scanner(scanner_mode, fh TSRMLS_CC) == FAILURE) {
+ zend_file_handle_dtor(fh TSRMLS_CC);
+ return FAILURE;
+ }
+
+ yy_scan_buffer(buf, size TSRMLS_CC);
+
+ return SUCCESS;
+}
+/* }}} */
+
+/* {{{ zend_ini_prepare_string_for_scanning()
+*/
+int zend_ini_prepare_string_for_scanning(char *str, int scanner_mode TSRMLS_DC)
+{
+ int len = strlen(str);
+
+ if (init_ini_scanner(scanner_mode, NULL TSRMLS_CC) == FAILURE) {
+ return FAILURE;
+ }
+
+ yy_scan_buffer(str, len TSRMLS_CC);
+
+ return SUCCESS;
+}
+/* }}} */
+
+/* {{{ zend_ini_escape_string()
+ */
+static void zend_ini_escape_string(zval *lval, char *str, int len, char quote_type TSRMLS_DC)
+{
+ register char *s, *t;
+ char *end;
+
+ zend_ini_copy_value(lval, str, len);
+
+ /* convert escape sequences */
+ s = t = Z_STRVAL_P(lval);
+ end = s + Z_STRLEN_P(lval);
+
+ while (s < end) {
+ if (*s == '\\') {
+ s++;
+ if (s >= end) {
+ *t++ = '\\';
+ continue;
+ }
+ switch (*s) {
+ case '"':
+ if (*s != quote_type) {
+ *t++ = '\\';
+ *t++ = *s;
+ break;
+ }
+ case '\\':
+ case '$':
+ *t++ = *s;
+ Z_STRLEN_P(lval)--;
+ break;
+ default:
+ *t++ = '\\';
+ *t++ = *s;
+ break;
+ }
+ } else {
+ *t++ = *s;
+ }
+ if (*s == '\n' || (*s == '\r' && (*(s+1) != '\n'))) {
+ SCNG(lineno)++;
+ }
+ s++;
+ }
+ *t = 0;
+}
+/* }}} */
+
+int ini_lex(zval *ini_lval TSRMLS_DC)
+{
+restart:
+ SCNG(yy_text) = YYCURSOR;
+
+/* yymore_restart: */
+ /* detect EOF */
+ if (YYCURSOR >= YYLIMIT) {
+ if (YYSTATE == STATE(ST_VALUE) || YYSTATE == STATE(ST_RAW)) {
+ BEGIN(INITIAL);
+ return END_OF_LINE;
+ }
+ return 0;
+ }
+
+ /* Eat any UTF-8 BOM we find in the first 3 bytes */
+ if (YYCURSOR == SCNG(yy_start) && YYCURSOR + 3 < YYLIMIT) {
+ if (memcmp(YYCURSOR, "\xef\xbb\xbf", 3) == 0) {
+ YYCURSOR += 3;
+ goto restart;
+ }
+ }
+
+#line 335 "Zend/zend_ini_scanner.c"
+{
+ YYCTYPE yych;
+ unsigned int yyaccept = 0;
+ if (YYGETCONDITION() < 4) {
+ if (YYGETCONDITION() < 2) {
+ if (YYGETCONDITION() < 1) {
+ goto yyc_INITIAL;
+ } else {
+ goto yyc_ST_OFFSET;
+ }
+ } else {
+ if (YYGETCONDITION() < 3) {
+ goto yyc_ST_SECTION_VALUE;
+ } else {
+ goto yyc_ST_VALUE;
+ }
+ }
+ } else {
+ if (YYGETCONDITION() < 6) {
+ if (YYGETCONDITION() < 5) {
+ goto yyc_ST_SECTION_RAW;
+ } else {
+ goto yyc_ST_DOUBLE_QUOTES;
+ }
+ } else {
+ if (YYGETCONDITION() < 7) {
+ goto yyc_ST_VARNAME;
+ } else {
+ goto yyc_ST_RAW;
+ }
+ }
+ }
+/* *********************************** */
+yyc_INITIAL:
+ {
+ static const unsigned char yybm[] = {
+ 144, 144, 144, 144, 144, 144, 144, 144,
+ 144, 160, 0, 144, 144, 0, 144, 144,
+ 144, 144, 144, 144, 144, 144, 144, 144,
+ 144, 144, 144, 144, 144, 144, 144, 144,
+ 240, 128, 128, 144, 128, 144, 128, 144,
+ 128, 128, 144, 144, 144, 144, 144, 144,
+ 144, 144, 144, 144, 144, 144, 144, 144,
+ 144, 144, 144, 128, 144, 128, 144, 144,
+ 144, 144, 144, 144, 144, 144, 144, 144,
+ 144, 144, 144, 144, 144, 144, 144, 144,
+ 144, 144, 144, 144, 144, 144, 144, 144,
+ 144, 144, 144, 128, 144, 144, 128, 144,
+ 144, 144, 144, 144, 144, 144, 144, 144,
+ 144, 144, 144, 144, 144, 144, 144, 144,
+ 144, 144, 144, 144, 144, 144, 144, 144,
+ 144, 144, 144, 128, 128, 128, 128, 144,
+ 144, 144, 144, 144, 144, 144, 144, 144,
+ 144, 144, 144, 144, 144, 144, 144, 144,
+ 144, 144, 144, 144, 144, 144, 144, 144,
+ 144, 144, 144, 144, 144, 144, 144, 144,
+ 144, 144, 144, 144, 144, 144, 144, 144,
+ 144, 144, 144, 144, 144, 144, 144, 144,
+ 144, 144, 144, 144, 144, 144, 144, 144,
+ 144, 144, 144, 144, 144, 144, 144, 144,
+ 144, 144, 144, 144, 144, 144, 144, 144,
+ 144, 144, 144, 144, 144, 144, 144, 144,
+ 144, 144, 144, 144, 144, 144, 144, 144,
+ 144, 144, 144, 144, 144, 144, 144, 144,
+ 144, 144, 144, 144, 144, 144, 144, 144,
+ 144, 144, 144, 144, 144, 144, 144, 144,
+ 144, 144, 144, 144, 144, 144, 144, 144,
+ 144, 144, 144, 144, 144, 144, 144, 144,
+ };
+
+ YYDEBUG(0, *YYCURSOR);
+ YYFILL(5);
+ yych = *YYCURSOR;
+ YYDEBUG(-1, yych);
+ switch (yych) {
+ case '\t': goto yy4;
+ case '\n': goto yy6;
+ case '\r': goto yy8;
+ case ' ': goto yy9;
+ case '!':
+ case '"':
+ case '$':
+ case '&':
+ case '(':
+ case ')':
+ case '^':
+ case '{':
+ case '|':
+ case '}':
+ case '~': goto yy10;
+ case '#': goto yy12;
+ case '%':
+ case '\'':
+ case '*':
+ case '+':
+ case ',':
+ case '-':
+ case '.':
+ case '/':
+ case ':':
+ case '<':
+ case '>':
+ case '?':
+ case '@':
+ case ']': goto yy13;
+ case ';': goto yy14;
+ case '=': goto yy16;
+ case 'F':
+ case 'f': goto yy18;
+ case 'N':
+ case 'n': goto yy19;
+ case 'O':
+ case 'o': goto yy20;
+ case 'T':
+ case 't': goto yy21;
+ case 'Y':
+ case 'y': goto yy22;
+ case '[': goto yy23;
+ default: goto yy2;
+ }
+yy2:
+ YYDEBUG(2, *YYCURSOR);
+ ++YYCURSOR;
+ yych = *YYCURSOR;
+ goto yy26;
+yy3:
+ YYDEBUG(3, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 427 "Zend/zend_ini_scanner.l"
+ { /* Get option name */
+ /* Eat leading whitespace */
+ EAT_LEADING_WHITESPACE();
+
+ /* Eat trailing whitespace */
+ EAT_TRAILING_WHITESPACE();
+
+ RETURN_TOKEN(TC_LABEL, yytext, yyleng);
+}
+#line 474 "Zend/zend_ini_scanner.c"
+yy4:
+ YYDEBUG(4, *YYCURSOR);
+ yyaccept = 0;
+ yych = *(YYMARKER = ++YYCURSOR);
+ goto yy68;
+yy5:
+ YYDEBUG(5, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 573 "Zend/zend_ini_scanner.l"
+ {
+ /* eat whitespace */
+ goto restart;
+}
+#line 488 "Zend/zend_ini_scanner.c"
+yy6:
+ YYDEBUG(6, *YYCURSOR);
+ ++YYCURSOR;
+yy7:
+ YYDEBUG(7, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 578 "Zend/zend_ini_scanner.l"
+ {
+ SCNG(lineno)++;
+ return END_OF_LINE;
+}
+#line 500 "Zend/zend_ini_scanner.c"
+yy8:
+ YYDEBUG(8, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == '\n') goto yy71;
+ goto yy7;
+yy9:
+ YYDEBUG(9, *YYCURSOR);
+ yyaccept = 1;
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yych <= ' ') {
+ if (yych <= '\n') {
+ if (yych <= 0x08) goto yy26;
+ if (yych <= '\t') goto yy67;
+ goto yy71;
+ } else {
+ if (yych == '\r') goto yy72;
+ if (yych <= 0x1F) goto yy26;
+ goto yy69;
+ }
+ } else {
+ if (yych <= ':') {
+ if (yych == '#') goto yy58;
+ goto yy26;
+ } else {
+ if (yych <= ';') goto yy53;
+ if (yych == '=') goto yy51;
+ goto yy26;
+ }
+ }
+yy10:
+ YYDEBUG(10, *YYCURSOR);
+ ++YYCURSOR;
+ YYDEBUG(11, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 501 "Zend/zend_ini_scanner.l"
+ { /* Disallow these chars outside option values */
+ return yytext[0];
+}
+#line 539 "Zend/zend_ini_scanner.c"
+yy12:
+ YYDEBUG(12, *YYCURSOR);
+ yyaccept = 1;
+ yych = *(YYMARKER = ++YYCURSOR);
+ goto yy59;
+yy13:
+ YYDEBUG(13, *YYCURSOR);
+ yych = *++YYCURSOR;
+ goto yy26;
+yy14:
+ YYDEBUG(14, *YYCURSOR);
+ yyaccept = 2;
+ yych = *(YYMARKER = ++YYCURSOR);
+ goto yy54;
+ YYDEBUG(15, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 601 "Zend/zend_ini_scanner.l"
+ {
+ return 0;
+}
+#line 560 "Zend/zend_ini_scanner.c"
+yy16:
+ YYDEBUG(16, *YYCURSOR);
+ ++YYCURSOR;
+ yych = *YYCURSOR;
+ goto yy52;
+yy17:
+ YYDEBUG(17, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 437 "Zend/zend_ini_scanner.l"
+ { /* Start option value */
+ if (SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW) {
+ yy_push_state(ST_RAW TSRMLS_CC);
+ } else {
+ yy_push_state(ST_VALUE TSRMLS_CC);
+ }
+ return '=';
+}
+#line 578 "Zend/zend_ini_scanner.c"
+yy18:
+ YYDEBUG(18, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'A') goto yy48;
+ if (yych == 'a') goto yy48;
+ goto yy26;
+yy19:
+ YYDEBUG(19, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych <= 'U') {
+ if (yych == 'O') goto yy44;
+ if (yych <= 'T') goto yy26;
+ goto yy45;
+ } else {
+ if (yych <= 'o') {
+ if (yych <= 'n') goto yy26;
+ goto yy44;
+ } else {
+ if (yych == 'u') goto yy45;
+ goto yy26;
+ }
+ }
+yy20:
+ YYDEBUG(20, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych <= 'N') {
+ if (yych == 'F') goto yy38;
+ if (yych <= 'M') goto yy26;
+ goto yy31;
+ } else {
+ if (yych <= 'f') {
+ if (yych <= 'e') goto yy26;
+ goto yy38;
+ } else {
+ if (yych == 'n') goto yy31;
+ goto yy26;
+ }
+ }
+yy21:
+ YYDEBUG(21, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'R') goto yy36;
+ if (yych == 'r') goto yy36;
+ goto yy26;
+yy22:
+ YYDEBUG(22, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'E') goto yy27;
+ if (yych == 'e') goto yy27;
+ goto yy26;
+yy23:
+ YYDEBUG(23, *YYCURSOR);
+ ++YYCURSOR;
+ YYDEBUG(24, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 356 "Zend/zend_ini_scanner.l"
+ { /* Section start */
+ /* Enter section data lookup state */
+ if (SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW) {
+ yy_push_state(ST_SECTION_RAW TSRMLS_CC);
+ } else {
+ yy_push_state(ST_SECTION_VALUE TSRMLS_CC);
+ }
+ return TC_SECTION;
+}
+#line 644 "Zend/zend_ini_scanner.c"
+yy25:
+ YYDEBUG(25, *YYCURSOR);
+ ++YYCURSOR;
+ YYFILL(1);
+ yych = *YYCURSOR;
+yy26:
+ YYDEBUG(26, *YYCURSOR);
+ if (yybm[0+yych] & 16) {
+ goto yy25;
+ }
+ if (yych == '[') goto yy28;
+ goto yy3;
+yy27:
+ YYDEBUG(27, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'S') goto yy31;
+ if (yych == 's') goto yy31;
+ goto yy26;
+yy28:
+ YYDEBUG(28, *YYCURSOR);
+ ++YYCURSOR;
+ YYFILL(1);
+ yych = *YYCURSOR;
+ YYDEBUG(29, *YYCURSOR);
+ if (yybm[0+yych] & 32) {
+ goto yy28;
+ }
+ YYDEBUG(30, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 381 "Zend/zend_ini_scanner.l"
+ { /* Start of option with offset */
+ /* Eat leading whitespace */
+ EAT_LEADING_WHITESPACE();
+
+ /* Eat trailing whitespace and [ */
+ EAT_TRAILING_WHITESPACE_EX('[');
+
+ /* Enter offset lookup state */
+ yy_push_state(ST_OFFSET TSRMLS_CC);
+
+ RETURN_TOKEN(TC_OFFSET, yytext, yyleng);
+}
+#line 687 "Zend/zend_ini_scanner.c"
+yy31:
+ YYDEBUG(31, *YYCURSOR);
+ ++YYCURSOR;
+ YYFILL(1);
+ yych = *YYCURSOR;
+ YYDEBUG(32, *YYCURSOR);
+ if (yybm[0+yych] & 64) {
+ goto yy31;
+ }
+ if (yych <= '\'') {
+ if (yych <= ' ') {
+ if (yych <= '\n') {
+ if (yych <= 0x08) goto yy25;
+ if (yych <= '\t') goto yy34;
+ } else {
+ if (yych != '\r') goto yy25;
+ }
+ } else {
+ if (yych <= '$') {
+ if (yych == '#') goto yy25;
+ } else {
+ if (yych != '&') goto yy25;
+ }
+ }
+ } else {
+ if (yych <= 'Z') {
+ if (yych <= ';') {
+ if (yych <= ')') goto yy33;
+ if (yych <= ':') goto yy25;
+ } else {
+ if (yych != '=') goto yy25;
+ }
+ } else {
+ if (yych <= '^') {
+ if (yych <= '[') goto yy28;
+ if (yych <= ']') goto yy25;
+ } else {
+ if (yych <= 'z') goto yy25;
+ if (yych >= 0x7F) goto yy25;
+ }
+ }
+ }
+yy33:
+ YYDEBUG(33, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 419 "Zend/zend_ini_scanner.l"
+ { /* TRUE value (when used outside option value/offset this causes parse error!) */
+ RETURN_TOKEN(BOOL_TRUE, "1", 1);
+}
+#line 737 "Zend/zend_ini_scanner.c"
+yy34:
+ YYDEBUG(34, *YYCURSOR);
+ ++YYCURSOR;
+ YYFILL(1);
+ yych = *YYCURSOR;
+ YYDEBUG(35, *YYCURSOR);
+ if (yych == '\t') goto yy34;
+ if (yych == ' ') goto yy34;
+ goto yy33;
+yy36:
+ YYDEBUG(36, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'U') goto yy37;
+ if (yych != 'u') goto yy26;
+yy37:
+ YYDEBUG(37, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'E') goto yy31;
+ if (yych == 'e') goto yy31;
+ goto yy26;
+yy38:
+ YYDEBUG(38, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'F') goto yy39;
+ if (yych != 'f') goto yy26;
+yy39:
+ YYDEBUG(39, *YYCURSOR);
+ ++YYCURSOR;
+ YYFILL(1);
+ yych = *YYCURSOR;
+ YYDEBUG(40, *YYCURSOR);
+ if (yych <= '&') {
+ if (yych <= 0x1F) {
+ if (yych <= '\n') {
+ if (yych <= 0x08) goto yy25;
+ if (yych <= '\t') goto yy42;
+ } else {
+ if (yych != '\r') goto yy25;
+ }
+ } else {
+ if (yych <= '#') {
+ if (yych <= ' ') goto yy39;
+ if (yych >= '#') goto yy25;
+ } else {
+ if (yych == '%') goto yy25;
+ }
+ }
+ } else {
+ if (yych <= '=') {
+ if (yych <= ':') {
+ if (yych <= '\'') goto yy25;
+ if (yych >= '*') goto yy25;
+ } else {
+ if (yych == '<') goto yy25;
+ }
+ } else {
+ if (yych <= ']') {
+ if (yych == '[') goto yy28;
+ goto yy25;
+ } else {
+ if (yych <= '^') goto yy41;
+ if (yych <= 'z') goto yy25;
+ if (yych >= 0x7F) goto yy25;
+ }
+ }
+ }
+yy41:
+ YYDEBUG(41, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 423 "Zend/zend_ini_scanner.l"
+ { /* FALSE value (when used outside option value/offset this causes parse error!)*/
+ RETURN_TOKEN(BOOL_FALSE, "", 0);
+}
+#line 811 "Zend/zend_ini_scanner.c"
+yy42:
+ YYDEBUG(42, *YYCURSOR);
+ ++YYCURSOR;
+ YYFILL(1);
+ yych = *YYCURSOR;
+ YYDEBUG(43, *YYCURSOR);
+ if (yych == '\t') goto yy42;
+ if (yych == ' ') goto yy42;
+ goto yy41;
+yy44:
+ YYDEBUG(44, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych <= '\'') {
+ if (yych <= 0x1F) {
+ if (yych <= '\n') {
+ if (yych <= 0x08) goto yy26;
+ if (yych <= '\t') goto yy42;
+ goto yy41;
+ } else {
+ if (yych == '\r') goto yy41;
+ goto yy26;
+ }
+ } else {
+ if (yych <= '#') {
+ if (yych <= ' ') goto yy39;
+ if (yych <= '"') goto yy41;
+ goto yy26;
+ } else {
+ if (yych == '%') goto yy26;
+ if (yych <= '&') goto yy41;
+ goto yy26;
+ }
+ }
+ } else {
+ if (yych <= 'N') {
+ if (yych <= ';') {
+ if (yych <= ')') goto yy41;
+ if (yych <= ':') goto yy26;
+ goto yy41;
+ } else {
+ if (yych == '=') goto yy41;
+ if (yych <= 'M') goto yy26;
+ goto yy47;
+ }
+ } else {
+ if (yych <= 'm') {
+ if (yych == '^') goto yy41;
+ goto yy26;
+ } else {
+ if (yych <= 'n') goto yy47;
+ if (yych <= 'z') goto yy26;
+ if (yych <= '~') goto yy41;
+ goto yy26;
+ }
+ }
+ }
+yy45:
+ YYDEBUG(45, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'L') goto yy46;
+ if (yych != 'l') goto yy26;
+yy46:
+ YYDEBUG(46, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'L') goto yy39;
+ if (yych == 'l') goto yy39;
+ goto yy26;
+yy47:
+ YYDEBUG(47, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'E') goto yy39;
+ if (yych == 'e') goto yy39;
+ goto yy26;
+yy48:
+ YYDEBUG(48, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'L') goto yy49;
+ if (yych != 'l') goto yy26;
+yy49:
+ YYDEBUG(49, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'S') goto yy50;
+ if (yych != 's') goto yy26;
+yy50:
+ YYDEBUG(50, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == 'E') goto yy39;
+ if (yych == 'e') goto yy39;
+ goto yy26;
+yy51:
+ YYDEBUG(51, *YYCURSOR);
+ ++YYCURSOR;
+ YYFILL(1);
+ yych = *YYCURSOR;
+yy52:
+ YYDEBUG(52, *YYCURSOR);
+ if (yych == '\t') goto yy51;
+ if (yych == ' ') goto yy51;
+ goto yy17;
+yy53:
+ YYDEBUG(53, *YYCURSOR);
+ ++YYCURSOR;
+ YYFILL(2);
+ yych = *YYCURSOR;
+yy54:
+ YYDEBUG(54, *YYCURSOR);
+ if (yybm[0+yych] & 128) {
+ goto yy53;
+ }
+ if (yych >= '\r') goto yy57;
+yy55:
+ YYDEBUG(55, *YYCURSOR);
+ ++YYCURSOR;
+yy56:
+ YYDEBUG(56, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 583 "Zend/zend_ini_scanner.l"
+ { /* Comment */
+ BEGIN(INITIAL);
+ SCNG(lineno)++;
+ return END_OF_LINE;
+}
+#line 934 "Zend/zend_ini_scanner.c"
+yy57:
+ YYDEBUG(57, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == '\n') goto yy55;
+ goto yy56;
+yy58:
+ YYDEBUG(58, *YYCURSOR);
+ yyaccept = 1;
+ YYMARKER = ++YYCURSOR;
+ YYFILL(2);
+ yych = *YYCURSOR;
+yy59:
+ YYDEBUG(59, *YYCURSOR);
+ if (yych <= '\'') {
+ if (yych <= ' ') {
+ if (yych <= '\n') {
+ if (yych <= 0x08) goto yy58;
+ if (yych >= '\n') goto yy64;
+ } else {
+ if (yych == '\r') goto yy66;
+ goto yy58;
+ }
+ } else {
+ if (yych <= '$') {
+ if (yych == '#') goto yy58;
+ } else {
+ if (yych != '&') goto yy58;
+ }
+ }
+ } else {
+ if (yych <= 'Z') {
+ if (yych <= ';') {
+ if (yych <= ')') goto yy60;
+ if (yych <= ':') goto yy58;
+ } else {
+ if (yych != '=') goto yy58;
+ }
+ } else {
+ if (yych <= '^') {
+ if (yych <= '[') goto yy62;
+ if (yych <= ']') goto yy58;
+ } else {
+ if (yych <= 'z') goto yy58;
+ if (yych >= 0x7F) goto yy58;
+ }
+ }
+ }
+yy60:
+ YYDEBUG(60, *YYCURSOR);
+ ++YYCURSOR;
+ YYFILL(2);
+ yych = *YYCURSOR;
+ YYDEBUG(61, *YYCURSOR);
+ if (yych == '\n') goto yy64;
+ if (yych == '\r') goto yy66;
+ goto yy60;
+yy62:
+ YYDEBUG(62, *YYCURSOR);
+ yyaccept = 3;
+ YYMARKER = ++YYCURSOR;
+ YYFILL(2);
+ yych = *YYCURSOR;
+ YYDEBUG(63, *YYCURSOR);
+ if (yych <= '\f') {
+ if (yych <= 0x08) goto yy60;
+ if (yych <= '\t') goto yy62;
+ if (yych >= '\v') goto yy60;
+ } else {
+ if (yych <= '\r') goto yy66;
+ if (yych == ' ') goto yy62;
+ goto yy60;
+ }
+yy64:
+ YYDEBUG(64, *YYCURSOR);
+ ++YYCURSOR;
+yy65:
+ YYDEBUG(65, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 589 "Zend/zend_ini_scanner.l"
+ { /* #Comment */
+ zend_error(E_DEPRECATED, "Comments starting with '#' are deprecated in %s on line %d", zend_ini_scanner_get_filename(TSRMLS_C), SCNG(lineno));
+ BEGIN(INITIAL);
+ SCNG(lineno)++;
+ return END_OF_LINE;
+}
+#line 1020 "Zend/zend_ini_scanner.c"
+yy66:
+ YYDEBUG(66, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == '\n') goto yy64;
+ goto yy65;
+yy67:
+ YYDEBUG(67, *YYCURSOR);
+ yyaccept = 0;
+ YYMARKER = ++YYCURSOR;
+ YYFILL(2);
+ yych = *YYCURSOR;
+yy68:
+ YYDEBUG(68, *YYCURSOR);
+ if (yych <= ' ') {
+ if (yych <= '\n') {
+ if (yych <= 0x08) goto yy5;
+ if (yych <= '\t') goto yy67;
+ goto yy71;
+ } else {
+ if (yych == '\r') goto yy72;
+ if (yych <= 0x1F) goto yy5;
+ goto yy67;
+ }
+ } else {
+ if (yych <= ':') {
+ if (yych == '#') goto yy60;
+ goto yy5;
+ } else {
+ if (yych <= ';') goto yy53;
+ if (yych == '=') goto yy51;
+ goto yy5;
+ }
+ }
+yy69:
+ YYDEBUG(69, *YYCURSOR);
+ yyaccept = 1;
+ YYMARKER = ++YYCURSOR;
+ YYFILL(2);
+ yych = *YYCURSOR;
+ YYDEBUG(70, *YYCURSOR);
+ if (yych <= '&') {
+ if (yych <= 0x1F) {
+ if (yych <= '\n') {
+ if (yych <= 0x08) goto yy25;
+ if (yych <= '\t') goto yy67;
+ } else {
+ if (yych == '\r') goto yy72;
+ goto yy25;
+ }
+ } else {
+ if (yych <= '#') {
+ if (yych <= ' ') goto yy69;
+ if (yych <= '"') goto yy3;
+ goto yy58;
+ } else {
+ if (yych == '%') goto yy25;
+ goto yy3;
+ }
+ }
+ } else {
+ if (yych <= '=') {
+ if (yych <= ':') {
+ if (yych <= '\'') goto yy25;
+ if (yych <= ')') goto yy3;
+ goto yy25;
+ } else {
+ if (yych <= ';') goto yy53;
+ if (yych <= '<') goto yy25;
+ goto yy51;
+ }
+ } else {
+ if (yych <= ']') {
+ if (yych == '[') goto yy28;
+ goto yy25;
+ } else {
+ if (yych <= '^') goto yy3;
+ if (yych <= 'z') goto yy25;
+ if (yych <= '~') goto yy3;
+ goto yy25;
+ }
+ }
+ }
+yy71:
+ YYDEBUG(71, *YYCURSOR);
+ yych = *++YYCURSOR;
+ goto yy7;
+yy72:
+ YYDEBUG(72, *YYCURSOR);
+ ++YYCURSOR;
+ if ((yych = *YYCURSOR) == '\n') goto yy71;
+ goto yy7;
+ }
+/* *********************************** */
+yyc_ST_DOUBLE_QUOTES:
+ {
+ static const unsigned char yybm[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 128, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 128, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ };
+ YYDEBUG(73, *YYCURSOR);
+ YYFILL(2);
+ yych = *YYCURSOR;
+ if (yych == '"') goto yy77;
+ if (yych == '$') goto yy79;
+ YYDEBUG(75, *YYCURSOR);
+ ++YYCURSOR;
+yy76:
+ YYDEBUG(76, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 533 "Zend/zend_ini_scanner.l"
+ { /* Escape double quoted string contents */
+ if (YYCURSOR > YYLIMIT) {
+ return 0;
+ }
+
+ while (YYCURSOR < YYLIMIT) {
+ switch (*YYCURSOR++) {
+ case '"':
+ if (YYCURSOR < YYLIMIT && YYCURSOR[-2] == '\\' && *YYCURSOR != '\r' && *YYCURSOR != '\n') {
+ continue;
+ }
+ break;
+ case '$':
+ if (*YYCURSOR == '{') {
+ break;
+ }
+ continue;
+ case '\\':
+ if (YYCURSOR < YYLIMIT && *YYCURSOR != '"') {
+ YYCURSOR++;
+ }
+ /* fall through */
+ default:
+ continue;
+ }
+
+ YYCURSOR--;
+ break;
+ }
+
+ yyleng = YYCURSOR - SCNG(yy_text);
+
+ zend_ini_escape_string(ini_lval, yytext, yyleng, '"' TSRMLS_CC);
+ return TC_QUOTED_STRING;
+}
+#line 1196 "Zend/zend_ini_scanner.c"
+yy77:
+ YYDEBUG(77, *YYCURSOR);
+ ++YYCURSOR;
+ yych = *YYCURSOR;
+ goto yy83;
+yy78:
+ YYDEBUG(78, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 528 "Zend/zend_ini_scanner.l"
+ { /* Double quoted '"' string ends */
+ yy_pop_state(TSRMLS_C);
+ return '"';
+}
+#line 1210 "Zend/zend_ini_scanner.c"
+yy79:
+ YYDEBUG(79, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych != '{') goto yy76;
+ YYDEBUG(80, *YYCURSOR);
+ ++YYCURSOR;
+ YYDEBUG(81, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 399 "Zend/zend_ini_scanner.l"
+ { /* Variable start */
+ yy_push_state(ST_VARNAME TSRMLS_CC);
+ return TC_DOLLAR_CURLY;
+}
+#line 1224 "Zend/zend_ini_scanner.c"
+yy82:
+ YYDEBUG(82, *YYCURSOR);
+ ++YYCURSOR;
+ YYFILL(1);
+ yych = *YYCURSOR;
+yy83:
+ YYDEBUG(83, *YYCURSOR);
+ if (yybm[0+yych] & 128) {
+ goto yy82;
+ }
+ goto yy78;
+ }
+/* *********************************** */
+yyc_ST_OFFSET:
+ {
+ static const unsigned char yybm[] = {
+ 66, 66, 66, 66, 66, 66, 66, 66,
+ 66, 194, 64, 66, 66, 64, 66, 66,
+ 66, 66, 66, 66, 66, 66, 66, 66,
+ 66, 66, 66, 66, 66, 66, 66, 66,
+ 194, 66, 64, 66, 68, 66, 66, 0,
+ 66, 66, 66, 66, 66, 66, 66, 66,
+ 114, 114, 114, 114, 114, 114, 114, 114,
+ 114, 114, 66, 64, 66, 66, 66, 66,
+ 66, 82, 82, 82, 82, 82, 82, 82,
+ 82, 82, 82, 82, 82, 82, 82, 82,
+ 82, 82, 82, 82, 82, 82, 82, 82,
+ 82, 82, 82, 66, 72, 64, 66, 82,
+ 66, 82, 82, 82, 82, 82, 82, 82,
+ 82, 82, 82, 82, 82, 82, 82, 82,
+ 82, 82, 82, 82, 82, 82, 82, 82,
+ 82, 82, 82, 66, 66, 66, 66, 66,
+ 66, 66, 66, 66, 66, 66, 66, 66,
+ 66, 66, 66, 66, 66, 66, 66, 66,
+ 66, 66, 66, 66, 66, 66, 66, 66,
+ 66, 66, 66, 66, 66, 66, 66, 66,
+ 66, 66, 66, 66, 66, 66, 66, 66,
+ 66, 66, 66, 66, 66, 66, 66, 66,
+ 66, 66, 66, 66, 66, 66, 66, 66,
+ 66, 66, 66, 66, 66, 66, 66, 66,
+ 66, 66, 66, 66, 66, 66, 66, 66,
+ 66, 66, 66, 66, 66, 66, 66, 66,
+ 66, 66, 66, 66, 66, 66, 66, 66,
+ 66, 66, 66, 66, 66, 66, 66, 66,
+ 66, 66, 66, 66, 66, 66, 66, 66,
+ 66, 66, 66, 66, 66, 66, 66, 66,
+ 66, 66, 66, 66, 66, 66, 66, 66,
+ 66, 66, 66, 66, 66, 66, 66, 66,
+ };
+ YYDEBUG(84, *YYCURSOR);
+ YYFILL(2);
+ yych = *YYCURSOR;
+ if (yych <= '-') {
+ if (yych <= ' ') {
+ if (yych <= '\n') {
+ if (yych <= 0x08) goto yy86;
+ if (yych <= '\t') goto yy88;
+ goto yy89;
+ } else {
+ if (yych == '\r') goto yy89;
+ if (yych >= ' ') goto yy88;
+ }
+ } else {
+ if (yych <= '$') {
+ if (yych == '"') goto yy91;
+ if (yych >= '$') goto yy93;
+ } else {
+ if (yych == '\'') goto yy94;
+ if (yych >= '-') goto yy95;
+ }
+ }
+ } else {
+ if (yych <= 'Z') {
+ if (yych <= '9') {
+ if (yych <= '.') goto yy96;
+ if (yych >= '0') goto yy97;
+ } else {
+ if (yych == ';') goto yy89;
+ if (yych >= 'A') goto yy99;
+ }
+ } else {
+ if (yych <= '^') {
+ if (yych <= '[') goto yy86;
+ if (yych <= '\\') goto yy101;
+ if (yych <= ']') goto yy102;
+ } else {
+ if (yych == '`') goto yy86;
+ if (yych <= 'z') goto yy99;
+ }
+ }
+ }
+yy86:
+ YYDEBUG(86, *YYCURSOR);
+ yyaccept = 0;
+ yych = *(YYMARKER = ++YYCURSOR);
+ goto yy105;
+yy87:
+ YYDEBUG(87, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 519 "Zend/zend_ini_scanner.l"
+ { /* Get rest as section/offset value */
+ RETURN_TOKEN(TC_STRING, yytext, yyleng);
+}
+#line 1328 "Zend/zend_ini_scanner.c"
+yy88:
+ YYDEBUG(88, *YYCURSOR);
+ yyaccept = 0;
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yybm[0+yych] & 128) {
+ goto yy131;
+ }
+ if (yych == '"') goto yy133;
+ if (yych == ']') goto yy134;
+ goto yy105;
+yy89:
+ YYDEBUG(89, *YYCURSOR);
+ ++YYCURSOR;
+yy90:
+ YYDEBUG(90, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 601 "Zend/zend_ini_scanner.l"
+ {
+ return 0;
+}
+#line 1349 "Zend/zend_ini_scanner.c"
+yy91:
+ YYDEBUG(91, *YYCURSOR);
+ ++YYCURSOR;
+yy92:
+ YYDEBUG(92, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 523 "Zend/zend_ini_scanner.l"
+ { /* Double quoted '"' string start */
+ yy_push_state(ST_DOUBLE_QUOTES TSRMLS_CC);
+ return '"';
+}
+#line 1361 "Zend/zend_ini_scanner.c"
+yy93:
+ YYDEBUG(93, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych <= '\\') {
+ if (yych <= 0x00) goto yy90;
+ if (yych <= '[') goto yy104;
+ goto yy109;
+ } else {
+ if (yych == '{') goto yy129;
+ goto yy104;
+ }
+yy94:
+ YYDEBUG(94, *YYCURSOR);
+ yyaccept = 1;
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yybm[0+yych] & 64) {
+ goto yy125;
+ }
+ goto yy90;
+yy95:
+ YYDEBUG(95, *YYCURSOR);
+ yyaccept = 0;
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yych <= '/') goto yy105;
+ if (yych <= '9') goto yy123;
+ goto yy105;
+yy96:
+ YYDEBUG(96, *YYCURSOR);
+ yyaccept = 0;
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yych <= '/') goto yy105;
+ if (yych <= '9') goto yy121;
+ goto yy105;
+yy97:
+ YYDEBUG(97, *YYCURSOR);
+ yyaccept = 2;
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yych <= '\'') {
+ if (yych <= '\r') {
+ if (yych == '\n') goto yy98;
+ if (yych <= '\f') goto yy105;
+ } else {
+ if (yych == '"') goto yy98;
+ if (yych <= '&') goto yy105;
+ }
+ } else {
+ if (yych <= '9') {
+ if (yych == '.') goto yy117;
+ if (yych <= '/') goto yy105;
+ goto yy119;
+ } else {
+ if (yych <= ';') {
+ if (yych <= ':') goto yy105;
+ } else {
+ if (yych != ']') goto yy105;
+ }
+ }
+ }
+yy98:
+ YYDEBUG(98, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 497 "Zend/zend_ini_scanner.l"
+ { /* Get number option value as string */
+ RETURN_TOKEN(TC_NUMBER, yytext, yyleng);
+}
+#line 1427 "Zend/zend_ini_scanner.c"
+yy99:
+ YYDEBUG(99, *YYCURSOR);
+ yyaccept = 3;
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yybm[0+yych] & 16) {
+ goto yy115;
+ }
+ if (yych <= '"') {
+ if (yych <= '\f') {
+ if (yych != '\n') goto yy105;
+ } else {
+ if (yych <= '\r') goto yy100;
+ if (yych <= '!') goto yy105;
+ }
+ } else {
+ if (yych <= ':') {
+ if (yych != '\'') goto yy105;
+ } else {
+ if (yych <= ';') goto yy100;
+ if (yych != ']') goto yy105;
+ }
+ }
+yy100:
+ YYDEBUG(100, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 493 "Zend/zend_ini_scanner.l"
+ { /* Get constant option value */
+ RETURN_TOKEN(TC_CONSTANT, yytext, yyleng);
+}
+#line 1457 "Zend/zend_ini_scanner.c"
+yy101:
+ YYDEBUG(101, *YYCURSOR);
+ yych = *++YYCURSOR;
+ goto yy104;
+yy102:
+ YYDEBUG(102, *YYCURSOR);
+ ++YYCURSOR;
+yy103:
+ YYDEBUG(103, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 394 "Zend/zend_ini_scanner.l"
+ { /* End of section or an option offset */
+ BEGIN(INITIAL);
+ return ']';
+}
+#line 1473 "Zend/zend_ini_scanner.c"
+yy104:
+ YYDEBUG(104, *YYCURSOR);
+ yyaccept = 0;
+ YYMARKER = ++YYCURSOR;
+ YYFILL(1);
+ yych = *YYCURSOR;
+yy105:
+ YYDEBUG(105, *YYCURSOR);
+ if (yybm[0+yych] & 2) {
+ goto yy104;
+ }
+ if (yych == '$') goto yy107;
+ if (yych != '\\') goto yy87;
+yy106:
+ YYDEBUG(106, *YYCURSOR);
+ ++YYCURSOR;
+ YYFILL(1);
+ yych = *YYCURSOR;
+ goto yy104;
+yy107:
+ YYDEBUG(107, *YYCURSOR);
+ ++YYCURSOR;
+ YYFILL(1);
+ yych = *YYCURSOR;
+ if (yych <= '\\') {
+ if (yych <= 0x00) goto yy108;
+ if (yych <= '[') goto yy104;
+ goto yy109;
+ } else {
+ if (yych != '{') goto yy104;
+ }
+yy108:
+ YYDEBUG(108, *YYCURSOR);
+ YYCURSOR = YYMARKER;
+ if (yyaccept <= 1) {
+ if (yyaccept <= 0) {
+ goto yy87;
+ } else {
+ goto yy90;
+ }
+ } else {
+ if (yyaccept <= 2) {
+ goto yy98;
+ } else {
+ goto yy100;
+ }
+ }
+yy109:
+ YYDEBUG(109, *YYCURSOR);
+ ++YYCURSOR;
+ YYFILL(1);
+ yych = *YYCURSOR;
+ if (yybm[0+yych] & 4) {
+ goto yy110;
+ }
+ if (yych == '\\') goto yy112;
+ goto yy104;
+yy110:
+ YYDEBUG(110, *YYCURSOR);
+ ++YYCURSOR;
+ YYFILL(1);
+ yych = *YYCURSOR;
+ YYDEBUG(111, *YYCURSOR);
+ if (yybm[0+yych] & 4) {
+ goto yy110;
+ }
+ if (yych == '\\') goto yy114;
+ goto yy104;
+yy112:
+ YYDEBUG(112, *YYCURSOR);
+ ++YYCURSOR;
+ YYFILL(1);
+ yych = *YYCURSOR;
+ YYDEBUG(113, *YYCURSOR);
+ if (yybm[0+yych] & 4) {
+ goto yy110;
+ }
+ if (yych == '\\') goto yy112;
+ goto yy104;
+yy114:
+ YYDEBUG(114, *YYCURSOR);
+ ++YYCURSOR;
+ YYFILL(1);
+ yych = *YYCURSOR;
+ if (yybm[0+yych] & 4) {
+ goto yy110;
+ }
+ if (yych == '\\') goto yy112;
+ goto yy104;
+yy115:
+ YYDEBUG(115, *YYCURSOR);
+ yyaccept = 3;
+ YYMARKER = ++YYCURSOR;
+ YYFILL(1);
+ yych = *YYCURSOR;
+ YYDEBUG(116, *YYCURSOR);
+ if (yybm[0+yych] & 16) {
+ goto yy115;
+ }
+ if (yych <= '$') {
+ if (yych <= '\r') {
+ if (yych == '\n') goto yy100;
+ if (yych <= '\f') goto yy104;
+ goto yy100;
+ } else {
+ if (yych == '"') goto yy100;
+ if (yych <= '#') goto yy104;
+ goto yy107;
+ }
+ } else {
+ if (yych <= ';') {
+ if (yych == '\'') goto yy100;
+ if (yych <= ':') goto yy104;
+ goto yy100;
+ } else {
+ if (yych <= '[') goto yy104;
+ if (yych <= '\\') goto yy106;
+ if (yych <= ']') goto yy100;
+ goto yy104;
+ }
+ }
+yy117:
+ YYDEBUG(117, *YYCURSOR);
+ yyaccept = 2;
+ YYMARKER = ++YYCURSOR;
+ YYFILL(1);
+ yych = *YYCURSOR;
+ YYDEBUG(118, *YYCURSOR);
+ if (yybm[0+yych] & 32) {
+ goto yy117;
+ }
+ if (yych <= '$') {
+ if (yych <= '\r') {
+ if (yych == '\n') goto yy98;
+ if (yych <= '\f') goto yy104;
+ goto yy98;
+ } else {
+ if (yych == '"') goto yy98;
+ if (yych <= '#') goto yy104;
+ goto yy107;
+ }
+ } else {
+ if (yych <= ';') {
+ if (yych == '\'') goto yy98;
+ if (yych <= ':') goto yy104;
+ goto yy98;
+ } else {
+ if (yych <= '[') goto yy104;
+ if (yych <= '\\') goto yy106;
+ if (yych <= ']') goto yy98;
+ goto yy104;
+ }
+ }
+yy119:
+ YYDEBUG(119, *YYCURSOR);
+ yyaccept = 2;
+ YYMARKER = ++YYCURSOR;
+ YYFILL(1);
+ yych = *YYCURSOR;
+ YYDEBUG(120, *YYCURSOR);
+ if (yych <= '\'') {
+ if (yych <= '!') {
+ if (yych <= '\n') {
+ if (yych <= '\t') goto yy104;
+ goto yy98;
+ } else {
+ if (yych == '\r') goto yy98;
+ goto yy104;
+ }
+ } else {
+ if (yych <= '#') {
+ if (yych <= '"') goto yy98;
+ goto yy104;
+ } else {
+ if (yych <= '$') goto yy107;
+ if (yych <= '&') goto yy104;
+ goto yy98;
+ }
+ }
+ } else {
+ if (yych <= ':') {
+ if (yych <= '.') {
+ if (yych <= '-') goto yy104;
+ goto yy117;
+ } else {
+ if (yych <= '/') goto yy104;
+ if (yych <= '9') goto yy119;
+ goto yy104;
+ }
+ } else {
+ if (yych <= '[') {
+ if (yych <= ';') goto yy98;
+ goto yy104;
+ } else {
+ if (yych <= '\\') goto yy106;
+ if (yych <= ']') goto yy98;
+ goto yy104;
+ }
+ }
+ }
+yy121:
+ YYDEBUG(121, *YYCURSOR);
+ yyaccept = 2;
+ YYMARKER = ++YYCURSOR;
+ YYFILL(1);
+ yych = *YYCURSOR;
+ YYDEBUG(122, *YYCURSOR);
+ if (yych <= '&') {
+ if (yych <= '\r') {
+ if (yych == '\n') goto yy98;
+ if (yych <= '\f') goto yy104;
+ goto yy98;
+ } else {
+ if (yych <= '"') {
+ if (yych <= '!') goto yy104;
+ goto yy98;
+ } else {
+ if (yych == '$') goto yy107;
+ goto yy104;
+ }
+ }
+ } else {
+ if (yych <= ':') {
+ if (yych <= '\'') goto yy98;
+ if (yych <= '/') goto yy104;
+ if (yych <= '9') goto yy121;
+ goto yy104;
+ } else {
+ if (yych <= '[') {
+ if (yych <= ';') goto yy98;
+ goto yy104;
+ } else {
+ if (yych <= '\\') goto yy106;
+ if (yych <= ']') goto yy98;
+ goto yy104;
+ }
+ }
+ }
+yy123:
+ YYDEBUG(123, *YYCURSOR);
+ yyaccept = 2;
+ YYMARKER = ++YYCURSOR;
+ YYFILL(1);
+ yych = *YYCURSOR;
+ YYDEBUG(124, *YYCURSOR);
+ if (yych <= '&') {
+ if (yych <= '\r') {
+ if (yych == '\n') goto yy98;
+ if (yych <= '\f') goto yy104;
+ goto yy98;
+ } else {
+ if (yych <= '"') {
+ if (yych <= '!') goto yy104;
+ goto yy98;
+ } else {
+ if (yych == '$') goto yy107;
+ goto yy104;
+ }
+ }
+ } else {
+ if (yych <= ':') {
+ if (yych <= '\'') goto yy98;
+ if (yych <= '/') goto yy104;
+ if (yych <= '9') goto yy123;
+ goto yy104;
+ } else {
+ if (yych <= '[') {
+ if (yych <= ';') goto yy98;
+ goto yy104;
+ } else {
+ if (yych <= '\\') goto yy106;
+ if (yych <= ']') goto yy98;
+ goto yy104;
+ }
+ }
+ }
+yy125:
+ YYDEBUG(125, *YYCURSOR);
+ ++YYCURSOR;
+ YYFILL(1);
+ yych = *YYCURSOR;
+ YYDEBUG(126, *YYCURSOR);
+ if (yybm[0+yych] & 64) {
+ goto yy125;
+ }
+ YYDEBUG(127, *YYCURSOR);
+ ++YYCURSOR;
+ YYDEBUG(128, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 366 "Zend/zend_ini_scanner.l"
+ { /* Raw string */
+ /* Eat leading and trailing single quotes */
+ if (yytext[0] == '\'' && yytext[yyleng - 1] == '\'') {
+ SCNG(yy_text)++;
+ yyleng = yyleng - 2;
+ }
+ RETURN_TOKEN(TC_RAW, yytext, yyleng);
+}
+#line 1772 "Zend/zend_ini_scanner.c"
+yy129:
+ YYDEBUG(129, *YYCURSOR);
+ ++YYCURSOR;
+ YYDEBUG(130, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 399 "Zend/zend_ini_scanner.l"
+ { /* Variable start */
+ yy_push_state(ST_VARNAME TSRMLS_CC);
+ return TC_DOLLAR_CURLY;
+}
+#line 1783 "Zend/zend_ini_scanner.c"
+yy131:
+ YYDEBUG(131, *YYCURSOR);
+ yyaccept = 0;
+ YYMARKER = ++YYCURSOR;
+ YYFILL(1);
+ yych = *YYCURSOR;
+ YYDEBUG(132, *YYCURSOR);
+ if (yybm[0+yych] & 128) {
+ goto yy131;
+ }
+ if (yych <= '$') {
+ if (yych <= '\r') {
+ if (yych == '\n') goto yy87;
+ if (yych <= '\f') goto yy104;
+ goto yy87;
+ } else {
+ if (yych == '"') goto yy133;
+ if (yych <= '#') goto yy104;
+ goto yy107;
+ }
+ } else {
+ if (yych <= ';') {
+ if (yych == '\'') goto yy87;
+ if (yych <= ':') goto yy104;
+ goto yy87;
+ } else {
+ if (yych <= '[') goto yy104;
+ if (yych <= '\\') goto yy106;
+ if (yych <= ']') goto yy134;
+ goto yy104;
+ }
+ }
+yy133:
+ YYDEBUG(133, *YYCURSOR);
+ yych = *++YYCURSOR;
+ goto yy92;
+yy134:
+ YYDEBUG(134, *YYCURSOR);
+ ++YYCURSOR;
+ yych = *YYCURSOR;
+ goto yy103;
+ }
+/* *********************************** */
+yyc_ST_RAW:
+ {
+ static const unsigned char yybm[] = {
+ 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 192, 0, 64, 64, 0, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64,
+ 192, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64,
+ };
+ YYDEBUG(135, *YYCURSOR);
+ YYFILL(3);
+ yych = *YYCURSOR;
+ if (yych <= '\f') {
+ if (yych <= 0x08) {
+ if (yych >= 0x01) goto yy139;
+ } else {
+ if (yych <= '\t') goto yy141;
+ if (yych <= '\n') goto yy142;
+ goto yy139;
+ }
+ } else {
+ if (yych <= ' ') {
+ if (yych <= '\r') goto yy144;
+ if (yych <= 0x1F) goto yy139;
+ goto yy141;
+ } else {
+ if (yych == ';') goto yy145;
+ goto yy139;
+ }
+ }
+ YYDEBUG(137, *YYCURSOR);
+ ++YYCURSOR;
+ YYDEBUG(138, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 596 "Zend/zend_ini_scanner.l"
+ { /* End of option value (if EOF is reached before EOL */
+ BEGIN(INITIAL);
+ return END_OF_LINE;
+}
+#line 1893 "Zend/zend_ini_scanner.c"
+yy139:
+ YYDEBUG(139, *YYCURSOR);
+ ++YYCURSOR;
+yy140:
+ YYDEBUG(140, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 446 "Zend/zend_ini_scanner.l"
+ { /* Raw value, only used when SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW. */
+ char *sc = NULL;
+ while (YYCURSOR < YYLIMIT) {
+ switch (*YYCURSOR) {
+ case '\n':
+ case '\r':
+ goto end_raw_value_chars;
+ break;
+ case ';':
+ if (sc == NULL) {
+ sc = YYCURSOR;
+ }
+ /* no break */
+ default:
+ YYCURSOR++;
+ break;
+ }
+ }
+end_raw_value_chars:
+ yyleng = YYCURSOR - SCNG(yy_text);
+
+ /* Eat trailing semicolons */
+ while (yytext[yyleng - 1] == ';') {
+ yyleng--;
+ }
+
+ /* Eat leading and trailing double quotes */
+ if (yytext[0] == '"' && yytext[yyleng - 1] == '"') {
+ SCNG(yy_text)++;
+ yyleng = yyleng - 2;
+ } else if (sc) {
+ YYCURSOR = sc;
+ yyleng = YYCURSOR - SCNG(yy_text);
+ }
+ RETURN_TOKEN(TC_RAW, yytext, yyleng);
+}
+#line 1937 "Zend/zend_ini_scanner.c"
+yy141:
+ YYDEBUG(141, *YYCURSOR);
+ yyaccept = 0;
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yych <= '\r') {
+ if (yych <= 0x08) goto yy140;
+ if (yych <= '\n') goto yy153;
+ if (yych <= '\f') goto yy140;
+ goto yy153;
+ } else {
+ if (yych <= ' ') {
+ if (yych <= 0x1F) goto yy140;
+ goto yy153;
+ } else {
+ if (yych == ';') goto yy153;
+ goto yy140;
+ }
+ }
+yy142:
+ YYDEBUG(142, *YYCURSOR);
+ ++YYCURSOR;
+yy143:
+ YYDEBUG(143, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 487 "Zend/zend_ini_scanner.l"
+ { /* End of option value */
+ BEGIN(INITIAL);
+ SCNG(lineno)++;
+ return END_OF_LINE;
+}
+#line 1968 "Zend/zend_ini_scanner.c"
+yy144:
+ YYDEBUG(144, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == '\n') goto yy151;
+ goto yy143;
+yy145:
+ YYDEBUG(145, *YYCURSOR);
+ yyaccept = 1;
+ yych = *(YYMARKER = ++YYCURSOR);
+ goto yy147;
+yy146:
+ YYDEBUG(146, *YYCURSOR);
+ ++YYCURSOR;
+ YYFILL(2);
+ yych = *YYCURSOR;
+yy147:
+ YYDEBUG(147, *YYCURSOR);
+ if (yybm[0+yych] & 64) {
+ goto yy146;
+ }
+ if (yych >= '\r') goto yy150;
+yy148:
+ YYDEBUG(148, *YYCURSOR);
+ ++YYCURSOR;
+yy149:
+ YYDEBUG(149, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 583 "Zend/zend_ini_scanner.l"
+ { /* Comment */
+ BEGIN(INITIAL);
+ SCNG(lineno)++;
+ return END_OF_LINE;
+}
+#line 2002 "Zend/zend_ini_scanner.c"
+yy150:
+ YYDEBUG(150, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == '\n') goto yy148;
+ goto yy149;
+yy151:
+ YYDEBUG(151, *YYCURSOR);
+ yych = *++YYCURSOR;
+ goto yy143;
+yy152:
+ YYDEBUG(152, *YYCURSOR);
+ yyaccept = 2;
+ YYMARKER = ++YYCURSOR;
+ YYFILL(2);
+ yych = *YYCURSOR;
+yy153:
+ YYDEBUG(153, *YYCURSOR);
+ if (yybm[0+yych] & 128) {
+ goto yy152;
+ }
+ if (yych <= '\f') {
+ if (yych == '\n') goto yy151;
+ } else {
+ if (yych <= '\r') goto yy155;
+ if (yych == ';') goto yy146;
+ }
+ YYDEBUG(154, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 573 "Zend/zend_ini_scanner.l"
+ {
+ /* eat whitespace */
+ goto restart;
+}
+#line 2036 "Zend/zend_ini_scanner.c"
+yy155:
+ YYDEBUG(155, *YYCURSOR);
+ ++YYCURSOR;
+ if ((yych = *YYCURSOR) == '\n') goto yy151;
+ goto yy143;
+ }
+/* *********************************** */
+yyc_ST_SECTION_RAW:
+ {
+ static const unsigned char yybm[] = {
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 192, 0, 128, 128, 0, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 192, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 0, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ };
+ YYDEBUG(156, *YYCURSOR);
+ YYFILL(3);
+ yych = *YYCURSOR;
+ if (yych <= '\f') {
+ if (yych == '\n') goto yy160;
+ } else {
+ if (yych <= '\r') goto yy160;
+ if (yych == ']') goto yy162;
+ }
+ YYDEBUG(158, *YYCURSOR);
+ ++YYCURSOR;
+ yych = *YYCURSOR;
+ goto yy169;
+yy159:
+ YYDEBUG(159, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 483 "Zend/zend_ini_scanner.l"
+ { /* Raw value, only used when SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW. */
+ RETURN_TOKEN(TC_RAW, yytext, yyleng);
+}
+#line 2100 "Zend/zend_ini_scanner.c"
+yy160:
+ YYDEBUG(160, *YYCURSOR);
+ ++YYCURSOR;
+ YYDEBUG(161, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 601 "Zend/zend_ini_scanner.l"
+ {
+ return 0;
+}
+#line 2110 "Zend/zend_ini_scanner.c"
+yy162:
+ YYDEBUG(162, *YYCURSOR);
+ ++YYCURSOR;
+ yych = *YYCURSOR;
+ goto yy165;
+yy163:
+ YYDEBUG(163, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 375 "Zend/zend_ini_scanner.l"
+ { /* End of section */
+ BEGIN(INITIAL);
+ SCNG(lineno)++;
+ return ']';
+}
+#line 2125 "Zend/zend_ini_scanner.c"
+yy164:
+ YYDEBUG(164, *YYCURSOR);
+ ++YYCURSOR;
+ YYFILL(2);
+ yych = *YYCURSOR;
+yy165:
+ YYDEBUG(165, *YYCURSOR);
+ if (yybm[0+yych] & 64) {
+ goto yy164;
+ }
+ if (yych == '\n') goto yy166;
+ if (yych == '\r') goto yy167;
+ goto yy163;
+yy166:
+ YYDEBUG(166, *YYCURSOR);
+ yych = *++YYCURSOR;
+ goto yy163;
+yy167:
+ YYDEBUG(167, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == '\n') goto yy166;
+ goto yy163;
+yy168:
+ YYDEBUG(168, *YYCURSOR);
+ ++YYCURSOR;
+ YYFILL(1);
+ yych = *YYCURSOR;
+yy169:
+ YYDEBUG(169, *YYCURSOR);
+ if (yybm[0+yych] & 128) {
+ goto yy168;
+ }
+ goto yy159;
+ }
+/* *********************************** */
+yyc_ST_SECTION_VALUE:
+ {
+ static const unsigned char yybm[] = {
+ 132, 132, 132, 132, 132, 132, 132, 132,
+ 132, 134, 128, 132, 132, 128, 132, 132,
+ 132, 132, 132, 132, 132, 132, 132, 132,
+ 132, 132, 132, 132, 132, 132, 132, 132,
+ 134, 132, 128, 132, 136, 132, 132, 0,
+ 132, 132, 132, 132, 132, 132, 132, 132,
+ 228, 228, 228, 228, 228, 228, 228, 228,
+ 228, 228, 132, 128, 132, 132, 132, 132,
+ 132, 164, 164, 164, 164, 164, 164, 164,
+ 164, 164, 164, 164, 164, 164, 164, 164,
+ 164, 164, 164, 164, 164, 164, 164, 164,
+ 164, 164, 164, 132, 144, 128, 132, 164,
+ 132, 164, 164, 164, 164, 164, 164, 164,
+ 164, 164, 164, 164, 164, 164, 164, 164,
+ 164, 164, 164, 164, 164, 164, 164, 164,
+ 164, 164, 164, 132, 132, 132, 132, 132,
+ 132, 132, 132, 132, 132, 132, 132, 132,
+ 132, 132, 132, 132, 132, 132, 132, 132,
+ 132, 132, 132, 132, 132, 132, 132, 132,
+ 132, 132, 132, 132, 132, 132, 132, 132,
+ 132, 132, 132, 132, 132, 132, 132, 132,
+ 132, 132, 132, 132, 132, 132, 132, 132,
+ 132, 132, 132, 132, 132, 132, 132, 132,
+ 132, 132, 132, 132, 132, 132, 132, 132,
+ 132, 132, 132, 132, 132, 132, 132, 132,
+ 132, 132, 132, 132, 132, 132, 132, 132,
+ 132, 132, 132, 132, 132, 132, 132, 132,
+ 132, 132, 132, 132, 132, 132, 132, 132,
+ 132, 132, 132, 132, 132, 132, 132, 132,
+ 132, 132, 132, 132, 132, 132, 132, 132,
+ 132, 132, 132, 132, 132, 132, 132, 132,
+ 132, 132, 132, 132, 132, 132, 132, 132,
+ };
+ YYDEBUG(170, *YYCURSOR);
+ YYFILL(3);
+ yych = *YYCURSOR;
+ if (yych <= '-') {
+ if (yych <= ' ') {
+ if (yych <= '\n') {
+ if (yych <= 0x08) goto yy172;
+ if (yych <= '\t') goto yy174;
+ goto yy175;
+ } else {
+ if (yych == '\r') goto yy175;
+ if (yych >= ' ') goto yy174;
+ }
+ } else {
+ if (yych <= '$') {
+ if (yych == '"') goto yy177;
+ if (yych >= '$') goto yy179;
+ } else {
+ if (yych == '\'') goto yy180;
+ if (yych >= '-') goto yy181;
+ }
+ }
+ } else {
+ if (yych <= 'Z') {
+ if (yych <= '9') {
+ if (yych <= '.') goto yy182;
+ if (yych >= '0') goto yy183;
+ } else {
+ if (yych == ';') goto yy175;
+ if (yych >= 'A') goto yy185;
+ }
+ } else {
+ if (yych <= '^') {
+ if (yych <= '[') goto yy172;
+ if (yych <= '\\') goto yy187;
+ if (yych <= ']') goto yy188;
+ } else {
+ if (yych == '`') goto yy172;
+ if (yych <= 'z') goto yy185;
+ }
+ }
+ }
+yy172:
+ YYDEBUG(172, *YYCURSOR);
+ yyaccept = 0;
+ yych = *(YYMARKER = ++YYCURSOR);
+ goto yy195;
+yy173:
+ YYDEBUG(173, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 519 "Zend/zend_ini_scanner.l"
+ { /* Get rest as section/offset value */
+ RETURN_TOKEN(TC_STRING, yytext, yyleng);
+}
+#line 2251 "Zend/zend_ini_scanner.c"
+yy174:
+ YYDEBUG(174, *YYCURSOR);
+ yyaccept = 0;
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yych <= 0x1F) {
+ if (yych == '\t') goto yy221;
+ goto yy195;
+ } else {
+ if (yych <= ' ') goto yy221;
+ if (yych == '"') goto yy223;
+ goto yy195;
+ }
+yy175:
+ YYDEBUG(175, *YYCURSOR);
+ ++YYCURSOR;
+yy176:
+ YYDEBUG(176, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 601 "Zend/zend_ini_scanner.l"
+ {
+ return 0;
+}
+#line 2274 "Zend/zend_ini_scanner.c"
+yy177:
+ YYDEBUG(177, *YYCURSOR);
+ ++YYCURSOR;
+yy178:
+ YYDEBUG(178, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 523 "Zend/zend_ini_scanner.l"
+ { /* Double quoted '"' string start */
+ yy_push_state(ST_DOUBLE_QUOTES TSRMLS_CC);
+ return '"';
+}
+#line 2286 "Zend/zend_ini_scanner.c"
+yy179:
+ YYDEBUG(179, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych <= '\\') {
+ if (yych <= 0x00) goto yy176;
+ if (yych <= '[') goto yy194;
+ goto yy199;
+ } else {
+ if (yych == '{') goto yy219;
+ goto yy194;
+ }
+yy180:
+ YYDEBUG(180, *YYCURSOR);
+ yyaccept = 1;
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yybm[0+yych] & 128) {
+ goto yy215;
+ }
+ goto yy176;
+yy181:
+ YYDEBUG(181, *YYCURSOR);
+ yyaccept = 0;
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yych <= '/') goto yy195;
+ if (yych <= '9') goto yy213;
+ goto yy195;
+yy182:
+ YYDEBUG(182, *YYCURSOR);
+ yyaccept = 0;
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yych <= '/') goto yy195;
+ if (yych <= '9') goto yy211;
+ goto yy195;
+yy183:
+ YYDEBUG(183, *YYCURSOR);
+ yyaccept = 2;
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yych <= '\'') {
+ if (yych <= '\r') {
+ if (yych == '\n') goto yy184;
+ if (yych <= '\f') goto yy195;
+ } else {
+ if (yych == '"') goto yy184;
+ if (yych <= '&') goto yy195;
+ }
+ } else {
+ if (yych <= '9') {
+ if (yych == '.') goto yy207;
+ if (yych <= '/') goto yy195;
+ goto yy209;
+ } else {
+ if (yych <= ';') {
+ if (yych <= ':') goto yy195;
+ } else {
+ if (yych != ']') goto yy195;
+ }
+ }
+ }
+yy184:
+ YYDEBUG(184, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 497 "Zend/zend_ini_scanner.l"
+ { /* Get number option value as string */
+ RETURN_TOKEN(TC_NUMBER, yytext, yyleng);
+}
+#line 2352 "Zend/zend_ini_scanner.c"
+yy185:
+ YYDEBUG(185, *YYCURSOR);
+ yyaccept = 3;
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yybm[0+yych] & 32) {
+ goto yy205;
+ }
+ if (yych <= '"') {
+ if (yych <= '\f') {
+ if (yych != '\n') goto yy195;
+ } else {
+ if (yych <= '\r') goto yy186;
+ if (yych <= '!') goto yy195;
+ }
+ } else {
+ if (yych <= ':') {
+ if (yych != '\'') goto yy195;
+ } else {
+ if (yych <= ';') goto yy186;
+ if (yych != ']') goto yy195;
+ }
+ }
+yy186:
+ YYDEBUG(186, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 493 "Zend/zend_ini_scanner.l"
+ { /* Get constant option value */
+ RETURN_TOKEN(TC_CONSTANT, yytext, yyleng);
+}
+#line 2382 "Zend/zend_ini_scanner.c"
+yy187:
+ YYDEBUG(187, *YYCURSOR);
+ yych = *++YYCURSOR;
+ goto yy194;
+yy188:
+ YYDEBUG(188, *YYCURSOR);
+ ++YYCURSOR;
+ yych = *YYCURSOR;
+ goto yy191;
+yy189:
+ YYDEBUG(189, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 375 "Zend/zend_ini_scanner.l"
+ { /* End of section */
+ BEGIN(INITIAL);
+ SCNG(lineno)++;
+ return ']';
+}
+#line 2401 "Zend/zend_ini_scanner.c"
+yy190:
+ YYDEBUG(190, *YYCURSOR);
+ ++YYCURSOR;
+ YYFILL(2);
+ yych = *YYCURSOR;
+yy191:
+ YYDEBUG(191, *YYCURSOR);
+ if (yybm[0+yych] & 2) {
+ goto yy190;
+ }
+ if (yych == '\n') goto yy192;
+ if (yych == '\r') goto yy193;
+ goto yy189;
+yy192:
+ YYDEBUG(192, *YYCURSOR);
+ yych = *++YYCURSOR;
+ goto yy189;
+yy193:
+ YYDEBUG(193, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == '\n') goto yy192;
+ goto yy189;
+yy194:
+ YYDEBUG(194, *YYCURSOR);
+ yyaccept = 0;
+ YYMARKER = ++YYCURSOR;
+ YYFILL(1);
+ yych = *YYCURSOR;
+yy195:
+ YYDEBUG(195, *YYCURSOR);
+ if (yybm[0+yych] & 4) {
+ goto yy194;
+ }
+ if (yych == '$') goto yy197;
+ if (yych != '\\') goto yy173;
+yy196:
+ YYDEBUG(196, *YYCURSOR);
+ ++YYCURSOR;
+ YYFILL(1);
+ yych = *YYCURSOR;
+ goto yy194;
+yy197:
+ YYDEBUG(197, *YYCURSOR);
+ ++YYCURSOR;
+ YYFILL(1);
+ yych = *YYCURSOR;
+ if (yych <= '\\') {
+ if (yych <= 0x00) goto yy198;
+ if (yych <= '[') goto yy194;
+ goto yy199;
+ } else {
+ if (yych != '{') goto yy194;
+ }
+yy198:
+ YYDEBUG(198, *YYCURSOR);
+ YYCURSOR = YYMARKER;
+ if (yyaccept <= 1) {
+ if (yyaccept <= 0) {
+ goto yy173;
+ } else {
+ goto yy176;
+ }
+ } else {
+ if (yyaccept <= 2) {
+ goto yy184;
+ } else {
+ goto yy186;
+ }
+ }
+yy199:
+ YYDEBUG(199, *YYCURSOR);
+ ++YYCURSOR;
+ YYFILL(1);
+ yych = *YYCURSOR;
+ if (yybm[0+yych] & 8) {
+ goto yy200;
+ }
+ if (yych == '\\') goto yy202;
+ goto yy194;
+yy200:
+ YYDEBUG(200, *YYCURSOR);
+ ++YYCURSOR;
+ YYFILL(1);
+ yych = *YYCURSOR;
+ YYDEBUG(201, *YYCURSOR);
+ if (yybm[0+yych] & 8) {
+ goto yy200;
+ }
+ if (yych == '\\') goto yy204;
+ goto yy194;
+yy202:
+ YYDEBUG(202, *YYCURSOR);
+ ++YYCURSOR;
+ YYFILL(1);
+ yych = *YYCURSOR;
+ YYDEBUG(203, *YYCURSOR);
+ if (yybm[0+yych] & 8) {
+ goto yy200;
+ }
+ if (yych == '\\') goto yy202;
+ goto yy194;
+yy204:
+ YYDEBUG(204, *YYCURSOR);
+ ++YYCURSOR;
+ YYFILL(1);
+ yych = *YYCURSOR;
+ if (yybm[0+yych] & 8) {
+ goto yy200;
+ }
+ if (yych == '\\') goto yy202;
+ goto yy194;
+yy205:
+ YYDEBUG(205, *YYCURSOR);
+ yyaccept = 3;
+ YYMARKER = ++YYCURSOR;
+ YYFILL(1);
+ yych = *YYCURSOR;
+ YYDEBUG(206, *YYCURSOR);
+ if (yybm[0+yych] & 32) {
+ goto yy205;
+ }
+ if (yych <= '$') {
+ if (yych <= '\r') {
+ if (yych == '\n') goto yy186;
+ if (yych <= '\f') goto yy194;
+ goto yy186;
+ } else {
+ if (yych == '"') goto yy186;
+ if (yych <= '#') goto yy194;
+ goto yy197;
+ }
+ } else {
+ if (yych <= ';') {
+ if (yych == '\'') goto yy186;
+ if (yych <= ':') goto yy194;
+ goto yy186;
+ } else {
+ if (yych <= '[') goto yy194;
+ if (yych <= '\\') goto yy196;
+ if (yych <= ']') goto yy186;
+ goto yy194;
+ }
+ }
+yy207:
+ YYDEBUG(207, *YYCURSOR);
+ yyaccept = 2;
+ YYMARKER = ++YYCURSOR;
+ YYFILL(1);
+ yych = *YYCURSOR;
+ YYDEBUG(208, *YYCURSOR);
+ if (yybm[0+yych] & 64) {
+ goto yy207;
+ }
+ if (yych <= '$') {
+ if (yych <= '\r') {
+ if (yych == '\n') goto yy184;
+ if (yych <= '\f') goto yy194;
+ goto yy184;
+ } else {
+ if (yych == '"') goto yy184;
+ if (yych <= '#') goto yy194;
+ goto yy197;
+ }
+ } else {
+ if (yych <= ';') {
+ if (yych == '\'') goto yy184;
+ if (yych <= ':') goto yy194;
+ goto yy184;
+ } else {
+ if (yych <= '[') goto yy194;
+ if (yych <= '\\') goto yy196;
+ if (yych <= ']') goto yy184;
+ goto yy194;
+ }
+ }
+yy209:
+ YYDEBUG(209, *YYCURSOR);
+ yyaccept = 2;
+ YYMARKER = ++YYCURSOR;
+ YYFILL(1);
+ yych = *YYCURSOR;
+ YYDEBUG(210, *YYCURSOR);
+ if (yych <= '\'') {
+ if (yych <= '!') {
+ if (yych <= '\n') {
+ if (yych <= '\t') goto yy194;
+ goto yy184;
+ } else {
+ if (yych == '\r') goto yy184;
+ goto yy194;
+ }
+ } else {
+ if (yych <= '#') {
+ if (yych <= '"') goto yy184;
+ goto yy194;
+ } else {
+ if (yych <= '$') goto yy197;
+ if (yych <= '&') goto yy194;
+ goto yy184;
+ }
+ }
+ } else {
+ if (yych <= ':') {
+ if (yych <= '.') {
+ if (yych <= '-') goto yy194;
+ goto yy207;
+ } else {
+ if (yych <= '/') goto yy194;
+ if (yych <= '9') goto yy209;
+ goto yy194;
+ }
+ } else {
+ if (yych <= '[') {
+ if (yych <= ';') goto yy184;
+ goto yy194;
+ } else {
+ if (yych <= '\\') goto yy196;
+ if (yych <= ']') goto yy184;
+ goto yy194;
+ }
+ }
+ }
+yy211:
+ YYDEBUG(211, *YYCURSOR);
+ yyaccept = 2;
+ YYMARKER = ++YYCURSOR;
+ YYFILL(1);
+ yych = *YYCURSOR;
+ YYDEBUG(212, *YYCURSOR);
+ if (yych <= '&') {
+ if (yych <= '\r') {
+ if (yych == '\n') goto yy184;
+ if (yych <= '\f') goto yy194;
+ goto yy184;
+ } else {
+ if (yych <= '"') {
+ if (yych <= '!') goto yy194;
+ goto yy184;
+ } else {
+ if (yych == '$') goto yy197;
+ goto yy194;
+ }
+ }
+ } else {
+ if (yych <= ':') {
+ if (yych <= '\'') goto yy184;
+ if (yych <= '/') goto yy194;
+ if (yych <= '9') goto yy211;
+ goto yy194;
+ } else {
+ if (yych <= '[') {
+ if (yych <= ';') goto yy184;
+ goto yy194;
+ } else {
+ if (yych <= '\\') goto yy196;
+ if (yych <= ']') goto yy184;
+ goto yy194;
+ }
+ }
+ }
+yy213:
+ YYDEBUG(213, *YYCURSOR);
+ yyaccept = 2;
+ YYMARKER = ++YYCURSOR;
+ YYFILL(1);
+ yych = *YYCURSOR;
+ YYDEBUG(214, *YYCURSOR);
+ if (yych <= '&') {
+ if (yych <= '\r') {
+ if (yych == '\n') goto yy184;
+ if (yych <= '\f') goto yy194;
+ goto yy184;
+ } else {
+ if (yych <= '"') {
+ if (yych <= '!') goto yy194;
+ goto yy184;
+ } else {
+ if (yych == '$') goto yy197;
+ goto yy194;
+ }
+ }
+ } else {
+ if (yych <= ':') {
+ if (yych <= '\'') goto yy184;
+ if (yych <= '/') goto yy194;
+ if (yych <= '9') goto yy213;
+ goto yy194;
+ } else {
+ if (yych <= '[') {
+ if (yych <= ';') goto yy184;
+ goto yy194;
+ } else {
+ if (yych <= '\\') goto yy196;
+ if (yych <= ']') goto yy184;
+ goto yy194;
+ }
+ }
+ }
+yy215:
+ YYDEBUG(215, *YYCURSOR);
+ ++YYCURSOR;
+ YYFILL(1);
+ yych = *YYCURSOR;
+ YYDEBUG(216, *YYCURSOR);
+ if (yybm[0+yych] & 128) {
+ goto yy215;
+ }
+ YYDEBUG(217, *YYCURSOR);
+ ++YYCURSOR;
+ YYDEBUG(218, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 366 "Zend/zend_ini_scanner.l"
+ { /* Raw string */
+ /* Eat leading and trailing single quotes */
+ if (yytext[0] == '\'' && yytext[yyleng - 1] == '\'') {
+ SCNG(yy_text)++;
+ yyleng = yyleng - 2;
+ }
+ RETURN_TOKEN(TC_RAW, yytext, yyleng);
+}
+#line 2722 "Zend/zend_ini_scanner.c"
+yy219:
+ YYDEBUG(219, *YYCURSOR);
+ ++YYCURSOR;
+ YYDEBUG(220, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 399 "Zend/zend_ini_scanner.l"
+ { /* Variable start */
+ yy_push_state(ST_VARNAME TSRMLS_CC);
+ return TC_DOLLAR_CURLY;
+}
+#line 2733 "Zend/zend_ini_scanner.c"
+yy221:
+ YYDEBUG(221, *YYCURSOR);
+ yyaccept = 0;
+ YYMARKER = ++YYCURSOR;
+ YYFILL(1);
+ yych = *YYCURSOR;
+ YYDEBUG(222, *YYCURSOR);
+ if (yych <= '"') {
+ if (yych <= '\f') {
+ if (yych <= 0x08) goto yy194;
+ if (yych <= '\t') goto yy221;
+ if (yych <= '\n') goto yy173;
+ goto yy194;
+ } else {
+ if (yych <= 0x1F) {
+ if (yych <= '\r') goto yy173;
+ goto yy194;
+ } else {
+ if (yych <= ' ') goto yy221;
+ if (yych <= '!') goto yy194;
+ }
+ }
+ } else {
+ if (yych <= ':') {
+ if (yych <= '$') {
+ if (yych <= '#') goto yy194;
+ goto yy197;
+ } else {
+ if (yych == '\'') goto yy173;
+ goto yy194;
+ }
+ } else {
+ if (yych <= '[') {
+ if (yych <= ';') goto yy173;
+ goto yy194;
+ } else {
+ if (yych <= '\\') goto yy196;
+ if (yych <= ']') goto yy173;
+ goto yy194;
+ }
+ }
+ }
+yy223:
+ YYDEBUG(223, *YYCURSOR);
+ ++YYCURSOR;
+ yych = *YYCURSOR;
+ goto yy178;
+ }
+/* *********************************** */
+yyc_ST_VALUE:
+ {
+ static const unsigned char yybm[] = {
+ 160, 162, 162, 162, 162, 162, 162, 162,
+ 162, 176, 128, 162, 162, 128, 162, 162,
+ 162, 162, 162, 162, 162, 162, 162, 162,
+ 162, 162, 162, 162, 162, 162, 162, 162,
+ 176, 160, 160, 162, 168, 162, 160, 32,
+ 160, 160, 162, 162, 162, 162, 162, 162,
+ 230, 230, 230, 230, 230, 230, 230, 230,
+ 230, 230, 162, 160, 162, 160, 162, 162,
+ 162, 166, 166, 166, 166, 166, 166, 166,
+ 166, 166, 166, 166, 166, 166, 166, 166,
+ 166, 166, 166, 166, 166, 166, 166, 166,
+ 166, 166, 166, 162, 162, 162, 160, 166,
+ 162, 166, 166, 166, 166, 166, 166, 166,
+ 166, 166, 166, 166, 166, 166, 166, 166,
+ 166, 166, 166, 166, 166, 166, 166, 166,
+ 166, 166, 166, 162, 160, 162, 160, 162,
+ 162, 162, 162, 162, 162, 162, 162, 162,
+ 162, 162, 162, 162, 162, 162, 162, 162,
+ 162, 162, 162, 162, 162, 162, 162, 162,
+ 162, 162, 162, 162, 162, 162, 162, 162,
+ 162, 162, 162, 162, 162, 162, 162, 162,
+ 162, 162, 162, 162, 162, 162, 162, 162,
+ 162, 162, 162, 162, 162, 162, 162, 162,
+ 162, 162, 162, 162, 162, 162, 162, 162,
+ 162, 162, 162, 162, 162, 162, 162, 162,
+ 162, 162, 162, 162, 162, 162, 162, 162,
+ 162, 162, 162, 162, 162, 162, 162, 162,
+ 162, 162, 162, 162, 162, 162, 162, 162,
+ 162, 162, 162, 162, 162, 162, 162, 162,
+ 162, 162, 162, 162, 162, 162, 162, 162,
+ 162, 162, 162, 162, 162, 162, 162, 162,
+ 162, 162, 162, 162, 162, 162, 162, 162,
+ };
+ YYDEBUG(224, *YYCURSOR);
+ YYFILL(6);
+ yych = *YYCURSOR;
+ YYDEBUG(-1, yych);
+ switch (yych) {
+ case 0x00: goto yy226;
+ case '\t':
+ case ' ': goto yy230;
+ case '\n': goto yy232;
+ case '\r': goto yy234;
+ case '!':
+ case '&':
+ case '(':
+ case ')':
+ case '^':
+ case '|':
+ case '~': goto yy235;
+ case '"': goto yy237;
+ case '$': goto yy239;
+ case '\'': goto yy240;
+ case '-': goto yy241;
+ case '.': goto yy242;
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9': goto yy243;
+ case ';': goto yy245;
+ case '=': goto yy246;
+ case 'A':
+ case 'B':
+ case 'C':
+ case 'D':
+ case 'E':
+ case 'G':
+ case 'H':
+ case 'I':
+ case 'J':
+ case 'K':
+ case 'L':
+ case 'M':
+ case 'P':
+ case 'Q':
+ case 'R':
+ case 'S':
+ case 'U':
+ case 'V':
+ case 'W':
+ case 'X':
+ case 'Z':
+ case '_':
+ case 'a':
+ case 'b':
+ case 'c':
+ case 'd':
+ case 'e':
+ case 'g':
+ case 'h':
+ case 'i':
+ case 'j':
+ case 'k':
+ case 'l':
+ case 'm':
+ case 'p':
+ case 'q':
+ case 'r':
+ case 's':
+ case 'u':
+ case 'v':
+ case 'w':
+ case 'x':
+ case 'z': goto yy248;
+ case 'F':
+ case 'f': goto yy250;
+ case 'N':
+ case 'n': goto yy251;
+ case 'O':
+ case 'o': goto yy252;
+ case 'T':
+ case 't': goto yy253;
+ case 'Y':
+ case 'y': goto yy254;
+ default: goto yy228;
+ }
+yy226:
+ YYDEBUG(226, *YYCURSOR);
+ ++YYCURSOR;
+yy227:
+ YYDEBUG(227, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 596 "Zend/zend_ini_scanner.l"
+ { /* End of option value (if EOF is reached before EOL */
+ BEGIN(INITIAL);
+ return END_OF_LINE;
+}
+#line 2919 "Zend/zend_ini_scanner.c"
+yy228:
+ YYDEBUG(228, *YYCURSOR);
+ yyaccept = 0;
+ yych = *(YYMARKER = ++YYCURSOR);
+ goto yy256;
+yy229:
+ YYDEBUG(229, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 515 "Zend/zend_ini_scanner.l"
+ { /* Get everything else as option/offset value */
+ RETURN_TOKEN(TC_STRING, yytext, yyleng);
+}
+#line 2932 "Zend/zend_ini_scanner.c"
+yy230:
+ YYDEBUG(230, *YYCURSOR);
+ yyaccept = 1;
+ yych = *(YYMARKER = ++YYCURSOR);
+ goto yy306;
+yy231:
+ YYDEBUG(231, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 569 "Zend/zend_ini_scanner.l"
+ {
+ RETURN_TOKEN(TC_WHITESPACE, yytext, yyleng);
+}
+#line 2945 "Zend/zend_ini_scanner.c"
+yy232:
+ YYDEBUG(232, *YYCURSOR);
+ ++YYCURSOR;
+yy233:
+ YYDEBUG(233, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 487 "Zend/zend_ini_scanner.l"
+ { /* End of option value */
+ BEGIN(INITIAL);
+ SCNG(lineno)++;
+ return END_OF_LINE;
+}
+#line 2958 "Zend/zend_ini_scanner.c"
+yy234:
+ YYDEBUG(234, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == '\n') goto yy304;
+ goto yy233;
+yy235:
+ YYDEBUG(235, *YYCURSOR);
+ ++YYCURSOR;
+ yych = *YYCURSOR;
+ goto yy303;
+yy236:
+ YYDEBUG(236, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 505 "Zend/zend_ini_scanner.l"
+ { /* Boolean operators */
+ return yytext[0];
+}
+#line 2976 "Zend/zend_ini_scanner.c"
+yy237:
+ YYDEBUG(237, *YYCURSOR);
+ ++YYCURSOR;
+yy238:
+ YYDEBUG(238, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 523 "Zend/zend_ini_scanner.l"
+ { /* Double quoted '"' string start */
+ yy_push_state(ST_DOUBLE_QUOTES TSRMLS_CC);
+ return '"';
+}
+#line 2988 "Zend/zend_ini_scanner.c"
+yy239:
+ YYDEBUG(239, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych <= '\\') {
+ if (yych <= 0x00) goto yy227;
+ if (yych <= '[') goto yy255;
+ goto yy262;
+ } else {
+ if (yych == '{') goto yy300;
+ goto yy255;
+ }
+yy240:
+ YYDEBUG(240, *YYCURSOR);
+ yyaccept = 2;
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yybm[0+yych] & 128) {
+ goto yy296;
+ }
+ goto yy227;
+yy241:
+ YYDEBUG(241, *YYCURSOR);
+ yyaccept = 0;
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yych <= '/') goto yy256;
+ if (yych <= '9') goto yy294;
+ goto yy256;
+yy242:
+ YYDEBUG(242, *YYCURSOR);
+ yyaccept = 0;
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yych <= '/') goto yy256;
+ if (yych <= '9') goto yy292;
+ goto yy256;
+yy243:
+ YYDEBUG(243, *YYCURSOR);
+ yyaccept = 3;
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yych <= '/') {
+ if (yych <= 0x1F) {
+ if (yych <= '\n') {
+ if (yych <= 0x00) goto yy244;
+ if (yych <= 0x08) goto yy256;
+ } else {
+ if (yych != '\r') goto yy256;
+ }
+ } else {
+ if (yych <= ')') {
+ if (yych <= '"') goto yy244;
+ if (yych <= '%') goto yy256;
+ } else {
+ if (yych == '.') goto yy288;
+ goto yy256;
+ }
+ }
+ } else {
+ if (yych <= ']') {
+ if (yych <= ';') {
+ if (yych <= '9') goto yy290;
+ if (yych <= ':') goto yy256;
+ } else {
+ if (yych != '=') goto yy256;
+ }
+ } else {
+ if (yych <= '|') {
+ if (yych <= '^') goto yy244;
+ if (yych <= '{') goto yy256;
+ } else {
+ if (yych != '~') goto yy256;
+ }
+ }
+ }
+yy244:
+ YYDEBUG(244, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 497 "Zend/zend_ini_scanner.l"
+ { /* Get number option value as string */
+ RETURN_TOKEN(TC_NUMBER, yytext, yyleng);
+}
+#line 3067 "Zend/zend_ini_scanner.c"
+yy245:
+ YYDEBUG(245, *YYCURSOR);
+ yyaccept = 2;
+ yych = *(YYMARKER = ++YYCURSOR);
+ goto yy284;
+yy246:
+ YYDEBUG(246, *YYCURSOR);
+ ++YYCURSOR;
+ YYDEBUG(247, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 509 "Zend/zend_ini_scanner.l"
+ { /* Make = used in option value to trigger error */
+ yyless(0);
+ BEGIN(INITIAL);
+ return END_OF_LINE;
+}
+#line 3084 "Zend/zend_ini_scanner.c"
+yy248:
+ YYDEBUG(248, *YYCURSOR);
+ yyaccept = 4;
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yybm[0+yych] & 4) {
+ goto yy257;
+ }
+ if (yych <= ':') {
+ if (yych <= '\r') {
+ if (yych <= 0x08) {
+ if (yych >= 0x01) goto yy256;
+ } else {
+ if (yych <= '\n') goto yy249;
+ if (yych <= '\f') goto yy256;
+ }
+ } else {
+ if (yych <= '"') {
+ if (yych <= 0x1F) goto yy256;
+ } else {
+ if (yych <= '%') goto yy256;
+ if (yych >= '*') goto yy256;
+ }
+ }
+ } else {
+ if (yych <= '^') {
+ if (yych <= '<') {
+ if (yych >= '<') goto yy256;
+ } else {
+ if (yych <= '=') goto yy249;
+ if (yych <= ']') goto yy256;
+ }
+ } else {
+ if (yych <= '|') {
+ if (yych <= '{') goto yy256;
+ } else {
+ if (yych != '~') goto yy256;
+ }
+ }
+ }
+yy249:
+ YYDEBUG(249, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 493 "Zend/zend_ini_scanner.l"
+ { /* Get constant option value */
+ RETURN_TOKEN(TC_CONSTANT, yytext, yyleng);
+}
+#line 3131 "Zend/zend_ini_scanner.c"
+yy250:
+ YYDEBUG(250, *YYCURSOR);
+ yyaccept = 4;
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yych <= '<') {
+ if (yych <= '"') {
+ if (yych <= '\n') {
+ if (yych <= 0x00) goto yy249;
+ if (yych <= 0x08) goto yy256;
+ goto yy249;
+ } else {
+ if (yych == '\r') goto yy249;
+ if (yych <= 0x1F) goto yy256;
+ goto yy249;
+ }
+ } else {
+ if (yych <= '/') {
+ if (yych <= '%') goto yy256;
+ if (yych <= ')') goto yy249;
+ goto yy256;
+ } else {
+ if (yych <= '9') goto yy257;
+ if (yych == ';') goto yy249;
+ goto yy256;
+ }
+ }
+ } else {
+ if (yych <= '_') {
+ if (yych <= 'A') {
+ if (yych <= '=') goto yy249;
+ if (yych <= '@') goto yy256;
+ goto yy280;
+ } else {
+ if (yych <= 'Z') goto yy257;
+ if (yych <= ']') goto yy256;
+ if (yych <= '^') goto yy249;
+ goto yy257;
+ }
+ } else {
+ if (yych <= '{') {
+ if (yych <= '`') goto yy256;
+ if (yych <= 'a') goto yy280;
+ if (yych <= 'z') goto yy257;
+ goto yy256;
+ } else {
+ if (yych == '}') goto yy256;
+ if (yych <= '~') goto yy249;
+ goto yy256;
+ }
+ }
+ }
+yy251:
+ YYDEBUG(251, *YYCURSOR);
+ yyaccept = 4;
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yych <= 'N') {
+ if (yych <= '%') {
+ if (yych <= '\f') {
+ if (yych <= 0x00) goto yy249;
+ if (yych <= 0x08) goto yy256;
+ if (yych <= '\n') goto yy249;
+ goto yy256;
+ } else {
+ if (yych <= '\r') goto yy249;
+ if (yych <= 0x1F) goto yy256;
+ if (yych <= '"') goto yy249;
+ goto yy256;
+ }
+ } else {
+ if (yych <= ':') {
+ if (yych <= ')') goto yy249;
+ if (yych <= '/') goto yy256;
+ if (yych <= '9') goto yy257;
+ goto yy256;
+ } else {
+ if (yych <= '<') {
+ if (yych <= ';') goto yy249;
+ goto yy256;
+ } else {
+ if (yych <= '=') goto yy249;
+ if (yych <= '@') goto yy256;
+ goto yy257;
+ }
+ }
+ }
+ } else {
+ if (yych <= 'n') {
+ if (yych <= 'Z') {
+ if (yych <= 'O') goto yy276;
+ if (yych == 'U') goto yy277;
+ goto yy257;
+ } else {
+ if (yych <= '^') {
+ if (yych <= ']') goto yy256;
+ goto yy249;
+ } else {
+ if (yych == '`') goto yy256;
+ goto yy257;
+ }
+ }
+ } else {
+ if (yych <= 'z') {
+ if (yych <= 'o') goto yy276;
+ if (yych == 'u') goto yy277;
+ goto yy257;
+ } else {
+ if (yych <= '|') {
+ if (yych <= '{') goto yy256;
+ goto yy249;
+ } else {
+ if (yych == '~') goto yy249;
+ goto yy256;
+ }
+ }
+ }
+ }
+yy252:
+ YYDEBUG(252, *YYCURSOR);
+ yyaccept = 4;
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yych <= 'E') {
+ if (yych <= '%') {
+ if (yych <= '\f') {
+ if (yych <= 0x00) goto yy249;
+ if (yych <= 0x08) goto yy256;
+ if (yych <= '\n') goto yy249;
+ goto yy256;
+ } else {
+ if (yych <= '\r') goto yy249;
+ if (yych <= 0x1F) goto yy256;
+ if (yych <= '"') goto yy249;
+ goto yy256;
+ }
+ } else {
+ if (yych <= ':') {
+ if (yych <= ')') goto yy249;
+ if (yych <= '/') goto yy256;
+ if (yych <= '9') goto yy257;
+ goto yy256;
+ } else {
+ if (yych <= '<') {
+ if (yych <= ';') goto yy249;
+ goto yy256;
+ } else {
+ if (yych <= '=') goto yy249;
+ if (yych <= '@') goto yy256;
+ goto yy257;
+ }
+ }
+ }
+ } else {
+ if (yych <= 'e') {
+ if (yych <= 'Z') {
+ if (yych <= 'F') goto yy271;
+ if (yych == 'N') goto yy265;
+ goto yy257;
+ } else {
+ if (yych <= '^') {
+ if (yych <= ']') goto yy256;
+ goto yy249;
+ } else {
+ if (yych == '`') goto yy256;
+ goto yy257;
+ }
+ }
+ } else {
+ if (yych <= 'z') {
+ if (yych <= 'f') goto yy271;
+ if (yych == 'n') goto yy265;
+ goto yy257;
+ } else {
+ if (yych <= '|') {
+ if (yych <= '{') goto yy256;
+ goto yy249;
+ } else {
+ if (yych == '~') goto yy249;
+ goto yy256;
+ }
+ }
+ }
+ }
+yy253:
+ YYDEBUG(253, *YYCURSOR);
+ yyaccept = 4;
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yych <= '=') {
+ if (yych <= '"') {
+ if (yych <= '\n') {
+ if (yych <= 0x00) goto yy249;
+ if (yych <= 0x08) goto yy256;
+ goto yy249;
+ } else {
+ if (yych == '\r') goto yy249;
+ if (yych <= 0x1F) goto yy256;
+ goto yy249;
+ }
+ } else {
+ if (yych <= '9') {
+ if (yych <= '%') goto yy256;
+ if (yych <= ')') goto yy249;
+ if (yych <= '/') goto yy256;
+ goto yy257;
+ } else {
+ if (yych == ';') goto yy249;
+ if (yych <= '<') goto yy256;
+ goto yy249;
+ }
+ }
+ } else {
+ if (yych <= '`') {
+ if (yych <= 'Z') {
+ if (yych <= '@') goto yy256;
+ if (yych == 'R') goto yy269;
+ goto yy257;
+ } else {
+ if (yych <= ']') goto yy256;
+ if (yych <= '^') goto yy249;
+ if (yych <= '_') goto yy257;
+ goto yy256;
+ }
+ } else {
+ if (yych <= '{') {
+ if (yych == 'r') goto yy269;
+ if (yych <= 'z') goto yy257;
+ goto yy256;
+ } else {
+ if (yych == '}') goto yy256;
+ if (yych <= '~') goto yy249;
+ goto yy256;
+ }
+ }
+ }
+yy254:
+ YYDEBUG(254, *YYCURSOR);
+ yyaccept = 4;
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yych <= '=') {
+ if (yych <= '"') {
+ if (yych <= '\n') {
+ if (yych <= 0x00) goto yy249;
+ if (yych <= 0x08) goto yy256;
+ goto yy249;
+ } else {
+ if (yych == '\r') goto yy249;
+ if (yych <= 0x1F) goto yy256;
+ goto yy249;
+ }
+ } else {
+ if (yych <= '9') {
+ if (yych <= '%') goto yy256;
+ if (yych <= ')') goto yy249;
+ if (yych <= '/') goto yy256;
+ goto yy257;
+ } else {
+ if (yych == ';') goto yy249;
+ if (yych <= '<') goto yy256;
+ goto yy249;
+ }
+ }
+ } else {
+ if (yych <= '`') {
+ if (yych <= 'Z') {
+ if (yych <= '@') goto yy256;
+ if (yych == 'E') goto yy259;
+ goto yy257;
+ } else {
+ if (yych <= ']') goto yy256;
+ if (yych <= '^') goto yy249;
+ if (yych <= '_') goto yy257;
+ goto yy256;
+ }
+ } else {
+ if (yych <= '{') {
+ if (yych == 'e') goto yy259;
+ if (yych <= 'z') goto yy257;
+ goto yy256;
+ } else {
+ if (yych == '}') goto yy256;
+ if (yych <= '~') goto yy249;
+ goto yy256;
+ }
+ }
+ }
+yy255:
+ YYDEBUG(255, *YYCURSOR);
+ yyaccept = 0;
+ YYMARKER = ++YYCURSOR;
+ YYFILL(1);
+ yych = *YYCURSOR;
+yy256:
+ YYDEBUG(256, *YYCURSOR);
+ if (yybm[0+yych] & 2) {
+ goto yy255;
+ }
+ if (yych == '$') goto yy260;
+ goto yy229;
+yy257:
+ YYDEBUG(257, *YYCURSOR);
+ yyaccept = 4;
+ YYMARKER = ++YYCURSOR;
+ YYFILL(1);
+ yych = *YYCURSOR;
+ YYDEBUG(258, *YYCURSOR);
+ if (yybm[0+yych] & 4) {
+ goto yy257;
+ }
+ if (yych <= ')') {
+ if (yych <= '\r') {
+ if (yych <= 0x08) {
+ if (yych <= 0x00) goto yy249;
+ goto yy255;
+ } else {
+ if (yych <= '\n') goto yy249;
+ if (yych <= '\f') goto yy255;
+ goto yy249;
+ }
+ } else {
+ if (yych <= '#') {
+ if (yych <= 0x1F) goto yy255;
+ if (yych <= '"') goto yy249;
+ goto yy255;
+ } else {
+ if (yych <= '$') goto yy260;
+ if (yych <= '%') goto yy255;
+ goto yy249;
+ }
+ }
+ } else {
+ if (yych <= ']') {
+ if (yych <= ';') {
+ if (yych <= ':') goto yy255;
+ goto yy249;
+ } else {
+ if (yych == '=') goto yy249;
+ goto yy255;
+ }
+ } else {
+ if (yych <= '|') {
+ if (yych <= '^') goto yy249;
+ if (yych <= '{') goto yy255;
+ goto yy249;
+ } else {
+ if (yych == '~') goto yy249;
+ goto yy255;
+ }
+ }
+ }
+yy259:
+ YYDEBUG(259, *YYCURSOR);
+ yyaccept = 4;
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yych <= '=') {
+ if (yych <= '"') {
+ if (yych <= '\n') {
+ if (yych <= 0x00) goto yy249;
+ if (yych <= 0x08) goto yy256;
+ goto yy249;
+ } else {
+ if (yych == '\r') goto yy249;
+ if (yych <= 0x1F) goto yy256;
+ goto yy249;
+ }
+ } else {
+ if (yych <= '9') {
+ if (yych <= '%') goto yy256;
+ if (yych <= ')') goto yy249;
+ if (yych <= '/') goto yy256;
+ goto yy257;
+ } else {
+ if (yych == ';') goto yy249;
+ if (yych <= '<') goto yy256;
+ goto yy249;
+ }
+ }
+ } else {
+ if (yych <= '`') {
+ if (yych <= 'Z') {
+ if (yych <= '@') goto yy256;
+ if (yych == 'S') goto yy265;
+ goto yy257;
+ } else {
+ if (yych <= ']') goto yy256;
+ if (yych <= '^') goto yy249;
+ if (yych <= '_') goto yy257;
+ goto yy256;
+ }
+ } else {
+ if (yych <= '{') {
+ if (yych == 's') goto yy265;
+ if (yych <= 'z') goto yy257;
+ goto yy256;
+ } else {
+ if (yych == '}') goto yy256;
+ if (yych <= '~') goto yy249;
+ goto yy256;
+ }
+ }
+ }
+yy260:
+ YYDEBUG(260, *YYCURSOR);
+ ++YYCURSOR;
+ YYFILL(1);
+ yych = *YYCURSOR;
+ if (yych <= '\\') {
+ if (yych <= 0x00) goto yy261;
+ if (yych <= '[') goto yy255;
+ goto yy262;
+ } else {
+ if (yych != '{') goto yy255;
+ }
+yy261:
+ YYDEBUG(261, *YYCURSOR);
+ YYCURSOR = YYMARKER;
+ if (yyaccept <= 3) {
+ if (yyaccept <= 1) {
+ if (yyaccept <= 0) {
+ goto yy229;
+ } else {
+ goto yy231;
+ }
+ } else {
+ if (yyaccept <= 2) {
+ goto yy227;
+ } else {
+ goto yy244;
+ }
+ }
+ } else {
+ if (yyaccept <= 5) {
+ if (yyaccept <= 4) {
+ goto yy249;
+ } else {
+ goto yy266;
+ }
+ } else {
+ goto yy273;
+ }
+ }
+yy262:
+ YYDEBUG(262, *YYCURSOR);
+ ++YYCURSOR;
+ YYFILL(1);
+ yych = *YYCURSOR;
+ if (yybm[0+yych] & 8) {
+ goto yy263;
+ }
+ goto yy255;
+yy263:
+ YYDEBUG(263, *YYCURSOR);
+ ++YYCURSOR;
+ YYFILL(1);
+ yych = *YYCURSOR;
+ YYDEBUG(264, *YYCURSOR);
+ if (yybm[0+yych] & 8) {
+ goto yy263;
+ }
+ if (yych <= 0x00) goto yy229;
+ if (yych == '\\') goto yy262;
+ goto yy255;
+yy265:
+ YYDEBUG(265, *YYCURSOR);
+ yyaccept = 5;
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yybm[0+yych] & 16) {
+ goto yy267;
+ }
+ if (yych <= ';') {
+ if (yych <= ' ') {
+ if (yych <= '\n') {
+ if (yych <= 0x00) goto yy266;
+ if (yych <= '\t') goto yy256;
+ } else {
+ if (yych != '\r') goto yy256;
+ }
+ } else {
+ if (yych <= ')') {
+ if (yych <= '"') goto yy266;
+ if (yych <= '%') goto yy256;
+ } else {
+ if (yych <= '/') goto yy256;
+ if (yych <= '9') goto yy257;
+ if (yych <= ':') goto yy256;
+ }
+ }
+ } else {
+ if (yych <= '_') {
+ if (yych <= '@') {
+ if (yych != '=') goto yy256;
+ } else {
+ if (yych <= 'Z') goto yy257;
+ if (yych <= ']') goto yy256;
+ if (yych >= '_') goto yy257;
+ }
+ } else {
+ if (yych <= '{') {
+ if (yych <= '`') goto yy256;
+ if (yych <= 'z') goto yy257;
+ goto yy256;
+ } else {
+ if (yych == '}') goto yy256;
+ if (yych >= 0x7F) goto yy256;
+ }
+ }
+ }
+yy266:
+ YYDEBUG(266, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 419 "Zend/zend_ini_scanner.l"
+ { /* TRUE value (when used outside option value/offset this causes parse error!) */
+ RETURN_TOKEN(BOOL_TRUE, "1", 1);
+}
+#line 3643 "Zend/zend_ini_scanner.c"
+yy267:
+ YYDEBUG(267, *YYCURSOR);
+ ++YYCURSOR;
+ YYFILL(1);
+ yych = *YYCURSOR;
+ YYDEBUG(268, *YYCURSOR);
+ if (yybm[0+yych] & 16) {
+ goto yy267;
+ }
+ goto yy266;
+yy269:
+ YYDEBUG(269, *YYCURSOR);
+ yyaccept = 4;
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yych <= '=') {
+ if (yych <= '"') {
+ if (yych <= '\n') {
+ if (yych <= 0x00) goto yy249;
+ if (yych <= 0x08) goto yy256;
+ goto yy249;
+ } else {
+ if (yych == '\r') goto yy249;
+ if (yych <= 0x1F) goto yy256;
+ goto yy249;
+ }
+ } else {
+ if (yych <= '9') {
+ if (yych <= '%') goto yy256;
+ if (yych <= ')') goto yy249;
+ if (yych <= '/') goto yy256;
+ goto yy257;
+ } else {
+ if (yych == ';') goto yy249;
+ if (yych <= '<') goto yy256;
+ goto yy249;
+ }
+ }
+ } else {
+ if (yych <= '`') {
+ if (yych <= 'Z') {
+ if (yych <= '@') goto yy256;
+ if (yych != 'U') goto yy257;
+ } else {
+ if (yych <= ']') goto yy256;
+ if (yych <= '^') goto yy249;
+ if (yych <= '_') goto yy257;
+ goto yy256;
+ }
+ } else {
+ if (yych <= '{') {
+ if (yych == 'u') goto yy270;
+ if (yych <= 'z') goto yy257;
+ goto yy256;
+ } else {
+ if (yych == '}') goto yy256;
+ if (yych <= '~') goto yy249;
+ goto yy256;
+ }
+ }
+ }
+yy270:
+ YYDEBUG(270, *YYCURSOR);
+ yyaccept = 4;
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yych <= '=') {
+ if (yych <= '"') {
+ if (yych <= '\n') {
+ if (yych <= 0x00) goto yy249;
+ if (yych <= 0x08) goto yy256;
+ goto yy249;
+ } else {
+ if (yych == '\r') goto yy249;
+ if (yych <= 0x1F) goto yy256;
+ goto yy249;
+ }
+ } else {
+ if (yych <= '9') {
+ if (yych <= '%') goto yy256;
+ if (yych <= ')') goto yy249;
+ if (yych <= '/') goto yy256;
+ goto yy257;
+ } else {
+ if (yych == ';') goto yy249;
+ if (yych <= '<') goto yy256;
+ goto yy249;
+ }
+ }
+ } else {
+ if (yych <= '`') {
+ if (yych <= 'Z') {
+ if (yych <= '@') goto yy256;
+ if (yych == 'E') goto yy265;
+ goto yy257;
+ } else {
+ if (yych <= ']') goto yy256;
+ if (yych <= '^') goto yy249;
+ if (yych <= '_') goto yy257;
+ goto yy256;
+ }
+ } else {
+ if (yych <= '{') {
+ if (yych == 'e') goto yy265;
+ if (yych <= 'z') goto yy257;
+ goto yy256;
+ } else {
+ if (yych == '}') goto yy256;
+ if (yych <= '~') goto yy249;
+ goto yy256;
+ }
+ }
+ }
+yy271:
+ YYDEBUG(271, *YYCURSOR);
+ yyaccept = 4;
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yych <= '=') {
+ if (yych <= '"') {
+ if (yych <= '\n') {
+ if (yych <= 0x00) goto yy249;
+ if (yych <= 0x08) goto yy256;
+ goto yy249;
+ } else {
+ if (yych == '\r') goto yy249;
+ if (yych <= 0x1F) goto yy256;
+ goto yy249;
+ }
+ } else {
+ if (yych <= '9') {
+ if (yych <= '%') goto yy256;
+ if (yych <= ')') goto yy249;
+ if (yych <= '/') goto yy256;
+ goto yy257;
+ } else {
+ if (yych == ';') goto yy249;
+ if (yych <= '<') goto yy256;
+ goto yy249;
+ }
+ }
+ } else {
+ if (yych <= '`') {
+ if (yych <= 'Z') {
+ if (yych <= '@') goto yy256;
+ if (yych != 'F') goto yy257;
+ } else {
+ if (yych <= ']') goto yy256;
+ if (yych <= '^') goto yy249;
+ if (yych <= '_') goto yy257;
+ goto yy256;
+ }
+ } else {
+ if (yych <= '{') {
+ if (yych == 'f') goto yy272;
+ if (yych <= 'z') goto yy257;
+ goto yy256;
+ } else {
+ if (yych == '}') goto yy256;
+ if (yych <= '~') goto yy249;
+ goto yy256;
+ }
+ }
+ }
+yy272:
+ YYDEBUG(272, *YYCURSOR);
+ yyaccept = 6;
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yybm[0+yych] & 4) {
+ goto yy257;
+ }
+ if (yych <= ')') {
+ if (yych <= '\f') {
+ if (yych <= 0x08) {
+ if (yych >= 0x01) goto yy256;
+ } else {
+ if (yych <= '\t') goto yy274;
+ if (yych >= '\v') goto yy256;
+ }
+ } else {
+ if (yych <= ' ') {
+ if (yych <= '\r') goto yy273;
+ if (yych <= 0x1F) goto yy256;
+ goto yy274;
+ } else {
+ if (yych <= '"') goto yy273;
+ if (yych <= '%') goto yy256;
+ }
+ }
+ } else {
+ if (yych <= ']') {
+ if (yych <= ';') {
+ if (yych <= ':') goto yy256;
+ } else {
+ if (yych != '=') goto yy256;
+ }
+ } else {
+ if (yych <= '|') {
+ if (yych <= '^') goto yy273;
+ if (yych <= '{') goto yy256;
+ } else {
+ if (yych != '~') goto yy256;
+ }
+ }
+ }
+yy273:
+ YYDEBUG(273, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 423 "Zend/zend_ini_scanner.l"
+ { /* FALSE value (when used outside option value/offset this causes parse error!)*/
+ RETURN_TOKEN(BOOL_FALSE, "", 0);
+}
+#line 3853 "Zend/zend_ini_scanner.c"
+yy274:
+ YYDEBUG(274, *YYCURSOR);
+ ++YYCURSOR;
+ YYFILL(1);
+ yych = *YYCURSOR;
+ YYDEBUG(275, *YYCURSOR);
+ if (yych == '\t') goto yy274;
+ if (yych == ' ') goto yy274;
+ goto yy273;
+yy276:
+ YYDEBUG(276, *YYCURSOR);
+ yyaccept = 6;
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yych <= '<') {
+ if (yych <= ' ') {
+ if (yych <= '\n') {
+ if (yych <= 0x00) goto yy273;
+ if (yych <= 0x08) goto yy256;
+ if (yych <= '\t') goto yy274;
+ goto yy273;
+ } else {
+ if (yych == '\r') goto yy273;
+ if (yych <= 0x1F) goto yy256;
+ goto yy274;
+ }
+ } else {
+ if (yych <= '/') {
+ if (yych <= '"') goto yy273;
+ if (yych <= '%') goto yy256;
+ if (yych <= ')') goto yy273;
+ goto yy256;
+ } else {
+ if (yych <= '9') goto yy257;
+ if (yych == ';') goto yy273;
+ goto yy256;
+ }
+ }
+ } else {
+ if (yych <= '_') {
+ if (yych <= 'N') {
+ if (yych <= '=') goto yy273;
+ if (yych <= '@') goto yy256;
+ if (yych <= 'M') goto yy257;
+ goto yy279;
+ } else {
+ if (yych <= 'Z') goto yy257;
+ if (yych <= ']') goto yy256;
+ if (yych <= '^') goto yy273;
+ goto yy257;
+ }
+ } else {
+ if (yych <= 'z') {
+ if (yych <= '`') goto yy256;
+ if (yych == 'n') goto yy279;
+ goto yy257;
+ } else {
+ if (yych <= '|') {
+ if (yych <= '{') goto yy256;
+ goto yy273;
+ } else {
+ if (yych == '~') goto yy273;
+ goto yy256;
+ }
+ }
+ }
+ }
+yy277:
+ YYDEBUG(277, *YYCURSOR);
+ yyaccept = 4;
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yych <= '=') {
+ if (yych <= '"') {
+ if (yych <= '\n') {
+ if (yych <= 0x00) goto yy249;
+ if (yych <= 0x08) goto yy256;
+ goto yy249;
+ } else {
+ if (yych == '\r') goto yy249;
+ if (yych <= 0x1F) goto yy256;
+ goto yy249;
+ }
+ } else {
+ if (yych <= '9') {
+ if (yych <= '%') goto yy256;
+ if (yych <= ')') goto yy249;
+ if (yych <= '/') goto yy256;
+ goto yy257;
+ } else {
+ if (yych == ';') goto yy249;
+ if (yych <= '<') goto yy256;
+ goto yy249;
+ }
+ }
+ } else {
+ if (yych <= '`') {
+ if (yych <= 'Z') {
+ if (yych <= '@') goto yy256;
+ if (yych != 'L') goto yy257;
+ } else {
+ if (yych <= ']') goto yy256;
+ if (yych <= '^') goto yy249;
+ if (yych <= '_') goto yy257;
+ goto yy256;
+ }
+ } else {
+ if (yych <= '{') {
+ if (yych == 'l') goto yy278;
+ if (yych <= 'z') goto yy257;
+ goto yy256;
+ } else {
+ if (yych == '}') goto yy256;
+ if (yych <= '~') goto yy249;
+ goto yy256;
+ }
+ }
+ }
+yy278:
+ YYDEBUG(278, *YYCURSOR);
+ yyaccept = 4;
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yych <= '=') {
+ if (yych <= '"') {
+ if (yych <= '\n') {
+ if (yych <= 0x00) goto yy249;
+ if (yych <= 0x08) goto yy256;
+ goto yy249;
+ } else {
+ if (yych == '\r') goto yy249;
+ if (yych <= 0x1F) goto yy256;
+ goto yy249;
+ }
+ } else {
+ if (yych <= '9') {
+ if (yych <= '%') goto yy256;
+ if (yych <= ')') goto yy249;
+ if (yych <= '/') goto yy256;
+ goto yy257;
+ } else {
+ if (yych == ';') goto yy249;
+ if (yych <= '<') goto yy256;
+ goto yy249;
+ }
+ }
+ } else {
+ if (yych <= '`') {
+ if (yych <= 'Z') {
+ if (yych <= '@') goto yy256;
+ if (yych == 'L') goto yy272;
+ goto yy257;
+ } else {
+ if (yych <= ']') goto yy256;
+ if (yych <= '^') goto yy249;
+ if (yych <= '_') goto yy257;
+ goto yy256;
+ }
+ } else {
+ if (yych <= '{') {
+ if (yych == 'l') goto yy272;
+ if (yych <= 'z') goto yy257;
+ goto yy256;
+ } else {
+ if (yych == '}') goto yy256;
+ if (yych <= '~') goto yy249;
+ goto yy256;
+ }
+ }
+ }
+yy279:
+ YYDEBUG(279, *YYCURSOR);
+ yyaccept = 4;
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yych <= '=') {
+ if (yych <= '"') {
+ if (yych <= '\n') {
+ if (yych <= 0x00) goto yy249;
+ if (yych <= 0x08) goto yy256;
+ goto yy249;
+ } else {
+ if (yych == '\r') goto yy249;
+ if (yych <= 0x1F) goto yy256;
+ goto yy249;
+ }
+ } else {
+ if (yych <= '9') {
+ if (yych <= '%') goto yy256;
+ if (yych <= ')') goto yy249;
+ if (yych <= '/') goto yy256;
+ goto yy257;
+ } else {
+ if (yych == ';') goto yy249;
+ if (yych <= '<') goto yy256;
+ goto yy249;
+ }
+ }
+ } else {
+ if (yych <= '`') {
+ if (yych <= 'Z') {
+ if (yych <= '@') goto yy256;
+ if (yych == 'E') goto yy272;
+ goto yy257;
+ } else {
+ if (yych <= ']') goto yy256;
+ if (yych <= '^') goto yy249;
+ if (yych <= '_') goto yy257;
+ goto yy256;
+ }
+ } else {
+ if (yych <= '{') {
+ if (yych == 'e') goto yy272;
+ if (yych <= 'z') goto yy257;
+ goto yy256;
+ } else {
+ if (yych == '}') goto yy256;
+ if (yych <= '~') goto yy249;
+ goto yy256;
+ }
+ }
+ }
+yy280:
+ YYDEBUG(280, *YYCURSOR);
+ yyaccept = 4;
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yych <= '=') {
+ if (yych <= '"') {
+ if (yych <= '\n') {
+ if (yych <= 0x00) goto yy249;
+ if (yych <= 0x08) goto yy256;
+ goto yy249;
+ } else {
+ if (yych == '\r') goto yy249;
+ if (yych <= 0x1F) goto yy256;
+ goto yy249;
+ }
+ } else {
+ if (yych <= '9') {
+ if (yych <= '%') goto yy256;
+ if (yych <= ')') goto yy249;
+ if (yych <= '/') goto yy256;
+ goto yy257;
+ } else {
+ if (yych == ';') goto yy249;
+ if (yych <= '<') goto yy256;
+ goto yy249;
+ }
+ }
+ } else {
+ if (yych <= '`') {
+ if (yych <= 'Z') {
+ if (yych <= '@') goto yy256;
+ if (yych != 'L') goto yy257;
+ } else {
+ if (yych <= ']') goto yy256;
+ if (yych <= '^') goto yy249;
+ if (yych <= '_') goto yy257;
+ goto yy256;
+ }
+ } else {
+ if (yych <= '{') {
+ if (yych == 'l') goto yy281;
+ if (yych <= 'z') goto yy257;
+ goto yy256;
+ } else {
+ if (yych == '}') goto yy256;
+ if (yych <= '~') goto yy249;
+ goto yy256;
+ }
+ }
+ }
+yy281:
+ YYDEBUG(281, *YYCURSOR);
+ yyaccept = 4;
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yych <= '=') {
+ if (yych <= '"') {
+ if (yych <= '\n') {
+ if (yych <= 0x00) goto yy249;
+ if (yych <= 0x08) goto yy256;
+ goto yy249;
+ } else {
+ if (yych == '\r') goto yy249;
+ if (yych <= 0x1F) goto yy256;
+ goto yy249;
+ }
+ } else {
+ if (yych <= '9') {
+ if (yych <= '%') goto yy256;
+ if (yych <= ')') goto yy249;
+ if (yych <= '/') goto yy256;
+ goto yy257;
+ } else {
+ if (yych == ';') goto yy249;
+ if (yych <= '<') goto yy256;
+ goto yy249;
+ }
+ }
+ } else {
+ if (yych <= '`') {
+ if (yych <= 'Z') {
+ if (yych <= '@') goto yy256;
+ if (yych != 'S') goto yy257;
+ } else {
+ if (yych <= ']') goto yy256;
+ if (yych <= '^') goto yy249;
+ if (yych <= '_') goto yy257;
+ goto yy256;
+ }
+ } else {
+ if (yych <= '{') {
+ if (yych == 's') goto yy282;
+ if (yych <= 'z') goto yy257;
+ goto yy256;
+ } else {
+ if (yych == '}') goto yy256;
+ if (yych <= '~') goto yy249;
+ goto yy256;
+ }
+ }
+ }
+yy282:
+ YYDEBUG(282, *YYCURSOR);
+ yyaccept = 4;
+ yych = *(YYMARKER = ++YYCURSOR);
+ if (yych <= '=') {
+ if (yych <= '"') {
+ if (yych <= '\n') {
+ if (yych <= 0x00) goto yy249;
+ if (yych <= 0x08) goto yy256;
+ goto yy249;
+ } else {
+ if (yych == '\r') goto yy249;
+ if (yych <= 0x1F) goto yy256;
+ goto yy249;
+ }
+ } else {
+ if (yych <= '9') {
+ if (yych <= '%') goto yy256;
+ if (yych <= ')') goto yy249;
+ if (yych <= '/') goto yy256;
+ goto yy257;
+ } else {
+ if (yych == ';') goto yy249;
+ if (yych <= '<') goto yy256;
+ goto yy249;
+ }
+ }
+ } else {
+ if (yych <= '`') {
+ if (yych <= 'Z') {
+ if (yych <= '@') goto yy256;
+ if (yych == 'E') goto yy272;
+ goto yy257;
+ } else {
+ if (yych <= ']') goto yy256;
+ if (yych <= '^') goto yy249;
+ if (yych <= '_') goto yy257;
+ goto yy256;
+ }
+ } else {
+ if (yych <= '{') {
+ if (yych == 'e') goto yy272;
+ if (yych <= 'z') goto yy257;
+ goto yy256;
+ } else {
+ if (yych == '}') goto yy256;
+ if (yych <= '~') goto yy249;
+ goto yy256;
+ }
+ }
+ }
+yy283:
+ YYDEBUG(283, *YYCURSOR);
+ ++YYCURSOR;
+ YYFILL(2);
+ yych = *YYCURSOR;
+yy284:
+ YYDEBUG(284, *YYCURSOR);
+ if (yybm[0+yych] & 32) {
+ goto yy283;
+ }
+ if (yych >= '\r') goto yy287;
+yy285:
+ YYDEBUG(285, *YYCURSOR);
+ ++YYCURSOR;
+yy286:
+ YYDEBUG(286, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 583 "Zend/zend_ini_scanner.l"
+ { /* Comment */
+ BEGIN(INITIAL);
+ SCNG(lineno)++;
+ return END_OF_LINE;
+}
+#line 4246 "Zend/zend_ini_scanner.c"
+yy287:
+ YYDEBUG(287, *YYCURSOR);
+ yych = *++YYCURSOR;
+ if (yych == '\n') goto yy285;
+ goto yy286;
+yy288:
+ YYDEBUG(288, *YYCURSOR);
+ yyaccept = 3;
+ YYMARKER = ++YYCURSOR;
+ YYFILL(1);
+ yych = *YYCURSOR;
+ YYDEBUG(289, *YYCURSOR);
+ if (yybm[0+yych] & 64) {
+ goto yy288;
+ }
+ if (yych <= ')') {
+ if (yych <= '\r') {
+ if (yych <= 0x08) {
+ if (yych <= 0x00) goto yy244;
+ goto yy255;
+ } else {
+ if (yych <= '\n') goto yy244;
+ if (yych <= '\f') goto yy255;
+ goto yy244;
+ }
+ } else {
+ if (yych <= '#') {
+ if (yych <= 0x1F) goto yy255;
+ if (yych <= '"') goto yy244;
+ goto yy255;
+ } else {
+ if (yych <= '$') goto yy260;
+ if (yych <= '%') goto yy255;
+ goto yy244;
+ }
+ }
+ } else {
+ if (yych <= ']') {
+ if (yych <= ';') {
+ if (yych <= ':') goto yy255;
+ goto yy244;
+ } else {
+ if (yych == '=') goto yy244;
+ goto yy255;
+ }
+ } else {
+ if (yych <= '|') {
+ if (yych <= '^') goto yy244;
+ if (yych <= '{') goto yy255;
+ goto yy244;
+ } else {
+ if (yych == '~') goto yy244;
+ goto yy255;
+ }
+ }
+ }
+yy290:
+ YYDEBUG(290, *YYCURSOR);
+ yyaccept = 3;
+ YYMARKER = ++YYCURSOR;
+ YYFILL(1);
+ yych = *YYCURSOR;
+ YYDEBUG(291, *YYCURSOR);
+ if (yych <= '.') {
+ if (yych <= 0x1F) {
+ if (yych <= '\n') {
+ if (yych <= 0x00) goto yy244;
+ if (yych <= 0x08) goto yy255;
+ goto yy244;
+ } else {
+ if (yych == '\r') goto yy244;
+ goto yy255;
+ }
+ } else {
+ if (yych <= '$') {
+ if (yych <= '"') goto yy244;
+ if (yych <= '#') goto yy255;
+ goto yy260;
+ } else {
+ if (yych <= '%') goto yy255;
+ if (yych <= ')') goto yy244;
+ if (yych <= '-') goto yy255;
+ goto yy288;
+ }
+ }
+ } else {
+ if (yych <= '=') {
+ if (yych <= ':') {
+ if (yych <= '/') goto yy255;
+ if (yych <= '9') goto yy290;
+ goto yy255;
+ } else {
+ if (yych == '<') goto yy255;
+ goto yy244;
+ }
+ } else {
+ if (yych <= '{') {
+ if (yych == '^') goto yy244;
+ goto yy255;
+ } else {
+ if (yych == '}') goto yy255;
+ if (yych <= '~') goto yy244;
+ goto yy255;
+ }
+ }
+ }
+yy292:
+ YYDEBUG(292, *YYCURSOR);
+ yyaccept = 3;
+ YYMARKER = ++YYCURSOR;
+ YYFILL(1);
+ yych = *YYCURSOR;
+ YYDEBUG(293, *YYCURSOR);
+ if (yych <= '/') {
+ if (yych <= 0x1F) {
+ if (yych <= '\n') {
+ if (yych <= 0x00) goto yy244;
+ if (yych <= 0x08) goto yy255;
+ goto yy244;
+ } else {
+ if (yych == '\r') goto yy244;
+ goto yy255;
+ }
+ } else {
+ if (yych <= '$') {
+ if (yych <= '"') goto yy244;
+ if (yych <= '#') goto yy255;
+ goto yy260;
+ } else {
+ if (yych <= '%') goto yy255;
+ if (yych <= ')') goto yy244;
+ goto yy255;
+ }
+ }
+ } else {
+ if (yych <= ']') {
+ if (yych <= ';') {
+ if (yych <= '9') goto yy292;
+ if (yych <= ':') goto yy255;
+ goto yy244;
+ } else {
+ if (yych == '=') goto yy244;
+ goto yy255;
+ }
+ } else {
+ if (yych <= '|') {
+ if (yych <= '^') goto yy244;
+ if (yych <= '{') goto yy255;
+ goto yy244;
+ } else {
+ if (yych == '~') goto yy244;
+ goto yy255;
+ }
+ }
+ }
+yy294:
+ YYDEBUG(294, *YYCURSOR);
+ yyaccept = 3;
+ YYMARKER = ++YYCURSOR;
+ YYFILL(1);
+ yych = *YYCURSOR;
+ YYDEBUG(295, *YYCURSOR);
+ if (yych <= '/') {
+ if (yych <= 0x1F) {
+ if (yych <= '\n') {
+ if (yych <= 0x00) goto yy244;
+ if (yych <= 0x08) goto yy255;
+ goto yy244;
+ } else {
+ if (yych == '\r') goto yy244;
+ goto yy255;
+ }
+ } else {
+ if (yych <= '$') {
+ if (yych <= '"') goto yy244;
+ if (yych <= '#') goto yy255;
+ goto yy260;
+ } else {
+ if (yych <= '%') goto yy255;
+ if (yych <= ')') goto yy244;
+ goto yy255;
+ }
+ }
+ } else {
+ if (yych <= ']') {
+ if (yych <= ';') {
+ if (yych <= '9') goto yy294;
+ if (yych <= ':') goto yy255;
+ goto yy244;
+ } else {
+ if (yych == '=') goto yy244;
+ goto yy255;
+ }
+ } else {
+ if (yych <= '|') {
+ if (yych <= '^') goto yy244;
+ if (yych <= '{') goto yy255;
+ goto yy244;
+ } else {
+ if (yych == '~') goto yy244;
+ goto yy255;
+ }
+ }
+ }
+yy296:
+ YYDEBUG(296, *YYCURSOR);
+ ++YYCURSOR;
+ YYFILL(1);
+ yych = *YYCURSOR;
+ YYDEBUG(297, *YYCURSOR);
+ if (yybm[0+yych] & 128) {
+ goto yy296;
+ }
+ YYDEBUG(298, *YYCURSOR);
+ ++YYCURSOR;
+ YYDEBUG(299, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 366 "Zend/zend_ini_scanner.l"
+ { /* Raw string */
+ /* Eat leading and trailing single quotes */
+ if (yytext[0] == '\'' && yytext[yyleng - 1] == '\'') {
+ SCNG(yy_text)++;
+ yyleng = yyleng - 2;
+ }
+ RETURN_TOKEN(TC_RAW, yytext, yyleng);
+}
+#line 4473 "Zend/zend_ini_scanner.c"
+yy300:
+ YYDEBUG(300, *YYCURSOR);
+ ++YYCURSOR;
+ YYDEBUG(301, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 399 "Zend/zend_ini_scanner.l"
+ { /* Variable start */
+ yy_push_state(ST_VARNAME TSRMLS_CC);
+ return TC_DOLLAR_CURLY;
+}
+#line 4484 "Zend/zend_ini_scanner.c"
+yy302:
+ YYDEBUG(302, *YYCURSOR);
+ ++YYCURSOR;
+ YYFILL(1);
+ yych = *YYCURSOR;
+yy303:
+ YYDEBUG(303, *YYCURSOR);
+ if (yych == '\t') goto yy302;
+ if (yych == ' ') goto yy302;
+ goto yy236;
+yy304:
+ YYDEBUG(304, *YYCURSOR);
+ yych = *++YYCURSOR;
+ goto yy233;
+yy305:
+ YYDEBUG(305, *YYCURSOR);
+ yyaccept = 1;
+ YYMARKER = ++YYCURSOR;
+ YYFILL(2);
+ yych = *YYCURSOR;
+yy306:
+ YYDEBUG(306, *YYCURSOR);
+ if (yych <= 0x1F) {
+ if (yych <= '\n') {
+ if (yych <= 0x08) goto yy231;
+ if (yych <= '\t') goto yy305;
+ goto yy304;
+ } else {
+ if (yych == '\r') goto yy308;
+ goto yy231;
+ }
+ } else {
+ if (yych <= '"') {
+ if (yych <= ' ') goto yy305;
+ if (yych <= '!') goto yy231;
+ } else {
+ if (yych == ';') goto yy283;
+ goto yy231;
+ }
+ }
+ YYDEBUG(307, *YYCURSOR);
+ yych = *++YYCURSOR;
+ goto yy238;
+yy308:
+ YYDEBUG(308, *YYCURSOR);
+ ++YYCURSOR;
+ if ((yych = *YYCURSOR) == '\n') goto yy304;
+ goto yy233;
+ }
+/* *********************************** */
+yyc_ST_VARNAME:
+ {
+ static const unsigned char yybm[] = {
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 0, 0, 128, 128, 0, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 0, 0, 128, 0, 128, 0, 128,
+ 0, 0, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 0, 128, 0, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 0, 128, 128, 0, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 0, 0, 0, 0, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ };
+ YYDEBUG(309, *YYCURSOR);
+ YYFILL(2);
+ yych = *YYCURSOR;
+ if (yych <= ')') {
+ if (yych <= '"') {
+ if (yych <= '\f') {
+ if (yych <= 0x08) goto yy311;
+ if (yych <= '\n') goto yy313;
+ } else {
+ if (yych <= '\r') goto yy313;
+ if (yych >= '!') goto yy313;
+ }
+ } else {
+ if (yych <= '%') {
+ if (yych == '$') goto yy313;
+ } else {
+ if (yych != '\'') goto yy313;
+ }
+ }
+ } else {
+ if (yych <= '[') {
+ if (yych <= '<') {
+ if (yych == ';') goto yy313;
+ } else {
+ if (yych <= '=') goto yy313;
+ if (yych >= '[') goto yy313;
+ }
+ } else {
+ if (yych <= 'z') {
+ if (yych == '^') goto yy313;
+ } else {
+ if (yych == '}') goto yy315;
+ if (yych <= '~') goto yy313;
+ }
+ }
+ }
+yy311:
+ YYDEBUG(311, *YYCURSOR);
+ ++YYCURSOR;
+ yych = *YYCURSOR;
+ goto yy318;
+yy312:
+ YYDEBUG(312, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 404 "Zend/zend_ini_scanner.l"
+ { /* Variable name */
+ /* Eat leading whitespace */
+ EAT_LEADING_WHITESPACE();
+
+ /* Eat trailing whitespace */
+ EAT_TRAILING_WHITESPACE();
+
+ RETURN_TOKEN(TC_VARNAME, yytext, yyleng);
+}
+#line 4625 "Zend/zend_ini_scanner.c"
+yy313:
+ YYDEBUG(313, *YYCURSOR);
+ ++YYCURSOR;
+ YYDEBUG(314, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 601 "Zend/zend_ini_scanner.l"
+ {
+ return 0;
+}
+#line 4635 "Zend/zend_ini_scanner.c"
+yy315:
+ YYDEBUG(315, *YYCURSOR);
+ ++YYCURSOR;
+ YYDEBUG(316, *YYCURSOR);
+ yyleng = YYCURSOR - SCNG(yy_text);
+#line 414 "Zend/zend_ini_scanner.l"
+ { /* Variable end */
+ yy_pop_state(TSRMLS_C);
+ return '}';
+}
+#line 4646 "Zend/zend_ini_scanner.c"
+yy317:
+ YYDEBUG(317, *YYCURSOR);
+ ++YYCURSOR;
+ YYFILL(1);
+ yych = *YYCURSOR;
+yy318:
+ YYDEBUG(318, *YYCURSOR);
+ if (yybm[0+yych] & 128) {
+ goto yy317;
+ }
+ goto yy312;
+ }
+}
+#line 605 "Zend/zend_ini_scanner.l"
+
+}
diff --git a/Zend/zend_ini_scanner.l b/Zend/zend_ini_scanner.l
index 6207c76b27..eb31a98d39 100644
--- a/Zend/zend_ini_scanner.l
+++ b/Zend/zend_ini_scanner.l
@@ -131,11 +131,9 @@ ZEND_API zend_ini_scanner_globals ini_scanner_globals;
/* Eat trailing whitespace */
#define EAT_TRAILING_WHITESPACE() EAT_TRAILING_WHITESPACE_EX('X')
-#define zend_ini_copy_value(retval, str, len) { \
- Z_STRVAL_P(retval) = zend_strndup(str, len); \
- Z_STRLEN_P(retval) = len; \
- Z_TYPE_P(retval) = IS_STRING; \
-}
+#define zend_ini_copy_value(retval, str, len) \
+ ZVAL_STR(retval, STR_INIT(str, len, 1))
+
#define RETURN_TOKEN(type, str, len) { \
zend_ini_copy_value(ini_lval, str, len); \
diff --git a/Zend/zend_ini_scanner_defs.h b/Zend/zend_ini_scanner_defs.h
index 5723954978..287d7bc1fb 100644
--- a/Zend/zend_ini_scanner_defs.h
+++ b/Zend/zend_ini_scanner_defs.h
@@ -1,13 +1,13 @@
-/* Generated by re2c 0.13.5 */
-#line 3 "Zend/zend_ini_scanner_defs.h"
-
-enum YYCONDTYPE {
- yycINITIAL,
- yycST_OFFSET,
- yycST_SECTION_VALUE,
- yycST_VALUE,
- yycST_SECTION_RAW,
- yycST_DOUBLE_QUOTES,
- yycST_VARNAME,
- yycST_RAW,
-};
+/* Generated by re2c 0.13.5 */
+#line 3 "Zend/zend_ini_scanner_defs.h"
+
+enum YYCONDTYPE {
+ yycINITIAL,
+ yycST_OFFSET,
+ yycST_SECTION_VALUE,
+ yycST_VALUE,
+ yycST_SECTION_RAW,
+ yycST_DOUBLE_QUOTES,
+ yycST_VARNAME,
+ yycST_RAW,
+};
diff --git a/Zend/zend_interfaces.c b/Zend/zend_interfaces.c
index f9a020c656..c8898e1694 100644
--- a/Zend/zend_interfaces.c
+++ b/Zend/zend_interfaces.c
@@ -31,24 +31,23 @@ ZEND_API zend_class_entry *zend_ce_serializable;
/* {{{ zend_call_method
Only returns the returned zval if retval_ptr != NULL */
-ZEND_API zval* zend_call_method(zval **object_pp, zend_class_entry *obj_ce, zend_function **fn_proxy, const char *function_name, int function_name_len, zval **retval_ptr_ptr, int param_count, zval* arg1, zval* arg2 TSRMLS_DC)
+ZEND_API zval* zend_call_method(zval *object, zend_class_entry *obj_ce, zend_function **fn_proxy, const char *function_name, int function_name_len, zval *retval_ptr, int param_count, zval* arg1, zval* arg2 TSRMLS_DC)
{
int result;
zend_fcall_info fci;
- zval z_fname;
- zval *retval;
+ zval retval;
HashTable *function_table;
- zval **params[2];
+ zval params[2];
- params[0] = &arg1;
- params[1] = &arg2;
+ ZVAL_COPY_VALUE(&params[0], arg1);
+ ZVAL_COPY_VALUE(&params[1], arg2);
fci.size = sizeof(fci);
/*fci.function_table = NULL; will be read form zend_class_entry of object if needed */
- fci.object_ptr = object_pp ? *object_pp : NULL;
- fci.function_name = &z_fname;
- fci.retval_ptr_ptr = retval_ptr_ptr ? retval_ptr_ptr : &retval;
+ fci.object_ptr = object;
+ ZVAL_STRINGL(&fci.function_name, function_name, function_name_len);
+ fci.retval = retval_ptr ? retval_ptr : &retval;
fci.param_count = param_count;
fci.params = params;
fci.no_separation = 1;
@@ -57,15 +56,14 @@ ZEND_API zval* zend_call_method(zval **object_pp, zend_class_entry *obj_ce, zend
if (!fn_proxy && !obj_ce) {
/* no interest in caching and no information already present that is
* needed later inside zend_call_function. */
- ZVAL_STRINGL(&z_fname, function_name, function_name_len, 0);
- fci.function_table = !object_pp ? EG(function_table) : NULL;
+ fci.function_table = !object ? EG(function_table) : NULL;
result = zend_call_function(&fci, NULL TSRMLS_CC);
} else {
zend_fcall_info_cache fcic;
fcic.initialized = 1;
if (!obj_ce) {
- obj_ce = object_pp ? Z_OBJCE_PP(object_pp) : NULL;
+ obj_ce = object ? Z_OBJCE_P(object) : NULL;
}
if (obj_ce) {
function_table = &obj_ce->function_table;
@@ -73,9 +71,9 @@ ZEND_API zval* zend_call_method(zval **object_pp, zend_class_entry *obj_ce, zend
function_table = EG(function_table);
}
if (!fn_proxy || !*fn_proxy) {
- if (zend_hash_find(function_table, function_name, function_name_len+1, (void **) &fcic.function_handler) == FAILURE) {
+ if ((fcic.function_handler = zend_hash_find_ptr(function_table, Z_STR(fci.function_name))) == NULL) {
/* error at c-level */
- zend_error(E_CORE_ERROR, "Couldn't find implementation for method %s%s%s", obj_ce ? obj_ce->name : "", obj_ce ? "::" : "", function_name);
+ zend_error(E_CORE_ERROR, "Couldn't find implementation for method %s%s%s", obj_ce ? obj_ce->name->val : "", obj_ce ? "::" : "", function_name);
}
if (fn_proxy) {
*fn_proxy = fcic.function_handler;
@@ -84,8 +82,8 @@ ZEND_API zval* zend_call_method(zval **object_pp, zend_class_entry *obj_ce, zend
fcic.function_handler = *fn_proxy;
}
fcic.calling_scope = obj_ce;
- if (object_pp) {
- fcic.called_scope = Z_OBJCE_PP(object_pp);
+ if (object) {
+ fcic.called_scope = Z_OBJCE_P(object);
} else if (obj_ce &&
!(EG(called_scope) &&
instanceof_function(EG(called_scope), obj_ce TSRMLS_CC))) {
@@ -93,25 +91,23 @@ ZEND_API zval* zend_call_method(zval **object_pp, zend_class_entry *obj_ce, zend
} else {
fcic.called_scope = EG(called_scope);
}
- fcic.object_ptr = object_pp ? *object_pp : NULL;
+ fcic.object_ptr = object;
result = zend_call_function(&fci, &fcic TSRMLS_CC);
}
if (result == FAILURE) {
/* error at c-level */
if (!obj_ce) {
- obj_ce = object_pp ? Z_OBJCE_PP(object_pp) : NULL;
+ obj_ce = object ? Z_OBJCE_P(object) : NULL;
}
if (!EG(exception)) {
- zend_error(E_CORE_ERROR, "Couldn't execute method %s%s%s", obj_ce ? obj_ce->name : "", obj_ce ? "::" : "", function_name);
+ zend_error(E_CORE_ERROR, "Couldn't execute method %s%s%s", obj_ce ? obj_ce->name->val : "", obj_ce ? "::" : "", function_name);
}
}
- if (!retval_ptr_ptr) {
- if (retval) {
- zval_ptr_dtor(&retval);
- }
+ if (!retval_ptr) {
+ zval_ptr_dtor(&retval);
return NULL;
}
- return *retval_ptr_ptr;
+ return retval_ptr;
}
/* }}} */
@@ -120,9 +116,9 @@ ZEND_API zval* zend_call_method(zval **object_pp, zend_class_entry *obj_ce, zend
/* {{{ zend_user_it_new_iterator */
ZEND_API zval *zend_user_it_new_iterator(zend_class_entry *ce, zval *object TSRMLS_DC)
{
- zval *retval;
+ zval retval;
- return zend_call_method_with_0_params(&object, ce, &ce->iterator_funcs.zf_new_iterator, "getiterator", &retval);
+ return zend_call_method_with_0_params(object, ce, &ce->iterator_funcs.zf_new_iterator, "getiterator", &retval);
}
/* }}} */
@@ -133,7 +129,7 @@ ZEND_API void zend_user_it_invalidate_current(zend_object_iterator *_iter TSRMLS
zend_user_iterator *iter = (zend_user_iterator*)_iter;
if (iter->value) {
- zval_ptr_dtor(&iter->value);
+ zval_ptr_dtor(iter->value);
iter->value = NULL;
}
}
@@ -146,7 +142,7 @@ static void zend_user_it_dtor(zend_object_iterator *_iter TSRMLS_DC)
zval *object = (zval*)iter->it.data;
zend_user_it_invalidate_current(_iter TSRMLS_CC);
- zval_ptr_dtor(&object);
+ zval_ptr_dtor(object);
efree(iter);
}
/* }}} */
@@ -157,12 +153,12 @@ ZEND_API int zend_user_it_valid(zend_object_iterator *_iter TSRMLS_DC)
if (_iter) {
zend_user_iterator *iter = (zend_user_iterator*)_iter;
zval *object = (zval*)iter->it.data;
- zval *more;
+ zval more;
int result;
- zend_call_method_with_0_params(&object, iter->ce, &iter->ce->iterator_funcs.zf_valid, "valid", &more);
- if (more) {
- result = i_zend_is_true(more TSRMLS_CC);
+ zend_call_method_with_0_params(object, iter->ce, &iter->ce->iterator_funcs.zf_valid, "valid", &more);
+ if (Z_TYPE(more) != IS_UNDEF) {
+ result = i_zend_is_true(&more TSRMLS_CC);
zval_ptr_dtor(&more);
return result ? SUCCESS : FAILURE;
}
@@ -172,15 +168,15 @@ ZEND_API int zend_user_it_valid(zend_object_iterator *_iter TSRMLS_DC)
/* }}} */
/* {{{ zend_user_it_get_current_data */
-ZEND_API void zend_user_it_get_current_data(zend_object_iterator *_iter, zval ***data TSRMLS_DC)
+ZEND_API zval *zend_user_it_get_current_data(zend_object_iterator *_iter TSRMLS_DC)
{
zend_user_iterator *iter = (zend_user_iterator*)_iter;
zval *object = (zval*)iter->it.data;
if (!iter->value) {
- zend_call_method_with_0_params(&object, iter->ce, &iter->ce->iterator_funcs.zf_current, "current", &iter->value);
+ zend_call_method_with_0_params(object, iter->ce, &iter->ce->iterator_funcs.zf_current, "current", iter->value);
}
- *data = &iter->value;
+ return iter->value;
}
/* }}} */
@@ -199,15 +195,15 @@ ZEND_API void zend_user_it_get_current_key(zend_object_iterator *_iter, zval *ke
{
zend_user_iterator *iter = (zend_user_iterator*)_iter;
zval *object = (zval*)iter->it.data;
- zval *retval;
+ zval retval;
- zend_call_method_with_0_params(&object, iter->ce, &iter->ce->iterator_funcs.zf_key, "key", &retval);
+ zend_call_method_with_0_params(object, iter->ce, &iter->ce->iterator_funcs.zf_key, "key", &retval);
- if (retval) {
- ZVAL_ZVAL(key, retval, 1, 1);
+ if (Z_TYPE(retval) != IS_UNDEF) {
+ ZVAL_ZVAL(key, &retval, 1, 1);
} else {
if (!EG(exception)) {
- zend_error(E_WARNING, "Nothing returned from %s::key()", iter->ce->name);
+ zend_error(E_WARNING, "Nothing returned from %s::key()", iter->ce->name->val);
}
ZVAL_LONG(key, 0);
@@ -221,7 +217,7 @@ ZEND_API void zend_user_it_move_forward(zend_object_iterator *_iter TSRMLS_DC)
zval *object = (zval*)iter->it.data;
zend_user_it_invalidate_current(_iter TSRMLS_CC);
- zend_call_method_with_0_params(&object, iter->ce, &iter->ce->iterator_funcs.zf_next, "next", NULL);
+ zend_call_method_with_0_params(object, iter->ce, &iter->ce->iterator_funcs.zf_next, "next", NULL);
}
/* }}} */
@@ -232,7 +228,7 @@ ZEND_API void zend_user_it_rewind(zend_object_iterator *_iter TSRMLS_DC)
zval *object = (zval*)iter->it.data;
zend_user_it_invalidate_current(_iter TSRMLS_CC);
- zend_call_method_with_0_params(&object, iter->ce, &iter->ce->iterator_funcs.zf_rewind, "rewind", NULL);
+ zend_call_method_with_0_params(object, iter->ce, &iter->ce->iterator_funcs.zf_rewind, "rewind", NULL);
}
/* }}} */
@@ -279,13 +275,13 @@ ZEND_API zend_object_iterator *zend_user_it_get_new_iterator(zend_class_entry *c
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) {
- zval_ptr_dtor(&iterator);
+ zval_ptr_dtor(iterator);
}
return NULL;
}
new_iterator = ce_it->get_iterator(ce_it, iterator, by_ref TSRMLS_CC);
- zval_ptr_dtor(&iterator);
+ zval_ptr_dtor(iterator);
return new_iterator;
}
/* }}} */
@@ -305,10 +301,10 @@ static int zend_implement_traversable(zend_class_entry *interface, zend_class_en
}
}
zend_error(E_CORE_ERROR, "Class %s must implement interface %s as part of either %s or %s",
- class_type->name,
- zend_ce_traversable->name,
- zend_ce_iterator->name,
- zend_ce_aggregate->name);
+ class_type->name->val,
+ zend_ce_traversable->name->val,
+ zend_ce_iterator->name->val,
+ zend_ce_aggregate->name->val);
return FAILURE;
}
/* }}} */
@@ -328,9 +324,9 @@ static int zend_implement_aggregate(zend_class_entry *interface, zend_class_entr
for (i = 0; i < class_type->num_interfaces; i++) {
if (class_type->interfaces[i] == zend_ce_iterator) {
zend_error(E_ERROR, "Class %s cannot implement both %s and %s at the same time",
- class_type->name,
- interface->name,
- zend_ce_iterator->name);
+ class_type->name->val,
+ interface->name->val,
+ zend_ce_iterator->name->val);
return FAILURE;
}
if (class_type->interfaces[i] == zend_ce_traversable) {
@@ -360,9 +356,9 @@ static int zend_implement_iterator(zend_class_entry *interface, zend_class_entry
/* c-level get_iterator cannot be changed */
if (class_type->get_iterator == zend_user_it_get_new_iterator) {
zend_error(E_ERROR, "Class %s cannot implement both %s and %s at the same time",
- class_type->name,
- interface->name,
- zend_ce_aggregate->name);
+ class_type->name->val,
+ interface->name->val,
+ zend_ce_aggregate->name->val);
}
return FAILURE;
}
@@ -400,23 +396,23 @@ static int zend_implement_arrayaccess(zend_class_entry *interface, zend_class_en
ZEND_API int zend_user_serialize(zval *object, unsigned char **buffer, zend_uint *buf_len, zend_serialize_data *data TSRMLS_DC)
{
zend_class_entry * ce = Z_OBJCE_P(object);
- zval *retval;
+ zval retval;
int result;
- zend_call_method_with_0_params(&object, ce, &ce->serialize_func, "serialize", &retval);
+ zend_call_method_with_0_params(object, ce, &ce->serialize_func, "serialize", &retval);
- if (!retval || EG(exception)) {
+ if (Z_TYPE(retval) == IS_UNDEF || EG(exception)) {
result = FAILURE;
} else {
- switch(Z_TYPE_P(retval)) {
+ switch(Z_TYPE(retval)) {
case IS_NULL:
/* we could also make this '*buf_len = 0' but this allows to skip variables */
zval_ptr_dtor(&retval);
return FAILURE;
case IS_STRING:
- *buffer = (unsigned char*)estrndup(Z_STRVAL_P(retval), Z_STRLEN_P(retval));
- *buf_len = Z_STRLEN_P(retval);
+ *buffer = (unsigned char*)estrndup(Z_STRVAL(retval), Z_STRLEN(retval));
+ *buf_len = Z_STRLEN(retval);
result = SUCCESS;
break;
default: /* failure */
@@ -434,16 +430,15 @@ ZEND_API int zend_user_serialize(zval *object, unsigned char **buffer, zend_uint
/* }}} */
/* {{{ zend_user_unserialize */
-ZEND_API int zend_user_unserialize(zval **object, zend_class_entry *ce, const unsigned char *buf, zend_uint buf_len, zend_unserialize_data *data TSRMLS_DC)
+ZEND_API int zend_user_unserialize(zval *object, zend_class_entry *ce, const unsigned char *buf, zend_uint buf_len, zend_unserialize_data *data TSRMLS_DC)
{
- zval * zdata;
+ zval zdata;
- object_init_ex(*object, ce);
+ object_init_ex(object, ce);
- MAKE_STD_ZVAL(zdata);
- ZVAL_STRINGL(zdata, (char*)buf, buf_len, 1);
+ ZVAL_STRINGL(&zdata, (char*)buf, buf_len);
- zend_call_method_with_1_params(object, ce, &ce->unserialize_func, "unserialize", NULL, zdata);
+ zend_call_method_with_1_params(object, ce, &ce->unserialize_func, "unserialize", NULL, &zdata);
zval_ptr_dtor(&zdata);
@@ -463,9 +458,9 @@ ZEND_API int zend_class_serialize_deny(zval *object, unsigned char **buffer, zen
}
/* }}} */
-ZEND_API int zend_class_unserialize_deny(zval **object, zend_class_entry *ce, const unsigned char *buf, zend_uint buf_len, zend_unserialize_data *data TSRMLS_DC) /* {{{ */
+ZEND_API int zend_class_unserialize_deny(zval *object, zend_class_entry *ce, const unsigned char *buf, zend_uint buf_len, zend_unserialize_data *data TSRMLS_DC) /* {{{ */
{
- zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "Unserialization of '%s' is not allowed", ce->name);
+ zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "Unserialization of '%s' is not allowed", ce->name->val);
return FAILURE;
}
/* }}} */
diff --git a/Zend/zend_interfaces.h b/Zend/zend_interfaces.h
index 7b70bc49d4..3c539ad563 100644
--- a/Zend/zend_interfaces.h
+++ b/Zend/zend_interfaces.h
@@ -38,7 +38,7 @@ typedef struct _zend_user_iterator {
zval *value;
} zend_user_iterator;
-ZEND_API zval* zend_call_method(zval **object_pp, zend_class_entry *obj_ce, zend_function **fn_proxy, const char *function_name, int function_name_len, zval **retval_ptr_ptr, int param_count, zval* arg1, zval* arg2 TSRMLS_DC);
+ZEND_API zval* zend_call_method(zval *object_pp, zend_class_entry *obj_ce, zend_function **fn_proxy, const char *function_name, int function_name_len, zval *retval, int param_count, zval* arg1, zval* arg2 TSRMLS_DC);
#define zend_call_method_with_0_params(obj, obj_ce, fn_proxy, function_name, retval) \
zend_call_method(obj, obj_ce, fn_proxy, function_name, sizeof(function_name)-1, retval, 0, NULL, NULL TSRMLS_CC)
@@ -52,7 +52,7 @@ ZEND_API zval* zend_call_method(zval **object_pp, zend_class_entry *obj_ce, zend
ZEND_API void zend_user_it_rewind(zend_object_iterator *_iter TSRMLS_DC);
ZEND_API int zend_user_it_valid(zend_object_iterator *_iter TSRMLS_DC);
ZEND_API void zend_user_it_get_current_key(zend_object_iterator *_iter, zval *key TSRMLS_DC);
-ZEND_API void zend_user_it_get_current_data(zend_object_iterator *_iter, zval ***data TSRMLS_DC);
+ZEND_API zval *zend_user_it_get_current_data(zend_object_iterator *_iter TSRMLS_DC);
ZEND_API void zend_user_it_move_forward(zend_object_iterator *_iter TSRMLS_DC);
ZEND_API void zend_user_it_invalidate_current(zend_object_iterator *_iter TSRMLS_DC);
@@ -62,10 +62,10 @@ ZEND_API zend_object_iterator *zend_user_it_get_new_iterator(zend_class_entry *c
ZEND_API void zend_register_interfaces(TSRMLS_D);
ZEND_API int zend_user_serialize(zval *object, unsigned char **buffer, zend_uint *buf_len, zend_serialize_data *data TSRMLS_DC);
-ZEND_API int zend_user_unserialize(zval **object, zend_class_entry *ce, const unsigned char *buf, zend_uint buf_len, zend_unserialize_data *data TSRMLS_DC);
+ZEND_API int zend_user_unserialize(zval *object, zend_class_entry *ce, const unsigned char *buf, zend_uint buf_len, zend_unserialize_data *data TSRMLS_DC);
ZEND_API int zend_class_serialize_deny(zval *object, unsigned char **buffer, zend_uint *buf_len, zend_serialize_data *data TSRMLS_DC);
-ZEND_API int zend_class_unserialize_deny(zval **object, zend_class_entry *ce, const unsigned char *buf, zend_uint buf_len, zend_unserialize_data *data TSRMLS_DC);
+ZEND_API int zend_class_unserialize_deny(zval *object, zend_class_entry *ce, const unsigned char *buf, zend_uint buf_len, zend_unserialize_data *data TSRMLS_DC);
END_EXTERN_C()
diff --git a/Zend/zend_iterators.c b/Zend/zend_iterators.c
index a2854c4b74..b433cbe1ab 100644
--- a/Zend/zend_iterators.c
+++ b/Zend/zend_iterators.c
@@ -51,11 +51,11 @@ static zend_object_handlers iterator_object_handlers = {
ZEND_API void zend_register_iterator_wrapper(TSRMLS_D)
{
INIT_CLASS_ENTRY(zend_iterator_class_entry, "__iterator_wrapper", NULL);
- str_free(zend_iterator_class_entry.name);
- zend_iterator_class_entry.name = "__iterator_wrapper";
+//??? STR_RELEASE(zend_iterator_class_entry.name);
+//??? zend_iterator_class_entry.name = STR_INIT("__iterator_wrapper", sizeof("__iterator_wrapper")-1, 0);
}
-static void iter_wrapper_dtor(void *object, zend_object_handle handle TSRMLS_DC)
+static void iter_wrapper_dtor(zend_object *object TSRMLS_DC)
{
zend_object_iterator *iter = (zend_object_iterator*)object;
iter->funcs->dtor(iter TSRMLS_CC);
@@ -63,6 +63,9 @@ static void iter_wrapper_dtor(void *object, zend_object_handle handle TSRMLS_DC)
ZEND_API zval *zend_iterator_wrap(zend_object_iterator *iter TSRMLS_DC)
{
+//???
+ return NULL;
+#if 0
zval *wrapped;
MAKE_STD_ZVAL(wrapped);
@@ -71,6 +74,7 @@ ZEND_API zval *zend_iterator_wrap(zend_object_iterator *iter TSRMLS_DC)
Z_OBJ_HT_P(wrapped) = &iterator_object_handlers;
return wrapped;
+#endif
}
ZEND_API enum zend_object_iterator_kind zend_iterator_unwrap(
@@ -79,7 +83,7 @@ ZEND_API enum zend_object_iterator_kind zend_iterator_unwrap(
switch (Z_TYPE_P(array_ptr)) {
case IS_OBJECT:
if (Z_OBJ_HT_P(array_ptr) == &iterator_object_handlers) {
- *iter = (zend_object_iterator *)zend_object_store_get_object(array_ptr TSRMLS_CC);
+ *iter = (zend_object_iterator *)Z_OBJ_P(array_ptr);
return ZEND_ITER_OBJECT;
}
if (Z_OBJPROP_P(array_ptr)) {
diff --git a/Zend/zend_iterators.h b/Zend/zend_iterators.h
index 873f36efbe..c0b71e7e37 100644
--- a/Zend/zend_iterators.h
+++ b/Zend/zend_iterators.h
@@ -36,7 +36,7 @@ typedef struct _zend_object_iterator_funcs {
int (*valid)(zend_object_iterator *iter TSRMLS_DC);
/* fetch the item data for the current element */
- void (*get_current_data)(zend_object_iterator *iter, zval ***data TSRMLS_DC);
+ zval *(*get_current_data)(zend_object_iterator *iter TSRMLS_DC);
/* fetch the key for the current element (optional, may be NULL). The key
* should be written into the provided zval* using the ZVAL_* macros. If
diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y
index a4bc612bcb..37ef067ba5 100644
--- a/Zend/zend_language_parser.y
+++ b/Zend/zend_language_parser.y
@@ -806,8 +806,8 @@ expr_without_variable:
| expr '%' expr { zend_do_binary_op(ZEND_MOD, &$$, &$1, &$3 TSRMLS_CC); }
| expr T_SL expr { zend_do_binary_op(ZEND_SL, &$$, &$1, &$3 TSRMLS_CC); }
| expr T_SR expr { zend_do_binary_op(ZEND_SR, &$$, &$1, &$3 TSRMLS_CC); }
- | '+' expr %prec T_INC { ZVAL_LONG(&$1.u.constant, 0); if ($2.op_type == IS_CONST) { add_function(&$2.u.constant, &$1.u.constant, &$2.u.constant TSRMLS_CC); $$ = $2; } else { $1.op_type = IS_CONST; INIT_PZVAL(&$1.u.constant); zend_do_binary_op(ZEND_ADD, &$$, &$1, &$2 TSRMLS_CC); } }
- | '-' expr %prec T_INC { ZVAL_LONG(&$1.u.constant, 0); if ($2.op_type == IS_CONST) { sub_function(&$2.u.constant, &$1.u.constant, &$2.u.constant TSRMLS_CC); $$ = $2; } else { $1.op_type = IS_CONST; INIT_PZVAL(&$1.u.constant); zend_do_binary_op(ZEND_SUB, &$$, &$1, &$2 TSRMLS_CC); } }
+ | '+' expr %prec T_INC { ZVAL_LONG(&$1.u.constant, 0); if ($2.op_type == IS_CONST) { add_function(&$2.u.constant, &$1.u.constant, &$2.u.constant TSRMLS_CC); $$ = $2; } else { $1.op_type = IS_CONST; zend_do_binary_op(ZEND_ADD, &$$, &$1, &$2 TSRMLS_CC); } }
+ | '-' expr %prec T_INC { ZVAL_LONG(&$1.u.constant, 0); if ($2.op_type == IS_CONST) { sub_function(&$2.u.constant, &$1.u.constant, &$2.u.constant TSRMLS_CC); $$ = $2; } else { $1.op_type = IS_CONST; zend_do_binary_op(ZEND_SUB, &$$, &$1, &$2 TSRMLS_CC); } }
| '!' expr { zend_do_unary_op(ZEND_BOOL_NOT, &$$, &$2 TSRMLS_CC); }
| '~' expr { zend_do_unary_op(ZEND_BW_NOT, &$$, &$2 TSRMLS_CC); }
| expr T_IS_IDENTICAL expr { zend_do_binary_op(ZEND_IS_IDENTICAL, &$$, &$1, &$3 TSRMLS_CC); }
@@ -903,16 +903,16 @@ function_call:
;
class_name:
- T_STATIC { $$.op_type = IS_CONST; ZVAL_STRINGL(&$$.u.constant, "static", sizeof("static")-1, 1);}
+ T_STATIC { $$.op_type = IS_CONST; ZVAL_STRINGL(&$$.u.constant, "static", sizeof("static")-1);}
| namespace_name { $$ = $1; }
| T_NAMESPACE T_NS_SEPARATOR namespace_name { $$.op_type = IS_CONST; ZVAL_EMPTY_STRING(&$$.u.constant); zend_do_build_namespace_name(&$$, &$$, &$3 TSRMLS_CC); }
- | T_NS_SEPARATOR namespace_name { char *tmp = estrndup(Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); memcpy(&(tmp[1]), Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); tmp[0] = '\\'; efree(Z_STRVAL($2.u.constant)); Z_STRVAL($2.u.constant) = tmp; ++Z_STRLEN($2.u.constant); $$ = $2; }
+ | T_NS_SEPARATOR namespace_name { zval tmp; ZVAL_STR(&tmp, STR_ALLOC(Z_STRLEN($2.u.constant)+1, 0)); Z_STRVAL(tmp)[0] = '\\'; memcpy(Z_STRVAL(tmp) + 1, Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); if (Z_DELREF($2.u.constant) == 0) {efree(Z_STR($2.u.constant));} Z_STR($2.u.constant) = Z_STR(tmp); $$ = $2; }
;
fully_qualified_class_name:
namespace_name { $$ = $1; }
| T_NAMESPACE T_NS_SEPARATOR namespace_name { $$.op_type = IS_CONST; ZVAL_EMPTY_STRING(&$$.u.constant); zend_do_build_namespace_name(&$$, &$$, &$3 TSRMLS_CC); }
- | T_NS_SEPARATOR namespace_name { char *tmp = estrndup(Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); memcpy(&(tmp[1]), Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); tmp[0] = '\\'; efree(Z_STRVAL($2.u.constant)); Z_STRVAL($2.u.constant) = tmp; ++Z_STRLEN($2.u.constant); $$ = $2; }
+ | T_NS_SEPARATOR namespace_name { zval tmp; ZVAL_STR(&tmp, STR_ALLOC(Z_STRLEN($2.u.constant)+1, 0)); Z_STRVAL(tmp)[0] = '\\'; memcpy(Z_STRVAL(tmp) + 1, Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); if (Z_DELREF($2.u.constant) == 0) {efree(Z_STR($2.u.constant));} Z_STR($2.u.constant) = Z_STR(tmp); $$ = $2; }
;
@@ -948,7 +948,7 @@ exit_expr:
;
backticks_expr:
- /* empty */ { ZVAL_EMPTY_STRING(&$$.u.constant); INIT_PZVAL(&$$.u.constant); $$.op_type = IS_CONST; }
+ /* empty */ { ZVAL_EMPTY_STRING(&$$.u.constant); $$.op_type = IS_CONST; }
| T_ENCAPSED_AND_WHITESPACE { $$ = $1; }
| encaps_list { $$ = $1; }
;
@@ -972,7 +972,7 @@ common_scalar:
| T_FUNC_C { $$ = $1; }
| T_NS_C { $$ = $1; }
| T_START_HEREDOC T_ENCAPSED_AND_WHITESPACE T_END_HEREDOC { $$ = $2; }
- | T_START_HEREDOC T_END_HEREDOC { ZVAL_EMPTY_STRING(&$$.u.constant); INIT_PZVAL(&$$.u.constant); $$.op_type = IS_CONST; }
+ | T_START_HEREDOC T_END_HEREDOC { ZVAL_EMPTY_STRING(&$$.u.constant); $$.op_type = IS_CONST; }
;
static_class_constant:
@@ -990,7 +990,7 @@ static_scalar_value:
| static_class_name_scalar { $$.u.ast = zend_ast_create_constant(&$1.u.constant); }
| namespace_name { zend_do_fetch_constant(&$$, NULL, &$1, ZEND_CT, 1 TSRMLS_CC); $$.u.ast = zend_ast_create_constant(&$$.u.constant); }
| T_NAMESPACE T_NS_SEPARATOR namespace_name { $$.op_type = IS_CONST; ZVAL_EMPTY_STRING(&$$.u.constant); zend_do_build_namespace_name(&$$, &$$, &$3 TSRMLS_CC); $3 = $$; zend_do_fetch_constant(&$$, NULL, &$3, ZEND_CT, 0 TSRMLS_CC); $$.u.ast = zend_ast_create_constant(&$$.u.constant); }
- | T_NS_SEPARATOR namespace_name { char *tmp = estrndup(Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); memcpy(&(tmp[1]), Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); tmp[0] = '\\'; efree(Z_STRVAL($2.u.constant)); Z_STRVAL($2.u.constant) = tmp; ++Z_STRLEN($2.u.constant); zend_do_fetch_constant(&$$, NULL, &$2, ZEND_CT, 0 TSRMLS_CC); $$.u.ast = zend_ast_create_constant(&$$.u.constant); }
+ | T_NS_SEPARATOR namespace_name { zval tmp; ZVAL_STR(&tmp, STR_ALLOC(Z_STRLEN($2.u.constant)+1, 0)); Z_STRVAL(tmp)[0] = '\\'; memcpy(Z_STRVAL(tmp) + 1, Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); if (Z_DELREF($2.u.constant) == 0) {efree(Z_STR($2.u.constant));} Z_STR($2.u.constant) = Z_STR(tmp); zend_do_fetch_constant(&$$, NULL, &$2, ZEND_CT, 0 TSRMLS_CC); $$.u.ast = zend_ast_create_constant(&$$.u.constant); }
| static_class_constant { $$.u.ast = zend_ast_create_constant(&$1.u.constant); }
| T_CLASS_C { $$.u.ast = zend_ast_create_constant(&$1.u.constant); }
| static_operation { $$ = $1; }
@@ -1037,7 +1037,7 @@ scalar:
| class_constant { $$ = $1; }
| namespace_name { zend_do_fetch_constant(&$$, NULL, &$1, ZEND_RT, 1 TSRMLS_CC); }
| T_NAMESPACE T_NS_SEPARATOR namespace_name { $$.op_type = IS_CONST; ZVAL_EMPTY_STRING(&$$.u.constant); zend_do_build_namespace_name(&$$, &$$, &$3 TSRMLS_CC); $3 = $$; zend_do_fetch_constant(&$$, NULL, &$3, ZEND_RT, 0 TSRMLS_CC); }
- | T_NS_SEPARATOR namespace_name { char *tmp = estrndup(Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); memcpy(&(tmp[1]), Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); tmp[0] = '\\'; efree(Z_STRVAL($2.u.constant)); Z_STRVAL($2.u.constant) = tmp; ++Z_STRLEN($2.u.constant); zend_do_fetch_constant(&$$, NULL, &$2, ZEND_RT, 0 TSRMLS_CC); }
+ | T_NS_SEPARATOR namespace_name { zval tmp; ZVAL_STR(&tmp, STR_ALLOC(Z_STRLEN($2.u.constant)+1, 0)); Z_STRVAL(tmp)[0] = '\\'; memcpy(Z_STRVAL(tmp) + 1, Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); if (Z_DELREF($2.u.constant) == 0) {efree(Z_STR($2.u.constant));} Z_STR($2.u.constant) = Z_STR(tmp); zend_do_fetch_constant(&$$, NULL, &$2, ZEND_RT, 0 TSRMLS_CC); }
| common_scalar { $$ = $1; }
| '"' encaps_list '"' { $$ = $2; }
| T_START_HEREDOC encaps_list T_END_HEREDOC { $$ = $2; }
@@ -1046,7 +1046,7 @@ scalar:
static_array_pair_list:
- /* empty */ { $$.op_type = IS_CONST; INIT_PZVAL(&$$.u.constant); array_init(&$$.u.constant); }
+ /* empty */ { $$.op_type = IS_CONST; array_init(&$$.u.constant); }
| non_empty_static_array_pair_list possible_comma { $$ = $1; }
;
@@ -1058,8 +1058,8 @@ possible_comma:
non_empty_static_array_pair_list:
non_empty_static_array_pair_list ',' static_scalar T_DOUBLE_ARROW static_scalar { zend_do_add_static_array_element(&$$, &$3, &$5); }
| non_empty_static_array_pair_list ',' static_scalar { zend_do_add_static_array_element(&$$, NULL, &$3); }
- | static_scalar T_DOUBLE_ARROW static_scalar { $$.op_type = IS_CONST; INIT_PZVAL(&$$.u.constant); array_init(&$$.u.constant); zend_do_add_static_array_element(&$$, &$1, &$3); }
- | static_scalar { $$.op_type = IS_CONST; INIT_PZVAL(&$$.u.constant); array_init(&$$.u.constant); zend_do_add_static_array_element(&$$, NULL, &$1); }
+ | static_scalar T_DOUBLE_ARROW static_scalar { $$.op_type = IS_CONST; array_init(&$$.u.constant); zend_do_add_static_array_element(&$$, &$1, &$3); }
+ | static_scalar { $$.op_type = IS_CONST; array_init(&$$.u.constant); zend_do_add_static_array_element(&$$, NULL, &$1); }
;
expr:
diff --git a/Zend/zend_language_scanner.c b/Zend/zend_language_scanner.c
index 8e958d73d2..67ac83ca17 100644
--- a/Zend/zend_language_scanner.c
+++ b/Zend/zend_language_scanner.c
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.13.5 on Sun Dec 22 13:03:33 2013 */
+/* Generated by re2c 0.13.5 */
#line 1 "Zend/zend_language_scanner.l"
/*
+----------------------------------------------------------------------+
@@ -114,9 +114,9 @@ do { \
} \
}
-/* To save initial string length after scanning to first variable, CG(doc_comment_len) can be reused */
-#define SET_DOUBLE_QUOTES_SCANNED_LENGTH(len) CG(doc_comment_len) = (len)
-#define GET_DOUBLE_QUOTES_SCANNED_LENGTH() CG(doc_comment_len)
+/* To save initial string length after scanning to first variable */
+#define SET_DOUBLE_QUOTES_SCANNED_LENGTH(len) SCNG(scanned_string_len) = (len)
+#define GET_DOUBLE_QUOTES_SCANNED_LENGTH() SCNG(scanned_string_len)
#define IS_LABEL_START(c) (((c) >= 'a' && (c) <= 'z') || ((c) >= 'A' && (c) <= 'Z') || (c) == '_' || (c) >= 0x7F)
@@ -181,7 +181,6 @@ void startup_scanner(TSRMLS_D)
{
CG(parse_error) = 0;
CG(doc_comment) = NULL;
- CG(doc_comment_len) = 0;
zend_stack_init(&SCNG(state_stack));
zend_ptr_stack_init(&SCNG(heredoc_label_stack));
}
@@ -536,7 +535,7 @@ ZEND_API int open_file_for_scanning(zend_file_handle *file_handle TSRMLS_DC)
file_path = file_handle->filename;
}
- zend_set_compiled_filename(file_path TSRMLS_CC);
+ zend_set_compiled_filename(STR_INIT(file_path, strlen(file_path), 0) TSRMLS_CC);
if (CG(start_lineno)) {
CG(zend_lineno) = CG(start_lineno);
@@ -564,7 +563,6 @@ ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type TSR
zend_bool original_in_compilation = CG(in_compilation);
retval_znode.op_type = IS_CONST;
- INIT_PZVAL(&retval_znode.u.constant);
ZVAL_LONG(&retval_znode.u.constant, 1);
zend_save_lexical_state(&original_lex_state TSRMLS_CC);
@@ -630,13 +628,11 @@ zend_op_array *compile_filename(int type, zval *filename TSRMLS_DC)
retval = zend_compile_file(&file_handle, type TSRMLS_CC);
if (retval && file_handle.handle.stream.handle) {
- int dummy = 1;
-
if (!file_handle.opened_path) {
file_handle.opened_path = opened_path = estrndup(Z_STRVAL_P(filename), Z_STRLEN_P(filename));
}
- zend_hash_add(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path)+1, (void *)&dummy, sizeof(int), NULL);
+ zend_hash_str_add_empty_element(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path));
if (opened_path) {
efree(opened_path);
@@ -656,7 +652,16 @@ ZEND_API int zend_prepare_string_for_scanning(zval *str, char *filename TSRMLS_D
size_t size;
/* enforce ZEND_MMAP_AHEAD trailing NULLs for flex... */
- Z_STRVAL_P(str) = str_erealloc(Z_STRVAL_P(str), Z_STRLEN_P(str) + ZEND_MMAP_AHEAD);
+ if (Z_REFCOUNT_P(str) == 1) {
+ Z_STR_P(str) = STR_EREALLOC(Z_STR_P(str), Z_STRLEN_P(str) + ZEND_MMAP_AHEAD);
+ } else {
+ zend_string *tmp;
+
+ tmp = STR_ALLOC(Z_STRLEN_P(str) + ZEND_MMAP_AHEAD, 0);
+ memcpy(tmp->val, Z_STRVAL_P(str), Z_STRLEN_P(str) + 1);
+ Z_DELREF_P(str);
+ Z_STR_P(str) = tmp;
+ }
memset(Z_STRVAL_P(str) + Z_STRLEN_P(str), 0, ZEND_MMAP_AHEAD);
SCNG(yy_in) = NULL;
@@ -684,7 +689,7 @@ ZEND_API int zend_prepare_string_for_scanning(zval *str, char *filename TSRMLS_D
yy_scan_buffer(buf, size TSRMLS_CC);
- zend_set_compiled_filename(filename TSRMLS_CC);
+ zend_set_compiled_filename(STR_INIT(filename, strlen(filename), 0) TSRMLS_CC);
CG(zend_lineno) = 1;
CG(increment_lineno) = 0;
RESET_DOC_COMMENT();
@@ -865,8 +870,7 @@ ZEND_API void zend_multibyte_yyinput_again(zend_encoding_filter old_input_filter
SCNG(output_filter)((unsigned char **)&Z_STRVAL_P(zendlval), &sz, (unsigned char *)yytext, (size_t)yyleng TSRMLS_CC); \
Z_STRLEN_P(zendlval) = sz; \
} else { \
- Z_STRVAL_P(zendlval) = (char *) estrndup(yytext, yyleng); \
- Z_STRLEN_P(zendlval) = yyleng; \
+ ZVAL_STRINGL(zendlval, yytext, yyleng); \
}
static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quote_type TSRMLS_DC)
@@ -874,7 +878,7 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo
register char *s, *t;
char *end;
- ZVAL_STRINGL(zendlval, str, len, 1);
+ ZVAL_STRINGL(zendlval, str, len);
/* convert escape sequences */
s = t = Z_STRVAL_P(zendlval);
@@ -997,7 +1001,7 @@ restart:
yymore_restart:
-#line 1001 "Zend/zend_language_scanner.c"
+#line 1005 "Zend/zend_language_scanner.c"
{
YYCTYPE yych;
unsigned int yyaccept = 0;
@@ -1096,7 +1100,7 @@ yyc_INITIAL:
yy3:
YYDEBUG(3, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1741 "Zend/zend_language_scanner.l"
+#line 1746 "Zend/zend_language_scanner.l"
{
if (YYCURSOR > YYLIMIT) {
return 0;
@@ -1148,15 +1152,14 @@ inline_html:
if (readsize < yyleng) {
yyless(readsize);
}
+ zendlval->type = IS_STRING;
} else {
- Z_STRVAL_P(zendlval) = (char *) estrndup(yytext, yyleng);
- Z_STRLEN_P(zendlval) = yyleng;
+ ZVAL_STRINGL(zendlval, yytext, yyleng);
}
- zendlval->type = IS_STRING;
HANDLE_NEWLINES(yytext, yyleng);
return T_INLINE_HTML;
}
-#line 1160 "Zend/zend_language_scanner.c"
+#line 1163 "Zend/zend_language_scanner.c"
yy4:
YYDEBUG(4, *YYCURSOR);
yych = *++YYCURSOR;
@@ -1174,34 +1177,34 @@ yy5:
yy6:
YYDEBUG(6, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1731 "Zend/zend_language_scanner.l"
+#line 1736 "Zend/zend_language_scanner.l"
{
if (CG(short_tags)) {
- ZVAL_STRINGL(zendlval, yytext, yyleng, 0); /* no copying - intentional */
+ ZVAL_STRINGL(zendlval, yytext, yyleng);
BEGIN(ST_IN_SCRIPTING);
return T_OPEN_TAG;
} else {
goto inline_char_handler;
}
}
-#line 1188 "Zend/zend_language_scanner.c"
+#line 1191 "Zend/zend_language_scanner.c"
yy7:
YYDEBUG(7, *YYCURSOR);
++YYCURSOR;
if ((yych = *YYCURSOR) == '=') goto yy43;
YYDEBUG(8, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1712 "Zend/zend_language_scanner.l"
+#line 1717 "Zend/zend_language_scanner.l"
{
if (CG(asp_tags)) {
- ZVAL_STRINGL(zendlval, yytext, yyleng, 0); /* no copying - intentional */
+ ZVAL_STRINGL(zendlval, yytext, yyleng);
BEGIN(ST_IN_SCRIPTING);
return T_OPEN_TAG;
} else {
goto inline_char_handler;
}
}
-#line 1205 "Zend/zend_language_scanner.c"
+#line 1208 "Zend/zend_language_scanner.c"
yy9:
YYDEBUG(9, *YYCURSOR);
yych = *++YYCURSOR;
@@ -1387,7 +1390,7 @@ yy35:
++YYCURSOR;
YYDEBUG(38, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1678 "Zend/zend_language_scanner.l"
+#line 1683 "Zend/zend_language_scanner.l"
{
YYCTYPE *bracket = (YYCTYPE*)zend_memrchr(yytext, '<', yyleng - (sizeof("script language=php>") - 1));
@@ -1398,11 +1401,11 @@ yy35:
}
HANDLE_NEWLINES(yytext, yyleng);
- ZVAL_STRINGL(zendlval, yytext, yyleng, 0); /* no copying - intentional */
+ ZVAL_STRINGL(zendlval, yytext, yyleng);
BEGIN(ST_IN_SCRIPTING);
return T_OPEN_TAG;
}
-#line 1406 "Zend/zend_language_scanner.c"
+#line 1409 "Zend/zend_language_scanner.c"
yy39:
YYDEBUG(39, *YYCURSOR);
yych = *++YYCURSOR;
@@ -1429,29 +1432,29 @@ yy43:
++YYCURSOR;
YYDEBUG(44, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1694 "Zend/zend_language_scanner.l"
+#line 1699 "Zend/zend_language_scanner.l"
{
if (CG(asp_tags)) {
- ZVAL_STRINGL(zendlval, yytext, yyleng, 0); /* no copying - intentional */
+ ZVAL_STRINGL(zendlval, yytext, yyleng);
BEGIN(ST_IN_SCRIPTING);
return T_OPEN_TAG_WITH_ECHO;
} else {
goto inline_char_handler;
}
}
-#line 1443 "Zend/zend_language_scanner.c"
+#line 1446 "Zend/zend_language_scanner.c"
yy45:
YYDEBUG(45, *YYCURSOR);
++YYCURSOR;
YYDEBUG(46, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1705 "Zend/zend_language_scanner.l"
+#line 1710 "Zend/zend_language_scanner.l"
{
- ZVAL_STRINGL(zendlval, yytext, yyleng, 0); /* no copying - intentional */
+ ZVAL_STRINGL(zendlval, yytext, yyleng);
BEGIN(ST_IN_SCRIPTING);
return T_OPEN_TAG_WITH_ECHO;
}
-#line 1455 "Zend/zend_language_scanner.c"
+#line 1458 "Zend/zend_language_scanner.c"
yy47:
YYDEBUG(47, *YYCURSOR);
yych = *++YYCURSOR;
@@ -1478,14 +1481,14 @@ yy50:
yy51:
YYDEBUG(51, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1723 "Zend/zend_language_scanner.l"
+#line 1728 "Zend/zend_language_scanner.l"
{
- ZVAL_STRINGL(zendlval, yytext, yyleng, 0); /* no copying - intentional */
+ ZVAL_STRINGL(zendlval, yytext, yyleng);
HANDLE_NEWLINE(yytext[yyleng-1]);
BEGIN(ST_IN_SCRIPTING);
return T_OPEN_TAG;
}
-#line 1489 "Zend/zend_language_scanner.c"
+#line 1492 "Zend/zend_language_scanner.c"
yy52:
YYDEBUG(52, *YYCURSOR);
++YYCURSOR;
@@ -1556,7 +1559,7 @@ yyc_ST_BACKQUOTE:
yy56:
YYDEBUG(56, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 2186 "Zend/zend_language_scanner.l"
+#line 2189 "Zend/zend_language_scanner.l"
{
if (YYCURSOR > YYLIMIT) {
return 0;
@@ -1597,7 +1600,7 @@ yy56:
zend_scan_escape_string(zendlval, yytext, yyleng, '`' TSRMLS_CC);
return T_ENCAPSED_AND_WHITESPACE;
}
-#line 1601 "Zend/zend_language_scanner.c"
+#line 1604 "Zend/zend_language_scanner.c"
yy57:
YYDEBUG(57, *YYCURSOR);
yych = *++YYCURSOR;
@@ -1608,12 +1611,12 @@ yy58:
++YYCURSOR;
YYDEBUG(59, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 2130 "Zend/zend_language_scanner.l"
+#line 2133 "Zend/zend_language_scanner.l"
{
BEGIN(ST_IN_SCRIPTING);
return '`';
}
-#line 1617 "Zend/zend_language_scanner.c"
+#line 1620 "Zend/zend_language_scanner.c"
yy60:
YYDEBUG(60, *YYCURSOR);
yych = *++YYCURSOR;
@@ -1623,14 +1626,14 @@ yy61:
++YYCURSOR;
YYDEBUG(62, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 2117 "Zend/zend_language_scanner.l"
+#line 2120 "Zend/zend_language_scanner.l"
{
Z_LVAL_P(zendlval) = (long) '{';
yy_push_state(ST_IN_SCRIPTING TSRMLS_CC);
yyless(1);
return T_CURLY_OPEN;
}
-#line 1634 "Zend/zend_language_scanner.c"
+#line 1637 "Zend/zend_language_scanner.c"
yy63:
YYDEBUG(63, *YYCURSOR);
yyaccept = 0;
@@ -1646,24 +1649,24 @@ yy63:
yy65:
YYDEBUG(65, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1823 "Zend/zend_language_scanner.l"
+#line 1827 "Zend/zend_language_scanner.l"
{
zend_copy_value(zendlval, (yytext+1), (yyleng-1));
zendlval->type = IS_STRING;
return T_VARIABLE;
}
-#line 1656 "Zend/zend_language_scanner.c"
+#line 1659 "Zend/zend_language_scanner.c"
yy66:
YYDEBUG(66, *YYCURSOR);
++YYCURSOR;
YYDEBUG(67, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1457 "Zend/zend_language_scanner.l"
+#line 1461 "Zend/zend_language_scanner.l"
{
yy_push_state(ST_LOOKING_FOR_VARNAME TSRMLS_CC);
return T_DOLLAR_OPEN_CURLY_BRACES;
}
-#line 1667 "Zend/zend_language_scanner.c"
+#line 1670 "Zend/zend_language_scanner.c"
yy68:
YYDEBUG(68, *YYCURSOR);
yych = *++YYCURSOR;
@@ -1677,7 +1680,7 @@ yy70:
++YYCURSOR;
YYDEBUG(71, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1815 "Zend/zend_language_scanner.l"
+#line 1819 "Zend/zend_language_scanner.l"
{
yyless(yyleng - 1);
yy_push_state(ST_VAR_OFFSET TSRMLS_CC);
@@ -1685,7 +1688,7 @@ yy70:
zendlval->type = IS_STRING;
return T_VARIABLE;
}
-#line 1689 "Zend/zend_language_scanner.c"
+#line 1692 "Zend/zend_language_scanner.c"
yy72:
YYDEBUG(72, *YYCURSOR);
yych = *++YYCURSOR;
@@ -1703,7 +1706,7 @@ yy73:
++YYCURSOR;
YYDEBUG(74, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1805 "Zend/zend_language_scanner.l"
+#line 1809 "Zend/zend_language_scanner.l"
{
yyless(yyleng - 3);
yy_push_state(ST_LOOKING_FOR_PROPERTY TSRMLS_CC);
@@ -1711,7 +1714,7 @@ yy73:
zendlval->type = IS_STRING;
return T_VARIABLE;
}
-#line 1715 "Zend/zend_language_scanner.c"
+#line 1718 "Zend/zend_language_scanner.c"
}
/* *********************************** */
yyc_ST_DOUBLE_QUOTES:
@@ -1779,7 +1782,7 @@ yy77:
yy78:
YYDEBUG(78, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 2136 "Zend/zend_language_scanner.l"
+#line 2139 "Zend/zend_language_scanner.l"
{
if (GET_DOUBLE_QUOTES_SCANNED_LENGTH()) {
YYCURSOR += GET_DOUBLE_QUOTES_SCANNED_LENGTH() - 1;
@@ -1828,7 +1831,7 @@ double_quotes_scan_done:
zend_scan_escape_string(zendlval, yytext, yyleng, '"' TSRMLS_CC);
return T_ENCAPSED_AND_WHITESPACE;
}
-#line 1832 "Zend/zend_language_scanner.c"
+#line 1835 "Zend/zend_language_scanner.c"
yy79:
YYDEBUG(79, *YYCURSOR);
yych = *++YYCURSOR;
@@ -1839,12 +1842,12 @@ yy80:
++YYCURSOR;
YYDEBUG(81, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 2125 "Zend/zend_language_scanner.l"
+#line 2128 "Zend/zend_language_scanner.l"
{
BEGIN(ST_IN_SCRIPTING);
return '"';
}
-#line 1848 "Zend/zend_language_scanner.c"
+#line 1851 "Zend/zend_language_scanner.c"
yy82:
YYDEBUG(82, *YYCURSOR);
yych = *++YYCURSOR;
@@ -1854,14 +1857,14 @@ yy83:
++YYCURSOR;
YYDEBUG(84, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 2117 "Zend/zend_language_scanner.l"
+#line 2120 "Zend/zend_language_scanner.l"
{
Z_LVAL_P(zendlval) = (long) '{';
yy_push_state(ST_IN_SCRIPTING TSRMLS_CC);
yyless(1);
return T_CURLY_OPEN;
}
-#line 1865 "Zend/zend_language_scanner.c"
+#line 1868 "Zend/zend_language_scanner.c"
yy85:
YYDEBUG(85, *YYCURSOR);
yyaccept = 0;
@@ -1877,24 +1880,24 @@ yy85:
yy87:
YYDEBUG(87, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1823 "Zend/zend_language_scanner.l"
+#line 1827 "Zend/zend_language_scanner.l"
{
zend_copy_value(zendlval, (yytext+1), (yyleng-1));
zendlval->type = IS_STRING;
return T_VARIABLE;
}
-#line 1887 "Zend/zend_language_scanner.c"
+#line 1890 "Zend/zend_language_scanner.c"
yy88:
YYDEBUG(88, *YYCURSOR);
++YYCURSOR;
YYDEBUG(89, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1457 "Zend/zend_language_scanner.l"
+#line 1461 "Zend/zend_language_scanner.l"
{
yy_push_state(ST_LOOKING_FOR_VARNAME TSRMLS_CC);
return T_DOLLAR_OPEN_CURLY_BRACES;
}
-#line 1898 "Zend/zend_language_scanner.c"
+#line 1901 "Zend/zend_language_scanner.c"
yy90:
YYDEBUG(90, *YYCURSOR);
yych = *++YYCURSOR;
@@ -1908,7 +1911,7 @@ yy92:
++YYCURSOR;
YYDEBUG(93, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1815 "Zend/zend_language_scanner.l"
+#line 1819 "Zend/zend_language_scanner.l"
{
yyless(yyleng - 1);
yy_push_state(ST_VAR_OFFSET TSRMLS_CC);
@@ -1916,7 +1919,7 @@ yy92:
zendlval->type = IS_STRING;
return T_VARIABLE;
}
-#line 1920 "Zend/zend_language_scanner.c"
+#line 1923 "Zend/zend_language_scanner.c"
yy94:
YYDEBUG(94, *YYCURSOR);
yych = *++YYCURSOR;
@@ -1934,7 +1937,7 @@ yy95:
++YYCURSOR;
YYDEBUG(96, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1805 "Zend/zend_language_scanner.l"
+#line 1809 "Zend/zend_language_scanner.l"
{
yyless(yyleng - 3);
yy_push_state(ST_LOOKING_FOR_PROPERTY TSRMLS_CC);
@@ -1942,7 +1945,7 @@ yy95:
zendlval->type = IS_STRING;
return T_VARIABLE;
}
-#line 1946 "Zend/zend_language_scanner.c"
+#line 1949 "Zend/zend_language_scanner.c"
}
/* *********************************** */
yyc_ST_END_HEREDOC:
@@ -1953,7 +1956,7 @@ yyc_ST_END_HEREDOC:
++YYCURSOR;
YYDEBUG(100, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 2103 "Zend/zend_language_scanner.l"
+#line 2106 "Zend/zend_language_scanner.l"
{
zend_heredoc_label *heredoc_label = zend_ptr_stack_pop(&SCNG(heredoc_label_stack));
@@ -1966,7 +1969,7 @@ yyc_ST_END_HEREDOC:
BEGIN(ST_IN_SCRIPTING);
return T_END_HEREDOC;
}
-#line 1970 "Zend/zend_language_scanner.c"
+#line 1973 "Zend/zend_language_scanner.c"
/* *********************************** */
yyc_ST_HEREDOC:
{
@@ -2028,7 +2031,7 @@ yy103:
yy104:
YYDEBUG(104, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 2228 "Zend/zend_language_scanner.l"
+#line 2231 "Zend/zend_language_scanner.l"
{
int newline = 0;
@@ -2101,7 +2104,7 @@ heredoc_scan_done:
zend_scan_escape_string(zendlval, yytext, yyleng - newline, 0 TSRMLS_CC);
return T_ENCAPSED_AND_WHITESPACE;
}
-#line 2105 "Zend/zend_language_scanner.c"
+#line 2108 "Zend/zend_language_scanner.c"
yy105:
YYDEBUG(105, *YYCURSOR);
yych = *++YYCURSOR;
@@ -2116,14 +2119,14 @@ yy107:
++YYCURSOR;
YYDEBUG(108, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 2117 "Zend/zend_language_scanner.l"
+#line 2120 "Zend/zend_language_scanner.l"
{
Z_LVAL_P(zendlval) = (long) '{';
yy_push_state(ST_IN_SCRIPTING TSRMLS_CC);
yyless(1);
return T_CURLY_OPEN;
}
-#line 2127 "Zend/zend_language_scanner.c"
+#line 2130 "Zend/zend_language_scanner.c"
yy109:
YYDEBUG(109, *YYCURSOR);
yyaccept = 0;
@@ -2139,24 +2142,24 @@ yy109:
yy111:
YYDEBUG(111, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1823 "Zend/zend_language_scanner.l"
+#line 1827 "Zend/zend_language_scanner.l"
{
zend_copy_value(zendlval, (yytext+1), (yyleng-1));
zendlval->type = IS_STRING;
return T_VARIABLE;
}
-#line 2149 "Zend/zend_language_scanner.c"
+#line 2152 "Zend/zend_language_scanner.c"
yy112:
YYDEBUG(112, *YYCURSOR);
++YYCURSOR;
YYDEBUG(113, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1457 "Zend/zend_language_scanner.l"
+#line 1461 "Zend/zend_language_scanner.l"
{
yy_push_state(ST_LOOKING_FOR_VARNAME TSRMLS_CC);
return T_DOLLAR_OPEN_CURLY_BRACES;
}
-#line 2160 "Zend/zend_language_scanner.c"
+#line 2163 "Zend/zend_language_scanner.c"
yy114:
YYDEBUG(114, *YYCURSOR);
yych = *++YYCURSOR;
@@ -2170,7 +2173,7 @@ yy116:
++YYCURSOR;
YYDEBUG(117, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1815 "Zend/zend_language_scanner.l"
+#line 1819 "Zend/zend_language_scanner.l"
{
yyless(yyleng - 1);
yy_push_state(ST_VAR_OFFSET TSRMLS_CC);
@@ -2178,7 +2181,7 @@ yy116:
zendlval->type = IS_STRING;
return T_VARIABLE;
}
-#line 2182 "Zend/zend_language_scanner.c"
+#line 2185 "Zend/zend_language_scanner.c"
yy118:
YYDEBUG(118, *YYCURSOR);
yych = *++YYCURSOR;
@@ -2196,7 +2199,7 @@ yy119:
++YYCURSOR;
YYDEBUG(120, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1805 "Zend/zend_language_scanner.l"
+#line 1809 "Zend/zend_language_scanner.l"
{
yyless(yyleng - 3);
yy_push_state(ST_LOOKING_FOR_PROPERTY TSRMLS_CC);
@@ -2204,7 +2207,7 @@ yy119:
zendlval->type = IS_STRING;
return T_VARIABLE;
}
-#line 2208 "Zend/zend_language_scanner.c"
+#line 2211 "Zend/zend_language_scanner.c"
}
/* *********************************** */
yyc_ST_IN_SCRIPTING:
@@ -2387,13 +2390,13 @@ yy123:
yy124:
YYDEBUG(124, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1846 "Zend/zend_language_scanner.l"
+#line 1850 "Zend/zend_language_scanner.l"
{
zend_copy_value(zendlval, yytext, yyleng);
zendlval->type = IS_STRING;
return T_STRING;
}
-#line 2397 "Zend/zend_language_scanner.c"
+#line 2400 "Zend/zend_language_scanner.c"
yy125:
YYDEBUG(125, *YYCURSOR);
yych = *++YYCURSOR;
@@ -2625,11 +2628,11 @@ yy138:
yy139:
YYDEBUG(139, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1446 "Zend/zend_language_scanner.l"
+#line 1450 "Zend/zend_language_scanner.l"
{
return yytext[0];
}
-#line 2633 "Zend/zend_language_scanner.c"
+#line 2636 "Zend/zend_language_scanner.c"
yy140:
YYDEBUG(140, *YYCURSOR);
++YYCURSOR;
@@ -2638,13 +2641,13 @@ yy140:
yy141:
YYDEBUG(141, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1175 "Zend/zend_language_scanner.l"
+#line 1179 "Zend/zend_language_scanner.l"
{
- ZVAL_STRINGL(zendlval, yytext, yyleng, 0); /* no copying - intentional */
+ ZVAL_STRINGL(zendlval, yytext, yyleng);
HANDLE_NEWLINES(yytext, yyleng);
return T_WHITESPACE;
}
-#line 2648 "Zend/zend_language_scanner.c"
+#line 2651 "Zend/zend_language_scanner.c"
yy142:
YYDEBUG(142, *YYCURSOR);
yych = *++YYCURSOR;
@@ -2655,11 +2658,11 @@ yy143:
++YYCURSOR;
YYDEBUG(144, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1202 "Zend/zend_language_scanner.l"
+#line 1206 "Zend/zend_language_scanner.l"
{
return T_NS_SEPARATOR;
}
-#line 2663 "Zend/zend_language_scanner.c"
+#line 2666 "Zend/zend_language_scanner.c"
yy145:
YYDEBUG(145, *YYCURSOR);
yyaccept = 1;
@@ -2892,18 +2895,18 @@ yy168:
++YYCURSOR;
YYDEBUG(169, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1451 "Zend/zend_language_scanner.l"
+#line 1455 "Zend/zend_language_scanner.l"
{
yy_push_state(ST_IN_SCRIPTING TSRMLS_CC);
return '{';
}
-#line 2901 "Zend/zend_language_scanner.c"
+#line 2904 "Zend/zend_language_scanner.c"
yy170:
YYDEBUG(170, *YYCURSOR);
++YYCURSOR;
YYDEBUG(171, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1463 "Zend/zend_language_scanner.l"
+#line 1467 "Zend/zend_language_scanner.l"
{
RESET_DOC_COMMENT();
if (!zend_stack_is_empty(&SCNG(state_stack))) {
@@ -2911,7 +2914,7 @@ yy170:
}
return '}';
}
-#line 2915 "Zend/zend_language_scanner.c"
+#line 2918 "Zend/zend_language_scanner.c"
yy172:
YYDEBUG(172, *YYCURSOR);
yyaccept = 2;
@@ -2939,7 +2942,7 @@ yy172:
yy173:
YYDEBUG(173, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1513 "Zend/zend_language_scanner.l"
+#line 1517 "Zend/zend_language_scanner.l"
{
if (yyleng < MAX_LENGTH_OF_LONG - 1) { /* Won't overflow */
Z_LVAL_P(zendlval) = strtol(yytext, NULL, 0);
@@ -2960,7 +2963,7 @@ yy173:
zendlval->type = IS_LONG;
return T_LNUMBER;
}
-#line 2964 "Zend/zend_language_scanner.c"
+#line 2967 "Zend/zend_language_scanner.c"
yy174:
YYDEBUG(174, *YYCURSOR);
yyaccept = 2;
@@ -2988,7 +2991,7 @@ yy176:
yy177:
YYDEBUG(177, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1853 "Zend/zend_language_scanner.l"
+#line 1857 "Zend/zend_language_scanner.l"
{
while (YYCURSOR < YYLIMIT) {
switch (*YYCURSOR++) {
@@ -3022,14 +3025,14 @@ yy177:
return T_COMMENT;
}
-#line 3026 "Zend/zend_language_scanner.c"
+#line 3029 "Zend/zend_language_scanner.c"
yy178:
YYDEBUG(178, *YYCURSOR);
++YYCURSOR;
yy179:
YYDEBUG(179, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1940 "Zend/zend_language_scanner.l"
+#line 1943 "Zend/zend_language_scanner.l"
{
register char *s, *t;
char *end;
@@ -3055,7 +3058,7 @@ yy179:
}
}
- ZVAL_STRINGL(zendlval, yytext+bprefix+1, yyleng-bprefix-2, 1);
+ ZVAL_STRINGL(zendlval, yytext+bprefix+1, yyleng-bprefix-2);
/* convert escape sequences */
s = t = Z_STRVAL_P(zendlval);
@@ -3095,14 +3098,14 @@ yy179:
}
return T_CONSTANT_ENCAPSED_STRING;
}
-#line 3099 "Zend/zend_language_scanner.c"
+#line 3102 "Zend/zend_language_scanner.c"
yy180:
YYDEBUG(180, *YYCURSOR);
++YYCURSOR;
yy181:
YYDEBUG(181, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 2007 "Zend/zend_language_scanner.l"
+#line 2010 "Zend/zend_language_scanner.l"
{
int bprefix = (yytext[0] != '"') ? 1 : 0;
@@ -3143,24 +3146,24 @@ yy181:
BEGIN(ST_DOUBLE_QUOTES);
return '"';
}
-#line 3147 "Zend/zend_language_scanner.c"
+#line 3150 "Zend/zend_language_scanner.c"
yy182:
YYDEBUG(182, *YYCURSOR);
++YYCURSOR;
YYDEBUG(183, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 2097 "Zend/zend_language_scanner.l"
+#line 2100 "Zend/zend_language_scanner.l"
{
BEGIN(ST_BACKQUOTE);
return '`';
}
-#line 3158 "Zend/zend_language_scanner.c"
+#line 3161 "Zend/zend_language_scanner.c"
yy184:
YYDEBUG(184, *YYCURSOR);
++YYCURSOR;
YYDEBUG(185, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 2360 "Zend/zend_language_scanner.l"
+#line 2363 "Zend/zend_language_scanner.l"
{
if (YYCURSOR > YYLIMIT) {
return 0;
@@ -3169,7 +3172,7 @@ yy184:
zend_error(E_COMPILE_WARNING,"Unexpected character in input: '%c' (ASCII=%d) state=%d", yytext[0], yytext[0], YYSTATE);
goto restart;
}
-#line 3173 "Zend/zend_language_scanner.c"
+#line 3176 "Zend/zend_language_scanner.c"
yy186:
YYDEBUG(186, *YYCURSOR);
++YYCURSOR;
@@ -3196,12 +3199,12 @@ yy188:
yy190:
YYDEBUG(190, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1572 "Zend/zend_language_scanner.l"
+#line 1576 "Zend/zend_language_scanner.l"
{
ZVAL_DOUBLE(zendlval, zend_strtod(yytext, NULL));
return T_DNUMBER;
}
-#line 3205 "Zend/zend_language_scanner.c"
+#line 3208 "Zend/zend_language_scanner.c"
yy191:
YYDEBUG(191, *YYCURSOR);
yyaccept = 2;
@@ -3293,7 +3296,7 @@ yy200:
}
YYDEBUG(202, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1489 "Zend/zend_language_scanner.l"
+#line 1493 "Zend/zend_language_scanner.l"
{
char *bin = yytext + 2; /* Skip "0b" */
int len = yyleng - 2;
@@ -3317,7 +3320,7 @@ yy200:
return T_DNUMBER;
}
}
-#line 3321 "Zend/zend_language_scanner.c"
+#line 3324 "Zend/zend_language_scanner.c"
yy203:
YYDEBUG(203, *YYCURSOR);
++YYCURSOR;
@@ -3329,7 +3332,7 @@ yy203:
}
YYDEBUG(205, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1534 "Zend/zend_language_scanner.l"
+#line 1538 "Zend/zend_language_scanner.l"
{
char *hex = yytext + 2; /* Skip "0x" */
int len = yyleng - 2;
@@ -3353,7 +3356,7 @@ yy203:
return T_DNUMBER;
}
}
-#line 3357 "Zend/zend_language_scanner.c"
+#line 3360 "Zend/zend_language_scanner.c"
yy206:
YYDEBUG(206, *YYCURSOR);
++YYCURSOR;
@@ -3362,13 +3365,13 @@ yy206:
yy207:
YYDEBUG(207, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1921 "Zend/zend_language_scanner.l"
+#line 1924 "Zend/zend_language_scanner.l"
{
- ZVAL_STRINGL(zendlval, yytext, yyleng, 0); /* no copying - intentional */
+ ZVAL_STRINGL(zendlval, yytext, yyleng);
BEGIN(INITIAL);
return T_CLOSE_TAG; /* implicit ';' at php-end tag */
}
-#line 3372 "Zend/zend_language_scanner.c"
+#line 3375 "Zend/zend_language_scanner.c"
yy208:
YYDEBUG(208, *YYCURSOR);
yych = *++YYCURSOR;
@@ -3402,13 +3405,13 @@ yy210:
yy212:
YYDEBUG(212, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1823 "Zend/zend_language_scanner.l"
+#line 1827 "Zend/zend_language_scanner.l"
{
zend_copy_value(zendlval, (yytext+1), (yyleng-1));
zendlval->type = IS_STRING;
return T_VARIABLE;
}
-#line 3412 "Zend/zend_language_scanner.c"
+#line 3415 "Zend/zend_language_scanner.c"
yy213:
YYDEBUG(213, *YYCURSOR);
yych = *++YYCURSOR;
@@ -3422,11 +3425,11 @@ yy214:
}
YYDEBUG(215, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1434 "Zend/zend_language_scanner.l"
+#line 1438 "Zend/zend_language_scanner.l"
{
return T_LOGICAL_XOR;
}
-#line 3430 "Zend/zend_language_scanner.c"
+#line 3433 "Zend/zend_language_scanner.c"
yy216:
YYDEBUG(216, *YYCURSOR);
++YYCURSOR;
@@ -3435,61 +3438,61 @@ yy216:
}
YYDEBUG(217, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1426 "Zend/zend_language_scanner.l"
+#line 1430 "Zend/zend_language_scanner.l"
{
return T_LOGICAL_OR;
}
-#line 3443 "Zend/zend_language_scanner.c"
+#line 3446 "Zend/zend_language_scanner.c"
yy218:
YYDEBUG(218, *YYCURSOR);
++YYCURSOR;
YYDEBUG(219, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1414 "Zend/zend_language_scanner.l"
+#line 1418 "Zend/zend_language_scanner.l"
{
return T_XOR_EQUAL;
}
-#line 3453 "Zend/zend_language_scanner.c"
+#line 3456 "Zend/zend_language_scanner.c"
yy220:
YYDEBUG(220, *YYCURSOR);
++YYCURSOR;
YYDEBUG(221, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1418 "Zend/zend_language_scanner.l"
+#line 1422 "Zend/zend_language_scanner.l"
{
return T_BOOLEAN_OR;
}
-#line 3463 "Zend/zend_language_scanner.c"
+#line 3466 "Zend/zend_language_scanner.c"
yy222:
YYDEBUG(222, *YYCURSOR);
++YYCURSOR;
YYDEBUG(223, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1410 "Zend/zend_language_scanner.l"
+#line 1414 "Zend/zend_language_scanner.l"
{
return T_OR_EQUAL;
}
-#line 3473 "Zend/zend_language_scanner.c"
+#line 3476 "Zend/zend_language_scanner.c"
yy224:
YYDEBUG(224, *YYCURSOR);
++YYCURSOR;
YYDEBUG(225, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1422 "Zend/zend_language_scanner.l"
+#line 1426 "Zend/zend_language_scanner.l"
{
return T_BOOLEAN_AND;
}
-#line 3483 "Zend/zend_language_scanner.c"
+#line 3486 "Zend/zend_language_scanner.c"
yy226:
YYDEBUG(226, *YYCURSOR);
++YYCURSOR;
YYDEBUG(227, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1406 "Zend/zend_language_scanner.l"
+#line 1410 "Zend/zend_language_scanner.l"
{
return T_AND_EQUAL;
}
-#line 3493 "Zend/zend_language_scanner.c"
+#line 3496 "Zend/zend_language_scanner.c"
yy228:
YYDEBUG(228, *YYCURSOR);
++YYCURSOR;
@@ -3498,28 +3501,28 @@ yy228:
yy229:
YYDEBUG(229, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1928 "Zend/zend_language_scanner.l"
+#line 1931 "Zend/zend_language_scanner.l"
{
if (CG(asp_tags)) {
BEGIN(INITIAL);
- ZVAL_STRINGL(zendlval, yytext, yyleng, 0); /* no copying - intentional */
+ ZVAL_STRINGL(zendlval, yytext, yyleng);
return T_CLOSE_TAG; /* implicit ';' at php-end tag */
} else {
yyless(1);
return yytext[0];
}
}
-#line 3513 "Zend/zend_language_scanner.c"
+#line 3516 "Zend/zend_language_scanner.c"
yy230:
YYDEBUG(230, *YYCURSOR);
++YYCURSOR;
YYDEBUG(231, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1394 "Zend/zend_language_scanner.l"
+#line 1398 "Zend/zend_language_scanner.l"
{
return T_MOD_EQUAL;
}
-#line 3523 "Zend/zend_language_scanner.c"
+#line 3526 "Zend/zend_language_scanner.c"
yy232:
YYDEBUG(232, *YYCURSOR);
yych = *++YYCURSOR;
@@ -3537,7 +3540,7 @@ yy234:
yy235:
YYDEBUG(235, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1887 "Zend/zend_language_scanner.l"
+#line 1891 "Zend/zend_language_scanner.l"
{
int doc_com;
@@ -3564,14 +3567,13 @@ yy235:
HANDLE_NEWLINES(yytext, yyleng);
if (doc_com) {
- CG(doc_comment) = estrndup(yytext, yyleng);
- CG(doc_comment_len) = yyleng;
+ CG(doc_comment) = STR_INIT(yytext, yyleng, 0);
return T_DOC_COMMENT;
}
return T_COMMENT;
}
-#line 3575 "Zend/zend_language_scanner.c"
+#line 3577 "Zend/zend_language_scanner.c"
yy236:
YYDEBUG(236, *YYCURSOR);
yych = *++YYCURSOR;
@@ -3581,11 +3583,11 @@ yy237:
++YYCURSOR;
YYDEBUG(238, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1386 "Zend/zend_language_scanner.l"
+#line 1390 "Zend/zend_language_scanner.l"
{
return T_DIV_EQUAL;
}
-#line 3589 "Zend/zend_language_scanner.c"
+#line 3591 "Zend/zend_language_scanner.c"
yy239:
YYDEBUG(239, *YYCURSOR);
yych = *++YYCURSOR;
@@ -3608,42 +3610,42 @@ yy242:
++YYCURSOR;
YYDEBUG(243, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1382 "Zend/zend_language_scanner.l"
+#line 1386 "Zend/zend_language_scanner.l"
{
return T_MUL_EQUAL;
}
-#line 3616 "Zend/zend_language_scanner.c"
+#line 3618 "Zend/zend_language_scanner.c"
yy244:
YYDEBUG(244, *YYCURSOR);
++YYCURSOR;
if ((yych = *YYCURSOR) == '=') goto yy248;
YYDEBUG(245, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1442 "Zend/zend_language_scanner.l"
+#line 1446 "Zend/zend_language_scanner.l"
{
return T_SR;
}
-#line 3627 "Zend/zend_language_scanner.c"
+#line 3629 "Zend/zend_language_scanner.c"
yy246:
YYDEBUG(246, *YYCURSOR);
++YYCURSOR;
YYDEBUG(247, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1370 "Zend/zend_language_scanner.l"
+#line 1374 "Zend/zend_language_scanner.l"
{
return T_IS_GREATER_OR_EQUAL;
}
-#line 3637 "Zend/zend_language_scanner.c"
+#line 3639 "Zend/zend_language_scanner.c"
yy248:
YYDEBUG(248, *YYCURSOR);
++YYCURSOR;
YYDEBUG(249, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1402 "Zend/zend_language_scanner.l"
+#line 1406 "Zend/zend_language_scanner.l"
{
return T_SR_EQUAL;
}
-#line 3647 "Zend/zend_language_scanner.c"
+#line 3649 "Zend/zend_language_scanner.c"
yy250:
YYDEBUG(250, *YYCURSOR);
yyaccept = 5;
@@ -3654,11 +3656,11 @@ yy250:
yy251:
YYDEBUG(251, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1438 "Zend/zend_language_scanner.l"
+#line 1442 "Zend/zend_language_scanner.l"
{
return T_SL;
}
-#line 3662 "Zend/zend_language_scanner.c"
+#line 3664 "Zend/zend_language_scanner.c"
yy252:
YYDEBUG(252, *YYCURSOR);
yych = *++YYCURSOR;
@@ -3670,22 +3672,22 @@ yy253:
++YYCURSOR;
YYDEBUG(254, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1366 "Zend/zend_language_scanner.l"
+#line 1370 "Zend/zend_language_scanner.l"
{
return T_IS_SMALLER_OR_EQUAL;
}
-#line 3678 "Zend/zend_language_scanner.c"
+#line 3680 "Zend/zend_language_scanner.c"
yy255:
YYDEBUG(255, *YYCURSOR);
++YYCURSOR;
yy256:
YYDEBUG(256, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1362 "Zend/zend_language_scanner.l"
+#line 1366 "Zend/zend_language_scanner.l"
{
return T_IS_NOT_EQUAL;
}
-#line 3689 "Zend/zend_language_scanner.c"
+#line 3691 "Zend/zend_language_scanner.c"
yy257:
YYDEBUG(257, *YYCURSOR);
yych = *++YYCURSOR;
@@ -3736,11 +3738,11 @@ yy264:
++YYCURSOR;
YYDEBUG(265, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1398 "Zend/zend_language_scanner.l"
+#line 1402 "Zend/zend_language_scanner.l"
{
return T_SL_EQUAL;
}
-#line 3744 "Zend/zend_language_scanner.c"
+#line 3746 "Zend/zend_language_scanner.c"
yy266:
YYDEBUG(266, *YYCURSOR);
++YYCURSOR;
@@ -3845,7 +3847,7 @@ yy275:
yy276:
YYDEBUG(276, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 2049 "Zend/zend_language_scanner.l"
+#line 2052 "Zend/zend_language_scanner.l"
{
char *s;
int bprefix = (yytext[0] != '<') ? 1 : 0;
@@ -3892,7 +3894,7 @@ yy276:
return T_START_HEREDOC;
}
-#line 3896 "Zend/zend_language_scanner.c"
+#line 3898 "Zend/zend_language_scanner.c"
yy277:
YYDEBUG(277, *YYCURSOR);
yych = *++YYCURSOR;
@@ -3932,31 +3934,31 @@ yy280:
++YYCURSOR;
YYDEBUG(282, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1354 "Zend/zend_language_scanner.l"
+#line 1358 "Zend/zend_language_scanner.l"
{
return T_IS_NOT_IDENTICAL;
}
-#line 3940 "Zend/zend_language_scanner.c"
+#line 3942 "Zend/zend_language_scanner.c"
yy283:
YYDEBUG(283, *YYCURSOR);
++YYCURSOR;
YYDEBUG(284, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1374 "Zend/zend_language_scanner.l"
+#line 1378 "Zend/zend_language_scanner.l"
{
return T_PLUS_EQUAL;
}
-#line 3950 "Zend/zend_language_scanner.c"
+#line 3952 "Zend/zend_language_scanner.c"
yy285:
YYDEBUG(285, *YYCURSOR);
++YYCURSOR;
YYDEBUG(286, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1342 "Zend/zend_language_scanner.l"
+#line 1346 "Zend/zend_language_scanner.l"
{
return T_INC;
}
-#line 3960 "Zend/zend_language_scanner.c"
+#line 3962 "Zend/zend_language_scanner.c"
yy287:
YYDEBUG(287, *YYCURSOR);
yych = *++YYCURSOR;
@@ -3975,42 +3977,42 @@ yy289:
}
YYDEBUG(290, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1330 "Zend/zend_language_scanner.l"
+#line 1334 "Zend/zend_language_scanner.l"
{
return T_LIST;
}
-#line 3983 "Zend/zend_language_scanner.c"
+#line 3985 "Zend/zend_language_scanner.c"
yy291:
YYDEBUG(291, *YYCURSOR);
++YYCURSOR;
if ((yych = *YYCURSOR) == '=') goto yy295;
YYDEBUG(292, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1358 "Zend/zend_language_scanner.l"
+#line 1362 "Zend/zend_language_scanner.l"
{
return T_IS_EQUAL;
}
-#line 3994 "Zend/zend_language_scanner.c"
+#line 3996 "Zend/zend_language_scanner.c"
yy293:
YYDEBUG(293, *YYCURSOR);
++YYCURSOR;
YYDEBUG(294, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1326 "Zend/zend_language_scanner.l"
+#line 1330 "Zend/zend_language_scanner.l"
{
return T_DOUBLE_ARROW;
}
-#line 4004 "Zend/zend_language_scanner.c"
+#line 4006 "Zend/zend_language_scanner.c"
yy295:
YYDEBUG(295, *YYCURSOR);
++YYCURSOR;
YYDEBUG(296, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1350 "Zend/zend_language_scanner.l"
+#line 1354 "Zend/zend_language_scanner.l"
{
return T_IS_IDENTICAL;
}
-#line 4014 "Zend/zend_language_scanner.c"
+#line 4016 "Zend/zend_language_scanner.c"
yy297:
YYDEBUG(297, *YYCURSOR);
yych = *++YYCURSOR;
@@ -4140,17 +4142,16 @@ yy313:
}
YYDEBUG(316, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1668 "Zend/zend_language_scanner.l"
+#line 1674 "Zend/zend_language_scanner.l"
{
- if (CG(current_namespace)) {
- *zendlval = *CG(current_namespace);
- zval_copy_ctor(zendlval);
+ if (Z_TYPE(CG(current_namespace)) != IS_UNDEF) {
+ ZVAL_DUP(zendlval, &CG(current_namespace));
} else {
ZVAL_EMPTY_STRING(zendlval);
}
return T_NS_C;
}
-#line 4154 "Zend/zend_language_scanner.c"
+#line 4155 "Zend/zend_language_scanner.c"
yy317:
YYDEBUG(317, *YYCURSOR);
yych = *++YYCURSOR;
@@ -4170,32 +4171,32 @@ yy318:
}
YYDEBUG(321, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1643 "Zend/zend_language_scanner.l"
+#line 1649 "Zend/zend_language_scanner.l"
{
- char *filename = zend_get_compiled_filename(TSRMLS_C);
- const size_t filename_len = strlen(filename);
- char *dirname;
+ zend_string *filename = zend_get_compiled_filename(TSRMLS_C);
+ zend_string *dirname;
if (!filename) {
- filename = "";
+ filename = STR_EMPTY_ALLOC();
}
- dirname = estrndup(filename, filename_len);
- zend_dirname(dirname, filename_len);
+ dirname = STR_DUP(filename, 0);
+ zend_dirname(dirname->val, dirname->len);
- if (strcmp(dirname, ".") == 0) {
- dirname = erealloc(dirname, MAXPATHLEN);
+ if (strcmp(dirname->val, ".") == 0) {
+ dirname = STR_EREALLOC(dirname, MAXPATHLEN);
#if HAVE_GETCWD
- VCWD_GETCWD(dirname, MAXPATHLEN);
+ VCWD_GETCWD(dirname->val, MAXPATHLEN);
#elif HAVE_GETWD
- VCWD_GETWD(dirname);
+ VCWD_GETWD(dirname->val);
#endif
}
- ZVAL_STRING(zendlval, dirname, 0);
+ dirname->len = strlen(dirname->val);
+ ZVAL_STR(zendlval, dirname);
return T_DIR;
}
-#line 4199 "Zend/zend_language_scanner.c"
+#line 4200 "Zend/zend_language_scanner.c"
yy322:
YYDEBUG(322, *YYCURSOR);
yych = *++YYCURSOR;
@@ -4220,12 +4221,12 @@ yy324:
}
YYDEBUG(327, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1628 "Zend/zend_language_scanner.l"
+#line 1634 "Zend/zend_language_scanner.l"
{
ZVAL_LONG(zendlval, CG(zend_lineno));
return T_LINE;
}
-#line 4229 "Zend/zend_language_scanner.c"
+#line 4230 "Zend/zend_language_scanner.c"
yy328:
YYDEBUG(328, *YYCURSOR);
yych = *++YYCURSOR;
@@ -4260,12 +4261,12 @@ yy332:
}
YYDEBUG(335, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1615 "Zend/zend_language_scanner.l"
+#line 1621 "Zend/zend_language_scanner.l"
{
- const char *class_name = CG(active_class_entry) ? CG(active_class_entry)->name : NULL;
- const char *func_name = CG(active_op_array)? CG(active_op_array)->function_name : NULL;
+ const char *class_name = CG(active_class_entry) ? CG(active_class_entry)->name->val : NULL;
+ const char *func_name = CG(active_op_array)? CG(active_op_array)->function_name->val : NULL;
- Z_STRLEN_P(zendlval) = zend_spprintf(&Z_STRVAL_P(zendlval), 0, "%s%s%s",
+ Z_STRLEN_P(zendlval) = zend_spprintf((char**)&Z_STRVAL_P(zendlval), 0, "%s%s%s",
class_name ? class_name : "",
class_name && func_name ? "::" : "",
func_name ? func_name : ""
@@ -4273,7 +4274,7 @@ yy332:
zendlval->type = IS_STRING;
return T_METHOD_C;
}
-#line 4277 "Zend/zend_language_scanner.c"
+#line 4278 "Zend/zend_language_scanner.c"
yy336:
YYDEBUG(336, *YYCURSOR);
yych = *++YYCURSOR;
@@ -4324,17 +4325,18 @@ yy343:
}
YYDEBUG(346, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1605 "Zend/zend_language_scanner.l"
+#line 1610 "Zend/zend_language_scanner.l"
{
zend_op_array *op_array = CG(active_op_array);
if (op_array && op_array->function_name) {
- ZVAL_STRING(zendlval, op_array->function_name, 1);
+ ZVAL_STR(zendlval, op_array->function_name);
+ Z_ADDREF_P(zendlval);
} else {
ZVAL_EMPTY_STRING(zendlval);
}
return T_FUNC_C;
}
-#line 4338 "Zend/zend_language_scanner.c"
+#line 4340 "Zend/zend_language_scanner.c"
yy347:
YYDEBUG(347, *YYCURSOR);
yych = *++YYCURSOR;
@@ -4354,17 +4356,17 @@ yy348:
}
YYDEBUG(351, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1633 "Zend/zend_language_scanner.l"
+#line 1639 "Zend/zend_language_scanner.l"
{
- char *filename = zend_get_compiled_filename(TSRMLS_C);
+ zend_string *filename = zend_get_compiled_filename(TSRMLS_C);
if (!filename) {
- filename = "";
+ filename = STR_EMPTY_ALLOC();
}
- ZVAL_STRING(zendlval, filename, 1);
+ ZVAL_STR(zendlval, filename);
return T_FILE;
}
-#line 4368 "Zend/zend_language_scanner.c"
+#line 4370 "Zend/zend_language_scanner.c"
yy352:
YYDEBUG(352, *YYCURSOR);
yych = *++YYCURSOR;
@@ -4394,17 +4396,18 @@ yy355:
}
YYDEBUG(358, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1595 "Zend/zend_language_scanner.l"
+#line 1599 "Zend/zend_language_scanner.l"
{
zend_class_entry *ce = CG(active_class_entry);
if (ce && ce->name && ZEND_ACC_TRAIT == (ce->ce_flags & ZEND_ACC_TRAIT)) {
- ZVAL_STRINGL(zendlval, ce->name, ce->name_length, 1);
+ ZVAL_STR(zendlval, ce->name);
+ Z_ADDREF_P(zendlval);
} else {
ZVAL_EMPTY_STRING(zendlval);
}
return T_TRAIT_C;
}
-#line 4408 "Zend/zend_language_scanner.c"
+#line 4411 "Zend/zend_language_scanner.c"
yy359:
YYDEBUG(359, *YYCURSOR);
yych = *++YYCURSOR;
@@ -4434,25 +4437,25 @@ yy362:
}
YYDEBUG(365, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1577 "Zend/zend_language_scanner.l"
+#line 1581 "Zend/zend_language_scanner.l"
{
zend_class_entry *ce = CG(active_class_entry);
if (ce && ZEND_ACC_TRAIT == (ce->ce_flags & ZEND_ACC_TRAIT)) {
/* We create a special __CLASS__ constant that is going to be resolved
at run-time */
- Z_STRLEN_P(zendlval) = sizeof("__CLASS__")-1;
- Z_STRVAL_P(zendlval) = estrndup("__CLASS__", Z_STRLEN_P(zendlval));
- zendlval->type = IS_CONSTANT;
+ ZVAL_STRINGL(zendlval, "__CLASS__", sizeof("__CLASS__") - 1);
+ Z_TYPE_P(zendlval) = IS_CONSTANT;
} else {
if (ce && ce->name) {
- ZVAL_STRINGL(zendlval, ce->name, ce->name_length, 1);
+ ZVAL_STR(zendlval, ce->name);
+ Z_ADDREF_P(zendlval);
} else {
ZVAL_EMPTY_STRING(zendlval);
}
}
return T_CLASS_C;
}
-#line 4456 "Zend/zend_language_scanner.c"
+#line 4459 "Zend/zend_language_scanner.c"
yy366:
YYDEBUG(366, *YYCURSOR);
yych = *++YYCURSOR;
@@ -4514,11 +4517,11 @@ yy377:
}
YYDEBUG(378, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1294 "Zend/zend_language_scanner.l"
+#line 1298 "Zend/zend_language_scanner.l"
{
return T_HALT_COMPILER;
}
-#line 4522 "Zend/zend_language_scanner.c"
+#line 4525 "Zend/zend_language_scanner.c"
yy379:
YYDEBUG(379, *YYCURSOR);
yych = *++YYCURSOR;
@@ -4538,11 +4541,11 @@ yy381:
}
YYDEBUG(382, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1274 "Zend/zend_language_scanner.l"
+#line 1278 "Zend/zend_language_scanner.l"
{
return T_USE;
}
-#line 4546 "Zend/zend_language_scanner.c"
+#line 4549 "Zend/zend_language_scanner.c"
yy383:
YYDEBUG(383, *YYCURSOR);
yych = *++YYCURSOR;
@@ -4561,11 +4564,11 @@ yy385:
}
YYDEBUG(386, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1322 "Zend/zend_language_scanner.l"
+#line 1326 "Zend/zend_language_scanner.l"
{
return T_UNSET;
}
-#line 4569 "Zend/zend_language_scanner.c"
+#line 4572 "Zend/zend_language_scanner.c"
yy387:
YYDEBUG(387, *YYCURSOR);
++YYCURSOR;
@@ -4737,11 +4740,11 @@ yy402:
++YYCURSOR;
YYDEBUG(404, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1222 "Zend/zend_language_scanner.l"
+#line 1226 "Zend/zend_language_scanner.l"
{
return T_INT_CAST;
}
-#line 4745 "Zend/zend_language_scanner.c"
+#line 4748 "Zend/zend_language_scanner.c"
yy405:
YYDEBUG(405, *YYCURSOR);
yych = *++YYCURSOR;
@@ -4785,11 +4788,11 @@ yy410:
++YYCURSOR;
YYDEBUG(413, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1226 "Zend/zend_language_scanner.l"
+#line 1230 "Zend/zend_language_scanner.l"
{
return T_DOUBLE_CAST;
}
-#line 4793 "Zend/zend_language_scanner.c"
+#line 4796 "Zend/zend_language_scanner.c"
yy414:
YYDEBUG(414, *YYCURSOR);
yych = *++YYCURSOR;
@@ -4859,11 +4862,11 @@ yy424:
++YYCURSOR;
YYDEBUG(427, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1230 "Zend/zend_language_scanner.l"
+#line 1234 "Zend/zend_language_scanner.l"
{
return T_STRING_CAST;
}
-#line 4867 "Zend/zend_language_scanner.c"
+#line 4870 "Zend/zend_language_scanner.c"
yy428:
YYDEBUG(428, *YYCURSOR);
yych = *++YYCURSOR;
@@ -4896,11 +4899,11 @@ yy431:
++YYCURSOR;
YYDEBUG(434, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1234 "Zend/zend_language_scanner.l"
+#line 1238 "Zend/zend_language_scanner.l"
{
return T_ARRAY_CAST;
}
-#line 4904 "Zend/zend_language_scanner.c"
+#line 4907 "Zend/zend_language_scanner.c"
yy435:
YYDEBUG(435, *YYCURSOR);
yych = *++YYCURSOR;
@@ -4938,11 +4941,11 @@ yy439:
++YYCURSOR;
YYDEBUG(442, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1238 "Zend/zend_language_scanner.l"
+#line 1242 "Zend/zend_language_scanner.l"
{
return T_OBJECT_CAST;
}
-#line 4946 "Zend/zend_language_scanner.c"
+#line 4949 "Zend/zend_language_scanner.c"
yy443:
YYDEBUG(443, *YYCURSOR);
yych = *++YYCURSOR;
@@ -4983,11 +4986,11 @@ yy448:
++YYCURSOR;
YYDEBUG(450, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1242 "Zend/zend_language_scanner.l"
+#line 1246 "Zend/zend_language_scanner.l"
{
return T_BOOL_CAST;
}
-#line 4991 "Zend/zend_language_scanner.c"
+#line 4994 "Zend/zend_language_scanner.c"
yy451:
YYDEBUG(451, *YYCURSOR);
yych = *++YYCURSOR;
@@ -5047,11 +5050,11 @@ yy459:
++YYCURSOR;
YYDEBUG(462, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1246 "Zend/zend_language_scanner.l"
+#line 1250 "Zend/zend_language_scanner.l"
{
return T_UNSET_CAST;
}
-#line 5055 "Zend/zend_language_scanner.c"
+#line 5058 "Zend/zend_language_scanner.c"
yy463:
YYDEBUG(463, *YYCURSOR);
yych = *++YYCURSOR;
@@ -5065,11 +5068,11 @@ yy464:
}
YYDEBUG(465, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1218 "Zend/zend_language_scanner.l"
+#line 1222 "Zend/zend_language_scanner.l"
{
return T_VAR;
}
-#line 5073 "Zend/zend_language_scanner.c"
+#line 5076 "Zend/zend_language_scanner.c"
yy466:
YYDEBUG(466, *YYCURSOR);
yych = *++YYCURSOR;
@@ -5089,11 +5092,11 @@ yy468:
}
YYDEBUG(469, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1210 "Zend/zend_language_scanner.l"
+#line 1214 "Zend/zend_language_scanner.l"
{
return T_NEW;
}
-#line 5097 "Zend/zend_language_scanner.c"
+#line 5100 "Zend/zend_language_scanner.c"
yy470:
YYDEBUG(470, *YYCURSOR);
yych = *++YYCURSOR;
@@ -5132,11 +5135,11 @@ yy476:
}
YYDEBUG(477, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1270 "Zend/zend_language_scanner.l"
+#line 1274 "Zend/zend_language_scanner.l"
{
return T_NAMESPACE;
}
-#line 5140 "Zend/zend_language_scanner.c"
+#line 5143 "Zend/zend_language_scanner.c"
yy478:
YYDEBUG(478, *YYCURSOR);
yyaccept = 3;
@@ -5158,11 +5161,11 @@ yy480:
++YYCURSOR;
YYDEBUG(481, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1390 "Zend/zend_language_scanner.l"
+#line 1394 "Zend/zend_language_scanner.l"
{
return T_CONCAT_EQUAL;
}
-#line 5166 "Zend/zend_language_scanner.c"
+#line 5169 "Zend/zend_language_scanner.c"
yy482:
YYDEBUG(482, *YYCURSOR);
yych = *++YYCURSOR;
@@ -5171,21 +5174,21 @@ yy482:
++YYCURSOR;
YYDEBUG(484, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1206 "Zend/zend_language_scanner.l"
+#line 1210 "Zend/zend_language_scanner.l"
{
return T_ELLIPSIS;
}
-#line 5179 "Zend/zend_language_scanner.c"
+#line 5182 "Zend/zend_language_scanner.c"
yy485:
YYDEBUG(485, *YYCURSOR);
++YYCURSOR;
YYDEBUG(486, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1198 "Zend/zend_language_scanner.l"
+#line 1202 "Zend/zend_language_scanner.l"
{
return T_PAAMAYIM_NEKUDOTAYIM;
}
-#line 5189 "Zend/zend_language_scanner.c"
+#line 5192 "Zend/zend_language_scanner.c"
yy487:
YYDEBUG(487, *YYCURSOR);
++YYCURSOR;
@@ -5207,32 +5210,32 @@ yy489:
++YYCURSOR;
YYDEBUG(490, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1378 "Zend/zend_language_scanner.l"
+#line 1382 "Zend/zend_language_scanner.l"
{
return T_MINUS_EQUAL;
}
-#line 5215 "Zend/zend_language_scanner.c"
+#line 5218 "Zend/zend_language_scanner.c"
yy491:
YYDEBUG(491, *YYCURSOR);
++YYCURSOR;
YYDEBUG(492, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1346 "Zend/zend_language_scanner.l"
+#line 1350 "Zend/zend_language_scanner.l"
{
return T_DEC;
}
-#line 5225 "Zend/zend_language_scanner.c"
+#line 5228 "Zend/zend_language_scanner.c"
yy493:
YYDEBUG(493, *YYCURSOR);
++YYCURSOR;
YYDEBUG(494, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1170 "Zend/zend_language_scanner.l"
+#line 1174 "Zend/zend_language_scanner.l"
{
yy_push_state(ST_LOOKING_FOR_PROPERTY TSRMLS_CC);
return T_OBJECT_OPERATOR;
}
-#line 5236 "Zend/zend_language_scanner.c"
+#line 5239 "Zend/zend_language_scanner.c"
yy495:
YYDEBUG(495, *YYCURSOR);
yych = *++YYCURSOR;
@@ -5277,11 +5280,11 @@ yy500:
}
YYDEBUG(501, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1318 "Zend/zend_language_scanner.l"
+#line 1322 "Zend/zend_language_scanner.l"
{
return T_PUBLIC;
}
-#line 5285 "Zend/zend_language_scanner.c"
+#line 5288 "Zend/zend_language_scanner.c"
yy502:
YYDEBUG(502, *YYCURSOR);
yych = *++YYCURSOR;
@@ -5336,11 +5339,11 @@ yy509:
}
YYDEBUG(510, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1314 "Zend/zend_language_scanner.l"
+#line 1318 "Zend/zend_language_scanner.l"
{
return T_PROTECTED;
}
-#line 5344 "Zend/zend_language_scanner.c"
+#line 5347 "Zend/zend_language_scanner.c"
yy511:
YYDEBUG(511, *YYCURSOR);
yych = *++YYCURSOR;
@@ -5370,11 +5373,11 @@ yy515:
}
YYDEBUG(516, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1310 "Zend/zend_language_scanner.l"
+#line 1314 "Zend/zend_language_scanner.l"
{
return T_PRIVATE;
}
-#line 5378 "Zend/zend_language_scanner.c"
+#line 5381 "Zend/zend_language_scanner.c"
yy517:
YYDEBUG(517, *YYCURSOR);
++YYCURSOR;
@@ -5383,11 +5386,11 @@ yy517:
}
YYDEBUG(518, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1146 "Zend/zend_language_scanner.l"
+#line 1150 "Zend/zend_language_scanner.l"
{
return T_PRINT;
}
-#line 5391 "Zend/zend_language_scanner.c"
+#line 5394 "Zend/zend_language_scanner.c"
yy519:
YYDEBUG(519, *YYCURSOR);
yych = *++YYCURSOR;
@@ -5412,11 +5415,11 @@ yy522:
}
YYDEBUG(523, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1138 "Zend/zend_language_scanner.l"
+#line 1142 "Zend/zend_language_scanner.l"
{
return T_GOTO;
}
-#line 5420 "Zend/zend_language_scanner.c"
+#line 5423 "Zend/zend_language_scanner.c"
yy524:
YYDEBUG(524, *YYCURSOR);
yych = *++YYCURSOR;
@@ -5440,11 +5443,11 @@ yy527:
}
YYDEBUG(528, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1282 "Zend/zend_language_scanner.l"
+#line 1286 "Zend/zend_language_scanner.l"
{
return T_GLOBAL;
}
-#line 5448 "Zend/zend_language_scanner.c"
+#line 5451 "Zend/zend_language_scanner.c"
yy529:
YYDEBUG(529, *YYCURSOR);
yych = *++YYCURSOR;
@@ -5481,11 +5484,11 @@ yy535:
}
YYDEBUG(536, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1130 "Zend/zend_language_scanner.l"
+#line 1134 "Zend/zend_language_scanner.l"
{
return T_BREAK;
}
-#line 5489 "Zend/zend_language_scanner.c"
+#line 5492 "Zend/zend_language_scanner.c"
yy537:
YYDEBUG(537, *YYCURSOR);
yych = *++YYCURSOR;
@@ -5525,11 +5528,11 @@ yy543:
}
YYDEBUG(544, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1114 "Zend/zend_language_scanner.l"
+#line 1118 "Zend/zend_language_scanner.l"
{
return T_SWITCH;
}
-#line 5533 "Zend/zend_language_scanner.c"
+#line 5536 "Zend/zend_language_scanner.c"
yy545:
YYDEBUG(545, *YYCURSOR);
yych = *++YYCURSOR;
@@ -5553,11 +5556,11 @@ yy548:
}
YYDEBUG(549, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1298 "Zend/zend_language_scanner.l"
+#line 1302 "Zend/zend_language_scanner.l"
{
return T_STATIC;
}
-#line 5561 "Zend/zend_language_scanner.c"
+#line 5564 "Zend/zend_language_scanner.c"
yy550:
YYDEBUG(550, *YYCURSOR);
yych = *++YYCURSOR;
@@ -5584,11 +5587,11 @@ yy553:
}
YYDEBUG(554, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1110 "Zend/zend_language_scanner.l"
+#line 1114 "Zend/zend_language_scanner.l"
{
return T_AS;
}
-#line 5592 "Zend/zend_language_scanner.c"
+#line 5595 "Zend/zend_language_scanner.c"
yy555:
YYDEBUG(555, *YYCURSOR);
yych = *++YYCURSOR;
@@ -5607,11 +5610,11 @@ yy557:
}
YYDEBUG(558, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1334 "Zend/zend_language_scanner.l"
+#line 1338 "Zend/zend_language_scanner.l"
{
return T_ARRAY;
}
-#line 5615 "Zend/zend_language_scanner.c"
+#line 5618 "Zend/zend_language_scanner.c"
yy559:
YYDEBUG(559, *YYCURSOR);
++YYCURSOR;
@@ -5620,11 +5623,11 @@ yy559:
}
YYDEBUG(560, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1430 "Zend/zend_language_scanner.l"
+#line 1434 "Zend/zend_language_scanner.l"
{
return T_LOGICAL_AND;
}
-#line 5628 "Zend/zend_language_scanner.c"
+#line 5631 "Zend/zend_language_scanner.c"
yy561:
YYDEBUG(561, *YYCURSOR);
yych = *++YYCURSOR;
@@ -5658,11 +5661,11 @@ yy566:
}
YYDEBUG(567, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1302 "Zend/zend_language_scanner.l"
+#line 1306 "Zend/zend_language_scanner.l"
{
return T_ABSTRACT;
}
-#line 5666 "Zend/zend_language_scanner.c"
+#line 5669 "Zend/zend_language_scanner.c"
yy568:
YYDEBUG(568, *YYCURSOR);
yych = *++YYCURSOR;
@@ -5686,11 +5689,11 @@ yy571:
}
YYDEBUG(572, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1070 "Zend/zend_language_scanner.l"
+#line 1074 "Zend/zend_language_scanner.l"
{
return T_WHILE;
}
-#line 5694 "Zend/zend_language_scanner.c"
+#line 5697 "Zend/zend_language_scanner.c"
yy573:
YYDEBUG(573, *YYCURSOR);
++YYCURSOR;
@@ -5699,11 +5702,11 @@ yy573:
}
YYDEBUG(574, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1054 "Zend/zend_language_scanner.l"
+#line 1058 "Zend/zend_language_scanner.l"
{
return T_IF;
}
-#line 5707 "Zend/zend_language_scanner.c"
+#line 5710 "Zend/zend_language_scanner.c"
yy575:
YYDEBUG(575, *YYCURSOR);
yych = *++YYCURSOR;
@@ -5755,11 +5758,11 @@ yy580:
}
YYDEBUG(581, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1286 "Zend/zend_language_scanner.l"
+#line 1290 "Zend/zend_language_scanner.l"
{
return T_ISSET;
}
-#line 5763 "Zend/zend_language_scanner.c"
+#line 5766 "Zend/zend_language_scanner.c"
yy582:
YYDEBUG(582, *YYCURSOR);
yych = *++YYCURSOR;
@@ -5813,11 +5816,11 @@ yy588:
yy589:
YYDEBUG(589, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1254 "Zend/zend_language_scanner.l"
+#line 1258 "Zend/zend_language_scanner.l"
{
return T_INCLUDE;
}
-#line 5821 "Zend/zend_language_scanner.c"
+#line 5824 "Zend/zend_language_scanner.c"
yy590:
YYDEBUG(590, *YYCURSOR);
yych = *++YYCURSOR;
@@ -5846,11 +5849,11 @@ yy594:
}
YYDEBUG(595, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1258 "Zend/zend_language_scanner.l"
+#line 1262 "Zend/zend_language_scanner.l"
{
return T_INCLUDE_ONCE;
}
-#line 5854 "Zend/zend_language_scanner.c"
+#line 5857 "Zend/zend_language_scanner.c"
yy596:
YYDEBUG(596, *YYCURSOR);
yych = *++YYCURSOR;
@@ -5884,11 +5887,11 @@ yy601:
}
YYDEBUG(602, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1154 "Zend/zend_language_scanner.l"
+#line 1158 "Zend/zend_language_scanner.l"
{
return T_INTERFACE;
}
-#line 5892 "Zend/zend_language_scanner.c"
+#line 5895 "Zend/zend_language_scanner.c"
yy603:
YYDEBUG(603, *YYCURSOR);
yych = *++YYCURSOR;
@@ -5938,11 +5941,11 @@ yy609:
}
YYDEBUG(610, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1278 "Zend/zend_language_scanner.l"
+#line 1282 "Zend/zend_language_scanner.l"
{
return T_INSTEADOF;
}
-#line 5946 "Zend/zend_language_scanner.c"
+#line 5949 "Zend/zend_language_scanner.c"
yy611:
YYDEBUG(611, *YYCURSOR);
yych = *++YYCURSOR;
@@ -5971,11 +5974,11 @@ yy615:
}
YYDEBUG(616, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1106 "Zend/zend_language_scanner.l"
+#line 1110 "Zend/zend_language_scanner.l"
{
return T_INSTANCEOF;
}
-#line 5979 "Zend/zend_language_scanner.c"
+#line 5982 "Zend/zend_language_scanner.c"
yy617:
YYDEBUG(617, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6019,11 +6022,11 @@ yy624:
}
YYDEBUG(625, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1166 "Zend/zend_language_scanner.l"
+#line 1170 "Zend/zend_language_scanner.l"
{
return T_IMPLEMENTS;
}
-#line 6027 "Zend/zend_language_scanner.c"
+#line 6030 "Zend/zend_language_scanner.c"
yy626:
YYDEBUG(626, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6051,11 +6054,11 @@ yy627:
}
YYDEBUG(629, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1038 "Zend/zend_language_scanner.l"
+#line 1042 "Zend/zend_language_scanner.l"
{
return T_TRY;
}
-#line 6059 "Zend/zend_language_scanner.c"
+#line 6062 "Zend/zend_language_scanner.c"
yy630:
YYDEBUG(630, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6074,11 +6077,11 @@ yy632:
}
YYDEBUG(633, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1158 "Zend/zend_language_scanner.l"
+#line 1162 "Zend/zend_language_scanner.l"
{
return T_TRAIT;
}
-#line 6082 "Zend/zend_language_scanner.c"
+#line 6085 "Zend/zend_language_scanner.c"
yy634:
YYDEBUG(634, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6097,11 +6100,11 @@ yy636:
}
YYDEBUG(637, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1050 "Zend/zend_language_scanner.l"
+#line 1054 "Zend/zend_language_scanner.l"
{
return T_THROW;
}
-#line 6105 "Zend/zend_language_scanner.c"
+#line 6108 "Zend/zend_language_scanner.c"
yy638:
YYDEBUG(638, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6125,11 +6128,11 @@ yy641:
}
YYDEBUG(642, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1034 "Zend/zend_language_scanner.l"
+#line 1038 "Zend/zend_language_scanner.l"
{
return T_YIELD;
}
-#line 6133 "Zend/zend_language_scanner.c"
+#line 6136 "Zend/zend_language_scanner.c"
yy643:
YYDEBUG(643, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6190,11 +6193,11 @@ yy649:
yy650:
YYDEBUG(650, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1262 "Zend/zend_language_scanner.l"
+#line 1266 "Zend/zend_language_scanner.l"
{
return T_REQUIRE;
}
-#line 6198 "Zend/zend_language_scanner.c"
+#line 6201 "Zend/zend_language_scanner.c"
yy651:
YYDEBUG(651, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6223,11 +6226,11 @@ yy655:
}
YYDEBUG(656, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1266 "Zend/zend_language_scanner.l"
+#line 1270 "Zend/zend_language_scanner.l"
{
return T_REQUIRE_ONCE;
}
-#line 6231 "Zend/zend_language_scanner.c"
+#line 6234 "Zend/zend_language_scanner.c"
yy657:
YYDEBUG(657, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6246,11 +6249,11 @@ yy659:
}
YYDEBUG(660, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1030 "Zend/zend_language_scanner.l"
+#line 1034 "Zend/zend_language_scanner.l"
{
return T_RETURN;
}
-#line 6254 "Zend/zend_language_scanner.c"
+#line 6257 "Zend/zend_language_scanner.c"
yy661:
YYDEBUG(661, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6340,11 +6343,11 @@ yy670:
}
YYDEBUG(671, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1134 "Zend/zend_language_scanner.l"
+#line 1138 "Zend/zend_language_scanner.l"
{
return T_CONTINUE;
}
-#line 6348 "Zend/zend_language_scanner.c"
+#line 6351 "Zend/zend_language_scanner.c"
yy672:
YYDEBUG(672, *YYCURSOR);
++YYCURSOR;
@@ -6353,11 +6356,11 @@ yy672:
}
YYDEBUG(673, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1026 "Zend/zend_language_scanner.l"
+#line 1030 "Zend/zend_language_scanner.l"
{
return T_CONST;
}
-#line 6361 "Zend/zend_language_scanner.c"
+#line 6364 "Zend/zend_language_scanner.c"
yy674:
YYDEBUG(674, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6382,11 +6385,11 @@ yy677:
}
YYDEBUG(678, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1214 "Zend/zend_language_scanner.l"
+#line 1218 "Zend/zend_language_scanner.l"
{
return T_CLONE;
}
-#line 6390 "Zend/zend_language_scanner.c"
+#line 6393 "Zend/zend_language_scanner.c"
yy679:
YYDEBUG(679, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6400,11 +6403,11 @@ yy680:
}
YYDEBUG(681, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1150 "Zend/zend_language_scanner.l"
+#line 1154 "Zend/zend_language_scanner.l"
{
return T_CLASS;
}
-#line 6408 "Zend/zend_language_scanner.c"
+#line 6411 "Zend/zend_language_scanner.c"
yy682:
YYDEBUG(682, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6450,11 +6453,11 @@ yy689:
}
YYDEBUG(690, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1338 "Zend/zend_language_scanner.l"
+#line 1342 "Zend/zend_language_scanner.l"
{
return T_CALLABLE;
}
-#line 6458 "Zend/zend_language_scanner.c"
+#line 6461 "Zend/zend_language_scanner.c"
yy691:
YYDEBUG(691, *YYCURSOR);
++YYCURSOR;
@@ -6463,11 +6466,11 @@ yy691:
}
YYDEBUG(692, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1122 "Zend/zend_language_scanner.l"
+#line 1126 "Zend/zend_language_scanner.l"
{
return T_CASE;
}
-#line 6471 "Zend/zend_language_scanner.c"
+#line 6474 "Zend/zend_language_scanner.c"
yy693:
YYDEBUG(693, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6481,11 +6484,11 @@ yy694:
}
YYDEBUG(695, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1042 "Zend/zend_language_scanner.l"
+#line 1046 "Zend/zend_language_scanner.l"
{
return T_CATCH;
}
-#line 6489 "Zend/zend_language_scanner.c"
+#line 6492 "Zend/zend_language_scanner.c"
yy696:
YYDEBUG(696, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6536,11 +6539,11 @@ yy704:
}
YYDEBUG(705, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1022 "Zend/zend_language_scanner.l"
+#line 1026 "Zend/zend_language_scanner.l"
{
return T_FUNCTION;
}
-#line 6544 "Zend/zend_language_scanner.c"
+#line 6547 "Zend/zend_language_scanner.c"
yy706:
YYDEBUG(706, *YYCURSOR);
++YYCURSOR;
@@ -6564,11 +6567,11 @@ yy706:
yy707:
YYDEBUG(707, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1082 "Zend/zend_language_scanner.l"
+#line 1086 "Zend/zend_language_scanner.l"
{
return T_FOR;
}
-#line 6572 "Zend/zend_language_scanner.c"
+#line 6575 "Zend/zend_language_scanner.c"
yy708:
YYDEBUG(708, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6592,11 +6595,11 @@ yy711:
}
YYDEBUG(712, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1090 "Zend/zend_language_scanner.l"
+#line 1094 "Zend/zend_language_scanner.l"
{
return T_FOREACH;
}
-#line 6600 "Zend/zend_language_scanner.c"
+#line 6603 "Zend/zend_language_scanner.c"
yy713:
YYDEBUG(713, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6630,11 +6633,11 @@ yy715:
yy716:
YYDEBUG(716, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1306 "Zend/zend_language_scanner.l"
+#line 1310 "Zend/zend_language_scanner.l"
{
return T_FINAL;
}
-#line 6638 "Zend/zend_language_scanner.c"
+#line 6641 "Zend/zend_language_scanner.c"
yy717:
YYDEBUG(717, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6648,11 +6651,11 @@ yy718:
}
YYDEBUG(719, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1046 "Zend/zend_language_scanner.l"
+#line 1050 "Zend/zend_language_scanner.l"
{
return T_FINALLY;
}
-#line 6656 "Zend/zend_language_scanner.c"
+#line 6659 "Zend/zend_language_scanner.c"
yy720:
YYDEBUG(720, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6683,11 +6686,11 @@ yy722:
}
YYDEBUG(723, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1078 "Zend/zend_language_scanner.l"
+#line 1082 "Zend/zend_language_scanner.l"
{
return T_DO;
}
-#line 6691 "Zend/zend_language_scanner.c"
+#line 6694 "Zend/zend_language_scanner.c"
yy724:
YYDEBUG(724, *YYCURSOR);
++YYCURSOR;
@@ -6696,11 +6699,11 @@ yy724:
}
YYDEBUG(725, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1018 "Zend/zend_language_scanner.l"
+#line 1022 "Zend/zend_language_scanner.l"
{
return T_EXIT;
}
-#line 6704 "Zend/zend_language_scanner.c"
+#line 6707 "Zend/zend_language_scanner.c"
yy726:
YYDEBUG(726, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6735,11 +6738,11 @@ yy731:
}
YYDEBUG(732, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1126 "Zend/zend_language_scanner.l"
+#line 1130 "Zend/zend_language_scanner.l"
{
return T_DEFAULT;
}
-#line 6743 "Zend/zend_language_scanner.c"
+#line 6746 "Zend/zend_language_scanner.c"
yy733:
YYDEBUG(733, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6763,11 +6766,11 @@ yy736:
}
YYDEBUG(737, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1098 "Zend/zend_language_scanner.l"
+#line 1102 "Zend/zend_language_scanner.l"
{
return T_DECLARE;
}
-#line 6771 "Zend/zend_language_scanner.c"
+#line 6774 "Zend/zend_language_scanner.c"
yy738:
YYDEBUG(738, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6847,11 +6850,11 @@ yy749:
}
YYDEBUG(750, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1162 "Zend/zend_language_scanner.l"
+#line 1166 "Zend/zend_language_scanner.l"
{
return T_EXTENDS;
}
-#line 6855 "Zend/zend_language_scanner.c"
+#line 6858 "Zend/zend_language_scanner.c"
yy751:
YYDEBUG(751, *YYCURSOR);
++YYCURSOR;
@@ -6860,11 +6863,11 @@ yy751:
}
YYDEBUG(752, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1014 "Zend/zend_language_scanner.l"
+#line 1018 "Zend/zend_language_scanner.l"
{
return T_EXIT;
}
-#line 6868 "Zend/zend_language_scanner.c"
+#line 6871 "Zend/zend_language_scanner.c"
yy753:
YYDEBUG(753, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6878,11 +6881,11 @@ yy754:
}
YYDEBUG(755, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1250 "Zend/zend_language_scanner.l"
+#line 1254 "Zend/zend_language_scanner.l"
{
return T_EVAL;
}
-#line 6886 "Zend/zend_language_scanner.c"
+#line 6889 "Zend/zend_language_scanner.c"
yy756:
YYDEBUG(756, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6952,11 +6955,11 @@ yy765:
}
YYDEBUG(766, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1074 "Zend/zend_language_scanner.l"
+#line 1078 "Zend/zend_language_scanner.l"
{
return T_ENDWHILE;
}
-#line 6960 "Zend/zend_language_scanner.c"
+#line 6963 "Zend/zend_language_scanner.c"
yy767:
YYDEBUG(767, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6985,11 +6988,11 @@ yy771:
}
YYDEBUG(772, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1118 "Zend/zend_language_scanner.l"
+#line 1122 "Zend/zend_language_scanner.l"
{
return T_ENDSWITCH;
}
-#line 6993 "Zend/zend_language_scanner.c"
+#line 6996 "Zend/zend_language_scanner.c"
yy773:
YYDEBUG(773, *YYCURSOR);
++YYCURSOR;
@@ -6998,11 +7001,11 @@ yy773:
}
YYDEBUG(774, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1062 "Zend/zend_language_scanner.l"
+#line 1066 "Zend/zend_language_scanner.l"
{
return T_ENDIF;
}
-#line 7006 "Zend/zend_language_scanner.c"
+#line 7009 "Zend/zend_language_scanner.c"
yy775:
YYDEBUG(775, *YYCURSOR);
yych = *++YYCURSOR;
@@ -7031,11 +7034,11 @@ yy776:
yy777:
YYDEBUG(777, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1086 "Zend/zend_language_scanner.l"
+#line 1090 "Zend/zend_language_scanner.l"
{
return T_ENDFOR;
}
-#line 7039 "Zend/zend_language_scanner.c"
+#line 7042 "Zend/zend_language_scanner.c"
yy778:
YYDEBUG(778, *YYCURSOR);
yych = *++YYCURSOR;
@@ -7059,11 +7062,11 @@ yy781:
}
YYDEBUG(782, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1094 "Zend/zend_language_scanner.l"
+#line 1098 "Zend/zend_language_scanner.l"
{
return T_ENDFOREACH;
}
-#line 7067 "Zend/zend_language_scanner.c"
+#line 7070 "Zend/zend_language_scanner.c"
yy783:
YYDEBUG(783, *YYCURSOR);
yych = *++YYCURSOR;
@@ -7097,11 +7100,11 @@ yy788:
}
YYDEBUG(789, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1102 "Zend/zend_language_scanner.l"
+#line 1106 "Zend/zend_language_scanner.l"
{
return T_ENDDECLARE;
}
-#line 7105 "Zend/zend_language_scanner.c"
+#line 7108 "Zend/zend_language_scanner.c"
yy790:
YYDEBUG(790, *YYCURSOR);
yych = *++YYCURSOR;
@@ -7120,11 +7123,11 @@ yy792:
}
YYDEBUG(793, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1290 "Zend/zend_language_scanner.l"
+#line 1294 "Zend/zend_language_scanner.l"
{
return T_EMPTY;
}
-#line 7128 "Zend/zend_language_scanner.c"
+#line 7131 "Zend/zend_language_scanner.c"
yy794:
YYDEBUG(794, *YYCURSOR);
yych = *++YYCURSOR;
@@ -7153,11 +7156,11 @@ yy795:
yy796:
YYDEBUG(796, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1066 "Zend/zend_language_scanner.l"
+#line 1070 "Zend/zend_language_scanner.l"
{
return T_ELSE;
}
-#line 7161 "Zend/zend_language_scanner.c"
+#line 7164 "Zend/zend_language_scanner.c"
yy797:
YYDEBUG(797, *YYCURSOR);
yych = *++YYCURSOR;
@@ -7171,11 +7174,11 @@ yy798:
}
YYDEBUG(799, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1058 "Zend/zend_language_scanner.l"
+#line 1062 "Zend/zend_language_scanner.l"
{
return T_ELSEIF;
}
-#line 7179 "Zend/zend_language_scanner.c"
+#line 7182 "Zend/zend_language_scanner.c"
yy800:
YYDEBUG(800, *YYCURSOR);
yych = *++YYCURSOR;
@@ -7189,11 +7192,11 @@ yy801:
}
YYDEBUG(802, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1142 "Zend/zend_language_scanner.l"
+#line 1146 "Zend/zend_language_scanner.l"
{
return T_ECHO;
}
-#line 7197 "Zend/zend_language_scanner.c"
+#line 7200 "Zend/zend_language_scanner.c"
}
/* *********************************** */
yyc_ST_LOOKING_FOR_PROPERTY:
@@ -7266,13 +7269,13 @@ yy805:
yy806:
YYDEBUG(806, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1175 "Zend/zend_language_scanner.l"
+#line 1179 "Zend/zend_language_scanner.l"
{
- ZVAL_STRINGL(zendlval, yytext, yyleng, 0); /* no copying - intentional */
+ ZVAL_STRINGL(zendlval, yytext, yyleng);
HANDLE_NEWLINES(yytext, yyleng);
return T_WHITESPACE;
}
-#line 7276 "Zend/zend_language_scanner.c"
+#line 7279 "Zend/zend_language_scanner.c"
yy807:
YYDEBUG(807, *YYCURSOR);
++YYCURSOR;
@@ -7280,13 +7283,13 @@ yy807:
yy808:
YYDEBUG(808, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1192 "Zend/zend_language_scanner.l"
+#line 1196 "Zend/zend_language_scanner.l"
{
yyless(0);
yy_pop_state(TSRMLS_C);
goto restart;
}
-#line 7290 "Zend/zend_language_scanner.c"
+#line 7293 "Zend/zend_language_scanner.c"
yy809:
YYDEBUG(809, *YYCURSOR);
++YYCURSOR;
@@ -7295,14 +7298,14 @@ yy809:
yy810:
YYDEBUG(810, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1185 "Zend/zend_language_scanner.l"
+#line 1189 "Zend/zend_language_scanner.l"
{
yy_pop_state(TSRMLS_C);
zend_copy_value(zendlval, yytext, yyleng);
zendlval->type = IS_STRING;
return T_STRING;
}
-#line 7306 "Zend/zend_language_scanner.c"
+#line 7309 "Zend/zend_language_scanner.c"
yy811:
YYDEBUG(811, *YYCURSOR);
yych = *++YYCURSOR;
@@ -7323,11 +7326,11 @@ yy814:
++YYCURSOR;
YYDEBUG(815, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1181 "Zend/zend_language_scanner.l"
+#line 1185 "Zend/zend_language_scanner.l"
{
return T_OBJECT_OPERATOR;
}
-#line 7331 "Zend/zend_language_scanner.c"
+#line 7334 "Zend/zend_language_scanner.c"
yy816:
YYDEBUG(816, *YYCURSOR);
++YYCURSOR;
@@ -7412,14 +7415,14 @@ yy820:
yy821:
YYDEBUG(821, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1482 "Zend/zend_language_scanner.l"
+#line 1486 "Zend/zend_language_scanner.l"
{
yyless(0);
yy_pop_state(TSRMLS_C);
yy_push_state(ST_IN_SCRIPTING TSRMLS_CC);
goto restart;
}
-#line 7423 "Zend/zend_language_scanner.c"
+#line 7426 "Zend/zend_language_scanner.c"
yy822:
YYDEBUG(822, *YYCURSOR);
yych = *++YYCURSOR;
@@ -7444,7 +7447,7 @@ yy826:
++YYCURSOR;
YYDEBUG(827, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1472 "Zend/zend_language_scanner.l"
+#line 1476 "Zend/zend_language_scanner.l"
{
yyless(yyleng - 1);
zend_copy_value(zendlval, yytext, yyleng);
@@ -7453,7 +7456,7 @@ yy826:
yy_push_state(ST_IN_SCRIPTING TSRMLS_CC);
return T_STRING_VARNAME;
}
-#line 7457 "Zend/zend_language_scanner.c"
+#line 7460 "Zend/zend_language_scanner.c"
}
/* *********************************** */
yyc_ST_NOWDOC:
@@ -7464,7 +7467,7 @@ yyc_ST_NOWDOC:
++YYCURSOR;
YYDEBUG(831, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 2302 "Zend/zend_language_scanner.l"
+#line 2305 "Zend/zend_language_scanner.l"
{
int newline = 0;
@@ -7521,7 +7524,7 @@ nowdoc_scan_done:
HANDLE_NEWLINES(yytext, yyleng - newline);
return T_ENCAPSED_AND_WHITESPACE;
}
-#line 7525 "Zend/zend_language_scanner.c"
+#line 7528 "Zend/zend_language_scanner.c"
/* *********************************** */
yyc_ST_VAR_OFFSET:
{
@@ -7628,16 +7631,16 @@ yy834:
yy835:
YYDEBUG(835, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1558 "Zend/zend_language_scanner.l"
+#line 1562 "Zend/zend_language_scanner.l"
{ /* Offset could be treated as a long */
if (yyleng < MAX_LENGTH_OF_LONG - 1 || (yyleng == MAX_LENGTH_OF_LONG - 1 && strcmp(yytext, long_min_digits) < 0)) {
ZVAL_LONG(zendlval, strtol(yytext, NULL, 10));
} else {
- ZVAL_STRINGL(zendlval, yytext, yyleng, 1);
+ ZVAL_STRINGL(zendlval, yytext, yyleng);
}
return T_NUM_STRING;
}
-#line 7641 "Zend/zend_language_scanner.c"
+#line 7644 "Zend/zend_language_scanner.c"
yy836:
YYDEBUG(836, *YYCURSOR);
yych = *++YYCURSOR;
@@ -7657,23 +7660,23 @@ yy837:
yy838:
YYDEBUG(838, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1834 "Zend/zend_language_scanner.l"
+#line 1838 "Zend/zend_language_scanner.l"
{
/* Only '[' can be valid, but returning other tokens will allow a more explicit parse error */
return yytext[0];
}
-#line 7666 "Zend/zend_language_scanner.c"
+#line 7669 "Zend/zend_language_scanner.c"
yy839:
YYDEBUG(839, *YYCURSOR);
++YYCURSOR;
YYDEBUG(840, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1829 "Zend/zend_language_scanner.l"
+#line 1833 "Zend/zend_language_scanner.l"
{
yy_pop_state(TSRMLS_C);
return ']';
}
-#line 7677 "Zend/zend_language_scanner.c"
+#line 7680 "Zend/zend_language_scanner.c"
yy841:
YYDEBUG(841, *YYCURSOR);
yych = *++YYCURSOR;
@@ -7683,14 +7686,14 @@ yy842:
++YYCURSOR;
YYDEBUG(843, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1839 "Zend/zend_language_scanner.l"
+#line 1843 "Zend/zend_language_scanner.l"
{
/* Invalid rule to return a more explicit parse error with proper line number */
yyless(0);
yy_pop_state(TSRMLS_C);
return T_ENCAPSED_AND_WHITESPACE;
}
-#line 7694 "Zend/zend_language_scanner.c"
+#line 7697 "Zend/zend_language_scanner.c"
yy844:
YYDEBUG(844, *YYCURSOR);
++YYCURSOR;
@@ -7699,19 +7702,19 @@ yy844:
yy845:
YYDEBUG(845, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1846 "Zend/zend_language_scanner.l"
+#line 1850 "Zend/zend_language_scanner.l"
{
zend_copy_value(zendlval, yytext, yyleng);
zendlval->type = IS_STRING;
return T_STRING;
}
-#line 7709 "Zend/zend_language_scanner.c"
+#line 7712 "Zend/zend_language_scanner.c"
yy846:
YYDEBUG(846, *YYCURSOR);
++YYCURSOR;
YYDEBUG(847, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 2360 "Zend/zend_language_scanner.l"
+#line 2363 "Zend/zend_language_scanner.l"
{
if (YYCURSOR > YYLIMIT) {
return 0;
@@ -7720,7 +7723,7 @@ yy846:
zend_error(E_COMPILE_WARNING,"Unexpected character in input: '%c' (ASCII=%d) state=%d", yytext[0], yytext[0], YYSTATE);
goto restart;
}
-#line 7724 "Zend/zend_language_scanner.c"
+#line 7727 "Zend/zend_language_scanner.c"
yy848:
YYDEBUG(848, *YYCURSOR);
++YYCURSOR;
@@ -7756,13 +7759,13 @@ yy850:
yy852:
YYDEBUG(852, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1823 "Zend/zend_language_scanner.l"
+#line 1827 "Zend/zend_language_scanner.l"
{
zend_copy_value(zendlval, (yytext+1), (yyleng-1));
zendlval->type = IS_STRING;
return T_VARIABLE;
}
-#line 7766 "Zend/zend_language_scanner.c"
+#line 7769 "Zend/zend_language_scanner.c"
yy853:
YYDEBUG(853, *YYCURSOR);
++YYCURSOR;
@@ -7802,12 +7805,12 @@ yy858:
yy860:
YYDEBUG(860, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
-#line 1567 "Zend/zend_language_scanner.l"
+#line 1571 "Zend/zend_language_scanner.l"
{ /* Offset must be treated as a string */
- ZVAL_STRINGL(zendlval, yytext, yyleng, 1);
+ ZVAL_STRINGL(zendlval, yytext, yyleng);
return T_NUM_STRING;
}
-#line 7811 "Zend/zend_language_scanner.c"
+#line 7814 "Zend/zend_language_scanner.c"
yy861:
YYDEBUG(861, *YYCURSOR);
++YYCURSOR;
@@ -7830,6 +7833,6 @@ yy863:
goto yy860;
}
}
-#line 2369 "Zend/zend_language_scanner.l"
+#line 2372 "Zend/zend_language_scanner.l"
}
diff --git a/Zend/zend_language_scanner.h b/Zend/zend_language_scanner.h
index 05345b2cc3..d434107a9b 100644
--- a/Zend/zend_language_scanner.h
+++ b/Zend/zend_language_scanner.h
@@ -35,7 +35,7 @@ typedef struct _zend_lex_state {
zend_file_handle *in;
uint lineno;
- char *filename;
+ zend_string *filename;
/* original (unfiltered) script */
unsigned char *script_org;
diff --git a/Zend/zend_language_scanner.l b/Zend/zend_language_scanner.l
index ccf8a4ca00..e7c2837dd2 100644
--- a/Zend/zend_language_scanner.l
+++ b/Zend/zend_language_scanner.l
@@ -112,9 +112,9 @@ do { \
} \
}
-/* To save initial string length after scanning to first variable, CG(doc_comment_len) can be reused */
-#define SET_DOUBLE_QUOTES_SCANNED_LENGTH(len) CG(doc_comment_len) = (len)
-#define GET_DOUBLE_QUOTES_SCANNED_LENGTH() CG(doc_comment_len)
+/* To save initial string length after scanning to first variable */
+#define SET_DOUBLE_QUOTES_SCANNED_LENGTH(len) SCNG(scanned_string_len) = (len)
+#define GET_DOUBLE_QUOTES_SCANNED_LENGTH() SCNG(scanned_string_len)
#define IS_LABEL_START(c) (((c) >= 'a' && (c) <= 'z') || ((c) >= 'A' && (c) <= 'Z') || (c) == '_' || (c) >= 0x7F)
@@ -179,7 +179,6 @@ void startup_scanner(TSRMLS_D)
{
CG(parse_error) = 0;
CG(doc_comment) = NULL;
- CG(doc_comment_len) = 0;
zend_stack_init(&SCNG(state_stack));
zend_ptr_stack_init(&SCNG(heredoc_label_stack));
}
@@ -534,7 +533,7 @@ ZEND_API int open_file_for_scanning(zend_file_handle *file_handle TSRMLS_DC)
file_path = file_handle->filename;
}
- zend_set_compiled_filename(file_path TSRMLS_CC);
+ zend_set_compiled_filename(STR_INIT(file_path, strlen(file_path), 0) TSRMLS_CC);
if (CG(start_lineno)) {
CG(zend_lineno) = CG(start_lineno);
@@ -562,7 +561,6 @@ ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type TSR
zend_bool original_in_compilation = CG(in_compilation);
retval_znode.op_type = IS_CONST;
- INIT_PZVAL(&retval_znode.u.constant);
ZVAL_LONG(&retval_znode.u.constant, 1);
zend_save_lexical_state(&original_lex_state TSRMLS_CC);
@@ -628,13 +626,11 @@ zend_op_array *compile_filename(int type, zval *filename TSRMLS_DC)
retval = zend_compile_file(&file_handle, type TSRMLS_CC);
if (retval && file_handle.handle.stream.handle) {
- int dummy = 1;
-
if (!file_handle.opened_path) {
file_handle.opened_path = opened_path = estrndup(Z_STRVAL_P(filename), Z_STRLEN_P(filename));
}
- zend_hash_add(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path)+1, (void *)&dummy, sizeof(int), NULL);
+ zend_hash_str_add_empty_element(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path));
if (opened_path) {
efree(opened_path);
@@ -654,7 +650,16 @@ ZEND_API int zend_prepare_string_for_scanning(zval *str, char *filename TSRMLS_D
size_t size;
/* enforce ZEND_MMAP_AHEAD trailing NULLs for flex... */
- Z_STRVAL_P(str) = str_erealloc(Z_STRVAL_P(str), Z_STRLEN_P(str) + ZEND_MMAP_AHEAD);
+ if (Z_REFCOUNT_P(str) == 1) {
+ Z_STR_P(str) = STR_EREALLOC(Z_STR_P(str), Z_STRLEN_P(str) + ZEND_MMAP_AHEAD);
+ } else {
+ zend_string *tmp;
+
+ tmp = STR_ALLOC(Z_STRLEN_P(str) + ZEND_MMAP_AHEAD, 0);
+ memcpy(tmp->val, Z_STRVAL_P(str), Z_STRLEN_P(str) + 1);
+ Z_DELREF_P(str);
+ Z_STR_P(str) = tmp;
+ }
memset(Z_STRVAL_P(str) + Z_STRLEN_P(str), 0, ZEND_MMAP_AHEAD);
SCNG(yy_in) = NULL;
@@ -682,7 +687,7 @@ ZEND_API int zend_prepare_string_for_scanning(zval *str, char *filename TSRMLS_D
yy_scan_buffer(buf, size TSRMLS_CC);
- zend_set_compiled_filename(filename TSRMLS_CC);
+ zend_set_compiled_filename(STR_INIT(filename, strlen(filename), 0) TSRMLS_CC);
CG(zend_lineno) = 1;
CG(increment_lineno) = 0;
RESET_DOC_COMMENT();
@@ -863,8 +868,7 @@ ZEND_API void zend_multibyte_yyinput_again(zend_encoding_filter old_input_filter
SCNG(output_filter)((unsigned char **)&Z_STRVAL_P(zendlval), &sz, (unsigned char *)yytext, (size_t)yyleng TSRMLS_CC); \
Z_STRLEN_P(zendlval) = sz; \
} else { \
- Z_STRVAL_P(zendlval) = (char *) estrndup(yytext, yyleng); \
- Z_STRLEN_P(zendlval) = yyleng; \
+ ZVAL_STRINGL(zendlval, yytext, yyleng); \
}
static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quote_type TSRMLS_DC)
@@ -872,7 +876,7 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo
register char *s, *t;
char *end;
- ZVAL_STRINGL(zendlval, str, len, 1);
+ ZVAL_STRINGL(zendlval, str, len);
/* convert escape sequences */
s = t = Z_STRVAL_P(zendlval);
@@ -1173,7 +1177,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
}
<ST_IN_SCRIPTING,ST_LOOKING_FOR_PROPERTY>{WHITESPACE}+ {
- ZVAL_STRINGL(zendlval, yytext, yyleng, 0); /* no copying - intentional */
+ ZVAL_STRINGL(zendlval, yytext, yyleng);
HANDLE_NEWLINES(yytext, yyleng);
return T_WHITESPACE;
}
@@ -1559,13 +1563,13 @@ NEWLINE ("\r"|"\n"|"\r\n")
if (yyleng < MAX_LENGTH_OF_LONG - 1 || (yyleng == MAX_LENGTH_OF_LONG - 1 && strcmp(yytext, long_min_digits) < 0)) {
ZVAL_LONG(zendlval, strtol(yytext, NULL, 10));
} else {
- ZVAL_STRINGL(zendlval, yytext, yyleng, 1);
+ ZVAL_STRINGL(zendlval, yytext, yyleng);
}
return T_NUM_STRING;
}
<ST_VAR_OFFSET>{LNUM}|{HNUM}|{BNUM} { /* Offset must be treated as a string */
- ZVAL_STRINGL(zendlval, yytext, yyleng, 1);
+ ZVAL_STRINGL(zendlval, yytext, yyleng);
return T_NUM_STRING;
}
@@ -1579,12 +1583,12 @@ NEWLINE ("\r"|"\n"|"\r\n")
if (ce && ZEND_ACC_TRAIT == (ce->ce_flags & ZEND_ACC_TRAIT)) {
/* We create a special __CLASS__ constant that is going to be resolved
at run-time */
- Z_STRLEN_P(zendlval) = sizeof("__CLASS__")-1;
- Z_STRVAL_P(zendlval) = estrndup("__CLASS__", Z_STRLEN_P(zendlval));
- zendlval->type = IS_CONSTANT;
+ ZVAL_STRINGL(zendlval, "__CLASS__", sizeof("__CLASS__") - 1);
+ Z_TYPE_P(zendlval) = IS_CONSTANT;
} else {
if (ce && ce->name) {
- ZVAL_STRINGL(zendlval, ce->name, ce->name_length, 1);
+ ZVAL_STR(zendlval, ce->name);
+ Z_ADDREF_P(zendlval);
} else {
ZVAL_EMPTY_STRING(zendlval);
}
@@ -1595,7 +1599,8 @@ NEWLINE ("\r"|"\n"|"\r\n")
<ST_IN_SCRIPTING>"__TRAIT__" {
zend_class_entry *ce = CG(active_class_entry);
if (ce && ce->name && ZEND_ACC_TRAIT == (ce->ce_flags & ZEND_ACC_TRAIT)) {
- ZVAL_STRINGL(zendlval, ce->name, ce->name_length, 1);
+ ZVAL_STR(zendlval, ce->name);
+ Z_ADDREF_P(zendlval);
} else {
ZVAL_EMPTY_STRING(zendlval);
}
@@ -1605,7 +1610,8 @@ NEWLINE ("\r"|"\n"|"\r\n")
<ST_IN_SCRIPTING>"__FUNCTION__" {
zend_op_array *op_array = CG(active_op_array);
if (op_array && op_array->function_name) {
- ZVAL_STRING(zendlval, op_array->function_name, 1);
+ ZVAL_STR(zendlval, op_array->function_name);
+ Z_ADDREF_P(zendlval);
} else {
ZVAL_EMPTY_STRING(zendlval);
}
@@ -1613,10 +1619,10 @@ NEWLINE ("\r"|"\n"|"\r\n")
}
<ST_IN_SCRIPTING>"__METHOD__" {
- const char *class_name = CG(active_class_entry) ? CG(active_class_entry)->name : NULL;
- const char *func_name = CG(active_op_array)? CG(active_op_array)->function_name : NULL;
+ const char *class_name = CG(active_class_entry) ? CG(active_class_entry)->name->val : NULL;
+ const char *func_name = CG(active_op_array)? CG(active_op_array)->function_name->val : NULL;
- Z_STRLEN_P(zendlval) = zend_spprintf(&Z_STRVAL_P(zendlval), 0, "%s%s%s",
+ Z_STRLEN_P(zendlval) = zend_spprintf((char**)&Z_STRVAL_P(zendlval), 0, "%s%s%s",
class_name ? class_name : "",
class_name && func_name ? "::" : "",
func_name ? func_name : ""
@@ -1631,44 +1637,43 @@ NEWLINE ("\r"|"\n"|"\r\n")
}
<ST_IN_SCRIPTING>"__FILE__" {
- char *filename = zend_get_compiled_filename(TSRMLS_C);
+ zend_string *filename = zend_get_compiled_filename(TSRMLS_C);
if (!filename) {
- filename = "";
+ filename = STR_EMPTY_ALLOC();
}
- ZVAL_STRING(zendlval, filename, 1);
+ ZVAL_STR(zendlval, filename);
return T_FILE;
}
<ST_IN_SCRIPTING>"__DIR__" {
- char *filename = zend_get_compiled_filename(TSRMLS_C);
- const size_t filename_len = strlen(filename);
- char *dirname;
+ zend_string *filename = zend_get_compiled_filename(TSRMLS_C);
+ zend_string *dirname;
if (!filename) {
- filename = "";
+ filename = STR_EMPTY_ALLOC();
}
- dirname = estrndup(filename, filename_len);
- zend_dirname(dirname, filename_len);
+ dirname = STR_DUP(filename, 0);
+ zend_dirname(dirname->val, dirname->len);
- if (strcmp(dirname, ".") == 0) {
- dirname = erealloc(dirname, MAXPATHLEN);
+ if (strcmp(dirname->val, ".") == 0) {
+ dirname = STR_EREALLOC(dirname, MAXPATHLEN);
#if HAVE_GETCWD
- VCWD_GETCWD(dirname, MAXPATHLEN);
+ VCWD_GETCWD(dirname->val, MAXPATHLEN);
#elif HAVE_GETWD
- VCWD_GETWD(dirname);
+ VCWD_GETWD(dirname->val);
#endif
}
- ZVAL_STRING(zendlval, dirname, 0);
+ dirname->len = strlen(dirname->val);
+ ZVAL_STR(zendlval, dirname);
return T_DIR;
}
<ST_IN_SCRIPTING>"__NAMESPACE__" {
- if (CG(current_namespace)) {
- *zendlval = *CG(current_namespace);
- zval_copy_ctor(zendlval);
+ if (Z_TYPE(CG(current_namespace)) != IS_UNDEF) {
+ ZVAL_DUP(zendlval, &CG(current_namespace));
} else {
ZVAL_EMPTY_STRING(zendlval);
}
@@ -1685,7 +1690,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
}
HANDLE_NEWLINES(yytext, yyleng);
- ZVAL_STRINGL(zendlval, yytext, yyleng, 0); /* no copying - intentional */
+ ZVAL_STRINGL(zendlval, yytext, yyleng);
BEGIN(ST_IN_SCRIPTING);
return T_OPEN_TAG;
}
@@ -1693,7 +1698,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
<INITIAL>"<%=" {
if (CG(asp_tags)) {
- ZVAL_STRINGL(zendlval, yytext, yyleng, 0); /* no copying - intentional */
+ ZVAL_STRINGL(zendlval, yytext, yyleng);
BEGIN(ST_IN_SCRIPTING);
return T_OPEN_TAG_WITH_ECHO;
} else {
@@ -1703,7 +1708,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
<INITIAL>"<?=" {
- ZVAL_STRINGL(zendlval, yytext, yyleng, 0); /* no copying - intentional */
+ ZVAL_STRINGL(zendlval, yytext, yyleng);
BEGIN(ST_IN_SCRIPTING);
return T_OPEN_TAG_WITH_ECHO;
}
@@ -1711,7 +1716,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
<INITIAL>"<%" {
if (CG(asp_tags)) {
- ZVAL_STRINGL(zendlval, yytext, yyleng, 0); /* no copying - intentional */
+ ZVAL_STRINGL(zendlval, yytext, yyleng);
BEGIN(ST_IN_SCRIPTING);
return T_OPEN_TAG;
} else {
@@ -1721,7 +1726,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
<INITIAL>"<?php"([ \t]|{NEWLINE}) {
- ZVAL_STRINGL(zendlval, yytext, yyleng, 0); /* no copying - intentional */
+ ZVAL_STRINGL(zendlval, yytext, yyleng);
HANDLE_NEWLINE(yytext[yyleng-1]);
BEGIN(ST_IN_SCRIPTING);
return T_OPEN_TAG;
@@ -1730,7 +1735,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
<INITIAL>"<?" {
if (CG(short_tags)) {
- ZVAL_STRINGL(zendlval, yytext, yyleng, 0); /* no copying - intentional */
+ ZVAL_STRINGL(zendlval, yytext, yyleng);
BEGIN(ST_IN_SCRIPTING);
return T_OPEN_TAG;
} else {
@@ -1789,11 +1794,10 @@ inline_html:
if (readsize < yyleng) {
yyless(readsize);
}
+ zendlval->type = IS_STRING;
} else {
- Z_STRVAL_P(zendlval) = (char *) estrndup(yytext, yyleng);
- Z_STRLEN_P(zendlval) = yyleng;
+ ZVAL_STRINGL(zendlval, yytext, yyleng);
}
- zendlval->type = IS_STRING;
HANDLE_NEWLINES(yytext, yyleng);
return T_INLINE_HTML;
}
@@ -1910,8 +1914,7 @@ inline_html:
HANDLE_NEWLINES(yytext, yyleng);
if (doc_com) {
- CG(doc_comment) = estrndup(yytext, yyleng);
- CG(doc_comment_len) = yyleng;
+ CG(doc_comment) = STR_INIT(yytext, yyleng, 0);
return T_DOC_COMMENT;
}
@@ -1919,7 +1922,7 @@ inline_html:
}
<ST_IN_SCRIPTING>("?>"|"</script"{WHITESPACE}*">"){NEWLINE}? {
- ZVAL_STRINGL(zendlval, yytext, yyleng, 0); /* no copying - intentional */
+ ZVAL_STRINGL(zendlval, yytext, yyleng);
BEGIN(INITIAL);
return T_CLOSE_TAG; /* implicit ';' at php-end tag */
}
@@ -1928,7 +1931,7 @@ inline_html:
<ST_IN_SCRIPTING>"%>"{NEWLINE}? {
if (CG(asp_tags)) {
BEGIN(INITIAL);
- ZVAL_STRINGL(zendlval, yytext, yyleng, 0); /* no copying - intentional */
+ ZVAL_STRINGL(zendlval, yytext, yyleng);
return T_CLOSE_TAG; /* implicit ';' at php-end tag */
} else {
yyless(1);
@@ -1962,7 +1965,7 @@ inline_html:
}
}
- ZVAL_STRINGL(zendlval, yytext+bprefix+1, yyleng-bprefix-2, 1);
+ ZVAL_STRINGL(zendlval, yytext+bprefix+1, yyleng-bprefix-2);
/* convert escape sequences */
s = t = Z_STRVAL_P(zendlval);
diff --git a/Zend/zend_language_scanner_defs.h b/Zend/zend_language_scanner_defs.h
index 70ce8b890c..5926e3c61d 100644
--- a/Zend/zend_language_scanner_defs.h
+++ b/Zend/zend_language_scanner_defs.h
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.13.5 on Sun Dec 22 13:03:33 2013 */
+/* Generated by re2c 0.13.5 */
#line 3 "Zend/zend_language_scanner_defs.h"
enum YYCONDTYPE {
diff --git a/Zend/zend_list.c b/Zend/zend_list.c
index 11c2c33567..59a561f6e6 100644
--- a/Zend/zend_list.c
+++ b/Zend/zend_list.c
@@ -31,88 +31,46 @@ ZEND_API int le_index_ptr;
/* true global */
static HashTable list_destructors;
-
-ZEND_API int zend_list_insert(void *ptr, int type TSRMLS_DC)
+ZEND_API zval *zend_list_insert(void *ptr, int type TSRMLS_DC)
{
int index;
- zend_rsrc_list_entry le;
-
- le.ptr=ptr;
- le.type=type;
- le.refcount=1;
+ zval zv;
index = zend_hash_next_free_element(&EG(regular_list));
-
- zend_hash_index_update(&EG(regular_list), index, (void *) &le, sizeof(zend_rsrc_list_entry), NULL);
- return index;
+ ZVAL_NEW_RES(&zv, index, ptr, type);
+ return zend_hash_index_update(&EG(regular_list), index, &zv);
}
-ZEND_API int _zend_list_delete(int id TSRMLS_DC)
+ZEND_API int _zend_list_delete(zend_resource *res TSRMLS_DC)
{
- zend_rsrc_list_entry *le;
-
- if (zend_hash_index_find(&EG(regular_list), id, (void **) &le)==SUCCESS) {
-/* printf("del(%d): %d->%d\n", id, le->refcount, le->refcount-1); */
- if (--le->refcount<=0) {
- return zend_hash_index_del(&EG(regular_list), id);
- } else {
- return SUCCESS;
- }
+ if (res->gc.refcount <= 0) {
+ return zend_hash_index_del(&EG(regular_list), res->handle);
} else {
- return FAILURE;
- }
-}
-
-
-ZEND_API void *_zend_list_find(int id, int *type TSRMLS_DC)
-{
- zend_rsrc_list_entry *le;
-
- if (zend_hash_index_find(&EG(regular_list), id, (void **) &le)==SUCCESS) {
- *type = le->type;
- return le->ptr;
- } else {
- *type = -1;
- return NULL;
- }
-}
-
-ZEND_API int _zend_list_addref(int id TSRMLS_DC)
-{
- zend_rsrc_list_entry *le;
-
- if (zend_hash_index_find(&EG(regular_list), id, (void **) &le)==SUCCESS) {
-/* printf("add(%d): %d->%d\n", id, le->refcount, le->refcount+1); */
- le->refcount++;
return SUCCESS;
- } else {
- return FAILURE;
}
}
-
-ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type TSRMLS_DC)
+ZEND_API zend_resource* zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type TSRMLS_DC)
{
- int rsrc_id;
+ zval *zv;
- rsrc_id = zend_list_insert(rsrc_pointer, rsrc_type TSRMLS_CC);
+ zv = zend_list_insert(rsrc_pointer, rsrc_type TSRMLS_CC);
if (rsrc_result) {
- rsrc_result->value.lval = rsrc_id;
- rsrc_result->type = IS_RESOURCE;
+ ZVAL_COPY_VALUE(rsrc_result, zv);
+ return Z_RES_P(rsrc_result);
+ } else {
+ return Z_RES_P(zv);
}
-
- return rsrc_id;
}
-
-ZEND_API void *zend_fetch_resource(zval **passed_id TSRMLS_DC, int default_id, const char *resource_type_name, int *found_resource_type, int num_resource_types, ...)
+ZEND_API void *zend_fetch_resource(zval *passed_id TSRMLS_DC, int default_id, const char *resource_type_name, int *found_resource_type, int num_resource_types, ...)
{
- int id;
int actual_resource_type;
- void *resource;
+// void *resource;
va_list resource_types;
int i;
+ zend_resource *res;
const char *space;
const char *class_name;
@@ -123,26 +81,25 @@ ZEND_API void *zend_fetch_resource(zval **passed_id TSRMLS_DC, int default_id, c
zend_error(E_WARNING, "%s%s%s(): no %s resource supplied", class_name, space, get_active_function_name(TSRMLS_C), resource_type_name);
}
return NULL;
- } else if ((*passed_id)->type != IS_RESOURCE) {
+ } else if (Z_TYPE_P(passed_id) != IS_RESOURCE) {
if (resource_type_name) {
class_name = get_active_class_name(&space TSRMLS_CC);
zend_error(E_WARNING, "%s%s%s(): supplied argument is not a valid %s resource", class_name, space, get_active_function_name(TSRMLS_C), resource_type_name);
}
return NULL;
}
- id = (*passed_id)->value.lval;
} else {
- id = default_id;
- }
-
- resource = zend_list_find(id, &actual_resource_type);
- if (!resource) {
- if (resource_type_name) {
- class_name = get_active_class_name(&space TSRMLS_CC);
- zend_error(E_WARNING, "%s%s%s(): %d is not a valid %s resource", class_name, space, get_active_function_name(TSRMLS_C), id, resource_type_name);
+ passed_id = zend_hash_index_find(&EG(regular_list), default_id);
+ if (!passed_id) {
+ if (resource_type_name) {
+ class_name = get_active_class_name(&space TSRMLS_CC);
+ zend_error(E_WARNING, "%s%s%s(): %d is not a valid %s resource", class_name, space, get_active_function_name(TSRMLS_C), default_id, resource_type_name);
+ }
+ return NULL;
}
- return NULL;
}
+ res = Z_RES_P(passed_id);
+ actual_resource_type = res->type;
va_start(resource_types, num_resource_types);
for (i=0; i<num_resource_types; i++) {
@@ -151,7 +108,7 @@ ZEND_API void *zend_fetch_resource(zval **passed_id TSRMLS_DC, int default_id, c
if (found_resource_type) {
*found_resource_type = actual_resource_type;
}
- return resource;
+ return res->ptr;
}
}
va_end(resource_types);
@@ -164,59 +121,58 @@ ZEND_API void *zend_fetch_resource(zval **passed_id TSRMLS_DC, int default_id, c
return NULL;
}
-
-void list_entry_destructor(void *ptr)
+void list_entry_destructor(zval *zv)
{
- zend_rsrc_list_entry *le = (zend_rsrc_list_entry *) ptr;
+ zend_resource *res = Z_RES_P(zv);
zend_rsrc_list_dtors_entry *ld;
TSRMLS_FETCH();
- if (zend_hash_index_find(&list_destructors, le->type, (void **) &ld)==SUCCESS) {
+ ld = zend_hash_index_find_ptr(&list_destructors, res->type);
+ if (ld) {
switch (ld->type) {
case ZEND_RESOURCE_LIST_TYPE_STD:
if (ld->list_dtor) {
- (ld->list_dtor)(le->ptr);
+ (ld->list_dtor)(res->ptr);
}
break;
case ZEND_RESOURCE_LIST_TYPE_EX:
if (ld->list_dtor_ex) {
- ld->list_dtor_ex(le TSRMLS_CC);
+ ld->list_dtor_ex(res->ptr TSRMLS_CC);
}
break;
EMPTY_SWITCH_DEFAULT_CASE()
}
} else {
- zend_error(E_WARNING,"Unknown list entry type in request shutdown (%d)", le->type);
+ zend_error(E_WARNING,"Unknown list entry type in request shutdown (%d)", res->type);
}
}
-
-void plist_entry_destructor(void *ptr)
+void plist_entry_destructor(zval *zv)
{
- zend_rsrc_list_entry *le = (zend_rsrc_list_entry *) ptr;
+ zend_resource *res = Z_RES_P(zv);
zend_rsrc_list_dtors_entry *ld;
TSRMLS_FETCH();
- if (zend_hash_index_find(&list_destructors, le->type, (void **) &ld)==SUCCESS) {
+ ld = zend_hash_index_find_ptr(&list_destructors, res->type);
+ if (ld) {
switch (ld->type) {
case ZEND_RESOURCE_LIST_TYPE_STD:
if (ld->plist_dtor) {
- (ld->plist_dtor)(le->ptr);
+ (ld->plist_dtor)(res->ptr);
}
break;
case ZEND_RESOURCE_LIST_TYPE_EX:
if (ld->plist_dtor_ex) {
- ld->plist_dtor_ex(le TSRMLS_CC);
+ ld->plist_dtor_ex(res TSRMLS_CC);
}
break;
EMPTY_SWITCH_DEFAULT_CASE()
}
} else {
- zend_error(E_WARNING,"Unknown persistent list entry type in module shutdown (%d)", le->type);
+ zend_error(E_WARNING,"Unknown persistent list entry type in module shutdown (%d)", res->type);
}
}
-
int zend_init_rsrc_list(TSRMLS_D)
{
if (zend_hash_init(&EG(regular_list), 0, NULL, list_entry_destructor, 0)==SUCCESS) {
@@ -239,9 +195,9 @@ void zend_destroy_rsrc_list(HashTable *ht TSRMLS_DC)
zend_hash_graceful_reverse_destroy(ht);
}
-static int clean_module_resource(zend_rsrc_list_entry *le, int *resource_id TSRMLS_DC)
+static int clean_module_resource(zval *zv, int *resource_id TSRMLS_DC)
{
- if (le->type == *resource_id) {
+ if (Z_RES_TYPE_P(zv) == *resource_id) {
return 1;
} else {
return 0;
@@ -249,8 +205,9 @@ static int clean_module_resource(zend_rsrc_list_entry *le, int *resource_id TSRM
}
-static int zend_clean_module_rsrc_dtors_cb(zend_rsrc_list_dtors_entry *ld, int *module_number TSRMLS_DC)
+static int zend_clean_module_rsrc_dtors_cb(zval *zv, int *module_number TSRMLS_DC)
{
+ zend_rsrc_list_dtors_entry *ld = Z_PTR_P(zv);
if (ld->module_number == *module_number) {
zend_hash_apply_with_argument(&EG(persistent_list), (apply_func_arg_t) clean_module_resource, (void *) &(ld->resource_id) TSRMLS_CC);
return 1;
@@ -268,21 +225,20 @@ void zend_clean_module_rsrc_dtors(int module_number TSRMLS_DC)
ZEND_API int zend_register_list_destructors(void (*ld)(void *), void (*pld)(void *), int module_number)
{
- zend_rsrc_list_dtors_entry lde;
-
-#if 0
- printf("Registering destructors %d for module %d\n", list_destructors.nNextFreeElement, module_number);
-#endif
+ zend_rsrc_list_dtors_entry *lde;
+ zval zv;
- lde.list_dtor=(void (*)(void *)) ld;
- lde.plist_dtor=(void (*)(void *)) pld;
- lde.list_dtor_ex = lde.plist_dtor_ex = NULL;
- lde.module_number = module_number;
- lde.resource_id = list_destructors.nNextFreeElement;
- lde.type = ZEND_RESOURCE_LIST_TYPE_STD;
- lde.type_name = NULL;
+ lde = emalloc(sizeof(zend_rsrc_list_dtors_entry));
+ lde->list_dtor=(void (*)(void *)) ld;
+ lde->plist_dtor=(void (*)(void *)) pld;
+ lde->list_dtor_ex = lde->plist_dtor_ex = NULL;
+ lde->module_number = module_number;
+ lde->resource_id = list_destructors.nNextFreeElement;
+ lde->type = ZEND_RESOURCE_LIST_TYPE_STD;
+ lde->type_name = NULL;
+ ZVAL_PTR(&zv, lde);
- if (zend_hash_next_index_insert(&list_destructors, (void *) &lde, sizeof(zend_rsrc_list_dtors_entry), NULL)==FAILURE) {
+ if (zend_hash_next_index_insert(&list_destructors, &zv) == NULL) {
return FAILURE;
}
return list_destructors.nNextFreeElement-1;
@@ -291,38 +247,34 @@ ZEND_API int zend_register_list_destructors(void (*ld)(void *), void (*pld)(void
ZEND_API int zend_register_list_destructors_ex(rsrc_dtor_func_t ld, rsrc_dtor_func_t pld, const char *type_name, int module_number)
{
- zend_rsrc_list_dtors_entry lde;
+ zend_rsrc_list_dtors_entry *lde;
+ zval zv;
-#if 0
- printf("Registering destructors %d for module %d\n", list_destructors.nNextFreeElement, module_number);
-#endif
-
- lde.list_dtor = NULL;
- lde.plist_dtor = NULL;
- lde.list_dtor_ex = ld;
- lde.plist_dtor_ex = pld;
- lde.module_number = module_number;
- lde.resource_id = list_destructors.nNextFreeElement;
- lde.type = ZEND_RESOURCE_LIST_TYPE_EX;
- lde.type_name = type_name;
+ lde = emalloc(sizeof(zend_rsrc_list_dtors_entry));
+ lde->list_dtor = NULL;
+ lde->plist_dtor = NULL;
+ lde->list_dtor_ex = ld;
+ lde->plist_dtor_ex = pld;
+ lde->module_number = module_number;
+ lde->resource_id = list_destructors.nNextFreeElement;
+ lde->type = ZEND_RESOURCE_LIST_TYPE_EX;
+ lde->type_name = type_name;
+ ZVAL_PTR(&zv, lde);
- if (zend_hash_next_index_insert(&list_destructors, (void *) &lde, sizeof(zend_rsrc_list_dtors_entry), NULL)==FAILURE) {
+ if (zend_hash_next_index_insert(&list_destructors, &zv) == NULL) {
return FAILURE;
}
return list_destructors.nNextFreeElement-1;
}
-ZEND_API int zend_fetch_list_dtor_id(char *type_name)
+ZEND_API int zend_fetch_list_dtor_id(const char *type_name)
{
zend_rsrc_list_dtors_entry *lde;
HashPosition pos;
zend_hash_internal_pointer_reset_ex(&list_destructors, &pos);
- while (zend_hash_get_current_data_ex(&list_destructors, (void **)&lde, &pos) == SUCCESS) {
+ while ((lde = zend_hash_get_current_data_ptr_ex(&list_destructors, &pos)) != NULL) {
if (lde->type_name && (strcmp(type_name, lde->type_name) == 0)) {
-#if 0
- printf("Found resource id %d for resource type %s\n", (*lde).resource_id, type_name);
-#endif
return lde->resource_id;
}
zend_hash_move_forward_ex(&list_destructors, &pos);
@@ -348,15 +300,12 @@ void zend_destroy_rsrc_list_dtors(void)
}
-const char *zend_rsrc_list_get_rsrc_type(int resource TSRMLS_DC)
+const char *zend_rsrc_list_get_rsrc_type(zend_resource *res TSRMLS_DC)
{
zend_rsrc_list_dtors_entry *lde;
- int rsrc_type;
-
- if (!zend_list_find(resource, &rsrc_type))
- return NULL;
- if (zend_hash_index_find(&list_destructors, rsrc_type, (void **) &lde)==SUCCESS) {
+ lde = zend_hash_index_find_ptr(&list_destructors, res->type);
+ if (lde) {
return lde->type_name;
} else {
return NULL;
diff --git a/Zend/zend_list.h b/Zend/zend_list.h
index b7980d56f2..67db98cca2 100644
--- a/Zend/zend_list.h
+++ b/Zend/zend_list.h
@@ -30,14 +30,14 @@ BEGIN_EXTERN_C()
#define ZEND_RESOURCE_LIST_TYPE_STD 1
#define ZEND_RESOURCE_LIST_TYPE_EX 2
-typedef struct _zend_rsrc_list_entry {
- void *ptr;
- int type;
- int refcount;
-} zend_rsrc_list_entry;
+//???typedef struct _zend_rsrc_list_entry {
+//??? void *ptr;
+//??? int type;
+//??? int refcount;
+//???} zend_rsrc_list_entry;
-typedef void (*rsrc_dtor_func_t)(zend_rsrc_list_entry *rsrc TSRMLS_DC);
-#define ZEND_RSRC_DTOR_FUNC(name) void name(zend_rsrc_list_entry *rsrc TSRMLS_DC)
+typedef void (*rsrc_dtor_func_t)(zend_resource *res TSRMLS_DC);
+#define ZEND_RSRC_DTOR_FUNC(name) void name(zend_resource *res TSRMLS_DC)
typedef struct _zend_rsrc_list_dtors_entry {
/* old style destructors */
@@ -60,8 +60,8 @@ typedef struct _zend_rsrc_list_dtors_entry {
ZEND_API int zend_register_list_destructors(void (*ld)(void *), void (*pld)(void *), int module_number);
ZEND_API int zend_register_list_destructors_ex(rsrc_dtor_func_t ld, rsrc_dtor_func_t pld, const char *type_name, int module_number);
-void list_entry_destructor(void *ptr);
-void plist_entry_destructor(void *ptr);
+void list_entry_destructor(zval *ptr);
+void plist_entry_destructor(zval *ptr);
void zend_clean_module_rsrc_dtors(int module_number TSRMLS_DC);
int zend_init_rsrc_list(TSRMLS_D);
@@ -70,20 +70,16 @@ void zend_destroy_rsrc_list(HashTable *ht TSRMLS_DC);
int zend_init_rsrc_list_dtors(void);
void zend_destroy_rsrc_list_dtors(void);
-ZEND_API int zend_list_insert(void *ptr, int type TSRMLS_DC);
-ZEND_API int _zend_list_addref(int id TSRMLS_DC);
-ZEND_API int _zend_list_delete(int id TSRMLS_DC);
-ZEND_API void *_zend_list_find(int id, int *type TSRMLS_DC);
+ZEND_API zval *zend_list_insert(void *ptr, int type TSRMLS_DC);
+ZEND_API int _zend_list_delete(zend_resource *res TSRMLS_DC);
-#define zend_list_addref(id) _zend_list_addref(id TSRMLS_CC)
-#define zend_list_delete(id) _zend_list_delete(id TSRMLS_CC)
-#define zend_list_find(id, type) _zend_list_find(id, type TSRMLS_CC)
+#define zend_list_delete(res) _zend_list_delete(res TSRMLS_CC)
-ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type TSRMLS_DC);
-ZEND_API void *zend_fetch_resource(zval **passed_id TSRMLS_DC, int default_id, const char *resource_type_name, int *found_resource_type, int num_resource_types, ...);
+ZEND_API zend_resource *zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type TSRMLS_DC);
+ZEND_API void *zend_fetch_resource(zval *passed_id TSRMLS_DC, int default_id, const char *resource_type_name, int *found_resource_type, int num_resource_types, ...);
-ZEND_API const char *zend_rsrc_list_get_rsrc_type(int resource TSRMLS_DC);
-ZEND_API int zend_fetch_list_dtor_id(char *type_name);
+ZEND_API const char *zend_rsrc_list_get_rsrc_type(zend_resource *res TSRMLS_DC);
+ZEND_API int zend_fetch_list_dtor_id(const char *type_name);
extern ZEND_API int le_index_ptr; /* list entry type for index pointers */
diff --git a/Zend/zend_modules.h b/Zend/zend_modules.h
index 55f99c4b1d..fbd4087ec2 100644
--- a/Zend/zend_modules.h
+++ b/Zend/zend_modules.h
@@ -129,7 +129,7 @@ int module_registry_cleanup(zend_module_entry *module TSRMLS_DC);
int module_registry_request_startup(zend_module_entry *module TSRMLS_DC);
int module_registry_unload_temp(const zend_module_entry *module TSRMLS_DC);
-#define ZEND_MODULE_DTOR (void (*)(void *)) module_destructor
+#define ZEND_MODULE_DTOR (void (*)(zval *)) module_destructor
#endif
/*
diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c
index 0af8e278b2..d05c6b302c 100644
--- a/Zend/zend_object_handlers.c
+++ b/Zend/zend_object_handlers.c
@@ -33,8 +33,11 @@
#define DEBUG_OBJECT_HANDLERS 0
-#define Z_OBJ_P(zval_p) \
- ((zend_object*)(EG(objects_store).object_buckets[Z_OBJ_HANDLE_P(zval_p)].bucket.obj.object))
+/* guard flags */
+#define IN_GET (1<<0)
+#define IN_SET (1<<1)
+#define IN_UNSET (1<<2)
+#define IN_ISSET (1<<3)
#define Z_OBJ_PROTECT_RECURSION(zval_p) \
do { \
@@ -68,6 +71,7 @@ ZEND_API void rebuild_object_properties(zend_object *zobj) /* {{{ */
{
if (!zobj->properties) {
HashPosition pos;
+ zval tmp;
zend_property_info *prop_info;
zend_class_entry *ce = zobj->ce;
@@ -75,26 +79,28 @@ ZEND_API void rebuild_object_properties(zend_object *zobj) /* {{{ */
zend_hash_init(zobj->properties, 0, NULL, ZVAL_PTR_DTOR, 0);
if (ce->default_properties_count) {
for (zend_hash_internal_pointer_reset_ex(&ce->properties_info, &pos);
- zend_hash_get_current_data_ex(&ce->properties_info, (void**)&prop_info, &pos) == SUCCESS;
+ (prop_info = zend_hash_get_current_data_ptr_ex(&ce->properties_info, &pos)) != NULL;
zend_hash_move_forward_ex(&ce->properties_info, &pos)) {
if (/*prop_info->ce == ce &&*/
(prop_info->flags & ZEND_ACC_STATIC) == 0 &&
prop_info->offset >= 0 &&
- zobj->properties_table[prop_info->offset]) {
- zend_hash_quick_add(zobj->properties, prop_info->name, prop_info->name_length+1, prop_info->h, (void**)&zobj->properties_table[prop_info->offset], sizeof(zval*), (void**)&zobj->properties_table[prop_info->offset]);
+ Z_TYPE(zobj->properties_table[prop_info->offset]) != IS_UNDEF) {
+ ZVAL_INDIRECT(&tmp, &zobj->properties_table[prop_info->offset]);
+ zend_hash_add(zobj->properties, prop_info->name, &tmp);
}
}
while (ce->parent && ce->parent->default_properties_count) {
ce = ce->parent;
for (zend_hash_internal_pointer_reset_ex(&ce->properties_info, &pos);
- zend_hash_get_current_data_ex(&ce->properties_info, (void**)&prop_info, &pos) == SUCCESS;
+ (prop_info = zend_hash_get_current_data_ptr_ex(&ce->properties_info, &pos)) != NULL;
zend_hash_move_forward_ex(&ce->properties_info, &pos)) {
if (prop_info->ce == ce &&
(prop_info->flags & ZEND_ACC_STATIC) == 0 &&
(prop_info->flags & ZEND_ACC_PRIVATE) != 0 &&
prop_info->offset >= 0 &&
- zobj->properties_table[prop_info->offset]) {
- zend_hash_quick_add(zobj->properties, prop_info->name, prop_info->name_length+1, prop_info->h, (void**)&zobj->properties_table[prop_info->offset], sizeof(zval*), (void**)&zobj->properties_table[prop_info->offset]);
+ Z_TYPE(zobj->properties_table[prop_info->offset]) != IS_UNDEF) {
+ ZVAL_INDIRECT(&tmp, &zobj->properties_table[prop_info->offset]);
+ zend_hash_add(zobj->properties, prop_info->name, &tmp);
}
}
}
@@ -114,7 +120,7 @@ ZEND_API HashTable *zend_std_get_properties(zval *object TSRMLS_DC) /* {{{ */
}
/* }}} */
-ZEND_API HashTable *zend_std_get_gc(zval *object, zval ***table, int *n TSRMLS_DC) /* {{{ */
+ZEND_API HashTable *zend_std_get_gc(zval *object, zval **table, int *n TSRMLS_DC) /* {{{ */
{
if (Z_OBJ_HANDLER_P(object, get_properties) != zend_std_get_properties) {
*table = NULL;
@@ -143,9 +149,8 @@ ZEND_API HashTable *zend_std_get_debug_info(zval *object, int *is_temp TSRMLS_DC
}
/* }}} */
-static zval *zend_std_call_getter(zval *object, zval *member TSRMLS_DC) /* {{{ */
+static void zend_std_call_getter(zval *object, zval *member, zval *retval TSRMLS_DC) /* {{{ */
{
- zval *retval = NULL;
zend_class_entry *ce = Z_OBJCE_P(object);
/* __get handler is called with one argument:
@@ -156,21 +161,20 @@ static zval *zend_std_call_getter(zval *object, zval *member TSRMLS_DC) /* {{{ *
SEPARATE_ARG_IF_REF(member);
- zend_call_method_with_1_params(&object, ce, &ce->__get, ZEND_GET_FUNC_NAME, &retval, member);
+ ZVAL_UNDEF(retval);
+ zend_call_method_with_1_params(object, ce, &ce->__get, ZEND_GET_FUNC_NAME, retval, member);
- zval_ptr_dtor(&member);
+ zval_ptr_dtor(member);
- if (retval) {
+ if (Z_REFCOUNTED_P(retval)) {
Z_DELREF_P(retval);
}
-
- return retval;
}
/* }}} */
static int zend_std_call_setter(zval *object, zval *member, zval *value TSRMLS_DC) /* {{{ */
{
- zval *retval = NULL;
+ zval retval;
int result;
zend_class_entry *ce = Z_OBJCE_P(object);
@@ -183,13 +187,14 @@ static int zend_std_call_setter(zval *object, zval *member, zval *value TSRMLS_D
it should return whether the call was successfull or not
*/
- zend_call_method_with_2_params(&object, ce, &ce->__set, ZEND_SET_FUNC_NAME, &retval, member, value);
+ ZVAL_UNDEF(&retval);
+ zend_call_method_with_2_params(object, ce, &ce->__set, ZEND_SET_FUNC_NAME, &retval, member, value);
- zval_ptr_dtor(&member);
- zval_ptr_dtor(&value);
+ zval_ptr_dtor(member);
+ zval_ptr_dtor(value);
- if (retval) {
- result = i_zend_is_true(retval TSRMLS_CC) ? SUCCESS : FAILURE;
+ if (Z_TYPE(retval) != IS_UNDEF) {
+ result = i_zend_is_true(&retval TSRMLS_CC) ? SUCCESS : FAILURE;
zval_ptr_dtor(&retval);
return result;
} else {
@@ -208,15 +213,14 @@ static void zend_std_call_unsetter(zval *object, zval *member TSRMLS_DC) /* {{{
SEPARATE_ARG_IF_REF(member);
- zend_call_method_with_1_params(&object, ce, &ce->__unset, ZEND_UNSET_FUNC_NAME, NULL, member);
+ zend_call_method_with_1_params(object, ce, &ce->__unset, ZEND_UNSET_FUNC_NAME, NULL, member);
- zval_ptr_dtor(&member);
+ zval_ptr_dtor(member);
}
/* }}} */
-static zval *zend_std_call_issetter(zval *object, zval *member TSRMLS_DC) /* {{{ */
+static void zend_std_call_issetter(zval *object, zval *member, zval *retval TSRMLS_DC) /* {{{ */
{
- zval *retval = NULL;
zend_class_entry *ce = Z_OBJCE_P(object);
/* __isset handler is called with one argument:
@@ -227,11 +231,10 @@ static zval *zend_std_call_issetter(zval *object, zval *member TSRMLS_DC) /* {{{
SEPARATE_ARG_IF_REF(member);
- zend_call_method_with_1_params(&object, ce, &ce->__isset, ZEND_ISSET_FUNC_NAME, &retval, member);
-
- zval_ptr_dtor(&member);
+ ZVAL_UNDEF(retval);
+ zend_call_method_with_1_params(object, ce, &ce->__isset, ZEND_ISSET_FUNC_NAME, retval, member);
- return retval;
+ zval_ptr_dtor(member);
}
/* }}} */
@@ -273,7 +276,6 @@ static zend_always_inline struct _zend_property_info *zend_get_property_info_qui
zend_property_info *property_info;
zend_property_info *scope_property_info;
zend_bool denied_access = 0;
- ulong h;
if (key && (property_info = CACHED_POLYMORPHIC_PTR(key->cache_slot, ce)) != NULL) {
return property_info;
@@ -290,8 +292,7 @@ static zend_always_inline struct _zend_property_info *zend_get_property_info_qui
return NULL;
}
property_info = NULL;
- h = key ? key->hash_value : zend_get_hash_value(Z_STRVAL_P(member), Z_STRLEN_P(member) + 1);
- if (zend_hash_quick_find(&ce->properties_info, Z_STRVAL_P(member), Z_STRLEN_P(member)+1, h, (void **) &property_info)==SUCCESS) {
+ if ((property_info = zend_hash_find_ptr(&ce->properties_info, Z_STR_P(member))) != NULL) {
if (UNEXPECTED((property_info->flags & ZEND_ACC_SHADOW) != 0)) {
/* if it's a shadow - go to access it's private */
property_info = NULL;
@@ -305,7 +306,7 @@ static zend_always_inline struct _zend_property_info *zend_get_property_info_qui
*/
} else {
if (UNEXPECTED((property_info->flags & ZEND_ACC_STATIC) != 0) && !silent) {
- zend_error(E_STRICT, "Accessing static property %s::$%s as non static", ce->name, Z_STRVAL_P(member));
+ zend_error(E_STRICT, "Accessing static property %s::$%s as non static", ce->name->val, Z_STRVAL_P(member));
}
if (key) {
CACHE_POLYMORPHIC_PTR(key->cache_slot, ce, property_info);
@@ -321,7 +322,7 @@ static zend_always_inline struct _zend_property_info *zend_get_property_info_qui
if (EG(scope) != ce
&& EG(scope)
&& is_derived_class(ce, EG(scope))
- && zend_hash_quick_find(&EG(scope)->properties_info, Z_STRVAL_P(member), Z_STRLEN_P(member)+1, h, (void **) &scope_property_info)==SUCCESS
+ && (scope_property_info = zend_hash_find_ptr(&EG(scope)->properties_info, Z_STR_P(member))) != NULL
&& scope_property_info->flags & ZEND_ACC_PRIVATE) {
if (key) {
CACHE_POLYMORPHIC_PTR(key->cache_slot, ce, scope_property_info);
@@ -342,9 +343,7 @@ static zend_always_inline struct _zend_property_info *zend_get_property_info_qui
}
} else {
EG(std_property_info).flags = ZEND_ACC_PUBLIC;
- EG(std_property_info).name = Z_STRVAL_P(member);
- EG(std_property_info).name_length = Z_STRLEN_P(member);
- EG(std_property_info).h = h;
+ EG(std_property_info).name = Z_STR_P(member);
EG(std_property_info).ce = ce;
EG(std_property_info).offset = -1;
property_info = &EG(std_property_info);
@@ -359,15 +358,15 @@ ZEND_API struct _zend_property_info *zend_get_property_info(zend_class_entry *ce
}
/* }}} */
-ZEND_API int zend_check_property_access(zend_object *zobj, const char *prop_info_name, int prop_info_name_len TSRMLS_DC) /* {{{ */
+ZEND_API int zend_check_property_access(zend_object *zobj, zend_string *prop_info_name TSRMLS_DC) /* {{{ */
{
zend_property_info *property_info;
const char *class_name, *prop_name;
zval member;
int prop_name_len;
- zend_unmangle_property_name_ex(prop_info_name, prop_info_name_len, &class_name, &prop_name, &prop_name_len);
- ZVAL_STRINGL(&member, prop_name, prop_name_len, 0);
+ zend_unmangle_property_name_ex(prop_info_name->val, prop_info_name->len, &class_name, &prop_name, &prop_name_len);
+ ZVAL_STRINGL(&member, prop_name, prop_name_len);
property_info = zend_get_property_info_quick(zobj->ce, &member, 1, NULL TSRMLS_CC);
if (!property_info) {
return FAILURE;
@@ -376,7 +375,7 @@ ZEND_API int zend_check_property_access(zend_object *zobj, const char *prop_info
if (!(property_info->flags & ZEND_ACC_PRIVATE)) {
/* we we're looking for a private prop but found a non private one of the same name */
return FAILURE;
- } else if (strcmp(prop_info_name+1, property_info->name+1)) {
+ } else if (strcmp(prop_info_name->val+1, property_info->name->val+1)) {
/* we we're looking for a private prop but found a private one of the same name but another class */
return FAILURE;
}
@@ -385,60 +384,53 @@ ZEND_API int zend_check_property_access(zend_object *zobj, const char *prop_info
}
/* }}} */
-static int zend_get_property_guard(zend_object *zobj, zend_property_info *property_info, zval *member, zend_guard **pguard) /* {{{ */
+static long *zend_get_property_guard(zend_object *zobj, zend_property_info *property_info, zval *member) /* {{{ */
{
zend_property_info info;
- zend_guard stub;
+ zval stub, *guard;
if (!property_info) {
property_info = &info;
- info.name = Z_STRVAL_P(member);
- info.name_length = Z_STRLEN_P(member);
- info.h = zend_get_hash_value(Z_STRVAL_P(member), Z_STRLEN_P(member) + 1);
- } else if(property_info->name[0] == '\0'){
+ info.name = Z_STR_P(member);
+ } else if(property_info->name->val[0] == '\0'){
const char *class_name = NULL, *prop_name = NULL;
- zend_unmangle_property_name(property_info->name, property_info->name_length, &class_name, &prop_name);
- if(class_name) {
+ zend_unmangle_property_name(property_info->name->val, property_info->name->len, &class_name, &prop_name);
+ if (class_name) {
/* use unmangled name for protected properties */
- info.name = prop_name;
- info.name_length = strlen(prop_name);
- info.h = zend_get_hash_value(info.name, info.name_length+1);
+ info.name = STR_INIT(prop_name, strlen(prop_name), 0);
property_info = &info;
}
}
if (!zobj->guards) {
ALLOC_HASHTABLE(zobj->guards);
zend_hash_init(zobj->guards, 0, NULL, NULL, 0);
- } else if (zend_hash_quick_find(zobj->guards, property_info->name, property_info->name_length+1, property_info->h, (void **) pguard) == SUCCESS) {
- return SUCCESS;
- }
- stub.in_get = 0;
- stub.in_set = 0;
- stub.in_unset = 0;
- stub.in_isset = 0;
- return zend_hash_quick_add(zobj->guards, property_info->name, property_info->name_length+1, property_info->h, (void**)&stub, sizeof(stub), (void**) pguard);
+ } else if ((guard = zend_hash_find(zobj->guards, property_info->name)) != NULL) {
+ return &Z_LVAL_P(guard);
+ }
+
+ ZVAL_LONG(&stub, 0);
+ guard = zend_hash_add(zobj->guards, property_info->name, &stub);
+ return &Z_LVAL_P(guard);
}
/* }}} */
zval *zend_std_read_property(zval *object, zval *member, int type, const zend_literal *key TSRMLS_DC) /* {{{ */
{
zend_object *zobj;
- zval *tmp_member = NULL;
- zval **retval;
- zval *rv = NULL;
+ zval tmp_member;
+ zval *retval;
+ zval rv;
zend_property_info *property_info;
int silent;
silent = (type == BP_VAR_IS);
zobj = Z_OBJ_P(object);
+ ZVAL_UNDEF(&tmp_member);
if (UNEXPECTED(Z_TYPE_P(member) != IS_STRING)) {
- ALLOC_ZVAL(tmp_member);
- *tmp_member = *member;
- INIT_PZVAL(tmp_member);
- zval_copy_ctor(tmp_member);
- convert_to_string(tmp_member);
- member = tmp_member;
+ ZVAL_DUP(&tmp_member, member);
+ convert_to_string(&tmp_member);
+ member = &tmp_member;
key = NULL;
}
@@ -449,38 +441,42 @@ zval *zend_std_read_property(zval *object, zval *member, int type, const zend_li
/* make zend_get_property_info silent if we have getter - we may want to use it */
property_info = zend_get_property_info_quick(zobj->ce, member, silent || (zobj->ce->__get != NULL), key TSRMLS_CC);
- if (UNEXPECTED(!property_info) ||
- ((EXPECTED((property_info->flags & ZEND_ACC_STATIC) == 0) &&
- property_info->offset >= 0) ?
- (zobj->properties ?
- ((retval = (zval**)zobj->properties_table[property_info->offset]) == NULL) :
- (*(retval = &zobj->properties_table[property_info->offset]) == NULL)) :
- (UNEXPECTED(!zobj->properties) ||
- UNEXPECTED(zend_hash_quick_find(zobj->properties, property_info->name, property_info->name_length+1, property_info->h, (void **) &retval) == FAILURE)))) {
- zend_guard *guard = NULL;
-
- if (zobj->ce->__get &&
- zend_get_property_guard(zobj, property_info, member, &guard) == SUCCESS &&
- !guard->in_get) {
+ if (EXPECTED(property_info != NULL)) {
+ if (EXPECTED((property_info->flags & ZEND_ACC_STATIC) == 0) &&
+ property_info->offset >= 0 &&
+ Z_TYPE(zobj->properties_table[property_info->offset]) != IS_UNDEF) {
+ retval = &zobj->properties_table[property_info->offset];
+ goto exit;
+ }
+ if (UNEXPECTED(!zobj->properties)) {
+ retval = zend_hash_find(zobj->properties, property_info->name);
+ if (retval) goto exit;
+ }
+ }
+
+ if (zobj->ce->__get) {
+ long *guard = zend_get_property_guard(zobj, property_info, member);
+ if (!((*guard) & IN_GET)) {
/* have getter - try with it! */
Z_ADDREF_P(object);
- if (PZVAL_IS_REF(object)) {
- SEPARATE_ZVAL(&object);
+ if (Z_ISREF_P(object)) {
+ SEPARATE_ZVAL(object);
}
- guard->in_get = 1; /* prevent circular getting */
- rv = zend_std_call_getter(object, member TSRMLS_CC);
- guard->in_get = 0;
+ *guard |= IN_GET; /* prevent circular getting */
+ zend_std_call_getter(object, member, &rv TSRMLS_CC);
+ *guard &= ~IN_GET;
+//???
+#if 0
if (rv) {
- retval = &rv;
+ retval = rv;
if (!Z_ISREF_P(rv) &&
(type == BP_VAR_W || type == BP_VAR_RW || type == BP_VAR_UNSET)) {
if (Z_REFCOUNT_P(rv) > 0) {
zval *tmp = rv;
ALLOC_ZVAL(rv);
- *rv = *tmp;
- zval_copy_ctor(rv);
+ ZVAL_DUP(rv, tmp);
Z_UNSET_ISREF_P(rv);
Z_SET_REFCOUNT_P(rv, 0);
}
@@ -496,126 +492,108 @@ zval *zend_std_read_property(zval *object, zval *member, int type, const zend_li
} else {
Z_DELREF_P(object);
}
+#endif
} else {
- if (zobj->ce->__get && guard && guard->in_get == 1) {
- if (Z_STRVAL_P(member)[0] == '\0') {
- if (Z_STRLEN_P(member) == 0) {
- zend_error(E_ERROR, "Cannot access empty property");
- } else {
- zend_error(E_ERROR, "Cannot access property started with '\\0'");
- }
+ if (Z_STRVAL_P(member)[0] == '\0') {
+ if (Z_STRLEN_P(member) == 0) {
+ zend_error(E_ERROR, "Cannot access empty property");
+ } else {
+ zend_error(E_ERROR, "Cannot access property started with '\\0'");
}
}
- if (!silent) {
- zend_error(E_NOTICE,"Undefined property: %s::$%s", zobj->ce->name, Z_STRVAL_P(member));
- }
- retval = &EG(uninitialized_zval_ptr);
}
+ } else {
+ if (!silent) {
+ zend_error(E_NOTICE,"Undefined property: %s::$%s", zobj->ce->name->val, Z_STRVAL_P(member));
+ }
+ retval = &EG(uninitialized_zval);
}
- if (UNEXPECTED(tmp_member != NULL)) {
- Z_ADDREF_PP(retval);
+exit:
+ if (UNEXPECTED(Z_TYPE(tmp_member) != IS_UNDEF)) {
+ Z_ADDREF_P(retval);
zval_ptr_dtor(&tmp_member);
- Z_DELREF_PP(retval);
+ Z_DELREF_P(retval);
}
- return *retval;
+ return retval;
}
/* }}} */
ZEND_API void zend_std_write_property(zval *object, zval *member, zval *value, const zend_literal *key TSRMLS_DC) /* {{{ */
{
zend_object *zobj;
- zval *tmp_member = NULL;
- zval **variable_ptr;
+ zval tmp_member;
+ zval *variable_ptr;
zend_property_info *property_info;
zobj = Z_OBJ_P(object);
+ ZVAL_UNDEF(&tmp_member);
if (UNEXPECTED(Z_TYPE_P(member) != IS_STRING)) {
- ALLOC_ZVAL(tmp_member);
- *tmp_member = *member;
- INIT_PZVAL(tmp_member);
- zval_copy_ctor(tmp_member);
- convert_to_string(tmp_member);
- member = tmp_member;
+ ZVAL_DUP(&tmp_member, member);
+ convert_to_string(&tmp_member);
+ member = &tmp_member;
key = NULL;
}
property_info = zend_get_property_info_quick(zobj->ce, member, (zobj->ce->__set != NULL), key TSRMLS_CC);
- if (EXPECTED(property_info != NULL) &&
- ((EXPECTED((property_info->flags & ZEND_ACC_STATIC) == 0) &&
- property_info->offset >= 0) ?
- (zobj->properties ?
- ((variable_ptr = (zval**)zobj->properties_table[property_info->offset]) != NULL) :
- (*(variable_ptr = &zobj->properties_table[property_info->offset]) != NULL)) :
- (EXPECTED(zobj->properties != NULL) &&
- EXPECTED(zend_hash_quick_find(zobj->properties, property_info->name, property_info->name_length+1, property_info->h, (void **) &variable_ptr) == SUCCESS)))) {
- /* if we already have this value there, we don't actually need to do anything */
- if (EXPECTED(*variable_ptr != value)) {
- /* if we are assigning reference, we shouldn't move it, but instead assign variable
- to the same pointer */
- if (PZVAL_IS_REF(*variable_ptr)) {
- zval garbage = **variable_ptr; /* old value should be destroyed */
-
- /* To check: can't *variable_ptr be some system variable like error_zval here? */
- Z_TYPE_PP(variable_ptr) = Z_TYPE_P(value);
- (*variable_ptr)->value = value->value;
- if (Z_REFCOUNT_P(value) > 0) {
- zval_copy_ctor(*variable_ptr);
+ if (EXPECTED(property_info != NULL)) {
+ if (EXPECTED((property_info->flags & ZEND_ACC_STATIC) == 0) &&
+ property_info->offset >= 0 &&
+ Z_TYPE(zobj->properties_table[property_info->offset]) != IS_UNDEF) {
+ variable_ptr = &zobj->properties_table[property_info->offset];
+ goto found;
+ }
+ if (UNEXPECTED(!zobj->properties)) {
+ variable_ptr = zend_hash_find(zobj->properties, property_info->name);
+found:
+ /* if we already have this value there, we don't actually need to do anything */
+ if (EXPECTED(variable_ptr != value)) {
+ /* if we are assigning reference, we shouldn't move it, but instead assign variable
+ to the same pointer */
+ if (Z_ISREF_P(variable_ptr)) {
+ zval garbage;
+
+ ZVAL_COPY_VALUE(&garbage, Z_REFVAL_P(variable_ptr)); /* old value should be destroyed */
+
+ /* To check: can't *variable_ptr be some system variable like error_zval here? */
+ ZVAL_COPY_VALUE(Z_REFVAL_P(variable_ptr), value);
+ if (Z_REFCOUNT_P(value) > 0) {
+ zval_copy_ctor(Z_REFVAL_P(variable_ptr));
+ }
+ zval_dtor(&garbage);
} else {
- efree(value);
- }
- zval_dtor(&garbage);
- } else {
- zval *garbage = *variable_ptr;
+ zval garbage;
- /* if we assign referenced variable, we should separate it */
- Z_ADDREF_P(value);
- if (PZVAL_IS_REF(value)) {
- SEPARATE_ZVAL(&value);
+ ZVAL_COPY_VALUE(&garbage, Z_REFVAL_P(variable_ptr));
+
+ /* if we assign referenced variable, we should separate it */
+ Z_ADDREF_P(value);
+ if (Z_ISREF_P(value)) {
+ SEPARATE_ZVAL(value);
+ }
+ ZVAL_COPY_VALUE(variable_ptr, value);
+ zval_ptr_dtor(&garbage);
}
- *variable_ptr = value;
- zval_ptr_dtor(&garbage);
}
}
- } else {
- zend_guard *guard = NULL;
+ }
+
+ if (zobj->ce->__set) {
+ long *guard = zend_get_property_guard(zobj, property_info, member);
- if (zobj->ce->__set &&
- zend_get_property_guard(zobj, property_info, member, &guard) == SUCCESS &&
- !guard->in_set) {
+ if (!((*guard) & IN_SET)) {
Z_ADDREF_P(object);
- if (PZVAL_IS_REF(object)) {
- SEPARATE_ZVAL(&object);
+ if (Z_ISREF_P(object)) {
+ SEPARATE_ZVAL(object);
}
- guard->in_set = 1; /* prevent circular setting */
+ (*guard) |= IN_SET; /* prevent circular setting */
if (zend_std_call_setter(object, member, value TSRMLS_CC) != SUCCESS) {
/* for now, just ignore it - __set should take care of warnings, etc. */
}
- guard->in_set = 0;
- zval_ptr_dtor(&object);
- } else if (EXPECTED(property_info != NULL)) {
- /* if we assign referenced variable, we should separate it */
- Z_ADDREF_P(value);
- if (PZVAL_IS_REF(value)) {
- SEPARATE_ZVAL(&value);
- }
- if (EXPECTED((property_info->flags & ZEND_ACC_STATIC) == 0) &&
- property_info->offset >= 0) {
- if (!zobj->properties) {
- zobj->properties_table[property_info->offset] = value;
- } else if (zobj->properties_table[property_info->offset]) {
- *(zval**)zobj->properties_table[property_info->offset] = value;
- } else {
- zend_hash_quick_update(zobj->properties, property_info->name, property_info->name_length+1, property_info->h, &value, sizeof(zval *), (void**)&zobj->properties_table[property_info->offset]);
- }
- } else {
- if (!zobj->properties) {
- rebuild_object_properties(zobj);
- }
- zend_hash_quick_update(zobj->properties, property_info->name, property_info->name_length+1, property_info->h, &value, sizeof(zval *), NULL);
- }
- } else if (zobj->ce->__set && guard && guard->in_set == 1) {
+ (*guard) &= ~IN_SET;
+ zval_ptr_dtor(object);
+ } else {
if (Z_STRVAL_P(member)[0] == '\0') {
if (Z_STRLEN_P(member) == 0) {
zend_error(E_ERROR, "Cannot access empty property");
@@ -624,9 +602,31 @@ ZEND_API void zend_std_write_property(zval *object, zval *member, zval *value, c
}
}
}
+ } else if (EXPECTED(property_info != NULL)) {
+ /* if we assign referenced variable, we should separate it */
+ Z_ADDREF_P(value);
+ if (Z_ISREF_P(value)) {
+ SEPARATE_ZVAL(value);
+ }
+ if (EXPECTED((property_info->flags & ZEND_ACC_STATIC) == 0) &&
+ property_info->offset >= 0) {
+
+ ZVAL_COPY_VALUE(&zobj->properties_table[property_info->offset], value);
+ if (zobj->properties) {
+ zval tmp;
+
+ ZVAL_INDIRECT(&tmp, &zobj->properties_table[property_info->offset]);
+ zend_hash_update(zobj->properties, property_info->name, &tmp);
+ }
+ } else {
+ if (!zobj->properties) {
+ rebuild_object_properties(zobj);
+ }
+ zend_hash_update(zobj->properties, property_info->name, value);
+ }
}
- if (UNEXPECTED(tmp_member != NULL)) {
+ if (UNEXPECTED(Z_TYPE(tmp_member) != IS_UNDEF)) {
zval_ptr_dtor(&tmp_member);
}
}
@@ -635,33 +635,36 @@ ZEND_API void zend_std_write_property(zval *object, zval *member, zval *value, c
zval *zend_std_read_dimension(zval *object, zval *offset, int type TSRMLS_DC) /* {{{ */
{
zend_class_entry *ce = Z_OBJCE_P(object);
- zval *retval;
+ zval retval, tmp;
if (EXPECTED(instanceof_function_ex(ce, zend_ce_arrayaccess, 1 TSRMLS_CC) != 0)) {
if(offset == NULL) {
/* [] construct */
- ALLOC_INIT_ZVAL(offset);
+ ZVAL_UNDEF(&tmp);
+ offset = &tmp;
} else {
SEPARATE_ARG_IF_REF(offset);
}
- zend_call_method_with_1_params(&object, ce, NULL, "offsetget", &retval, offset);
+ zend_call_method_with_1_params(object, ce, NULL, "offsetget", &retval, offset);
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
- if (UNEXPECTED(!retval)) {
+ if (UNEXPECTED(Z_TYPE(retval) == IS_UNDEF)) {
if (UNEXPECTED(!EG(exception))) {
- zend_error_noreturn(E_ERROR, "Undefined offset for object of type %s used as array", ce->name);
+ zend_error_noreturn(E_ERROR, "Undefined offset for object of type %s used as array", ce->name->val);
}
- return 0;
+ return NULL;
}
/* Undo PZVAL_LOCK() */
- Z_DELREF_P(retval);
+ Z_DELREF(retval);
- return retval;
+ // TODO: FIXME???
+ //???return &retval;
+ return NULL;
} else {
- zend_error_noreturn(E_ERROR, "Cannot use object of type %s as array", ce->name);
- return 0;
+ zend_error_noreturn(E_ERROR, "Cannot use object of type %s as array", ce->name->val);
+ return NULL;
}
}
/* }}} */
@@ -669,17 +672,19 @@ zval *zend_std_read_dimension(zval *object, zval *offset, int type TSRMLS_DC) /*
static void zend_std_write_dimension(zval *object, zval *offset, zval *value TSRMLS_DC) /* {{{ */
{
zend_class_entry *ce = Z_OBJCE_P(object);
+ zval tmp;
if (EXPECTED(instanceof_function_ex(ce, zend_ce_arrayaccess, 1 TSRMLS_CC) != 0)) {
if (!offset) {
- ALLOC_INIT_ZVAL(offset);
+ ZVAL_UNDEF(&tmp);
+ offset = &tmp;
} else {
SEPARATE_ARG_IF_REF(offset);
}
- zend_call_method_with_2_params(&object, ce, NULL, "offsetset", NULL, offset, value);
- zval_ptr_dtor(&offset);
+ zend_call_method_with_2_params(object, ce, NULL, "offsetset", NULL, offset, value);
+ zval_ptr_dtor(offset);
} else {
- zend_error_noreturn(E_ERROR, "Cannot use object of type %s as array", ce->name);
+ zend_error_noreturn(E_ERROR, "Cannot use object of type %s as array", ce->name->val);
}
}
/* }}} */
@@ -687,46 +692,47 @@ static void zend_std_write_dimension(zval *object, zval *offset, zval *value TSR
static int zend_std_has_dimension(zval *object, zval *offset, int check_empty TSRMLS_DC) /* {{{ */
{
zend_class_entry *ce = Z_OBJCE_P(object);
- zval *retval;
+ zval retval;
int result;
if (EXPECTED(instanceof_function_ex(ce, zend_ce_arrayaccess, 1 TSRMLS_CC) != 0)) {
SEPARATE_ARG_IF_REF(offset);
- zend_call_method_with_1_params(&object, ce, NULL, "offsetexists", &retval, offset);
- if (EXPECTED(retval != NULL)) {
- result = i_zend_is_true(retval TSRMLS_CC);
+ zend_call_method_with_1_params(object, ce, NULL, "offsetexists", &retval, offset);
+ if (EXPECTED(Z_TYPE(retval) != IS_UNDEF)) {
+ result = i_zend_is_true(&retval TSRMLS_CC);
zval_ptr_dtor(&retval);
if (check_empty && result && EXPECTED(!EG(exception))) {
- zend_call_method_with_1_params(&object, ce, NULL, "offsetget", &retval, offset);
- if (retval) {
- result = i_zend_is_true(retval TSRMLS_CC);
+ zend_call_method_with_1_params(object, ce, NULL, "offsetget", &retval, offset);
+ if (EXPECTED(Z_TYPE(retval) != IS_UNDEF)) {
+ result = i_zend_is_true(&retval TSRMLS_CC);
zval_ptr_dtor(&retval);
}
}
} else {
result = 0;
}
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
- zend_error_noreturn(E_ERROR, "Cannot use object of type %s as array", ce->name);
+ zend_error_noreturn(E_ERROR, "Cannot use object of type %s as array", ce->name->val);
return 0;
}
return result;
}
/* }}} */
-static zval **zend_std_get_property_ptr_ptr(zval *object, zval *member, int type, const zend_literal *key TSRMLS_DC) /* {{{ */
+static zval *zend_std_get_property_ptr_ptr(zval *object, zval *member, int type, const zend_literal *key TSRMLS_DC) /* {{{ */
{
zend_object *zobj;
zval tmp_member;
- zval **retval;
+ zval *retval;
zend_property_info *property_info;
+ long *guard;
zobj = Z_OBJ_P(object);
+ ZVAL_UNDEF(&tmp_member);
if (UNEXPECTED(Z_TYPE_P(member) != IS_STRING)) {
- tmp_member = *member;
- zval_copy_ctor(&tmp_member);
+ ZVAL_DUP(&tmp_member, member);
convert_to_string(&tmp_member);
member = &tmp_member;
key = NULL;
@@ -738,52 +744,50 @@ static zval **zend_std_get_property_ptr_ptr(zval *object, zval *member, int type
property_info = zend_get_property_info_quick(zobj->ce, member, (zobj->ce->__get != NULL), key TSRMLS_CC);
- if (UNEXPECTED(!property_info) ||
- ((EXPECTED((property_info->flags & ZEND_ACC_STATIC) == 0) &&
- property_info->offset >= 0) ?
- (zobj->properties ?
- ((retval = (zval**)zobj->properties_table[property_info->offset]) == NULL) :
- (*(retval = &zobj->properties_table[property_info->offset]) == NULL)) :
- (UNEXPECTED(!zobj->properties) ||
- UNEXPECTED(zend_hash_quick_find(zobj->properties, property_info->name, property_info->name_length+1, property_info->h, (void **) &retval) == FAILURE)))) {
- zval *new_zval;
- zend_guard *guard;
-
- if (!zobj->ce->__get ||
- zend_get_property_guard(zobj, property_info, member, &guard) != SUCCESS ||
- (property_info && guard->in_get)) {
- /* we don't have access controls - will just add it */
- new_zval = &EG(uninitialized_zval);
-
- if(UNEXPECTED(type == BP_VAR_RW || type == BP_VAR_R)) {
- zend_error(E_NOTICE, "Undefined property: %s::$%s", zobj->ce->name, Z_STRVAL_P(member));
- }
- Z_ADDREF_P(new_zval);
- if (EXPECTED((property_info->flags & ZEND_ACC_STATIC) == 0) &&
- property_info->offset >= 0) {
- if (!zobj->properties) {
- zobj->properties_table[property_info->offset] = new_zval;
- retval = &zobj->properties_table[property_info->offset];
- } else if (zobj->properties_table[property_info->offset]) {
- *(zval**)zobj->properties_table[property_info->offset] = new_zval;
- retval = (zval**)zobj->properties_table[property_info->offset];
- } else {
- zend_hash_quick_update(zobj->properties, property_info->name, property_info->name_length+1, property_info->h, &new_zval, sizeof(zval *), (void**)&zobj->properties_table[property_info->offset]);
- retval = (zval**)zobj->properties_table[property_info->offset];
- }
- } else {
- if (!zobj->properties) {
- rebuild_object_properties(zobj);
- }
- zend_hash_quick_update(zobj->properties, property_info->name, property_info->name_length+1, property_info->h, &new_zval, sizeof(zval *), (void **) &retval);
+ if (EXPECTED(property_info != NULL)) {
+ if (EXPECTED((property_info->flags & ZEND_ACC_STATIC) == 0) &&
+ property_info->offset >= 0 &&
+ Z_TYPE(zobj->properties_table[property_info->offset]) != IS_UNDEF) {
+ retval = &zobj->properties_table[property_info->offset];
+ goto exit;
+ }
+ if (UNEXPECTED(!zobj->properties)) {
+ retval = zend_hash_find(zobj->properties, property_info->name);
+ if (retval) goto exit;
+ }
+ }
+
+ if (!zobj->ce->__get ||
+ (guard = zend_get_property_guard(zobj, property_info, member)) ||
+ (property_info && ((*guard) & IN_GET))) {
+
+ /* we don't have access controls - will just add it */
+ if(UNEXPECTED(type == BP_VAR_RW || type == BP_VAR_R)) {
+ zend_error(E_NOTICE, "Undefined property: %s::$%s", zobj->ce->name->val, Z_STRVAL_P(member));
+ }
+ if (EXPECTED((property_info->flags & ZEND_ACC_STATIC) == 0) &&
+ property_info->offset >= 0) {
+ retval = &zobj->properties_table[property_info->offset];
+ ZVAL_NULL(retval);
+ if (zobj->properties) {
+ zval tmp;
+ ZVAL_INDIRECT(&tmp, retval);
+ zend_hash_update(zobj->properties, property_info->name, &tmp);
}
} else {
- /* we do have getter - fail and let it try again with usual get/set */
- retval = NULL;
+ if (!zobj->properties) {
+ rebuild_object_properties(zobj);
+ }
+ zend_hash_update(zobj->properties, property_info->name, retval);
}
+ } else {
+ /* we do have getter - fail and let it try again with usual get/set */
+ retval = NULL;
}
- if (UNEXPECTED(member == &tmp_member)) {
- zval_dtor(member);
+
+exit:
+ if (UNEXPECTED(Z_TYPE(tmp_member) != IS_UNDEF)) {
+ zval_dtor(&tmp_member);
}
return retval;
}
@@ -792,18 +796,16 @@ static zval **zend_std_get_property_ptr_ptr(zval *object, zval *member, int type
static void zend_std_unset_property(zval *object, zval *member, const zend_literal *key TSRMLS_DC) /* {{{ */
{
zend_object *zobj;
- zval *tmp_member = NULL;
+ zval tmp_member;
zend_property_info *property_info;
zobj = Z_OBJ_P(object);
+ ZVAL_UNDEF(&tmp_member);
if (UNEXPECTED(Z_TYPE_P(member) != IS_STRING)) {
- ALLOC_ZVAL(tmp_member);
- *tmp_member = *member;
- INIT_PZVAL(tmp_member);
- zval_copy_ctor(tmp_member);
- convert_to_string(tmp_member);
- member = tmp_member;
+ ZVAL_DUP(&tmp_member, member);
+ convert_to_string(&tmp_member);
+ member = &tmp_member;
key = NULL;
}
@@ -811,44 +813,41 @@ static void zend_std_unset_property(zval *object, zval *member, const zend_liter
if (EXPECTED(property_info != NULL) &&
EXPECTED((property_info->flags & ZEND_ACC_STATIC) == 0) &&
- !zobj->properties &&
- property_info->offset >= 0 &&
- EXPECTED(zobj->properties_table[property_info->offset] != NULL)) {
+ property_info->offset >= 0) {
zval_ptr_dtor(&zobj->properties_table[property_info->offset]);
- zobj->properties_table[property_info->offset] = NULL;
- } else if (UNEXPECTED(!property_info) ||
- !zobj->properties ||
- UNEXPECTED(zend_hash_quick_del(zobj->properties, property_info->name, property_info->name_length+1, property_info->h) == FAILURE)) {
- zend_guard *guard = NULL;
-
- if (zobj->ce->__unset &&
- zend_get_property_guard(zobj, property_info, member, &guard) == SUCCESS &&
- !guard->in_unset) {
- /* have unseter - try with it! */
- Z_ADDREF_P(object);
- if (PZVAL_IS_REF(object)) {
- SEPARATE_ZVAL(&object);
- }
- guard->in_unset = 1; /* prevent circular unsetting */
- zend_std_call_unsetter(object, member TSRMLS_CC);
- guard->in_unset = 0;
- zval_ptr_dtor(&object);
- } else if (zobj->ce->__unset && guard && guard->in_unset == 1) {
- if (Z_STRVAL_P(member)[0] == '\0') {
- if (Z_STRLEN_P(member) == 0) {
- zend_error(E_ERROR, "Cannot access empty property");
- } else {
- zend_error(E_ERROR, "Cannot access property started with '\\0'");
+ ZVAL_UNDEF(&zobj->properties_table[property_info->offset]);
+ if (!zobj->properties) goto exit;
+ }
+ if (UNEXPECTED(!property_info) ||
+ !zobj->properties ||
+ UNEXPECTED(zend_hash_del(zobj->properties, property_info->name) == FAILURE)) {
+
+ if (zobj->ce->__unset) {
+ long *guard = zend_get_property_guard(zobj, property_info, member);
+ if (!((*guard) & IN_UNSET)) {
+ /* have unseter - try with it! */
+ Z_ADDREF_P(object);
+ if (Z_ISREF_P(object)) {
+ SEPARATE_ZVAL(object);
+ }
+ (*guard) |= IN_UNSET; /* prevent circular unsetting */
+ zend_std_call_unsetter(object, member TSRMLS_CC);
+ (*guard) &= ~IN_UNSET;
+ zval_ptr_dtor(object);
+ } else {
+ if (Z_STRVAL_P(member)[0] == '\0') {
+ if (Z_STRLEN_P(member) == 0) {
+ zend_error(E_ERROR, "Cannot access empty property");
+ } else {
+ zend_error(E_ERROR, "Cannot access property started with '\\0'");
+ }
}
}
}
- } else if (EXPECTED(property_info != NULL) &&
- EXPECTED((property_info->flags & ZEND_ACC_STATIC) == 0) &&
- property_info->offset >= 0) {
- zobj->properties_table[property_info->offset] = NULL;
}
- if (UNEXPECTED(tmp_member != NULL)) {
+exit:
+ if (UNEXPECTED(Z_TYPE(tmp_member) != IS_NULL)) {
zval_ptr_dtor(&tmp_member);
}
}
@@ -860,10 +859,10 @@ static void zend_std_unset_dimension(zval *object, zval *offset TSRMLS_DC) /* {{
if (instanceof_function_ex(ce, zend_ce_arrayaccess, 1 TSRMLS_CC)) {
SEPARATE_ARG_IF_REF(offset);
- zend_call_method_with_1_params(&object, ce, NULL, "offsetunset", NULL, offset);
- zval_ptr_dtor(&offset);
+ zend_call_method_with_1_params(object, ce, NULL, "offsetunset", NULL, offset);
+ zval_ptr_dtor(offset);
} else {
- zend_error_noreturn(E_ERROR, "Cannot use object of type %s as array", ce->name);
+ zend_error_noreturn(E_ERROR, "Cannot use object of type %s as array", ce->name->val);
}
}
/* }}} */
@@ -871,39 +870,36 @@ static void zend_std_unset_dimension(zval *object, zval *offset TSRMLS_DC) /* {{
ZEND_API void zend_std_call_user_call(INTERNAL_FUNCTION_PARAMETERS) /* {{{ */
{
zend_internal_function *func = (zend_internal_function *)EG(current_execute_data)->function_state.function;
- zval *method_name_ptr, *method_args_ptr;
- zval *method_result_ptr = NULL;
+ zval method_name, method_args;
+ zval method_result;
zend_class_entry *ce = Z_OBJCE_P(this_ptr);
- ALLOC_ZVAL(method_args_ptr);
- INIT_PZVAL(method_args_ptr);
- array_init_size(method_args_ptr, ZEND_NUM_ARGS());
+ array_init_size(&method_args, ZEND_NUM_ARGS());
- if (UNEXPECTED(zend_copy_parameters_array(ZEND_NUM_ARGS(), method_args_ptr TSRMLS_CC) == FAILURE)) {
- zval_dtor(method_args_ptr);
+ if (UNEXPECTED(zend_copy_parameters_array(ZEND_NUM_ARGS(), &method_args TSRMLS_CC) == FAILURE)) {
+ zval_dtor(&method_args);
zend_error_noreturn(E_ERROR, "Cannot get arguments for __call");
RETURN_FALSE;
}
- ALLOC_ZVAL(method_name_ptr);
- INIT_PZVAL(method_name_ptr);
- ZVAL_STRING(method_name_ptr, func->function_name, 0); /* no dup - it's a copy */
+ ZVAL_STR(&method_name, func->function_name); /* no dup - it's a copy */
/* __call handler is called with two arguments:
method name
array of method parameters
*/
- zend_call_method_with_2_params(&this_ptr, ce, &ce->__call, ZEND_CALL_FUNC_NAME, &method_result_ptr, method_name_ptr, method_args_ptr);
+ ZVAL_UNDEF(&method_result);
+ zend_call_method_with_2_params(this_ptr, ce, &ce->__call, ZEND_CALL_FUNC_NAME, &method_result, &method_name, &method_args);
- if (method_result_ptr) {
- RETVAL_ZVAL_FAST(method_result_ptr);
- zval_ptr_dtor(&method_result_ptr);
+ if (Z_TYPE(method_result) != IS_UNDEF) {
+ RETVAL_ZVAL_FAST(&method_result);
+ zval_ptr_dtor(&method_result);
}
/* now destruct all auxiliaries */
- zval_ptr_dtor(&method_args_ptr);
- zval_ptr_dtor(&method_name_ptr);
+ zval_ptr_dtor(&method_args);
+ zval_ptr_dtor(&method_name);
/* destruct the function also, then - we have allocated it in get_method */
efree(func);
@@ -914,8 +910,10 @@ ZEND_API void zend_std_call_user_call(INTERNAL_FUNCTION_PARAMETERS) /* {{{ */
* Returns the function address that should be called, or NULL
* if no such function exists.
*/
-static inline zend_function *zend_check_private_int(zend_function *fbc, zend_class_entry *ce, char *function_name_strval, int function_name_strlen, ulong hash_value TSRMLS_DC) /* {{{ */
+static inline zend_function *zend_check_private_int(zend_function *fbc, zend_class_entry *ce, zend_string *function_name TSRMLS_DC) /* {{{ */
{
+ zval *func;
+
if (!ce) {
return 0;
}
@@ -936,10 +934,12 @@ static inline zend_function *zend_check_private_int(zend_function *fbc, zend_cla
ce = ce->parent;
while (ce) {
if (ce == EG(scope)) {
- if (zend_hash_quick_find(&ce->function_table, function_name_strval, function_name_strlen+1, hash_value, (void **) &fbc)==SUCCESS
- && fbc->op_array.fn_flags & ZEND_ACC_PRIVATE
- && fbc->common.scope == EG(scope)) {
- return fbc;
+ if ((func = zend_hash_find(&ce->function_table, function_name))) {
+ fbc = Z_FUNC_P(func);
+ if (fbc->common.fn_flags & ZEND_ACC_PRIVATE
+ && fbc->common.scope == EG(scope)) {
+ return fbc;
+ }
}
break;
}
@@ -949,9 +949,9 @@ static inline zend_function *zend_check_private_int(zend_function *fbc, zend_cla
}
/* }}} */
-ZEND_API int zend_check_private(zend_function *fbc, zend_class_entry *ce, char *function_name_strval, int function_name_strlen TSRMLS_DC) /* {{{ */
+ZEND_API int zend_check_private(zend_function *fbc, zend_class_entry *ce, zend_string *function_name TSRMLS_DC) /* {{{ */
{
- return zend_check_private_int(fbc, ce, function_name_strval, function_name_strlen, zend_hash_func(function_name_strval, function_name_strlen+1) TSRMLS_CC) != NULL;
+ return zend_check_private_int(fbc, ce, function_name TSRMLS_CC) != NULL;
}
/* }}} */
@@ -984,7 +984,7 @@ ZEND_API int zend_check_protected(zend_class_entry *ce, zend_class_entry *scope)
}
/* }}} */
-static inline union _zend_function *zend_get_user_call_function(zend_class_entry *ce, const char *method_name, int method_len) /* {{{ */
+static inline union _zend_function *zend_get_user_call_function(zend_class_entry *ce, zend_string *method_name) /* {{{ */
{
zend_internal_function *call_user_call = emalloc(sizeof(zend_internal_function));
call_user_call->type = ZEND_INTERNAL_FUNCTION;
@@ -994,42 +994,40 @@ static inline union _zend_function *zend_get_user_call_function(zend_class_entry
call_user_call->num_args = 0;
call_user_call->scope = ce;
call_user_call->fn_flags = ZEND_ACC_CALL_VIA_HANDLER;
- call_user_call->function_name = estrndup(method_name, method_len);
+ call_user_call->function_name = STR_COPY(method_name);
return (union _zend_function *)call_user_call;
}
/* }}} */
-static union _zend_function *zend_std_get_method(zval **object_ptr, char *method_name, int method_len, const zend_literal *key TSRMLS_DC) /* {{{ */
+static union _zend_function *zend_std_get_method(zval *object, zend_string *method_name, const zend_literal *key TSRMLS_DC) /* {{{ */
{
+ zval *func;
zend_function *fbc;
- zval *object = *object_ptr;
zend_object *zobj = Z_OBJ_P(object);
- ulong hash_value;
- char *lc_method_name;
- ALLOCA_FLAG(use_heap)
+ zend_string *lc_method_name;
if (EXPECTED(key != NULL)) {
- lc_method_name = Z_STRVAL(key->constant);
- hash_value = key->hash_value;
+ lc_method_name = Z_STR(key->constant);
} else {
- lc_method_name = do_alloca(method_len+1, use_heap);
/* Create a zend_copy_str_tolower(dest, src, src_length); */
- zend_str_tolower_copy(lc_method_name, method_name, method_len);
- hash_value = zend_hash_func(lc_method_name, method_len+1);
+//??? lc_method_name = do_alloca(method_len+1, use_heap);
+ lc_method_name = STR_ALLOC(method_name->len, 0);
+ zend_str_tolower_copy(lc_method_name->val, method_name->val, method_name->len);
}
- if (UNEXPECTED(zend_hash_quick_find(&zobj->ce->function_table, lc_method_name, method_len+1, hash_value, (void **)&fbc) == FAILURE)) {
+ if (UNEXPECTED((func = zend_hash_find(&zobj->ce->function_table, lc_method_name)) == NULL)) {
if (UNEXPECTED(!key)) {
- free_alloca(lc_method_name, use_heap);
+ STR_FREE(lc_method_name);
}
if (zobj->ce->__call) {
- return zend_get_user_call_function(zobj->ce, method_name, method_len);
+ return zend_get_user_call_function(zobj->ce, method_name);
} else {
return NULL;
}
}
+ fbc = Z_FUNC_P(func);
/* Check access level */
if (fbc->op_array.fn_flags & ZEND_ACC_PRIVATE) {
zend_function *updated_fbc;
@@ -1037,14 +1035,14 @@ static union _zend_function *zend_std_get_method(zval **object_ptr, char *method
/* Ensure that if we're calling a private function, we're allowed to do so.
* If we're not and __call() handler exists, invoke it, otherwise error out.
*/
- updated_fbc = zend_check_private_int(fbc, Z_OBJ_HANDLER_P(object, get_class_entry)(object TSRMLS_CC), lc_method_name, method_len, hash_value TSRMLS_CC);
+ updated_fbc = zend_check_private_int(fbc, Z_OBJ_HANDLER_P(object, get_class_entry)(object TSRMLS_CC), lc_method_name TSRMLS_CC);
if (EXPECTED(updated_fbc != NULL)) {
fbc = updated_fbc;
} else {
if (zobj->ce->__call) {
- fbc = zend_get_user_call_function(zobj->ce, method_name, method_len);
+ fbc = zend_get_user_call_function(zobj->ce, method_name);
} else {
- zend_error_noreturn(E_ERROR, "Call to %s method %s::%s() from context '%s'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), method_name, EG(scope) ? EG(scope)->name : "");
+ zend_error_noreturn(E_ERROR, "Call to %s method %s::%s() from context '%s'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), method_name->val, EG(scope) ? EG(scope)->name->val : "");
}
}
} else {
@@ -1054,12 +1052,12 @@ static union _zend_function *zend_std_get_method(zval **object_ptr, char *method
if (EG(scope) &&
is_derived_class(fbc->common.scope, EG(scope)) &&
fbc->op_array.fn_flags & ZEND_ACC_CHANGED) {
- zend_function *priv_fbc;
-
- if (zend_hash_quick_find(&EG(scope)->function_table, lc_method_name, method_len+1, hash_value, (void **) &priv_fbc)==SUCCESS
- && priv_fbc->common.fn_flags & ZEND_ACC_PRIVATE
- && priv_fbc->common.scope == EG(scope)) {
- fbc = priv_fbc;
+ if ((func = zend_hash_find(&EG(scope)->function_table, lc_method_name)) != SUCCESS) {
+ zend_function *priv_fbc = Z_FUNC_P(func);
+ if (priv_fbc->common.fn_flags & ZEND_ACC_PRIVATE
+ && priv_fbc->common.scope == EG(scope)) {
+ fbc = priv_fbc;
+ }
}
}
if ((fbc->common.fn_flags & ZEND_ACC_PROTECTED)) {
@@ -1068,16 +1066,16 @@ static union _zend_function *zend_std_get_method(zval **object_ptr, char *method
*/
if (UNEXPECTED(!zend_check_protected(zend_get_function_root_class(fbc), EG(scope)))) {
if (zobj->ce->__call) {
- fbc = zend_get_user_call_function(zobj->ce, method_name, method_len);
+ fbc = zend_get_user_call_function(zobj->ce, method_name);
} else {
- zend_error_noreturn(E_ERROR, "Call to %s method %s::%s() from context '%s'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), method_name, EG(scope) ? EG(scope)->name : "");
+ zend_error_noreturn(E_ERROR, "Call to %s method %s::%s() from context '%s'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), method_name->val, EG(scope) ? EG(scope)->name->val : "");
}
}
}
}
if (UNEXPECTED(!key)) {
- free_alloca(lc_method_name, use_heap);
+ STR_FREE(lc_method_name);
}
return fbc;
}
@@ -1086,45 +1084,42 @@ static union _zend_function *zend_std_get_method(zval **object_ptr, char *method
ZEND_API void zend_std_callstatic_user_call(INTERNAL_FUNCTION_PARAMETERS) /* {{{ */
{
zend_internal_function *func = (zend_internal_function *)EG(current_execute_data)->function_state.function;
- zval *method_name_ptr, *method_args_ptr;
- zval *method_result_ptr = NULL;
+ zval method_name, method_args;
+ zval method_result;
zend_class_entry *ce = EG(scope);
- ALLOC_ZVAL(method_args_ptr);
- INIT_PZVAL(method_args_ptr);
- array_init_size(method_args_ptr, ZEND_NUM_ARGS());
+ array_init_size(&method_args, ZEND_NUM_ARGS());
- if (UNEXPECTED(zend_copy_parameters_array(ZEND_NUM_ARGS(), method_args_ptr TSRMLS_CC) == FAILURE)) {
- zval_dtor(method_args_ptr);
+ if (UNEXPECTED(zend_copy_parameters_array(ZEND_NUM_ARGS(), &method_args TSRMLS_CC) == FAILURE)) {
+ zval_dtor(&method_args);
zend_error_noreturn(E_ERROR, "Cannot get arguments for " ZEND_CALLSTATIC_FUNC_NAME);
RETURN_FALSE;
}
- ALLOC_ZVAL(method_name_ptr);
- INIT_PZVAL(method_name_ptr);
- ZVAL_STRING(method_name_ptr, func->function_name, 0); /* no dup - it's a copy */
+ ZVAL_STR(&method_name, func->function_name); /* no dup - it's a copy */
/* __callStatic handler is called with two arguments:
method name
array of method parameters
*/
- zend_call_method_with_2_params(NULL, ce, &ce->__callstatic, ZEND_CALLSTATIC_FUNC_NAME, &method_result_ptr, method_name_ptr, method_args_ptr);
+ ZVAL_UNDEF(&method_result);
+ zend_call_method_with_2_params(NULL, ce, &ce->__callstatic, ZEND_CALLSTATIC_FUNC_NAME, &method_result, &method_name, &method_args);
- if (method_result_ptr) {
- RETVAL_ZVAL_FAST(method_result_ptr);
- zval_ptr_dtor(&method_result_ptr);
+ if (Z_TYPE(method_result) != IS_UNDEF) {
+ RETVAL_ZVAL_FAST(&method_result);
+ zval_ptr_dtor(&method_result);
}
/* now destruct all auxiliaries */
- zval_ptr_dtor(&method_args_ptr);
- zval_ptr_dtor(&method_name_ptr);
+ zval_ptr_dtor(&method_args);
+ zval_ptr_dtor(&method_name);
/* destruct the function also, then - we have allocated it in get_method */
efree(func);
}
/* }}} */
-static inline union _zend_function *zend_get_user_callstatic_function(zend_class_entry *ce, const char *method_name, int method_len) /* {{{ */
+static inline union _zend_function *zend_get_user_callstatic_function(zend_class_entry *ce, zend_string *method_name) /* {{{ */
{
zend_internal_function *callstatic_user_call = emalloc(sizeof(zend_internal_function));
callstatic_user_call->type = ZEND_INTERNAL_FUNCTION;
@@ -1134,7 +1129,7 @@ static inline union _zend_function *zend_get_user_callstatic_function(zend_class
callstatic_user_call->num_args = 0;
callstatic_user_call->scope = ce;
callstatic_user_call->fn_flags = ZEND_ACC_STATIC | ZEND_ACC_PUBLIC | ZEND_ACC_CALL_VIA_HANDLER;
- callstatic_user_call->function_name = estrndup(method_name, method_len);
+ callstatic_user_call->function_name = STR_COPY(method_name);
return (zend_function *)callstatic_user_call;
}
@@ -1142,48 +1137,50 @@ static inline union _zend_function *zend_get_user_callstatic_function(zend_class
/* This is not (yet?) in the API, but it belongs in the built-in objects callbacks */
-ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, const char *function_name_strval, int function_name_strlen, const zend_literal *key TSRMLS_DC) /* {{{ */
+ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, zend_string *function_name, const zend_literal *key TSRMLS_DC) /* {{{ */
{
zend_function *fbc = NULL;
- char *lc_class_name, *lc_function_name = NULL;
- ulong hash_value;
- ALLOCA_FLAG(use_heap)
+ char *lc_class_name;
+ zend_string *lc_function_name;
if (EXPECTED(key != NULL)) {
- lc_function_name = Z_STRVAL(key->constant);
- hash_value = key->hash_value;
+ lc_function_name = Z_STR(key->constant);
} else {
- lc_function_name = do_alloca(function_name_strlen+1, use_heap);
+ //???lc_function_name = do_alloca(function_name_strlen+1, use_heap);
/* Create a zend_copy_str_tolower(dest, src, src_length); */
- zend_str_tolower_copy(lc_function_name, function_name_strval, function_name_strlen);
- hash_value = zend_hash_func(lc_function_name, function_name_strlen+1);
+ lc_function_name = STR_ALLOC(function_name->len, 0);
+ zend_str_tolower_copy(lc_function_name->val, function_name->val, function_name->len);
}
- if (function_name_strlen == ce->name_length && ce->constructor) {
- lc_class_name = zend_str_tolower_dup(ce->name, ce->name_length);
+ if (function_name->len == ce->name->len && ce->constructor) {
+ lc_class_name = zend_str_tolower_dup(ce->name->val, ce->name->len);
/* Only change the method to the constructor if the constructor isn't called __construct
* we check for __ so we can be binary safe for lowering, we should use ZEND_CONSTRUCTOR_FUNC_NAME
*/
- if (!memcmp(lc_class_name, lc_function_name, function_name_strlen) && memcmp(ce->constructor->common.function_name, "__", sizeof("__") - 1)) {
+ if (!memcmp(lc_class_name, lc_function_name->val, function_name->len) && memcmp(ce->constructor->common.function_name->val, "__", sizeof("__") - 1)) {
fbc = ce->constructor;
}
efree(lc_class_name);
}
- if (EXPECTED(!fbc) &&
- UNEXPECTED(zend_hash_quick_find(&ce->function_table, lc_function_name, function_name_strlen+1, hash_value, (void **) &fbc)==FAILURE)) {
- if (UNEXPECTED(!key)) {
- free_alloca(lc_function_name, use_heap);
- }
- if (ce->__call &&
- EG(This) &&
- Z_OBJ_HT_P(EG(This))->get_class_entry &&
- instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) {
- return zend_get_user_call_function(ce, function_name_strval, function_name_strlen);
- } else if (ce->__callstatic) {
- return zend_get_user_callstatic_function(ce, function_name_strval, function_name_strlen);
+ if (EXPECTED(!fbc)) {
+ zval *func = zend_hash_find(&ce->function_table, lc_function_name);
+ if (EXPECTED(func != NULL)) {
+ fbc = Z_FUNC_P(func);
} else {
- return NULL;
+ if (UNEXPECTED(!key)) {
+ STR_FREE(lc_function_name);
+ }
+ if (ce->__call &&
+ Z_TYPE(EG(This)) == IS_OBJECT &&
+ Z_OBJ_HT(EG(This))->get_class_entry &&
+ instanceof_function(Z_OBJCE(EG(This)), ce TSRMLS_CC)) {
+ return zend_get_user_call_function(ce, function_name);
+ } else if (ce->__callstatic) {
+ return zend_get_user_callstatic_function(ce, function_name);
+ } else {
+ return NULL;
+ }
}
}
@@ -1201,14 +1198,14 @@ ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, const c
/* Ensure that if we're calling a private function, we're allowed to do so.
*/
- updated_fbc = zend_check_private_int(fbc, EG(scope), lc_function_name, function_name_strlen, hash_value TSRMLS_CC);
+ updated_fbc = zend_check_private_int(fbc, EG(scope), lc_function_name TSRMLS_CC);
if (EXPECTED(updated_fbc != NULL)) {
fbc = updated_fbc;
} else {
if (ce->__callstatic) {
- fbc = zend_get_user_callstatic_function(ce, function_name_strval, function_name_strlen);
+ fbc = zend_get_user_callstatic_function(ce, function_name);
} else {
- zend_error_noreturn(E_ERROR, "Call to %s method %s::%s() from context '%s'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), function_name_strval, EG(scope) ? EG(scope)->name : "");
+ zend_error_noreturn(E_ERROR, "Call to %s method %s::%s() from context '%s'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), function_name->val, EG(scope) ? EG(scope)->name->val : "");
}
}
} else if ((fbc->common.fn_flags & ZEND_ACC_PROTECTED)) {
@@ -1216,45 +1213,35 @@ ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, const c
*/
if (UNEXPECTED(!zend_check_protected(zend_get_function_root_class(fbc), EG(scope)))) {
if (ce->__callstatic) {
- fbc = zend_get_user_callstatic_function(ce, function_name_strval, function_name_strlen);
+ fbc = zend_get_user_callstatic_function(ce, function_name);
} else {
- zend_error_noreturn(E_ERROR, "Call to %s method %s::%s() from context '%s'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), function_name_strval, EG(scope) ? EG(scope)->name : "");
+ zend_error_noreturn(E_ERROR, "Call to %s method %s::%s() from context '%s'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), function_name->val, EG(scope) ? EG(scope)->name->val : "");
}
}
}
if (UNEXPECTED(!key)) {
- free_alloca(lc_function_name, use_heap);
+ STR_FREE(lc_function_name);
}
return fbc;
}
/* }}} */
-ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, const char *property_name, int property_name_len, zend_bool silent, const zend_literal *key TSRMLS_DC) /* {{{ */
+ZEND_API zval *zend_std_get_static_property(zend_class_entry *ce, zend_string *property_name, zend_bool silent, const zend_literal *key TSRMLS_DC) /* {{{ */
{
zend_property_info *property_info;
- ulong hash_value;
if (UNEXPECTED(!key) ||
(property_info = CACHED_POLYMORPHIC_PTR(key->cache_slot, ce)) == NULL) {
- if (EXPECTED(key != NULL)) {
- hash_value = key->hash_value;
- } else {
- hash_value = zend_hash_func(property_name, property_name_len+1);
- }
- if (UNEXPECTED(zend_hash_quick_find(&ce->properties_info, property_name, property_name_len+1, hash_value, (void **) &property_info)==FAILURE)) {
+ if (UNEXPECTED((property_info = zend_hash_find_ptr(&ce->properties_info, property_name)) == NULL)) {
if (!silent) {
- zend_error_noreturn(E_ERROR, "Access to undeclared static property: %s::$%s", ce->name, property_name);
+ zend_error_noreturn(E_ERROR, "Access to undeclared static property: %s::$%s", ce->name->val, property_name->val);
}
return NULL;
}
-#if DEBUG_OBJECT_HANDLERS
- zend_printf("Access type for %s::%s is %s\n", ce->name, property_name, zend_visibility_string(property_info->flags));
-#endif
-
if (UNEXPECTED(!zend_verify_property_access(property_info, ce TSRMLS_CC))) {
if (!silent) {
zend_error_noreturn(E_ERROR, "Cannot access %s property %s::$%s", zend_visibility_string(property_info->flags), ce->name, property_name);
@@ -1277,9 +1264,9 @@ ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, const char *p
}
if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL) ||
- UNEXPECTED(CE_STATIC_MEMBERS(ce)[property_info->offset] == NULL)) {
+ UNEXPECTED(Z_TYPE(CE_STATIC_MEMBERS(ce)[property_info->offset]) == IS_UNDEF)) {
if (!silent) {
- zend_error_noreturn(E_ERROR, "Access to undeclared static property: %s::$%s", ce->name, property_name);
+ zend_error_noreturn(E_ERROR, "Access to undeclared static property: %s::$%s", ce->name->val, property_name->val);
}
return NULL;
}
@@ -1288,9 +1275,9 @@ ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, const char *p
}
/* }}} */
-ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, const char *property_name, int property_name_len, const zend_literal *key TSRMLS_DC) /* {{{ */
+ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, zend_string *property_name, const zend_literal *key TSRMLS_DC) /* {{{ */
{
- zend_error_noreturn(E_ERROR, "Attempt to unset static property %s::$%s", ce->name, property_name);
+ zend_error_noreturn(E_ERROR, "Attempt to unset static property %s::$%s", ce->name->val, property_name->val);
return 0;
}
/* }}} */
@@ -1347,38 +1334,38 @@ static int zend_std_compare_objects(zval *o1, zval *o2 TSRMLS_DC) /* {{{ */
if (!zobj1->properties && !zobj2->properties) {
int i;
- Z_OBJ_PROTECT_RECURSION(o1);
- Z_OBJ_PROTECT_RECURSION(o2);
+//??? Z_OBJ_PROTECT_RECURSION(o1);
+//??? Z_OBJ_PROTECT_RECURSION(o2);
for (i = 0; i < zobj1->ce->default_properties_count; i++) {
- if (zobj1->properties_table[i]) {
- if (zobj2->properties_table[i]) {
+ if (Z_TYPE(zobj1->properties_table[i]) != IS_UNDEF) {
+ if (Z_TYPE(zobj2->properties_table[i]) != IS_UNDEF) {
zval result;
- if (compare_function(&result, zobj1->properties_table[i], zobj2->properties_table[i] TSRMLS_CC)==FAILURE) {
- Z_OBJ_UNPROTECT_RECURSION(o1);
- Z_OBJ_UNPROTECT_RECURSION(o2);
+ if (compare_function(&result, &zobj1->properties_table[i], &zobj2->properties_table[i] TSRMLS_CC)==FAILURE) {
+//??? Z_OBJ_UNPROTECT_RECURSION(o1);
+//??? Z_OBJ_UNPROTECT_RECURSION(o2);
return 1;
}
if (Z_LVAL(result) != 0) {
- Z_OBJ_UNPROTECT_RECURSION(o1);
- Z_OBJ_UNPROTECT_RECURSION(o2);
+//??? Z_OBJ_UNPROTECT_RECURSION(o1);
+//??? Z_OBJ_UNPROTECT_RECURSION(o2);
return Z_LVAL(result);
}
} else {
- Z_OBJ_UNPROTECT_RECURSION(o1);
- Z_OBJ_UNPROTECT_RECURSION(o2);
+//??? Z_OBJ_UNPROTECT_RECURSION(o1);
+//??? Z_OBJ_UNPROTECT_RECURSION(o2);
return 1;
}
} else {
- if (zobj2->properties_table[i]) {
- Z_OBJ_UNPROTECT_RECURSION(o1);
- Z_OBJ_UNPROTECT_RECURSION(o2);
+ if (Z_TYPE(zobj2->properties_table[i]) != IS_UNDEF) {
+//??? Z_OBJ_UNPROTECT_RECURSION(o1);
+//??? Z_OBJ_UNPROTECT_RECURSION(o2);
return 1;
}
}
}
- Z_OBJ_UNPROTECT_RECURSION(o1);
- Z_OBJ_UNPROTECT_RECURSION(o2);
+//??? Z_OBJ_UNPROTECT_RECURSION(o1);
+//??? Z_OBJ_UNPROTECT_RECURSION(o2);
return 0;
} else {
if (!zobj1->properties) {
@@ -1396,63 +1383,74 @@ static int zend_std_has_property(zval *object, zval *member, int has_set_exists,
{
zend_object *zobj;
int result;
- zval **value = NULL;
- zval *tmp_member = NULL;
+ zval *value = NULL;
+ zval tmp_member;
zend_property_info *property_info;
zobj = Z_OBJ_P(object);
+ ZVAL_UNDEF(&tmp_member);
if (UNEXPECTED(Z_TYPE_P(member) != IS_STRING)) {
- ALLOC_ZVAL(tmp_member);
- *tmp_member = *member;
- INIT_PZVAL(tmp_member);
- zval_copy_ctor(tmp_member);
- convert_to_string(tmp_member);
- member = tmp_member;
+ ZVAL_DUP(&tmp_member, member);
+ convert_to_string(&tmp_member);
+ member = &tmp_member;
key = NULL;
}
-#if DEBUG_OBJECT_HANDLERS
- fprintf(stderr, "Read object #%d property: %s\n", Z_OBJ_HANDLE_P(object), Z_STRVAL_P(member));
-#endif
-
property_info = zend_get_property_info_quick(zobj->ce, member, 1, key TSRMLS_CC);
- if (UNEXPECTED(!property_info) ||
- ((EXPECTED((property_info->flags & ZEND_ACC_STATIC) == 0) &&
- property_info->offset >= 0) ?
- (zobj->properties ?
- ((value = (zval**)zobj->properties_table[property_info->offset]) == NULL) :
- (*(value = &zobj->properties_table[property_info->offset]) == NULL)) :
- (UNEXPECTED(!zobj->properties) ||
- UNEXPECTED(zend_hash_quick_find(zobj->properties, property_info->name, property_info->name_length+1, property_info->h, (void **) &value) == FAILURE)))) {
- zend_guard *guard;
-
- result = 0;
- if ((has_set_exists != 2) &&
- zobj->ce->__isset &&
- zend_get_property_guard(zobj, property_info, member, &guard) == SUCCESS &&
- !guard->in_isset) {
- zval *rv;
+ if (EXPECTED(property_info != NULL)) {
+ if (EXPECTED((property_info->flags & ZEND_ACC_STATIC) == 0) &&
+ property_info->offset >= 0 &&
+ Z_TYPE(zobj->properties_table[property_info->offset]) != IS_UNDEF) {
+ value = &zobj->properties_table[property_info->offset];
+ goto found;
+ }
+ if (UNEXPECTED(!zobj->properties)) {
+ value = zend_hash_find(zobj->properties, property_info->name);
+found:
+ switch (has_set_exists) {
+ case 0:
+ result = (Z_TYPE_P(value) != IS_NULL);
+ break;
+ default:
+ result = zend_is_true(value TSRMLS_CC);
+ break;
+ case 2:
+ result = 1;
+ break;
+ }
+ }
+ goto exit;
+ }
+
+ result = 0;
+ if ((has_set_exists != 2) && zobj->ce->__isset) {
+ long *guard = zend_get_property_guard(zobj, property_info, member);
+
+ if (!((*guard) & IN_ISSET)) {
+ zval rv;
/* have issetter - try with it! */
Z_ADDREF_P(object);
- if (PZVAL_IS_REF(object)) {
- SEPARATE_ZVAL(&object);
+ if (Z_ISREF_P(object)) {
+ SEPARATE_ZVAL(object);
}
- guard->in_isset = 1; /* prevent circular getting */
- rv = zend_std_call_issetter(object, member TSRMLS_CC);
- if (rv) {
- result = zend_is_true(rv TSRMLS_CC);
+ (*guard) |= IN_ISSET; /* prevent circular getting */
+ ZVAL_UNDEF(&rv);
+ zend_std_call_issetter(object, member, &rv TSRMLS_CC);
+ if (Z_TYPE(rv) != IS_UNDEF) {
+ result = zend_is_true(&rv TSRMLS_CC);
zval_ptr_dtor(&rv);
if (has_set_exists && result) {
- if (EXPECTED(!EG(exception)) && zobj->ce->__get && !guard->in_get) {
- guard->in_get = 1;
- rv = zend_std_call_getter(object, member TSRMLS_CC);
- guard->in_get = 0;
- if (rv) {
- Z_ADDREF_P(rv);
- result = i_zend_is_true(rv TSRMLS_CC);
+ if (EXPECTED(!EG(exception)) && zobj->ce->__get && !((*guard) & IN_GET)) {
+ (*guard) |= IN_GET;
+ ZVAL_UNDEF(&rv);
+ zend_std_call_getter(object, member, &rv TSRMLS_CC);
+ (*guard) &= ~IN_GET;
+ if (Z_TYPE(rv) != IS_UNDEF) {
+ Z_ADDREF(rv);
+ result = i_zend_is_true(&rv TSRMLS_CC);
zval_ptr_dtor(&rv);
} else {
result = 0;
@@ -1462,24 +1460,13 @@ static int zend_std_has_property(zval *object, zval *member, int has_set_exists,
}
}
}
- guard->in_isset = 0;
- zval_ptr_dtor(&object);
- }
- } else {
- switch (has_set_exists) {
- case 0:
- result = (Z_TYPE_PP(value) != IS_NULL);
- break;
- default:
- result = zend_is_true(*value TSRMLS_CC);
- break;
- case 2:
- result = 1;
- break;
+ (*guard) &= ~IN_ISSET;
+ zval_ptr_dtor(object);
}
}
- if (UNEXPECTED(tmp_member != NULL)) {
+exit:
+ if (UNEXPECTED(Z_TYPE(tmp_member) != IS_UNDEF)) {
zval_ptr_dtor(&tmp_member);
}
return result;
@@ -1495,7 +1482,7 @@ zend_class_entry *zend_std_object_get_class(const zval *object TSRMLS_DC) /* {{{
}
/* }}} */
-int zend_std_object_get_class_name(const zval *object, const char **class_name, zend_uint *class_name_len, int parent TSRMLS_DC) /* {{{ */
+zend_string* zend_std_object_get_class_name(const zval *object, int parent TSRMLS_DC) /* {{{ */
{
zend_object *zobj;
zend_class_entry *ce;
@@ -1503,67 +1490,64 @@ int zend_std_object_get_class_name(const zval *object, const char **class_name,
if (parent) {
if (!zobj->ce->parent) {
- return FAILURE;
+ return NULL;
}
ce = zobj->ce->parent;
} else {
ce = zobj->ce;
}
- *class_name_len = ce->name_length;
- *class_name = estrndup(ce->name, ce->name_length);
- return SUCCESS;
+ return STR_COPY(ce->name);
}
/* }}} */
ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int type TSRMLS_DC) /* {{{ */
{
- zval *retval;
+ zval retval;
zend_class_entry *ce;
switch (type) {
case IS_STRING:
+ ZVAL_UNDEF(&retval);
ce = Z_OBJCE_P(readobj);
if (ce->__tostring &&
- (zend_call_method_with_0_params(&readobj, ce, &ce->__tostring, "__tostring", &retval) || EG(exception))) {
+ (zend_call_method_with_0_params(readobj, ce, &ce->__tostring, "__tostring", &retval) || EG(exception))) {
if (UNEXPECTED(EG(exception) != NULL)) {
- if (retval) {
+ if (Z_TYPE(retval) != IS_UNDEF) {
zval_ptr_dtor(&retval);
}
EG(exception) = NULL;
- zend_error_noreturn(E_ERROR, "Method %s::__toString() must not throw an exception", ce->name);
+ zend_error_noreturn(E_ERROR, "Method %s::__toString() must not throw an exception", ce->name->val);
return FAILURE;
}
- if (EXPECTED(Z_TYPE_P(retval) == IS_STRING)) {
- INIT_PZVAL(writeobj);
+ if (EXPECTED(Z_TYPE(retval) == IS_STRING)) {
+//??? INIT_PZVAL(writeobj);
if (readobj == writeobj) {
zval_dtor(readobj);
}
- ZVAL_ZVAL(writeobj, retval, 1, 1);
+ ZVAL_ZVAL(writeobj, &retval, 1, 1);
if (Z_TYPE_P(writeobj) != type) {
convert_to_explicit_type(writeobj, type);
}
return SUCCESS;
} else {
zval_ptr_dtor(&retval);
- INIT_PZVAL(writeobj);
+//??? INIT_PZVAL(writeobj);
if (readobj == writeobj) {
zval_dtor(readobj);
}
ZVAL_EMPTY_STRING(writeobj);
- zend_error(E_RECOVERABLE_ERROR, "Method %s::__toString() must return a string value", ce->name);
+ zend_error(E_RECOVERABLE_ERROR, "Method %s::__toString() must return a string value", ce->name->val);
return SUCCESS;
}
}
return FAILURE;
case IS_BOOL:
- INIT_PZVAL(writeobj);
ZVAL_BOOL(writeobj, 1);
return SUCCESS;
case IS_LONG:
ce = Z_OBJCE_P(readobj);
- zend_error(E_NOTICE, "Object of class %s could not be converted to int", ce->name);
- INIT_PZVAL(writeobj);
+ zend_error(E_NOTICE, "Object of class %s could not be converted to int", ce->name->val);
if (readobj == writeobj) {
zval_dtor(readobj);
}
@@ -1571,43 +1555,44 @@ ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int ty
return SUCCESS;
case IS_DOUBLE:
ce = Z_OBJCE_P(readobj);
- zend_error(E_NOTICE, "Object of class %s could not be converted to double", ce->name);
- INIT_PZVAL(writeobj);
+ zend_error(E_NOTICE, "Object of class %s could not be converted to double", ce->name->val);
if (readobj == writeobj) {
zval_dtor(readobj);
}
ZVAL_DOUBLE(writeobj, 1);
return SUCCESS;
default:
- INIT_PZVAL(writeobj);
- Z_TYPE_P(writeobj) = IS_NULL;
+ ZVAL_NULL(writeobj);
break;
}
return FAILURE;
}
/* }}} */
-int zend_std_get_closure(zval *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zval **zobj_ptr TSRMLS_DC) /* {{{ */
+int zend_std_get_closure(zval *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zval *zobj_ptr TSRMLS_DC) /* {{{ */
{
+ zval *func;
zend_class_entry *ce;
+
if (Z_TYPE_P(obj) != IS_OBJECT) {
return FAILURE;
}
ce = Z_OBJCE_P(obj);
- if (zend_hash_find(&ce->function_table, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME), (void**)fptr_ptr) == FAILURE) {
+ if ((func = zend_hash_str_find(&ce->function_table, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1)) == NULL) {
return FAILURE;
}
+ *fptr_ptr = Z_FUNC_P(func);
*ce_ptr = ce;
if ((*fptr_ptr)->common.fn_flags & ZEND_ACC_STATIC) {
if (zobj_ptr) {
- *zobj_ptr = NULL;
+ ZVAL_UNDEF(zobj_ptr);
}
} else {
if (zobj_ptr) {
- *zobj_ptr = obj;
+ ZVAL_COPY_VALUE(zobj_ptr, obj);
}
}
return SUCCESS;
@@ -1615,8 +1600,8 @@ int zend_std_get_closure(zval *obj, zend_class_entry **ce_ptr, zend_function **f
/* }}} */
ZEND_API zend_object_handlers std_object_handlers = {
- zend_objects_store_add_ref, /* add_ref */
- zend_objects_store_del_ref, /* del_ref */
+ zend_object_free, /* free_obj */
+ zend_object_std_dtor, /* dtor_obj */
zend_objects_clone_obj, /* clone_obj */
zend_std_read_property, /* read_property */
diff --git a/Zend/zend_object_handlers.h b/Zend/zend_object_handlers.h
index 14418b9bf2..34e0172f90 100644
--- a/Zend/zend_object_handlers.h
+++ b/Zend/zend_object_handlers.h
@@ -50,11 +50,11 @@ typedef void (*zend_object_write_dimension_t)(zval *object, zval *offset, zval *
/* Used to create pointer to the property of the object, for future direct r/w access */
-typedef zval **(*zend_object_get_property_ptr_ptr_t)(zval *object, zval *member, int type, const struct _zend_literal *key TSRMLS_DC);
+typedef zval *(*zend_object_get_property_ptr_ptr_t)(zval *object, zval *member, int type, const struct _zend_literal *key TSRMLS_DC);
/* Used to set object value. Can be used to override assignments and scalar
write ops (like ++, +=) on the object */
-typedef void (*zend_object_set_t)(zval **object, zval *value TSRMLS_DC);
+typedef void (*zend_object_set_t)(zval *object, zval *value TSRMLS_DC);
/* Used to get object value. Can be used when converting object value to
* one of the basic types and when using scalar ops (like ++, +=) on the object
@@ -87,18 +87,20 @@ typedef HashTable *(*zend_object_get_debug_info_t)(zval *object, int *is_temp TS
/* args on stack! */
/* Andi - EX(fbc) (function being called) needs to be initialized already in the INIT fcall opcode so that the parameters can be parsed the right way. We need to add another callback for this.
*/
-typedef int (*zend_object_call_method_t)(const char *method, INTERNAL_FUNCTION_PARAMETERS);
-typedef union _zend_function *(*zend_object_get_method_t)(zval **object_ptr, char *method, int method_len, const struct _zend_literal *key TSRMLS_DC);
+typedef int (*zend_object_call_method_t)(zend_string *method, INTERNAL_FUNCTION_PARAMETERS);
+typedef union _zend_function *(*zend_object_get_method_t)(zval *object_ptr, zend_string *method, const struct _zend_literal *key TSRMLS_DC);
typedef union _zend_function *(*zend_object_get_constructor_t)(zval *object TSRMLS_DC);
/* Object maintenance/destruction */
typedef void (*zend_object_add_ref_t)(zval *object TSRMLS_DC);
typedef void (*zend_object_del_ref_t)(zval *object TSRMLS_DC);
typedef void (*zend_object_delete_obj_t)(zval *object TSRMLS_DC);
-typedef zend_object_value (*zend_object_clone_obj_t)(zval *object TSRMLS_DC);
+typedef void (*zend_object_dtor_obj_t)(zend_object *object TSRMLS_DC);
+typedef void (*zend_object_free_obj_t)(zend_object *object TSRMLS_DC);
+typedef zend_object* (*zend_object_clone_obj_t)(zval *object TSRMLS_DC);
typedef zend_class_entry *(*zend_object_get_class_entry_t)(const zval *object TSRMLS_DC);
-typedef int (*zend_object_get_class_name_t)(const zval *object, const char **class_name, zend_uint *class_name_len, int parent TSRMLS_DC);
+typedef zend_string *(*zend_object_get_class_name_t)(const zval *object, int parent TSRMLS_DC);
typedef int (*zend_object_compare_t)(zval *object1, zval *object2 TSRMLS_DC);
typedef int (*zend_object_compare_zvals_t)(zval *resul, zval *op1, zval *op2 TSRMLS_DC);
@@ -110,16 +112,16 @@ typedef int (*zend_object_cast_t)(zval *readobj, zval *retval, int type TSRMLS_D
* Returns FAILURE if the object does not have any sense of overloaded dimensions */
typedef int (*zend_object_count_elements_t)(zval *object, long *count TSRMLS_DC);
-typedef int (*zend_object_get_closure_t)(zval *obj, zend_class_entry **ce_ptr, union _zend_function **fptr_ptr, zval **zobj_ptr TSRMLS_DC);
+typedef int (*zend_object_get_closure_t)(zval *obj, zend_class_entry **ce_ptr, union _zend_function **fptr_ptr, zval *zobj_ptr TSRMLS_DC);
-typedef HashTable *(*zend_object_get_gc_t)(zval *object, zval ***table, int *n TSRMLS_DC);
+typedef HashTable *(*zend_object_get_gc_t)(zval *object, zval **table, int *n TSRMLS_DC);
typedef int (*zend_object_do_operation_t)(zend_uchar opcode, zval *result, zval *op1, zval *op2 TSRMLS_DC);
struct _zend_object_handlers {
/* general object functions */
- zend_object_add_ref_t add_ref;
- zend_object_del_ref_t del_ref;
+ zend_object_free_obj_t free_obj;
+ zend_object_dtor_obj_t dtor_obj;
zend_object_clone_obj_t clone_obj;
/* individual object functions */
zend_object_read_property_t read_property;
@@ -155,9 +157,9 @@ extern ZEND_API zend_object_handlers std_object_handlers;
((fbc)->common.prototype ? (fbc)->common.prototype->common.scope : (fbc)->common.scope)
BEGIN_EXTERN_C()
-ZEND_API union _zend_function *zend_std_get_static_method(zend_class_entry *ce, const char *function_name_strval, int function_name_strlen, const struct _zend_literal *key TSRMLS_DC);
-ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, const char *property_name, int property_name_len, zend_bool silent, const struct _zend_literal *key TSRMLS_DC);
-ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, const char *property_name, int property_name_len, const struct _zend_literal *key TSRMLS_DC);
+ZEND_API union _zend_function *zend_std_get_static_method(zend_class_entry *ce, zend_string *function_name_strval, const struct _zend_literal *key TSRMLS_DC);
+ZEND_API zval *zend_std_get_static_property(zend_class_entry *ce, zend_string *property_name, zend_bool silent, const struct _zend_literal *key TSRMLS_DC);
+ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, zend_string *property_name, const struct _zend_literal *key TSRMLS_DC);
ZEND_API union _zend_function *zend_std_get_constructor(zval *object TSRMLS_DC);
ZEND_API struct _zend_property_info *zend_get_property_info(zend_class_entry *ce, zval *member, int silent TSRMLS_DC);
ZEND_API HashTable *zend_std_get_properties(zval *object TSRMLS_DC);
@@ -170,11 +172,11 @@ ZEND_API void rebuild_object_properties(zend_object *zobj);
#define IS_ZEND_STD_OBJECT(z) (Z_TYPE(z) == IS_OBJECT && (Z_OBJ_HT((z))->get_class_entry != NULL))
#define HAS_CLASS_ENTRY(z) (Z_OBJ_HT(z)->get_class_entry != NULL)
-ZEND_API int zend_check_private(union _zend_function *fbc, zend_class_entry *ce, char *function_name_strval, int function_name_strlen TSRMLS_DC);
+ZEND_API int zend_check_private(union _zend_function *fbc, zend_class_entry *ce, zend_string *function_name TSRMLS_DC);
ZEND_API int zend_check_protected(zend_class_entry *ce, zend_class_entry *scope);
-ZEND_API int zend_check_property_access(zend_object *zobj, const char *prop_info_name, int prop_info_name_len TSRMLS_DC);
+ZEND_API int zend_check_property_access(zend_object *zobj, zend_string *prop_info_name TSRMLS_DC);
ZEND_API void zend_std_call_user_call(INTERNAL_FUNCTION_PARAMETERS);
END_EXTERN_C()
diff --git a/Zend/zend_objects.c b/Zend/zend_objects.c
index da3aab551d..cf7ac3fa6c 100644
--- a/Zend/zend_objects.c
+++ b/Zend/zend_objects.c
@@ -28,14 +28,20 @@
ZEND_API void zend_object_std_init(zend_object *object, zend_class_entry *ce TSRMLS_DC)
{
+ object->gc.refcount = 1;
+ object->gc.u.v.type = IS_OBJECT;
+ object->gc.u.v.buffer = 0;
object->ce = ce;
object->properties = NULL;
- object->properties_table = NULL;
object->guards = NULL;
+ memset(object->properties_table, 0, sizeof(zval) * ce->default_properties_count);
+ zend_objects_store_put(object);
}
ZEND_API void zend_object_std_dtor(zend_object *object TSRMLS_DC)
{
+ int i;
+
if (object->guards) {
zend_hash_destroy(object->guards);
FREE_HASHTABLE(object->guards);
@@ -46,26 +52,19 @@ ZEND_API void zend_object_std_dtor(zend_object *object TSRMLS_DC)
if (object->properties_table) {
efree(object->properties_table);
}
- } else if (object->properties_table) {
- int i;
-
- for (i = 0; i < object->ce->default_properties_count; i++) {
- if (object->properties_table[i]) {
- zval_ptr_dtor(&object->properties_table[i]);
- }
- }
- efree(object->properties_table);
+ }
+ for (i = 0; i < object->ce->default_properties_count; i++) {
+ zval_ptr_dtor(&object->properties_table[i]);
}
}
-ZEND_API void zend_objects_destroy_object(zend_object *object, zend_object_handle handle TSRMLS_DC)
+ZEND_API void zend_objects_destroy_object(zend_object *object TSRMLS_DC)
{
zend_function *destructor = object ? object->ce->destructor : NULL;
if (destructor) {
- zval *old_exception;
- zval *obj;
- zend_object_store_bucket *obj_bucket;
+ zend_object *old_exception;
+ zval obj;
if (destructor->op_array.fn_flags & (ZEND_ACC_PRIVATE|ZEND_ACC_PROTECTED)) {
if (destructor->op_array.fn_flags & ZEND_ACC_PRIVATE) {
@@ -76,8 +75,8 @@ ZEND_API void zend_objects_destroy_object(zend_object *object, zend_object_handl
zend_error(EG(in_execution) ? E_ERROR : E_WARNING,
"Call to private %s::__destruct() from context '%s'%s",
- ce->name,
- EG(scope) ? EG(scope)->name : "",
+ ce->name->val,
+ EG(scope) ? EG(scope)->name->val : "",
EG(in_execution) ? "" : " during shutdown ignored");
return;
}
@@ -89,23 +88,16 @@ ZEND_API void zend_objects_destroy_object(zend_object *object, zend_object_handl
zend_error(EG(in_execution) ? E_ERROR : E_WARNING,
"Call to protected %s::__destruct() from context '%s'%s",
- ce->name,
- EG(scope) ? EG(scope)->name : "",
+ ce->name->val,
+ EG(scope) ? EG(scope)->name->val : "",
EG(in_execution) ? "" : " during shutdown ignored");
return;
}
}
}
- MAKE_STD_ZVAL(obj);
- Z_TYPE_P(obj) = IS_OBJECT;
- Z_OBJ_HANDLE_P(obj) = handle;
- obj_bucket = &EG(objects_store).object_buckets[handle];
- if (!obj_bucket->bucket.obj.handlers) {
- obj_bucket->bucket.obj.handlers = &std_object_handlers;
- }
- Z_OBJ_HT_P(obj) = obj_bucket->bucket.obj.handlers;
- zval_copy_ctor(obj);
+ ZVAL_OBJ(&obj, object);
+ Z_ADDREF(obj);
/* Make sure that destructors are protected from previously thrown exceptions.
* For example, if an exception was thrown in a function and when the function's
@@ -113,7 +105,7 @@ ZEND_API void zend_objects_destroy_object(zend_object *object, zend_object_handl
*/
old_exception = NULL;
if (EG(exception)) {
- if (Z_OBJ_HANDLE_P(EG(exception)) == handle) {
+ if (EG(exception) == object) {
zend_error(E_ERROR, "Attempt to destruct pending exception");
} else {
old_exception = EG(exception);
@@ -132,69 +124,52 @@ ZEND_API void zend_objects_destroy_object(zend_object *object, zend_object_handl
}
}
-ZEND_API void zend_objects_free_object_storage(zend_object *object TSRMLS_DC)
+ZEND_API void zend_object_free(zend_object *object TSRMLS_DC)
{
zend_object_std_dtor(object TSRMLS_CC);
efree(object);
}
-ZEND_API zend_object_value zend_objects_new(zend_object **object, zend_class_entry *class_type TSRMLS_DC)
+ZEND_API zend_object *zend_objects_new(zend_class_entry *ce TSRMLS_DC)
{
- zend_object_value retval;
-
- *object = emalloc(sizeof(zend_object));
- (*object)->ce = class_type;
- (*object)->properties = NULL;
- (*object)->properties_table = NULL;
- (*object)->guards = NULL;
- retval.handle = zend_objects_store_put(*object, (zend_objects_store_dtor_t) zend_objects_destroy_object, (zend_objects_free_object_storage_t) zend_objects_free_object_storage, NULL TSRMLS_CC);
- retval.handlers = &std_object_handlers;
- return retval;
-}
+ zend_object *object = emalloc(sizeof(zend_object) + sizeof(zval) * (ce->default_properties_count - 1));
-ZEND_API zend_object *zend_objects_get_address(const zval *zobject TSRMLS_DC)
-{
- return (zend_object *)zend_object_store_get_object(zobject TSRMLS_CC);
+ zend_object_std_init(object, ce);
+ object->handlers = &std_object_handlers;
+ return object;
}
-ZEND_API void zend_objects_clone_members(zend_object *new_object, zend_object_value new_obj_val, zend_object *old_object, zend_object_handle handle TSRMLS_DC)
+ZEND_API void zend_objects_clone_members(zend_object *new_object, zend_object *old_object TSRMLS_DC)
{
int i;
- if (old_object->properties_table) {
- if (!new_object->properties_table) {
- new_object->properties_table = emalloc(sizeof(zval*) * old_object->ce->default_properties_count);
- memset(new_object->properties_table, 0, sizeof(zval*) * old_object->ce->default_properties_count);
- }
- for (i = 0; i < old_object->ce->default_properties_count; i++) {
- if (!new_object->properties) {
- if (new_object->properties_table[i]) {
- zval_ptr_dtor(&new_object->properties_table[i]);
- }
- }
- if (!old_object->properties) {
- new_object->properties_table[i] = old_object->properties_table[i];
- if (new_object->properties_table[i]) {
- Z_ADDREF_P(new_object->properties_table[i]);
- }
- }
- }
+ for (i = 0; i < old_object->ce->default_properties_count; i++) {
+//??? if (!new_object->properties) {
+ zval_ptr_dtor(&new_object->properties_table[i]);
+//??? }
+//??? if (!old_object->properties) {
+ ZVAL_COPY(&new_object->properties_table[i], &old_object->properties_table[i]);
+//??? }
}
if (old_object->properties) {
if (!new_object->properties) {
ALLOC_HASHTABLE(new_object->properties);
zend_hash_init(new_object->properties, 0, NULL, ZVAL_PTR_DTOR, 0);
}
- zend_hash_copy(new_object->properties, old_object->properties, (copy_ctor_func_t) zval_add_ref, (void *) NULL /* Not used anymore */, sizeof(zval *));
+ zend_hash_copy(new_object->properties, old_object->properties, zval_add_ref);
if (old_object->properties_table) {
HashPosition pos;
+ zval *prop;
zend_property_info *prop_info;
+
for (zend_hash_internal_pointer_reset_ex(&old_object->ce->properties_info, &pos);
- zend_hash_get_current_data_ex(&old_object->ce->properties_info, (void**)&prop_info, &pos) == SUCCESS;
+ (prop_info = zend_hash_get_current_data_ptr_ex(&old_object->ce->properties_info, &pos)) != NULL;
zend_hash_move_forward_ex(&old_object->ce->properties_info, &pos)) {
if ((prop_info->flags & ZEND_ACC_STATIC) == 0) {
- if (zend_hash_quick_find(new_object->properties, prop_info->name, prop_info->name_length+1, prop_info->h, (void**)&new_object->properties_table[prop_info->offset]) == FAILURE) {
- new_object->properties_table[prop_info->offset] = NULL;
+ if ((prop = zend_hash_find_ptr(new_object->properties, prop_info->name)) != NULL) {
+ ZVAL_COPY(&new_object->properties_table[prop_info->offset], prop);
+ } else {
+ ZVAL_UNDEF(&new_object->properties_table[prop_info->offset]);
}
}
}
@@ -202,34 +177,28 @@ ZEND_API void zend_objects_clone_members(zend_object *new_object, zend_object_va
}
if (old_object->ce->clone) {
- zval *new_obj;
-
- MAKE_STD_ZVAL(new_obj);
- new_obj->type = IS_OBJECT;
- new_obj->value.obj = new_obj_val;
- zval_copy_ctor(new_obj);
+ zval new_obj;
+ ZVAL_OBJ(&new_obj, new_object);
+ zval_copy_ctor(&new_obj);
zend_call_method_with_0_params(&new_obj, old_object->ce, &old_object->ce->clone, ZEND_CLONE_FUNC_NAME, NULL);
-
zval_ptr_dtor(&new_obj);
}
}
-ZEND_API zend_object_value zend_objects_clone_obj(zval *zobject TSRMLS_DC)
+ZEND_API zend_object *zend_objects_clone_obj(zval *zobject TSRMLS_DC)
{
- zend_object_value new_obj_val;
zend_object *old_object;
zend_object *new_object;
- zend_object_handle handle = Z_OBJ_HANDLE_P(zobject);
/* assume that create isn't overwritten, so when clone depends on the
* overwritten one then it must itself be overwritten */
- old_object = zend_objects_get_address(zobject TSRMLS_CC);
- new_obj_val = zend_objects_new(&new_object, old_object->ce TSRMLS_CC);
+ old_object = Z_OBJ_P(zobject);
+ new_object = zend_objects_new(old_object->ce TSRMLS_CC);
- zend_objects_clone_members(new_object, new_obj_val, old_object, handle TSRMLS_CC);
+ zend_objects_clone_members(new_object, old_object TSRMLS_CC);
- return new_obj_val;
+ return new_object;
}
/*
diff --git a/Zend/zend_objects.h b/Zend/zend_objects.h
index d00c65a368..ac0adf8634 100644
--- a/Zend/zend_objects.h
+++ b/Zend/zend_objects.h
@@ -27,12 +27,11 @@
BEGIN_EXTERN_C()
ZEND_API void zend_object_std_init(zend_object *object, zend_class_entry *ce TSRMLS_DC);
ZEND_API void zend_object_std_dtor(zend_object *object TSRMLS_DC);
-ZEND_API zend_object_value zend_objects_new(zend_object **object, zend_class_entry *class_type TSRMLS_DC);
-ZEND_API void zend_objects_destroy_object(zend_object *object, zend_object_handle handle TSRMLS_DC);
-ZEND_API zend_object *zend_objects_get_address(const zval *object TSRMLS_DC);
-ZEND_API void zend_objects_clone_members(zend_object *new_object, zend_object_value new_obj_val, zend_object *old_object, zend_object_handle handle TSRMLS_DC);
-ZEND_API zend_object_value zend_objects_clone_obj(zval *object TSRMLS_DC);
-ZEND_API void zend_objects_free_object_storage(zend_object *object TSRMLS_DC);
+ZEND_API zend_object *zend_objects_new(zend_class_entry *ce TSRMLS_DC);
+ZEND_API void zend_objects_destroy_object(zend_object *object TSRMLS_DC);
+ZEND_API void zend_objects_clone_members(zend_object *new_object, zend_object *old_object TSRMLS_DC);
+ZEND_API zend_object *zend_objects_clone_obj(zval *object TSRMLS_DC);
+ZEND_API void zend_object_free(zend_object *object TSRMLS_DC);
END_EXTERN_C()
#endif /* ZEND_OBJECTS_H */
diff --git a/Zend/zend_objects_API.c b/Zend/zend_objects_API.c
index f7a6b0b4c3..04de616f44 100644
--- a/Zend/zend_objects_API.c
+++ b/Zend/zend_objects_API.c
@@ -25,15 +25,25 @@
#include "zend_API.h"
#include "zend_objects_API.h"
-#define ZEND_DEBUG_OBJECTS 0
+#define FREE_BUCKET 1
+
+#define IS_VALID(o) (!(((zend_uintptr_t)(o)) & FREE_BUCKET))
+
+#define GET_BUCKET_NUMBER(o) (((zend_uintptr_t)(o)) >> 1)
+
+#define SET_BUCKET_NUMBER(o, n) do { \
+ (o) = (((zend_uintptr_t)(n)) << 1) | FREE_BUCKET); \
+ } while (0)
+
+
ZEND_API void zend_objects_store_init(zend_objects_store *objects, zend_uint init_size)
{
- objects->object_buckets = (zend_object_store_bucket *) emalloc(init_size * sizeof(zend_object_store_bucket));
+ objects->object_buckets = (zend_object **) emalloc(init_size * sizeof(zend_object*));
objects->top = 1; /* Skip 0 so that handles are true */
objects->size = init_size;
objects->free_list_head = -1;
- memset(&objects->object_buckets[0], 0, sizeof(zend_object_store_bucket));
+ memset(&objects->object_buckets[0], 0, sizeof(zend_object*));
}
ZEND_API void zend_objects_store_destroy(zend_objects_store *objects)
@@ -47,21 +57,17 @@ ZEND_API void zend_objects_store_call_destructors(zend_objects_store *objects TS
zend_uint i = 1;
for (i = 1; i < objects->top ; i++) {
- if (objects->object_buckets[i].valid) {
- struct _store_object *obj = &objects->object_buckets[i].bucket.obj;
-
- if (!objects->object_buckets[i].destructor_called) {
- objects->object_buckets[i].destructor_called = 1;
- if (obj->dtor && obj->object) {
- obj->refcount++;
- obj->dtor(obj->object, i TSRMLS_CC);
- obj = &objects->object_buckets[i].bucket.obj;
- obj->refcount--;
-
- if (obj->refcount == 0) {
- /* in case gc_collect_cycle is triggered before free_storage */
- GC_REMOVE_ZOBJ_FROM_BUFFER(obj);
- }
+ zend_object *obj = objects->object_buckets[i];
+
+ if (IS_VALID(obj)) {
+ if (!(obj->gc.u.v.flags & IS_OBJ_DESTRUCTOR_CALLED)) {
+ obj->gc.u.v.flags |= IS_OBJ_DESTRUCTOR_CALLED;
+ obj->gc.refcount++;
+ obj->handlers->dtor_obj(obj TSRMLS_CC);
+ obj->gc.refcount--;
+
+ if (obj->gc.refcount == 0) {
+ gc_remove_zval_from_buffer((zend_refcounted*)obj TSRMLS_CC);
}
}
}
@@ -76,8 +82,10 @@ ZEND_API void zend_objects_store_mark_destructed(zend_objects_store *objects TSR
return;
}
for (i = 1; i < objects->top ; i++) {
- if (objects->object_buckets[i].valid) {
- objects->object_buckets[i].destructor_called = 1;
+ zend_object *obj = objects->object_buckets[i];
+
+ if (IS_VALID(obj)) {
+ obj->gc.u.v.flags |= IS_OBJ_DESTRUCTOR_CALLED;
}
}
}
@@ -87,14 +95,13 @@ ZEND_API void zend_objects_store_free_object_storage(zend_objects_store *objects
zend_uint i = 1;
for (i = 1; i < objects->top ; i++) {
- if (objects->object_buckets[i].valid) {
- struct _store_object *obj = &objects->object_buckets[i].bucket.obj;
-
- GC_REMOVE_ZOBJ_FROM_BUFFER(obj);
+ zend_object *obj = objects->object_buckets[i];
- objects->object_buckets[i].valid = 0;
- if (obj->free_storage) {
- obj->free_storage(obj->object TSRMLS_CC);
+ if (IS_VALID(obj)) {
+ gc_remove_zval_from_buffer((zend_refcounted*)obj TSRMLS_CC);
+//??? objects->object_buckets[i].valid = 0;
+ if (obj->handlers->free_obj) {
+ obj->handlers->free_obj(obj TSRMLS_CC);
}
/* Not adding to free list as we are shutting down anyway */
}
@@ -104,63 +111,22 @@ ZEND_API void zend_objects_store_free_object_storage(zend_objects_store *objects
/* Store objects API */
-ZEND_API zend_object_handle zend_objects_store_put(void *object, zend_objects_store_dtor_t dtor, zend_objects_free_object_storage_t free_storage, zend_objects_store_clone_t clone TSRMLS_DC)
+ZEND_API void zend_objects_store_put(zend_object *object TSRMLS_DC)
{
- zend_object_handle handle;
- struct _store_object *obj;
+ int handle;
if (EG(objects_store).free_list_head != -1) {
handle = EG(objects_store).free_list_head;
- EG(objects_store).free_list_head = EG(objects_store).object_buckets[handle].bucket.free_list.next;
+ EG(objects_store).free_list_head = GET_BUCKET_NUMBER(EG(objects_store).object_buckets[handle]);
} else {
if (EG(objects_store).top == EG(objects_store).size) {
EG(objects_store).size <<= 1;
- EG(objects_store).object_buckets = (zend_object_store_bucket *) erealloc(EG(objects_store).object_buckets, EG(objects_store).size * sizeof(zend_object_store_bucket));
+ EG(objects_store).object_buckets = (zend_object **) erealloc(EG(objects_store).object_buckets, EG(objects_store).size * sizeof(zend_object*));
}
handle = EG(objects_store).top++;
}
- obj = &EG(objects_store).object_buckets[handle].bucket.obj;
- EG(objects_store).object_buckets[handle].destructor_called = 0;
- EG(objects_store).object_buckets[handle].valid = 1;
- EG(objects_store).object_buckets[handle].apply_count = 0;
-
- obj->refcount = 1;
- GC_OBJ_INIT(obj);
- obj->object = object;
- obj->dtor = dtor?dtor:(zend_objects_store_dtor_t)zend_objects_destroy_object;
- obj->free_storage = free_storage;
- obj->clone = clone;
- obj->handlers = NULL;
-
-#if ZEND_DEBUG_OBJECTS
- fprintf(stderr, "Allocated object id #%d\n", handle);
-#endif
- return handle;
-}
-
-ZEND_API zend_uint zend_objects_store_get_refcount(zval *object TSRMLS_DC)
-{
- zend_object_handle handle = Z_OBJ_HANDLE_P(object);
-
- return EG(objects_store).object_buckets[handle].bucket.obj.refcount;
-}
-
-ZEND_API void zend_objects_store_add_ref(zval *object TSRMLS_DC)
-{
- zend_object_handle handle = Z_OBJ_HANDLE_P(object);
-
- EG(objects_store).object_buckets[handle].bucket.obj.refcount++;
-#if ZEND_DEBUG_OBJECTS
- fprintf(stderr, "Increased refcount of object id #%d\n", handle);
-#endif
-}
-
-/*
- * Add a reference to an objects store entry given the object handle.
- */
-ZEND_API void zend_objects_store_add_ref_by_handle(zend_object_handle handle TSRMLS_DC)
-{
- EG(objects_store).object_buckets[handle].bucket.obj.refcount++;
+ object->handle = handle;
+ EG(objects_store).object_buckets[handle] = object;
}
#define ZEND_OBJECTS_STORE_ADD_TO_FREE_LIST() \
@@ -168,22 +134,11 @@ ZEND_API void zend_objects_store_add_ref_by_handle(zend_object_handle handle TSR
EG(objects_store).free_list_head = handle; \
EG(objects_store).object_buckets[handle].valid = 0;
-ZEND_API void zend_objects_store_del_ref(zval *zobject TSRMLS_DC)
-{
- zend_object_handle handle;
-
- handle = Z_OBJ_HANDLE_P(zobject);
-
- Z_ADDREF_P(zobject);
- zend_objects_store_del_ref_by_handle_ex(handle, Z_OBJ_HT_P(zobject) TSRMLS_CC);
- Z_DELREF_P(zobject);
-
- GC_ZOBJ_CHECK_POSSIBLE_ROOT(zobject);
-}
-
/*
* Delete a reference to an objects store entry given the object handle.
*/
+//???
+#if 0
ZEND_API void zend_objects_store_del_ref_by_handle_ex(zend_object_handle handle, const zend_object_handlers *handlers TSRMLS_DC) /* {{{ */
{
struct _store_object *obj;
@@ -220,7 +175,7 @@ ZEND_API void zend_objects_store_del_ref_by_handle_ex(zend_object_handle handle,
obj = &EG(objects_store).object_buckets[handle].bucket.obj;
if (obj->refcount == 1) {
- GC_REMOVE_ZOBJ_FROM_BUFFER(obj);
+//??? GC_REMOVE_ZOBJ_FROM_BUFFER(obj);
if (obj->free_storage) {
zend_try {
obj->free_storage(obj->object TSRMLS_CC);
@@ -235,33 +190,29 @@ ZEND_API void zend_objects_store_del_ref_by_handle_ex(zend_object_handle handle,
obj->refcount--;
-#if ZEND_DEBUG_OBJECTS
- if (obj->refcount == 0) {
- fprintf(stderr, "Deallocated object id #%d\n", handle);
- } else {
- fprintf(stderr, "Decreased refcount of object id #%d\n", handle);
- }
-#endif
if (failure) {
zend_bailout();
}
}
+#endif
/* }}} */
-ZEND_API zend_object_value zend_objects_store_clone_obj(zval *zobject TSRMLS_DC)
+//???
+#if 0
+ZEND_API zend_object *zend_objects_store_clone_obj(zval *zobject TSRMLS_DC)
{
- zend_object_value retval;
- void *new_object;
- struct _store_object *obj;
- zend_object_handle handle = Z_OBJ_HANDLE_P(zobject);
+ zend_object *obj, *new_object;
+//??? struct _store_object *obj;
+//??? zend_object_handle handle = Z_OBJ_HANDLE_P(zobject);
- obj = &EG(objects_store).object_buckets[handle].bucket.obj;
+//??? obj = &EG(objects_store).object_buckets[handle].bucket.obj;
- if (obj->clone == NULL) {
- zend_error(E_CORE_ERROR, "Trying to clone uncloneable object of class %s", Z_OBJCE_P(zobject)->name);
- }
+//??? if (obj->clone == NULL) {
+//??? zend_error(E_CORE_ERROR, "Trying to clone uncloneable object of class %s", Z_OBJCE_P(zobject)->name);
+//??? }
- obj->clone(obj->object, &new_object TSRMLS_CC);
+ obj = Z_OBJ_P(zobject);
+ new_object = obj->handlers->clone_obj(obj TSRMLS_CC);
obj = &EG(objects_store).object_buckets[handle].bucket.obj;
retval.handle = zend_objects_store_put(new_object, obj->dtor, obj->free_storage, obj->clone TSRMLS_CC);
@@ -270,21 +221,7 @@ ZEND_API zend_object_value zend_objects_store_clone_obj(zval *zobject TSRMLS_DC)
return retval;
}
-
-ZEND_API void *zend_object_store_get_object(const zval *zobject TSRMLS_DC)
-{
- zend_object_handle handle = Z_OBJ_HANDLE_P(zobject);
-
- return EG(objects_store).object_buckets[handle].bucket.obj.object;
-}
-
-/*
- * Retrieve an entry from the objects store given the object handle.
- */
-ZEND_API void *zend_object_store_get_object_by_handle(zend_object_handle handle TSRMLS_DC)
-{
- return EG(objects_store).object_buckets[handle].bucket.obj.object;
-}
+#endif
/* zend_object_store_set_object:
* It is ONLY valid to call this function from within the constructor of an
@@ -293,15 +230,19 @@ ZEND_API void *zend_object_store_get_object_by_handle(zend_object_handle handle
* from the constructor function. You MUST NOT use this function for any other
* weird games, or call it at any other time after the object is constructed.
* */
+//???
+#if 0
ZEND_API void zend_object_store_set_object(zval *zobject, void *object TSRMLS_DC)
{
zend_object_handle handle = Z_OBJ_HANDLE_P(zobject);
EG(objects_store).object_buckets[handle].bucket.obj.object = object;
}
-
+#endif
/* Called when the ctor was terminated by an exception */
+//???
+#if 0
ZEND_API void zend_object_store_ctor_failed(zval *zobject TSRMLS_DC)
{
zend_object_handle handle = Z_OBJ_HANDLE_P(zobject);
@@ -310,17 +251,18 @@ ZEND_API void zend_object_store_ctor_failed(zval *zobject TSRMLS_DC)
obj_bucket->bucket.obj.handlers = Z_OBJ_HT_P(zobject);;
obj_bucket->destructor_called = 1;
}
-
+#endif
/* Proxy objects workings */
typedef struct _zend_proxy_object {
- zval *object;
- zval *property;
+ zend_object std;
+ zval object;
+ zval property;
} zend_proxy_object;
static zend_object_handlers zend_object_proxy_handlers;
-ZEND_API void zend_objects_proxy_destroy(zend_object *object, zend_object_handle handle TSRMLS_DC)
+ZEND_API void zend_objects_proxy_destroy(zend_object *object TSRMLS_DC)
{
}
@@ -336,35 +278,34 @@ ZEND_API void zend_objects_proxy_clone(zend_proxy_object *object, zend_proxy_obj
*object_clone = emalloc(sizeof(zend_proxy_object));
(*object_clone)->object = object->object;
(*object_clone)->property = object->property;
- zval_add_ref(&(*object_clone)->property);
- zval_add_ref(&(*object_clone)->object);
+ Z_ADDREF_P(&(*object_clone)->property);
+ Z_ADDREF_P(&(*object_clone)->object);
}
-ZEND_API zval *zend_object_create_proxy(zval *object, zval *member TSRMLS_DC)
+ZEND_API zend_object *zend_object_create_proxy(zval *object, zval *member TSRMLS_DC)
{
- zend_proxy_object *pobj = emalloc(sizeof(zend_proxy_object));
- zval *retval;
-
- pobj->object = object;
- zval_add_ref(&pobj->object);
- ALLOC_ZVAL(pobj->property);
- INIT_PZVAL_COPY(pobj->property, member);
- zval_copy_ctor(pobj->property);
-
- MAKE_STD_ZVAL(retval);
- Z_TYPE_P(retval) = IS_OBJECT;
- Z_OBJ_HANDLE_P(retval) = zend_objects_store_put(pobj, (zend_objects_store_dtor_t)zend_objects_proxy_destroy, (zend_objects_free_object_storage_t) zend_objects_proxy_free_storage, (zend_objects_store_clone_t) zend_objects_proxy_clone TSRMLS_CC);
- Z_OBJ_HT_P(retval) = &zend_object_proxy_handlers;
+ zend_proxy_object *obj = emalloc(sizeof(zend_proxy_object));
+
+ obj->std.gc.refcount = 1;
+ obj->std.gc.u.v.type = IS_OBJECT;
+ obj->std.gc.u.v.buffer = 0;
+ obj->std.ce = NULL;
+ obj->std.properties = NULL;
+ obj->std.guards = NULL;
+ obj->std.handlers = &zend_object_proxy_handlers;
+
+ ZVAL_COPY(&obj->object, object);
+ ZVAL_DUP(&obj->property, member);
- return retval;
+ return (zend_object*)obj;
}
-ZEND_API void zend_object_proxy_set(zval **property, zval *value TSRMLS_DC)
+ZEND_API void zend_object_proxy_set(zval *property, zval *value TSRMLS_DC)
{
- zend_proxy_object *probj = zend_object_store_get_object(*property TSRMLS_CC);
+ zend_proxy_object *probj = (zend_proxy_object*)Z_OBJ_P(property);
- if (Z_OBJ_HT_P(probj->object) && Z_OBJ_HT_P(probj->object)->write_property) {
- Z_OBJ_HT_P(probj->object)->write_property(probj->object, probj->property, value, 0 TSRMLS_CC);
+ if (Z_OBJ_HT(probj->object) && Z_OBJ_HT(probj->object)->write_property) {
+ Z_OBJ_HT(probj->object)->write_property(&probj->object, &probj->property, value, 0 TSRMLS_CC);
} else {
zend_error(E_WARNING, "Cannot write property of object - no write handler defined");
}
@@ -372,10 +313,10 @@ ZEND_API void zend_object_proxy_set(zval **property, zval *value TSRMLS_DC)
ZEND_API zval* zend_object_proxy_get(zval *property TSRMLS_DC)
{
- zend_proxy_object *probj = zend_object_store_get_object(property TSRMLS_CC);
+ zend_proxy_object *probj = (zend_proxy_object*)Z_OBJ_P(property);
- if (Z_OBJ_HT_P(probj->object) && Z_OBJ_HT_P(probj->object)->read_property) {
- return Z_OBJ_HT_P(probj->object)->read_property(probj->object, probj->property, BP_VAR_R, 0 TSRMLS_CC);
+ if (Z_OBJ_HT(probj->object) && Z_OBJ_HT(probj->object)->read_property) {
+ return Z_OBJ_HT(probj->object)->read_property(&probj->object, &probj->property, BP_VAR_R, 0 TSRMLS_CC);
} else {
zend_error(E_WARNING, "Cannot read property of object - no read handler defined");
}
diff --git a/Zend/zend_objects_API.h b/Zend/zend_objects_API.h
index d8f2c5e384..9c69e97ed4 100644
--- a/Zend/zend_objects_API.h
+++ b/Zend/zend_objects_API.h
@@ -24,32 +24,35 @@
#include "zend.h"
-typedef void (*zend_objects_store_dtor_t)(void *object, zend_object_handle handle TSRMLS_DC);
-typedef void (*zend_objects_free_object_storage_t)(void *object TSRMLS_DC);
-typedef void (*zend_objects_store_clone_t)(void *object, void **object_clone TSRMLS_DC);
+//???typedef void (*zend_objects_store_dtor_t)(zend_object *object TSRMLS_DC);
+//???typedef void (*zend_objects_free_object_storage_t)(void *object TSRMLS_DC);
+//???typedef void (*zend_objects_store_clone_t)(zend_object *object, zend_object **object_clone TSRMLS_DC);
-typedef struct _zend_object_store_bucket {
- zend_bool destructor_called;
- zend_bool valid;
- zend_uchar apply_count;
- union _store_bucket {
- struct _store_object {
- void *object;
- zend_objects_store_dtor_t dtor;
- zend_objects_free_object_storage_t free_storage;
- zend_objects_store_clone_t clone;
- const zend_object_handlers *handlers;
- zend_uint refcount;
- gc_root_buffer *buffered;
- } obj;
- struct {
- int next;
- } free_list;
- } bucket;
-} zend_object_store_bucket;
+//???typedef union _zend_object_store_bucket {
+//??? zend_object *object;
+//??? int next_free;
+//??? zend_bool destructor_called;
+//??? zend_bool valid;
+//??? zend_uchar apply_count;
+//??? union _store_bucket {
+//??? struct _store_object {
+//??? zend_object *object;
+//??? zend_objects_store_dtor_t dtor;
+//??? zend_objects_free_object_storage_t free_storage;
+//??? zend_objects_store_clone_t clone;
+//??? const zend_object_handlers *handlers;
+//??? zend_uint refcount;
+//??? gc_root_buffer *buffered;
+//??? } obj;
+//??? zend_object *obj;
+//??? struct {
+//??? int next;
+//??? } free_list;
+//??? } bucket;
+//???} zend_object_store_bucket;
typedef struct _zend_objects_store {
- zend_object_store_bucket *object_buckets;
+ zend_object **object_buckets;
zend_uint top;
zend_uint size;
int free_list_head;
@@ -63,28 +66,28 @@ ZEND_API void zend_objects_store_mark_destructed(zend_objects_store *objects TSR
ZEND_API void zend_objects_store_destroy(zend_objects_store *objects);
/* Store API functions */
-ZEND_API zend_object_handle zend_objects_store_put(void *object, zend_objects_store_dtor_t dtor, zend_objects_free_object_storage_t storage, zend_objects_store_clone_t clone TSRMLS_DC);
+ZEND_API void zend_objects_store_put(zend_object *object TSRMLS_DC);
-ZEND_API void zend_objects_store_add_ref(zval *object TSRMLS_DC);
-ZEND_API void zend_objects_store_del_ref(zval *object TSRMLS_DC);
-ZEND_API void zend_objects_store_add_ref_by_handle(zend_object_handle handle TSRMLS_DC);
-ZEND_API void zend_objects_store_del_ref_by_handle_ex(zend_object_handle handle, const zend_object_handlers *handlers TSRMLS_DC);
-static zend_always_inline void zend_objects_store_del_ref_by_handle(zend_object_handle handle TSRMLS_DC) {
- zend_objects_store_del_ref_by_handle_ex(handle, NULL TSRMLS_CC);
-}
-ZEND_API zend_uint zend_objects_store_get_refcount(zval *object TSRMLS_DC);
-ZEND_API zend_object_value zend_objects_store_clone_obj(zval *object TSRMLS_DC);
-ZEND_API void *zend_object_store_get_object(const zval *object TSRMLS_DC);
-ZEND_API void *zend_object_store_get_object_by_handle(zend_object_handle handle TSRMLS_DC);
+//???ZEND_API void zend_objects_store_add_ref(zval *object TSRMLS_DC);
+//???ZEND_API void zend_objects_store_del_ref(zval *object TSRMLS_DC);
+//???ZEND_API void zend_objects_store_add_ref_by_handle(zend_object_handle handle TSRMLS_DC);
+//???ZEND_API void zend_objects_store_del_ref_by_handle_ex(zend_object_handle handle, const zend_object_handlers *handlers TSRMLS_DC);
+//???static zend_always_inline void zend_objects_store_del_ref_by_handle(zend_object_handle handle TSRMLS_DC) {
+//??? zend_objects_store_del_ref_by_handle_ex(handle, NULL TSRMLS_CC);
+//???}
+//???ZEND_API zend_uint zend_objects_store_get_refcount(zval *object TSRMLS_DC);
+//???ZEND_API zend_object *zend_objects_store_clone_obj(zval *object TSRMLS_DC);
+//???ZEND_API void *zend_object_store_get_object(const zval *object TSRMLS_DC);
+//???ZEND_API void *zend_object_store_get_object_by_handle(zend_object_handle handle TSRMLS_DC);
/* See comment in zend_objects_API.c before you use this */
-ZEND_API void zend_object_store_set_object(zval *zobject, void *object TSRMLS_DC);
+//???ZEND_API void zend_object_store_set_object(zval *zobject, void *object TSRMLS_DC);
ZEND_API void zend_object_store_ctor_failed(zval *zobject TSRMLS_DC);
ZEND_API void zend_objects_store_free_object_storage(zend_objects_store *objects TSRMLS_DC);
-#define ZEND_OBJECTS_STORE_HANDLERS zend_objects_store_add_ref, zend_objects_store_del_ref, zend_objects_store_clone_obj
+#define ZEND_OBJECTS_STORE_HANDLERS zend_object_free, zend_object_std_dtor, zend_objects_clone_obj
-ZEND_API zval *zend_object_create_proxy(zval *object, zval *member TSRMLS_DC);
+ZEND_API zend_object *zend_object_create_proxy(zval *object, zval *member TSRMLS_DC);
ZEND_API zend_object_handlers *zend_get_std_object_handlers(void);
END_EXTERN_C()
diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c
index af64e5a7f9..4fb41e794f 100644
--- a/Zend/zend_opcode.c
+++ b/Zend/zend_opcode.c
@@ -76,7 +76,6 @@ void init_op_array(zend_op_array *op_array, zend_uchar type, int initial_ops_siz
op_array->function_name = NULL;
op_array->filename = zend_get_compiled_filename(TSRMLS_C);
op_array->doc_comment = NULL;
- op_array->doc_comment_len = 0;
op_array->arg_info = NULL;
op_array->num_args = 0;
@@ -165,10 +164,12 @@ static inline void cleanup_user_class_data(zend_class_entry *ce TSRMLS_DC)
int i;
for (i = 0; i < ce->default_static_members_count; i++) {
- if (ce->static_members_table[i]) {
- zval *p = ce->static_members_table[i];
- ce->static_members_table[i] = NULL;
- zval_ptr_dtor(&p);
+ if (Z_TYPE(ce->static_members_table[i]) != IS_UNDEF) {
+ zval tmp;
+
+ ZVAL_COPY_VALUE(&tmp, &ce->static_members_table[i]);
+ ZVAL_UNDEF(&ce->static_members_table[i]);
+ zval_ptr_dtor(&tmp);
}
}
ce->static_members_table = NULL;
@@ -279,7 +280,7 @@ ZEND_API void destroy_zend_class(zend_class_entry **pce)
int i;
for (i = 0; i < ce->default_properties_count; i++) {
- if (ce->default_properties_table[i]) {
+ if (Z_TYPE(ce->default_properties_table[i]) != IS_UNDEF) {
zval_ptr_dtor(&ce->default_properties_table[i]);
}
}
@@ -289,14 +290,14 @@ ZEND_API void destroy_zend_class(zend_class_entry **pce)
int i;
for (i = 0; i < ce->default_static_members_count; i++) {
- if (ce->default_static_members_table[i]) {
+ if (Z_TYPE(ce->default_static_members_table[i]) != IS_UNDEF) {
zval_ptr_dtor(&ce->default_static_members_table[i]);
}
}
efree(ce->default_static_members_table);
}
zend_hash_destroy(&ce->properties_info);
- str_efree(ce->name);
+ STR_RELEASE(ce->name);
zend_hash_destroy(&ce->function_table);
zend_hash_destroy(&ce->constants_table);
if (ce->num_interfaces > 0 && ce->interfaces) {
@@ -315,7 +316,7 @@ ZEND_API void destroy_zend_class(zend_class_entry **pce)
int i;
for (i = 0; i < ce->default_properties_count; i++) {
- if (ce->default_properties_table[i]) {
+ if (Z_TYPE(ce->default_properties_table[i]) != IS_UNDEF) {
zval_internal_ptr_dtor(&ce->default_properties_table[i]);
}
}
@@ -330,7 +331,7 @@ ZEND_API void destroy_zend_class(zend_class_entry **pce)
free(ce->default_static_members_table);
}
zend_hash_destroy(&ce->properties_info);
- str_free(ce->name);
+ STR_RELEASE(ce->name);
zend_hash_destroy(&ce->function_table);
zend_hash_destroy(&ce->constants_table);
if (ce->num_interfaces > 0) {
@@ -371,7 +372,7 @@ ZEND_API void destroy_op_array(zend_op_array *op_array TSRMLS_DC)
i = op_array->last_var;
while (i > 0) {
i--;
- str_efree(op_array->vars[i].name);
+ STR_RELEASE(op_array->vars[i]);
}
efree(op_array->vars);
}
@@ -403,9 +404,11 @@ ZEND_API void destroy_op_array(zend_op_array *op_array TSRMLS_DC)
}
if (op_array->arg_info) {
for (i=0; i<op_array->num_args; i++) {
- str_efree(op_array->arg_info[i].name);
+//??? str_efree(op_array->arg_info[i].name);
+ efree((char*)op_array->arg_info[i].name);
if (op_array->arg_info[i].class_name) {
- str_efree(op_array->arg_info[i].class_name);
+//??? str_efree(op_array->arg_info[i].class_name);
+ efree((char*)op_array->arg_info[i].class_name);
}
}
efree(op_array->arg_info);
@@ -671,7 +674,7 @@ ZEND_API int pass_two(zend_op_array *op_array TSRMLS_DC)
}
if (!(op_array->fn_flags & ZEND_ACC_INTERACTIVE) && CG(context).vars_size != op_array->last_var) {
- op_array->vars = (zend_compiled_variable *) erealloc(op_array->vars, sizeof(zend_compiled_variable)*op_array->last_var);
+ op_array->vars = (zend_string**) erealloc(op_array->vars, sizeof(zend_string*)*op_array->last_var);
CG(context).vars_size = op_array->last_var;
}
if (!(op_array->fn_flags & ZEND_ACC_INTERACTIVE) && CG(context).opcodes_size != op_array->last) {
@@ -732,9 +735,9 @@ ZEND_API int pass_two(zend_op_array *op_array TSRMLS_DC)
int print_class(zend_class_entry *class_entry TSRMLS_DC)
{
- printf("Class %s:\n", class_entry->name);
+ printf("Class %s:\n", class_entry->name->val);
zend_hash_apply(&class_entry->function_table, (apply_func_t) pass_two TSRMLS_CC);
- printf("End of class %s.\n\n", class_entry->name);
+ printf("End of class %s.\n\n", class_entry->name->val);
return 0;
}
diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c
index 3434694f4c..2f964d2b89 100644
--- a/Zend/zend_operators.c
+++ b/Zend/zend_operators.c
@@ -186,21 +186,24 @@ ZEND_API void convert_scalar_to_number(zval *op TSRMLS_DC) /* {{{ */
switch (Z_TYPE_P(op)) {
case IS_STRING:
{
- char *strval;
+ zend_string *str;
- strval = Z_STRVAL_P(op);
- if ((Z_TYPE_P(op)=is_numeric_string(strval, Z_STRLEN_P(op), &Z_LVAL_P(op), &Z_DVAL_P(op), 1)) == 0) {
+ str = Z_STR_P(op);
+ if ((Z_TYPE_P(op)=is_numeric_string(str->val, str->len, &Z_LVAL_P(op), &Z_DVAL_P(op), 1)) == 0) {
ZVAL_LONG(op, 0);
}
- str_efree(strval);
+ STR_RELEASE(str);
break;
}
case IS_BOOL:
Z_TYPE_P(op) = IS_LONG;
break;
case IS_RESOURCE:
- zend_list_delete(Z_LVAL_P(op));
- Z_TYPE_P(op) = IS_LONG;
+ {
+ long l = Z_RES_HANDLE_P(op);
+ zval_ptr_dtor(op);
+ ZVAL_LONG(op, l);
+ }
break;
case IS_OBJECT:
convert_to_long_base(op, 10);
@@ -238,8 +241,7 @@ ZEND_API void convert_scalar_to_number(zval *op TSRMLS_DC) /* {{{ */
(op) = &(holder); \
break; \
case IS_OBJECT: \
- (holder) = (*(op)); \
- zval_copy_ctor(&(holder)); \
+ ZVAL_DUP(&(holder), op); \
convert_to_long_base(&(holder), 10); \
if (Z_TYPE(holder) == IS_LONG) { \
(op) = &(holder); \
@@ -269,8 +271,7 @@ ZEND_API void convert_scalar_to_number(zval *op TSRMLS_DC) /* {{{ */
Z_LVAL(holder) = (zend_hash_num_elements(Z_ARRVAL_P(op))?1:0); \
break; \
case IS_OBJECT: \
- (holder) = (*(op)); \
- zval_copy_ctor(&(holder)); \
+ ZVAL_DUP(&(holder), (op)); \
convert_to_long_base(&(holder), 10); \
break; \
case IS_BOOL: \
@@ -316,8 +317,7 @@ ZEND_API void convert_scalar_to_number(zval *op TSRMLS_DC) /* {{{ */
Z_LVAL(holder) = (zend_hash_num_elements(Z_ARRVAL_P(op))?1:0); \
break; \
case IS_OBJECT: \
- (holder) = (*(op)); \
- zval_copy_ctor(&(holder)); \
+ ZVAL_DUP(&(holder), (op)); \
convert_to_boolean(&(holder)); \
break; \
default: \
@@ -336,7 +336,7 @@ ZEND_API void convert_scalar_to_number(zval *op TSRMLS_DC) /* {{{ */
zval dst; \
if (Z_OBJ_HT_P(op)->cast_object(op, &dst, ctype TSRMLS_CC) == FAILURE) { \
zend_error(E_RECOVERABLE_ERROR, \
- "Object of class %s could not be converted to %s", Z_OBJCE_P(op)->name, \
+ "Object of class %s could not be converted to %s", Z_OBJCE_P(op)->name->val,\
zend_get_type_by_const(ctype)); \
} else { \
zval_dtor(op); \
@@ -349,8 +349,7 @@ ZEND_API void convert_scalar_to_number(zval *op TSRMLS_DC) /* {{{ */
if (Z_TYPE_P(newop) != IS_OBJECT) { \
/* for safety - avoid loop */ \
zval_dtor(op); \
- *op = *newop; \
- FREE_ZVAL(newop); \
+ ZVAL_COPY_VALUE(op, newop); \
conv_func(op); \
} \
} \
@@ -376,8 +375,9 @@ ZEND_API void convert_to_long_base(zval *op, int base) /* {{{ */
break;
case IS_RESOURCE: {
TSRMLS_FETCH();
-
- zend_list_delete(Z_LVAL_P(op));
+ long l = Z_RES_HANDLE_P(op);
+ zval_ptr_dtor(op);
+ Z_LVAL_P(op) = l;
}
/* break missing intentionally */
case IS_BOOL:
@@ -388,10 +388,10 @@ ZEND_API void convert_to_long_base(zval *op, int base) /* {{{ */
break;
case IS_STRING:
{
- char *strval = Z_STRVAL_P(op);
+ zend_string *str = Z_STR_P(op);
- Z_LVAL_P(op) = strtol(strval, NULL, base);
- str_efree(strval);
+ Z_LVAL_P(op) = strtol(str->val, NULL, base);
+ STR_RELEASE(str);
}
break;
case IS_ARRAY:
@@ -409,7 +409,7 @@ ZEND_API void convert_to_long_base(zval *op, int base) /* {{{ */
if (Z_TYPE_P(op) == IS_LONG) {
return;
}
- zend_error(E_NOTICE, "Object of class %s could not be converted to int", Z_OBJCE_P(op)->name);
+ zend_error(E_NOTICE, "Object of class %s could not be converted to int", Z_OBJCE_P(op)->name->val);
zval_dtor(op);
ZVAL_LONG(op, retval);
@@ -436,10 +436,11 @@ ZEND_API void convert_to_double(zval *op) /* {{{ */
break;
case IS_RESOURCE: {
TSRMLS_FETCH();
-
- zend_list_delete(Z_LVAL_P(op));
+ double d = (double) Z_RES_HANDLE_P(op);
+ zval_ptr_dtor(op);
+ Z_DVAL_P(op) = d;
}
- /* break missing intentionally */
+ break;
case IS_BOOL:
case IS_LONG:
Z_DVAL_P(op) = (double) Z_LVAL_P(op);
@@ -448,10 +449,10 @@ ZEND_API void convert_to_double(zval *op) /* {{{ */
break;
case IS_STRING:
{
- char *strval = Z_STRVAL_P(op);
+ zend_string *str = Z_STR_P(op);
- Z_DVAL_P(op) = zend_strtod(strval, NULL);
- str_efree(strval);
+ Z_DVAL_P(op) = zend_strtod(str->val, NULL);
+ STR_RELEASE(str);
}
break;
case IS_ARRAY:
@@ -469,7 +470,7 @@ ZEND_API void convert_to_double(zval *op) /* {{{ */
if (Z_TYPE_P(op) == IS_DOUBLE) {
return;
}
- zend_error(E_NOTICE, "Object of class %s could not be converted to double", Z_OBJCE_P(op)->name);
+ zend_error(E_NOTICE, "Object of class %s could not be converted to double", Z_OBJCE_P(op)->name->val);
zval_dtor(op);
ZVAL_DOUBLE(op, retval);
@@ -489,17 +490,15 @@ ZEND_API void convert_to_null(zval *op) /* {{{ */
{
if (Z_TYPE_P(op) == IS_OBJECT) {
if (Z_OBJ_HT_P(op)->cast_object) {
- zval *org;
+ zval org;
TSRMLS_FETCH();
- ALLOC_ZVAL(org);
- *org = *op;
- if (Z_OBJ_HT_P(op)->cast_object(org, op, IS_NULL TSRMLS_CC) == SUCCESS) {
- zval_dtor(org);
+ ZVAL_COPY_VALUE(&org, op);
+ if (Z_OBJ_HT_P(op)->cast_object(&org, op, IS_NULL TSRMLS_CC) == SUCCESS) {
+ zval_dtor(&org);
return;
}
- *op = *org;
- FREE_ZVAL(org);
+ ZVAL_COPY_VALUE(op, &org);
}
}
@@ -520,10 +519,12 @@ ZEND_API void convert_to_boolean(zval *op) /* {{{ */
break;
case IS_RESOURCE: {
TSRMLS_FETCH();
+ long l = (Z_RES_HANDLE_P(op) ? 1 : 0);
- zend_list_delete(Z_LVAL_P(op));
+ zval_ptr_dtor(op);
+ Z_LVAL_P(op) = l;
}
- /* break missing intentionally */
+ break;
case IS_LONG:
Z_LVAL_P(op) = (Z_LVAL_P(op) ? 1 : 0);
break;
@@ -532,15 +533,15 @@ ZEND_API void convert_to_boolean(zval *op) /* {{{ */
break;
case IS_STRING:
{
- char *strval = Z_STRVAL_P(op);
+ zend_string *str = Z_STR_P(op);
- if (Z_STRLEN_P(op) == 0
- || (Z_STRLEN_P(op)==1 && Z_STRVAL_P(op)[0]=='0')) {
+ if (str->len == 0
+ || (str->len == 1 && str->val[0] == '0')) {
Z_LVAL_P(op) = 0;
} else {
Z_LVAL_P(op) = 1;
}
- str_efree(strval);
+ STR_RELEASE(str);
}
break;
case IS_ARRAY:
@@ -579,7 +580,7 @@ ZEND_API void _convert_to_cstring(zval *op ZEND_FILE_LINE_DC) /* {{{ */
case IS_DOUBLE: {
TSRMLS_FETCH();
dval = Z_DVAL_P(op);
- Z_STRLEN_P(op) = zend_spprintf(&Z_STRVAL_P(op), 0, "%.*H", (int) EG(precision), dval);
+ Z_STRLEN_P(op) = zend_spprintf((char**)&Z_STRVAL_P(op), 0, "%.*H", (int) EG(precision), dval);
/* %H already handles removing trailing zeros from the fractional part, yay */
break;
}
@@ -597,45 +598,55 @@ ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC) /* {{{ */
switch (Z_TYPE_P(op)) {
case IS_NULL:
- Z_STRVAL_P(op) = STR_EMPTY_ALLOC();
- Z_STRLEN_P(op) = 0;
+ Z_STR_P(op) = STR_EMPTY_ALLOC();
break;
case IS_STRING:
break;
case IS_BOOL:
if (Z_LVAL_P(op)) {
- Z_STRVAL_P(op) = estrndup_rel("1", 1);
- Z_STRLEN_P(op) = 1;
+ Z_STR_P(op) = STR_INIT("1", 1, 0);
} else {
- Z_STRVAL_P(op) = STR_EMPTY_ALLOC();
- Z_STRLEN_P(op) = 0;
+ Z_STR_P(op) = STR_EMPTY_ALLOC();
}
break;
case IS_RESOURCE: {
long tmp = Z_LVAL_P(op);
+ char *str;
+ int len;
TSRMLS_FETCH();
- zend_list_delete(Z_LVAL_P(op));
- Z_STRLEN_P(op) = zend_spprintf(&Z_STRVAL_P(op), 0, "Resource id #%ld", tmp);
+ zval_ptr_dtor(op);
+ len = zend_spprintf(&str, 0, "Resource id #%ld", tmp);
+ Z_STR_P(op) = STR_INIT(str, len, 0);
+ efree(str);
break;
}
- case IS_LONG:
+ case IS_LONG: {
+ char *str;
+ int len;
lval = Z_LVAL_P(op);
- Z_STRLEN_P(op) = zend_spprintf(&Z_STRVAL_P(op), 0, "%ld", lval);
+ len = zend_spprintf(&str, 0, "%ld", lval);
+ Z_STR_P(op) = STR_INIT(str, len, 0);
+ efree(str);
break;
+ }
case IS_DOUBLE: {
+ char *str;
+ int len;
TSRMLS_FETCH();
+
dval = Z_DVAL_P(op);
- Z_STRLEN_P(op) = zend_spprintf(&Z_STRVAL_P(op), 0, "%.*G", (int) EG(precision), dval);
+ len = zend_spprintf(&str, 0, "%.*G", (int) EG(precision), dval);
/* %G already handles removing trailing zeros from the fractional part, yay */
+ Z_STR_P(op) = STR_INIT(str, len, 0);
+ efree(str);
break;
}
case IS_ARRAY:
zend_error(E_NOTICE, "Array to string conversion");
zval_dtor(op);
- Z_STRVAL_P(op) = estrndup_rel("Array", sizeof("Array")-1);
- Z_STRLEN_P(op) = sizeof("Array")-1;
+ Z_STR_P(op) = STR_INIT("Array", sizeof("Array")-1, 0);
break;
case IS_OBJECT: {
TSRMLS_FETCH();
@@ -646,10 +657,9 @@ ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC) /* {{{ */
return;
}
- zend_error(E_NOTICE, "Object of class %s to string conversion", Z_OBJCE_P(op)->name);
+ zend_error(E_NOTICE, "Object of class %s to string conversion", Z_OBJCE_P(op)->name->val);
zval_dtor(op);
- Z_STRVAL_P(op) = estrndup_rel("Object", sizeof("Object")-1);
- Z_STRLEN_P(op) = sizeof("Object")-1;
+ Z_STR_P(op) = STR_INIT("Object", sizeof("Object")-1, 0);
break;
}
default:
@@ -663,22 +673,20 @@ ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC) /* {{{ */
static void convert_scalar_to_array(zval *op, int type TSRMLS_DC) /* {{{ */
{
- zval *entry;
+ zval entry;
- ALLOC_ZVAL(entry);
- *entry = *op;
- INIT_PZVAL(entry);
+ ZVAL_COPY_VALUE(&entry, op);
switch (type) {
case IS_ARRAY:
- ALLOC_HASHTABLE(Z_ARRVAL_P(op));
+ ZVAL_NEW_ARR(op);
zend_hash_init(Z_ARRVAL_P(op), 0, NULL, ZVAL_PTR_DTOR, 0);
- zend_hash_index_update(Z_ARRVAL_P(op), 0, (void *) &entry, sizeof(zval *), NULL);
+ zend_hash_index_update(Z_ARRVAL_P(op), 0, &entry);
Z_TYPE_P(op) = IS_ARRAY;
break;
case IS_OBJECT:
object_init(op);
- zend_hash_update(Z_OBJPROP_P(op), "scalar", sizeof("scalar"), (void *) &entry, sizeof(zval *), NULL);
+ zend_hash_str_update(Z_OBJPROP_P(op), "scalar", sizeof("scalar")-1, &entry);
break;
}
}
@@ -694,41 +702,36 @@ ZEND_API void convert_to_array(zval *op) /* {{{ */
/* OBJECTS_OPTIMIZE */
case IS_OBJECT:
{
- zval *tmp;
- HashTable *ht;
+ zval arr;
- ALLOC_HASHTABLE(ht);
- zend_hash_init(ht, 0, NULL, ZVAL_PTR_DTOR, 0);
+ ZVAL_NEW_ARR(&arr);
+ zend_hash_init(Z_ARRVAL(arr), 0, NULL, ZVAL_PTR_DTOR, 0);
if (Z_OBJCE_P(op) == zend_ce_closure) {
convert_scalar_to_array(op, IS_ARRAY TSRMLS_CC);
if (Z_TYPE_P(op) == IS_ARRAY) {
- zend_hash_destroy(ht);
- FREE_HASHTABLE(ht);
+ zval_dtor(&arr);
return;
}
} else if (Z_OBJ_HT_P(op)->get_properties) {
HashTable *obj_ht = Z_OBJ_HT_P(op)->get_properties(op TSRMLS_CC);
if (obj_ht) {
- zend_hash_copy(ht, obj_ht, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
+ zend_hash_copy(Z_ARRVAL(arr), obj_ht, zval_add_ref);
}
} else {
convert_object_to_type(op, IS_ARRAY, convert_to_array);
if (Z_TYPE_P(op) == IS_ARRAY) {
- zend_hash_destroy(ht);
- FREE_HASHTABLE(ht);
+ zval_dtor(&arr);
return;
}
}
zval_dtor(op);
- Z_TYPE_P(op) = IS_ARRAY;
- Z_ARRVAL_P(op) = ht;
+ ZVAL_COPY_VALUE(op, &arr);
}
break;
case IS_NULL:
- ALLOC_HASHTABLE(Z_ARRVAL_P(op));
+ ZVAL_NEW_ARR(op);
zend_hash_init(Z_ARRVAL_P(op), 0, NULL, ZVAL_PTR_DTOR, 0);
- Z_TYPE_P(op) = IS_ARRAY;
break;
default:
convert_scalar_to_array(op, IS_ARRAY TSRMLS_CC);
@@ -761,13 +764,13 @@ ZEND_API void convert_to_object(zval *op) /* {{{ */
ZEND_API void multi_convert_to_long_ex(int argc, ...) /* {{{ */
{
- zval **arg;
+ zval *arg;
va_list ap;
va_start(ap, argc);
while (argc--) {
- arg = va_arg(ap, zval **);
+ arg = va_arg(ap, zval *);
convert_to_long_ex(arg);
}
@@ -777,13 +780,13 @@ ZEND_API void multi_convert_to_long_ex(int argc, ...) /* {{{ */
ZEND_API void multi_convert_to_double_ex(int argc, ...) /* {{{ */
{
- zval **arg;
+ zval *arg;
va_list ap;
va_start(ap, argc);
while (argc--) {
- arg = va_arg(ap, zval **);
+ arg = va_arg(ap, zval *);
convert_to_double_ex(arg);
}
@@ -793,13 +796,13 @@ ZEND_API void multi_convert_to_double_ex(int argc, ...) /* {{{ */
ZEND_API void multi_convert_to_string_ex(int argc, ...) /* {{{ */
{
- zval **arg;
+ zval *arg;
va_list ap;
va_start(ap, argc);
while (argc--) {
- arg = va_arg(ap, zval **);
+ arg = va_arg(ap, zval *);
convert_to_string_ex(arg);
}
@@ -840,20 +843,16 @@ ZEND_API int add_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ *
ZVAL_DOUBLE(result, Z_DVAL_P(op1) + Z_DVAL_P(op2));
return SUCCESS;
- case TYPE_PAIR(IS_ARRAY, IS_ARRAY): {
- zval *tmp;
-
+ case TYPE_PAIR(IS_ARRAY, IS_ARRAY):
if ((result == op1) && (result == op2)) {
/* $a += $a */
return SUCCESS;
}
if (result != op1) {
- *result = *op1;
- zval_copy_ctor(result);
+ ZVAL_DUP(result, op1);
}
- zend_hash_merge(Z_ARRVAL_P(result), Z_ARRVAL_P(op2), (void (*)(void *pData)) zval_add_ref, (void *) &tmp, sizeof(zval *), 0);
+ zend_hash_merge(Z_ARRVAL_P(result), Z_ARRVAL_P(op2), zval_add_ref, 0);
return SUCCESS;
- }
default:
if (!converted) {
@@ -1112,8 +1111,7 @@ ZEND_API int bitwise_not_function(zval *result, zval *op1 TSRMLS_DC) /* {{{ */
zval op1_copy = *op1;
Z_TYPE_P(result) = IS_STRING;
- Z_STRVAL_P(result) = estrndup(Z_STRVAL(op1_copy), Z_STRLEN(op1_copy));
- Z_STRLEN_P(result) = Z_STRLEN(op1_copy);
+ Z_STR_P(result) = STR_DUP(Z_STR(op1_copy), 0);
for (i = 0; i < Z_STRLEN(op1_copy); i++) {
Z_STRVAL_P(result)[i] = ~Z_STRVAL(op1_copy)[i];
}
@@ -1135,8 +1133,8 @@ ZEND_API int bitwise_or_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /
if (Z_TYPE_P(op1) == IS_STRING && Z_TYPE_P(op2) == IS_STRING) {
zval *longer, *shorter;
- char *result_str;
- int i, result_len;
+ zend_string *str;
+ int i;
if (Z_STRLEN_P(op1) >= Z_STRLEN_P(op2)) {
longer = op1;
@@ -1146,17 +1144,14 @@ ZEND_API int bitwise_or_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /
shorter = op1;
}
- Z_TYPE_P(result) = IS_STRING;
- result_len = Z_STRLEN_P(longer);
- result_str = estrndup(Z_STRVAL_P(longer), Z_STRLEN_P(longer));
+ str = STR_DUP(Z_STR_P(longer), 0);
for (i = 0; i < Z_STRLEN_P(shorter); i++) {
- result_str[i] |= Z_STRVAL_P(shorter)[i];
+ str->val[i] |= Z_STRVAL_P(shorter)[i];
}
if (result==op1) {
- str_efree(Z_STRVAL_P(result));
+ STR_RELEASE(Z_STR_P(result));
}
- Z_STRVAL_P(result) = result_str;
- Z_STRLEN_P(result) = result_len;
+ ZVAL_STR(result, str);
return SUCCESS;
}
@@ -1182,8 +1177,8 @@ ZEND_API int bitwise_and_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
if (Z_TYPE_P(op1) == IS_STRING && Z_TYPE_P(op2) == IS_STRING) {
zval *longer, *shorter;
- char *result_str;
- int i, result_len;
+ zend_string *str;
+ int i;
if (Z_STRLEN_P(op1) >= Z_STRLEN_P(op2)) {
longer = op1;
@@ -1193,17 +1188,14 @@ ZEND_API int bitwise_and_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
shorter = op1;
}
- Z_TYPE_P(result) = IS_STRING;
- result_len = Z_STRLEN_P(shorter);
- result_str = estrndup(Z_STRVAL_P(shorter), Z_STRLEN_P(shorter));
+ str = STR_DUP(Z_STR_P(shorter), 0);
for (i = 0; i < Z_STRLEN_P(shorter); i++) {
- result_str[i] &= Z_STRVAL_P(longer)[i];
+ str->val[i] &= Z_STRVAL_P(longer)[i];
}
if (result==op1) {
- str_efree(Z_STRVAL_P(result));
+ STR_RELEASE(Z_STR_P(result));
}
- Z_STRVAL_P(result) = result_str;
- Z_STRLEN_P(result) = result_len;
+ ZVAL_STR(result, str);
return SUCCESS;
}
@@ -1229,8 +1221,8 @@ ZEND_API int bitwise_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
if (Z_TYPE_P(op1) == IS_STRING && Z_TYPE_P(op2) == IS_STRING) {
zval *longer, *shorter;
- char *result_str;
- int i, result_len;
+ zend_string *str;
+ int i;
if (Z_STRLEN_P(op1) >= Z_STRLEN_P(op2)) {
longer = op1;
@@ -1240,17 +1232,14 @@ ZEND_API int bitwise_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
shorter = op1;
}
- Z_TYPE_P(result) = IS_STRING;
- result_len = Z_STRLEN_P(shorter);
- result_str = estrndup(Z_STRVAL_P(shorter), Z_STRLEN_P(shorter));
+ str = STR_DUP(Z_STR_P(shorter), 0);
for (i = 0; i < Z_STRLEN_P(shorter); i++) {
- result_str[i] ^= Z_STRVAL_P(longer)[i];
+ str->val[i] ^= Z_STRVAL_P(longer)[i];
}
if (result==op1) {
- str_efree(Z_STRVAL_P(result));
+ STR_RELEASE(Z_STR_P(result));
}
- Z_STRVAL_P(result) = result_str;
- Z_STRLEN_P(result) = result_len;
+ ZVAL_STR(result, str);
return SUCCESS;
}
@@ -1313,11 +1302,11 @@ ZEND_API int shift_right_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
ZEND_API int add_char_to_string(zval *result, const zval *op1, const zval *op2) /* {{{ */
{
int length = Z_STRLEN_P(op1) + 1;
- char *buf = str_erealloc(Z_STRVAL_P(op1), length + 1);
+ zend_string *buf = STR_EREALLOC(Z_STR_P(op1), length + 1);
- buf[length - 1] = (char) Z_LVAL_P(op2);
- buf[length] = 0;
- ZVAL_STRINGL(result, buf, length, 0);
+ buf->val[length - 1] = (char) Z_LVAL_P(op2);
+ buf->val[length] = 0;
+ ZVAL_STR(result, buf);
return SUCCESS;
}
/* }}} */
@@ -1326,11 +1315,11 @@ ZEND_API int add_char_to_string(zval *result, const zval *op1, const zval *op2)
ZEND_API int add_string_to_string(zval *result, const zval *op1, const zval *op2) /* {{{ */
{
int length = Z_STRLEN_P(op1) + Z_STRLEN_P(op2);
- char *buf = str_erealloc(Z_STRVAL_P(op1), length + 1);
+ zend_string *buf = STR_EREALLOC(Z_STR_P(op1), length + 1);
- memcpy(buf + Z_STRLEN_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op2));
- buf[length] = 0;
- ZVAL_STRINGL(result, buf, length, 0);
+ memcpy(buf->val + Z_STRLEN_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op2));
+ buf->val[length] = 0;
+ ZVAL_STR(result, buf);
return SUCCESS;
}
/* }}} */
@@ -1363,28 +1352,26 @@ ZEND_API int concat_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{
if (use_copy2) {
op2 = &op2_copy;
}
- if (result==op1 && !IS_INTERNED(Z_STRVAL_P(op1))) { /* special case, perform operations on result */
+ if (result==op1 && !IS_INTERNED(Z_STR_P(op1))) { /* special case, perform operations on result */
uint res_len = Z_STRLEN_P(op1) + Z_STRLEN_P(op2);
if (Z_STRLEN_P(result) < 0 || (int) (Z_STRLEN_P(op1) + Z_STRLEN_P(op2)) < 0) {
- efree(Z_STRVAL_P(result));
ZVAL_EMPTY_STRING(result);
zend_error(E_ERROR, "String size overflow");
}
- Z_STRVAL_P(result) = erealloc(Z_STRVAL_P(result), res_len+1);
+ Z_STR_P(result) = STR_EREALLOC(Z_STR_P(result), res_len+1);
memcpy(Z_STRVAL_P(result)+Z_STRLEN_P(result), Z_STRVAL_P(op2), Z_STRLEN_P(op2));
Z_STRVAL_P(result)[res_len]=0;
- Z_STRLEN_P(result) = res_len;
} else {
int length = Z_STRLEN_P(op1) + Z_STRLEN_P(op2);
- char *buf = (char *) emalloc(length + 1);
+ zend_string *buf = STR_ALLOC(length, 0);
- memcpy(buf, Z_STRVAL_P(op1), Z_STRLEN_P(op1));
- memcpy(buf + Z_STRLEN_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op2));
- buf[length] = 0;
- ZVAL_STRINGL(result, buf, length, 0);
+ memcpy(buf->val, Z_STRVAL_P(op1), Z_STRLEN_P(op1));
+ memcpy(buf->val + Z_STRLEN_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op2));
+ buf->val[length] = 0;
+ ZVAL_STR(result, buf);
}
if (use_copy1) {
zval_dtor(op1);
@@ -1480,11 +1467,8 @@ ZEND_API int numeric_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_
{
zval op1_copy, op2_copy;
- op1_copy = *op1;
- zval_copy_ctor(&op1_copy);
-
- op2_copy = *op2;
- zval_copy_ctor(&op2_copy);
+ ZVAL_DUP(&op1_copy, op1);
+ ZVAL_DUP(&op2_copy, op2);
convert_to_double(&op1_copy);
convert_to_double(&op2_copy);
@@ -1500,9 +1484,9 @@ static inline void zend_free_obj_get_result(zval *op TSRMLS_DC) /* {{{ */
if (Z_REFCOUNT_P(op) == 0) {
GC_REMOVE_ZVAL_FROM_BUFFER(op);
zval_dtor(op);
- FREE_ZVAL(op);
+//??? FREE_ZVAL(op);
} else {
- zval_ptr_dtor(&op);
+ zval_ptr_dtor(op);
}
}
/* }}} */
@@ -1512,7 +1496,7 @@ ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {
int ret;
int converted = 0;
zval op1_copy, op2_copy;
- zval *op_free;
+ zval *op_free, tmp_free;
while (1) {
switch (TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2))) {
@@ -1587,7 +1571,7 @@ ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {
}
if (Z_TYPE_P(op1) == IS_OBJECT && Z_TYPE_P(op2) == IS_OBJECT) {
- if (Z_OBJ_HANDLE_P(op1) == Z_OBJ_HANDLE_P(op2)) {
+ if (Z_OBJ_P(op1) == Z_OBJ_P(op2)) {
/* object handles are identical, apparently this is the same object */
ZVAL_LONG(result, 0);
return SUCCESS;
@@ -1604,14 +1588,13 @@ ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {
zend_free_obj_get_result(op_free TSRMLS_CC);
return ret;
} else if (Z_TYPE_P(op2) != IS_OBJECT && Z_OBJ_HT_P(op1)->cast_object) {
- ALLOC_INIT_ZVAL(op_free);
- if (Z_OBJ_HT_P(op1)->cast_object(op1, op_free, Z_TYPE_P(op2) TSRMLS_CC) == FAILURE) {
+ if (Z_OBJ_HT_P(op1)->cast_object(op1, &tmp_free, Z_TYPE_P(op2) TSRMLS_CC) == FAILURE) {
ZVAL_LONG(result, 1);
- zend_free_obj_get_result(op_free TSRMLS_CC);
+ zend_free_obj_get_result(&tmp_free TSRMLS_CC);
return SUCCESS;
}
- ret = compare_function(result, op_free, op2 TSRMLS_CC);
- zend_free_obj_get_result(op_free TSRMLS_CC);
+ ret = compare_function(result, &tmp_free, op2 TSRMLS_CC);
+ zend_free_obj_get_result(&tmp_free TSRMLS_CC);
return ret;
}
}
@@ -1622,14 +1605,13 @@ ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {
zend_free_obj_get_result(op_free TSRMLS_CC);
return ret;
} else if (Z_TYPE_P(op1) != IS_OBJECT && Z_OBJ_HT_P(op2)->cast_object) {
- ALLOC_INIT_ZVAL(op_free);
- if (Z_OBJ_HT_P(op2)->cast_object(op2, op_free, Z_TYPE_P(op1) TSRMLS_CC) == FAILURE) {
+ if (Z_OBJ_HT_P(op2)->cast_object(op2, &tmp_free, Z_TYPE_P(op1) TSRMLS_CC) == FAILURE) {
ZVAL_LONG(result, -1);
- zend_free_obj_get_result(op_free TSRMLS_CC);
+ zend_free_obj_get_result(&tmp_free TSRMLS_CC);
return SUCCESS;
}
- ret = compare_function(result, op1, op_free TSRMLS_CC);
- zend_free_obj_get_result(op_free TSRMLS_CC);
+ ret = compare_function(result, op1, &tmp_free TSRMLS_CC);
+ zend_free_obj_get_result(&tmp_free TSRMLS_CC);
return ret;
} else if (Z_TYPE_P(op1) == IS_OBJECT) {
ZVAL_LONG(result, 1);
@@ -1725,7 +1707,7 @@ ZEND_API int is_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
break;
case IS_OBJECT:
if (Z_OBJ_HT_P(op1) == Z_OBJ_HT_P(op2)) {
- Z_LVAL_P(result) = (Z_OBJ_HANDLE_P(op1) == Z_OBJ_HANDLE_P(op2));
+ Z_LVAL_P(result) = (Z_OBJ_P(op1) == Z_OBJ_P(op2));
} else {
Z_LVAL_P(result) = 0;
}
@@ -1824,21 +1806,24 @@ static void increment_string(zval *str) /* {{{ */
{
int carry=0;
int pos=Z_STRLEN_P(str)-1;
- char *s=Z_STRVAL_P(str);
- char *t;
+ char *s;
+ zend_string *t;
int last=0; /* Shut up the compiler warning */
int ch;
if (Z_STRLEN_P(str) == 0) {
- str_efree(Z_STRVAL_P(str));
- Z_STRVAL_P(str) = estrndup("1", sizeof("1")-1);
- Z_STRLEN_P(str) = 1;
+ STR_RELEASE(Z_STR_P(str));
+ Z_STR_P(str) = STR_INIT("1", sizeof("1")-1, 0);
return;
}
- if (IS_INTERNED(s)) {
- Z_STRVAL_P(str) = s = estrndup(s, Z_STRLEN_P(str));
+ if (IS_INTERNED(Z_STR_P(str))) {
+ Z_STR_P(str) = STR_DUP(Z_STR_P(str), 0);
+ } else if (Z_REFCOUNT_P(str) > 1) {
+ Z_DELREF_P(str);
+ Z_STR_P(str) = STR_DUP(Z_STR_P(str), 0);
}
+ s = Z_STRVAL_P(str);
while (pos >= 0) {
ch = s[pos];
@@ -1880,23 +1865,22 @@ static void increment_string(zval *str) /* {{{ */
}
if (carry) {
- t = (char *) emalloc(Z_STRLEN_P(str)+1+1);
- memcpy(t+1, Z_STRVAL_P(str), Z_STRLEN_P(str));
- Z_STRLEN_P(str)++;
- t[Z_STRLEN_P(str)] = '\0';
+ t = STR_ALLOC(Z_STRLEN_P(str)+1, 0);
+ memcpy(t->val + 1, Z_STRVAL_P(str), Z_STRLEN_P(str));
+ t->val[Z_STRLEN_P(str) + 1] = '\0';
switch (last) {
case NUMERIC:
- t[0] = '1';
+ t->val[0] = '1';
break;
case UPPER_CASE:
- t[0] = 'A';
+ t->val[0] = 'A';
break;
case LOWER_CASE:
- t[0] = 'a';
+ t->val[0] = 'a';
break;
}
- str_efree(Z_STRVAL_P(str));
- Z_STRVAL_P(str) = t;
+ STR_FREE(Z_STR_P(str));
+ ZVAL_STR(str, t);
}
}
/* }}} */
@@ -1925,7 +1909,7 @@ ZEND_API int increment_function(zval *op1) /* {{{ */
switch (is_numeric_string(Z_STRVAL_P(op1), Z_STRLEN_P(op1), &lval, &dval, 0)) {
case IS_LONG:
- str_efree(Z_STRVAL_P(op1));
+ STR_RELEASE(Z_STR_P(op1));
if (lval == LONG_MAX) {
/* switch to double */
double d = (double)lval;
@@ -1935,7 +1919,7 @@ ZEND_API int increment_function(zval *op1) /* {{{ */
}
break;
case IS_DOUBLE:
- str_efree(Z_STRVAL_P(op1));
+ STR_RELEASE(Z_STR_P(op1));
ZVAL_DOUBLE(op1, dval+1);
break;
default:
@@ -1947,13 +1931,12 @@ ZEND_API int increment_function(zval *op1) /* {{{ */
break;
case IS_OBJECT:
if (Z_OBJ_HANDLER_P(op1, do_operation)) {
- zval *op2;
+ zval op2;
int res;
TSRMLS_FETCH();
- MAKE_STD_ZVAL(op2);
- ZVAL_LONG(op2, 1);
- res = Z_OBJ_HANDLER_P(op1, do_operation)(ZEND_ADD, op1, op1, op2 TSRMLS_CC);
+ ZVAL_LONG(&op2, 1);
+ res = Z_OBJ_HANDLER_P(op1, do_operation)(ZEND_ADD, op1, op1, &op2 TSRMLS_CC);
zval_ptr_dtor(&op2);
return res;
@@ -1985,13 +1968,13 @@ ZEND_API int decrement_function(zval *op1) /* {{{ */
break;
case IS_STRING: /* Like perl we only support string increment */
if (Z_STRLEN_P(op1) == 0) { /* consider as 0 */
- str_efree(Z_STRVAL_P(op1));
+ STR_RELEASE(Z_STR_P(op1));
ZVAL_LONG(op1, -1);
break;
}
switch (is_numeric_string(Z_STRVAL_P(op1), Z_STRLEN_P(op1), &lval, &dval, 0)) {
case IS_LONG:
- str_efree(Z_STRVAL_P(op1));
+ STR_RELEASE(Z_STR_P(op1));
if (lval == LONG_MIN) {
double d = (double)lval;
ZVAL_DOUBLE(op1, d-1);
@@ -2000,20 +1983,19 @@ ZEND_API int decrement_function(zval *op1) /* {{{ */
}
break;
case IS_DOUBLE:
- str_efree(Z_STRVAL_P(op1));
+ STR_RELEASE(Z_STR_P(op1));
ZVAL_DOUBLE(op1, dval - 1);
break;
}
break;
case IS_OBJECT:
if (Z_OBJ_HANDLER_P(op1, do_operation)) {
- zval *op2;
+ zval op2;
int res;
TSRMLS_FETCH();
- MAKE_STD_ZVAL(op2);
- ZVAL_LONG(op2, 1);
- res = Z_OBJ_HANDLER_P(op1, do_operation)(ZEND_SUB, op1, op1, op2 TSRMLS_CC);
+ ZVAL_LONG(&op2, 1);
+ res = Z_OBJ_HANDLER_P(op1, do_operation)(ZEND_SUB, op1, op1, &op2 TSRMLS_CC);
zval_ptr_dtor(&op2);
return res;
@@ -2302,7 +2284,7 @@ ZEND_API void zend_compare_objects(zval *result, zval *o1, zval *o2 TSRMLS_DC) /
{
Z_TYPE_P(result) = IS_LONG;
- if (Z_OBJ_HANDLE_P(o1) == Z_OBJ_HANDLE_P(o2)) {
+ if (Z_OBJ_P(o1) == Z_OBJ_P(o2)) {
Z_LVAL_P(result) = 0;
return;
}
@@ -2318,8 +2300,12 @@ ZEND_API void zend_compare_objects(zval *result, zval *o1, zval *o2 TSRMLS_DC) /
ZEND_API void zend_locale_sprintf_double(zval *op ZEND_FILE_LINE_DC) /* {{{ */
{
TSRMLS_FETCH();
+ char *str;
+ int len;
- Z_STRLEN_P(op) = zend_spprintf(&Z_STRVAL_P(op), 0, "%.*G", (int) EG(precision), (double)Z_DVAL_P(op));
+ len = zend_spprintf(&str, 0, "%.*G", (int) EG(precision), (double)Z_DVAL_P(op));
+ Z_STR_P(op) = STR_INIT(str, len, 0);
+ efree(str);
}
/* }}} */
diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h
index cfc84063e4..31701a98e0 100644
--- a/Zend/zend_operators.h
+++ b/Zend/zend_operators.h
@@ -378,10 +378,10 @@ ZEND_API long zend_atol(const char *str, int str_len);
ZEND_API void zend_locale_sprintf_double(zval *op ZEND_FILE_LINE_DC);
END_EXTERN_C()
-#define convert_to_ex_master(ppzv, lower_type, upper_type) \
- if (Z_TYPE_PP(ppzv)!=IS_##upper_type) { \
- SEPARATE_ZVAL_IF_NOT_REF(ppzv); \
- convert_to_##lower_type(*ppzv); \
+#define convert_to_ex_master(pzv, lower_type, upper_type) \
+ if (Z_TYPE_P(pzv)!=IS_##upper_type) { \
+ SEPARATE_ZVAL_IF_NOT_REF(pzv); \
+ convert_to_##lower_type(pzv); \
}
#define convert_to_explicit_type(pzv, type) \
@@ -414,81 +414,28 @@ END_EXTERN_C()
} \
} while (0);
-#define convert_to_explicit_type_ex(ppzv, str_type) \
- if (Z_TYPE_PP(ppzv) != str_type) { \
- SEPARATE_ZVAL_IF_NOT_REF(ppzv); \
- convert_to_explicit_type(*ppzv, str_type); \
+#define convert_to_explicit_type_ex(pzv, str_type) \
+ if (Z_TYPE_P(pzv) != str_type) { \
+ SEPARATE_ZVAL_IF_NOT_REF(pzv); \
+ convert_to_explicit_type(pzv, str_type); \
}
-#define convert_to_boolean_ex(ppzv) convert_to_ex_master(ppzv, boolean, BOOL)
-#define convert_to_long_ex(ppzv) convert_to_ex_master(ppzv, long, LONG)
-#define convert_to_double_ex(ppzv) convert_to_ex_master(ppzv, double, DOUBLE)
-#define convert_to_string_ex(ppzv) convert_to_ex_master(ppzv, string, STRING)
-#define convert_to_array_ex(ppzv) convert_to_ex_master(ppzv, array, ARRAY)
-#define convert_to_object_ex(ppzv) convert_to_ex_master(ppzv, object, OBJECT)
-#define convert_to_null_ex(ppzv) convert_to_ex_master(ppzv, null, NULL)
-
-#define convert_scalar_to_number_ex(ppzv) \
- if (Z_TYPE_PP(ppzv)!=IS_LONG && Z_TYPE_PP(ppzv)!=IS_DOUBLE) { \
- if (!Z_ISREF_PP(ppzv)) { \
- SEPARATE_ZVAL(ppzv); \
+#define convert_to_boolean_ex(pzv) convert_to_ex_master(pzv, boolean, BOOL)
+#define convert_to_long_ex(pzv) convert_to_ex_master(pzv, long, LONG)
+#define convert_to_double_ex(pzv) convert_to_ex_master(pzv, double, DOUBLE)
+#define convert_to_string_ex(pzv) convert_to_ex_master(pzv, string, STRING)
+#define convert_to_array_ex(pzv) convert_to_ex_master(pzv, array, ARRAY)
+#define convert_to_object_ex(pzv) convert_to_ex_master(pzv, object, OBJECT)
+#define convert_to_null_ex(pzv) convert_to_ex_master(pzv, null, NULL)
+
+#define convert_scalar_to_number_ex(pzv) \
+ if (Z_TYPE_P(pzv)!=IS_LONG && Z_TYPE_P(pzv)!=IS_DOUBLE) { \
+ if (!Z_ISREF_P(pzv)) { \
+ SEPARATE_ZVAL(pzv); \
} \
- convert_scalar_to_number(*ppzv TSRMLS_CC); \
+ convert_scalar_to_number(ppzv TSRMLS_CC); \
}
-
-#define Z_LVAL(zval) (zval).value.lval
-#define Z_BVAL(zval) ((zend_bool)(zval).value.lval)
-#define Z_DVAL(zval) (zval).value.dval
-#define Z_STRVAL(zval) (zval).value.str.val
-#define Z_STRLEN(zval) (zval).value.str.len
-#define Z_ARRVAL(zval) (zval).value.ht
-#define Z_AST(zval) (zval).value.ast
-#define Z_OBJVAL(zval) (zval).value.obj
-#define Z_OBJ_HANDLE(zval) Z_OBJVAL(zval).handle
-#define Z_OBJ_HT(zval) Z_OBJVAL(zval).handlers
-#define Z_OBJCE(zval) zend_get_class_entry(&(zval) TSRMLS_CC)
-#define Z_OBJPROP(zval) Z_OBJ_HT((zval))->get_properties(&(zval) TSRMLS_CC)
-#define Z_OBJ_HANDLER(zval, hf) Z_OBJ_HT((zval))->hf
-#define Z_RESVAL(zval) (zval).value.lval
-#define Z_OBJDEBUG(zval,is_tmp) (Z_OBJ_HANDLER((zval),get_debug_info)?Z_OBJ_HANDLER((zval),get_debug_info)(&(zval),&is_tmp TSRMLS_CC):(is_tmp=0,Z_OBJ_HANDLER((zval),get_properties)?Z_OBJPROP(zval):NULL))
-
-#define Z_LVAL_P(zval_p) Z_LVAL(*zval_p)
-#define Z_BVAL_P(zval_p) Z_BVAL(*zval_p)
-#define Z_DVAL_P(zval_p) Z_DVAL(*zval_p)
-#define Z_STRVAL_P(zval_p) Z_STRVAL(*zval_p)
-#define Z_STRLEN_P(zval_p) Z_STRLEN(*zval_p)
-#define Z_ARRVAL_P(zval_p) Z_ARRVAL(*zval_p)
-#define Z_AST_P(zval_p) Z_AST(*zval_p)
-#define Z_OBJPROP_P(zval_p) Z_OBJPROP(*zval_p)
-#define Z_OBJCE_P(zval_p) Z_OBJCE(*zval_p)
-#define Z_RESVAL_P(zval_p) Z_RESVAL(*zval_p)
-#define Z_OBJVAL_P(zval_p) Z_OBJVAL(*zval_p)
-#define Z_OBJ_HANDLE_P(zval_p) Z_OBJ_HANDLE(*zval_p)
-#define Z_OBJ_HT_P(zval_p) Z_OBJ_HT(*zval_p)
-#define Z_OBJ_HANDLER_P(zval_p, h) Z_OBJ_HANDLER(*zval_p, h)
-#define Z_OBJDEBUG_P(zval_p,is_tmp) Z_OBJDEBUG(*zval_p,is_tmp)
-
-#define Z_LVAL_PP(zval_pp) Z_LVAL(**zval_pp)
-#define Z_BVAL_PP(zval_pp) Z_BVAL(**zval_pp)
-#define Z_DVAL_PP(zval_pp) Z_DVAL(**zval_pp)
-#define Z_STRVAL_PP(zval_pp) Z_STRVAL(**zval_pp)
-#define Z_STRLEN_PP(zval_pp) Z_STRLEN(**zval_pp)
-#define Z_ARRVAL_PP(zval_pp) Z_ARRVAL(**zval_pp)
-#define Z_AST_PP(zval_p) Z_AST(**zval_p)
-#define Z_OBJPROP_PP(zval_pp) Z_OBJPROP(**zval_pp)
-#define Z_OBJCE_PP(zval_pp) Z_OBJCE(**zval_pp)
-#define Z_RESVAL_PP(zval_pp) Z_RESVAL(**zval_pp)
-#define Z_OBJVAL_PP(zval_pp) Z_OBJVAL(**zval_pp)
-#define Z_OBJ_HANDLE_PP(zval_p) Z_OBJ_HANDLE(**zval_p)
-#define Z_OBJ_HT_PP(zval_p) Z_OBJ_HT(**zval_p)
-#define Z_OBJ_HANDLER_PP(zval_p, h) Z_OBJ_HANDLER(**zval_p, h)
-#define Z_OBJDEBUG_PP(zval_pp,is_tmp) Z_OBJDEBUG(**zval_pp,is_tmp)
-
-#define Z_TYPE(zval) (zval).type
-#define Z_TYPE_P(zval_p) Z_TYPE(*zval_p)
-#define Z_TYPE_PP(zval_pp) Z_TYPE(**zval_pp)
-
#if HAVE_SETLOCALE && defined(ZEND_WIN32) && !defined(ZTS) && defined(_MSC_VER) && (_MSC_VER >= 1400)
/* This is performance improvement of tolower() on Windows and VC2005
* Gives 10-18% on bench.php
diff --git a/Zend/zend_stack.c b/Zend/zend_stack.c
index cf99499e79..31bb8afec5 100644
--- a/Zend/zend_stack.c
+++ b/Zend/zend_stack.c
@@ -161,6 +161,27 @@ ZEND_API void zend_stack_apply_with_argument(zend_stack *stack, int type, int (*
}
}
+ZEND_API void zend_stack_clean(zend_stack *stack, void (*func)(void *), zend_bool free_elements)
+{
+ int i;
+
+ if (func) {
+ for (i = 0; i < stack->top; i++) {
+ func(stack->elements[i]);
+ }
+ }
+ if (free_elements) {
+ if (stack->elements) {
+ for (i = 0; i < stack->top; i++) {
+ efree(stack->elements[i]);
+ }
+ efree(stack->elements);
+ stack->elements = NULL;
+ }
+ stack->top = stack->max = 0;
+ }
+}
+
/*
* Local variables:
* tab-width: 4
diff --git a/Zend/zend_stack.h b/Zend/zend_stack.h
index d484879468..851e2301aa 100644
--- a/Zend/zend_stack.h
+++ b/Zend/zend_stack.h
@@ -42,6 +42,7 @@ ZEND_API void **zend_stack_base(const zend_stack *stack);
ZEND_API int zend_stack_count(const zend_stack *stack);
ZEND_API void zend_stack_apply(zend_stack *stack, int type, int (*apply_function)(void *element));
ZEND_API void zend_stack_apply_with_argument(zend_stack *stack, int type, int (*apply_function)(void *element, void *arg), void *arg);
+ZEND_API void zend_stack_clean(zend_stack *stack, void (*func)(void *), zend_bool free_elements);
END_EXTERN_C()
#define ZEND_STACK_APPLY_TOPDOWN 1
diff --git a/Zend/zend_string.c b/Zend/zend_string.c
index f1162f0b4c..05cd6a2d19 100644
--- a/Zend/zend_string.c
+++ b/Zend/zend_string.c
@@ -21,48 +21,40 @@
#include "zend.h"
#include "zend_globals.h"
-#ifndef ZEND_DEBUG_INTERNED_STRINGS
-# define ZEND_DEBUG_INTERNED_STRINGS 0
-#endif
-
-#if ZEND_DEBUG_INTERNED_STRINGS
-# include <sys/mman.h>
-#endif
-
-ZEND_API const char *(*zend_new_interned_string)(const char *str, int len, int free_src TSRMLS_DC);
+ZEND_API zend_string *(*zend_new_interned_string)(zend_string *str TSRMLS_DC);
ZEND_API void (*zend_interned_strings_snapshot)(TSRMLS_D);
ZEND_API void (*zend_interned_strings_restore)(TSRMLS_D);
-static const char *zend_new_interned_string_int(const char *str, int len, int free_src TSRMLS_DC);
+static zend_string *zend_new_interned_string_int(zend_string *str TSRMLS_DC);
static void zend_interned_strings_snapshot_int(TSRMLS_D);
static void zend_interned_strings_restore_int(TSRMLS_D);
+ZEND_API zend_ulong zend_hash_func(const char *str, uint len)
+{
+ return zend_inline_hash_func(str, len);
+}
+
void zend_interned_strings_init(TSRMLS_D)
{
#ifndef ZTS
- size_t size = 1024 * 1024;
-
-#if ZEND_DEBUG_INTERNED_STRINGS
- CG(interned_strings_start) = valloc(size);
-#else
- CG(interned_strings_start) = malloc(size);
-#endif
-
- CG(interned_strings_top) = CG(interned_strings_start);
- CG(interned_strings_snapshot_top) = CG(interned_strings_start);
- CG(interned_strings_end) = CG(interned_strings_start) + size;
+ zend_string *str;
zend_hash_init(&CG(interned_strings), 0, NULL, NULL, 1);
CG(interned_strings).nTableMask = CG(interned_strings).nTableSize - 1;
- CG(interned_strings).arBuckets = (Bucket **) pecalloc(CG(interned_strings).nTableSize, sizeof(Bucket *), CG(interned_strings).persistent);
-
-#if ZEND_DEBUG_INTERNED_STRINGS
- mprotect(CG(interned_strings_start), CG(interned_strings_end) - CG(interned_strings_start), PROT_READ);
-#endif
-
- /* interned empty string */
- CG(interned_empty_string) = zend_new_interned_string_int("", sizeof(""), 0 TSRMLS_CC);
+ CG(interned_strings).arData = (Bucket*) pecalloc(CG(interned_strings).nTableSize, sizeof(Bucket), CG(interned_strings).flags & HASH_FLAG_PERSISTENT);
+ CG(interned_strings).arHash = (zend_uint*) pecalloc(CG(interned_strings).nTableSize, sizeof(zend_uint), CG(interned_strings).flags & HASH_FLAG_PERSISTENT);
+ memset(CG(interned_strings).arHash, INVALID_IDX, CG(interned_strings).nTableSize * sizeof(zend_uint));
+
+ /* interned empty string */
+ str = STR_ALLOC(sizeof("")-1, 1);
+ str->val[0] = '\000';
+ CG(empty_string) = zend_new_interned_string_int(str TSRMLS_CC);
+#else
+ str = STR_ALLOC(sizeof("")-1, 1);
+ str->val[0] = '\000';
+ str->gc.u.v.flags |= IS_STR_INTERNED;
+ CG(empty_string) = str;
#endif
zend_new_interned_string = zend_new_interned_string_int;
@@ -73,94 +65,68 @@ void zend_interned_strings_init(TSRMLS_D)
void zend_interned_strings_dtor(TSRMLS_D)
{
#ifndef ZTS
-#if ZEND_DEBUG_INTERNED_STRINGS
- mprotect(CG(interned_strings_start), CG(interned_strings_end) - CG(interned_strings_start), PROT_WRITE | PROT_READ);
-#endif
- free(CG(interned_strings).arBuckets);
- free(CG(interned_strings_start));
+ free(CG(interned_strings).arData);
+ free(CG(interned_strings).arHash);
#endif
}
-static const char *zend_new_interned_string_int(const char *arKey, int nKeyLength, int free_src TSRMLS_DC)
+static zend_string *zend_new_interned_string_int(zend_string *str TSRMLS_DC)
{
#ifndef ZTS
ulong h;
uint nIndex;
+ uint idx;
Bucket *p;
- if (IS_INTERNED(arKey)) {
- return arKey;
+ if (IS_INTERNED(str)) {
+ return str;
}
- h = zend_inline_hash_func(arKey, nKeyLength);
+ h = STR_HASH_VAL(str);
nIndex = h & CG(interned_strings).nTableMask;
- p = CG(interned_strings).arBuckets[nIndex];
- while (p != NULL) {
- if ((p->h == h) && (p->nKeyLength == nKeyLength)) {
- if (!memcmp(p->arKey, arKey, nKeyLength)) {
- if (free_src) {
- efree((void *)arKey);
- }
- return p->arKey;
+ idx = CG(interned_strings).arHash[nIndex];
+ while (idx != INVALID_IDX) {
+ p = CG(interned_strings).arData + idx;
+ if ((p->h == h) && (p->key->len == str->len)) {
+ if (!memcmp(p->key->val, str->val, str->len)) {
+//??? if (free_src) {
+//??? efree((void *)arKey);
+//??? }
+ return p->key;
}
}
- p = p->pNext;
- }
-
- if (CG(interned_strings_top) + ZEND_MM_ALIGNED_SIZE(sizeof(Bucket) + nKeyLength) >=
- CG(interned_strings_end)) {
- /* no memory */
- return arKey;
+ idx = p->val.u.next;
}
-
- p = (Bucket *) CG(interned_strings_top);
- CG(interned_strings_top) += ZEND_MM_ALIGNED_SIZE(sizeof(Bucket) + nKeyLength);
-
-#if ZEND_DEBUG_INTERNED_STRINGS
- mprotect(CG(interned_strings_start), CG(interned_strings_end) - CG(interned_strings_start), PROT_READ | PROT_WRITE);
-#endif
- p->arKey = (char*)(p+1);
- memcpy((char*)p->arKey, arKey, nKeyLength);
- if (free_src) {
- efree((void *)arKey);
- }
- p->nKeyLength = nKeyLength;
- p->h = h;
- p->pData = &p->pDataPtr;
- p->pDataPtr = p;
+ str->gc.refcount = 1;
+// str->gc.u.v.type = IS_INTERNED_STRING;
+ str->gc.u.v.flags |= IS_STR_INTERNED;
+
+//??? if (CG(interned_strings_top) + ZEND_MM_ALIGNED_SIZE(sizeof(Bucket) + nKeyLength) >=
+//??? CG(interned_strings_end)) {
+//??? /* no memory */
+//??? return arKey;
+//??? }
+
+//??? info = (zend_string_info*) CG(interned_strings_top);
+//??? CG(interned_strings_top) += ZEND_MM_ALIGNED_SIZE(sizeof(zend_string_info) + nKeyLength);
+
+//??? memcpy((char*)(info+1), arKey, nKeyLength);
+//??? if (free_src) {
+//??? efree((void *)arKey);
+//??? }
+//??? info->nKeyLength = nKeyLength;
+//??? info->h = h;
- p->pNext = CG(interned_strings).arBuckets[nIndex];
- p->pLast = NULL;
- if (p->pNext) {
- p->pNext->pLast = p;
- }
-
- HANDLE_BLOCK_INTERRUPTIONS();
-
- p->pListLast = CG(interned_strings).pListTail;
- CG(interned_strings).pListTail = p;
- p->pListNext = NULL;
- if (p->pListLast != NULL) {
- p->pListLast->pListNext = p;
- }
- if (!CG(interned_strings).pListHead) {
- CG(interned_strings).pListHead = p;
- }
-
- CG(interned_strings).arBuckets[nIndex] = p;
-
- HANDLE_UNBLOCK_INTERRUPTIONS();
-
- CG(interned_strings).nNumOfElements++;
-
- if (CG(interned_strings).nNumOfElements > CG(interned_strings).nTableSize) {
+ if (CG(interned_strings).nNumUsed >= CG(interned_strings).nTableSize) {
if ((CG(interned_strings).nTableSize << 1) > 0) { /* Let's double the table size */
- Bucket **t = (Bucket **) perealloc_recoverable(CG(interned_strings).arBuckets, (CG(interned_strings).nTableSize << 1) * sizeof(Bucket *), CG(interned_strings).persistent);
+ Bucket *d = (Bucket *) perealloc_recoverable(CG(interned_strings).arData, (CG(interned_strings).nTableSize << 1) * sizeof(Bucket), CG(interned_strings).flags & HASH_FLAG_PERSISTENT);
+ zend_uint *h = (zend_uint *) perealloc_recoverable(CG(interned_strings).arHash, (CG(interned_strings).nTableSize << 1) * sizeof(zend_uint), CG(interned_strings).flags & HASH_FLAG_PERSISTENT);
- if (t) {
+ if (d && h) {
HANDLE_BLOCK_INTERRUPTIONS();
- CG(interned_strings).arBuckets = t;
+ CG(interned_strings).arData = d;
+ CG(interned_strings).arHash = h;
CG(interned_strings).nTableSize = (CG(interned_strings).nTableSize << 1);
CG(interned_strings).nTableMask = CG(interned_strings).nTableSize - 1;
zend_hash_rehash(&CG(interned_strings));
@@ -169,60 +135,68 @@ static const char *zend_new_interned_string_int(const char *arKey, int nKeyLengt
}
}
-#if ZEND_DEBUG_INTERNED_STRINGS
- mprotect(CG(interned_strings_start), CG(interned_strings_end) - CG(interned_strings_start), PROT_READ);
-#endif
+ HANDLE_BLOCK_INTERRUPTIONS();
+
+ idx = CG(interned_strings).nNumUsed++;
+ CG(interned_strings).nNumOfElements++;
+ p = CG(interned_strings).arData + idx;
+ p->h = h;
+ p->key = str;
+ Z_STR(p->val) = str;
+ Z_TYPE(p->val) = IS_STRING;
+ nIndex = h & CG(interned_strings).nTableMask;
+ p->val.u.next = CG(interned_strings).arHash[nIndex];
+ CG(interned_strings).arHash[nIndex] = idx;
+
+ HANDLE_UNBLOCK_INTERRUPTIONS();
- return p->arKey;
+ return str;
#else
- return arKey;
+ return str;
#endif
}
static void zend_interned_strings_snapshot_int(TSRMLS_D)
{
- CG(interned_strings_snapshot_top) = CG(interned_strings_top);
+#ifndef ZTS
+ uint idx;
+ Bucket *p;
+
+ idx = CG(interned_strings).nNumUsed;
+ while (idx > 0) {
+ idx--;
+ p = CG(interned_strings).arData + idx;
+ p->key->gc.u.v.flags |= IS_STR_PERMANENT;
+ }
+#endif
}
static void zend_interned_strings_restore_int(TSRMLS_D)
{
#ifndef ZTS
+ uint nIndex;
+ uint idx;
Bucket *p;
- int i;
-#endif
-
- CG(interned_strings_top) = CG(interned_strings_snapshot_top);
-
-#ifndef ZTS
-#if ZEND_DEBUG_INTERNED_STRINGS
- mprotect(CG(interned_strings_start), CG(interned_strings_end) - CG(interned_strings_start), PROT_WRITE | PROT_READ);
-#endif
- for (i = 0; i < CG(interned_strings).nTableSize; i++) {
- p = CG(interned_strings).arBuckets[i];
- while (p && p->arKey > CG(interned_strings_top)) {
- CG(interned_strings).nNumOfElements--;
- if (p->pListLast != NULL) {
- p->pListLast->pListNext = p->pListNext;
- } else {
- CG(interned_strings).pListHead = p->pListNext;
- }
- if (p->pListNext != NULL) {
- p->pListNext->pListLast = p->pListLast;
- } else {
- CG(interned_strings).pListTail = p->pListLast;
- }
- p = p->pNext;
- }
- if (p) {
- p->pLast = NULL;
- }
- CG(interned_strings).arBuckets[i] = p;
- }
-
-#if ZEND_DEBUG_INTERNED_STRINGS
- mprotect(CG(interned_strings_start), CG(interned_strings_end) - CG(interned_strings_start), PROT_READ);
-#endif
+ idx = CG(interned_strings).nNumUsed;
+ while (idx > 0) {
+ idx--;
+ p = CG(interned_strings).arData + idx;
+ if (!(p->key->gc.u.v.flags & IS_STR_PERMANENT)) break;
+ CG(interned_strings).nNumUsed--;
+ CG(interned_strings).nNumOfElements--;
+
+ nIndex = p->h & CG(interned_strings).nTableMask;
+ if (CG(interned_strings).arHash[nIndex] == idx) {
+ CG(interned_strings).arHash[nIndex] = p->val.u.next;
+ } else {
+ uint prev = CG(interned_strings).arHash[nIndex];
+ while (CG(interned_strings).arData[prev].val.u.next != idx) {
+ prev = CG(interned_strings).arData[prev].val.u.next;
+ }
+ CG(interned_strings).arData[prev].val.u.next = p->val.u.next;
+ }
+ }
#endif
}
diff --git a/Zend/zend_string.h b/Zend/zend_string.h
index 978426e7c5..ca13e8aec3 100644
--- a/Zend/zend_string.h
+++ b/Zend/zend_string.h
@@ -24,70 +24,211 @@
#include "zend.h"
BEGIN_EXTERN_C()
-ZEND_API extern const char *(*zend_new_interned_string)(const char *str, int len, int free_src TSRMLS_DC);
+
+ZEND_API extern zend_string *(*zend_new_interned_string)(zend_string *str TSRMLS_DC);
ZEND_API extern void (*zend_interned_strings_snapshot)(TSRMLS_D);
ZEND_API extern void (*zend_interned_strings_restore)(TSRMLS_D);
+ZEND_API zend_ulong zend_hash_func(const char *str, uint len);
void zend_interned_strings_init(TSRMLS_D);
void zend_interned_strings_dtor(TSRMLS_D);
+
END_EXTERN_C()
#ifndef ZTS
+# define IS_INTERNED(s) ((s)->gc.u.v.flags & IS_STR_INTERNED)
+#else
+# define IS_INTERNED(s) 0
+#endif
-#define IS_INTERNED(s) \
- (((s) >= CG(interned_strings_start)) && ((s) < CG(interned_strings_end)))
+#define STR_HASH_VAL(s) zend_str_hash_val(s)
+#define STR_FORGET_HASH_VAL(s) zend_str_forget_hash_val(s)
+
+#define STR_REFCOUNT(s) zend_str_refcount(s)
+#define STR_ADDREF(s) zend_str_addref(s)
+#define STR_DELREF(s) zend_str_delref(s)
+#define STR_ALLOC(len, persistent) zend_str_alloc(len, persistent)
+#define STR_INIT(str, len, persistent) zend_str_init(str, len, persistent)
+#define STR_COPY(s) zend_str_copy(s)
+#define STR_DUP(s, persistent) zend_str_dup(s, persistent)
+#define STR_EREALLOC(s, len) zend_str_erealloc(s, len)
+#define STR_FREE(s) zend_str_free(s)
+#define STR_RELEASE(s) zend_str_release(s)
+#define STR_EMPTY_ALLOC() CG(empty_string)
+
+static zend_always_inline zend_ulong zend_str_hash_val(zend_string *s)
+{
+ if (!s->h) {
+ s->h = zend_hash_func(s->val, s->len + 1);
+ }
+ return s->h;
+}
-#else
+static zend_always_inline void zend_str_forget_hash_val(zend_string *s)
+{
+ s->h = 0;
+}
-#define IS_INTERNED(s) \
- (0)
+static zend_always_inline zend_uint zend_str_refcount(zend_string *s)
+{
+ if (!IS_INTERNED(s)) {
+ return s->gc.refcount;
+ }
+ return 1;
+}
-#endif
+static zend_always_inline zend_uint zend_str_addref(zend_string *s)
+{
+ if (!IS_INTERNED(s)) {
+ return ++s->gc.refcount;
+ }
+ return 1;
+}
+
+static zend_always_inline zend_uint zend_str_delref(zend_string *s)
+{
+ if (!IS_INTERNED(s)) {
+ return --s->gc.refcount;
+ }
+ return 1;
+}
+
+static zend_always_inline zend_string *zend_str_alloc(int len, int persistent)
+{
+ zend_string *ret = pemalloc(sizeof(zend_string) + len, persistent);
+
+ ret->gc.refcount = 1;
+ ret->gc.u.v.type = IS_STRING;
+ ret->gc.u.v.flags = (persistent ? IS_STR_PERSISTENT : 0);
+ ret->h = 0;
+ ret->len = len;
+ return ret;
+}
+
+static zend_always_inline zend_string *zend_str_init(const char *str, int len, int persistent)
+{
+ zend_string *ret = STR_ALLOC(len, persistent);
+
+ memcpy(ret, str, len + 1);
+ return ret;
+}
+
+static zend_always_inline zend_string *zend_str_copy(zend_string *s)
+{
+ if (!IS_INTERNED(s)) {
+ STR_ADDREF(s);
+ }
+ return s;
+}
+
+static zend_always_inline zend_string *zend_str_dup(zend_string *s, int persistent)
+{
+ if (IS_INTERNED(s)) {
+ return s;
+ } else {
+ return STR_INIT(s->val, s->len, persistent);
+ }
+}
-#define INTERNED_LEN(s) \
- (((Bucket*)(((char*)(s))-sizeof(Bucket)))->nKeyLength)
-
-#define INTERNED_HASH(s) \
- (((Bucket*)(((char*)(s))-sizeof(Bucket)))->h)
-
-#define str_efree(s) do { \
- if (!IS_INTERNED(s)) { \
- efree((char*)s); \
- } \
- } while (0)
-
-#define str_efree_rel(s) do { \
- if (!IS_INTERNED(s)) { \
- efree_rel((char *)s); \
- } \
- } while (0)
-
-#define str_free(s) do { \
- if (!IS_INTERNED(s)) { \
- free((char*)s); \
- } \
- } while (0)
-
-#define str_erealloc(str, new_len) \
- (IS_INTERNED(str) \
- ? _str_erealloc(str, new_len, INTERNED_LEN(str)) \
- : erealloc(str, new_len))
-
-static inline char *_str_erealloc(char *str, size_t new_len, size_t old_len) {
- char *buf = (char *) emalloc(new_len);
- memcpy(buf, str, old_len);
- return buf;
+static zend_always_inline zend_string *zend_str_erealloc(zend_string *s, int len)
+{
+ zend_string *ret;
+
+ if (IS_INTERNED(s)) {
+ ret = STR_ALLOC(len, 0);
+ memcpy(ret->val, s->val, (len > s->len ? s->len : len) + 1);
+ } else if (STR_REFCOUNT(s) == 1) {
+ ret = erealloc(s, sizeof(zend_string) + len);
+ ret->len = len;
+ STR_FORGET_HASH_VAL(ret);
+ } else {
+ ret = STR_ALLOC(len, 0);
+ memcpy(ret->val, s->val, (len > s->len ? s->len : len) + 1);
+ STR_DELREF(s);
+ }
+ return ret;
}
-#define str_estrndup(str, len) \
- (IS_INTERNED(str) ? (str) : estrndup((str), (len)))
+static zend_always_inline void zend_str_free(zend_string *s)
+{
+ if (!IS_INTERNED(s)) {
+ pefree(s, s->gc.u.v.flags & IS_STR_PERSISTENT);
+ }
+}
-#define str_strndup(str, len) \
- (IS_INTERNED(str) ? (str) : zend_strndup((str), (len)));
+static zend_always_inline void zend_str_release(zend_string *s)
+{
+ if (!IS_INTERNED(s)) {
+ if (STR_DELREF(s) == 0) {
+ STR_FREE(s);
+ }
+ }
+}
-#define str_hash(str, len) \
- (IS_INTERNED(str) ? INTERNED_HASH(str) : zend_hash_func((str), (len)+1))
+/*
+ * DJBX33A (Daniel J. Bernstein, Times 33 with Addition)
+ *
+ * This is Daniel J. Bernstein's popular `times 33' hash function as
+ * posted by him years ago on comp.lang.c. It basically uses a function
+ * like ``hash(i) = hash(i-1) * 33 + str[i]''. This is one of the best
+ * known hash functions for strings. Because it is both computed very
+ * fast and distributes very well.
+ *
+ * The magic of number 33, i.e. why it works better than many other
+ * constants, prime or not, has never been adequately explained by
+ * anyone. So I try an explanation: if one experimentally tests all
+ * multipliers between 1 and 256 (as RSE did now) one detects that even
+ * numbers are not useable at all. The remaining 128 odd numbers
+ * (except for the number 1) work more or less all equally well. They
+ * all distribute in an acceptable way and this way fill a hash table
+ * with an average percent of approx. 86%.
+ *
+ * If one compares the Chi^2 values of the variants, the number 33 not
+ * even has the best value. But the number 33 and a few other equally
+ * good numbers like 17, 31, 63, 127 and 129 have nevertheless a great
+ * advantage to the remaining numbers in the large set of possible
+ * multipliers: their multiply operation can be replaced by a faster
+ * operation based on just one shift plus either a single addition
+ * or subtraction operation. And because a hash function has to both
+ * distribute good _and_ has to be very fast to compute, those few
+ * numbers should be preferred and seems to be the reason why Daniel J.
+ * Bernstein also preferred it.
+ *
+ *
+ * -- Ralf S. Engelschall <rse@engelschall.com>
+ */
+
+static inline ulong zend_inline_hash_func(const char *str, uint len)
+{
+ register ulong hash = 5381;
+
+ /* variant with the hash unrolled eight times */
+ for (; len >= 8; len -= 8) {
+ hash = ((hash << 5) + hash) + *str++;
+ hash = ((hash << 5) + hash) + *str++;
+ hash = ((hash << 5) + hash) + *str++;
+ hash = ((hash << 5) + hash) + *str++;
+ hash = ((hash << 5) + hash) + *str++;
+ hash = ((hash << 5) + hash) + *str++;
+ hash = ((hash << 5) + hash) + *str++;
+ hash = ((hash << 5) + hash) + *str++;
+ }
+ switch (len) {
+ case 7: hash = ((hash << 5) + hash) + *str++; /* fallthrough... */
+ case 6: hash = ((hash << 5) + hash) + *str++; /* fallthrough... */
+ case 5: hash = ((hash << 5) + hash) + *str++; /* fallthrough... */
+ case 4: hash = ((hash << 5) + hash) + *str++; /* fallthrough... */
+ case 3: hash = ((hash << 5) + hash) + *str++; /* fallthrough... */
+ case 2: hash = ((hash << 5) + hash) + *str++; /* fallthrough... */
+ case 1: hash = ((hash << 5) + hash) + *str++; break;
+ case 0: break;
+EMPTY_SWITCH_DEFAULT_CASE()
+ }
+ return hash;
+}
+//???#define str_estrndup(str, len) (IS_INTERNED(str) ? (str) : estrndup((str), (len)))
+//???#define str_strndup(str, len) (IS_INTERNED(str) ? (str) : zend_strndup((str), (len)));
#endif /* ZEND_STRING_H */
diff --git a/Zend/zend_ts_hash.c b/Zend/zend_ts_hash.c
index 100bcf188d..776f728718 100644
--- a/Zend/zend_ts_hash.c
+++ b/Zend/zend_ts_hash.c
@@ -99,45 +99,34 @@ ZEND_API void zend_ts_hash_clean(TsHashTable *ht)
end_write(ht);
}
-ZEND_API int _zend_ts_hash_add_or_update(TsHashTable *ht, char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC)
+ZEND_API zval *_zend_ts_hash_add_or_update(TsHashTable *ht, zend_string *key, zval *pData, int flag ZEND_FILE_LINE_DC)
{
- int retval;
+ zval *retval;
begin_write(ht);
- retval = _zend_hash_add_or_update(TS_HASH(ht), arKey, nKeyLength, pData, nDataSize, pDest, flag ZEND_FILE_LINE_RELAY_CC);
+ retval = _zend_hash_add_or_update(TS_HASH(ht), key, pData, flag ZEND_FILE_LINE_RELAY_CC);
end_write(ht);
return retval;
}
-ZEND_API int _zend_ts_hash_quick_add_or_update(TsHashTable *ht, char *arKey, uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC)
+ZEND_API zval *_zend_ts_hash_index_update_or_next_insert(TsHashTable *ht, ulong h, zval *pData, int flag ZEND_FILE_LINE_DC)
{
- int retval;
+ zval *retval;
begin_write(ht);
- retval = _zend_hash_quick_add_or_update(TS_HASH(ht), arKey, nKeyLength, h, pData, nDataSize, pDest, flag ZEND_FILE_LINE_RELAY_CC);
+ retval = _zend_hash_index_update_or_next_insert(TS_HASH(ht), h, pData, flag ZEND_FILE_LINE_RELAY_CC);
end_write(ht);
return retval;
}
-ZEND_API int _zend_ts_hash_index_update_or_next_insert(TsHashTable *ht, ulong h, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC)
+ZEND_API zval *zend_ts_hash_add_empty_element(TsHashTable *ht, zend_string *key)
{
- int retval;
+ zval *retval;
begin_write(ht);
- retval = _zend_hash_index_update_or_next_insert(TS_HASH(ht), h, pData, nDataSize, pDest, flag ZEND_FILE_LINE_RELAY_CC);
- end_write(ht);
-
- return retval;
-}
-
-ZEND_API int zend_ts_hash_add_empty_element(TsHashTable *ht, char *arKey, uint nKeyLength)
-{
- int retval;
-
- begin_write(ht);
- retval = zend_hash_add_empty_element(TS_HASH(ht), arKey, nKeyLength);
+ retval = zend_hash_add_empty_element(TS_HASH(ht), key);
end_write(ht);
return retval;
@@ -187,67 +176,56 @@ ZEND_API void zend_ts_hash_reverse_apply(TsHashTable *ht, apply_func_t apply_fun
end_write(ht);
}
-ZEND_API int zend_ts_hash_del_key_or_index(TsHashTable *ht, char *arKey, uint nKeyLength, ulong h, int flag)
+ZEND_API int zend_ts_hash_del(TsHashTable *ht, zend_string *key)
{
int retval;
begin_write(ht);
- retval = zend_hash_del_key_or_index(TS_HASH(ht), arKey, nKeyLength, h, flag);
+ retval = zend_hash_del(TS_HASH(ht), key);
end_write(ht);
return retval;
}
-ZEND_API ulong zend_ts_get_hash_value(TsHashTable *ht, char *arKey, uint nKeyLength)
-{
- ulong retval;
-
- begin_read(ht);
- retval = zend_get_hash_value(arKey, nKeyLength);
- end_read(ht);
-
- return retval;
-}
-
-ZEND_API int zend_ts_hash_find(TsHashTable *ht, char *arKey, uint nKeyLength, void **pData)
+ZEND_API int zend_ts_hash_index_del(TsHashTable *ht, ulong h)
{
int retval;
- begin_read(ht);
- retval = zend_hash_find(TS_HASH(ht), arKey, nKeyLength, pData);
- end_read(ht);
+ begin_write(ht);
+ retval = zend_hash_index_del(TS_HASH(ht), h);
+ end_write(ht);
return retval;
}
-ZEND_API int zend_ts_hash_quick_find(TsHashTable *ht, char *arKey, uint nKeyLength, ulong h, void **pData)
+ZEND_API zval *zend_ts_hash_find(TsHashTable *ht, zend_string *key)
{
- int retval;
+ zval *retval;
begin_read(ht);
- retval = zend_hash_quick_find(TS_HASH(ht), arKey, nKeyLength, h, pData);
+ retval = zend_hash_find(TS_HASH(ht), key);
end_read(ht);
return retval;
}
-ZEND_API int zend_ts_hash_index_find(TsHashTable *ht, ulong h, void **pData)
+ZEND_API zval *zend_ts_hash_index_find(TsHashTable *ht, ulong h)
{
- int retval;
+ zval *retval;
begin_read(ht);
- retval = zend_hash_index_find(TS_HASH(ht), h, pData);
+ retval = zend_hash_index_find(TS_HASH(ht), h);
end_read(ht);
return retval;
}
-ZEND_API int zend_ts_hash_exists(TsHashTable *ht, char *arKey, uint nKeyLength)
+ZEND_API int zend_ts_hash_exists(TsHashTable *ht, zend_string *key)
{
int retval;
begin_read(ht);
- retval = zend_hash_exists(TS_HASH(ht), arKey, nKeyLength);
+ retval = zend_hash_exists(TS_HASH(ht), key);
end_read(ht);
return retval;
@@ -264,36 +242,36 @@ ZEND_API int zend_ts_hash_index_exists(TsHashTable *ht, ulong h)
return retval;
}
-ZEND_API void zend_ts_hash_copy(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size)
+ZEND_API void zend_ts_hash_copy(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor)
{
begin_read(source);
begin_write(target);
- zend_hash_copy(TS_HASH(target), TS_HASH(source), pCopyConstructor, tmp, size);
+ zend_hash_copy(TS_HASH(target), TS_HASH(source), pCopyConstructor);
end_write(target);
end_read(source);
}
-ZEND_API void zend_ts_hash_copy_to_hash(HashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size)
+ZEND_API void zend_ts_hash_copy_to_hash(HashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor)
{
begin_read(source);
- zend_hash_copy(target, TS_HASH(source), pCopyConstructor, tmp, size);
+ zend_hash_copy(target, TS_HASH(source), pCopyConstructor);
end_read(source);
}
-ZEND_API void zend_ts_hash_merge(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size, int overwrite)
+ZEND_API void zend_ts_hash_merge(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor, int overwrite)
{
begin_read(source);
begin_write(target);
- zend_hash_merge(TS_HASH(target), TS_HASH(source), pCopyConstructor, tmp, size, overwrite);
+ zend_hash_merge(TS_HASH(target), TS_HASH(source), pCopyConstructor, overwrite);
end_write(target);
end_read(source);
}
-ZEND_API void zend_ts_hash_merge_ex(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor, uint size, merge_checker_func_t pMergeSource, void *pParam)
+ZEND_API void zend_ts_hash_merge_ex(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor, merge_checker_func_t pMergeSource, void *pParam)
{
begin_read(source);
begin_write(target);
- zend_hash_merge_ex(TS_HASH(target), TS_HASH(source), pCopyConstructor, size, pMergeSource, pParam);
+ zend_hash_merge_ex(TS_HASH(target), TS_HASH(source), pCopyConstructor, pMergeSource, pParam);
end_write(target);
end_read(source);
}
@@ -322,12 +300,12 @@ ZEND_API int zend_ts_hash_compare(TsHashTable *ht1, TsHashTable *ht2, compare_fu
return retval;
}
-ZEND_API int zend_ts_hash_minmax(TsHashTable *ht, compare_func_t compar, int flag, void **pData TSRMLS_DC)
+ZEND_API zval *zend_ts_hash_minmax(TsHashTable *ht, compare_func_t compar, int flag TSRMLS_DC)
{
- int retval;
+ zval *retval;
begin_read(ht);
- retval = zend_hash_minmax(TS_HASH(ht), compar, flag, pData TSRMLS_CC);
+ retval = zend_hash_minmax(TS_HASH(ht), compar, flag TSRMLS_CC);
end_read(ht);
return retval;
@@ -355,22 +333,6 @@ ZEND_API int zend_ts_hash_rehash(TsHashTable *ht)
return retval;
}
-#if ZEND_DEBUG
-void zend_ts_hash_display_pListTail(TsHashTable *ht)
-{
- begin_read(ht);
- zend_hash_display_pListTail(TS_HASH(ht));
- end_read(ht);
-}
-
-void zend_ts_hash_display(TsHashTable *ht)
-{
- begin_read(ht);
- zend_hash_display(TS_HASH(ht));
- end_read(ht);
-}
-#endif
-
/*
* Local variables:
* tab-width: 4
diff --git a/Zend/zend_ts_hash.h b/Zend/zend_ts_hash.h
index e46acd52bf..7394efd576 100644
--- a/Zend/zend_ts_hash.h
+++ b/Zend/zend_ts_hash.h
@@ -49,25 +49,19 @@ ZEND_API void zend_ts_hash_clean(TsHashTable *ht);
/* additions/updates/changes */
-ZEND_API int _zend_ts_hash_add_or_update(TsHashTable *ht, char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC);
-#define zend_ts_hash_update(ht, arKey, nKeyLength, pData, nDataSize, pDest) \
- _zend_ts_hash_add_or_update(ht, arKey, nKeyLength, pData, nDataSize, pDest, HASH_UPDATE ZEND_FILE_LINE_CC)
-#define zend_ts_hash_add(ht, arKey, nKeyLength, pData, nDataSize, pDest) \
- _zend_ts_hash_add_or_update(ht, arKey, nKeyLength, pData, nDataSize, pDest, HASH_ADD ZEND_FILE_LINE_CC)
-
-ZEND_API int _zend_ts_hash_quick_add_or_update(TsHashTable *ht, char *arKey, uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC);
-#define zend_ts_hash_quick_update(ht, arKey, nKeyLength, h, pData, nDataSize, pDest) \
- _zend_ts_hash_quick_add_or_update(ht, arKey, nKeyLength, h, pData, nDataSize, pDest, HASH_UPDATE ZEND_FILE_LINE_CC)
-#define zend_ts_hash_quick_add(ht, arKey, nKeyLength, h, pData, nDataSize, pDest) \
- _zend_ts_hash_quick_add_or_update(ht, arKey, nKeyLength, h, pData, nDataSize, pDest, HASH_ADD ZEND_FILE_LINE_CC)
-
-ZEND_API int _zend_ts_hash_index_update_or_next_insert(TsHashTable *ht, ulong h, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC);
-#define zend_ts_hash_index_update(ht, h, pData, nDataSize, pDest) \
- _zend_ts_hash_index_update_or_next_insert(ht, h, pData, nDataSize, pDest, HASH_UPDATE ZEND_FILE_LINE_CC)
-#define zend_ts_hash_next_index_insert(ht, pData, nDataSize, pDest) \
- _zend_ts_hash_index_update_or_next_insert(ht, 0, pData, nDataSize, pDest, HASH_NEXT_INSERT ZEND_FILE_LINE_CC)
-
-ZEND_API int zend_ts_hash_add_empty_element(TsHashTable *ht, char *arKey, uint nKeyLength);
+ZEND_API zval *_zend_ts_hash_add_or_update(TsHashTable *ht, zend_string *key, zval *pData, int flag ZEND_FILE_LINE_DC);
+#define zend_ts_hash_update(ht, key, pData) \
+ _zend_ts_hash_add_or_update(ht, key, pData, HASH_UPDATE ZEND_FILE_LINE_CC)
+#define zend_ts_hash_add(ht, key, pData) \
+ _zend_ts_hash_add_or_update(ht, key, pData, HASH_ADD ZEND_FILE_LINE_CC)
+
+ZEND_API zval *_zend_ts_hash_index_update_or_next_insert(TsHashTable *ht, ulong h, zval *pData, int flag ZEND_FILE_LINE_DC);
+#define zend_ts_hash_index_update(ht, h, pData) \
+ _zend_ts_hash_index_update_or_next_insert(ht, h, pData, HASH_UPDATE ZEND_FILE_LINE_CC)
+#define zend_ts_hash_next_index_insert(ht, pData) \
+ _zend_ts_hash_index_update_or_next_insert(ht, 0, pData, HASH_NEXT_INSERT ZEND_FILE_LINE_CC)
+
+ZEND_API zval* zend_ts_hash_add_empty_element(TsHashTable *ht, zend_string *key);
ZEND_API void zend_ts_hash_graceful_destroy(TsHashTable *ht);
ZEND_API void zend_ts_hash_apply(TsHashTable *ht, apply_func_t apply_func TSRMLS_DC);
@@ -78,38 +72,30 @@ ZEND_API void zend_ts_hash_reverse_apply(TsHashTable *ht, apply_func_t apply_fun
/* Deletes */
-ZEND_API int zend_ts_hash_del_key_or_index(TsHashTable *ht, char *arKey, uint nKeyLength, ulong h, int flag);
-#define zend_ts_hash_del(ht, arKey, nKeyLength) \
- zend_ts_hash_del_key_or_index(ht, arKey, nKeyLength, 0, HASH_DEL_KEY)
-#define zend_ts_hash_index_del(ht, h) \
- zend_ts_hash_del_key_or_index(ht, NULL, 0, h, HASH_DEL_INDEX)
-
-ZEND_API ulong zend_ts_get_hash_value(TsHashTable *ht, char *arKey, uint nKeyLength);
+ZEND_API int zend_ts_hash_del(TsHashTable *ht, zend_string *key);
+ZEND_API int zend_ts_hash_index_del(TsHashTable *ht, ulong h);
/* Data retreival */
-ZEND_API int zend_ts_hash_find(TsHashTable *ht, char *arKey, uint nKeyLength, void **pData);
-ZEND_API int zend_ts_hash_quick_find(TsHashTable *ht, char *arKey, uint nKeyLength, ulong h, void **pData);
-ZEND_API int zend_ts_hash_index_find(TsHashTable *ht, ulong h, void **pData);
+ZEND_API zval *zend_ts_hash_find(TsHashTable *ht, zend_string *key);
+ZEND_API zval *zend_ts_hash_index_find(TsHashTable *ht, ulong);
/* Misc */
-ZEND_API int zend_ts_hash_exists(TsHashTable *ht, char *arKey, uint nKeyLength);
+ZEND_API int zend_ts_hash_exists(TsHashTable *ht, zend_string *key);
ZEND_API int zend_ts_hash_index_exists(TsHashTable *ht, ulong h);
/* Copying, merging and sorting */
-ZEND_API void zend_ts_hash_copy(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size);
-ZEND_API void zend_ts_hash_copy_to_hash(HashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size);
-ZEND_API void zend_ts_hash_merge(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size, int overwrite);
-ZEND_API void zend_ts_hash_merge_ex(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor, uint size, merge_checker_func_t pMergeSource, void *pParam);
+ZEND_API void zend_ts_hash_copy(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor);
+ZEND_API void zend_ts_hash_copy_to_hash(HashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor);
+ZEND_API void zend_ts_hash_merge(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor, int overwrite);
+ZEND_API void zend_ts_hash_merge_ex(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor, merge_checker_func_t pMergeSource, void *pParam);
ZEND_API int zend_ts_hash_sort(TsHashTable *ht, sort_func_t sort_func, compare_func_t compare_func, int renumber TSRMLS_DC);
ZEND_API int zend_ts_hash_compare(TsHashTable *ht1, TsHashTable *ht2, compare_func_t compar, zend_bool ordered TSRMLS_DC);
-ZEND_API int zend_ts_hash_minmax(TsHashTable *ht, compare_func_t compar, int flag, void **pData TSRMLS_DC);
+ZEND_API zval *zend_ts_hash_minmax(TsHashTable *ht, compare_func_t compar, int flag TSRMLS_DC);
ZEND_API int zend_ts_hash_num_elements(TsHashTable *ht);
ZEND_API int zend_ts_hash_rehash(TsHashTable *ht);
-ZEND_API ulong zend_ts_hash_func(char *arKey, uint nKeyLength);
-
#if ZEND_DEBUG
/* debug */
void zend_ts_hash_display_pListTail(TsHashTable *ht);
diff --git a/Zend/zend_types.h b/Zend/zend_types.h
index e5d5bbb500..1f1c621882 100644
--- a/Zend/zend_types.h
+++ b/Zend/zend_types.h
@@ -50,14 +50,423 @@ typedef long zend_intptr_t;
typedef unsigned long zend_uintptr_t;
#endif
-typedef unsigned int zend_object_handle;
typedef struct _zend_object_handlers zend_object_handlers;
-typedef struct _zval_struct zval;
+typedef struct _zend_class_entry zend_class_entry;
+typedef union _zend_function zend_function;
-typedef struct _zend_object_value {
- zend_object_handle handle;
+typedef struct _zval_struct zval;
+
+typedef struct _zend_refcounted zend_refcounted;
+typedef struct _zend_string zend_string;
+typedef struct _zend_array zend_array;
+typedef struct _zend_object zend_object;
+typedef struct _zend_resource zend_resource;
+typedef struct _zend_reference zend_reference;
+typedef struct _zend_ast_ref zend_ast_ref;
+typedef struct _zend_ast zend_ast;
+typedef struct _zend_str_offset zend_str_offset;
+
+typedef void (*dtor_func_t)(zval *zv);
+
+typedef union _zend_value {
+ long lval; /* long value */
+ double dval; /* double value */
+ zend_refcounted *counted;
+ zend_string *str;
+ zend_array *arr;
+ zend_object *obj;
+ zend_resource *res;
+ zend_reference *ref;
+ zend_ast_ref *ast;
+ zval *zv;
+ void *ptr;
+ zend_class_entry *ce;
+ zend_function *func;
+ zend_str_offset *str_offset;
+} zend_value;
+
+struct _zval_struct {
+ zend_value value; /* value */
+ zend_uchar type; /* active type */
+ union {
+ zend_uint next; /* hash collision chain */
+ } u;
+};
+
+struct _zend_refcounted {
+ zend_uint refcount; /* reference counter 32-bit */
+ union {
+ struct {
+ zend_uchar type;
+ zend_uchar flags; /* used for strings & objects */
+ zend_ushort buffer; /* keeps GC root number or 0 */
+ } v;
+ zend_uint long_type;
+ } u;
+};
+
+struct _zend_string {
+ zend_refcounted gc;
+ zend_ulong h; /* hash value */
+ int len;
+ char val[1];
+};
+
+struct _zend_str_offset {
+ zend_refcounted gc;
+ zend_string *str;
+ int offset;
+};
+
+typedef struct _Bucket {
+ zend_ulong h; /* hash value (or numeric index) */
+ zend_string *key; /* string key or NULL for numerics */
+ zval val;
+} Bucket;
+
+typedef struct _HashTable {
+ zend_uint nTableSize;
+ zend_uint nTableMask;
+ zend_uint nNumUsed;
+ zend_uint nNumOfElements;
+ long nNextFreeElement;
+ Bucket *arData;
+ zend_uint *arHash;
+ dtor_func_t pDestructor;
+ zend_uint nInternalPointer;
+ zend_uchar flags;
+ zend_uchar nApplyCount;
+} HashTable;
+
+struct _zend_array {
+ zend_refcounted gc;
+ HashTable ht;
+};
+
+struct _zend_object {
+ zend_refcounted gc;
+ zend_uint handle;
+ zend_class_entry *ce;
const zend_object_handlers *handlers;
-} zend_object_value;
+ HashTable *properties;
+ HashTable *guards; /* protects from __get/__set ... recursion */
+ zval properties_table[1];
+};
+
+struct _zend_resource {
+ zend_refcounted gc;
+ long handle; //???
+ int type;
+ void *ptr;
+};
+
+struct _zend_reference {
+ zend_refcounted gc;
+ zval val;
+};
+
+struct _zend_ast_ref {
+ zend_refcounted gc;
+ zend_ast *ast;
+};
+
+/* data types */
+#define IS_UNDEF 0
+#define IS_NULL 1
+#define IS_INDIRECT 2
+#define IS_BOOL 3
+#define IS_LONG 4
+#define IS_DOUBLE 5
+//#define IS_INTERNED_STRING 6
+#define IS_STRING 7
+#define IS_ARRAY 8
+#define IS_OBJECT 9
+#define IS_RESOURCE 10
+#define IS_REFERENCE 11
+
+#define IS_CONSTANT 12
+#define IS_CONSTANT_ARRAY 13
+#define IS_CONSTANT_AST 14
+#define IS_CALLABLE 15
+
+#define IS_STR_OFFSET 16
+#define IS_PTR 17
+
+/* Ugly hack to support constants as static array indices */
+#define IS_CONSTANT_TYPE_MASK 0x00f
+#define IS_CONSTANT_UNQUALIFIED 0x010
+#define IS_CONSTANT_INDEX 0x080
+#define IS_LEXICAL_VAR 0x020
+#define IS_LEXICAL_REF 0x040
+#define IS_CONSTANT_IN_NAMESPACE 0x100
+
+#define IS_CONSTANT_TYPE(type) \
+ (((type) & IS_CONSTANT_TYPE_MASK) >= IS_CONSTANT && ((type) & IS_CONSTANT_TYPE_MASK) <= IS_CONSTANT_AST)
+
+/* All data types < IS_STRING have their constructor/destructors skipped */
+#define IS_REFCOUNTED(type) ((type) >= IS_STRING)
+
+#define Z_TYPE(zval) (zval).type
+#define Z_TYPE_P(zval_p) Z_TYPE(*(zval_p))
+
+/* string flags (zval.value->gc.u.vflags) */
+#define IS_STR_PERSISTENT (1<<0) /* allocated using malloc */
+#define IS_STR_INTERNED (1<<1) /* interned string */
+#define IS_STR_PERMANENT (1<<2) /* relives request boundary */
+
+/* string flags (zval.value->gc.u.vflags) */
+#define IS_OBJ_DESTRUCTOR_CALLED (1<<0)
+
+#define Z_REFCOUNTED(zval) IS_REFCOUNTED(Z_TYPE(zval))
+#define Z_REFCOUNTED_P(zval_p) Z_REFCOUNTED(*(zval_p))
+
+#define Z_ISREF(zval) (Z_TYPE(zval) == IS_REFERENCE)
+#define Z_ISREF_P(zval_p) Z_ISREF(*(zval_p))
+
+#define Z_BVAL(zval) (zend_bool)(zval).value.lval
+#define Z_BVAL_P(zval_p) Z_LVAL(*(zval_p))
+
+#define Z_LVAL(zval) (zval).value.lval
+#define Z_LVAL_P(zval_p) Z_LVAL(*(zval_p))
+
+#define Z_DVAL(zval) (zval).value.dval
+#define Z_DVAL_P(zval_p) Z_DVAL(*(zval_p))
+
+#define Z_COUNTED(zval) (zval).value.counted
+#define Z_COUNTED_P(zval_p) Z_COUNTED(*(zval_p))
+
+#define Z_GC_TYPE(zval) Z_COUNTED(zval)->type
+#define Z_GC_TYPE_P(zval_p) Z_GC_TYPE(*(zval_p))
+
+#define Z_GC_BUFFER(zval) Z_COUNTED(zval)->u.v.buffer
+#define Z_GC_BUFFER_P(zval_p) Z_GC_BUFFER(*(zval_p))
+
+#define Z_STR(zval) (zval).value.str
+#define Z_STR_P(zval_p) Z_STR(*(zval_p))
+
+#define Z_STRVAL(zval) Z_STR(zval)->val
+#define Z_STRVAL_P(zval_p) Z_STRVAL(*(zval_p))
+
+#define Z_STRLEN(zval) Z_STR(zval)->len
+#define Z_STRLEN_P(zval_p) Z_STRLEN(*(zval_p))
+
+#define Z_STRHASH(zval) Z_STR(zval)->h
+#define Z_STRHASH_P(zval_p) Z_STRHASH(*(zval_p))
+
+#define Z_ARR(zval) (zval).value.arr
+#define Z_ARR_P(zval_p) Z_ARR(*(zval_p))
+
+#define Z_ARRVAL(zval) (&Z_ARR(zval)->ht)
+#define Z_ARRVAL_P(zval_p) Z_ARRVAL(*(zval_p))
+
+#define Z_OBJ(zval) (zval).value.obj
+#define Z_OBJ_P(zval_p) Z_OBJ(*(zval_p))
+
+#define Z_OBJ(zval) (zval).value.obj
+#define Z_OBJ_P(zval_p) Z_OBJ(*(zval_p))
+
+#define Z_OBJ_HT(zval) Z_OBJ(zval)->handlers
+#define Z_OBJ_HT_P(zval_p) Z_OBJ_HT(*(zval_p))
+
+#define Z_OBJ_HANDLER(zval, hf) Z_OBJ_HT((zval))->hf
+#define Z_OBJ_HANDLER_P(zv_p, hf) Z_OBJ_HANDLER(*(zv_p), hf)
+
+#define Z_OBJCE(zval) zend_get_class_entry(&(zval) TSRMLS_CC)
+#define Z_OBJCE_P(zval_p) Z_OBJCE(*(zval_p))
+
+#define Z_OBJPROP(zval) Z_OBJ_HT((zval))->get_properties(&(zval) TSRMLS_CC)
+#define Z_OBJPROP_P(zval_p) Z_OBJPROP(*(zval_p))
+
+#define Z_OBJDEBUG(zval,tmp) (Z_OBJ_HANDLER((zval),get_debug_info)?Z_OBJ_HANDLER((zval),get_debug_info)(&(zval),&tmp TSRMLS_CC):(tmp=0,Z_OBJ_HANDLER((zval),get_properties)?Z_OBJPROP(zval):NULL))
+#define Z_OBJDEBUG_P(zval_p,tmp) Z_OBJDEBUG(*(zval_p), tmp)
+
+#define Z_RES(zval) (zval).value.res
+#define Z_RES_P(zval_p) Z_RES(*zval_p)
+
+#define Z_RES_HANDLE(zval) Z_RES(zval)->handle
+#define Z_RES_HANDLE_P(zval_p) Z_RES_HANDLE(*zval_p)
+
+#define Z_RES_TYPE(zval) Z_RES(zval)->type
+#define Z_RES_TYPE_P(zval_p) Z_RES_TYPE(*zval_p)
+
+#define Z_RES_VAL(zval) Z_RES(zval)->ptr
+#define Z_RES_VAL_P(zval_p) Z_RES_VAL(*zval_p)
+
+#define Z_REF(zval) (zval).value.ref
+#define Z_REF_P(zval_p) Z_REF(*(zval_p))
+
+#define Z_REFVAL(zval) &Z_REF(zval)->val
+#define Z_REFVAL_P(zval_p) Z_REFVAL(*(zval_p))
+
+#define Z_AST(zval) (zval).value.ast
+#define Z_AST_P(zval_p) Z_AST(*(zval_p))
+
+#define Z_ASTVAL(zval) (zval).value.ast->ast
+#define Z_ASTVAL_P(zval_p) Z_ASTVAL(*(zval_p))
+
+#define Z_INDIRECT(zval) (zval).value.zv
+#define Z_INDIRECT_P(zval_p) Z_INDIRECT(*(zval_p))
+
+#define Z_CE(zval) (zval).value.ce
+#define Z_CE_P(zval_p) Z_CE(*(zval_p))
+
+#define Z_FUNC(zval) (zval).value.func
+#define Z_FUNC_P(zval_p) Z_FUNC(*(zval_p))
+
+#define Z_PTR(zval) (zval).value.ptr
+#define Z_PTR_P(zval_p) Z_PTR(*(zval_p))
+
+#define Z_STR_OFFSET(zval) (zval).value.str_offset
+#define Z_STR_OFFSET_P(zval_p) Z_STR_OFFSET(*(zval_p))
+
+#define ZVAL_UNDEF(z) do { \
+ Z_TYPE_P(z) = IS_UNDEF; \
+ } while (0)
+
+#define ZVAL_NULL(z) do { \
+ Z_TYPE_P(z) = IS_NULL; \
+ } while (0)
+
+#define ZVAL_BOOL(z, b) do { \
+ zval *__z = (z); \
+ Z_LVAL_P(__z) = ((b) != 0); \
+ Z_TYPE_P(__z) = IS_BOOL; \
+ } while (0)
+
+#define ZVAL_LONG(z, l) { \
+ zval *__z = (z); \
+ Z_LVAL_P(__z) = l; \
+ Z_TYPE_P(__z) = IS_LONG; \
+ }
+
+#define ZVAL_DOUBLE(z, d) { \
+ zval *__z = (z); \
+ Z_DVAL_P(__z) = d; \
+ Z_TYPE_P(__z) = IS_DOUBLE; \
+ }
+
+#define ZVAL_STR(z, s) do { \
+ zval *__z = (z); \
+ Z_STR_P(__z) = (s); \
+ Z_TYPE_P(__z) = IS_STRING; \
+ } while (0)
+
+#define ZVAL_ARR(z, a) do { \
+ zval *__z = (z); \
+ Z_ARR_P(__z) = (a); \
+ Z_TYPE_P(__z) = IS_ARRAY; \
+ } while (0)
+
+#define ZVAL_NEW_ARR(z) do { \
+ zval *__z = (z); \
+ zend_array *_arr = emalloc(sizeof(zend_array)); \
+ _arr->gc.refcount = 1; \
+ _arr->gc.u.v.type = IS_ARRAY; \
+ _arr->gc.u.v.buffer = 0; \
+ Z_ARR_P(__z) = _arr; \
+ Z_TYPE_P(__z) = IS_ARRAY; \
+ } while (0)
+
+#define ZVAL_NEW_PERSISTENT_ARR(z) do { \
+ zval *__z = (z); \
+ zend_array *_arr = malloc(sizeof(zend_array)); \
+ _arr->gc.refcount = 1; \
+ _arr->gc.u.v.type = IS_ARRAY; \
+ _arr->gc.u.v.buffer = 0; \
+ Z_ARR_P(__z) = _arr; \
+ Z_TYPE_P(__z) = IS_ARRAY; \
+ } while (0)
+
+#define ZVAL_OBJ(z, o) do { \
+ zval *__z = (z); \
+ Z_OBJ_P(__z) = (o); \
+ Z_TYPE_P(__z) = IS_OBJECT; \
+ } while (0)
+
+#define ZVAL_RES(z, r) do { \
+ zval *__z = (z); \
+ Z_RES_P(__z) = (r); \
+ Z_TYPE_P(__z) = IS_RESOURCE; \
+ } while (0)
+
+#define ZVAL_NEW_RES(z, h, p, t) do { \
+ zend_resource *_res = emalloc(sizeof(zend_resource)); \
+ _res->gc.refcount = 1; \
+ _res->gc.u.v.type = IS_RESOURCE; \
+ _res->handle = (h); \
+ _res->type = (t); \
+ _res->ptr = (p); \
+ zval *__z = (z); \
+ Z_RES_P(__z) = _res; \
+ Z_TYPE_P(__z) = IS_RESOURCE; \
+ } while (0)
+
+#define ZVAL_NEW_PERSISTENT_RES(z, h, p, t) do { \
+ zend_resource *_res = malloc(sizeof(zend_resource)); \
+ _res->gc.refcount = 1; \
+ _res->gc.u.v.type = IS_RESOURCE; \
+ _res->handle = (h); \
+ _res->type = (t); \
+ _res->ptr = (p); \
+ zval *__z = (z); \
+ Z_RES_P(__z) = _res; \
+ Z_TYPE_P(__z) = IS_RESOURCE; \
+ } while (0)
+
+#define ZVAL_REF(z, r) do { \
+ zval *__z = (z); \
+ Z_REF_P(__z) = (r); \
+ Z_TYPE_P(__z) = IS_REFERENCE; \
+ } while (0)
+
+#define ZVAL_NEW_REF(z, r) do { \
+ zend_reference *_ref = emalloc(sizeof(zend_reference)); \
+ _ref->gc.refcount = 1; \
+ _ref->gc.u.v.type = IS_REFERENCE; \
+ _ref->val = *(r); \
+ Z_REF_P(z) = _ref; \
+ Z_TYPE_P(z) = IS_REFERENCE; \
+ } while (0)
+
+#define ZVAL_NEW_AST(z, a) do { \
+ zval *__z = (z); \
+ zend_ast_ref *_ast = emalloc(sizeof(zend_ast_ref)); \
+ _ast->gc.refcount = 1; \
+ _ast->gc.u.v.type = IS_CONSTANT_AST; \
+ _ast->ast = (a); \
+ Z_AST_P(__z) = _ast; \
+ Z_TYPE_P(__z) = IS_CONSTANT_AST; \
+ } while (0)
+
+#define ZVAL_INDIRECT(z, v) do { \
+ Z_INDIRECT_P(z) = (v); \
+ Z_TYPE_P(z) = IS_INDIRECT; \
+ } while (0)
+
+#define ZVAL_PTR(z, p) do { \
+ Z_PTR_P(z) = (p); \
+ Z_TYPE_P(z) = IS_PTR; \
+ } while (0)
+
+#define ZVAL_FUNC(z, f) do { \
+ Z_FUNC_P(z) = (f); \
+ Z_TYPE_P(z) = IS_PTR; \
+ } while (0)
+
+#define ZVAL_CE(z, c) do { \
+ Z_CE_P(z) = (c); \
+ Z_TYPE_P(z) = IS_PTR; \
+ } while (0)
+
+#define ZVAL_STR_OFFSET(z, s, o) do { \
+ zend_str_offset *x = emalloc(sizeof(zend_str_offset)); \
+ x->gc.refcount = 1; \
+ x->gc.u.v.type = IS_STR_OFFSET; \
+ x->str = (s); \
+ x->offset = (o); \
+ Z_STR_OFFSET_P(z) = x; \
+ Z_TYPE_P(z) = IS_STR_OFFSET; \
+ } while (0)
#endif /* ZEND_TYPES_H */
diff --git a/Zend/zend_variables.c b/Zend/zend_variables.c
index a18591fdf7..ea31bd5708 100644
--- a/Zend/zend_variables.c
+++ b/Zend/zend_variables.c
@@ -27,43 +27,46 @@
#include "zend_constants.h"
#include "zend_list.h"
-
ZEND_API void _zval_dtor_func(zval *zvalue ZEND_FILE_LINE_DC)
{
switch (Z_TYPE_P(zvalue) & IS_CONSTANT_TYPE_MASK) {
case IS_STRING:
case IS_CONSTANT:
CHECK_ZVAL_STRING_REL(zvalue);
- str_efree_rel(zvalue->value.str.val);
+ STR_FREE(Z_STR_P(zvalue));
break;
case IS_ARRAY:
case IS_CONSTANT_ARRAY: {
TSRMLS_FETCH();
- if (zvalue->value.ht && (zvalue->value.ht != &EG(symbol_table))) {
+//??? if (zvalue->value.ht && (zvalue->value.ht != &EG(symbol_table))) {
/* break possible cycles */
Z_TYPE_P(zvalue) = IS_NULL;
- zend_hash_destroy(zvalue->value.ht);
- FREE_HASHTABLE(zvalue->value.ht);
- }
+ zend_hash_destroy(Z_ARRVAL_P(zvalue));
+ FREE_HASHTABLE(Z_ARR_P(zvalue));
+//??? }
}
break;
case IS_CONSTANT_AST:
- zend_ast_destroy(Z_AST_P(zvalue));
+ zend_ast_destroy(Z_AST_P(zvalue)->ast);
break;
case IS_OBJECT:
{
TSRMLS_FETCH();
- Z_OBJ_HT_P(zvalue)->del_ref(zvalue TSRMLS_CC);
+ if (Z_DELREF_P(zvalue) == 0) {
+ // TODO: release object???
+ }
}
break;
case IS_RESOURCE:
{
TSRMLS_FETCH();
- /* destroy resource */
- zend_list_delete(zvalue->value.lval);
+ if (Z_DELREF_P(zvalue) == 0) {
+ /* destroy resource */
+ zend_list_delete(Z_RES_P(zvalue));
+ }
}
break;
case IS_LONG:
@@ -83,7 +86,7 @@ ZEND_API void _zval_internal_dtor(zval *zvalue ZEND_FILE_LINE_DC)
case IS_STRING:
case IS_CONSTANT:
CHECK_ZVAL_STRING_REL(zvalue);
- str_free(zvalue->value.str.val);
+ STR_FREE(Z_STR_P(zvalue));
break;
case IS_ARRAY:
case IS_CONSTANT_ARRAY:
@@ -102,56 +105,48 @@ ZEND_API void _zval_internal_dtor(zval *zvalue ZEND_FILE_LINE_DC)
}
-ZEND_API void zval_add_ref(zval **p)
+ZEND_API void zval_add_ref(zval *p)
{
- Z_ADDREF_PP(p);
+ if (Z_REFCOUNTED_P(p)) {
+ Z_ADDREF_P(p);
+ }
}
ZEND_API void _zval_copy_ctor_func(zval *zvalue ZEND_FILE_LINE_DC)
{
switch (Z_TYPE_P(zvalue) & IS_CONSTANT_TYPE_MASK) {
- case IS_RESOURCE: {
- TSRMLS_FETCH();
-
- zend_list_addref(zvalue->value.lval);
- }
- break;
- case IS_BOOL:
- case IS_LONG:
- case IS_NULL:
- break;
case IS_CONSTANT:
case IS_STRING:
CHECK_ZVAL_STRING_REL(zvalue);
- if (!IS_INTERNED(zvalue->value.str.val)) {
- zvalue->value.str.val = (char *) estrndup_rel(zvalue->value.str.val, zvalue->value.str.len);
- }
+ Z_STR_P(zvalue) = STR_DUP(Z_STR_P(zvalue), 0);
break;
case IS_ARRAY:
case IS_CONSTANT_ARRAY: {
- zval *tmp;
- HashTable *original_ht = zvalue->value.ht;
- HashTable *tmp_ht = NULL;
+ HashTable *ht = Z_ARRVAL_P(zvalue);
TSRMLS_FETCH();
- if (zvalue->value.ht == &EG(symbol_table)) {
+ if (ht == &EG(symbol_table).ht) {
return; /* do nothing */
}
- ALLOC_HASHTABLE_REL(tmp_ht);
- zend_hash_init(tmp_ht, zend_hash_num_elements(original_ht), NULL, ZVAL_PTR_DTOR, 0);
- zend_hash_copy(tmp_ht, original_ht, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
- zvalue->value.ht = tmp_ht;
+ ZVAL_NEW_ARR(zvalue);
+ zend_hash_init(Z_ARRVAL_P(zvalue), zend_hash_num_elements(ht), NULL, ZVAL_PTR_DTOR, 0);
+ zend_hash_copy(Z_ARRVAL_P(zvalue), ht, (copy_ctor_func_t) zval_add_ref);
}
break;
- case IS_CONSTANT_AST:
- Z_AST_P(zvalue) = zend_ast_copy(Z_AST_P(zvalue));
+ case IS_CONSTANT_AST: {
+ zend_ast_ref *ast = emalloc(sizeof(zend_ast_ref));
+
+ ast->gc.refcount = 1;
+ ast->gc.u.v.type = IS_CONSTANT_AST;
+ ast->ast = zend_ast_copy(Z_ASTVAL_P(zvalue));
+ Z_AST_P(zvalue) = ast;
+ }
break;
case IS_OBJECT:
- {
- TSRMLS_FETCH();
- Z_OBJ_HT_P(zvalue)->add_ref(zvalue TSRMLS_CC);
- }
+ case IS_RESOURCE:
+ case IS_REFERENCE:
+ Z_ADDREF_P(zvalue);
break;
}
}
@@ -185,58 +180,68 @@ ZEND_API void _zval_internal_dtor_wrapper(zval *zvalue)
}
-ZEND_API void _zval_ptr_dtor_wrapper(zval **zval_ptr)
+ZEND_API void _zval_ptr_dtor_wrapper(zval *zval_ptr)
{
zval_ptr_dtor(zval_ptr);
}
-ZEND_API void _zval_internal_ptr_dtor_wrapper(zval **zval_ptr)
+ZEND_API void _zval_internal_ptr_dtor_wrapper(zval *zval_ptr)
{
zval_internal_ptr_dtor(zval_ptr);
}
#endif
-ZEND_API int zval_copy_static_var(zval **p TSRMLS_DC, int num_args, va_list args, zend_hash_key *key) /* {{{ */
+ZEND_API int zval_copy_static_var(zval *p TSRMLS_DC, int num_args, va_list args, zend_hash_key *key) /* {{{ */
{
HashTable *target = va_arg(args, HashTable*);
zend_bool is_ref;
- zval *tmp;
+ zval tmp;
- if (Z_TYPE_PP(p) & (IS_LEXICAL_VAR|IS_LEXICAL_REF)) {
- is_ref = Z_TYPE_PP(p) & IS_LEXICAL_REF;
+ if (Z_TYPE_P(p) & (IS_LEXICAL_VAR|IS_LEXICAL_REF)) {
+ is_ref = Z_TYPE_P(p) & IS_LEXICAL_REF;
if (!EG(active_symbol_table)) {
zend_rebuild_symbol_table(TSRMLS_C);
}
- if (zend_hash_quick_find(EG(active_symbol_table), key->arKey, key->nKeyLength, key->h, (void **) &p) == FAILURE) {
- if (is_ref) {
- ALLOC_INIT_ZVAL(tmp);
- Z_SET_ISREF_P(tmp);
- zend_hash_quick_add(EG(active_symbol_table), key->arKey, key->nKeyLength, key->h, &tmp, sizeof(zval*), (void**)&p);
+ p = zend_hash_find(EG(active_symbol_table), key->key);
+ if (!p) {
+ p = &tmp;
+ ZVAL_NULL(&tmp);
+ if (is_ref) {
+ ZVAL_NEW_REF(&tmp, &tmp);
+ zend_hash_add(EG(active_symbol_table), key->key, &tmp);
} else {
- tmp = EG(uninitialized_zval_ptr);
- zend_error(E_NOTICE,"Undefined variable: %s", key->arKey);
+ zend_error(E_NOTICE,"Undefined variable: %s", key->key->val);
}
} else {
if (is_ref) {
- SEPARATE_ZVAL_TO_MAKE_IS_REF(p);
- tmp = *p;
- } else if (Z_ISREF_PP(p)) {
- ALLOC_INIT_ZVAL(tmp);
- ZVAL_COPY_VALUE(tmp, *p);
- zval_copy_ctor(tmp);
- Z_SET_REFCOUNT_P(tmp, 0);
- Z_UNSET_ISREF_P(tmp);
- } else {
- tmp = *p;
+//??? SEPARATE_ZVAL_TO_MAKE_IS_REF(p);
+ if (!Z_ISREF_P(p)) {
+ if (IS_REFCOUNTED(Z_TYPE_P(p)) && Z_REFCOUNT_P(p) > 1) {
+ Z_DELREF_P(p);
+ ZVAL_NEW_REF(p, p);
+ zval_copy_ctor(Z_REFVAL_P(p));
+ Z_SET_REFCOUNT_P(Z_REFVAL_P(p), 1);
+ } else {
+ ZVAL_NEW_REF(p, p);
+ }
+ }
+ } else if (Z_ISREF_P(p)) {
+//???
+ tmp = *Z_REFVAL_P(p);
+ if (Z_REFCOUNTED(tmp) && Z_REFCOUNT(tmp) > 1) {
+ zval_copy_ctor(&tmp);
+ Z_SET_REFCOUNT(tmp, 0);
+ }
+ p = &tmp;
}
}
- } else {
- tmp = *p;
}
- if (zend_hash_quick_add(target, key->arKey, key->nKeyLength, key->h, &tmp, sizeof(zval*), NULL) == SUCCESS) {
- Z_ADDREF_P(tmp);
+ if (zend_hash_add(target, key->key, p)) {
+ if (Z_REFCOUNTED_P(p)) {
+ Z_ADDREF_P(p);
+ }
}
return ZEND_HASH_APPLY_KEEP;
}
diff --git a/Zend/zend_variables.h b/Zend/zend_variables.h
index 30f170bfbe..9ce1312b0d 100644
--- a/Zend/zend_variables.h
+++ b/Zend/zend_variables.h
@@ -29,7 +29,7 @@ ZEND_API void _zval_dtor_func(zval *zvalue ZEND_FILE_LINE_DC);
static zend_always_inline void _zval_dtor(zval *zvalue ZEND_FILE_LINE_DC)
{
- if (zvalue->type <= IS_BOOL) {
+ if (!Z_REFCOUNTED_P(zvalue)) {
return;
}
_zval_dtor_func(zvalue ZEND_FILE_LINE_RELAY_CC);
@@ -39,18 +39,18 @@ ZEND_API void _zval_copy_ctor_func(zval *zvalue ZEND_FILE_LINE_DC);
static zend_always_inline void _zval_copy_ctor(zval *zvalue ZEND_FILE_LINE_DC)
{
- if (zvalue->type <= IS_BOOL) {
+ if (!Z_REFCOUNTED_P(zvalue)) {
return;
}
_zval_copy_ctor_func(zvalue ZEND_FILE_LINE_RELAY_CC);
}
-ZEND_API int zval_copy_static_var(zval **p TSRMLS_DC, int num_args, va_list args, zend_hash_key *key);
+ZEND_API int zval_copy_static_var(zval *p TSRMLS_DC, int num_args, va_list args, zend_hash_key *key);
ZEND_API int zend_print_variable(zval *var);
-ZEND_API void _zval_ptr_dtor(zval **zval_ptr ZEND_FILE_LINE_DC);
+ZEND_API void _zval_ptr_dtor(zval *zval_ptr ZEND_FILE_LINE_DC);
ZEND_API void _zval_internal_dtor(zval *zvalue ZEND_FILE_LINE_DC);
-ZEND_API void _zval_internal_ptr_dtor(zval **zvalue ZEND_FILE_LINE_DC);
+ZEND_API void _zval_internal_ptr_dtor(zval *zvalue ZEND_FILE_LINE_DC);
ZEND_API void _zval_dtor_wrapper(zval *zvalue);
#define zval_copy_ctor(zvalue) _zval_copy_ctor((zvalue) ZEND_FILE_LINE_CC)
#define zval_dtor(zvalue) _zval_dtor((zvalue) ZEND_FILE_LINE_CC)
@@ -61,9 +61,9 @@ ZEND_API void _zval_dtor_wrapper(zval *zvalue);
#if ZEND_DEBUG
ZEND_API void _zval_copy_ctor_wrapper(zval *zvalue);
-ZEND_API void _zval_ptr_dtor_wrapper(zval **zval_ptr);
+ZEND_API void _zval_ptr_dtor_wrapper(zval *zval_ptr);
ZEND_API void _zval_internal_dtor_wrapper(zval *zvalue);
-ZEND_API void _zval_internal_ptr_dtor_wrapper(zval **zvalue);
+ZEND_API void _zval_internal_ptr_dtor_wrapper(zval *zvalue);
#define zval_copy_ctor_wrapper _zval_copy_ctor_wrapper
#define zval_ptr_dtor_wrapper _zval_ptr_dtor_wrapper
#define zval_internal_dtor_wrapper _zval_internal_dtor_wrapper
@@ -75,15 +75,15 @@ ZEND_API void _zval_internal_ptr_dtor_wrapper(zval **zvalue);
#define zval_internal_ptr_dtor_wrapper _zval_internal_ptr_dtor
#endif
-ZEND_API void zval_add_ref(zval **p);
+ZEND_API void zval_add_ref(zval *p);
END_EXTERN_C()
-#define ZVAL_DESTRUCTOR (void (*)(void *)) zval_dtor_wrapper
-#define ZVAL_PTR_DTOR (void (*)(void *)) zval_ptr_dtor_wrapper
-#define ZVAL_INTERNAL_DTOR (void (*)(void *)) zval_internal_dtor_wrapper
-#define ZVAL_INTERNAL_PTR_DTOR (void (*)(void *)) zval_internal_ptr_dtor_wrapper
-#define ZVAL_COPY_CTOR (void (*)(void *)) zval_copy_ctor_wrapper
+#define ZVAL_DESTRUCTOR zval_dtor_wrapper
+#define ZVAL_PTR_DTOR zval_ptr_dtor_wrapper
+#define ZVAL_INTERNAL_DTOR zval_internal_dtor_wrapper
+#define ZVAL_INTERNAL_PTR_DTOR zval_internal_ptr_dtor_wrapper
+#define ZVAL_COPY_CTOR zval_copy_ctor_wrapper
#endif
diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h
index b2cecf229e..63ab543c68 100644
--- a/Zend/zend_vm_def.h
+++ b/Zend/zend_vm_def.h
@@ -31,7 +31,7 @@ ZEND_VM_HANDLER(1, ZEND_ADD, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- fast_add_function(&EX_T(opline->result.var).tmp_var,
+ fast_add_function(EX_VAR(opline->result.var),
GET_OP1_ZVAL_PTR(BP_VAR_R),
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC);
FREE_OP1();
@@ -46,7 +46,7 @@ ZEND_VM_HANDLER(2, ZEND_SUB, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- fast_sub_function(&EX_T(opline->result.var).tmp_var,
+ fast_sub_function(EX_VAR(opline->result.var),
GET_OP1_ZVAL_PTR(BP_VAR_R),
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC);
FREE_OP1();
@@ -61,7 +61,7 @@ ZEND_VM_HANDLER(3, ZEND_MUL, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- fast_mul_function(&EX_T(opline->result.var).tmp_var,
+ fast_mul_function(EX_VAR(opline->result.var),
GET_OP1_ZVAL_PTR(BP_VAR_R),
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC);
FREE_OP1();
@@ -76,7 +76,7 @@ ZEND_VM_HANDLER(4, ZEND_DIV, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- fast_div_function(&EX_T(opline->result.var).tmp_var,
+ fast_div_function(EX_VAR(opline->result.var),
GET_OP1_ZVAL_PTR(BP_VAR_R),
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC);
FREE_OP1();
@@ -91,7 +91,7 @@ ZEND_VM_HANDLER(5, ZEND_MOD, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- fast_mod_function(&EX_T(opline->result.var).tmp_var,
+ fast_mod_function(EX_VAR(opline->result.var),
GET_OP1_ZVAL_PTR(BP_VAR_R),
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC);
FREE_OP1();
@@ -106,7 +106,7 @@ ZEND_VM_HANDLER(6, ZEND_SL, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- shift_left_function(&EX_T(opline->result.var).tmp_var,
+ shift_left_function(EX_VAR(opline->result.var),
GET_OP1_ZVAL_PTR(BP_VAR_R),
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC);
FREE_OP1();
@@ -121,7 +121,7 @@ ZEND_VM_HANDLER(7, ZEND_SR, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- shift_right_function(&EX_T(opline->result.var).tmp_var,
+ shift_right_function(EX_VAR(opline->result.var),
GET_OP1_ZVAL_PTR(BP_VAR_R),
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC);
FREE_OP1();
@@ -136,7 +136,7 @@ ZEND_VM_HANDLER(8, ZEND_CONCAT, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- concat_function(&EX_T(opline->result.var).tmp_var,
+ concat_function(EX_VAR(opline->result.var),
GET_OP1_ZVAL_PTR(BP_VAR_R),
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC);
FREE_OP1();
@@ -151,7 +151,7 @@ ZEND_VM_HANDLER(15, ZEND_IS_IDENTICAL, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- is_identical_function(&EX_T(opline->result.var).tmp_var,
+ is_identical_function(EX_VAR(opline->result.var),
GET_OP1_ZVAL_PTR(BP_VAR_R),
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC);
FREE_OP1();
@@ -164,7 +164,7 @@ ZEND_VM_HANDLER(16, ZEND_IS_NOT_IDENTICAL, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
is_identical_function(result,
@@ -181,7 +181,7 @@ ZEND_VM_HANDLER(17, ZEND_IS_EQUAL, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_equal_function(result,
@@ -197,7 +197,7 @@ ZEND_VM_HANDLER(18, ZEND_IS_NOT_EQUAL, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_not_equal_function(result,
@@ -213,7 +213,7 @@ ZEND_VM_HANDLER(19, ZEND_IS_SMALLER, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_is_smaller_function(result,
@@ -229,7 +229,7 @@ ZEND_VM_HANDLER(20, ZEND_IS_SMALLER_OR_EQUAL, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_is_smaller_or_equal_function(result,
@@ -247,7 +247,7 @@ ZEND_VM_HANDLER(9, ZEND_BW_OR, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- bitwise_or_function(&EX_T(opline->result.var).tmp_var,
+ bitwise_or_function(EX_VAR(opline->result.var),
GET_OP1_ZVAL_PTR(BP_VAR_R),
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC);
FREE_OP1();
@@ -262,7 +262,7 @@ ZEND_VM_HANDLER(10, ZEND_BW_AND, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- bitwise_and_function(&EX_T(opline->result.var).tmp_var,
+ bitwise_and_function(EX_VAR(opline->result.var),
GET_OP1_ZVAL_PTR(BP_VAR_R),
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC);
FREE_OP1();
@@ -277,7 +277,7 @@ ZEND_VM_HANDLER(11, ZEND_BW_XOR, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- bitwise_xor_function(&EX_T(opline->result.var).tmp_var,
+ bitwise_xor_function(EX_VAR(opline->result.var),
GET_OP1_ZVAL_PTR(BP_VAR_R),
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC);
FREE_OP1();
@@ -292,7 +292,7 @@ ZEND_VM_HANDLER(14, ZEND_BOOL_XOR, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- boolean_xor_function(&EX_T(opline->result.var).tmp_var,
+ boolean_xor_function(EX_VAR(opline->result.var),
GET_OP1_ZVAL_PTR(BP_VAR_R),
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC);
FREE_OP1();
@@ -307,7 +307,7 @@ ZEND_VM_HANDLER(12, ZEND_BW_NOT, CONST|TMP|VAR|CV, ANY)
zend_free_op free_op1;
SAVE_OPLINE();
- bitwise_not_function(&EX_T(opline->result.var).tmp_var,
+ bitwise_not_function(EX_VAR(opline->result.var),
GET_OP1_ZVAL_PTR(BP_VAR_R) TSRMLS_CC);
FREE_OP1();
CHECK_EXCEPTION();
@@ -320,7 +320,7 @@ ZEND_VM_HANDLER(13, ZEND_BOOL_NOT, CONST|TMP|VAR|CV, ANY)
zend_free_op free_op1;
SAVE_OPLINE();
- boolean_not_function(&EX_T(opline->result.var).tmp_var,
+ boolean_not_function(EX_VAR(opline->result.var),
GET_OP1_ZVAL_PTR(BP_VAR_R) TSRMLS_CC);
FREE_OP1();
CHECK_EXCEPTION();
@@ -331,18 +331,16 @@ ZEND_VM_HELPER_EX(zend_binary_assign_op_obj_helper, VAR|UNUSED|CV, CONST|TMP|VAR
{
USE_OPLINE
zend_free_op free_op1, free_op2, free_op_data1;
- zval **object_ptr = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_RW);
- zval *object;
+ zval *object = GET_OP1_OBJ_ZVAL_PTR(BP_VAR_RW);
zval *property = GET_OP2_ZVAL_PTR(BP_VAR_R);
zval *value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
int have_get_ptr = 0;
- if (OP1_TYPE == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- make_real_object(object_ptr TSRMLS_CC);
- object = *object_ptr;
+ make_real_object(object TSRMLS_CC);
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to assign property of non-object");
@@ -350,8 +348,7 @@ ZEND_VM_HELPER_EX(zend_binary_assign_op_obj_helper, VAR|UNUSED|CV, CONST|TMP|VAR
FREE_OP(free_op_data1);
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
} else {
/* here we are sure we are dealing with an object */
@@ -362,15 +359,14 @@ ZEND_VM_HELPER_EX(zend_binary_assign_op_obj_helper, VAR|UNUSED|CV, CONST|TMP|VAR
/* here property is a string */
if (opline->extended_value == ZEND_ASSIGN_OBJ
&& Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval **zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
have_get_ptr = 1;
- binary_op(*zptr, *zptr, value TSRMLS_CC);
+ binary_op(zptr, zptr, value TSRMLS_CC);
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(*zptr);
- EX_T(opline->result.var).var.ptr = *zptr;
+ ZVAL_COPY(EX_VAR(opline->result.var), zptr);
}
}
}
@@ -394,12 +390,11 @@ ZEND_VM_HELPER_EX(zend_binary_assign_op_obj_helper, VAR|UNUSED|CV, CONST|TMP|VAR
if (Z_REFCOUNT_P(z) == 0) {
GC_REMOVE_ZVAL_FROM_BUFFER(z);
zval_dtor(z);
- FREE_ZVAL(z);
}
z = value;
}
Z_ADDREF_P(z);
- SEPARATE_ZVAL_IF_NOT_REF(&z);
+ SEPARATE_ZVAL_IF_NOT_REF(z);
binary_op(z, z, value TSRMLS_CC);
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
Z_OBJ_HT_P(object)->write_property(object, property, z, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
@@ -407,21 +402,19 @@ ZEND_VM_HELPER_EX(zend_binary_assign_op_obj_helper, VAR|UNUSED|CV, CONST|TMP|VAR
Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(z);
- EX_T(opline->result.var).var.ptr = z;
+ ZVAL_COPY(EX_VAR(opline->result.var), z);
}
- zval_ptr_dtor(&z);
+ zval_ptr_dtor(z);
} else {
zend_error(E_WARNING, "Attempt to assign property of non-object");
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
}
}
if (IS_OP2_TMP_FREE()) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
FREE_OP2();
}
@@ -439,7 +432,7 @@ ZEND_VM_HELPER_EX(zend_binary_assign_op_helper, VAR|UNUSED|CV, CONST|TMP|VAR|UNU
{
USE_OPLINE
zend_free_op free_op1, free_op2, free_op_data2, free_op_data1;
- zval **var_ptr;
+ zval *var_ptr;
zval *value;
SAVE_OPLINE();
@@ -448,39 +441,38 @@ ZEND_VM_HELPER_EX(zend_binary_assign_op_helper, VAR|UNUSED|CV, CONST|TMP|VAR|UNU
ZEND_VM_DISPATCH_TO_HELPER_EX(zend_binary_assign_op_obj_helper, binary_op, binary_op);
break;
case ZEND_ASSIGN_DIM: {
- zval **container = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_RW);
+ zval *container = GET_OP1_OBJ_ZVAL_PTR(BP_VAR_RW);
- if (OP1_TYPE == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- } else if (UNEXPECTED(Z_TYPE_PP(container) == IS_OBJECT)) {
+ } else if (UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
if (OP1_TYPE == IS_VAR && !OP1_FREE) {
- Z_ADDREF_PP(container); /* undo the effect of get_obj_zval_ptr_ptr() */
+ Z_ADDREF_P(container); /* undo the effect of get_obj_zval_ptr_ptr() */
}
ZEND_VM_DISPATCH_TO_HELPER_EX(zend_binary_assign_op_obj_helper, binary_op, binary_op);
} else {
zval *dim = GET_OP2_ZVAL_PTR(BP_VAR_R);
- zend_fetch_dimension_address(&EX_T((opline+1)->op2.var), container, dim, OP2_TYPE, BP_VAR_RW TSRMLS_CC);
+ zend_fetch_dimension_address(EX_VAR((opline+1)->op2.var), container, dim, OP2_TYPE, BP_VAR_RW TSRMLS_CC);
value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
- var_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
+ var_ptr = _get_zval_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
}
}
break;
default:
value = GET_OP2_ZVAL_PTR(BP_VAR_R);
- var_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_RW);
+ var_ptr = GET_OP1_ZVAL_PTR(BP_VAR_RW);
/* do nothing */
break;
}
- if (UNEXPECTED(var_ptr == NULL)) {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
}
- if (UNEXPECTED(*var_ptr == &EG(error_zval))) {
+ if (UNEXPECTED(var_ptr == &EG(error_zval))) {
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
FREE_OP2();
FREE_OP1_VAR_PTR();
@@ -493,22 +485,21 @@ ZEND_VM_HELPER_EX(zend_binary_assign_op_helper, VAR|UNUSED|CV, CONST|TMP|VAR|UNU
SEPARATE_ZVAL_IF_NOT_REF(var_ptr);
- if (UNEXPECTED(Z_TYPE_PP(var_ptr) == IS_OBJECT)
- && Z_OBJ_HANDLER_PP(var_ptr, get)
- && Z_OBJ_HANDLER_PP(var_ptr, set)) {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_OBJECT)
+ && Z_OBJ_HANDLER_P(var_ptr, get)
+ && Z_OBJ_HANDLER_P(var_ptr, set)) {
/* proxy object */
- zval *objval = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC);
+ zval *objval = Z_OBJ_HANDLER_P(var_ptr, get)(var_ptr TSRMLS_CC);
Z_ADDREF_P(objval);
binary_op(objval, objval, value TSRMLS_CC);
- Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, objval TSRMLS_CC);
- zval_ptr_dtor(&objval);
+ Z_OBJ_HANDLER_P(var_ptr, set)(var_ptr, objval TSRMLS_CC);
+ zval_ptr_dtor(objval);
} else {
- binary_op(*var_ptr, *var_ptr, value TSRMLS_CC);
+ binary_op(var_ptr, var_ptr, value TSRMLS_CC);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(*var_ptr);
- EX_T(opline->result.var).var.ptr = *var_ptr;
+ ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
FREE_OP2();
@@ -584,30 +575,27 @@ ZEND_VM_HELPER_EX(zend_pre_incdec_property_helper, VAR|UNUSED|CV, CONST|TMP|VAR|
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval **object_ptr;
zval *object;
zval *property;
- zval **retval;
+ zval *retval;
int have_get_ptr = 0;
SAVE_OPLINE();
- object_ptr = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_RW);
+ object = GET_OP1_OBJ_ZVAL_PTR(BP_VAR_RW);
property = GET_OP2_ZVAL_PTR(BP_VAR_R);
- retval = &EX_T(opline->result.var).var.ptr;
+ retval = EX_VAR(opline->result.var);
- if (OP1_TYPE == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
- object = *object_ptr;
+ make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
FREE_OP2();
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- *retval = &EG(uninitialized_zval);
+ ZVAL_NULL(retval);
}
FREE_OP1_VAR_PTR();
CHECK_EXCEPTION();
@@ -621,15 +609,14 @@ ZEND_VM_HELPER_EX(zend_pre_incdec_property_helper, VAR|UNUSED|CV, CONST|TMP|VAR|
}
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval **zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
have_get_ptr = 1;
- incdec_op(*zptr);
+ incdec_op(zptr);
if (RETURN_VALUE_USED(opline)) {
- *retval = *zptr;
- PZVAL_LOCK(*retval);
+ ZVAL_COPY(retval, zptr);
}
}
}
@@ -644,28 +631,26 @@ ZEND_VM_HELPER_EX(zend_pre_incdec_property_helper, VAR|UNUSED|CV, CONST|TMP|VAR|
if (Z_REFCOUNT_P(z) == 0) {
GC_REMOVE_ZVAL_FROM_BUFFER(z);
zval_dtor(z);
- FREE_ZVAL(z);
}
z = value;
}
Z_ADDREF_P(z);
- SEPARATE_ZVAL_IF_NOT_REF(&z);
+ SEPARATE_ZVAL_IF_NOT_REF(z);
incdec_op(z);
- *retval = z;
+ ZVAL_COPY_VALUE(retval, z);
Z_OBJ_HT_P(object)->write_property(object, property, z, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- SELECTIVE_PZVAL_LOCK(*retval, opline);
- zval_ptr_dtor(&z);
+ SELECTIVE_PZVAL_LOCK(retval, opline);
+ zval_ptr_dtor(z);
} else {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- *retval = &EG(uninitialized_zval);
+ ZVAL_NULL(retval);
}
}
}
if (IS_OP2_TMP_FREE()) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
FREE_OP2();
}
@@ -688,23 +673,21 @@ ZEND_VM_HELPER_EX(zend_post_incdec_property_helper, VAR|UNUSED|CV, CONST|TMP|VAR
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval **object_ptr;
zval *object;
zval *property;
zval *retval;
int have_get_ptr = 0;
SAVE_OPLINE();
- object_ptr = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_RW);
+ object = GET_OP1_OBJ_ZVAL_PTR(BP_VAR_RW);
property = GET_OP2_ZVAL_PTR(BP_VAR_R);
- retval = &EX_T(opline->result.var).tmp_var;
+ retval = EX_VAR(opline->result.var);
- if (OP1_TYPE == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
- object = *object_ptr;
+ make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
@@ -722,15 +705,14 @@ ZEND_VM_HELPER_EX(zend_post_incdec_property_helper, VAR|UNUSED|CV, CONST|TMP|VAR
}
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval **zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
have_get_ptr = 1;
SEPARATE_ZVAL_IF_NOT_REF(zptr);
- ZVAL_COPY_VALUE(retval, *zptr);
- zendi_zval_copy_ctor(*retval);
+ ZVAL_DUP(retval, zptr);
- incdec_op(*zptr);
+ incdec_op(zptr);
}
}
@@ -738,7 +720,7 @@ ZEND_VM_HELPER_EX(zend_post_incdec_property_helper, VAR|UNUSED|CV, CONST|TMP|VAR
if (!have_get_ptr) {
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- zval *z_copy;
+ zval z_copy;
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC);
@@ -746,20 +728,16 @@ ZEND_VM_HELPER_EX(zend_post_incdec_property_helper, VAR|UNUSED|CV, CONST|TMP|VAR
if (Z_REFCOUNT_P(z) == 0) {
GC_REMOVE_ZVAL_FROM_BUFFER(z);
zval_dtor(z);
- FREE_ZVAL(z);
}
z = value;
}
- ZVAL_COPY_VALUE(retval, z);
- zendi_zval_copy_ctor(*retval);
- ALLOC_ZVAL(z_copy);
- INIT_PZVAL_COPY(z_copy, z);
- zendi_zval_copy_ctor(*z_copy);
- incdec_op(z_copy);
+ ZVAL_DUP(retval, z);
+ ZVAL_DUP(&z_copy, z);
+ incdec_op(&z_copy);
Z_ADDREF_P(z);
- Z_OBJ_HT_P(object)->write_property(object, property, z_copy, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(object)->write_property(object, property, &z_copy, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval_ptr_dtor(&z_copy);
- zval_ptr_dtor(&z);
+ zval_ptr_dtor(z);
} else {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
ZVAL_NULL(retval);
@@ -767,7 +745,7 @@ ZEND_VM_HELPER_EX(zend_post_incdec_property_helper, VAR|UNUSED|CV, CONST|TMP|VAR
}
if (IS_OP2_TMP_FREE()) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
FREE_OP2();
}
@@ -790,18 +768,17 @@ ZEND_VM_HANDLER(34, ZEND_PRE_INC, VAR|CV, ANY)
{
USE_OPLINE
zend_free_op free_op1;
- zval **var_ptr;
+ zval *var_ptr;
SAVE_OPLINE();
- var_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_RW);
+ var_ptr = GET_OP1_ZVAL_PTR(BP_VAR_RW);
- if (OP1_TYPE == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
+ if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- if (OP1_TYPE == IS_VAR && UNEXPECTED(*var_ptr == &EG(error_zval))) {
+ if (OP1_TYPE == IS_VAR && UNEXPECTED(var_ptr == &EG(error_zval))) {
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
FREE_OP1_VAR_PTR();
CHECK_EXCEPTION();
@@ -810,22 +787,21 @@ ZEND_VM_HANDLER(34, ZEND_PRE_INC, VAR|CV, ANY)
SEPARATE_ZVAL_IF_NOT_REF(var_ptr);
- if (UNEXPECTED(Z_TYPE_PP(var_ptr) == IS_OBJECT)
- && Z_OBJ_HANDLER_PP(var_ptr, get)
- && Z_OBJ_HANDLER_PP(var_ptr, set)) {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_OBJECT)
+ && Z_OBJ_HANDLER_P(var_ptr, get)
+ && Z_OBJ_HANDLER_P(var_ptr, set)) {
/* proxy object */
- zval *val = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC);
+ zval *val = Z_OBJ_HANDLER_P(var_ptr, get)(var_ptr TSRMLS_CC);
Z_ADDREF_P(val);
fast_increment_function(val);
- Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, val TSRMLS_CC);
- zval_ptr_dtor(&val);
+ Z_OBJ_HANDLER_P(var_ptr, set)(var_ptr, val TSRMLS_CC);
+ zval_ptr_dtor(val);
} else {
- fast_increment_function(*var_ptr);
+ fast_increment_function(var_ptr);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(*var_ptr);
- EX_T(opline->result.var).var.ptr = *var_ptr;
+ ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
FREE_OP1_VAR_PTR();
@@ -837,18 +813,17 @@ ZEND_VM_HANDLER(35, ZEND_PRE_DEC, VAR|CV, ANY)
{
USE_OPLINE
zend_free_op free_op1;
- zval **var_ptr;
+ zval *var_ptr;
SAVE_OPLINE();
- var_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_RW);
+ var_ptr = GET_OP1_ZVAL_PTR(BP_VAR_RW);
- if (OP1_TYPE == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
+ if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- if (OP1_TYPE == IS_VAR && UNEXPECTED(*var_ptr == &EG(error_zval))) {
+ if (OP1_TYPE == IS_VAR && UNEXPECTED(var_ptr == &EG(error_zval))) {
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
FREE_OP1_VAR_PTR();
CHECK_EXCEPTION();
@@ -857,22 +832,21 @@ ZEND_VM_HANDLER(35, ZEND_PRE_DEC, VAR|CV, ANY)
SEPARATE_ZVAL_IF_NOT_REF(var_ptr);
- if (UNEXPECTED(Z_TYPE_PP(var_ptr) == IS_OBJECT)
- && Z_OBJ_HANDLER_PP(var_ptr, get)
- && Z_OBJ_HANDLER_PP(var_ptr, set)) {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_OBJECT)
+ && Z_OBJ_HANDLER_P(var_ptr, get)
+ && Z_OBJ_HANDLER_P(var_ptr, set)) {
/* proxy object */
- zval *val = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC);
+ zval *val = Z_OBJ_HANDLER_P(var_ptr, get)(var_ptr TSRMLS_CC);
Z_ADDREF_P(val);
fast_decrement_function(val);
- Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, val TSRMLS_CC);
- zval_ptr_dtor(&val);
+ Z_OBJ_HANDLER_P(var_ptr, set)(var_ptr, val TSRMLS_CC);
+ zval_ptr_dtor(val);
} else {
- fast_decrement_function(*var_ptr);
+ fast_decrement_function(var_ptr);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(*var_ptr);
- EX_T(opline->result.var).var.ptr = *var_ptr;
+ ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
FREE_OP1_VAR_PTR();
@@ -884,38 +858,37 @@ ZEND_VM_HANDLER(36, ZEND_POST_INC, VAR|CV, ANY)
{
USE_OPLINE
zend_free_op free_op1;
- zval **var_ptr, *retval;
+ zval *var_ptr, *retval;
SAVE_OPLINE();
- var_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_RW);
+ var_ptr = GET_OP1_ZVAL_PTR(BP_VAR_RW);
- if (OP1_TYPE == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
+ if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- if (OP1_TYPE == IS_VAR && UNEXPECTED(*var_ptr == &EG(error_zval))) {
- ZVAL_NULL(&EX_T(opline->result.var).tmp_var);
+ if (OP1_TYPE == IS_VAR && UNEXPECTED(var_ptr == &EG(error_zval))) {
+ ZVAL_NULL(EX_VAR(opline->result.var));
FREE_OP1_VAR_PTR();
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
- retval = &EX_T(opline->result.var).tmp_var;
- ZVAL_COPY_VALUE(retval, *var_ptr);
- zendi_zval_copy_ctor(*retval);
+ retval = EX_VAR(opline->result.var);
+ ZVAL_DUP(retval, var_ptr);
SEPARATE_ZVAL_IF_NOT_REF(var_ptr);
- if (UNEXPECTED(Z_TYPE_PP(var_ptr) == IS_OBJECT)
- && Z_OBJ_HANDLER_PP(var_ptr, get)
- && Z_OBJ_HANDLER_PP(var_ptr, set)) {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_OBJECT)
+ && Z_OBJ_HANDLER_P(var_ptr, get)
+ && Z_OBJ_HANDLER_P(var_ptr, set)) {
/* proxy object */
- zval *val = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC);
+ zval *val = Z_OBJ_HANDLER_P(var_ptr, get)(var_ptr TSRMLS_CC);
Z_ADDREF_P(val);
fast_increment_function(val);
- Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, val TSRMLS_CC);
- zval_ptr_dtor(&val);
+ Z_OBJ_HANDLER_P(var_ptr, set)(var_ptr, val TSRMLS_CC);
+ zval_ptr_dtor(val);
} else {
- fast_increment_function(*var_ptr);
+ fast_increment_function(var_ptr);
}
FREE_OP1_VAR_PTR();
@@ -927,38 +900,37 @@ ZEND_VM_HANDLER(37, ZEND_POST_DEC, VAR|CV, ANY)
{
USE_OPLINE
zend_free_op free_op1;
- zval **var_ptr, *retval;
+ zval *var_ptr, *retval;
SAVE_OPLINE();
- var_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_RW);
+ var_ptr = GET_OP1_ZVAL_PTR(BP_VAR_RW);
- if (OP1_TYPE == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
+ if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- if (OP1_TYPE == IS_VAR && UNEXPECTED(*var_ptr == &EG(error_zval))) {
- ZVAL_NULL(&EX_T(opline->result.var).tmp_var);
+ if (OP1_TYPE == IS_VAR && UNEXPECTED(var_ptr == &EG(error_zval))) {
+ ZVAL_NULL(EX_VAR(opline->result.var));
FREE_OP1_VAR_PTR();
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
- retval = &EX_T(opline->result.var).tmp_var;
- ZVAL_COPY_VALUE(retval, *var_ptr);
- zendi_zval_copy_ctor(*retval);
+ retval = EX_VAR(opline->result.var);
+ ZVAL_DUP(retval, var_ptr);
SEPARATE_ZVAL_IF_NOT_REF(var_ptr);
- if (UNEXPECTED(Z_TYPE_PP(var_ptr) == IS_OBJECT)
- && Z_OBJ_HANDLER_PP(var_ptr, get)
- && Z_OBJ_HANDLER_PP(var_ptr, set)) {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_OBJECT)
+ && Z_OBJ_HANDLER_P(var_ptr, get)
+ && Z_OBJ_HANDLER_P(var_ptr, set)) {
/* proxy object */
- zval *val = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC);
+ zval *val = Z_OBJ_HANDLER_P(var_ptr, get)(var_ptr TSRMLS_CC);
Z_ADDREF_P(val);
fast_decrement_function(val);
- Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, val TSRMLS_CC);
- zval_ptr_dtor(&val);
+ Z_OBJ_HANDLER_P(var_ptr, set)(var_ptr, val TSRMLS_CC);
+ zval_ptr_dtor(val);
} else {
- fast_decrement_function(*var_ptr);
+ fast_decrement_function(var_ptr);
}
FREE_OP1_VAR_PTR();
@@ -976,7 +948,7 @@ ZEND_VM_HANDLER(40, ZEND_ECHO, CONST|TMP|VAR|CV, ANY)
z = GET_OP1_ZVAL_PTR(BP_VAR_R);
if (OP1_TYPE == IS_TMP_VAR && Z_TYPE_P(z) == IS_OBJECT) {
- INIT_PZVAL(z);
+//??? INIT_PZVAL(z);
}
zend_print_variable(z);
@@ -989,7 +961,7 @@ ZEND_VM_HANDLER(41, ZEND_PRINT, CONST|TMP|VAR|CV, ANY)
{
USE_OPLINE
- ZVAL_LONG(&EX_T(opline->result.var).tmp_var, 1);
+ ZVAL_LONG(EX_VAR(opline->result.var), 1);
ZEND_VM_DISPATCH_TO_HANDLER(ZEND_ECHO);
}
@@ -998,19 +970,17 @@ ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST|TMP|VAR|CV, UNUSED|CONST|
USE_OPLINE
zend_free_op free_op1;
zval *varname;
- zval **retval;
+ zval *retval;
zval tmp_varname;
HashTable *target_symbol_table;
- ulong hash_value;
SAVE_OPLINE();
varname = GET_OP1_ZVAL_PTR(BP_VAR_R);
if (OP1_TYPE != IS_CONST && UNEXPECTED(Z_TYPE_P(varname) != IS_STRING)) {
- ZVAL_COPY_VALUE(&tmp_varname, varname);
- zval_copy_ctor(&tmp_varname);
- Z_SET_REFCOUNT(tmp_varname, 1);
- Z_UNSET_ISREF(tmp_varname);
+ ZVAL_DUP(&tmp_varname, varname);
+//??? Z_SET_REFCOUNT(tmp_varname, 1);
+//??? Z_UNSET_ISREF(tmp_varname);
convert_to_string(&tmp_varname);
varname = &tmp_varname;
}
@@ -1022,7 +992,7 @@ ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST|TMP|VAR|CV, UNUSED|CONST|
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
ce = CACHED_PTR(opline->op2.literal->cache_slot);
} else {
- ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
if (OP1_TYPE != IS_CONST && varname == &tmp_varname) {
zval_dtor(&tmp_varname);
@@ -1034,9 +1004,9 @@ ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST|TMP|VAR|CV, UNUSED|CONST|
CACHE_PTR(opline->op2.literal->cache_slot, ce);
}
} else {
- ce = EX_T(opline->op2.var).class_entry;
+ ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0, ((OP1_TYPE == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ retval = zend_std_get_static_property(ce, Z_STR_P(varname), 0, ((OP1_TYPE == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
FREE_OP1();
} else {
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
@@ -1046,27 +1016,21 @@ ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST|TMP|VAR|CV, UNUSED|CONST|
ZEND_VM_NEXT_OPCODE();
}
*/
- if (OP1_TYPE == IS_CONST) {
- hash_value = Z_HASH_P(varname);
- } else {
- hash_value = str_hash(Z_STRVAL_P(varname), Z_STRLEN_P(varname));
- }
-
- if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) {
+ if ((retval = zend_hash_find(target_symbol_table, Z_STR_P(varname))) == NULL) {
switch (type) {
case BP_VAR_R:
case BP_VAR_UNSET:
zend_error(E_NOTICE,"Undefined variable: %s", Z_STRVAL_P(varname));
/* break missing intentionally */
case BP_VAR_IS:
- retval = &EG(uninitialized_zval_ptr);
+ ZVAL_NULL(retval);
break;
case BP_VAR_RW:
zend_error(E_NOTICE,"Undefined variable: %s", Z_STRVAL_P(varname));
/* break missing intentionally */
case BP_VAR_W:
Z_ADDREF_P(&EG(uninitialized_zval));
- zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval);
+ retval = zend_hash_update(target_symbol_table, Z_STR_P(varname), &EG(uninitialized_zval));
break;
EMPTY_SWITCH_DEFAULT_CASE()
}
@@ -1085,7 +1049,7 @@ ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST|TMP|VAR|CV, UNUSED|CONST|
break;
case ZEND_FETCH_GLOBAL_LOCK:
if (OP1_TYPE == IS_VAR && !free_op1.var) {
- PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
+ Z_ADDREF_P(EX_VAR(opline->op1.var));
}
break;
}
@@ -1098,27 +1062,26 @@ ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST|TMP|VAR|CV, UNUSED|CONST|
if (opline->extended_value & ZEND_FETCH_MAKE_REF) {
SEPARATE_ZVAL_TO_MAKE_IS_REF(retval);
}
- PZVAL_LOCK(*retval);
- switch (type) {
- case BP_VAR_R:
- case BP_VAR_IS:
- EX_T(opline->result.var).var.ptr = *retval;
- break;
- case BP_VAR_UNSET: {
- zend_free_op free_res;
-
- PZVAL_UNLOCK(*retval, &free_res);
- if (retval != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(retval);
- }
- PZVAL_LOCK(*retval);
- FREE_OP_VAR_PTR(free_res);
- }
- /* break missing intentionally */
- default:
- EX_T(opline->result.var).var.ptr_ptr = retval;
- break;
- }
+ ZVAL_COPY(EX_VAR(opline->result.var), retval);
+//??? switch (type) {
+//??? case BP_VAR_R:
+//??? case BP_VAR_IS:
+//??? break;
+//??? case BP_VAR_UNSET: {
+//??? zend_free_op free_res;
+//???
+//??? PZVAL_UNLOCK(*retval, &free_res);
+//??? if (retval != &EG(uninitialized_zval_ptr)) {
+//??? SEPARATE_ZVAL_IF_NOT_REF(retval);
+//??? }
+//??? PZVAL_LOCK(*retval);
+//??? FREE_OP_VAR_PTR(free_res);
+//??? }
+//??? /* break missing intentionally */
+//??? default:
+//??? EX_T(opline->result.var).var.ptr_ptr = retval;
+//??? break;
+//??? }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -1164,7 +1127,7 @@ ZEND_VM_HANDLER(81, ZEND_FETCH_DIM_R, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
SAVE_OPLINE();
container = GET_OP1_ZVAL_PTR(BP_VAR_R);
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, GET_OP2_ZVAL_PTR(BP_VAR_R), OP2_TYPE, BP_VAR_R TSRMLS_CC);
+ zend_fetch_dimension_address_read(EX_VAR(opline->result.var), container, GET_OP2_ZVAL_PTR(BP_VAR_R), OP2_TYPE, BP_VAR_R TSRMLS_CC);
FREE_OP2();
if (OP1_TYPE != IS_VAR || !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
FREE_OP1();
@@ -1177,30 +1140,28 @@ ZEND_VM_HANDLER(84, ZEND_FETCH_DIM_W, VAR|CV, CONST|TMP|VAR|UNUSED|CV)
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval **container;
+ zval *container;
SAVE_OPLINE();
- container = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W);
+ container = GET_OP1_ZVAL_PTR(BP_VAR_W);
- if (OP1_TYPE == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_fetch_dimension_address(&EX_T(opline->result.var), container, GET_OP2_ZVAL_PTR(BP_VAR_R), OP2_TYPE, BP_VAR_W TSRMLS_CC);
+ zend_fetch_dimension_address(EX_VAR(opline->result.var), container, GET_OP2_ZVAL_PTR(BP_VAR_R), OP2_TYPE, BP_VAR_W TSRMLS_CC);
FREE_OP2();
- if (OP1_TYPE == IS_VAR && OP1_FREE && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
+//??? if (OP1_TYPE == IS_VAR && OP1_FREE && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
+//??? }
FREE_OP1_VAR_PTR();
/* We are going to assign the result by reference */
if (UNEXPECTED(opline->extended_value != 0)) {
- zval **retval_ptr = EX_T(opline->result.var).var.ptr_ptr;
+ zval *retval_ptr = EX_VAR(opline->result.var);
- if (retval_ptr) {
- Z_DELREF_PP(retval_ptr);
- SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
- Z_ADDREF_PP(retval_ptr);
- }
+ Z_DELREF_P(retval_ptr);
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
+ Z_ADDREF_P(retval_ptr);
}
CHECK_EXCEPTION();
@@ -1211,19 +1172,19 @@ ZEND_VM_HANDLER(87, ZEND_FETCH_DIM_RW, VAR|CV, CONST|TMP|VAR|UNUSED|CV)
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval **container;
+ zval *container;
SAVE_OPLINE();
- container = GET_OP1_ZVAL_PTR_PTR(BP_VAR_RW);
+ container = GET_OP1_ZVAL_PTR(BP_VAR_RW);
- if (OP1_TYPE == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_fetch_dimension_address(&EX_T(opline->result.var), container, GET_OP2_ZVAL_PTR(BP_VAR_R), OP2_TYPE, BP_VAR_RW TSRMLS_CC);
+ zend_fetch_dimension_address(EX_VAR(opline->result.var), container, GET_OP2_ZVAL_PTR(BP_VAR_R), OP2_TYPE, BP_VAR_RW TSRMLS_CC);
FREE_OP2();
- if (OP1_TYPE == IS_VAR && OP1_FREE && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
+//??? if (OP1_TYPE == IS_VAR && OP1_FREE && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
FREE_OP1_VAR_PTR();
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -1237,7 +1198,7 @@ ZEND_VM_HANDLER(90, ZEND_FETCH_DIM_IS, VAR|CV, CONST|TMP|VAR|CV)
SAVE_OPLINE();
container = GET_OP1_ZVAL_PTR(BP_VAR_IS);
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, GET_OP2_ZVAL_PTR(BP_VAR_R), OP2_TYPE, BP_VAR_IS TSRMLS_CC);
+ zend_fetch_dimension_address_read(EX_VAR(opline->result.var), container, GET_OP2_ZVAL_PTR(BP_VAR_R), OP2_TYPE, BP_VAR_IS TSRMLS_CC);
FREE_OP2();
FREE_OP1();
CHECK_EXCEPTION();
@@ -1247,29 +1208,28 @@ ZEND_VM_HANDLER(90, ZEND_FETCH_DIM_IS, VAR|CV, CONST|TMP|VAR|CV)
ZEND_VM_HANDLER(93, ZEND_FETCH_DIM_FUNC_ARG, VAR|CV, CONST|TMP|VAR|UNUSED|CV)
{
USE_OPLINE
+ zval *container;
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
if (zend_is_by_ref_func_arg_fetch(opline, EX(call) TSRMLS_CC)) {
- zval **container = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W);
+ container = GET_OP1_ZVAL_PTR(BP_VAR_W);
if (OP1_TYPE == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_fetch_dimension_address(&EX_T(opline->result.var), container, GET_OP2_ZVAL_PTR(BP_VAR_R), OP2_TYPE, BP_VAR_W TSRMLS_CC);
- if (OP1_TYPE == IS_VAR && OP1_FREE && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
+ zend_fetch_dimension_address(EX_VAR(opline->result.var), container, GET_OP2_ZVAL_PTR(BP_VAR_R), OP2_TYPE, BP_VAR_W TSRMLS_CC);
+//??? if (OP1_TYPE == IS_VAR && OP1_FREE && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
FREE_OP2();
FREE_OP1_VAR_PTR();
} else {
- zval *container;
-
if (OP2_TYPE == IS_UNUSED) {
zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
}
container = GET_OP1_ZVAL_PTR(BP_VAR_R);
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, GET_OP2_ZVAL_PTR(BP_VAR_R), OP2_TYPE, BP_VAR_R TSRMLS_CC);
+ zend_fetch_dimension_address_read(EX_VAR(opline->result.var), container, GET_OP2_ZVAL_PTR(BP_VAR_R), OP2_TYPE, BP_VAR_R TSRMLS_CC);
FREE_OP2();
FREE_OP1();
}
@@ -1281,37 +1241,33 @@ ZEND_VM_HANDLER(96, ZEND_FETCH_DIM_UNSET, VAR|CV, CONST|TMP|VAR|CV)
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval **container;
+ zval *container;
SAVE_OPLINE();
- container = GET_OP1_ZVAL_PTR_PTR(BP_VAR_UNSET);
+ container = GET_OP1_ZVAL_PTR(BP_VAR_UNSET);
if (OP1_TYPE == IS_CV) {
- if (container != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(container);
- }
+ SEPARATE_ZVAL_IF_NOT_REF(container);
}
- if (OP1_TYPE == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_fetch_dimension_address(&EX_T(opline->result.var), container, GET_OP2_ZVAL_PTR(BP_VAR_R), OP2_TYPE, BP_VAR_UNSET TSRMLS_CC);
+ zend_fetch_dimension_address(EX_VAR(opline->result.var), container, GET_OP2_ZVAL_PTR(BP_VAR_R), OP2_TYPE, BP_VAR_UNSET TSRMLS_CC);
FREE_OP2();
- if (OP1_TYPE == IS_VAR && OP1_FREE && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
+//??? if (OP1_TYPE == IS_VAR && OP1_FREE && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
FREE_OP1_VAR_PTR();
- if (UNEXPECTED(EX_T(opline->result.var).var.ptr_ptr == NULL)) {
+ if (UNEXPECTED(Z_TYPE_P(EX_VAR(opline->result.var)) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
ZEND_VM_NEXT_OPCODE();
} else {
zend_free_op free_res;
- zval **retval_ptr = EX_T(opline->result.var).var.ptr_ptr;
+ zval *retval_ptr = EX_VAR(opline->result.var);
- PZVAL_UNLOCK(*retval_ptr, &free_res);
- if (retval_ptr != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(retval_ptr);
- }
- PZVAL_LOCK(*retval_ptr);
+ PZVAL_UNLOCK(retval_ptr, &free_res);
+ SEPARATE_ZVAL_IF_NOT_REF(retval_ptr);
+ PZVAL_LOCK(retval_ptr);
FREE_OP_VAR_PTR(free_res);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -1333,8 +1289,7 @@ ZEND_VM_HELPER(zend_fetch_property_address_read_helper, VAR|UNUSED|CV, CONST|TMP
if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
zend_error(E_NOTICE, "Trying to get property of non-object");
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
FREE_OP2();
} else {
zval *retval;
@@ -1346,11 +1301,10 @@ ZEND_VM_HELPER(zend_fetch_property_address_read_helper, VAR|UNUSED|CV, CONST|TMP
/* here we are sure we are dealing with an object */
retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_R, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- PZVAL_LOCK(retval);
- EX_T(opline->result.var).var.ptr = retval;
+ ZVAL_COPY(EX_VAR(opline->result.var), retval);
if (IS_OP2_TMP_FREE()) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
FREE_OP2();
}
@@ -1371,7 +1325,7 @@ ZEND_VM_HANDLER(85, ZEND_FETCH_OBJ_W, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
USE_OPLINE
zend_free_op free_op1, free_op2;
zval *property;
- zval **container;
+ zval *container;
SAVE_OPLINE();
property = GET_OP2_ZVAL_PTR(BP_VAR_R);
@@ -1379,31 +1333,31 @@ ZEND_VM_HANDLER(85, ZEND_FETCH_OBJ_W, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
if (IS_OP2_TMP_FREE()) {
MAKE_REAL_ZVAL_PTR(property);
}
- container = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_W);
- if (OP1_TYPE == IS_VAR && UNEXPECTED(container == NULL)) {
+ container = GET_OP1_OBJ_ZVAL_PTR(BP_VAR_W);
+ if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(&EX_T(opline->result.var), container, property, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W TSRMLS_CC);
if (IS_OP2_TMP_FREE()) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
FREE_OP2();
}
- if (OP1_TYPE == IS_VAR && OP1_FREE && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
+//??? if (OP1_TYPE == IS_VAR && OP1_FREE && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
FREE_OP1_VAR_PTR();
/* We are going to assign the result by reference */
if (opline->extended_value & ZEND_FETCH_MAKE_REF) {
- zval **retval_ptr = EX_T(opline->result.var).var.ptr_ptr;
+ zval *retval_ptr = EX_VAR(opline->result.var);
- Z_DELREF_PP(retval_ptr);
+ Z_DELREF_P(retval_ptr);
SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
- Z_ADDREF_PP(retval_ptr);
- EX_T(opline->result.var).var.ptr = *EX_T(opline->result.var).var.ptr_ptr;
- EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
+ Z_ADDREF_P(retval_ptr);
+//??? EX_T(opline->result.var).var.ptr = *EX_T(opline->result.var).var.ptr_ptr;
+//??? EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
}
CHECK_EXCEPTION();
@@ -1415,27 +1369,27 @@ ZEND_VM_HANDLER(88, ZEND_FETCH_OBJ_RW, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
USE_OPLINE
zend_free_op free_op1, free_op2;
zval *property;
- zval **container;
+ zval *container;
SAVE_OPLINE();
property = GET_OP2_ZVAL_PTR(BP_VAR_R);
- container = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_RW);
+ container = GET_OP1_OBJ_ZVAL_PTR(BP_VAR_RW);
if (IS_OP2_TMP_FREE()) {
MAKE_REAL_ZVAL_PTR(property);
}
- if (OP1_TYPE == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(&EX_T(opline->result.var), container, property, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_RW TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_RW TSRMLS_CC);
if (IS_OP2_TMP_FREE()) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
FREE_OP2();
}
- if (OP1_TYPE == IS_VAR && OP1_FREE && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
+//??? if (OP1_TYPE == IS_VAR && OP1_FREE && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
FREE_OP1_VAR_PTR();
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -1455,8 +1409,7 @@ ZEND_VM_HANDLER(91, ZEND_FETCH_OBJ_IS, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
FREE_OP2();
} else {
zval *retval;
@@ -1468,11 +1421,10 @@ ZEND_VM_HANDLER(91, ZEND_FETCH_OBJ_IS, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
/* here we are sure we are dealing with an object */
retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_IS, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- PZVAL_LOCK(retval);
- EX_T(opline->result.var).var.ptr = retval;
+ ZVAL_COPY(EX_VAR(opline->result.var), retval);
if (IS_OP2_TMP_FREE()) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
FREE_OP2();
}
@@ -1486,32 +1438,32 @@ ZEND_VM_HANDLER(91, ZEND_FETCH_OBJ_IS, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
ZEND_VM_HANDLER(94, ZEND_FETCH_OBJ_FUNC_ARG, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
{
USE_OPLINE
+ zval *container;
if (zend_is_by_ref_func_arg_fetch(opline, EX(call) TSRMLS_CC)) {
/* Behave like FETCH_OBJ_W */
zend_free_op free_op1, free_op2;
zval *property;
- zval **container;
SAVE_OPLINE();
property = GET_OP2_ZVAL_PTR(BP_VAR_R);
- container = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_W);
+ container = GET_OP1_OBJ_ZVAL_PTR(BP_VAR_W);
if (IS_OP2_TMP_FREE()) {
MAKE_REAL_ZVAL_PTR(property);
}
- if (OP1_TYPE == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(&EX_T(opline->result.var), container, property, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W TSRMLS_CC);
if (IS_OP2_TMP_FREE()) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
FREE_OP2();
}
- if (OP1_TYPE == IS_VAR && OP1_FREE && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
+//??? if (OP1_TYPE == IS_VAR && OP1_FREE && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
FREE_OP1_VAR_PTR();
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -1524,40 +1476,38 @@ ZEND_VM_HANDLER(97, ZEND_FETCH_OBJ_UNSET, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
{
USE_OPLINE
zend_free_op free_op1, free_op2, free_res;
- zval **container;
+ zval *container;
zval *property;
SAVE_OPLINE();
- container = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_UNSET);
+ container = GET_OP1_OBJ_ZVAL_PTR(BP_VAR_UNSET);
property = GET_OP2_ZVAL_PTR(BP_VAR_R);
if (OP1_TYPE == IS_CV) {
- if (container != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(container);
- }
+ SEPARATE_ZVAL_IF_NOT_REF(container);
}
if (IS_OP2_TMP_FREE()) {
MAKE_REAL_ZVAL_PTR(property);
}
- if (OP1_TYPE == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(&EX_T(opline->result.var), container, property, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_UNSET TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_UNSET TSRMLS_CC);
if (IS_OP2_TMP_FREE()) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
FREE_OP2();
}
- if (OP1_TYPE == IS_VAR && OP1_FREE && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
+//??? if (OP1_TYPE == IS_VAR && OP1_FREE && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
FREE_OP1_VAR_PTR();
- PZVAL_UNLOCK(*EX_T(opline->result.var).var.ptr_ptr, &free_res);
- if (EX_T(opline->result.var).var.ptr_ptr != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(EX_T(opline->result.var).var.ptr_ptr);
- }
- PZVAL_LOCK(*EX_T(opline->result.var).var.ptr_ptr);
+//??? PZVAL_UNLOCK(EX_VAR(opline->result.var), &free_res);
+//??? if (EX_T(opline->result.var).var.ptr_ptr != &EG(uninitialized_zval_ptr)) {
+//??? SEPARATE_ZVAL_IF_NOT_REF(EX_T(opline->result.var).var.ptr_ptr);
+//??? }
+//??? PZVAL_LOCK(EX_VAR(opline->result.var));
FREE_OP_VAR_PTR(free_res);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -1573,14 +1523,12 @@ ZEND_VM_HANDLER(98, ZEND_FETCH_DIM_TMP_VAR, CONST|TMP, CONST)
container = GET_OP1_ZVAL_PTR(BP_VAR_R);
if (UNEXPECTED(Z_TYPE_P(container) != IS_ARRAY)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
} else {
zend_free_op free_op2;
- zval *value = *zend_fetch_dimension_address_inner(Z_ARRVAL_P(container), GET_OP2_ZVAL_PTR(BP_VAR_R), OP2_TYPE, BP_VAR_R TSRMLS_CC);
+ zval *value = zend_fetch_dimension_address_inner(Z_ARRVAL_P(container), GET_OP2_ZVAL_PTR(BP_VAR_R), OP2_TYPE, BP_VAR_R TSRMLS_CC);
- PZVAL_LOCK(value);
- EX_T(opline->result.var).var.ptr = value;
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
FREE_OP2();
}
CHECK_EXCEPTION();
@@ -1591,22 +1539,22 @@ ZEND_VM_HANDLER(136, ZEND_ASSIGN_OBJ, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval **object_ptr;
+ zval *object;
zval *property_name;
SAVE_OPLINE();
- object_ptr = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_W);
+ object = GET_OP1_OBJ_ZVAL_PTR(BP_VAR_W);
property_name = GET_OP2_ZVAL_PTR(BP_VAR_R);
if (IS_OP2_TMP_FREE()) {
MAKE_REAL_ZVAL_PTR(property_name);
}
- if (OP1_TYPE == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_assign_to_object(RETURN_VALUE_USED(opline)?&EX_T(opline->result.var).var.ptr:NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (IS_OP2_TMP_FREE()) {
- zval_ptr_dtor(&property_name);
+ zval_ptr_dtor(property_name);
} else {
FREE_OP2();
}
@@ -1621,24 +1569,24 @@ ZEND_VM_HANDLER(147, ZEND_ASSIGN_DIM, VAR|CV, CONST|TMP|VAR|UNUSED|CV)
{
USE_OPLINE
zend_free_op free_op1;
- zval **object_ptr;
+ zval *object_ptr;
SAVE_OPLINE();
- object_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W);
+ object_ptr = GET_OP1_ZVAL_PTR(BP_VAR_W);
- if (OP1_TYPE == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_TYPE_P(object_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- if (Z_TYPE_PP(object_ptr) == IS_OBJECT) {
+ if (Z_TYPE_P(object_ptr) == IS_OBJECT) {
zend_free_op free_op2;
zval *property_name = GET_OP2_ZVAL_PTR(BP_VAR_R);
if (IS_OP2_TMP_FREE()) {
MAKE_REAL_ZVAL_PTR(property_name);
}
- zend_assign_to_object(RETURN_VALUE_USED(opline)?&EX_T(opline->result.var).var.ptr:NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (IS_OP2_TMP_FREE()) {
- zval_ptr_dtor(&property_name);
+ zval_ptr_dtor(property_name);
} else {
FREE_OP2();
}
@@ -1646,46 +1594,38 @@ ZEND_VM_HANDLER(147, ZEND_ASSIGN_DIM, VAR|CV, CONST|TMP|VAR|UNUSED|CV)
zend_free_op free_op2, free_op_data1, free_op_data2;
zval *value;
zval *dim = GET_OP2_ZVAL_PTR(BP_VAR_R);
- zval **variable_ptr_ptr;
+ zval *variable_ptr;
- zend_fetch_dimension_address(&EX_T((opline+1)->op2.var), object_ptr, dim, OP2_TYPE, BP_VAR_W TSRMLS_CC);
+ zend_fetch_dimension_address(EX_VAR((opline+1)->op2.var), object_ptr, dim, OP2_TYPE, BP_VAR_W TSRMLS_CC);
FREE_OP2();
value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
- variable_ptr_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
- if (UNEXPECTED(variable_ptr_ptr == NULL)) {
- if (zend_assign_to_string_offset(&EX_T((opline+1)->op2.var), value, (opline+1)->op1_type TSRMLS_CC)) {
+ variable_ptr = _get_zval_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
+ if (UNEXPECTED(Z_TYPE_P(variable_ptr) == IS_STR_OFFSET)) {
+ if (zend_assign_to_string_offset(EX_VAR((opline+1)->op2.var), value, (opline+1)->op1_type TSRMLS_CC)) {
if (RETURN_VALUE_USED(opline)) {
- zval *retval;
-
- ALLOC_ZVAL(retval);
- ZVAL_STRINGL(retval, Z_STRVAL_P(EX_T((opline+1)->op2.var).str_offset.str)+EX_T((opline+1)->op2.var).str_offset.offset, 1, 1);
- INIT_PZVAL(retval);
- EX_T(opline->result.var).var.ptr = retval;
+ ZVAL_STRINGL(EX_VAR(opline->result.var), Z_STR_OFFSET_P(EX_VAR((opline+1)->op2.var))->str + Z_STR_OFFSET_P(EX_VAR((opline+1)->op2.var))->offset, 1);
}
} else if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
- } else if (UNEXPECTED(*variable_ptr_ptr == &EG(error_zval))) {
+ } else if (UNEXPECTED(variable_ptr == &EG(error_zval))) {
if (IS_TMP_FREE(free_op_data1)) {
zval_dtor(value);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
} else {
if ((opline+1)->op1_type == IS_TMP_VAR) {
- value = zend_assign_tmp_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_tmp_to_variable(variable_ptr, value TSRMLS_CC);
} else if ((opline+1)->op1_type == IS_CONST) {
- value = zend_assign_const_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_const_to_variable(variable_ptr, value TSRMLS_CC);
} else {
- value = zend_assign_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_to_variable(variable_ptr, value TSRMLS_CC);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(value);
- EX_T(opline->result.var).var.ptr = value;
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
}
}
FREE_OP_VAR_PTR(free_op_data2);
@@ -1703,45 +1643,37 @@ ZEND_VM_HANDLER(38, ZEND_ASSIGN, VAR|CV, CONST|TMP|VAR|CV)
USE_OPLINE
zend_free_op free_op1, free_op2;
zval *value;
- zval **variable_ptr_ptr;
+ zval *variable_ptr;
SAVE_OPLINE();
value = GET_OP2_ZVAL_PTR(BP_VAR_R);
- variable_ptr_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W);
+ variable_ptr = GET_OP1_ZVAL_PTR(BP_VAR_W);
- if (OP1_TYPE == IS_VAR && UNEXPECTED(variable_ptr_ptr == NULL)) {
- if (zend_assign_to_string_offset(&EX_T(opline->op1.var), value, OP2_TYPE TSRMLS_CC)) {
+ if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_TYPE_P(variable_ptr) == IS_STR_OFFSET)) {
+ if (zend_assign_to_string_offset(EX_VAR(opline->op1.var), value, OP2_TYPE TSRMLS_CC)) {
if (RETURN_VALUE_USED(opline)) {
- zval *retval;
-
- ALLOC_ZVAL(retval);
- ZVAL_STRINGL(retval, Z_STRVAL_P(EX_T(opline->op1.var).str_offset.str)+EX_T(opline->op1.var).str_offset.offset, 1, 1);
- INIT_PZVAL(retval);
- EX_T(opline->result.var).var.ptr = retval;
+ ZVAL_STRINGL(EX_VAR(opline->result.var), Z_STR_OFFSET_P(EX_VAR(opline->op1.var))->str + Z_STR_OFFSET_P(EX_VAR(opline->op1.var))->offset, 1);
}
} else if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
- } else if (OP1_TYPE == IS_VAR && UNEXPECTED(*variable_ptr_ptr == &EG(error_zval))) {
+ } else if (OP1_TYPE == IS_VAR && UNEXPECTED(variable_ptr == &EG(error_zval))) {
if (IS_OP2_TMP_FREE()) {
zval_dtor(value);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
} else {
if (OP2_TYPE == IS_TMP_VAR) {
- value = zend_assign_tmp_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_tmp_to_variable(variable_ptr, value TSRMLS_CC);
} else if (OP2_TYPE == IS_CONST) {
- value = zend_assign_const_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_const_to_variable(variable_ptr, value TSRMLS_CC);
} else {
- value = zend_assign_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_to_variable(variable_ptr, value TSRMLS_CC);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(value);
- EX_T(opline->result.var).var.ptr = value;
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
}
}
@@ -1758,19 +1690,19 @@ ZEND_VM_HANDLER(39, ZEND_ASSIGN_REF, VAR|CV, VAR|CV)
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval **variable_ptr_ptr;
- zval **value_ptr_ptr;
+ zval *variable_ptr;
+ zval *value_ptr;
SAVE_OPLINE();
- value_ptr_ptr = GET_OP2_ZVAL_PTR_PTR(BP_VAR_W);
+ value_ptr = GET_OP2_ZVAL_PTR(BP_VAR_W);
if (OP2_TYPE == IS_VAR &&
- value_ptr_ptr &&
- !Z_ISREF_PP(value_ptr_ptr) &&
- opline->extended_value == ZEND_RETURNS_FUNCTION &&
- !EX_T(opline->op2.var).var.fcall_returned_reference) {
+ value_ptr &&
+ !Z_ISREF_P(value_ptr) &&
+ opline->extended_value == ZEND_RETURNS_FUNCTION /*???&&
+ !EX_T(opline->op2.var).var.fcall_returned_reference*/) {
if (free_op2.var == NULL) {
- PZVAL_LOCK(*value_ptr_ptr); /* undo the effect of get_zval_ptr_ptr() */
+ PZVAL_LOCK(value_ptr); /* undo the effect of get_zval_ptr_ptr() */
}
zend_error(E_STRICT, "Only variables should be assigned by reference");
if (UNEXPECTED(EG(exception) != NULL)) {
@@ -1779,26 +1711,25 @@ ZEND_VM_HANDLER(39, ZEND_ASSIGN_REF, VAR|CV, VAR|CV)
}
ZEND_VM_DISPATCH_TO_HANDLER(ZEND_ASSIGN);
} else if (OP2_TYPE == IS_VAR && opline->extended_value == ZEND_RETURNS_NEW) {
- PZVAL_LOCK(*value_ptr_ptr);
- }
- if (OP1_TYPE == IS_VAR && UNEXPECTED(EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr)) {
- zend_error_noreturn(E_ERROR, "Cannot assign by reference to overloaded object");
+ PZVAL_LOCK(value_ptr);
}
+//??? if (OP1_TYPE == IS_VAR && UNEXPECTED(EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr)) {
+//??? zend_error_noreturn(E_ERROR, "Cannot assign by reference to overloaded object");
+//??? }
- variable_ptr_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W);
- if ((OP2_TYPE == IS_VAR && UNEXPECTED(value_ptr_ptr == NULL)) ||
- (OP1_TYPE == IS_VAR && UNEXPECTED(variable_ptr_ptr == NULL))) {
+ variable_ptr = GET_OP1_ZVAL_PTR(BP_VAR_W);
+ if ((OP2_TYPE == IS_VAR && UNEXPECTED(Z_TYPE_P(value_ptr) == IS_STR_OFFSET)) ||
+ (OP1_TYPE == IS_VAR && UNEXPECTED(Z_TYPE_P(variable_ptr) == IS_STR_OFFSET))) {
zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets nor overloaded objects");
}
- zend_assign_to_variable_reference(variable_ptr_ptr, value_ptr_ptr TSRMLS_CC);
+ zend_assign_to_variable_reference(variable_ptr, value_ptr TSRMLS_CC);
if (OP2_TYPE == IS_VAR && opline->extended_value == ZEND_RETURNS_NEW) {
- Z_DELREF_PP(variable_ptr_ptr);
+ Z_DELREF_P(variable_ptr);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(*variable_ptr_ptr);
- EX_T(opline->result.var).var.ptr = *variable_ptr_ptr;
+ ZVAL_COPY(EX_VAR(opline->result.var), variable_ptr);
}
FREE_OP1_VAR_PTR();
@@ -1819,10 +1750,10 @@ ZEND_VM_HELPER(zend_leave_helper, ANY, ANY)
i_free_compiled_variables(execute_data TSRMLS_CC);
}
- zend_vm_stack_free((char*)execute_data - (ZEND_MM_ALIGNED_SIZE(sizeof(temp_variable)) * op_array->T) TSRMLS_CC);
+ zend_vm_stack_free((char*)execute_data - (ZEND_MM_ALIGNED_SIZE(sizeof(zval)) * op_array->T) TSRMLS_CC);
if ((op_array->fn_flags & ZEND_ACC_CLOSURE) && op_array->prototype) {
- zval_ptr_dtor((zval**)&op_array->prototype);
+ zval_ptr_dtor((zval*)op_array->prototype);
}
if (nested) {
@@ -1840,7 +1771,7 @@ ZEND_VM_HELPER(zend_leave_helper, ANY, ANY)
EG(opline_ptr) = &EX(opline);
EG(active_op_array) = EX(op_array);
- EG(return_value_ptr_ptr) = EX(original_return_value);
+//??? EG(return_value_ptr_ptr) = EX(original_return_value);
destroy_op_array(op_array TSRMLS_CC);
efree(op_array);
if (UNEXPECTED(EG(exception) != NULL)) {
@@ -1853,7 +1784,7 @@ ZEND_VM_HELPER(zend_leave_helper, ANY, ANY)
} else {
EG(opline_ptr) = &EX(opline);
EG(active_op_array) = EX(op_array);
- EG(return_value_ptr_ptr) = EX(original_return_value);
+//??? EG(return_value_ptr_ptr) = EX(original_return_value);
if (EG(active_symbol_table)) {
zend_clean_and_cache_symbol_table(EG(active_symbol_table) TSRMLS_CC);
}
@@ -1862,20 +1793,20 @@ ZEND_VM_HELPER(zend_leave_helper, ANY, ANY)
EX(function_state).function = (zend_function *) EX(op_array);
EX(function_state).arguments = NULL;
- if (EG(This)) {
+ if (Z_TYPE(EG(This)) != IS_UNDEF) {
if (UNEXPECTED(EG(exception) != NULL) && EX(call)->is_ctor_call) {
if (EX(call)->is_ctor_result_used) {
- Z_DELREF_P(EG(This));
+ Z_DELREF(EG(This));
}
- if (Z_REFCOUNT_P(EG(This)) == 1) {
- zend_object_store_ctor_failed(EG(This) TSRMLS_CC);
+ if (Z_REFCOUNT(EG(This)) == 1) {
+ zend_object_store_ctor_failed(&EG(This) TSRMLS_CC);
}
}
zval_ptr_dtor(&EG(This));
}
- EG(This) = EX(current_this);
- EG(scope) = EX(current_scope);
- EG(called_scope) = EX(current_called_scope);
+//??? EG(This) = EX(current_this);
+//??? EG(scope) = EX(current_scope);
+//??? EG(called_scope) = EX(current_called_scope);
EX(call)--;
@@ -1883,8 +1814,8 @@ ZEND_VM_HELPER(zend_leave_helper, ANY, ANY)
if (UNEXPECTED(EG(exception) != NULL)) {
zend_throw_exception_internal(NULL TSRMLS_CC);
- if (RETURN_VALUE_USED(opline) && EX_T(opline->result.var).var.ptr) {
- zval_ptr_dtor(&EX_T(opline->result.var).var.ptr);
+ if (RETURN_VALUE_USED(opline) /*???&& EX_VAR(opline->result.var).var.ptr*/) {
+ zval_ptr_dtor(EX_VAR(opline->result.var));
}
HANDLE_EXCEPTION_LEAVE();
}
@@ -1904,16 +1835,16 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
zend_uint num_args;
SAVE_OPLINE();
- EX(object) = EX(call)->object;
+ ZVAL_COPY_VALUE(&EX(object), &EX(call)->object);
if (UNEXPECTED((fbc->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_DEPRECATED)) != 0)) {
if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_ABSTRACT) != 0)) {
zend_error_noreturn(E_ERROR, "Cannot call abstract method %s::%s()", fbc->common.scope->name, fbc->common.function_name);
}
if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_DEPRECATED) != 0)) {
zend_error(E_DEPRECATED, "Function %s%s%s() is deprecated",
- fbc->common.scope ? fbc->common.scope->name : "",
+ fbc->common.scope ? fbc->common.scope->name->val : "",
fbc->common.scope ? "::" : "",
- fbc->common.function_name);
+ fbc->common.function_name->val);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
@@ -1921,11 +1852,11 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
}
if (fbc->common.scope &&
!(fbc->common.fn_flags & ZEND_ACC_STATIC) &&
- !EX(object)) {
+ Z_TYPE(EX(object)) == IS_UNDEF) {
if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
/* FIXME: output identifiers properly */
- zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically", fbc->common.scope->name, fbc->common.function_name);
+ zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically", fbc->common.scope->name->val, fbc->common.function_name->val);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
@@ -1938,11 +1869,11 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
if (fbc->type == ZEND_USER_FUNCTION || fbc->common.scope) {
should_change_scope = 1;
- EX(current_this) = EG(This);
- EX(current_scope) = EG(scope);
- EX(current_called_scope) = EG(called_scope);
+//??? EX(current_this) = EG(This);
+//??? EX(current_scope) = EG(scope);
+//??? EX(current_called_scope) = EG(called_scope);
EG(This) = EX(object);
- EG(scope) = (fbc->type == ZEND_USER_FUNCTION || !EX(object)) ? fbc->common.scope : NULL;
+ EG(scope) = (fbc->type == ZEND_USER_FUNCTION || Z_TYPE(EX(object)) == IS_UNDEF) ? fbc->common.scope : NULL;
EG(called_scope) = EX(call)->called_scope;
}
@@ -1958,51 +1889,50 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
if (fbc->type == ZEND_INTERNAL_FUNCTION) {
if (fbc->common.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) {
zend_uint i;
- void **p = EX(function_state).arguments - num_args;
+ zval *p = EX(function_state).arguments - num_args;
for (i = 0; i < num_args; ++i, ++p) {
- zend_verify_arg_type(fbc, i + 1, (zval *) *p, 0 TSRMLS_CC);
+ zend_verify_arg_type(fbc, i + 1, p, 0 TSRMLS_CC);
}
}
if (EXPECTED(EG(exception) == NULL)) {
- temp_variable *ret = &EX_T(opline->result.var);
+ zval *ret = EX_VAR(opline->result.var);
- MAKE_STD_ZVAL(ret->var.ptr);
- ZVAL_NULL(ret->var.ptr);
- ret->var.ptr_ptr = &ret->var.ptr;
- ret->var.fcall_returned_reference = (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0;
+ ZVAL_NULL(ret);
+//??? ret->var.ptr_ptr = &ret->var.ptr;
+//??? ret->var.fcall_returned_reference = (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0;
if (!zend_execute_internal) {
/* saves one function call if zend_execute_internal is not used */
- fbc->internal_function.handler(num_args, ret->var.ptr, &ret->var.ptr, EX(object), RETURN_VALUE_USED(opline) TSRMLS_CC);
+ fbc->internal_function.handler(num_args, ret, &EX(object), RETURN_VALUE_USED(opline) TSRMLS_CC);
} else {
zend_execute_internal(execute_data, NULL, RETURN_VALUE_USED(opline) TSRMLS_CC);
}
if (!RETURN_VALUE_USED(opline)) {
- zval_ptr_dtor(&ret->var.ptr);
+ zval_ptr_dtor(ret);
}
- } else if (RETURN_VALUE_USED(opline)) {
- EX_T(opline->result.var).var.ptr = NULL;
+ } else if (RETURN_VALUE_USED(opline)) {
+//??? EX_T(opline->result.var).var.ptr = NULL;
}
} else if (fbc->type == ZEND_USER_FUNCTION) {
- EX(original_return_value) = EG(return_value_ptr_ptr);
+//??? EX(original_return_value) = EG(return_value_ptr_ptr);
EG(active_symbol_table) = NULL;
EG(active_op_array) = &fbc->op_array;
- EG(return_value_ptr_ptr) = NULL;
+//??? EG(return_value_ptr_ptr) = NULL;
if (RETURN_VALUE_USED(opline)) {
- temp_variable *ret = &EX_T(opline->result.var);
+ zval *ret = EX_VAR(opline->result.var);
- ret->var.ptr = NULL;
- EG(return_value_ptr_ptr) = &ret->var.ptr;
- ret->var.ptr_ptr = &ret->var.ptr;
- ret->var.fcall_returned_reference = (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0;
+ ZVAL_NULL(ret);
+//??? EG(return_value_ptr_ptr) = &ret->var.ptr;
+//??? ret->var.ptr_ptr = &ret->var.ptr;
+//??? ret->var.fcall_returned_reference = (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0;
}
if (UNEXPECTED((EG(active_op_array)->fn_flags & ZEND_ACC_GENERATOR) != 0)) {
if (RETURN_VALUE_USED(opline)) {
- EX_T(opline->result.var).var.ptr = zend_generator_create_zval(EG(active_op_array) TSRMLS_CC);
+ zend_generator_create_zval(EG(active_op_array), EX_VAR(opline->result.var) TSRMLS_CC);
}
} else if (EXPECTED(zend_execute_ex == execute_ex)) {
if (EXPECTED(EG(exception) == NULL)) {
@@ -2014,18 +1944,17 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
EG(opline_ptr) = &EX(opline);
EG(active_op_array) = EX(op_array);
- EG(return_value_ptr_ptr) = EX(original_return_value);
+//??? EG(return_value_ptr_ptr) = EX(original_return_value);
if (EG(active_symbol_table)) {
zend_clean_and_cache_symbol_table(EG(active_symbol_table) TSRMLS_CC);
}
EG(active_symbol_table) = EX(symbol_table);
} else { /* ZEND_OVERLOADED_FUNCTION */
- MAKE_STD_ZVAL(EX_T(opline->result.var).var.ptr);
- ZVAL_NULL(EX_T(opline->result.var).var.ptr);
+ ZVAL_NULL(EX_VAR(opline->result.var));
/* Not sure what should be done here if it's a static method */
- if (EXPECTED(EX(object) != NULL)) {
- Z_OBJ_HT_P(EX(object))->call_method(fbc->common.function_name, num_args, EX_T(opline->result.var).var.ptr, &EX_T(opline->result.var).var.ptr, EX(object), RETURN_VALUE_USED(opline) TSRMLS_CC);
+ if (EXPECTED(Z_TYPE(EX(object)) != IS_UNDEF)) {
+ Z_OBJ_HT_P(&EX(object))->call_method(fbc->common.function_name, num_args, EX_VAR(opline->result.var), &EX(object), RETURN_VALUE_USED(opline) TSRMLS_CC);
} else {
zend_error_noreturn(E_ERROR, "Cannot call overloaded function for non-object");
}
@@ -2036,12 +1965,12 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
efree(fbc);
if (!RETURN_VALUE_USED(opline)) {
- zval_ptr_dtor(&EX_T(opline->result.var).var.ptr);
+ zval_ptr_dtor(EX_VAR(opline->result.var));
} else {
- Z_UNSET_ISREF_P(EX_T(opline->result.var).var.ptr);
- Z_SET_REFCOUNT_P(EX_T(opline->result.var).var.ptr, 1);
- EX_T(opline->result.var).var.fcall_returned_reference = 0;
- EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
+//??? Z_UNSET_ISREF_P(EX_T(opline->result.var).var.ptr);
+//??? Z_SET_REFCOUNT_P(EX_T(opline->result.var).var.ptr, 1);
+//??? EX_T(opline->result.var).var.fcall_returned_reference = 0;
+//??? EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
}
}
@@ -2049,20 +1978,20 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
EX(function_state).arguments = NULL;
if (should_change_scope) {
- if (EG(This)) {
+ if (Z_TYPE(EG(This)) != IS_UNDEF) {
if (UNEXPECTED(EG(exception) != NULL) && EX(call)->is_ctor_call) {
if (EX(call)->is_ctor_result_used) {
- Z_DELREF_P(EG(This));
+ Z_DELREF(EG(This));
}
- if (Z_REFCOUNT_P(EG(This)) == 1) {
- zend_object_store_ctor_failed(EG(This) TSRMLS_CC);
+ if (Z_REFCOUNT(EG(This)) == 1) {
+ zend_object_store_ctor_failed(&EG(This) TSRMLS_CC);
}
}
zval_ptr_dtor(&EG(This));
}
- EG(This) = EX(current_this);
- EG(scope) = EX(current_scope);
- EG(called_scope) = EX(current_called_scope);
+//??? EG(This) = EX(current_this);
+//??? EG(scope) = EX(current_scope);
+//??? EG(called_scope) = EX(current_called_scope);
}
EX(call)--;
@@ -2071,8 +2000,8 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
if (UNEXPECTED(EG(exception) != NULL)) {
zend_throw_exception_internal(NULL TSRMLS_CC);
- if (RETURN_VALUE_USED(opline) && EX_T(opline->result.var).var.ptr) {
- zval_ptr_dtor(&EX_T(opline->result.var).var.ptr);
+ if (RETURN_VALUE_USED(opline) /*???&& EX_T(opline->result.var).var.ptr*/) {
+ zval_ptr_dtor(EX_VAR(opline->result.var));
}
HANDLE_EXCEPTION();
}
@@ -2204,8 +2133,7 @@ ZEND_VM_HANDLER(46, ZEND_JMPZ_EX, CONST|TMP|VAR|CV, ANY)
HANDLE_EXCEPTION();
}
}
- Z_LVAL(EX_T(opline->result.var).tmp_var) = retval;
- Z_TYPE(EX_T(opline->result.var).tmp_var) = IS_BOOL;
+ ZVAL_BOOL(EX_VAR(opline->result.var), retval);
if (!retval) {
#if DEBUG_ZEND>=2
printf("Conditional jmp to %d\n", opline->op2.opline_num);
@@ -2235,8 +2163,7 @@ ZEND_VM_HANDLER(47, ZEND_JMPNZ_EX, CONST|TMP|VAR|CV, ANY)
HANDLE_EXCEPTION();
}
}
- Z_LVAL(EX_T(opline->result.var).tmp_var) = retval;
- Z_TYPE(EX_T(opline->result.var).tmp_var) = IS_BOOL;
+ ZVAL_BOOL(EX_VAR(opline->result.var), retval);
if (retval) {
#if DEBUG_ZEND>=2
printf("Conditional jmp to %d\n", opline->op2.opline_num);
@@ -2253,9 +2180,9 @@ ZEND_VM_HANDLER(70, ZEND_FREE, TMP|VAR, ANY)
SAVE_OPLINE();
if (OP1_TYPE == IS_TMP_VAR) {
- zendi_zval_dtor(EX_T(opline->op1.var).tmp_var);
+ zval_dtor(EX_VAR(opline->op1.var));
} else {
- zval_ptr_dtor(&EX_T(opline->op1.var).var.ptr);
+ zval_ptr_dtor(EX_VAR(opline->op1.var));
}
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -2264,15 +2191,10 @@ ZEND_VM_HANDLER(70, ZEND_FREE, TMP|VAR, ANY)
ZEND_VM_HANDLER(53, ZEND_INIT_STRING, ANY, ANY)
{
USE_OPLINE
- zval *tmp = &EX_T(opline->result.var).tmp_var;
+ zval *tmp = EX_VAR(opline->result.var);
SAVE_OPLINE();
- tmp->value.str.val = emalloc(1);
- tmp->value.str.val[0] = 0;
- tmp->value.str.len = 0;
- Z_SET_REFCOUNT_P(tmp, 1);
- tmp->type = IS_STRING;
- Z_UNSET_ISREF_P(tmp);
+ ZVAL_EMPTY_STRING(tmp);
/*CHECK_EXCEPTION();*/
ZEND_VM_NEXT_OPCODE();
}
@@ -2280,17 +2202,13 @@ ZEND_VM_HANDLER(53, ZEND_INIT_STRING, ANY, ANY)
ZEND_VM_HANDLER(54, ZEND_ADD_CHAR, TMP|UNUSED, CONST)
{
USE_OPLINE
- zval *str = &EX_T(opline->result.var).tmp_var;
+ zval *str = EX_VAR(opline->result.var);
SAVE_OPLINE();
if (OP1_TYPE == IS_UNUSED) {
/* Initialize for erealloc in add_char_to_string */
- Z_STRVAL_P(str) = NULL;
- Z_STRLEN_P(str) = 0;
- Z_TYPE_P(str) = IS_STRING;
-
- INIT_PZVAL(str);
+ ZVAL_STR(str, STR_EMPTY_ALLOC());
}
add_char_to_string(str, str, opline->op2.zv);
@@ -2303,17 +2221,13 @@ ZEND_VM_HANDLER(54, ZEND_ADD_CHAR, TMP|UNUSED, CONST)
ZEND_VM_HANDLER(55, ZEND_ADD_STRING, TMP|UNUSED, CONST)
{
USE_OPLINE
- zval *str = &EX_T(opline->result.var).tmp_var;
+ zval *str = EX_VAR(opline->result.var);
SAVE_OPLINE();
if (OP1_TYPE == IS_UNUSED) {
/* Initialize for erealloc in add_string_to_string */
- Z_STRVAL_P(str) = NULL;
- Z_STRLEN_P(str) = 0;
- Z_TYPE_P(str) = IS_STRING;
-
- INIT_PZVAL(str);
+ ZVAL_STR(str, STR_EMPTY_ALLOC());
}
add_string_to_string(str, str, opline->op2.zv);
@@ -2327,7 +2241,7 @@ ZEND_VM_HANDLER(56, ZEND_ADD_VAR, TMP|UNUSED, TMP|VAR|CV)
{
USE_OPLINE
zend_free_op free_op2;
- zval *str = &EX_T(opline->result.var).tmp_var;
+ zval *str = EX_VAR(opline->result.var);
zval *var;
zval var_copy;
int use_copy = 0;
@@ -2337,11 +2251,7 @@ ZEND_VM_HANDLER(56, ZEND_ADD_VAR, TMP|UNUSED, TMP|VAR|CV)
if (OP1_TYPE == IS_UNUSED) {
/* Initialize for erealloc in add_string_to_string */
- Z_STRVAL_P(str) = NULL;
- Z_STRLEN_P(str) = 0;
- Z_TYPE_P(str) = IS_STRING;
-
- INIT_PZVAL(str);
+ ZVAL_STR(str, STR_EMPTY_ALLOC());
}
if (Z_TYPE_P(var) != IS_STRING) {
@@ -2377,7 +2287,7 @@ ZEND_VM_HANDLER(109, ZEND_FETCH_CLASS, ANY, CONST|TMP|VAR|UNUSED|CV)
zend_exception_save(TSRMLS_C);
}
if (OP2_TYPE == IS_UNUSED) {
- EX_T(opline->result.var).class_entry = zend_fetch_class(NULL, 0, opline->extended_value TSRMLS_CC);
+ Z_CE_P(EX_VAR(opline->result.var)) = zend_fetch_class(NULL, opline->extended_value TSRMLS_CC);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
} else {
@@ -2386,15 +2296,15 @@ ZEND_VM_HANDLER(109, ZEND_FETCH_CLASS, ANY, CONST|TMP|VAR|UNUSED|CV)
if (OP2_TYPE == IS_CONST) {
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- EX_T(opline->result.var).class_entry = CACHED_PTR(opline->op2.literal->cache_slot);
+ Z_CE_P(EX_VAR(opline->result.var)) = CACHED_PTR(opline->op2.literal->cache_slot);
} else {
- EX_T(opline->result.var).class_entry = zend_fetch_class_by_name(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->op2.literal + 1, opline->extended_value TSRMLS_CC);
- CACHE_PTR(opline->op2.literal->cache_slot, EX_T(opline->result.var).class_entry);
+ Z_CE_P(EX_VAR(opline->result.var)) = zend_fetch_class_by_name(Z_STR_P(class_name), opline->op2.literal + 1, opline->extended_value TSRMLS_CC);
+ CACHE_PTR(opline->op2.literal->cache_slot, Z_CE_P(EX_VAR(opline->result.var)));
}
} else if (Z_TYPE_P(class_name) == IS_OBJECT) {
- EX_T(opline->result.var).class_entry = Z_OBJCE_P(class_name);
+ Z_CE_P(EX_VAR(opline->result.var)) = Z_OBJCE_P(class_name);
} else if (Z_TYPE_P(class_name) == IS_STRING) {
- EX_T(opline->result.var).class_entry = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->extended_value TSRMLS_CC);
+ Z_CE_P(EX_VAR(opline->result.var)) = zend_fetch_class(Z_STR_P(class_name), opline->extended_value TSRMLS_CC);
} else {
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
@@ -2412,8 +2322,6 @@ ZEND_VM_HANDLER(112, ZEND_INIT_METHOD_CALL, TMP|VAR|UNUSED|CV, CONST|TMP|VAR|CV)
{
USE_OPLINE
zval *function_name;
- char *function_name_strval;
- int function_name_strlen;
zend_free_op free_op1, free_op2;
call_slot *call = EX(call_slots) + opline->result.num;
@@ -2429,32 +2337,29 @@ ZEND_VM_HANDLER(112, ZEND_INIT_METHOD_CALL, TMP|VAR|UNUSED|CV, CONST|TMP|VAR|CV)
zend_error_noreturn(E_ERROR, "Method name must be a string");
}
- function_name_strval = Z_STRVAL_P(function_name);
- function_name_strlen = Z_STRLEN_P(function_name);
-
- call->object = GET_OP1_OBJ_ZVAL_PTR(BP_VAR_R);
+ ZVAL_COPY_VALUE(&call->object, GET_OP1_OBJ_ZVAL_PTR(BP_VAR_R));
- if (EXPECTED(call->object != NULL) &&
- EXPECTED(Z_TYPE_P(call->object) == IS_OBJECT)) {
- call->called_scope = Z_OBJCE_P(call->object);
+ if (EXPECTED(Z_TYPE(call->object) != IS_UNDEF) &&
+ EXPECTED(Z_TYPE(call->object) == IS_OBJECT)) {
+ call->called_scope = Z_OBJCE(call->object);
if (OP2_TYPE != IS_CONST ||
(call->fbc = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope)) == NULL) {
- zval *object = call->object;
+ zend_object *object = Z_OBJ(call->object);
- if (UNEXPECTED(Z_OBJ_HT_P(call->object)->get_method == NULL)) {
+ if (UNEXPECTED(Z_OBJ_HT(call->object)->get_method == NULL)) {
zend_error_noreturn(E_ERROR, "Object does not support method calls");
}
/* First, locate the function. */
- call->fbc = Z_OBJ_HT_P(call->object)->get_method(&call->object, function_name_strval, function_name_strlen, ((OP2_TYPE == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
+ call->fbc = Z_OBJ_HT(call->object)->get_method(&call->object, Z_STR_P(function_name), ((OP2_TYPE == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
if (UNEXPECTED(call->fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(call->object), function_name_strval);
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(&call->object), Z_STRVAL_P(function_name));
}
if (OP2_TYPE == IS_CONST &&
EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0) &&
- EXPECTED(call->object == object)) {
+ EXPECTED(Z_OBJ(call->object) == object)) {
CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope, call->fbc);
}
}
@@ -2463,20 +2368,16 @@ ZEND_VM_HANDLER(112, ZEND_INIT_METHOD_CALL, TMP|VAR|UNUSED|CV, CONST|TMP|VAR|CV)
FREE_OP2();
HANDLE_EXCEPTION();
}
- zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval);
+ zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", Z_STRVAL_P(function_name));
}
if ((call->fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) {
- call->object = NULL;
+ ZVAL_UNDEF(&call->object);
} else {
- if (!PZVAL_IS_REF(call->object)) {
- Z_ADDREF_P(call->object); /* For $this pointer */
+ if (!Z_ISREF(call->object)) {
+ Z_ADDREF(call->object); /* For $this pointer */
} else {
- zval *this_ptr;
- ALLOC_ZVAL(this_ptr);
- INIT_PZVAL_COPY(this_ptr, call->object);
- zval_copy_ctor(this_ptr);
- call->object = this_ptr;
+ ZVAL_DUP(&call->object, Z_REFVAL(call->object));
}
}
@@ -2505,7 +2406,7 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CONST|VAR, CONST|TMP|VAR|UNUS
if (CACHED_PTR(opline->op1.literal->cache_slot)) {
ce = CACHED_PTR(opline->op1.literal->cache_slot);
} else {
- ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
@@ -2516,7 +2417,7 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CONST|VAR, CONST|TMP|VAR|UNUS
}
call->called_scope = ce;
} else {
- ce = EX_T(opline->op1.var).class_entry;
+ ce = Z_CE_P(EX_VAR(opline->op1.var));
if (opline->extended_value == ZEND_FETCH_CLASS_PARENT || opline->extended_value == ZEND_FETCH_CLASS_SELF) {
call->called_scope = EG(called_scope);
@@ -2534,44 +2435,33 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CONST|VAR, CONST|TMP|VAR|UNUS
(call->fbc = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce))) {
/* do nothing */
} else if (OP2_TYPE != IS_UNUSED) {
- char *function_name_strval = NULL;
- int function_name_strlen = 0;
zend_free_op free_op2;
- if (OP2_TYPE == IS_CONST) {
- function_name_strval = Z_STRVAL_P(opline->op2.zv);
- function_name_strlen = Z_STRLEN_P(opline->op2.zv);
- } else {
- function_name = GET_OP2_ZVAL_PTR(BP_VAR_R);
-
+ function_name = GET_OP2_ZVAL_PTR(BP_VAR_R);
+ if (OP2_TYPE != IS_CONST) {
if (UNEXPECTED(Z_TYPE_P(function_name) != IS_STRING)) {
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
zend_error_noreturn(E_ERROR, "Function name must be a string");
- } else {
- function_name_strval = Z_STRVAL_P(function_name);
- function_name_strlen = Z_STRLEN_P(function_name);
}
}
- if (function_name_strval) {
- if (ce->get_static_method) {
- call->fbc = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
+ if (ce->get_static_method) {
+ call->fbc = ce->get_static_method(ce, Z_STR_P(function_name) TSRMLS_CC);
+ } else {
+ call->fbc = zend_std_get_static_method(ce, Z_STR_P(function_name), ((OP2_TYPE == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
+ }
+ if (UNEXPECTED(call->fbc == NULL)) {
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", ce->name->val, Z_STRVAL_P(function_name));
+ }
+ if (OP2_TYPE == IS_CONST &&
+ EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
+ EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0)) {
+ if (OP1_TYPE == IS_CONST) {
+ CACHE_PTR(opline->op2.literal->cache_slot, call->fbc);
} else {
- call->fbc = zend_std_get_static_method(ce, function_name_strval, function_name_strlen, ((OP2_TYPE == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
- }
- if (UNEXPECTED(call->fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", ce->name, function_name_strval);
- }
- if (OP2_TYPE == IS_CONST &&
- EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
- EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0)) {
- if (OP1_TYPE == IS_CONST) {
- CACHE_PTR(opline->op2.literal->cache_slot, call->fbc);
- } else {
- CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce, call->fbc);
- }
+ CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce, call->fbc);
}
}
if (OP2_TYPE != IS_CONST) {
@@ -2581,31 +2471,28 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CONST|VAR, CONST|TMP|VAR|UNUS
if (UNEXPECTED(ce->constructor == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot call constructor");
}
- if (EG(This) && Z_OBJCE_P(EG(This)) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
- zend_error_noreturn(E_ERROR, "Cannot call private %s::__construct()", ce->name);
+ if (Z_TYPE(EG(This)) != IS_UNDEF && Z_OBJCE(EG(This)) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
+ zend_error_noreturn(E_ERROR, "Cannot call private %s::__construct()", ce->name->val);
}
call->fbc = ce->constructor;
}
if (call->fbc->common.fn_flags & ZEND_ACC_STATIC) {
- call->object = NULL;
+ ZVAL_UNDEF(&call->object);
} else {
- if (EG(This) &&
- Z_OBJ_HT_P(EG(This))->get_class_entry &&
- !instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) {
+ if (Z_TYPE(EG(This)) != IS_UNDEF &&
+ Z_OBJ_HT(EG(This))->get_class_entry &&
+ !instanceof_function(Z_OBJCE(EG(This)), ce TSRMLS_CC)) {
/* We are calling method of the other (incompatible) class,
but passing $this. This is done for compatibility with php-4. */
if (call->fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
- zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name);
+ zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name->val, call->fbc->common.function_name->val);
} else {
/* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */
- zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name);
+ zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", call->fbc->common.scope->name->val, call->fbc->common.function_name->val);
}
}
- if ((call->object = EG(This))) {
- Z_ADDREF_P(call->object);
- call->called_scope = Z_OBJCE_P(call->object);
- }
+ ZVAL_COPY(&call->object, &EG(This));
}
call->num_additional_args = 0;
@@ -2619,21 +2506,22 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CONST|VAR, CONST|TMP|VAR|UNUS
ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV)
{
USE_OPLINE
- zval *function_name;
+ zval *function_name, *func;
call_slot *call = EX(call_slots) + opline->result.num;
if (OP2_TYPE == IS_CONST) {
function_name = (zval*)(opline->op2.literal+1);
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
call->fbc = CACHED_PTR(opline->op2.literal->cache_slot);
- } else if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(function_name), Z_STRLEN_P(function_name)+1, Z_HASH_P(function_name), (void **) &call->fbc) == FAILURE)) {
+ } else if (UNEXPECTED((func = zend_hash_find(EG(function_table), Z_STR_P(function_name))) == NULL)) {
SAVE_OPLINE();
zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(opline->op2.zv));
} else {
+ call->fbc = Z_FUNC_P(func);
CACHE_PTR(opline->op2.literal->cache_slot, call->fbc);
}
- call->object = NULL;
+ ZVAL_UNDEF(&call->object);
call->called_scope = NULL;
call->num_additional_args = 0;
call->is_ctor_call = 0;
@@ -2642,29 +2530,28 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV)
/*CHECK_EXCEPTION();*/
ZEND_VM_NEXT_OPCODE();
} else {
- char *function_name_strval, *lcname;
- int function_name_strlen;
+ zend_string *lcname;
zend_free_op free_op2;
SAVE_OPLINE();
function_name = GET_OP2_ZVAL_PTR(BP_VAR_R);
if (EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) {
- function_name_strval = Z_STRVAL_P(function_name);
- function_name_strlen = Z_STRLEN_P(function_name);
- if (function_name_strval[0] == '\\') {
- function_name_strlen -= 1;
- lcname = zend_str_tolower_dup(function_name_strval + 1, function_name_strlen);
+ if (Z_STRVAL_P(function_name)[0] == '\\') {
+ lcname = STR_ALLOC(Z_STRLEN_P(function_name) - 1, 0);
+ zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name) + 1, Z_STRLEN_P(function_name) - 1);
} else {
- lcname = zend_str_tolower_dup(function_name_strval, function_name_strlen);
+ lcname = STR_ALLOC(Z_STRLEN_P(function_name), 0);
+ zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name), Z_STRLEN_P(function_name));
}
- if (UNEXPECTED(zend_hash_find(EG(function_table), lcname, function_name_strlen+1, (void **) &call->fbc) == FAILURE)) {
- zend_error_noreturn(E_ERROR, "Call to undefined function %s()", function_name_strval);
+ if (UNEXPECTED((func = zend_hash_find(EG(function_table), lcname)) == NULL)) {
+ zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(function_name));
}
- efree(lcname);
+ STR_FREE(lcname);
FREE_OP2();
- call->object = NULL;
+ call->fbc = Z_FUNC_P(func);
+ ZVAL_UNDEF(&call->object);
call->called_scope = NULL;
call->num_additional_args = 0;
call->is_ctor_call = 0;
@@ -2676,8 +2563,8 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV)
EXPECTED(Z_TYPE_P(function_name) == IS_OBJECT) &&
Z_OBJ_HANDLER_P(function_name, get_closure) &&
Z_OBJ_HANDLER_P(function_name, get_closure)(function_name, &call->called_scope, &call->fbc, &call->object TSRMLS_CC) == SUCCESS) {
- if (call->object) {
- Z_ADDREF_P(call->object);
+ if (Z_REFCOUNTED(call->object)) {
+ Z_ADDREF(call->object);
}
if (OP2_TYPE == IS_VAR && OP2_FREE && Z_REFCOUNT_P(function_name) == 1 &&
call->fbc->common.fn_flags & ZEND_ACC_CLOSURE) {
@@ -2696,67 +2583,60 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV)
} else if (OP2_TYPE != IS_CONST &&
EXPECTED(Z_TYPE_P(function_name) == IS_ARRAY) &&
zend_hash_num_elements(Z_ARRVAL_P(function_name)) == 2) {
- zend_class_entry *ce;
- zval **method = NULL;
- zval **obj = NULL;
+ zval *obj;
+ zval *method;
- zend_hash_index_find(Z_ARRVAL_P(function_name), 0, (void **) &obj);
- zend_hash_index_find(Z_ARRVAL_P(function_name), 1, (void **) &method);
+ obj = zend_hash_index_find(Z_ARRVAL_P(function_name), 0);
+ method = zend_hash_index_find(Z_ARRVAL_P(function_name), 1);
if (!obj || !method) {
zend_error_noreturn(E_ERROR, "Array callback has to contain indices 0 and 1");
}
- if (Z_TYPE_PP(obj) != IS_STRING && Z_TYPE_PP(obj) != IS_OBJECT) {
+ if (Z_TYPE_P(obj) != IS_STRING && Z_TYPE_P(obj) != IS_OBJECT) {
zend_error_noreturn(E_ERROR, "First array member is not a valid class name or object");
}
- if (Z_TYPE_PP(method) != IS_STRING) {
+ if (Z_TYPE_P(method) != IS_STRING) {
zend_error_noreturn(E_ERROR, "Second array member is not a valid method");
}
- if (Z_TYPE_PP(obj) == IS_STRING) {
- ce = zend_fetch_class_by_name(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj), NULL, 0 TSRMLS_CC);
- if (UNEXPECTED(ce == NULL)) {
+ if (Z_TYPE_P(obj) == IS_STRING) {
+ ZVAL_UNDEF(&call->object);
+ call->called_scope = zend_fetch_class_by_name(Z_STR_P(obj), NULL, 0 TSRMLS_CC);
+ if (UNEXPECTED(call->called_scope == NULL)) {
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
- call->called_scope = ce;
- call->object = NULL;
- if (ce->get_static_method) {
- call->fbc = ce->get_static_method(ce, Z_STRVAL_PP(method), Z_STRLEN_PP(method) TSRMLS_CC);
+ if (call->called_scope->get_static_method) {
+ call->fbc = call->called_scope->get_static_method(call->called_scope, Z_STR_P(method) TSRMLS_CC);
} else {
- call->fbc = zend_std_get_static_method(ce, Z_STRVAL_PP(method), Z_STRLEN_PP(method), NULL TSRMLS_CC);
+ call->fbc = zend_std_get_static_method(call->called_scope, Z_STR_P(method), NULL TSRMLS_CC);
+ }
+ if (UNEXPECTED(call->fbc == NULL)) {
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", call->called_scope->name->val, Z_STRVAL_P(method));
}
} else {
- call->object = *obj;
- ce = call->called_scope = Z_OBJCE_PP(obj);
+ call->called_scope = Z_OBJCE_P(obj);
+ ZVAL_COPY_VALUE(&call->object, obj);
- call->fbc = Z_OBJ_HT_P(call->object)->get_method(&call->object, Z_STRVAL_PP(method), Z_STRLEN_PP(method), NULL TSRMLS_CC);
+ call->fbc = Z_OBJ_HT_P(obj)->get_method(obj, Z_STR_P(method), NULL TSRMLS_CC);
if (UNEXPECTED(call->fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(call->object), Z_STRVAL_PP(method));
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(obj), Z_STRVAL_P(method));
}
if ((call->fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) {
- call->object = NULL;
+ ZVAL_UNDEF(&call->object);
} else {
- if (!PZVAL_IS_REF(call->object)) {
- Z_ADDREF_P(call->object); /* For $this pointer */
+ if (!Z_ISREF(call->object)) {
+ Z_ADDREF(call->object); /* For $this pointer */
} else {
- zval *this_ptr;
- ALLOC_ZVAL(this_ptr);
- INIT_PZVAL_COPY(this_ptr, call->object);
- zval_copy_ctor(this_ptr);
- call->object = this_ptr;
+ ZVAL_DUP(&call->object, Z_REFVAL(call->object));
}
}
}
- if (UNEXPECTED(call->fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", ce->name, Z_STRVAL_PP(method));
- }
-
call->num_additional_args = 0;
call->is_ctor_call = 0;
EX(call) = call;
@@ -2779,29 +2659,32 @@ ZEND_VM_HANDLER(69, ZEND_INIT_NS_FCALL_BY_NAME, ANY, CONST)
{
USE_OPLINE
zend_literal *func_name;
+ zval *func;
call_slot *call = EX(call_slots) + opline->result.num;
func_name = opline->op2.literal + 1;
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
call->fbc = CACHED_PTR(opline->op2.literal->cache_slot);
- } else if (zend_hash_quick_find(EG(function_table), Z_STRVAL(func_name->constant), Z_STRLEN(func_name->constant)+1, func_name->hash_value, (void **) &call->fbc)==FAILURE) {
+ } else if ((func = zend_hash_find(EG(function_table), Z_STR(func_name->constant))) == NULL) {
func_name++;
- if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL(func_name->constant), Z_STRLEN(func_name->constant)+1, func_name->hash_value, (void **) &call->fbc)==FAILURE)) {
+ if (UNEXPECTED((func = zend_hash_find(EG(function_table), Z_STR(func_name->constant))) == NULL)) {
SAVE_OPLINE();
zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(opline->op2.zv));
} else {
+ call->fbc = Z_FUNC_P(func);
CACHE_PTR(opline->op2.literal->cache_slot, call->fbc);
}
} else {
+ call->fbc = Z_FUNC_P(func);
CACHE_PTR(opline->op2.literal->cache_slot, call->fbc);
}
- call->object = NULL;
+ ZVAL_UNDEF(&call->object);
call->called_scope = NULL;
call->num_additional_args = 0;
call->is_ctor_call = 0;
-
EX(call) = call;
+
ZEND_VM_NEXT_OPCODE();
}
@@ -2816,19 +2699,21 @@ ZEND_VM_HANDLER(60, ZEND_DO_FCALL, CONST, ANY)
USE_OPLINE
zend_free_op free_op1;
zval *fname = GET_OP1_ZVAL_PTR(BP_VAR_R);
+ zval *func;
call_slot *call = EX(call_slots) + opline->op2.num;
if (CACHED_PTR(opline->op1.literal->cache_slot)) {
EX(function_state).function = CACHED_PTR(opline->op1.literal->cache_slot);
- } else if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(fname), Z_STRLEN_P(fname)+1, Z_HASH_P(fname), (void **) &EX(function_state).function)==FAILURE)) {
+ } else if (UNEXPECTED((func = zend_hash_find(EG(function_table), Z_STR_P(fname))) == NULL)) {
SAVE_OPLINE();
- zend_error_noreturn(E_ERROR, "Call to undefined function %s()", fname->value.str.val);
+ zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(fname));
} else {
+ EX(function_state).function = Z_FUNC_P(func);
CACHE_PTR(opline->op1.literal->cache_slot, EX(function_state).function);
}
call->fbc = EX(function_state).function;
- call->object = NULL;
+ ZVAL_UNDEF(&call->object);
call->called_scope = NULL;
call->num_additional_args = 0;
call->is_ctor_call = 0;
@@ -2848,32 +2733,22 @@ ZEND_VM_HANDLER(62, ZEND_RETURN, CONST|TMP|VAR|CV, ANY)
SAVE_OPLINE();
retval_ptr = GET_OP1_ZVAL_PTR(BP_VAR_R);
- if (!EG(return_value_ptr_ptr)) {
+ if (/*???!EG(return_value_ptr_ptr)*/0) {
FREE_OP1();
} else {
if (OP1_TYPE == IS_CONST ||
OP1_TYPE == IS_TMP_VAR ||
- PZVAL_IS_REF(retval_ptr)) {
- zval *ret;
+ Z_ISREF_P(retval_ptr)) {
+ zval ret;
- ALLOC_ZVAL(ret);
- INIT_PZVAL_COPY(ret, retval_ptr);
+ ZVAL_COPY_VALUE(&ret, retval_ptr);
if (OP1_TYPE != IS_TMP_VAR) {
- zval_copy_ctor(ret);
+ zval_copy_ctor(&ret);
}
- *EG(return_value_ptr_ptr) = ret;
+//??? *EG(return_value_ptr_ptr) = ret;
FREE_OP1_IF_VAR();
- } else if ((OP1_TYPE == IS_CV || OP1_TYPE == IS_VAR) &&
- retval_ptr == &EG(uninitialized_zval)) {
- zval *ret;
-
- if (OP1_TYPE == IS_VAR) {
- Z_DELREF_P(retval_ptr);
- }
- ALLOC_INIT_ZVAL(ret);
- *EG(return_value_ptr_ptr) = ret;
} else {
- *EG(return_value_ptr_ptr) = retval_ptr;
+//??? *EG(return_value_ptr_ptr) = retval_ptr;
if (OP1_TYPE == IS_CV) {
Z_ADDREF_P(retval_ptr);
}
@@ -2886,7 +2761,6 @@ ZEND_VM_HANDLER(111, ZEND_RETURN_BY_REF, CONST|TMP|VAR|CV, ANY)
{
USE_OPLINE
zval *retval_ptr;
- zval **retval_ptr_ptr;
zend_free_op free_op1;
SAVE_OPLINE();
@@ -2898,33 +2772,32 @@ ZEND_VM_HANDLER(111, ZEND_RETURN_BY_REF, CONST|TMP|VAR|CV, ANY)
zend_error(E_NOTICE, "Only variable references should be returned by reference");
retval_ptr = GET_OP1_ZVAL_PTR(BP_VAR_R);
- if (!EG(return_value_ptr_ptr)) {
+ if (/*???!EG(return_value_ptr_ptr)*/0) {
if (OP1_TYPE == IS_TMP_VAR) {
FREE_OP1();
}
} else if (!IS_OP1_TMP_FREE()) { /* Not a temp var */
- zval *ret;
+ zval ret;
- ALLOC_ZVAL(ret);
- INIT_PZVAL_COPY(ret, retval_ptr);
- zval_copy_ctor(ret);
- *EG(return_value_ptr_ptr) = ret;
+ ZVAL_DUP(&ret, retval_ptr);
+//??? *EG(return_value_ptr_ptr) = ret;
} else {
- zval *ret;
+ zval ret;
- ALLOC_ZVAL(ret);
- INIT_PZVAL_COPY(ret, retval_ptr);
- *EG(return_value_ptr_ptr) = ret;
+ ZVAL_COPY_VALUE(&ret, retval_ptr);
+//??? *EG(return_value_ptr_ptr) = ret;
}
break;
}
- retval_ptr_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W);
+ retval_ptr = GET_OP1_ZVAL_PTR(BP_VAR_W);
- if (OP1_TYPE == IS_VAR && UNEXPECTED(retval_ptr_ptr == NULL)) {
+ if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_TYPE_P(retval_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot return string offsets by reference");
}
+//???
+#if 0
if (OP1_TYPE == IS_VAR && !Z_ISREF_PP(retval_ptr_ptr)) {
if (opline->extended_value == ZEND_RETURNS_FUNCTION &&
EX_T(opline->op1.var).var.fcall_returned_reference) {
@@ -2934,8 +2807,7 @@ ZEND_VM_HANDLER(111, ZEND_RETURN_BY_REF, CONST|TMP|VAR|CV, ANY)
zval *ret;
ALLOC_ZVAL(ret);
- INIT_PZVAL_COPY(ret, *retval_ptr_ptr);
- zval_copy_ctor(ret);
+ INIT_DUP(ret, *retval_ptr_ptr);
*EG(return_value_ptr_ptr) = ret;
}
break;
@@ -2948,6 +2820,7 @@ ZEND_VM_HANDLER(111, ZEND_RETURN_BY_REF, CONST|TMP|VAR|CV, ANY)
*EG(return_value_ptr_ptr) = *retval_ptr_ptr;
}
+#endif
} while (0);
FREE_OP1_VAR_PTR();
@@ -2957,10 +2830,10 @@ ZEND_VM_HANDLER(111, ZEND_RETURN_BY_REF, CONST|TMP|VAR|CV, ANY)
ZEND_VM_HANDLER(161, ZEND_GENERATOR_RETURN, ANY, ANY)
{
/* The generator object is stored in return_value_ptr_ptr */
- zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr);
+//??? zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr);
/* Close the generator to free up resources */
- zend_generator_close(generator, 1 TSRMLS_CC);
+//??? zend_generator_close(generator, 1 TSRMLS_CC);
/* Pass execution back to handling code */
ZEND_VM_RETURN();
@@ -2970,7 +2843,7 @@ ZEND_VM_HANDLER(108, ZEND_THROW, CONST|TMP|VAR|CV, ANY)
{
USE_OPLINE
zval *value;
- zval *exception;
+ zval exception;
zend_free_op free_op1;
SAVE_OPLINE();
@@ -2985,13 +2858,12 @@ ZEND_VM_HANDLER(108, ZEND_THROW, CONST|TMP|VAR|CV, ANY)
zend_exception_save(TSRMLS_C);
/* Not sure if a complete copy is what we want here */
- ALLOC_ZVAL(exception);
- INIT_PZVAL_COPY(exception, value);
+ ZVAL_COPY_VALUE(&exception, value);
if (!IS_OP1_TMP_FREE()) {
- zval_copy_ctor(exception);
+ zval_copy_ctor(&exception);
}
- zend_throw_exception_object(exception TSRMLS_CC);
+ zend_throw_exception_object(&exception TSRMLS_CC);
zend_exception_restore(TSRMLS_C);
FREE_OP1_IF_VAR();
HANDLE_EXCEPTION();
@@ -3001,7 +2873,7 @@ ZEND_VM_HANDLER(107, ZEND_CATCH, CONST, CV)
{
USE_OPLINE
zend_class_entry *ce, *catch_ce;
- zval *exception;
+ zend_object *exception;
SAVE_OPLINE();
/* Check whether an exception has been thrown, if not, jump over code */
@@ -3013,11 +2885,12 @@ ZEND_VM_HANDLER(107, ZEND_CATCH, CONST, CV)
if (CACHED_PTR(opline->op1.literal->cache_slot)) {
catch_ce = CACHED_PTR(opline->op1.literal->cache_slot);
} else {
- catch_ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, ZEND_FETCH_CLASS_NO_AUTOLOAD TSRMLS_CC);
+ catch_ce = zend_fetch_class_by_name(Z_STR_P(opline->op1.zv), opline->op1.literal + 1, ZEND_FETCH_CLASS_NO_AUTOLOAD TSRMLS_CC);
CACHE_PTR(opline->op1.literal->cache_slot, catch_ce);
}
- ce = Z_OBJCE_P(EG(exception));
+//??? ce = Z_OBJCE_P(EG(exception));
+ ce = EG(exception)->ce;
#ifdef HAVE_DTRACE
if (DTRACE_EXCEPTION_CAUGHT_ENABLED()) {
@@ -3037,19 +2910,17 @@ ZEND_VM_HANDLER(107, ZEND_CATCH, CONST, CV)
}
exception = EG(exception);
- if (!EG(active_symbol_table)) {
- if (EX_CV(opline->op2.var)) {
- zval_ptr_dtor(EX_CV(opline->op2.var));
- }
- EX_CV(opline->op2.var) = (zval**)EX_CV_NUM(execute_data, EX(op_array)->last_var + opline->op2.var);
- *EX_CV(opline->op2.var) = EG(exception);
- } else {
- zend_compiled_variable *cv = &CV_DEF_OF(opline->op2.var);
- zend_hash_quick_update(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value,
- &EG(exception), sizeof(zval *), (void**)&EX_CV(opline->op2.var));
+ if (Z_REFCOUNTED_P(EX_VAR_NUM(opline->op2.var))) {
+ zval_ptr_dtor(EX_VAR_NUM(opline->op2.var));
+ }
+ ZVAL_OBJ(EX_VAR_NUM(opline->op2.var), EG(exception));
+ if (EG(active_symbol_table)) {
+ zend_string *cv = CV_DEF_OF(opline->op2.var);
+ // TODO: indirect???
+ zend_hash_update(EG(active_symbol_table), cv, EX_VAR_NUM(opline->op2.var));
}
if (UNEXPECTED(EG(exception) != exception)) {
- Z_ADDREF_P(EG(exception));
+ EG(exception)->gc.refcount++;
HANDLE_EXCEPTION();
} else {
EG(exception) = NULL;
@@ -3070,18 +2941,17 @@ ZEND_VM_HANDLER(65, ZEND_SEND_VAL, CONST|TMP, ANY)
}
{
- zval *valptr;
+ zval valptr;
zval *value;
zend_free_op free_op1;
value = GET_OP1_ZVAL_PTR(BP_VAR_R);
- ALLOC_ZVAL(valptr);
- INIT_PZVAL_COPY(valptr, value);
+ ZVAL_COPY_VALUE(&valptr, value);
if (!IS_OP1_TMP_FREE()) {
- zval_copy_ctor(valptr);
+ zval_copy_ctor(&valptr);
}
- zend_vm_stack_push(valptr TSRMLS_CC);
+ zend_vm_stack_push(&valptr TSRMLS_CC);
FREE_OP1_IF_VAR();
}
CHECK_EXCEPTION();
@@ -3091,26 +2961,18 @@ ZEND_VM_HANDLER(65, ZEND_SEND_VAL, CONST|TMP, ANY)
ZEND_VM_HELPER(zend_send_by_var_helper, VAR|CV, ANY)
{
USE_OPLINE
- zval *varptr;
+ zval *varptr, var;
zend_free_op free_op1;
- varptr = GET_OP1_ZVAL_PTR(BP_VAR_R);
- if (varptr == &EG(uninitialized_zval)) {
- if (OP1_TYPE == IS_VAR) {
- Z_DELREF_P(varptr);
- }
- ALLOC_INIT_ZVAL(varptr);
- } else if (PZVAL_IS_REF(varptr)) {
+ varptr = GET_OP1_ZVAL_PTR(BP_VAR_R);
+ if (Z_ISREF_P(varptr)) {
if (OP1_TYPE == IS_CV ||
(OP1_TYPE == IS_VAR && Z_REFCOUNT_P(varptr) > 2)) {
- zval *original_var = varptr;
-
- ALLOC_ZVAL(varptr);
- INIT_PZVAL_COPY(varptr, original_var);
- zval_copy_ctor(varptr);
+ ZVAL_DUP(&var, Z_REFVAL_P(varptr));
+ varptr = &var;
FREE_OP1();
} else {
- Z_UNSET_ISREF_P(varptr);
+ varptr = Z_REFVAL_P(varptr);
}
} else if (OP1_TYPE == IS_CV) {
Z_ADDREF_P(varptr);
@@ -3141,31 +3003,29 @@ ZEND_VM_HANDLER(106, ZEND_SEND_VAR_NO_REF, VAR|CV, ANY)
}
varptr = GET_OP1_ZVAL_PTR(BP_VAR_R);
- if ((!(opline->extended_value & ZEND_ARG_SEND_FUNCTION) ||
- EX_T(opline->op1.var).var.fcall_returned_reference) &&
- varptr != &EG(uninitialized_zval) &&
- (PZVAL_IS_REF(varptr) || Z_REFCOUNT_P(varptr) == 1)) {
- Z_SET_ISREF_P(varptr);
- if (OP1_TYPE == IS_CV) {
- Z_ADDREF_P(varptr);
- }
- zend_vm_stack_push(varptr TSRMLS_CC);
- } else {
- zval *valptr;
+//??? if ((!(opline->extended_value & ZEND_ARG_SEND_FUNCTION) ||
+//??? EX_T(opline->op1.var).var.fcall_returned_reference) &&
+//??? (Z_ISREF_P(varptr) || Z_REFCOUNT_P(varptr) == 1)) {
+//??? Z_SET_ISREF_P(varptr);
+//??? if (OP1_TYPE == IS_CV) {
+//??? Z_ADDREF_P(varptr);
+//??? }
+//??? zend_vm_stack_push(varptr TSRMLS_CC);
+//??? } else {
+ zval val;
if ((opline->extended_value & ZEND_ARG_COMPILE_TIME_BOUND) ?
!(opline->extended_value & ZEND_ARG_SEND_SILENT) :
!ARG_MAY_BE_SENT_BY_REF(EX(call)->fbc, arg_num)) {
zend_error(E_STRICT, "Only variables should be passed by reference");
}
- ALLOC_ZVAL(valptr);
- INIT_PZVAL_COPY(valptr, varptr);
+ ZVAL_COPY_VALUE(&val, varptr);
if (!IS_OP1_TMP_FREE()) {
- zval_copy_ctor(valptr);
+ zval_copy_ctor(&val);
}
FREE_OP1_IF_VAR();
- zend_vm_stack_push(valptr TSRMLS_CC);
- }
+ zend_vm_stack_push(&val TSRMLS_CC);
+//??? }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -3174,19 +3034,17 @@ ZEND_VM_HANDLER(67, ZEND_SEND_REF, VAR|CV, ANY)
{
USE_OPLINE
zend_free_op free_op1;
- zval **varptr_ptr;
zval *varptr;
SAVE_OPLINE();
- varptr_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W);
+ varptr = GET_OP1_ZVAL_PTR(BP_VAR_W);
- if (OP1_TYPE == IS_VAR && UNEXPECTED(varptr_ptr == NULL)) {
+ if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_TYPE_P(varptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Only variables can be passed by reference");
}
- if (OP1_TYPE == IS_VAR && UNEXPECTED(*varptr_ptr == &EG(error_zval))) {
- ALLOC_INIT_ZVAL(varptr);
- zend_vm_stack_push(varptr TSRMLS_CC);
+ if (OP1_TYPE == IS_VAR && UNEXPECTED(varptr == &EG(error_zval))) {
+ zend_vm_stack_push(&EG(uninitialized_zval) TSRMLS_CC);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -3199,8 +3057,7 @@ ZEND_VM_HANDLER(67, ZEND_SEND_REF, VAR|CV, ANY)
}
}
- SEPARATE_ZVAL_TO_MAKE_IS_REF(varptr_ptr);
- varptr = *varptr_ptr;
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(varptr);
Z_ADDREF_P(varptr);
zend_vm_stack_push(varptr TSRMLS_CC);
@@ -3225,6 +3082,8 @@ ZEND_VM_HANDLER(66, ZEND_SEND_VAR, VAR|CV, ANY)
ZEND_VM_HANDLER(165, ZEND_SEND_UNPACK, ANY, ANY)
{
+//???
+#if 0
USE_OPLINE
zend_free_op free_op1;
zval *args;
@@ -3238,12 +3097,12 @@ ZEND_VM_HANDLER(165, ZEND_SEND_UNPACK, ANY, ANY)
case IS_ARRAY: {
HashTable *ht = Z_ARRVAL_P(args);
HashPosition pos;
- zval **arg_ptr, *arg;
+ zval *arg;
ZEND_VM_STACK_GROW_IF_NEEDED(zend_hash_num_elements(ht));
for (zend_hash_internal_pointer_reset_ex(ht, &pos);
- zend_hash_get_current_data_ex(ht, (void **) &arg_ptr, &pos) == SUCCESS;
+ (arg = zend_hash_get_current_data_ex(ht, &pos) != NULL;
zend_hash_move_forward_ex(ht, &pos), ++arg_num
) {
char *name;
@@ -3258,14 +3117,11 @@ ZEND_VM_HANDLER(165, ZEND_SEND_UNPACK, ANY, ANY)
}
if (ARG_SHOULD_BE_SENT_BY_REF(EX(call)->fbc, arg_num)) {
- SEPARATE_ZVAL_TO_MAKE_IS_REF(arg_ptr);
- arg = *arg_ptr;
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(arg);
Z_ADDREF_P(arg);
- } else if (Z_ISREF_PP(arg_ptr)) {
- ALLOC_ZVAL(arg);
- MAKE_COPY_ZVAL(arg_ptr, arg);
+ } else if (Z_ISREF_P(arg)) {
+ ZVAL_DUP(arg, Z_REFVAL_P(arg);
} else {
- arg = *arg_ptr;
Z_ADDREF_P(arg);
}
@@ -3368,6 +3224,7 @@ ZEND_VM_C_LABEL(unpack_iter_dtor):
FREE_OP1();
CHECK_EXCEPTION();
+#endif
ZEND_VM_NEXT_OPCODE();
}
@@ -3375,7 +3232,7 @@ ZEND_VM_HANDLER(63, ZEND_RECV, ANY, ANY)
{
USE_OPLINE
zend_uint arg_num = opline->op1.num;
- zval **param = zend_vm_stack_get_arg(arg_num TSRMLS_CC);
+ zval *param = zend_vm_stack_get_arg(arg_num TSRMLS_CC);
SAVE_OPLINE();
if (UNEXPECTED(param == NULL)) {
@@ -3385,7 +3242,7 @@ ZEND_VM_HANDLER(63, ZEND_RECV, ANY, ANY)
zend_execute_data *ptr;
if (EG(active_op_array)->scope) {
- class_name = EG(active_op_array)->scope->name;
+ class_name = EG(active_op_array)->scope->name->val;
space = "::";
} else {
class_name = space = "";
@@ -3393,19 +3250,18 @@ ZEND_VM_HANDLER(63, ZEND_RECV, ANY, ANY)
ptr = EX(prev_execute_data);
if(ptr && ptr->op_array) {
- zend_error(E_WARNING, "Missing argument %u for %s%s%s(), called in %s on line %d and defined", opline->op1.num, class_name, space, get_active_function_name(TSRMLS_C), ptr->op_array->filename, ptr->opline->lineno);
+ zend_error(E_WARNING, "Missing argument %u for %s%s%s(), called in %s on line %d and defined", opline->op1.num, class_name, space, get_active_function_name(TSRMLS_C), ptr->op_array->filename->val, ptr->opline->lineno);
} else {
zend_error(E_WARNING, "Missing argument %u for %s%s%s()", opline->op1.num, class_name, space, get_active_function_name(TSRMLS_C));
}
}
} else {
- zval **var_ptr;
+ zval *var_ptr;
- zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, *param, opline->extended_value TSRMLS_CC);
- var_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->result.var TSRMLS_CC);
- Z_DELREF_PP(var_ptr);
- *var_ptr = *param;
- Z_ADDREF_PP(var_ptr);
+ zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, param, opline->extended_value TSRMLS_CC);
+ var_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->result.var TSRMLS_CC);
+ Z_DELREF_P(var_ptr);
+ ZVAL_COPY(var_ptr, param);
}
CHECK_EXCEPTION();
@@ -3415,31 +3271,25 @@ ZEND_VM_HANDLER(63, ZEND_RECV, ANY, ANY)
ZEND_VM_HANDLER(64, ZEND_RECV_INIT, ANY, CONST)
{
USE_OPLINE
- zval *assignment_value;
zend_uint arg_num = opline->op1.num;
- zval **param = zend_vm_stack_get_arg(arg_num TSRMLS_CC);
- zval **var_ptr;
+ zval *param = zend_vm_stack_get_arg(arg_num TSRMLS_CC);
+ zval *var_ptr;
SAVE_OPLINE();
+ var_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->result.var TSRMLS_CC);
+ zval_ptr_dtor(var_ptr);
if (param == NULL) {
- ALLOC_ZVAL(assignment_value);
- *assignment_value = *opline->op2.zv;
- if (IS_CONSTANT_TYPE(Z_TYPE_P(assignment_value))) {
- Z_SET_REFCOUNT_P(assignment_value, 1);
- zval_update_constant(&assignment_value, 0 TSRMLS_CC);
+ ZVAL_COPY_VALUE(var_ptr, opline->op2.zv);
+ if (IS_CONSTANT_TYPE(Z_TYPE_P(var_ptr))) {
+ zval_update_constant(var_ptr, 0 TSRMLS_CC);
} else {
- zval_copy_ctor(assignment_value);
+ zval_copy_ctor(var_ptr);
}
- INIT_PZVAL(assignment_value);
} else {
- assignment_value = *param;
- Z_ADDREF_P(assignment_value);
+ ZVAL_COPY(var_ptr, param);
}
- zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, assignment_value, opline->extended_value TSRMLS_CC);
- var_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->result.var TSRMLS_CC);
- zval_ptr_dtor(var_ptr);
- *var_ptr = assignment_value;
+ zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, var_ptr, opline->extended_value TSRMLS_CC);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -3450,14 +3300,12 @@ ZEND_VM_HANDLER(164, ZEND_RECV_VARIADIC, ANY, ANY)
USE_OPLINE
zend_uint arg_num = opline->op1.num;
zend_uint arg_count = zend_vm_stack_get_args_count(TSRMLS_C);
- zval **var_ptr, *params;
+ zval *params;
SAVE_OPLINE();
- var_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->result.var TSRMLS_CC);
- Z_DELREF_PP(var_ptr);
- MAKE_STD_ZVAL(params);
- *var_ptr = params;
+ params = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->result.var TSRMLS_CC);
+ Z_DELREF_P(params);
if (arg_num <= arg_count) {
array_init_size(params, arg_count - arg_num + 1);
@@ -3466,10 +3314,12 @@ ZEND_VM_HANDLER(164, ZEND_RECV_VARIADIC, ANY, ANY)
}
for (; arg_num <= arg_count; ++arg_num) {
- zval **param = zend_vm_stack_get_arg(arg_num TSRMLS_CC);
- zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, *param, opline->extended_value TSRMLS_CC);
- zend_hash_next_index_insert(Z_ARRVAL_P(params), param, sizeof(zval *), NULL);
- Z_ADDREF_PP(param);
+ zval *param = zend_vm_stack_get_arg(arg_num TSRMLS_CC);
+ zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, param, opline->extended_value TSRMLS_CC);
+ zend_hash_next_index_insert(Z_ARRVAL_P(params), param);
+ if (Z_REFCOUNTED_P(param)) {
+ Z_ADDREF_P(param);
+ }
}
CHECK_EXCEPTION();
@@ -3480,7 +3330,7 @@ ZEND_VM_HANDLER(52, ZEND_BOOL, CONST|TMP|VAR|CV, ANY)
{
USE_OPLINE
zend_free_op free_op1;
- zval *retval = &EX_T(opline->result.var).tmp_var;
+ zval *retval = EX_VAR(opline->result.var);
SAVE_OPLINE();
/* PHP 3.0 returned "" for false and 1 for true, here we use 0 and 1 for now */
@@ -3528,12 +3378,12 @@ ZEND_VM_HANDLER(100, ZEND_GOTO, ANY, CONST)
switch (brk_opline->opcode) {
case ZEND_SWITCH_FREE:
if (!(brk_opline->extended_value & EXT_TYPE_FREE_ON_RETURN)) {
- zval_ptr_dtor(&EX_T(brk_opline->op1.var).var.ptr);
+ zval_ptr_dtor(EX_VAR(brk_opline->op1.var));
}
break;
case ZEND_FREE:
if (!(brk_opline->extended_value & EXT_TYPE_FREE_ON_RETURN)) {
- zendi_zval_dtor(EX_T(brk_opline->op1.var).tmp_var);
+ zval_dtor(EX_VAR(brk_opline->op1.var));
}
break;
}
@@ -3546,7 +3396,7 @@ ZEND_VM_HANDLER(48, ZEND_CASE, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- is_equal_function(&EX_T(opline->result.var).tmp_var,
+ is_equal_function(EX_VAR(opline->result.var),
GET_OP1_ZVAL_PTR(BP_VAR_R),
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC);
@@ -3560,7 +3410,7 @@ ZEND_VM_HANDLER(49, ZEND_SWITCH_FREE, VAR, ANY)
USE_OPLINE
SAVE_OPLINE();
- zval_ptr_dtor(&EX_T(opline->op1.var).var.ptr);
+ zval_ptr_dtor(EX_VAR(opline->op1.var));
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -3568,28 +3418,25 @@ ZEND_VM_HANDLER(49, ZEND_SWITCH_FREE, VAR, ANY)
ZEND_VM_HANDLER(68, ZEND_NEW, ANY, ANY)
{
USE_OPLINE
- zval *object_zval;
+ zval object_zval;
zend_function *constructor;
SAVE_OPLINE();
- if (UNEXPECTED((EX_T(opline->op1.var).class_entry->ce_flags & (ZEND_ACC_INTERFACE|ZEND_ACC_IMPLICIT_ABSTRACT_CLASS|ZEND_ACC_EXPLICIT_ABSTRACT_CLASS)) != 0)) {
- if (EX_T(opline->op1.var).class_entry->ce_flags & ZEND_ACC_INTERFACE) {
- zend_error_noreturn(E_ERROR, "Cannot instantiate interface %s", EX_T(opline->op1.var).class_entry->name);
- } else if ((EX_T(opline->op1.var).class_entry->ce_flags & ZEND_ACC_TRAIT) == ZEND_ACC_TRAIT) {
- zend_error_noreturn(E_ERROR, "Cannot instantiate trait %s", EX_T(opline->op1.var).class_entry->name);
+ if (UNEXPECTED((Z_CE_P(EX_VAR(opline->op1.var))->ce_flags & (ZEND_ACC_INTERFACE|ZEND_ACC_IMPLICIT_ABSTRACT_CLASS|ZEND_ACC_EXPLICIT_ABSTRACT_CLASS)) != 0)) {
+ if (Z_CE_P(EX_VAR(opline->op1.var))->ce_flags & ZEND_ACC_INTERFACE) {
+ zend_error_noreturn(E_ERROR, "Cannot instantiate interface %s", Z_CE_P(EX_VAR(opline->op1.var))->name->val);
+ } else if ((Z_CE_P(EX_VAR(opline->op1.var))->ce_flags & ZEND_ACC_TRAIT) == ZEND_ACC_TRAIT) {
+ zend_error_noreturn(E_ERROR, "Cannot instantiate trait %s", Z_CE_P(EX_VAR(opline->op1.var))->name->val);
} else {
- zend_error_noreturn(E_ERROR, "Cannot instantiate abstract class %s", EX_T(opline->op1.var).class_entry->name);
+ zend_error_noreturn(E_ERROR, "Cannot instantiate abstract class %s", Z_CE_P(EX_VAR(opline->op1.var))->name->val);
}
}
- ALLOC_ZVAL(object_zval);
- object_init_ex(object_zval, EX_T(opline->op1.var).class_entry);
- INIT_PZVAL(object_zval);
-
- constructor = Z_OBJ_HT_P(object_zval)->get_constructor(object_zval TSRMLS_CC);
+ object_init_ex(&object_zval, Z_CE_P(EX_VAR(opline->op1.var)));
+ constructor = Z_OBJ_HT(object_zval)->get_constructor(&object_zval TSRMLS_CC);
if (constructor == NULL) {
if (RETURN_VALUE_USED(opline)) {
- AI_SET_PTR(&EX_T(opline->result.var), object_zval);
+ ZVAL_COPY_VALUE(EX_VAR(opline->result.var), &object_zval);
} else {
zval_ptr_dtor(&object_zval);
}
@@ -3598,14 +3445,13 @@ ZEND_VM_HANDLER(68, ZEND_NEW, ANY, ANY)
call_slot *call = EX(call_slots) + opline->extended_value;
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(object_zval);
- AI_SET_PTR(&EX_T(opline->result.var), object_zval);
+ ZVAL_COPY(EX_VAR(opline->result.var), &object_zval);
}
/* We are not handling overloaded classes right now */
call->fbc = constructor;
- call->object = object_zval;
- call->called_scope = EX_T(opline->op1.var).class_entry;
+ ZVAL_COPY_VALUE(&call->object, &object_zval);
+ call->called_scope = Z_CE_P(EX_VAR(opline->op1.var));
call->num_additional_args = 0;
call->is_ctor_call = 1;
call->is_ctor_result_used = RETURN_VALUE_USED(opline);
@@ -3652,29 +3498,22 @@ ZEND_VM_HANDLER(110, ZEND_CLONE, CONST|TMP|VAR|UNUSED|CV, ANY)
/* Ensure that if we're calling a private function, we're allowed to do so.
*/
if (UNEXPECTED(ce != EG(scope))) {
- zend_error_noreturn(E_ERROR, "Call to private %s::__clone() from context '%s'", ce->name, EG(scope) ? EG(scope)->name : "");
+ zend_error_noreturn(E_ERROR, "Call to private %s::__clone() from context '%s'", ce->name->val, EG(scope) ? EG(scope)->name->val : "");
}
} else if ((clone->common.fn_flags & ZEND_ACC_PROTECTED)) {
/* Ensure that if we're calling a protected function, we're allowed to do so.
*/
if (UNEXPECTED(!zend_check_protected(zend_get_function_root_class(clone), EG(scope)))) {
- zend_error_noreturn(E_ERROR, "Call to protected %s::__clone() from context '%s'", ce->name, EG(scope) ? EG(scope)->name : "");
+ zend_error_noreturn(E_ERROR, "Call to protected %s::__clone() from context '%s'", ce->name->val, EG(scope) ? EG(scope)->name->val : "");
}
}
}
if (EXPECTED(EG(exception) == NULL)) {
- zval *retval;
-
- ALLOC_ZVAL(retval);
- Z_OBJVAL_P(retval) = clone_call(obj TSRMLS_CC);
- Z_TYPE_P(retval) = IS_OBJECT;
- Z_SET_REFCOUNT_P(retval, 1);
- Z_SET_ISREF_P(retval);
+ ZVAL_OBJ(EX_VAR(opline->result.var), clone_call(obj TSRMLS_CC));
+//??? Z_SET_ISREF_P(retval);
if (!RETURN_VALUE_USED(opline) || UNEXPECTED(EG(exception) != NULL)) {
- zval_ptr_dtor(&retval);
- } else {
- EX_T(opline->result.var).var.ptr = retval;
+ zval_ptr_dtor(EX_VAR(opline->result.var));
}
}
FREE_OP1_IF_VAR();
@@ -3703,7 +3542,7 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNUSED, CONST)
}
/* non-qualified constant - allow text substitution */
zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", actual, actual);
- ZVAL_STRINGL(&EX_T(opline->result.var).tmp_var, actual, Z_STRLEN_P(opline->op2.zv)-(actual - Z_STRVAL_P(opline->op2.zv)), 1);
+ ZVAL_STRINGL(EX_VAR(opline->result.var), actual, Z_STRLEN_P(opline->op2.zv)-(actual - Z_STRVAL_P(opline->op2.zv)));
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
} else {
@@ -3712,27 +3551,25 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNUSED, CONST)
} else {
CACHE_PTR(opline->op2.literal->cache_slot, c);
}
- retval = &EX_T(opline->result.var).tmp_var;
- ZVAL_COPY_VALUE(retval, &c->value);
- zval_copy_ctor(retval);
+ retval = EX_VAR(opline->result.var);
+ ZVAL_DUP(retval, &c->value);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
} else {
/* class constant */
zend_class_entry *ce;
- zval **value;
+ zval *value;
if (OP1_TYPE == IS_CONST) {
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
value = CACHED_PTR(opline->op2.literal->cache_slot);
- ZVAL_COPY_VALUE(&EX_T(opline->result.var).tmp_var, *value);
- zval_copy_ctor(&EX_T(opline->result.var).tmp_var);
+ ZVAL_DUP(EX_VAR(opline->result.var), value);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
} else if (CACHED_PTR(opline->op1.literal->cache_slot)) {
ce = CACHED_PTR(opline->op1.literal->cache_slot);
} else {
- ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
@@ -3742,17 +3579,16 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNUSED, CONST)
CACHE_PTR(opline->op1.literal->cache_slot, ce);
}
} else {
- ce = EX_T(opline->op1.var).class_entry;
+ ce = Z_CE_P(EX_VAR(opline->op1.var));
if ((value = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce)) != NULL) {
- ZVAL_COPY_VALUE(&EX_T(opline->result.var).tmp_var, *value);
- zval_copy_ctor(&EX_T(opline->result.var).tmp_var);
+ ZVAL_DUP(EX_VAR(opline->result.var), value);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
}
- if (EXPECTED(zend_hash_quick_find(&ce->constants_table, Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv)+1, Z_HASH_P(opline->op2.zv), (void **) &value) == SUCCESS)) {
- if (IS_CONSTANT_TYPE(Z_TYPE_PP(value))) {
+ if (EXPECTED((value = zend_hash_find(&ce->constants_table, Z_STR_P(opline->op2.zv))) != NULL)) {
+ if (IS_CONSTANT_TYPE(Z_TYPE_P(value))) {
zend_class_entry *old_scope = EG(scope);
EG(scope) = ce;
@@ -3764,11 +3600,11 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNUSED, CONST)
} else {
CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce, value);
}
- ZVAL_COPY_VALUE(&EX_T(opline->result.var).tmp_var, *value);
- zval_copy_ctor(&EX_T(opline->result.var).tmp_var);
+ ZVAL_DUP(EX_VAR(opline->result.var), value);
} else if (Z_STRLEN_P(opline->op2.zv) == sizeof("class")-1 && memcmp(Z_STRVAL_P(opline->op2.zv), "class", sizeof("class") - 1) == 0) {
/* "class" is assigned as a case-sensitive keyword from zend_do_resolve_class_name */
- ZVAL_STRINGL(&EX_T(opline->result.var).tmp_var, ce->name, ce->name_length, 1);
+ ZVAL_STR(EX_VAR(opline->result.var), ce->name);
+ STR_ADDREF(ce->name);
} else {
zend_error_noreturn(E_ERROR, "Undefined class constant '%s'", Z_STRVAL_P(opline->op2.zv));
}
@@ -3786,29 +3622,24 @@ ZEND_VM_HANDLER(72, ZEND_ADD_ARRAY_ELEMENT, CONST|TMP|VAR|CV, CONST|TMP|VAR|UNUS
SAVE_OPLINE();
if ((OP1_TYPE == IS_VAR || OP1_TYPE == IS_CV) && opline->extended_value) {
- zval **expr_ptr_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W);
-
- if (OP1_TYPE == IS_VAR && UNEXPECTED(expr_ptr_ptr == NULL)) {
+ expr_ptr = GET_OP1_ZVAL_PTR(BP_VAR_W);
+ if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets");
}
- SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr_ptr);
- expr_ptr = *expr_ptr_ptr;
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr);
Z_ADDREF_P(expr_ptr);
} else {
expr_ptr=GET_OP1_ZVAL_PTR(BP_VAR_R);
if (IS_OP1_TMP_FREE()) { /* temporary variable */
- zval *new_expr;
-
- ALLOC_ZVAL(new_expr);
- INIT_PZVAL_COPY(new_expr, expr_ptr);
- expr_ptr = new_expr;
- } else if (OP1_TYPE == IS_CONST || PZVAL_IS_REF(expr_ptr)) {
- zval *new_expr;
-
- ALLOC_ZVAL(new_expr);
- INIT_PZVAL_COPY(new_expr, expr_ptr);
- expr_ptr = new_expr;
- zendi_zval_copy_ctor(*expr_ptr);
+ zval new_expr;
+
+ ZVAL_COPY_VALUE(&new_expr, expr_ptr);
+ expr_ptr = &new_expr;
+ } else if (OP1_TYPE == IS_CONST || Z_ISREF_P(expr_ptr)) {
+ zval new_expr;
+
+ ZVAL_DUP(&new_expr, expr_ptr);
+ expr_ptr = &new_expr;
FREE_OP1_IF_VAR();
} else if (OP1_TYPE == IS_CV) {
Z_ADDREF_P(expr_ptr);
@@ -3828,29 +3659,26 @@ ZEND_VM_HANDLER(72, ZEND_ADD_ARRAY_ELEMENT, CONST|TMP|VAR|CV, CONST|TMP|VAR|UNUS
case IS_BOOL:
hval = Z_LVAL_P(offset);
ZEND_VM_C_LABEL(num_index):
- zend_hash_index_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), hval, &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr);
break;
case IS_STRING:
- if (OP2_TYPE == IS_CONST) {
- hval = Z_HASH_P(offset);
- } else {
+ if (OP2_TYPE != IS_CONST) {
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, ZEND_VM_C_GOTO(num_index));
- hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset));
}
- zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), Z_STR_P(offset), expr_ptr);
break;
case IS_NULL:
- zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), STR_EMPTY_ALLOC(), expr_ptr);
break;
default:
zend_error(E_WARNING, "Illegal offset type");
- zval_ptr_dtor(&expr_ptr);
+ zval_ptr_dtor(expr_ptr);
/* do nothing */
break;
}
FREE_OP2();
} else {
- zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr);
}
if ((OP1_TYPE == IS_VAR || OP1_TYPE == IS_CV) && opline->extended_value) {
FREE_OP1_VAR_PTR();
@@ -3863,7 +3691,7 @@ ZEND_VM_HANDLER(71, ZEND_INIT_ARRAY, CONST|TMP|VAR|UNUSED|CV, CONST|TMP|VAR|UNUS
{
USE_OPLINE
- array_init(&EX_T(opline->result.var).tmp_var);
+ array_init(EX_VAR(opline->result.var));
if (OP1_TYPE == IS_UNUSED) {
ZEND_VM_NEXT_OPCODE();
#if !defined(ZEND_VM_SPEC) || OP1_TYPE != IS_UNUSED
@@ -3878,7 +3706,7 @@ ZEND_VM_HANDLER(21, ZEND_CAST, CONST|TMP|VAR|CV, ANY)
USE_OPLINE
zend_free_op free_op1;
zval *expr;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
expr = GET_OP1_ZVAL_PTR(BP_VAR_R);
@@ -3886,7 +3714,7 @@ ZEND_VM_HANDLER(21, ZEND_CAST, CONST|TMP|VAR|CV, ANY)
if (opline->extended_value != IS_STRING) {
ZVAL_COPY_VALUE(result, expr);
if (!IS_OP1_TMP_FREE()) {
- zendi_zval_copy_ctor(*result);
+ zval_copy_ctor(result);
}
}
switch (opline->extended_value) {
@@ -3915,7 +3743,7 @@ ZEND_VM_HANDLER(21, ZEND_CAST, CONST|TMP|VAR|CV, ANY)
} else {
ZVAL_COPY_VALUE(result, expr);
if (!IS_OP1_TMP_FREE()) {
- zendi_zval_copy_ctor(*result);
+ zval_copy_ctor(result);
}
}
break;
@@ -3938,18 +3766,17 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VAR|CV, ANY)
zend_op_array *new_op_array=NULL;
zend_free_op free_op1;
zval *inc_filename;
- zval *tmp_inc_filename = NULL;
+ zval tmp_inc_filename;
zend_bool failure_retval=0;
SAVE_OPLINE();
inc_filename = GET_OP1_ZVAL_PTR(BP_VAR_R);
+ ZVAL_UNDEF(&tmp_inc_filename);
if (inc_filename->type!=IS_STRING) {
- MAKE_STD_ZVAL(tmp_inc_filename);
- ZVAL_COPY_VALUE(tmp_inc_filename, inc_filename);
- zval_copy_ctor(tmp_inc_filename);
- convert_to_string(tmp_inc_filename);
- inc_filename = tmp_inc_filename;
+ ZVAL_DUP(&tmp_inc_filename, inc_filename);
+ convert_to_string(&tmp_inc_filename);
+ inc_filename = &tmp_inc_filename;
}
if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRLEN_P(inc_filename)) {
@@ -3967,7 +3794,7 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VAR|CV, ANY)
resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename) TSRMLS_CC);
if (resolved_path) {
- failure_retval = zend_hash_exists(&EG(included_files), resolved_path, strlen(resolved_path)+1);
+//??? failure_retval = zend_hash_exists(&EG(included_files), resolved_path, strlen(resolved_path)+1);
} else {
resolved_path = Z_STRVAL_P(inc_filename);
}
@@ -3980,13 +3807,13 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VAR|CV, ANY)
file_handle.opened_path = estrdup(resolved_path);
}
- if (zend_hash_add_empty_element(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path)+1)==SUCCESS) {
- new_op_array = zend_compile_file(&file_handle, (opline->extended_value==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC);
- zend_destroy_file_handle(&file_handle TSRMLS_CC);
- } else {
- zend_file_handle_dtor(&file_handle TSRMLS_CC);
- failure_retval=1;
- }
+//??? if (zend_hash_add_empty_element(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path)+1)==SUCCESS) {
+//??? new_op_array = zend_compile_file(&file_handle, (opline->extended_value==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC);
+//??? zend_destroy_file_handle(&file_handle TSRMLS_CC);
+//??? } else {
+//??? zend_file_handle_dtor(&file_handle TSRMLS_CC);
+//??? failure_retval=1;
+//??? }
} else {
if (opline->extended_value == ZEND_INCLUDE_ONCE) {
zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC);
@@ -4013,24 +3840,24 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VAR|CV, ANY)
EMPTY_SWITCH_DEFAULT_CASE()
}
}
- if (tmp_inc_filename) {
+ if (Z_TYPE(tmp_inc_filename) != IS_UNDEF) {
zval_ptr_dtor(&tmp_inc_filename);
}
FREE_OP1();
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
} else if (EXPECTED(new_op_array != NULL)) {
- EX(original_return_value) = EG(return_value_ptr_ptr);
+//??? EX(original_return_value) = EG(return_value_ptr_ptr);
EG(active_op_array) = new_op_array;
if (RETURN_VALUE_USED(opline)) {
- EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
- EG(return_value_ptr_ptr) = EX_T(opline->result.var).var.ptr_ptr;
+//??? EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
+//??? EG(return_value_ptr_ptr) = EX_T(opline->result.var).var.ptr_ptr;
} else {
- EG(return_value_ptr_ptr) = NULL;
+//??? EG(return_value_ptr_ptr) = NULL;
}
EX(function_state).function = (zend_function *) new_op_array;
- EX(object) = NULL;
+ ZVAL_UNDEF(&EX(object));
if (!EG(active_symbol_table)) {
zend_rebuild_symbol_table(TSRMLS_C);
@@ -4046,7 +3873,7 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VAR|CV, ANY)
EG(opline_ptr) = &EX(opline);
EG(active_op_array) = EX(op_array);
- EG(return_value_ptr_ptr) = EX(original_return_value);
+//??? EG(return_value_ptr_ptr) = EX(original_return_value);
destroy_op_array(new_op_array TSRMLS_CC);
efree(new_op_array);
if (UNEXPECTED(EG(exception) != NULL)) {
@@ -4055,12 +3882,7 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VAR|CV, ANY)
}
} else if (RETURN_VALUE_USED(opline)) {
- zval *retval;
-
- ALLOC_ZVAL(retval);
- ZVAL_BOOL(retval, failure_retval);
- INIT_PZVAL(retval);
- EX_T(opline->result.var).var.ptr = retval;
+ ZVAL_BOOL(EX_VAR(opline->result.var), failure_retval);
}
ZEND_VM_NEXT_OPCODE();
}
@@ -4077,13 +3899,13 @@ ZEND_VM_HANDLER(74, ZEND_UNSET_VAR, CONST|TMP|VAR|CV, UNUSED|CONST|VAR)
OP2_TYPE == IS_UNUSED &&
(opline->extended_value & ZEND_QUICK_SET)) {
if (EG(active_symbol_table)) {
- zend_compiled_variable *cv = &CV_DEF_OF(opline->op1.var);
+ zend_string *cv = CV_DEF_OF(opline->op1.var);
- zend_delete_variable(EX(prev_execute_data), EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value TSRMLS_CC);
- EX_CV(opline->op1.var) = NULL;
- } else if (EX_CV(opline->op1.var)) {
- zval_ptr_dtor(EX_CV(opline->op1.var));
- EX_CV(opline->op1.var) = NULL;
+ zend_delete_variable(EX(prev_execute_data), EG(active_symbol_table), cv TSRMLS_CC);
+ ZVAL_UNDEF(EX_VAR_NUM(opline->op1.var));
+ } else if (Z_TYPE_P(EX_VAR_NUM(opline->op1.var)) != IS_UNDEF) {
+ zval_ptr_dtor(EX_VAR_NUM(opline->op1.var));
+ ZVAL_UNDEF(EX_VAR_NUM(opline->op1.var));
}
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -4092,8 +3914,7 @@ ZEND_VM_HANDLER(74, ZEND_UNSET_VAR, CONST|TMP|VAR|CV, UNUSED|CONST|VAR)
varname = GET_OP1_ZVAL_PTR(BP_VAR_R);
if (OP1_TYPE != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
- ZVAL_COPY_VALUE(&tmp, varname);
- zval_copy_ctor(&tmp);
+ ZVAL_DUP(&tmp, varname);
convert_to_string(&tmp);
varname = &tmp;
} else if (OP1_TYPE == IS_VAR || OP1_TYPE == IS_CV) {
@@ -4107,12 +3928,12 @@ ZEND_VM_HANDLER(74, ZEND_UNSET_VAR, CONST|TMP|VAR|CV, UNUSED|CONST|VAR)
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
ce = CACHED_PTR(opline->op2.literal->cache_slot);
} else {
- ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
if (OP1_TYPE != IS_CONST && varname == &tmp) {
zval_dtor(&tmp);
} else if (OP1_TYPE == IS_VAR || OP1_TYPE == IS_CV) {
- zval_ptr_dtor(&varname);
+ zval_ptr_dtor(varname);
}
FREE_OP1();
HANDLE_EXCEPTION();
@@ -4123,20 +3944,18 @@ ZEND_VM_HANDLER(74, ZEND_UNSET_VAR, CONST|TMP|VAR|CV, UNUSED|CONST|VAR)
CACHE_PTR(opline->op2.literal->cache_slot, ce);
}
} else {
- ce = EX_T(opline->op2.var).class_entry;
+ ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), ((OP1_TYPE == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ zend_std_unset_static_property(ce, Z_STR_P(varname), ((OP1_TYPE == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
} else {
- ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1);
-
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
- zend_delete_variable(execute_data, target_symbol_table, varname->value.str.val, varname->value.str.len+1, hash_value TSRMLS_CC);
+ zend_delete_variable(execute_data, target_symbol_table, Z_STR_P(varname) TSRMLS_CC);
}
if (OP1_TYPE != IS_CONST && varname == &tmp) {
zval_dtor(&tmp);
} else if (OP1_TYPE == IS_VAR || OP1_TYPE == IS_CV) {
- zval_ptr_dtor(&varname);
+ zval_ptr_dtor(varname);
}
FREE_OP1();
CHECK_EXCEPTION();
@@ -4147,21 +3966,21 @@ ZEND_VM_HANDLER(75, ZEND_UNSET_DIM, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval **container;
+ zval *container;
zval *offset;
ulong hval;
SAVE_OPLINE();
- container = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_UNSET);
- if (OP1_TYPE == IS_CV && container != &EG(uninitialized_zval_ptr)) {
+ container = GET_OP1_OBJ_ZVAL_PTR(BP_VAR_UNSET);
+ if (OP1_TYPE == IS_CV) {
SEPARATE_ZVAL_IF_NOT_REF(container);
}
offset = GET_OP2_ZVAL_PTR(BP_VAR_R);
if (OP1_TYPE != IS_VAR || container) {
- switch (Z_TYPE_PP(container)) {
+ switch (Z_TYPE_P(container)) {
case IS_ARRAY: {
- HashTable *ht = Z_ARRVAL_PP(container);
+ HashTable *ht = Z_ARRVAL_P(container);
switch (Z_TYPE_P(offset)) {
case IS_DOUBLE:
@@ -4178,29 +3997,26 @@ ZEND_VM_HANDLER(75, ZEND_UNSET_DIM, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
if (OP2_TYPE == IS_CV || OP2_TYPE == IS_VAR) {
Z_ADDREF_P(offset);
}
- if (OP2_TYPE == IS_CONST) {
- hval = Z_HASH_P(offset);
- } else {
+ if (OP2_TYPE != IS_CONST) {
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, ZEND_VM_C_GOTO(num_index_dim));
- hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset));
}
- if (ht == &EG(symbol_table)) {
- zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC);
+ if (ht == &EG(symbol_table).ht) {
+ zend_delete_global_variable(Z_STR_P(offset) TSRMLS_CC);
} else {
- zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval);
+ zend_hash_del(ht, Z_STR_P(offset));
}
if (OP2_TYPE == IS_CV || OP2_TYPE == IS_VAR) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
}
break;
ZEND_VM_C_LABEL(num_index_dim):
zend_hash_index_del(ht, hval);
if (OP2_TYPE == IS_CV || OP2_TYPE == IS_VAR) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
}
break;
case IS_NULL:
- zend_hash_del(ht, "", sizeof(""));
+ zend_hash_del(ht, STR_EMPTY_ALLOC());
break;
default:
zend_error(E_WARNING, "Illegal offset type in unset");
@@ -4210,15 +4026,15 @@ ZEND_VM_C_LABEL(num_index_dim):
break;
}
case IS_OBJECT:
- if (UNEXPECTED(Z_OBJ_HT_P(*container)->unset_dimension == NULL)) {
+ if (UNEXPECTED(Z_OBJ_HT_P(container)->unset_dimension == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use object as array");
}
if (IS_OP2_TMP_FREE()) {
MAKE_REAL_ZVAL_PTR(offset);
}
- Z_OBJ_HT_P(*container)->unset_dimension(*container, offset TSRMLS_CC);
+ Z_OBJ_HT_P(container)->unset_dimension(container, offset TSRMLS_CC);
if (IS_OP2_TMP_FREE()) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
FREE_OP2();
}
@@ -4243,28 +4059,28 @@ ZEND_VM_HANDLER(76, ZEND_UNSET_OBJ, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval **container;
+ zval *container;
zval *offset;
SAVE_OPLINE();
- container = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_UNSET);
+ container = GET_OP1_OBJ_ZVAL_PTR(BP_VAR_UNSET);
offset = GET_OP2_ZVAL_PTR(BP_VAR_R);
if (OP1_TYPE != IS_VAR || container) {
- if (OP1_TYPE == IS_CV && container != &EG(uninitialized_zval_ptr)) {
+ if (OP1_TYPE == IS_CV) {
SEPARATE_ZVAL_IF_NOT_REF(container);
}
- if (Z_TYPE_PP(container) == IS_OBJECT) {
+ if (Z_TYPE_P(container) == IS_OBJECT) {
if (IS_OP2_TMP_FREE()) {
MAKE_REAL_ZVAL_PTR(offset);
}
- if (Z_OBJ_HT_P(*container)->unset_property) {
- Z_OBJ_HT_P(*container)->unset_property(*container, offset, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ if (Z_OBJ_HT_P(container)->unset_property) {
+ Z_OBJ_HT_P(container)->unset_property(container, offset, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to unset property of non-object");
}
if (IS_OP2_TMP_FREE()) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
FREE_OP2();
}
@@ -4284,7 +4100,7 @@ ZEND_VM_HANDLER(77, ZEND_FE_RESET, CONST|TMP|VAR|CV, ANY)
{
USE_OPLINE
zend_free_op free_op1;
- zval *array_ptr, **array_ptr_ptr;
+ zval *array_ptr;
HashTable *fe_ht;
zend_object_iterator *iter = NULL;
zend_class_entry *ce = NULL;
@@ -4294,40 +4110,35 @@ ZEND_VM_HANDLER(77, ZEND_FE_RESET, CONST|TMP|VAR|CV, ANY)
if ((OP1_TYPE == IS_CV || OP1_TYPE == IS_VAR) &&
(opline->extended_value & ZEND_FE_RESET_VARIABLE)) {
- array_ptr_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_R);
- if (array_ptr_ptr == NULL || array_ptr_ptr == &EG(uninitialized_zval_ptr)) {
- MAKE_STD_ZVAL(array_ptr);
- ZVAL_NULL(array_ptr);
- } else if (Z_TYPE_PP(array_ptr_ptr) == IS_OBJECT) {
- if(Z_OBJ_HT_PP(array_ptr_ptr)->get_class_entry == NULL) {
+ array_ptr = GET_OP1_ZVAL_PTR(BP_VAR_R);
+ if (Z_TYPE_P(array_ptr) == IS_NULL) {
+ } else if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
+ if(Z_OBJ_HT_P(array_ptr)->get_class_entry == NULL) {
zend_error(E_WARNING, "foreach() cannot iterate over objects without PHP class");
ZEND_VM_JMP(EX(op_array)->opcodes+opline->op2.opline_num);
}
- ce = Z_OBJCE_PP(array_ptr_ptr);
+ ce = Z_OBJCE_P(array_ptr);
if (!ce || ce->get_iterator == NULL) {
- SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr);
- Z_ADDREF_PP(array_ptr_ptr);
+ SEPARATE_ZVAL_IF_NOT_REF(array_ptr);
+ Z_ADDREF_P(array_ptr);
}
- array_ptr = *array_ptr_ptr;
} else {
- if (Z_TYPE_PP(array_ptr_ptr) == IS_ARRAY) {
- SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr);
+ if (Z_TYPE_P(array_ptr) == IS_ARRAY) {
+ SEPARATE_ZVAL_IF_NOT_REF(array_ptr);
if (opline->extended_value & ZEND_FE_FETCH_BYREF) {
- Z_SET_ISREF_PP(array_ptr_ptr);
+ ZVAL_NEW_REF(array_ptr, array_ptr);
}
}
- array_ptr = *array_ptr_ptr;
Z_ADDREF_P(array_ptr);
}
} else {
array_ptr = GET_OP1_ZVAL_PTR(BP_VAR_R);
if (IS_OP1_TMP_FREE()) { /* IS_TMP_VAR */
- zval *tmp;
+ zval tmp;
- ALLOC_ZVAL(tmp);
- INIT_PZVAL_COPY(tmp, array_ptr);
- array_ptr = tmp;
+ ZVAL_COPY_VALUE(&tmp, array_ptr);
+ array_ptr = &tmp;
if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
ce = Z_OBJCE_P(array_ptr);
if (ce && ce->get_iterator) {
@@ -4348,15 +4159,13 @@ ZEND_VM_HANDLER(77, ZEND_FE_RESET, CONST|TMP|VAR|CV, ANY)
(OP1_TYPE == IS_VAR &&
!Z_ISREF_P(array_ptr) &&
Z_REFCOUNT_P(array_ptr) > 2)) {
- zval *tmp;
+ zval tmp;
if (OP1_TYPE == IS_VAR) {
Z_DELREF_P(array_ptr);
}
- ALLOC_ZVAL(tmp);
- INIT_PZVAL_COPY(tmp, array_ptr);
- zval_copy_ctor(tmp);
- array_ptr = tmp;
+ ZVAL_DUP(&tmp, array_ptr);
+ array_ptr = &tmp;
} else if (OP1_TYPE == IS_CV) {
Z_ADDREF_P(array_ptr);
}
@@ -4382,14 +4191,14 @@ ZEND_VM_HANDLER(77, ZEND_FE_RESET, CONST|TMP|VAR|CV, ANY)
}
}
- EX_T(opline->result.var).fe.ptr = array_ptr;
+ ZVAL_COPY_VALUE(EX_VAR(opline->result.var), array_ptr);
if (iter) {
iter->index = 0;
if (iter->funcs->rewind) {
iter->funcs->rewind(iter TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
- zval_ptr_dtor(&array_ptr);
+ zval_ptr_dtor(array_ptr);
if (OP1_TYPE == IS_VAR && opline->extended_value & ZEND_FE_RESET_VARIABLE) {
FREE_OP1_VAR_PTR();
}
@@ -4398,7 +4207,7 @@ ZEND_VM_HANDLER(77, ZEND_FE_RESET, CONST|TMP|VAR|CV, ANY)
}
is_empty = iter->funcs->valid(iter TSRMLS_CC) != SUCCESS;
if (UNEXPECTED(EG(exception) != NULL)) {
- zval_ptr_dtor(&array_ptr);
+ zval_ptr_dtor(array_ptr);
if (OP1_TYPE == IS_VAR && opline->extended_value & ZEND_FE_RESET_VARIABLE) {
FREE_OP1_VAR_PTR();
}
@@ -4408,24 +4217,23 @@ ZEND_VM_HANDLER(77, ZEND_FE_RESET, CONST|TMP|VAR|CV, ANY)
} else if ((fe_ht = HASH_OF(array_ptr)) != NULL) {
zend_hash_internal_pointer_reset(fe_ht);
if (ce) {
- zend_object *zobj = zend_objects_get_address(array_ptr TSRMLS_CC);
+ zend_object *zobj = Z_OBJ_P(array_ptr);
while (zend_hash_has_more_elements(fe_ht) == SUCCESS) {
- char *str_key;
- uint str_key_len;
+ zend_string *str_key;
ulong int_key;
zend_uchar key_type;
- key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &str_key_len, &int_key, 0, NULL);
+ key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &int_key, 0, NULL);
if (key_type != HASH_KEY_NON_EXISTENT &&
(key_type == HASH_KEY_IS_LONG ||
- zend_check_property_access(zobj, str_key, str_key_len-1 TSRMLS_CC) == SUCCESS)) {
+ zend_check_property_access(zobj, str_key TSRMLS_CC) == SUCCESS)) {
break;
}
zend_hash_move_forward(fe_ht);
}
}
is_empty = zend_hash_has_more_elements(fe_ht) != SUCCESS;
- zend_hash_get_pointer(fe_ht, &EX_T(opline->result.var).fe.fe_pos);
+//??? zend_hash_get_pointer(fe_ht, EX_VAR(opline->result.var));
} else {
zend_error(E_WARNING, "Invalid argument supplied for foreach()");
is_empty = 1;
@@ -4446,14 +4254,14 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY)
{
USE_OPLINE
zend_free_op free_op1;
- zval *array = EX_T(opline->op1.var).fe.ptr;
- zval **value;
+ zval *array = EX_VAR(opline->op1.var);
+ zval *value;
HashTable *fe_ht;
zend_object_iterator *iter = NULL;
zval *key = NULL;
if (opline->extended_value & ZEND_FE_FETCH_WITH_KEY) {
- key = &EX_T((opline+1)->result.var).tmp_var;
+ key = EX_VAR((opline+1)->result.var);
}
SAVE_OPLINE();
@@ -4465,46 +4273,45 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY)
ZEND_VM_JMP(EX(op_array)->opcodes+opline->op2.opline_num);
case ZEND_ITER_PLAIN_OBJECT: {
- zend_object *zobj = zend_objects_get_address(array TSRMLS_CC);
+ zend_object *zobj = Z_OBJ_P(array);
int key_type;
- char *str_key;
- zend_uint str_key_len;
+ zend_string *str_key;
zend_ulong int_key;
fe_ht = Z_OBJPROP_P(array);
- zend_hash_set_pointer(fe_ht, &EX_T(opline->op1.var).fe.fe_pos);
+//??? zend_hash_set_pointer(fe_ht, &EX_T(opline->op1.var).fe.fe_pos);
do {
- if (zend_hash_get_current_data(fe_ht, (void **) &value)==FAILURE) {
+ if ((value = zend_hash_get_current_data(fe_ht)) == NULL) {
/* reached end of iteration */
ZEND_VM_JMP(EX(op_array)->opcodes+opline->op2.opline_num);
}
- key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &str_key_len, &int_key, 0, NULL);
+ key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &int_key, 0, NULL);
zend_hash_move_forward(fe_ht);
} while (key_type != HASH_KEY_IS_LONG &&
- zend_check_property_access(zobj, str_key, str_key_len - 1 TSRMLS_CC) != SUCCESS);
+ zend_check_property_access(zobj, str_key TSRMLS_CC) != SUCCESS);
if (key) {
if (key_type == HASH_KEY_IS_LONG) {
ZVAL_LONG(key, int_key);
} else {
- const char *class_name, *prop_name;
- int prop_name_len;
- zend_unmangle_property_name_ex(
- str_key, str_key_len - 1, &class_name, &prop_name, &prop_name_len
- );
- ZVAL_STRINGL(key, prop_name, prop_name_len, 1);
+//??? const char *class_name, *prop_name;
+//??? int prop_name_len;
+//??? zend_unmangle_property_name_ex(
+//??? str_key, &class_name, &prop_name, &prop_name_len
+//??? );
+//??? ZVAL_STRINGL(key, prop_name, prop_name_len, 1);
}
}
- zend_hash_get_pointer(fe_ht, &EX_T(opline->op1.var).fe.fe_pos);
+//??? zend_hash_get_pointer(fe_ht, &EX_T(opline->op1.var).fe.fe_pos);
break;
}
case ZEND_ITER_PLAIN_ARRAY:
fe_ht = Z_ARRVAL_P(array);
- zend_hash_set_pointer(fe_ht, &EX_T(opline->op1.var).fe.fe_pos);
- if (zend_hash_get_current_data(fe_ht, (void **) &value)==FAILURE) {
+//??? zend_hash_set_pointer(fe_ht, &EX_T(opline->op1.var).fe.fe_pos);
+ if ((value = zend_hash_get_current_data(fe_ht)) == NULL) {
/* reached end of iteration */
ZEND_VM_JMP(EX(op_array)->opcodes+opline->op2.opline_num);
}
@@ -4512,7 +4319,7 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY)
zend_hash_get_current_key_zval(fe_ht, key);
}
zend_hash_move_forward(fe_ht);
- zend_hash_get_pointer(fe_ht, &EX_T(opline->op1.var).fe.fe_pos);
+//??? zend_hash_get_pointer(fe_ht, &EX_T(opline->op1.var).fe.fe_pos);
break;
case ZEND_ITER_OBJECT:
@@ -4522,7 +4329,7 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY)
* In case that ever happens we need an additional flag. */
iter->funcs->move_forward(iter TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
- zval_ptr_dtor(&array);
+ zval_ptr_dtor(array);
HANDLE_EXCEPTION();
}
}
@@ -4530,14 +4337,14 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY)
if (!iter || (iter->index > 0 && iter->funcs->valid(iter TSRMLS_CC) == FAILURE)) {
/* reached end of iteration */
if (UNEXPECTED(EG(exception) != NULL)) {
- zval_ptr_dtor(&array);
+ zval_ptr_dtor(array);
HANDLE_EXCEPTION();
}
ZEND_VM_JMP(EX(op_array)->opcodes+opline->op2.opline_num);
}
- iter->funcs->get_current_data(iter, &value TSRMLS_CC);
+ value = iter->funcs->get_current_data(iter TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
- zval_ptr_dtor(&array);
+ zval_ptr_dtor(array);
HANDLE_EXCEPTION();
}
if (!value) {
@@ -4548,7 +4355,7 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY)
if (iter->funcs->get_current_key) {
iter->funcs->get_current_key(iter, key TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
- zval_ptr_dtor(&array);
+ zval_ptr_dtor(array);
HANDLE_EXCEPTION();
}
} else {
@@ -4560,12 +4367,10 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY)
if (opline->extended_value & ZEND_FE_FETCH_BYREF) {
SEPARATE_ZVAL_IF_NOT_REF(value);
- Z_SET_ISREF_PP(value);
- EX_T(opline->result.var).var.ptr_ptr = value;
- Z_ADDREF_PP(value);
+ ZVAL_NEW_REF(value, value);
+ Z_ADDREF_P(value);
} else {
- PZVAL_LOCK(*value);
- EX_T(opline->result.var).var.ptr = *value;
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
}
CHECK_EXCEPTION();
@@ -4576,19 +4381,19 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY)
ZEND_VM_HANDLER(114, ZEND_ISSET_ISEMPTY_VAR, CONST|TMP|VAR|CV, UNUSED|CONST|VAR)
{
USE_OPLINE
- zval **value;
+ zval *value;
zend_bool isset = 1;
SAVE_OPLINE();
if (OP1_TYPE == IS_CV &&
OP2_TYPE == IS_UNUSED &&
(opline->extended_value & ZEND_QUICK_SET)) {
- if (EX_CV(opline->op1.var)) {
- value = EX_CV(opline->op1.var);
+ if (Z_TYPE_P(EX_VAR_NUM(opline->op1.var)) != IS_UNDEF) {
+ value = EX_VAR_NUM(opline->op1.var);
} else if (EG(active_symbol_table)) {
- zend_compiled_variable *cv = &CV_DEF_OF(opline->op1.var);
+ zend_string *cv = CV_DEF_OF(opline->op1.var);
- if (zend_hash_quick_find(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, (void **) &value) == FAILURE) {
+ if ((value = zend_hash_find(EG(active_symbol_table), cv)) == NULL) {
isset = 0;
}
} else {
@@ -4600,8 +4405,7 @@ ZEND_VM_HANDLER(114, ZEND_ISSET_ISEMPTY_VAR, CONST|TMP|VAR|CV, UNUSED|CONST|VAR)
zval tmp, *varname = GET_OP1_ZVAL_PTR(BP_VAR_IS);
if (OP1_TYPE != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
- ZVAL_COPY_VALUE(&tmp, varname);
- zval_copy_ctor(&tmp);
+ ZVAL_DUP(&tmp, varname);
convert_to_string(&tmp);
varname = &tmp;
}
@@ -4613,7 +4417,7 @@ ZEND_VM_HANDLER(114, ZEND_ISSET_ISEMPTY_VAR, CONST|TMP|VAR|CV, UNUSED|CONST|VAR)
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
ce = CACHED_PTR(opline->op2.literal->cache_slot);
} else {
- ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -4621,15 +4425,15 @@ ZEND_VM_HANDLER(114, ZEND_ISSET_ISEMPTY_VAR, CONST|TMP|VAR|CV, UNUSED|CONST|VAR)
CACHE_PTR(opline->op2.literal->cache_slot, ce);
}
} else {
- ce = EX_T(opline->op2.var).class_entry;
+ ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1, ((OP1_TYPE == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ value = zend_std_get_static_property(ce, Z_STR_P(varname), 1, ((OP1_TYPE == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
if (!value) {
isset = 0;
}
} else {
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
- if (zend_hash_find(target_symbol_table, varname->value.str.val, varname->value.str.len+1, (void **) &value) == FAILURE) {
+ if ((value = zend_hash_find(target_symbol_table, Z_STR_P(varname))) == NULL) {
isset = 0;
}
}
@@ -4641,16 +4445,16 @@ ZEND_VM_HANDLER(114, ZEND_ISSET_ISEMPTY_VAR, CONST|TMP|VAR|CV, UNUSED|CONST|VAR)
}
if (opline->extended_value & ZEND_ISSET) {
- if (isset && Z_TYPE_PP(value) != IS_NULL) {
- ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, 1);
+ if (isset && Z_TYPE_P(value) != IS_NULL) {
+ ZVAL_BOOL(EX_VAR(opline->result.var), 1);
} else {
- ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, 0);
+ ZVAL_BOOL(EX_VAR(opline->result.var), 0);
}
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (!isset || !i_zend_is_true(*value TSRMLS_CC)) {
- ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, 1);
+ if (!isset || !i_zend_is_true(value TSRMLS_CC)) {
+ ZVAL_BOOL(EX_VAR(opline->result.var), 1);
} else {
- ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, 0);
+ ZVAL_BOOL(EX_VAR(opline->result.var), 0);
}
}
@@ -4663,7 +4467,7 @@ ZEND_VM_HELPER_EX(zend_isset_isempty_dim_prop_obj_handler, VAR|UNUSED|CV, CONST|
USE_OPLINE
zend_free_op free_op1, free_op2;
zval *container;
- zval **value = NULL;
+ zval *value;
int result = 0;
ulong hval;
zval *offset;
@@ -4687,23 +4491,20 @@ ZEND_VM_HELPER_EX(zend_isset_isempty_dim_prop_obj_handler, VAR|UNUSED|CV, CONST|
case IS_LONG:
hval = Z_LVAL_P(offset);
ZEND_VM_C_LABEL(num_index_prop):
- if (zend_hash_index_find(ht, hval, (void **) &value) == SUCCESS) {
+ if ((value = zend_hash_index_find(ht, hval)) != NULL) {
isset = 1;
}
break;
case IS_STRING:
- if (OP2_TYPE == IS_CONST) {
- hval = Z_HASH_P(offset);
- } else {
+ if (OP2_TYPE != IS_CONST) {
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, ZEND_VM_C_GOTO(num_index_prop));
- hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset));
}
- if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) {
+ if ((value = zend_hash_find(ht, Z_STR_P(offset))) != NULL) {
isset = 1;
}
break;
case IS_NULL:
- if (zend_hash_find(ht, "", sizeof(""), (void **) &value) == SUCCESS) {
+ if ((value = zend_hash_find(ht, STR_EMPTY_ALLOC())) != NULL) {
isset = 1;
}
break;
@@ -4713,13 +4514,13 @@ ZEND_VM_C_LABEL(num_index_prop):
}
if (opline->extended_value & ZEND_ISSET) {
- if (isset && Z_TYPE_PP(value) == IS_NULL) {
+ if (isset && Z_TYPE_P(value) == IS_NULL) {
result = 0;
} else {
result = isset;
}
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (!isset || !i_zend_is_true(*value TSRMLS_CC)) {
+ if (!isset || !i_zend_is_true(value TSRMLS_CC)) {
result = 0;
} else {
result = 1;
@@ -4746,7 +4547,7 @@ ZEND_VM_C_LABEL(num_index_prop):
}
}
if (IS_OP2_TMP_FREE()) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
FREE_OP2();
}
@@ -4757,8 +4558,7 @@ ZEND_VM_C_LABEL(num_index_prop):
if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */
|| (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
&& IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) {
- ZVAL_COPY_VALUE(&tmp, offset);
- zval_copy_ctor(&tmp);
+ ZVAL_DUP(&tmp, offset);
convert_to_long(&tmp);
offset = &tmp;
} else {
@@ -4782,11 +4582,10 @@ ZEND_VM_C_LABEL(num_index_prop):
FREE_OP2();
}
- Z_TYPE(EX_T(opline->result.var).tmp_var) = IS_BOOL;
if (opline->extended_value & ZEND_ISSET) {
- Z_LVAL(EX_T(opline->result.var).tmp_var) = result;
+ ZVAL_BOOL(EX_VAR(opline->result.var), result);
} else {
- Z_LVAL(EX_T(opline->result.var).tmp_var) = !result;
+ ZVAL_BOOL(EX_VAR(opline->result.var), !result);
}
FREE_OP1_IF_VAR();
@@ -4832,17 +4631,19 @@ ZEND_VM_HANDLER(57, ZEND_BEGIN_SILENCE, ANY, ANY)
USE_OPLINE
SAVE_OPLINE();
- Z_LVAL(EX_T(opline->result.var).tmp_var) = EG(error_reporting);
- Z_TYPE(EX_T(opline->result.var).tmp_var) = IS_LONG; /* shouldn't be necessary */
- if (EX(old_error_reporting) == NULL) {
- EX(old_error_reporting) = &EX_T(opline->result.var).tmp_var;
+ ZVAL_LONG(EX_VAR(opline->result.var), EG(error_reporting));
+ if (Z_TYPE(EX(old_error_reporting)) == IS_UNDEF) {
+ ZVAL_LONG(&EX(old_error_reporting), EG(error_reporting));
}
if (EG(error_reporting)) {
do {
EG(error_reporting) = 0;
if (!EG(error_reporting_ini_entry)) {
- if (UNEXPECTED(zend_hash_find(EG(ini_directives), "error_reporting", sizeof("error_reporting"), (void **) &EG(error_reporting_ini_entry)) == FAILURE)) {
+ zend_ini_entry *p = zend_hash_str_find_ptr(EG(ini_directives), "error_reporting", sizeof("error_reporting")-1);
+ if (p) {
+ EG(error_reporting_ini_entry) = p;
+ } else {
break;
}
}
@@ -4851,7 +4652,7 @@ ZEND_VM_HANDLER(57, ZEND_BEGIN_SILENCE, ANY, ANY)
ALLOC_HASHTABLE(EG(modified_ini_directives));
zend_hash_init(EG(modified_ini_directives), 8, NULL, NULL, 0);
}
- if (EXPECTED(zend_hash_add(EG(modified_ini_directives), "error_reporting", sizeof("error_reporting"), &EG(error_reporting_ini_entry), sizeof(zend_ini_entry*), NULL) == SUCCESS)) {
+ if (EXPECTED(zend_hash_str_add_ptr(EG(modified_ini_directives), "error_reporting", sizeof("error_reporting")-1, EG(error_reporting_ini_entry)) != NULL)) {
EG(error_reporting_ini_entry)->orig_value = EG(error_reporting_ini_entry)->value;
EG(error_reporting_ini_entry)->orig_value_length = EG(error_reporting_ini_entry)->value_length;
EG(error_reporting_ini_entry)->orig_modifiable = EG(error_reporting_ini_entry)->modifiable;
@@ -4881,9 +4682,8 @@ ZEND_VM_HANDLER(58, ZEND_END_SILENCE, TMP, ANY)
zval restored_error_reporting;
SAVE_OPLINE();
- if (!EG(error_reporting) && Z_LVAL(EX_T(opline->op1.var).tmp_var) != 0) {
- Z_TYPE(restored_error_reporting) = IS_LONG;
- Z_LVAL(restored_error_reporting) = Z_LVAL(EX_T(opline->op1.var).tmp_var);
+ if (!EG(error_reporting) && Z_LVAL_P(EX_VAR(opline->op1.var)) != 0) {
+ ZVAL_LONG(&restored_error_reporting, Z_LVAL_P(EX_VAR(opline->op1.var)));
EG(error_reporting) = Z_LVAL(restored_error_reporting);
convert_to_string(&restored_error_reporting);
if (EXPECTED(EG(error_reporting_ini_entry) != NULL)) {
@@ -4894,12 +4694,12 @@ ZEND_VM_HANDLER(58, ZEND_END_SILENCE, TMP, ANY)
EG(error_reporting_ini_entry)->value = Z_STRVAL(restored_error_reporting);
EG(error_reporting_ini_entry)->value_length = Z_STRLEN(restored_error_reporting);
} else {
- zendi_zval_dtor(restored_error_reporting);
+ zval_dtor(&restored_error_reporting);
}
}
- if (EX(old_error_reporting) == &EX_T(opline->op1.var).tmp_var) {
- EX(old_error_reporting) = NULL;
- }
+//??? if (EX(old_error_reporting) == EX_VAR(opline->op1.var)) {
+//??? EX(old_error_reporting) = NULL;
+//??? }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -4914,9 +4714,9 @@ ZEND_VM_HANDLER(152, ZEND_JMP_SET, CONST|TMP|VAR|CV, ANY)
value = GET_OP1_ZVAL_PTR(BP_VAR_R);
if (i_zend_is_true(value TSRMLS_CC)) {
- ZVAL_COPY_VALUE(&EX_T(opline->result.var).tmp_var, value);
+ ZVAL_COPY_VALUE(EX_VAR(opline->result.var), value);
if (!IS_OP1_TMP_FREE()) {
- zendi_zval_copy_ctor(EX_T(opline->result.var).tmp_var);
+ zval_copy_ctor(EX_VAR(opline->result.var));
}
FREE_OP1_IF_VAR();
#if DEBUG_ZEND>=2
@@ -4934,23 +4734,19 @@ ZEND_VM_HANDLER(158, ZEND_JMP_SET_VAR, CONST|TMP|VAR|CV, ANY)
{
USE_OPLINE
zend_free_op free_op1;
- zval *value, *ret;
+ zval *value;
SAVE_OPLINE();
value = GET_OP1_ZVAL_PTR(BP_VAR_R);
if (i_zend_is_true(value TSRMLS_CC)) {
if (OP1_TYPE == IS_VAR || OP1_TYPE == IS_CV) {
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
Z_ADDREF_P(value);
- EX_T(opline->result.var).var.ptr = value;
- EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
} else {
- ALLOC_ZVAL(ret);
- INIT_PZVAL_COPY(ret, value);
- EX_T(opline->result.var).var.ptr = ret;
- EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
+ ZVAL_COPY_VALUE(EX_VAR(opline->result.var), value);
if (!IS_OP1_TMP_FREE()) {
- zval_copy_ctor(EX_T(opline->result.var).var.ptr);
+ zval_copy_ctor(EX_VAR(opline->result.var));
}
}
FREE_OP1_IF_VAR();
@@ -4974,9 +4770,9 @@ ZEND_VM_HANDLER(22, ZEND_QM_ASSIGN, CONST|TMP|VAR|CV, ANY)
SAVE_OPLINE();
value = GET_OP1_ZVAL_PTR(BP_VAR_R);
- ZVAL_COPY_VALUE(&EX_T(opline->result.var).tmp_var, value);
+ ZVAL_COPY_VALUE(EX_VAR(opline->result.var), value);
if (!IS_OP1_TMP_FREE()) {
- zval_copy_ctor(&EX_T(opline->result.var).tmp_var);
+ zval_copy_ctor(EX_VAR(opline->result.var));
}
FREE_OP1_IF_VAR();
CHECK_EXCEPTION();
@@ -4987,22 +4783,17 @@ ZEND_VM_HANDLER(157, ZEND_QM_ASSIGN_VAR, CONST|TMP|VAR|CV, ANY)
{
USE_OPLINE
zend_free_op free_op1;
- zval *value, *ret;
+ zval *value;
SAVE_OPLINE();
value = GET_OP1_ZVAL_PTR(BP_VAR_R);
if (OP1_TYPE == IS_VAR || OP1_TYPE == IS_CV) {
- Z_ADDREF_P(value);
- EX_T(opline->result.var).var.ptr = value;
- EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
} else {
- ALLOC_ZVAL(ret);
- INIT_PZVAL_COPY(ret, value);
- EX_T(opline->result.var).var.ptr = ret;
- EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
+ ZVAL_COPY_VALUE(EX_VAR(opline->result.var), value);
if (!IS_OP1_TMP_FREE()) {
- zval_copy_ctor(EX_T(opline->result.var).var.ptr);
+ zval_copy_ctor(EX_VAR(opline->result.var));
}
}
@@ -5046,7 +4837,7 @@ ZEND_VM_HANDLER(139, ZEND_DECLARE_CLASS, ANY, ANY)
USE_OPLINE
SAVE_OPLINE();
- EX_T(opline->result.var).class_entry = do_bind_class(EX(op_array), opline, EG(class_table), 0 TSRMLS_CC);
+ Z_CE_P(EX_VAR(opline->result.var)) = do_bind_class(EX(op_array), opline, EG(class_table), 0 TSRMLS_CC);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -5056,7 +4847,7 @@ ZEND_VM_HANDLER(140, ZEND_DECLARE_INHERITED_CLASS, ANY, ANY)
USE_OPLINE
SAVE_OPLINE();
- EX_T(opline->result.var).class_entry = do_bind_inherited_class(EX(op_array), opline, EG(class_table), EX_T(opline->extended_value).class_entry, 0 TSRMLS_CC);
+ Z_CE_P(EX_VAR(opline->result.var)) = do_bind_inherited_class(EX(op_array), opline, EG(class_table), Z_CE_P(EX_VAR(opline->extended_value)), 0 TSRMLS_CC);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -5064,13 +4855,13 @@ ZEND_VM_HANDLER(140, ZEND_DECLARE_INHERITED_CLASS, ANY, ANY)
ZEND_VM_HANDLER(145, ZEND_DECLARE_INHERITED_CLASS_DELAYED, ANY, ANY)
{
USE_OPLINE
- zend_class_entry **pce, **pce_orig;
+ zval *zce, *orig_zce;
SAVE_OPLINE();
- if (zend_hash_quick_find(EG(class_table), Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv)+1, Z_HASH_P(opline->op2.zv), (void**)&pce) == FAILURE ||
- (zend_hash_quick_find(EG(class_table), Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), Z_HASH_P(opline->op1.zv), (void**)&pce_orig) == SUCCESS &&
- *pce != *pce_orig)) {
- do_bind_inherited_class(EX(op_array), opline, EG(class_table), EX_T(opline->extended_value).class_entry, 0 TSRMLS_CC);
+ if ((zce = zend_hash_find(EG(class_table), Z_STR_P(opline->op2.zv))) == NULL ||
+ ((orig_zce = zend_hash_find(EG(class_table), Z_STR_P(opline->op1.zv))) != NULL &&
+ Z_CE_P(zce) != Z_CE_P(orig_zce))) {
+ do_bind_inherited_class(EX(op_array), opline, EG(class_table), Z_CE_P(EX_VAR(opline->extended_value)), 0 TSRMLS_CC);
}
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -5112,11 +4903,11 @@ ZEND_VM_HANDLER(138, ZEND_INSTANCEOF, TMP|VAR|CV, ANY)
expr = GET_OP1_ZVAL_PTR(BP_VAR_R);
if (Z_TYPE_P(expr) == IS_OBJECT && Z_OBJ_HT_P(expr)->get_class_entry) {
- result = instanceof_function(Z_OBJCE_P(expr), EX_T(opline->op2.var).class_entry TSRMLS_CC);
+ result = instanceof_function(Z_OBJCE_P(expr), Z_CE_P(EX_VAR(opline->op2.var)) TSRMLS_CC);
} else {
result = 0;
}
- ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, result);
+ ZVAL_BOOL(EX_VAR(opline->result.var), result);
FREE_OP1();
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -5135,14 +4926,14 @@ ZEND_VM_HANDLER(0, ZEND_NOP, ANY, ANY)
ZEND_VM_HANDLER(144, ZEND_ADD_INTERFACE, ANY, CONST)
{
USE_OPLINE
- zend_class_entry *ce = EX_T(opline->op1.var).class_entry;
+ zend_class_entry *ce = Z_CE_P(EX_VAR(opline->op1.var));
zend_class_entry *iface;
SAVE_OPLINE();
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
iface = CACHED_PTR(opline->op2.literal->cache_slot);
} else {
- iface = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, opline->extended_value TSRMLS_CC);
+ iface = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, opline->extended_value TSRMLS_CC);
if (UNEXPECTED(iface == NULL)) {
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -5162,15 +4953,14 @@ ZEND_VM_HANDLER(144, ZEND_ADD_INTERFACE, ANY, CONST)
ZEND_VM_HANDLER(154, ZEND_ADD_TRAIT, ANY, ANY)
{
USE_OPLINE
- zend_class_entry *ce = EX_T(opline->op1.var).class_entry;
+ zend_class_entry *ce = Z_CE_P(EX_VAR(opline->op1.var));
zend_class_entry *trait;
SAVE_OPLINE();
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
trait = CACHED_PTR(opline->op2.literal->cache_slot);
} else {
- trait = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv),
- Z_STRLEN_P(opline->op2.zv),
+ trait = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv),
opline->op2.literal + 1,
opline->extended_value TSRMLS_CC);
if (UNEXPECTED(trait == NULL)) {
@@ -5192,7 +4982,7 @@ ZEND_VM_HANDLER(154, ZEND_ADD_TRAIT, ANY, ANY)
ZEND_VM_HANDLER(155, ZEND_BIND_TRAITS, ANY, ANY)
{
USE_OPLINE
- zend_class_entry *ce = EX_T(opline->op1.var).class_entry;
+ zend_class_entry *ce = Z_CE_P(EX_VAR(opline->op1.var));
SAVE_OPLINE();
zend_do_bind_traits(ce TSRMLS_CC);
@@ -5205,7 +4995,7 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY)
zend_uint op_num = EG(opline_before_exception)-EG(active_op_array)->opcodes;
int i;
zend_uint catch_op_num = 0, finally_op_num = 0, finally_op_end = 0;
- void **stack_frame;
+ zval *stack_frame;
/* Figure out where the next stack frame (which maybe contains pushed
* arguments that have to be dtor'ed) starts */
@@ -5215,7 +5005,7 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY)
* arguments pushed to the stack that have to be dtor'ed. */
while (zend_vm_stack_top(TSRMLS_C) != stack_frame) {
zval *stack_zval_p = zend_vm_stack_pop(TSRMLS_C);
- zval_ptr_dtor(&stack_zval_p);
+ zval_ptr_dtor(stack_zval_p);
}
for (i=0; i<EG(active_op_array)->last_try_catch; i++) {
@@ -5238,13 +5028,13 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY)
if (EX(call) >= EX(call_slots)) {
call_slot *call = EX(call);
do {
- if (call->object) {
+ if (Z_TYPE(call->object) != IS_UNDEF) {
if (call->is_ctor_call) {
if (call->is_ctor_result_used) {
- Z_DELREF_P(call->object);
+ Z_DELREF(call->object);
}
- if (Z_REFCOUNT_P(call->object) == 1) {
- zend_object_store_ctor_failed(call->object TSRMLS_CC);
+ if (Z_REFCOUNT(call->object) == 1) {
+ zend_object_store_ctor_failed(&call->object TSRMLS_CC);
}
}
zval_ptr_dtor(&call->object);
@@ -5268,12 +5058,12 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY)
switch (brk_opline->opcode) {
case ZEND_SWITCH_FREE:
if (!(brk_opline->extended_value & EXT_TYPE_FREE_ON_RETURN)) {
- zval_ptr_dtor(&EX_T(brk_opline->op1.var).var.ptr);
+ zval_ptr_dtor(EX_VAR(brk_opline->op1.var));
}
break;
case ZEND_FREE:
if (!(brk_opline->extended_value & EXT_TYPE_FREE_ON_RETURN)) {
- zendi_zval_dtor(EX_T(brk_opline->op1.var).tmp_var);
+ zval_dtor(EX_VAR(brk_opline->op1.var));
}
break;
}
@@ -5282,16 +5072,18 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY)
}
/* restore previous error_reporting value */
- if (!EG(error_reporting) && EX(old_error_reporting) != NULL && Z_LVAL_P(EX(old_error_reporting)) != 0) {
+ if (!EG(error_reporting) && Z_TYPE(EX(old_error_reporting)) != IS_UNDEF && Z_LVAL(EX(old_error_reporting)) != 0) {
zval restored_error_reporting;
+ zend_string *key;
- Z_TYPE(restored_error_reporting) = IS_LONG;
- Z_LVAL(restored_error_reporting) = Z_LVAL_P(EX(old_error_reporting));
+ ZVAL_LONG(&restored_error_reporting, Z_LVAL(EX(old_error_reporting)));
convert_to_string(&restored_error_reporting);
- 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 TSRMLS_CC);
- zendi_zval_dtor(restored_error_reporting);
+ key = STR_INIT("error_reporting", sizeof("error_reporting")-1, 0);
+ zend_alter_ini_entry_ex(key, Z_STRVAL(restored_error_reporting), Z_STRLEN(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME, 1 TSRMLS_CC);
+ STR_FREE(key);
+ zval_dtor(&restored_error_reporting);
}
- EX(old_error_reporting) = NULL;
+ ZVAL_UNDEF(&EX(old_error_reporting));
if (finally_op_num && (!catch_op_num || catch_op_num >= finally_op_num)) {
if (EX(delayed_exception)) {
@@ -5330,7 +5122,7 @@ ZEND_VM_HANDLER(146, ZEND_VERIFY_ABSTRACT_CLASS, ANY, ANY)
USE_OPLINE
SAVE_OPLINE();
- zend_verify_abstract_class(EX_T(opline->op1.var).class_entry TSRMLS_CC);
+ zend_verify_abstract_class(Z_CE_P(EX_VAR(opline->op1.var)) TSRMLS_CC);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -5377,23 +5169,16 @@ ZEND_VM_HANDLER(143, ZEND_DECLARE_CONST, CONST, CONST)
val = GET_OP2_ZVAL_PTR(BP_VAR_R);
if (IS_CONSTANT_TYPE(Z_TYPE_P(val))) {
- zval tmp;
- zval *tmp_ptr = &tmp;
-
- ZVAL_COPY_VALUE(&tmp, val);
+ ZVAL_COPY_VALUE(&c.value, val);
if (Z_TYPE_P(val) == IS_CONSTANT_ARRAY) {
- zval_copy_ctor(&tmp);
+ zval_copy_ctor(&c.value);
}
- INIT_PZVAL(&tmp);
- zval_update_constant(&tmp_ptr, NULL TSRMLS_CC);
- c.value = *tmp_ptr;
+ zval_update_constant(&c.value, NULL TSRMLS_CC);
} else {
- INIT_PZVAL_COPY(&c.value, val);
- zval_copy_ctor(&c.value);
+ ZVAL_DUP(&c.value, val);
}
c.flags = CONST_CS; /* non persistent, case sensetive */
- c.name = str_strndup(Z_STRVAL_P(name), Z_STRLEN_P(name));
- c.name_len = Z_STRLEN_P(name)+1;
+ c.name = STR_DUP(Z_STR_P(name), 0);
c.module_number = PHP_USER_CONSTANT;
if (zend_register_constant(&c TSRMLS_CC) == FAILURE) {
@@ -5408,16 +5193,16 @@ ZEND_VM_HANDLER(143, ZEND_DECLARE_CONST, CONST, CONST)
ZEND_VM_HANDLER(153, ZEND_DECLARE_LAMBDA_FUNCTION, CONST, UNUSED)
{
USE_OPLINE
- zend_function *op_array;
+ zval *zfunc;
SAVE_OPLINE();
- if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), Z_HASH_P(opline->op1.zv), (void *) &op_array) == FAILURE) ||
- UNEXPECTED(op_array->type != ZEND_USER_FUNCTION)) {
+ if (UNEXPECTED((zfunc = zend_hash_find(EG(function_table), Z_STR_P(opline->op1.zv))) == NULL) ||
+ UNEXPECTED(Z_FUNC_P(zfunc)->type != ZEND_USER_FUNCTION)) {
zend_error_noreturn(E_ERROR, "Base lambda function for closure not found");
}
- zend_create_closure(&EX_T(opline->result.var).tmp_var, (zend_function *) op_array, EG(scope), EG(This) TSRMLS_CC);
+ zend_create_closure(EX_VAR(opline->result.var), Z_FUNC_P(zfunc), EG(scope), &EG(This) TSRMLS_CC);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -5426,26 +5211,25 @@ ZEND_VM_HANDLER(153, ZEND_DECLARE_LAMBDA_FUNCTION, CONST, UNUSED)
ZEND_VM_HANDLER(156, ZEND_SEPARATE, VAR, UNUSED)
{
USE_OPLINE
- zval *var_ptr, *new_zv;
+ zval *var_ptr;
SAVE_OPLINE();
- var_ptr = EX_T(opline->op1.var).var.ptr;
+ var_ptr = EX_VAR(opline->op1.var);
if (Z_TYPE_P(var_ptr) != IS_OBJECT &&
- !PZVAL_IS_REF(var_ptr) &&
+ !Z_ISREF_P(var_ptr) &&
Z_REFCOUNT_P(var_ptr) > 1) {
Z_DELREF_P(var_ptr);
- ALLOC_ZVAL(new_zv);
- INIT_PZVAL_COPY(new_zv, var_ptr);
- var_ptr = new_zv;
- zval_copy_ctor(var_ptr);
- EX_T(opline->op1.var).var.ptr = var_ptr;
+ ZVAL_DUP(EX_VAR(opline->op1.var), var_ptr);
}
ZEND_VM_NEXT_OPCODE();
}
ZEND_VM_HANDLER(160, ZEND_YIELD, CONST|TMP|VAR|CV|UNUSED, CONST|TMP|VAR|CV|UNUSED)
{
+//???
+return 0;
+#if 0
USE_OPLINE
/* The generator object is stored in return_value_ptr_ptr */
@@ -5517,7 +5301,7 @@ ZEND_VM_HANDLER(160, ZEND_YIELD, CONST|TMP|VAR|CV|UNUSED, CONST|TMP|VAR|CV|UNUSE
/* Consts, temporary variables and references need copying */
if (OP1_TYPE == IS_CONST || OP1_TYPE == IS_TMP_VAR
- || PZVAL_IS_REF(value)
+ || Z_ISREF_P(value)
) {
zval *copy;
@@ -5551,7 +5335,7 @@ ZEND_VM_HANDLER(160, ZEND_YIELD, CONST|TMP|VAR|CV|UNUSED, CONST|TMP|VAR|CV|UNUSE
/* Consts, temporary variables and references need copying */
if (OP2_TYPE == IS_CONST || OP2_TYPE == IS_TMP_VAR
- || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0)
+ || (Z_ISREF_P(key) && Z_REFCOUNT_P(key) > 0)
) {
zval *copy;
@@ -5603,13 +5387,14 @@ ZEND_VM_HANDLER(160, ZEND_YIELD, CONST|TMP|VAR|CV|UNUSED, CONST|TMP|VAR|CV|UNUSE
SAVE_OPLINE();
ZEND_VM_RETURN();
+#endif
}
ZEND_VM_HANDLER(159, ZEND_DISCARD_EXCEPTION, ANY, ANY)
{
if (EX(delayed_exception) != NULL) {
/* discard the previously thrown exception */
- zval_ptr_dtor(&EX(delayed_exception));
+//??? zval_ptr_dtor(EX(delayed_exception));
EX(delayed_exception) = NULL;
}
diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h
index 49d04a2bae..80d8c5670e 100644
--- a/Zend/zend_vm_execute.h
+++ b/Zend/zend_vm_execute.h
@@ -382,7 +382,7 @@ zend_vm_enter:
ZEND_API void zend_execute(zend_op_array *op_array TSRMLS_DC)
{
- if (EG(exception)) {
+ if (EG(exception) != NULL) {
return;
}
zend_execute_ex(i_create_execute_data_from_op_array(op_array, 0 TSRMLS_CC) TSRMLS_CC);
@@ -399,10 +399,10 @@ static int ZEND_FASTCALL zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS)
i_free_compiled_variables(execute_data TSRMLS_CC);
}
- zend_vm_stack_free((char*)execute_data - (ZEND_MM_ALIGNED_SIZE(sizeof(temp_variable)) * op_array->T) TSRMLS_CC);
+ zend_vm_stack_free((char*)execute_data - (ZEND_MM_ALIGNED_SIZE(sizeof(zval)) * op_array->T) TSRMLS_CC);
if ((op_array->fn_flags & ZEND_ACC_CLOSURE) && op_array->prototype) {
- zval_ptr_dtor((zval**)&op_array->prototype);
+ zval_ptr_dtor((zval*)op_array->prototype);
}
if (nested) {
@@ -420,7 +420,7 @@ static int ZEND_FASTCALL zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS)
EG(opline_ptr) = &EX(opline);
EG(active_op_array) = EX(op_array);
- EG(return_value_ptr_ptr) = EX(original_return_value);
+//??? EG(return_value_ptr_ptr) = EX(original_return_value);
destroy_op_array(op_array TSRMLS_CC);
efree(op_array);
if (UNEXPECTED(EG(exception) != NULL)) {
@@ -433,7 +433,7 @@ static int ZEND_FASTCALL zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS)
} else {
EG(opline_ptr) = &EX(opline);
EG(active_op_array) = EX(op_array);
- EG(return_value_ptr_ptr) = EX(original_return_value);
+//??? EG(return_value_ptr_ptr) = EX(original_return_value);
if (EG(active_symbol_table)) {
zend_clean_and_cache_symbol_table(EG(active_symbol_table) TSRMLS_CC);
}
@@ -442,20 +442,20 @@ static int ZEND_FASTCALL zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS)
EX(function_state).function = (zend_function *) EX(op_array);
EX(function_state).arguments = NULL;
- if (EG(This)) {
+ if (Z_TYPE(EG(This)) != IS_UNDEF) {
if (UNEXPECTED(EG(exception) != NULL) && EX(call)->is_ctor_call) {
if (EX(call)->is_ctor_result_used) {
- Z_DELREF_P(EG(This));
+ Z_DELREF(EG(This));
}
- if (Z_REFCOUNT_P(EG(This)) == 1) {
- zend_object_store_ctor_failed(EG(This) TSRMLS_CC);
+ if (Z_REFCOUNT(EG(This)) == 1) {
+ zend_object_store_ctor_failed(&EG(This) TSRMLS_CC);
}
}
zval_ptr_dtor(&EG(This));
}
- EG(This) = EX(current_this);
- EG(scope) = EX(current_scope);
- EG(called_scope) = EX(current_called_scope);
+//??? EG(This) = EX(current_this);
+//??? EG(scope) = EX(current_scope);
+//??? EG(called_scope) = EX(current_called_scope);
EX(call)--;
@@ -463,8 +463,8 @@ static int ZEND_FASTCALL zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS)
if (UNEXPECTED(EG(exception) != NULL)) {
zend_throw_exception_internal(NULL TSRMLS_CC);
- if (RETURN_VALUE_USED(opline) && EX_T(opline->result.var).var.ptr) {
- zval_ptr_dtor(&EX_T(opline->result.var).var.ptr);
+ if (RETURN_VALUE_USED(opline) /*???&& EX_VAR(opline->result.var).var.ptr*/) {
+ zval_ptr_dtor(EX_VAR(opline->result.var));
}
HANDLE_EXCEPTION_LEAVE();
}
@@ -484,16 +484,16 @@ static int ZEND_FASTCALL zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_AR
zend_uint num_args;
SAVE_OPLINE();
- EX(object) = EX(call)->object;
+ ZVAL_COPY_VALUE(&EX(object), &EX(call)->object);
if (UNEXPECTED((fbc->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_DEPRECATED)) != 0)) {
if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_ABSTRACT) != 0)) {
zend_error_noreturn(E_ERROR, "Cannot call abstract method %s::%s()", fbc->common.scope->name, fbc->common.function_name);
}
if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_DEPRECATED) != 0)) {
zend_error(E_DEPRECATED, "Function %s%s%s() is deprecated",
- fbc->common.scope ? fbc->common.scope->name : "",
+ fbc->common.scope ? fbc->common.scope->name->val : "",
fbc->common.scope ? "::" : "",
- fbc->common.function_name);
+ fbc->common.function_name->val);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
@@ -501,11 +501,11 @@ static int ZEND_FASTCALL zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_AR
}
if (fbc->common.scope &&
!(fbc->common.fn_flags & ZEND_ACC_STATIC) &&
- !EX(object)) {
+ Z_TYPE(EX(object)) == IS_UNDEF) {
if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
/* FIXME: output identifiers properly */
- zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically", fbc->common.scope->name, fbc->common.function_name);
+ zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically", fbc->common.scope->name->val, fbc->common.function_name->val);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
@@ -518,11 +518,11 @@ static int ZEND_FASTCALL zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_AR
if (fbc->type == ZEND_USER_FUNCTION || fbc->common.scope) {
should_change_scope = 1;
- EX(current_this) = EG(This);
- EX(current_scope) = EG(scope);
- EX(current_called_scope) = EG(called_scope);
+//??? EX(current_this) = EG(This);
+//??? EX(current_scope) = EG(scope);
+//??? EX(current_called_scope) = EG(called_scope);
EG(This) = EX(object);
- EG(scope) = (fbc->type == ZEND_USER_FUNCTION || !EX(object)) ? fbc->common.scope : NULL;
+ EG(scope) = (fbc->type == ZEND_USER_FUNCTION || Z_TYPE(EX(object)) == IS_UNDEF) ? fbc->common.scope : NULL;
EG(called_scope) = EX(call)->called_scope;
}
@@ -538,51 +538,50 @@ static int ZEND_FASTCALL zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_AR
if (fbc->type == ZEND_INTERNAL_FUNCTION) {
if (fbc->common.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) {
zend_uint i;
- void **p = EX(function_state).arguments - num_args;
+ zval *p = EX(function_state).arguments - num_args;
for (i = 0; i < num_args; ++i, ++p) {
- zend_verify_arg_type(fbc, i + 1, (zval *) *p, 0 TSRMLS_CC);
+ zend_verify_arg_type(fbc, i + 1, p, 0 TSRMLS_CC);
}
}
if (EXPECTED(EG(exception) == NULL)) {
- temp_variable *ret = &EX_T(opline->result.var);
+ zval *ret = EX_VAR(opline->result.var);
- MAKE_STD_ZVAL(ret->var.ptr);
- ZVAL_NULL(ret->var.ptr);
- ret->var.ptr_ptr = &ret->var.ptr;
- ret->var.fcall_returned_reference = (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0;
+ ZVAL_NULL(ret);
+//??? ret->var.ptr_ptr = &ret->var.ptr;
+//??? ret->var.fcall_returned_reference = (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0;
if (!zend_execute_internal) {
/* saves one function call if zend_execute_internal is not used */
- fbc->internal_function.handler(num_args, ret->var.ptr, &ret->var.ptr, EX(object), RETURN_VALUE_USED(opline) TSRMLS_CC);
+ fbc->internal_function.handler(num_args, ret, &EX(object), RETURN_VALUE_USED(opline) TSRMLS_CC);
} else {
zend_execute_internal(execute_data, NULL, RETURN_VALUE_USED(opline) TSRMLS_CC);
}
if (!RETURN_VALUE_USED(opline)) {
- zval_ptr_dtor(&ret->var.ptr);
+ zval_ptr_dtor(ret);
}
} else if (RETURN_VALUE_USED(opline)) {
- EX_T(opline->result.var).var.ptr = NULL;
+//??? EX_T(opline->result.var).var.ptr = NULL;
}
} else if (fbc->type == ZEND_USER_FUNCTION) {
- EX(original_return_value) = EG(return_value_ptr_ptr);
+//??? EX(original_return_value) = EG(return_value_ptr_ptr);
EG(active_symbol_table) = NULL;
EG(active_op_array) = &fbc->op_array;
- EG(return_value_ptr_ptr) = NULL;
+//??? EG(return_value_ptr_ptr) = NULL;
if (RETURN_VALUE_USED(opline)) {
- temp_variable *ret = &EX_T(opline->result.var);
+ zval *ret = EX_VAR(opline->result.var);
- ret->var.ptr = NULL;
- EG(return_value_ptr_ptr) = &ret->var.ptr;
- ret->var.ptr_ptr = &ret->var.ptr;
- ret->var.fcall_returned_reference = (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0;
+ ZVAL_NULL(ret);
+//??? EG(return_value_ptr_ptr) = &ret->var.ptr;
+//??? ret->var.ptr_ptr = &ret->var.ptr;
+//??? ret->var.fcall_returned_reference = (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0;
}
if (UNEXPECTED((EG(active_op_array)->fn_flags & ZEND_ACC_GENERATOR) != 0)) {
if (RETURN_VALUE_USED(opline)) {
- EX_T(opline->result.var).var.ptr = zend_generator_create_zval(EG(active_op_array) TSRMLS_CC);
+ zend_generator_create_zval(EG(active_op_array), EX_VAR(opline->result.var) TSRMLS_CC);
}
} else if (EXPECTED(zend_execute_ex == execute_ex)) {
if (EXPECTED(EG(exception) == NULL)) {
@@ -594,18 +593,17 @@ static int ZEND_FASTCALL zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_AR
EG(opline_ptr) = &EX(opline);
EG(active_op_array) = EX(op_array);
- EG(return_value_ptr_ptr) = EX(original_return_value);
+//??? EG(return_value_ptr_ptr) = EX(original_return_value);
if (EG(active_symbol_table)) {
zend_clean_and_cache_symbol_table(EG(active_symbol_table) TSRMLS_CC);
}
EG(active_symbol_table) = EX(symbol_table);
} else { /* ZEND_OVERLOADED_FUNCTION */
- MAKE_STD_ZVAL(EX_T(opline->result.var).var.ptr);
- ZVAL_NULL(EX_T(opline->result.var).var.ptr);
+ ZVAL_NULL(EX_VAR(opline->result.var));
/* Not sure what should be done here if it's a static method */
- if (EXPECTED(EX(object) != NULL)) {
- Z_OBJ_HT_P(EX(object))->call_method(fbc->common.function_name, num_args, EX_T(opline->result.var).var.ptr, &EX_T(opline->result.var).var.ptr, EX(object), RETURN_VALUE_USED(opline) TSRMLS_CC);
+ if (EXPECTED(Z_TYPE(EX(object)) != IS_UNDEF)) {
+ Z_OBJ_HT_P(&EX(object))->call_method(fbc->common.function_name, num_args, EX_VAR(opline->result.var), &EX(object), RETURN_VALUE_USED(opline) TSRMLS_CC);
} else {
zend_error_noreturn(E_ERROR, "Cannot call overloaded function for non-object");
}
@@ -616,12 +614,12 @@ static int ZEND_FASTCALL zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_AR
efree(fbc);
if (!RETURN_VALUE_USED(opline)) {
- zval_ptr_dtor(&EX_T(opline->result.var).var.ptr);
+ zval_ptr_dtor(EX_VAR(opline->result.var));
} else {
- Z_UNSET_ISREF_P(EX_T(opline->result.var).var.ptr);
- Z_SET_REFCOUNT_P(EX_T(opline->result.var).var.ptr, 1);
- EX_T(opline->result.var).var.fcall_returned_reference = 0;
- EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
+//??? Z_UNSET_ISREF_P(EX_T(opline->result.var).var.ptr);
+//??? Z_SET_REFCOUNT_P(EX_T(opline->result.var).var.ptr, 1);
+//??? EX_T(opline->result.var).var.fcall_returned_reference = 0;
+//??? EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
}
}
@@ -629,20 +627,20 @@ static int ZEND_FASTCALL zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_AR
EX(function_state).arguments = NULL;
if (should_change_scope) {
- if (EG(This)) {
+ if (Z_TYPE(EG(This)) != IS_UNDEF) {
if (UNEXPECTED(EG(exception) != NULL) && EX(call)->is_ctor_call) {
if (EX(call)->is_ctor_result_used) {
- Z_DELREF_P(EG(This));
+ Z_DELREF(EG(This));
}
- if (Z_REFCOUNT_P(EG(This)) == 1) {
- zend_object_store_ctor_failed(EG(This) TSRMLS_CC);
+ if (Z_REFCOUNT(EG(This)) == 1) {
+ zend_object_store_ctor_failed(&EG(This) TSRMLS_CC);
}
}
zval_ptr_dtor(&EG(This));
}
- EG(This) = EX(current_this);
- EG(scope) = EX(current_scope);
- EG(called_scope) = EX(current_called_scope);
+//??? EG(This) = EX(current_this);
+//??? EG(scope) = EX(current_scope);
+//??? EG(called_scope) = EX(current_called_scope);
}
EX(call)--;
@@ -651,8 +649,8 @@ static int ZEND_FASTCALL zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_AR
if (UNEXPECTED(EG(exception) != NULL)) {
zend_throw_exception_internal(NULL TSRMLS_CC);
- if (RETURN_VALUE_USED(opline) && EX_T(opline->result.var).var.ptr) {
- zval_ptr_dtor(&EX_T(opline->result.var).var.ptr);
+ if (RETURN_VALUE_USED(opline) /*???&& EX_T(opline->result.var).var.ptr*/) {
+ zval_ptr_dtor(EX_VAR(opline->result.var));
}
HANDLE_EXCEPTION();
}
@@ -674,15 +672,10 @@ static int ZEND_FASTCALL ZEND_JMP_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
static int ZEND_FASTCALL ZEND_INIT_STRING_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zval *tmp = &EX_T(opline->result.var).tmp_var;
+ zval *tmp = EX_VAR(opline->result.var);
SAVE_OPLINE();
- tmp->value.str.val = emalloc(1);
- tmp->value.str.val[0] = 0;
- tmp->value.str.len = 0;
- Z_SET_REFCOUNT_P(tmp, 1);
- tmp->type = IS_STRING;
- Z_UNSET_ISREF_P(tmp);
+ ZVAL_EMPTY_STRING(tmp);
/*CHECK_EXCEPTION();*/
ZEND_VM_NEXT_OPCODE();
}
@@ -696,10 +689,10 @@ static int ZEND_FASTCALL ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER(ZEND_OPCODE_HANDLER
static int ZEND_FASTCALL ZEND_GENERATOR_RETURN_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
/* The generator object is stored in return_value_ptr_ptr */
- zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr);
+//??? zend_generator *generator = (zend_generator *) EG(return_value_ptr_ptr);
/* Close the generator to free up resources */
- zend_generator_close(generator, 1 TSRMLS_CC);
+//??? zend_generator_close(generator, 1 TSRMLS_CC);
/* Pass execution back to handling code */
ZEND_VM_RETURN();
@@ -707,6 +700,8 @@ static int ZEND_FASTCALL ZEND_GENERATOR_RETURN_SPEC_HANDLER(ZEND_OPCODE_HANDLER
static int ZEND_FASTCALL ZEND_SEND_UNPACK_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
+//???
+#if 0
USE_OPLINE
zend_free_op free_op1;
zval *args;
@@ -720,12 +715,12 @@ static int ZEND_FASTCALL ZEND_SEND_UNPACK_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS
case IS_ARRAY: {
HashTable *ht = Z_ARRVAL_P(args);
HashPosition pos;
- zval **arg_ptr, *arg;
+ zval *arg;
ZEND_VM_STACK_GROW_IF_NEEDED(zend_hash_num_elements(ht));
for (zend_hash_internal_pointer_reset_ex(ht, &pos);
- zend_hash_get_current_data_ex(ht, (void **) &arg_ptr, &pos) == SUCCESS;
+ (arg = zend_hash_get_current_data_ex(ht, &pos) != NULL;
zend_hash_move_forward_ex(ht, &pos), ++arg_num
) {
char *name;
@@ -740,14 +735,11 @@ static int ZEND_FASTCALL ZEND_SEND_UNPACK_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS
}
if (ARG_SHOULD_BE_SENT_BY_REF(EX(call)->fbc, arg_num)) {
- SEPARATE_ZVAL_TO_MAKE_IS_REF(arg_ptr);
- arg = *arg_ptr;
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(arg);
Z_ADDREF_P(arg);
- } else if (Z_ISREF_PP(arg_ptr)) {
- ALLOC_ZVAL(arg);
- MAKE_COPY_ZVAL(arg_ptr, arg);
+ } else if (Z_ISREF_P(arg)) {
+ ZVAL_DUP(arg, Z_REFVAL_P(arg);
} else {
- arg = *arg_ptr;
Z_ADDREF_P(arg);
}
@@ -850,6 +842,7 @@ unpack_iter_dtor:
FREE_OP(free_op1);
CHECK_EXCEPTION();
+#endif
ZEND_VM_NEXT_OPCODE();
}
@@ -857,7 +850,7 @@ static int ZEND_FASTCALL ZEND_RECV_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
zend_uint arg_num = opline->op1.num;
- zval **param = zend_vm_stack_get_arg(arg_num TSRMLS_CC);
+ zval *param = zend_vm_stack_get_arg(arg_num TSRMLS_CC);
SAVE_OPLINE();
if (UNEXPECTED(param == NULL)) {
@@ -867,7 +860,7 @@ static int ZEND_FASTCALL ZEND_RECV_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_execute_data *ptr;
if (EG(active_op_array)->scope) {
- class_name = EG(active_op_array)->scope->name;
+ class_name = EG(active_op_array)->scope->name->val;
space = "::";
} else {
class_name = space = "";
@@ -875,19 +868,18 @@ static int ZEND_FASTCALL ZEND_RECV_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
ptr = EX(prev_execute_data);
if(ptr && ptr->op_array) {
- zend_error(E_WARNING, "Missing argument %u for %s%s%s(), called in %s on line %d and defined", opline->op1.num, class_name, space, get_active_function_name(TSRMLS_C), ptr->op_array->filename, ptr->opline->lineno);
+ zend_error(E_WARNING, "Missing argument %u for %s%s%s(), called in %s on line %d and defined", opline->op1.num, class_name, space, get_active_function_name(TSRMLS_C), ptr->op_array->filename->val, ptr->opline->lineno);
} else {
zend_error(E_WARNING, "Missing argument %u for %s%s%s()", opline->op1.num, class_name, space, get_active_function_name(TSRMLS_C));
}
}
} else {
- zval **var_ptr;
+ zval *var_ptr;
- zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, *param, opline->extended_value TSRMLS_CC);
- var_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->result.var TSRMLS_CC);
- Z_DELREF_PP(var_ptr);
- *var_ptr = *param;
- Z_ADDREF_PP(var_ptr);
+ zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, param, opline->extended_value TSRMLS_CC);
+ var_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->result.var TSRMLS_CC);
+ Z_DELREF_P(var_ptr);
+ ZVAL_COPY(var_ptr, param);
}
CHECK_EXCEPTION();
@@ -899,14 +891,12 @@ static int ZEND_FASTCALL ZEND_RECV_VARIADIC_SPEC_HANDLER(ZEND_OPCODE_HANDLER_AR
USE_OPLINE
zend_uint arg_num = opline->op1.num;
zend_uint arg_count = zend_vm_stack_get_args_count(TSRMLS_C);
- zval **var_ptr, *params;
+ zval *params;
SAVE_OPLINE();
- var_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->result.var TSRMLS_CC);
- Z_DELREF_PP(var_ptr);
- MAKE_STD_ZVAL(params);
- *var_ptr = params;
+ params = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->result.var TSRMLS_CC);
+ Z_DELREF_P(params);
if (arg_num <= arg_count) {
array_init_size(params, arg_count - arg_num + 1);
@@ -915,10 +905,12 @@ static int ZEND_FASTCALL ZEND_RECV_VARIADIC_SPEC_HANDLER(ZEND_OPCODE_HANDLER_AR
}
for (; arg_num <= arg_count; ++arg_num) {
- zval **param = zend_vm_stack_get_arg(arg_num TSRMLS_CC);
- zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, *param, opline->extended_value TSRMLS_CC);
- zend_hash_next_index_insert(Z_ARRVAL_P(params), param, sizeof(zval *), NULL);
- Z_ADDREF_PP(param);
+ zval *param = zend_vm_stack_get_arg(arg_num TSRMLS_CC);
+ zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, param, opline->extended_value TSRMLS_CC);
+ zend_hash_next_index_insert(Z_ARRVAL_P(params), param);
+ if (Z_REFCOUNTED_P(param)) {
+ Z_ADDREF_P(param);
+ }
}
CHECK_EXCEPTION();
@@ -928,28 +920,25 @@ static int ZEND_FASTCALL ZEND_RECV_VARIADIC_SPEC_HANDLER(ZEND_OPCODE_HANDLER_AR
static int ZEND_FASTCALL ZEND_NEW_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zval *object_zval;
+ zval object_zval;
zend_function *constructor;
SAVE_OPLINE();
- if (UNEXPECTED((EX_T(opline->op1.var).class_entry->ce_flags & (ZEND_ACC_INTERFACE|ZEND_ACC_IMPLICIT_ABSTRACT_CLASS|ZEND_ACC_EXPLICIT_ABSTRACT_CLASS)) != 0)) {
- if (EX_T(opline->op1.var).class_entry->ce_flags & ZEND_ACC_INTERFACE) {
- zend_error_noreturn(E_ERROR, "Cannot instantiate interface %s", EX_T(opline->op1.var).class_entry->name);
- } else if ((EX_T(opline->op1.var).class_entry->ce_flags & ZEND_ACC_TRAIT) == ZEND_ACC_TRAIT) {
- zend_error_noreturn(E_ERROR, "Cannot instantiate trait %s", EX_T(opline->op1.var).class_entry->name);
+ if (UNEXPECTED((Z_CE_P(EX_VAR(opline->op1.var))->ce_flags & (ZEND_ACC_INTERFACE|ZEND_ACC_IMPLICIT_ABSTRACT_CLASS|ZEND_ACC_EXPLICIT_ABSTRACT_CLASS)) != 0)) {
+ if (Z_CE_P(EX_VAR(opline->op1.var))->ce_flags & ZEND_ACC_INTERFACE) {
+ zend_error_noreturn(E_ERROR, "Cannot instantiate interface %s", Z_CE_P(EX_VAR(opline->op1.var))->name->val);
+ } else if ((Z_CE_P(EX_VAR(opline->op1.var))->ce_flags & ZEND_ACC_TRAIT) == ZEND_ACC_TRAIT) {
+ zend_error_noreturn(E_ERROR, "Cannot instantiate trait %s", Z_CE_P(EX_VAR(opline->op1.var))->name->val);
} else {
- zend_error_noreturn(E_ERROR, "Cannot instantiate abstract class %s", EX_T(opline->op1.var).class_entry->name);
+ zend_error_noreturn(E_ERROR, "Cannot instantiate abstract class %s", Z_CE_P(EX_VAR(opline->op1.var))->name->val);
}
}
- ALLOC_ZVAL(object_zval);
- object_init_ex(object_zval, EX_T(opline->op1.var).class_entry);
- INIT_PZVAL(object_zval);
-
- constructor = Z_OBJ_HT_P(object_zval)->get_constructor(object_zval TSRMLS_CC);
+ object_init_ex(&object_zval, Z_CE_P(EX_VAR(opline->op1.var)));
+ constructor = Z_OBJ_HT(object_zval)->get_constructor(&object_zval TSRMLS_CC);
if (constructor == NULL) {
if (RETURN_VALUE_USED(opline)) {
- AI_SET_PTR(&EX_T(opline->result.var), object_zval);
+ ZVAL_COPY_VALUE(EX_VAR(opline->result.var), &object_zval);
} else {
zval_ptr_dtor(&object_zval);
}
@@ -958,14 +947,13 @@ static int ZEND_FASTCALL ZEND_NEW_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
call_slot *call = EX(call_slots) + opline->extended_value;
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(object_zval);
- AI_SET_PTR(&EX_T(opline->result.var), object_zval);
+ ZVAL_COPY(EX_VAR(opline->result.var), &object_zval);
}
/* We are not handling overloaded classes right now */
call->fbc = constructor;
- call->object = object_zval;
- call->called_scope = EX_T(opline->op1.var).class_entry;
+ ZVAL_COPY_VALUE(&call->object, &object_zval);
+ call->called_scope = Z_CE_P(EX_VAR(opline->op1.var));
call->num_additional_args = 0;
call->is_ctor_call = 1;
call->is_ctor_result_used = RETURN_VALUE_USED(opline);
@@ -981,17 +969,19 @@ static int ZEND_FASTCALL ZEND_BEGIN_SILENCE_SPEC_HANDLER(ZEND_OPCODE_HANDLER_AR
USE_OPLINE
SAVE_OPLINE();
- Z_LVAL(EX_T(opline->result.var).tmp_var) = EG(error_reporting);
- Z_TYPE(EX_T(opline->result.var).tmp_var) = IS_LONG; /* shouldn't be necessary */
- if (EX(old_error_reporting) == NULL) {
- EX(old_error_reporting) = &EX_T(opline->result.var).tmp_var;
+ ZVAL_LONG(EX_VAR(opline->result.var), EG(error_reporting));
+ if (Z_TYPE(EX(old_error_reporting)) == IS_UNDEF) {
+ ZVAL_LONG(&EX(old_error_reporting), EG(error_reporting));
}
if (EG(error_reporting)) {
do {
EG(error_reporting) = 0;
if (!EG(error_reporting_ini_entry)) {
- if (UNEXPECTED(zend_hash_find(EG(ini_directives), "error_reporting", sizeof("error_reporting"), (void **) &EG(error_reporting_ini_entry)) == FAILURE)) {
+ zend_ini_entry *p = zend_hash_str_find_ptr(EG(ini_directives), "error_reporting", sizeof("error_reporting")-1);
+ if (p) {
+ EG(error_reporting_ini_entry) = p;
+ } else {
break;
}
}
@@ -1000,7 +990,7 @@ static int ZEND_FASTCALL ZEND_BEGIN_SILENCE_SPEC_HANDLER(ZEND_OPCODE_HANDLER_AR
ALLOC_HASHTABLE(EG(modified_ini_directives));
zend_hash_init(EG(modified_ini_directives), 8, NULL, NULL, 0);
}
- if (EXPECTED(zend_hash_add(EG(modified_ini_directives), "error_reporting", sizeof("error_reporting"), &EG(error_reporting_ini_entry), sizeof(zend_ini_entry*), NULL) == SUCCESS)) {
+ if (EXPECTED(zend_hash_str_add_ptr(EG(modified_ini_directives), "error_reporting", sizeof("error_reporting")-1, EG(error_reporting_ini_entry)) != NULL)) {
EG(error_reporting_ini_entry)->orig_value = EG(error_reporting_ini_entry)->value;
EG(error_reporting_ini_entry)->orig_value_length = EG(error_reporting_ini_entry)->value_length;
EG(error_reporting_ini_entry)->orig_modifiable = EG(error_reporting_ini_entry)->modifiable;
@@ -1059,7 +1049,7 @@ static int ZEND_FASTCALL ZEND_DECLARE_CLASS_SPEC_HANDLER(ZEND_OPCODE_HANDLER_AR
USE_OPLINE
SAVE_OPLINE();
- EX_T(opline->result.var).class_entry = do_bind_class(EX(op_array), opline, EG(class_table), 0 TSRMLS_CC);
+ Z_CE_P(EX_VAR(opline->result.var)) = do_bind_class(EX(op_array), opline, EG(class_table), 0 TSRMLS_CC);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -1069,7 +1059,7 @@ static int ZEND_FASTCALL ZEND_DECLARE_INHERITED_CLASS_SPEC_HANDLER(ZEND_OPCODE_
USE_OPLINE
SAVE_OPLINE();
- EX_T(opline->result.var).class_entry = do_bind_inherited_class(EX(op_array), opline, EG(class_table), EX_T(opline->extended_value).class_entry, 0 TSRMLS_CC);
+ Z_CE_P(EX_VAR(opline->result.var)) = do_bind_inherited_class(EX(op_array), opline, EG(class_table), Z_CE_P(EX_VAR(opline->extended_value)), 0 TSRMLS_CC);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -1077,13 +1067,13 @@ static int ZEND_FASTCALL ZEND_DECLARE_INHERITED_CLASS_SPEC_HANDLER(ZEND_OPCODE_
static int ZEND_FASTCALL ZEND_DECLARE_INHERITED_CLASS_DELAYED_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_class_entry **pce, **pce_orig;
+ zval *zce, *orig_zce;
SAVE_OPLINE();
- if (zend_hash_quick_find(EG(class_table), Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv)+1, Z_HASH_P(opline->op2.zv), (void**)&pce) == FAILURE ||
- (zend_hash_quick_find(EG(class_table), Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), Z_HASH_P(opline->op1.zv), (void**)&pce_orig) == SUCCESS &&
- *pce != *pce_orig)) {
- do_bind_inherited_class(EX(op_array), opline, EG(class_table), EX_T(opline->extended_value).class_entry, 0 TSRMLS_CC);
+ if ((zce = zend_hash_find(EG(class_table), Z_STR_P(opline->op2.zv))) == NULL ||
+ ((orig_zce = zend_hash_find(EG(class_table), Z_STR_P(opline->op1.zv))) != NULL &&
+ Z_CE_P(zce) != Z_CE_P(orig_zce))) {
+ do_bind_inherited_class(EX(op_array), opline, EG(class_table), Z_CE_P(EX_VAR(opline->extended_value)), 0 TSRMLS_CC);
}
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -1127,15 +1117,14 @@ static int ZEND_FASTCALL ZEND_NOP_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
static int ZEND_FASTCALL ZEND_ADD_TRAIT_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_class_entry *ce = EX_T(opline->op1.var).class_entry;
+ zend_class_entry *ce = Z_CE_P(EX_VAR(opline->op1.var));
zend_class_entry *trait;
SAVE_OPLINE();
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
trait = CACHED_PTR(opline->op2.literal->cache_slot);
} else {
- trait = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv),
- Z_STRLEN_P(opline->op2.zv),
+ trait = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv),
opline->op2.literal + 1,
opline->extended_value TSRMLS_CC);
if (UNEXPECTED(trait == NULL)) {
@@ -1157,7 +1146,7 @@ static int ZEND_FASTCALL ZEND_ADD_TRAIT_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
static int ZEND_FASTCALL ZEND_BIND_TRAITS_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_class_entry *ce = EX_T(opline->op1.var).class_entry;
+ zend_class_entry *ce = Z_CE_P(EX_VAR(opline->op1.var));
SAVE_OPLINE();
zend_do_bind_traits(ce TSRMLS_CC);
@@ -1170,7 +1159,7 @@ static int ZEND_FASTCALL ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER
zend_uint op_num = EG(opline_before_exception)-EG(active_op_array)->opcodes;
int i;
zend_uint catch_op_num = 0, finally_op_num = 0, finally_op_end = 0;
- void **stack_frame;
+ zval *stack_frame;
/* Figure out where the next stack frame (which maybe contains pushed
* arguments that have to be dtor'ed) starts */
@@ -1180,7 +1169,7 @@ static int ZEND_FASTCALL ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER
* arguments pushed to the stack that have to be dtor'ed. */
while (zend_vm_stack_top(TSRMLS_C) != stack_frame) {
zval *stack_zval_p = zend_vm_stack_pop(TSRMLS_C);
- zval_ptr_dtor(&stack_zval_p);
+ zval_ptr_dtor(stack_zval_p);
}
for (i=0; i<EG(active_op_array)->last_try_catch; i++) {
@@ -1203,13 +1192,13 @@ static int ZEND_FASTCALL ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER
if (EX(call) >= EX(call_slots)) {
call_slot *call = EX(call);
do {
- if (call->object) {
+ if (Z_TYPE(call->object) != IS_UNDEF) {
if (call->is_ctor_call) {
if (call->is_ctor_result_used) {
- Z_DELREF_P(call->object);
+ Z_DELREF(call->object);
}
- if (Z_REFCOUNT_P(call->object) == 1) {
- zend_object_store_ctor_failed(call->object TSRMLS_CC);
+ if (Z_REFCOUNT(call->object) == 1) {
+ zend_object_store_ctor_failed(&call->object TSRMLS_CC);
}
}
zval_ptr_dtor(&call->object);
@@ -1233,12 +1222,12 @@ static int ZEND_FASTCALL ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER
switch (brk_opline->opcode) {
case ZEND_SWITCH_FREE:
if (!(brk_opline->extended_value & EXT_TYPE_FREE_ON_RETURN)) {
- zval_ptr_dtor(&EX_T(brk_opline->op1.var).var.ptr);
+ zval_ptr_dtor(EX_VAR(brk_opline->op1.var));
}
break;
case ZEND_FREE:
if (!(brk_opline->extended_value & EXT_TYPE_FREE_ON_RETURN)) {
- zendi_zval_dtor(EX_T(brk_opline->op1.var).tmp_var);
+ zval_dtor(EX_VAR(brk_opline->op1.var));
}
break;
}
@@ -1247,16 +1236,18 @@ static int ZEND_FASTCALL ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER
}
/* restore previous error_reporting value */
- if (!EG(error_reporting) && EX(old_error_reporting) != NULL && Z_LVAL_P(EX(old_error_reporting)) != 0) {
+ if (!EG(error_reporting) && Z_TYPE(EX(old_error_reporting)) != IS_UNDEF && Z_LVAL(EX(old_error_reporting)) != 0) {
zval restored_error_reporting;
+ zend_string *key;
- Z_TYPE(restored_error_reporting) = IS_LONG;
- Z_LVAL(restored_error_reporting) = Z_LVAL_P(EX(old_error_reporting));
+ ZVAL_LONG(&restored_error_reporting, Z_LVAL(EX(old_error_reporting)));
convert_to_string(&restored_error_reporting);
- 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 TSRMLS_CC);
- zendi_zval_dtor(restored_error_reporting);
+ key = STR_INIT("error_reporting", sizeof("error_reporting")-1, 0);
+ zend_alter_ini_entry_ex(key, Z_STRVAL(restored_error_reporting), Z_STRLEN(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME, 1 TSRMLS_CC);
+ STR_FREE(key);
+ zval_dtor(&restored_error_reporting);
}
- EX(old_error_reporting) = NULL;
+ ZVAL_UNDEF(&EX(old_error_reporting));
if (finally_op_num && (!catch_op_num || catch_op_num >= finally_op_num)) {
if (EX(delayed_exception)) {
@@ -1295,7 +1286,7 @@ static int ZEND_FASTCALL ZEND_VERIFY_ABSTRACT_CLASS_SPEC_HANDLER(ZEND_OPCODE_HA
USE_OPLINE
SAVE_OPLINE();
- zend_verify_abstract_class(EX_T(opline->op1.var).class_entry TSRMLS_CC);
+ zend_verify_abstract_class(Z_CE_P(EX_VAR(opline->op1.var)) TSRMLS_CC);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -1333,7 +1324,7 @@ static int ZEND_FASTCALL ZEND_DISCARD_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLE
{
if (EX(delayed_exception) != NULL) {
/* discard the previously thrown exception */
- zval_ptr_dtor(&EX(delayed_exception));
+//??? zval_ptr_dtor(EX(delayed_exception));
EX(delayed_exception) = NULL;
}
@@ -1392,7 +1383,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLE
zend_exception_save(TSRMLS_C);
}
if (IS_CONST == IS_UNUSED) {
- EX_T(opline->result.var).class_entry = zend_fetch_class(NULL, 0, opline->extended_value TSRMLS_CC);
+ Z_CE_P(EX_VAR(opline->result.var)) = zend_fetch_class(NULL, opline->extended_value TSRMLS_CC);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
} else {
@@ -1401,15 +1392,15 @@ static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLE
if (IS_CONST == IS_CONST) {
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- EX_T(opline->result.var).class_entry = CACHED_PTR(opline->op2.literal->cache_slot);
+ Z_CE_P(EX_VAR(opline->result.var)) = CACHED_PTR(opline->op2.literal->cache_slot);
} else {
- EX_T(opline->result.var).class_entry = zend_fetch_class_by_name(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->op2.literal + 1, opline->extended_value TSRMLS_CC);
- CACHE_PTR(opline->op2.literal->cache_slot, EX_T(opline->result.var).class_entry);
+ Z_CE_P(EX_VAR(opline->result.var)) = zend_fetch_class_by_name(Z_STR_P(class_name), opline->op2.literal + 1, opline->extended_value TSRMLS_CC);
+ CACHE_PTR(opline->op2.literal->cache_slot, Z_CE_P(EX_VAR(opline->result.var)));
}
} else if (Z_TYPE_P(class_name) == IS_OBJECT) {
- EX_T(opline->result.var).class_entry = Z_OBJCE_P(class_name);
+ Z_CE_P(EX_VAR(opline->result.var)) = Z_OBJCE_P(class_name);
} else if (Z_TYPE_P(class_name) == IS_STRING) {
- EX_T(opline->result.var).class_entry = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->extended_value TSRMLS_CC);
+ Z_CE_P(EX_VAR(opline->result.var)) = zend_fetch_class(Z_STR_P(class_name), opline->extended_value TSRMLS_CC);
} else {
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
@@ -1425,21 +1416,22 @@ static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLE
static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zval *function_name;
+ zval *function_name, *func;
call_slot *call = EX(call_slots) + opline->result.num;
if (IS_CONST == IS_CONST) {
function_name = (zval*)(opline->op2.literal+1);
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
call->fbc = CACHED_PTR(opline->op2.literal->cache_slot);
- } else if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(function_name), Z_STRLEN_P(function_name)+1, Z_HASH_P(function_name), (void **) &call->fbc) == FAILURE)) {
+ } else if (UNEXPECTED((func = zend_hash_find(EG(function_table), Z_STR_P(function_name))) == NULL)) {
SAVE_OPLINE();
zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(opline->op2.zv));
} else {
+ call->fbc = Z_FUNC_P(func);
CACHE_PTR(opline->op2.literal->cache_slot, call->fbc);
}
- call->object = NULL;
+ ZVAL_UNDEF(&call->object);
call->called_scope = NULL;
call->num_additional_args = 0;
call->is_ctor_call = 0;
@@ -1448,28 +1440,27 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CONST_HANDLER(ZEND_OPCODE
/*CHECK_EXCEPTION();*/
ZEND_VM_NEXT_OPCODE();
} else {
- char *function_name_strval, *lcname;
- int function_name_strlen;
+ zend_string *lcname;
SAVE_OPLINE();
function_name = opline->op2.zv;
if (EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) {
- function_name_strval = Z_STRVAL_P(function_name);
- function_name_strlen = Z_STRLEN_P(function_name);
- if (function_name_strval[0] == '\\') {
- function_name_strlen -= 1;
- lcname = zend_str_tolower_dup(function_name_strval + 1, function_name_strlen);
+ if (Z_STRVAL_P(function_name)[0] == '\\') {
+ lcname = STR_ALLOC(Z_STRLEN_P(function_name) - 1, 0);
+ zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name) + 1, Z_STRLEN_P(function_name) - 1);
} else {
- lcname = zend_str_tolower_dup(function_name_strval, function_name_strlen);
+ lcname = STR_ALLOC(Z_STRLEN_P(function_name), 0);
+ zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name), Z_STRLEN_P(function_name));
}
- if (UNEXPECTED(zend_hash_find(EG(function_table), lcname, function_name_strlen+1, (void **) &call->fbc) == FAILURE)) {
- zend_error_noreturn(E_ERROR, "Call to undefined function %s()", function_name_strval);
+ if (UNEXPECTED((func = zend_hash_find(EG(function_table), lcname)) == NULL)) {
+ zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(function_name));
}
- efree(lcname);
+ STR_FREE(lcname);
- call->object = NULL;
+ call->fbc = Z_FUNC_P(func);
+ ZVAL_UNDEF(&call->object);
call->called_scope = NULL;
call->num_additional_args = 0;
call->is_ctor_call = 0;
@@ -1481,8 +1472,8 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CONST_HANDLER(ZEND_OPCODE
EXPECTED(Z_TYPE_P(function_name) == IS_OBJECT) &&
Z_OBJ_HANDLER_P(function_name, get_closure) &&
Z_OBJ_HANDLER_P(function_name, get_closure)(function_name, &call->called_scope, &call->fbc, &call->object TSRMLS_CC) == SUCCESS) {
- if (call->object) {
- Z_ADDREF_P(call->object);
+ if (Z_REFCOUNTED(call->object)) {
+ Z_ADDREF(call->object);
}
if (IS_CONST == IS_VAR && 0 && Z_REFCOUNT_P(function_name) == 1 &&
call->fbc->common.fn_flags & ZEND_ACC_CLOSURE) {
@@ -1501,67 +1492,60 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CONST_HANDLER(ZEND_OPCODE
} else if (IS_CONST != IS_CONST &&
EXPECTED(Z_TYPE_P(function_name) == IS_ARRAY) &&
zend_hash_num_elements(Z_ARRVAL_P(function_name)) == 2) {
- zend_class_entry *ce;
- zval **method = NULL;
- zval **obj = NULL;
+ zval *obj;
+ zval *method;
- zend_hash_index_find(Z_ARRVAL_P(function_name), 0, (void **) &obj);
- zend_hash_index_find(Z_ARRVAL_P(function_name), 1, (void **) &method);
+ obj = zend_hash_index_find(Z_ARRVAL_P(function_name), 0);
+ method = zend_hash_index_find(Z_ARRVAL_P(function_name), 1);
if (!obj || !method) {
zend_error_noreturn(E_ERROR, "Array callback has to contain indices 0 and 1");
}
- if (Z_TYPE_PP(obj) != IS_STRING && Z_TYPE_PP(obj) != IS_OBJECT) {
+ if (Z_TYPE_P(obj) != IS_STRING && Z_TYPE_P(obj) != IS_OBJECT) {
zend_error_noreturn(E_ERROR, "First array member is not a valid class name or object");
}
- if (Z_TYPE_PP(method) != IS_STRING) {
+ if (Z_TYPE_P(method) != IS_STRING) {
zend_error_noreturn(E_ERROR, "Second array member is not a valid method");
}
- if (Z_TYPE_PP(obj) == IS_STRING) {
- ce = zend_fetch_class_by_name(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj), NULL, 0 TSRMLS_CC);
- if (UNEXPECTED(ce == NULL)) {
+ if (Z_TYPE_P(obj) == IS_STRING) {
+ ZVAL_UNDEF(&call->object);
+ call->called_scope = zend_fetch_class_by_name(Z_STR_P(obj), NULL, 0 TSRMLS_CC);
+ if (UNEXPECTED(call->called_scope == NULL)) {
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
- call->called_scope = ce;
- call->object = NULL;
- if (ce->get_static_method) {
- call->fbc = ce->get_static_method(ce, Z_STRVAL_PP(method), Z_STRLEN_PP(method) TSRMLS_CC);
+ if (call->called_scope->get_static_method) {
+ call->fbc = call->called_scope->get_static_method(call->called_scope, Z_STR_P(method) TSRMLS_CC);
} else {
- call->fbc = zend_std_get_static_method(ce, Z_STRVAL_PP(method), Z_STRLEN_PP(method), NULL TSRMLS_CC);
+ call->fbc = zend_std_get_static_method(call->called_scope, Z_STR_P(method), NULL TSRMLS_CC);
+ }
+ if (UNEXPECTED(call->fbc == NULL)) {
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", call->called_scope->name->val, Z_STRVAL_P(method));
}
} else {
- call->object = *obj;
- ce = call->called_scope = Z_OBJCE_PP(obj);
+ call->called_scope = Z_OBJCE_P(obj);
+ ZVAL_COPY_VALUE(&call->object, obj);
- call->fbc = Z_OBJ_HT_P(call->object)->get_method(&call->object, Z_STRVAL_PP(method), Z_STRLEN_PP(method), NULL TSRMLS_CC);
+ call->fbc = Z_OBJ_HT_P(obj)->get_method(obj, Z_STR_P(method), NULL TSRMLS_CC);
if (UNEXPECTED(call->fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(call->object), Z_STRVAL_PP(method));
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(obj), Z_STRVAL_P(method));
}
if ((call->fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) {
- call->object = NULL;
+ ZVAL_UNDEF(&call->object);
} else {
- if (!PZVAL_IS_REF(call->object)) {
- Z_ADDREF_P(call->object); /* For $this pointer */
+ if (!Z_ISREF(call->object)) {
+ Z_ADDREF(call->object); /* For $this pointer */
} else {
- zval *this_ptr;
- ALLOC_ZVAL(this_ptr);
- INIT_PZVAL_COPY(this_ptr, call->object);
- zval_copy_ctor(this_ptr);
- call->object = this_ptr;
+ ZVAL_DUP(&call->object, Z_REFVAL(call->object));
}
}
}
- if (UNEXPECTED(call->fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", ce->name, Z_STRVAL_PP(method));
- }
-
call->num_additional_args = 0;
call->is_ctor_call = 0;
EX(call) = call;
@@ -1583,60 +1567,57 @@ static int ZEND_FASTCALL ZEND_INIT_NS_FCALL_BY_NAME_SPEC_CONST_HANDLER(ZEND_OPC
{
USE_OPLINE
zend_literal *func_name;
+ zval *func;
call_slot *call = EX(call_slots) + opline->result.num;
func_name = opline->op2.literal + 1;
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
call->fbc = CACHED_PTR(opline->op2.literal->cache_slot);
- } else if (zend_hash_quick_find(EG(function_table), Z_STRVAL(func_name->constant), Z_STRLEN(func_name->constant)+1, func_name->hash_value, (void **) &call->fbc)==FAILURE) {
+ } else if ((func = zend_hash_find(EG(function_table), Z_STR(func_name->constant))) == NULL) {
func_name++;
- if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL(func_name->constant), Z_STRLEN(func_name->constant)+1, func_name->hash_value, (void **) &call->fbc)==FAILURE)) {
+ if (UNEXPECTED((func = zend_hash_find(EG(function_table), Z_STR(func_name->constant))) == NULL)) {
SAVE_OPLINE();
zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(opline->op2.zv));
} else {
+ call->fbc = Z_FUNC_P(func);
CACHE_PTR(opline->op2.literal->cache_slot, call->fbc);
}
} else {
+ call->fbc = Z_FUNC_P(func);
CACHE_PTR(opline->op2.literal->cache_slot, call->fbc);
}
- call->object = NULL;
+ ZVAL_UNDEF(&call->object);
call->called_scope = NULL;
call->num_additional_args = 0;
call->is_ctor_call = 0;
-
EX(call) = call;
+
ZEND_VM_NEXT_OPCODE();
}
static int ZEND_FASTCALL ZEND_RECV_INIT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zval *assignment_value;
zend_uint arg_num = opline->op1.num;
- zval **param = zend_vm_stack_get_arg(arg_num TSRMLS_CC);
- zval **var_ptr;
+ zval *param = zend_vm_stack_get_arg(arg_num TSRMLS_CC);
+ zval *var_ptr;
SAVE_OPLINE();
+ var_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->result.var TSRMLS_CC);
+ zval_ptr_dtor(var_ptr);
if (param == NULL) {
- ALLOC_ZVAL(assignment_value);
- *assignment_value = *opline->op2.zv;
- if (IS_CONSTANT_TYPE(Z_TYPE_P(assignment_value))) {
- Z_SET_REFCOUNT_P(assignment_value, 1);
- zval_update_constant(&assignment_value, 0 TSRMLS_CC);
+ ZVAL_COPY_VALUE(var_ptr, opline->op2.zv);
+ if (IS_CONSTANT_TYPE(Z_TYPE_P(var_ptr))) {
+ zval_update_constant(var_ptr, 0 TSRMLS_CC);
} else {
- zval_copy_ctor(assignment_value);
+ zval_copy_ctor(var_ptr);
}
- INIT_PZVAL(assignment_value);
} else {
- assignment_value = *param;
- Z_ADDREF_P(assignment_value);
+ ZVAL_COPY(var_ptr, param);
}
- zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, assignment_value, opline->extended_value TSRMLS_CC);
- var_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->result.var TSRMLS_CC);
- zval_ptr_dtor(var_ptr);
- *var_ptr = assignment_value;
+ zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, var_ptr, opline->extended_value TSRMLS_CC);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -1679,12 +1660,12 @@ static int ZEND_FASTCALL ZEND_GOTO_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
switch (brk_opline->opcode) {
case ZEND_SWITCH_FREE:
if (!(brk_opline->extended_value & EXT_TYPE_FREE_ON_RETURN)) {
- zval_ptr_dtor(&EX_T(brk_opline->op1.var).var.ptr);
+ zval_ptr_dtor(EX_VAR(brk_opline->op1.var));
}
break;
case ZEND_FREE:
if (!(brk_opline->extended_value & EXT_TYPE_FREE_ON_RETURN)) {
- zendi_zval_dtor(EX_T(brk_opline->op1.var).tmp_var);
+ zval_dtor(EX_VAR(brk_opline->op1.var));
}
break;
}
@@ -1694,14 +1675,14 @@ static int ZEND_FASTCALL ZEND_GOTO_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
static int ZEND_FASTCALL ZEND_ADD_INTERFACE_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_class_entry *ce = EX_T(opline->op1.var).class_entry;
+ zend_class_entry *ce = Z_CE_P(EX_VAR(opline->op1.var));
zend_class_entry *iface;
SAVE_OPLINE();
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
iface = CACHED_PTR(opline->op2.literal->cache_slot);
} else {
- iface = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, opline->extended_value TSRMLS_CC);
+ iface = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, opline->extended_value TSRMLS_CC);
if (UNEXPECTED(iface == NULL)) {
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -1727,7 +1708,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_
zend_exception_save(TSRMLS_C);
}
if (IS_TMP_VAR == IS_UNUSED) {
- EX_T(opline->result.var).class_entry = zend_fetch_class(NULL, 0, opline->extended_value TSRMLS_CC);
+ Z_CE_P(EX_VAR(opline->result.var)) = zend_fetch_class(NULL, opline->extended_value TSRMLS_CC);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
} else {
@@ -1736,15 +1717,15 @@ static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_
if (IS_TMP_VAR == IS_CONST) {
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- EX_T(opline->result.var).class_entry = CACHED_PTR(opline->op2.literal->cache_slot);
+ Z_CE_P(EX_VAR(opline->result.var)) = CACHED_PTR(opline->op2.literal->cache_slot);
} else {
- EX_T(opline->result.var).class_entry = zend_fetch_class_by_name(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->op2.literal + 1, opline->extended_value TSRMLS_CC);
- CACHE_PTR(opline->op2.literal->cache_slot, EX_T(opline->result.var).class_entry);
+ Z_CE_P(EX_VAR(opline->result.var)) = zend_fetch_class_by_name(Z_STR_P(class_name), opline->op2.literal + 1, opline->extended_value TSRMLS_CC);
+ CACHE_PTR(opline->op2.literal->cache_slot, Z_CE_P(EX_VAR(opline->result.var)));
}
} else if (Z_TYPE_P(class_name) == IS_OBJECT) {
- EX_T(opline->result.var).class_entry = Z_OBJCE_P(class_name);
+ Z_CE_P(EX_VAR(opline->result.var)) = Z_OBJCE_P(class_name);
} else if (Z_TYPE_P(class_name) == IS_STRING) {
- EX_T(opline->result.var).class_entry = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->extended_value TSRMLS_CC);
+ Z_CE_P(EX_VAR(opline->result.var)) = zend_fetch_class(Z_STR_P(class_name), opline->extended_value TSRMLS_CC);
} else {
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
@@ -1761,21 +1742,22 @@ static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_
static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zval *function_name;
+ zval *function_name, *func;
call_slot *call = EX(call_slots) + opline->result.num;
if (IS_TMP_VAR == IS_CONST) {
function_name = (zval*)(opline->op2.literal+1);
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
call->fbc = CACHED_PTR(opline->op2.literal->cache_slot);
- } else if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(function_name), Z_STRLEN_P(function_name)+1, Z_HASH_P(function_name), (void **) &call->fbc) == FAILURE)) {
+ } else if (UNEXPECTED((func = zend_hash_find(EG(function_table), Z_STR_P(function_name))) == NULL)) {
SAVE_OPLINE();
zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(opline->op2.zv));
} else {
+ call->fbc = Z_FUNC_P(func);
CACHE_PTR(opline->op2.literal->cache_slot, call->fbc);
}
- call->object = NULL;
+ ZVAL_UNDEF(&call->object);
call->called_scope = NULL;
call->num_additional_args = 0;
call->is_ctor_call = 0;
@@ -1784,29 +1766,28 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_TMP_HANDLER(ZEND_OPCODE_H
/*CHECK_EXCEPTION();*/
ZEND_VM_NEXT_OPCODE();
} else {
- char *function_name_strval, *lcname;
- int function_name_strlen;
+ zend_string *lcname;
zend_free_op free_op2;
SAVE_OPLINE();
function_name = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
if (EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) {
- function_name_strval = Z_STRVAL_P(function_name);
- function_name_strlen = Z_STRLEN_P(function_name);
- if (function_name_strval[0] == '\\') {
- function_name_strlen -= 1;
- lcname = zend_str_tolower_dup(function_name_strval + 1, function_name_strlen);
+ if (Z_STRVAL_P(function_name)[0] == '\\') {
+ lcname = STR_ALLOC(Z_STRLEN_P(function_name) - 1, 0);
+ zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name) + 1, Z_STRLEN_P(function_name) - 1);
} else {
- lcname = zend_str_tolower_dup(function_name_strval, function_name_strlen);
+ lcname = STR_ALLOC(Z_STRLEN_P(function_name), 0);
+ zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name), Z_STRLEN_P(function_name));
}
- if (UNEXPECTED(zend_hash_find(EG(function_table), lcname, function_name_strlen+1, (void **) &call->fbc) == FAILURE)) {
- zend_error_noreturn(E_ERROR, "Call to undefined function %s()", function_name_strval);
+ if (UNEXPECTED((func = zend_hash_find(EG(function_table), lcname)) == NULL)) {
+ zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(function_name));
}
- efree(lcname);
+ STR_FREE(lcname);
zval_dtor(free_op2.var);
- call->object = NULL;
+ call->fbc = Z_FUNC_P(func);
+ ZVAL_UNDEF(&call->object);
call->called_scope = NULL;
call->num_additional_args = 0;
call->is_ctor_call = 0;
@@ -1818,8 +1799,8 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_TMP_HANDLER(ZEND_OPCODE_H
EXPECTED(Z_TYPE_P(function_name) == IS_OBJECT) &&
Z_OBJ_HANDLER_P(function_name, get_closure) &&
Z_OBJ_HANDLER_P(function_name, get_closure)(function_name, &call->called_scope, &call->fbc, &call->object TSRMLS_CC) == SUCCESS) {
- if (call->object) {
- Z_ADDREF_P(call->object);
+ if (Z_REFCOUNTED(call->object)) {
+ Z_ADDREF(call->object);
}
if (IS_TMP_VAR == IS_VAR && 1 && Z_REFCOUNT_P(function_name) == 1 &&
call->fbc->common.fn_flags & ZEND_ACC_CLOSURE) {
@@ -1838,67 +1819,60 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_TMP_HANDLER(ZEND_OPCODE_H
} else if (IS_TMP_VAR != IS_CONST &&
EXPECTED(Z_TYPE_P(function_name) == IS_ARRAY) &&
zend_hash_num_elements(Z_ARRVAL_P(function_name)) == 2) {
- zend_class_entry *ce;
- zval **method = NULL;
- zval **obj = NULL;
+ zval *obj;
+ zval *method;
- zend_hash_index_find(Z_ARRVAL_P(function_name), 0, (void **) &obj);
- zend_hash_index_find(Z_ARRVAL_P(function_name), 1, (void **) &method);
+ obj = zend_hash_index_find(Z_ARRVAL_P(function_name), 0);
+ method = zend_hash_index_find(Z_ARRVAL_P(function_name), 1);
if (!obj || !method) {
zend_error_noreturn(E_ERROR, "Array callback has to contain indices 0 and 1");
}
- if (Z_TYPE_PP(obj) != IS_STRING && Z_TYPE_PP(obj) != IS_OBJECT) {
+ if (Z_TYPE_P(obj) != IS_STRING && Z_TYPE_P(obj) != IS_OBJECT) {
zend_error_noreturn(E_ERROR, "First array member is not a valid class name or object");
}
- if (Z_TYPE_PP(method) != IS_STRING) {
+ if (Z_TYPE_P(method) != IS_STRING) {
zend_error_noreturn(E_ERROR, "Second array member is not a valid method");
}
- if (Z_TYPE_PP(obj) == IS_STRING) {
- ce = zend_fetch_class_by_name(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj), NULL, 0 TSRMLS_CC);
- if (UNEXPECTED(ce == NULL)) {
+ if (Z_TYPE_P(obj) == IS_STRING) {
+ ZVAL_UNDEF(&call->object);
+ call->called_scope = zend_fetch_class_by_name(Z_STR_P(obj), NULL, 0 TSRMLS_CC);
+ if (UNEXPECTED(call->called_scope == NULL)) {
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
- call->called_scope = ce;
- call->object = NULL;
- if (ce->get_static_method) {
- call->fbc = ce->get_static_method(ce, Z_STRVAL_PP(method), Z_STRLEN_PP(method) TSRMLS_CC);
+ if (call->called_scope->get_static_method) {
+ call->fbc = call->called_scope->get_static_method(call->called_scope, Z_STR_P(method) TSRMLS_CC);
} else {
- call->fbc = zend_std_get_static_method(ce, Z_STRVAL_PP(method), Z_STRLEN_PP(method), NULL TSRMLS_CC);
+ call->fbc = zend_std_get_static_method(call->called_scope, Z_STR_P(method), NULL TSRMLS_CC);
+ }
+ if (UNEXPECTED(call->fbc == NULL)) {
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", call->called_scope->name->val, Z_STRVAL_P(method));
}
} else {
- call->object = *obj;
- ce = call->called_scope = Z_OBJCE_PP(obj);
+ call->called_scope = Z_OBJCE_P(obj);
+ ZVAL_COPY_VALUE(&call->object, obj);
- call->fbc = Z_OBJ_HT_P(call->object)->get_method(&call->object, Z_STRVAL_PP(method), Z_STRLEN_PP(method), NULL TSRMLS_CC);
+ call->fbc = Z_OBJ_HT_P(obj)->get_method(obj, Z_STR_P(method), NULL TSRMLS_CC);
if (UNEXPECTED(call->fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(call->object), Z_STRVAL_PP(method));
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(obj), Z_STRVAL_P(method));
}
if ((call->fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) {
- call->object = NULL;
+ ZVAL_UNDEF(&call->object);
} else {
- if (!PZVAL_IS_REF(call->object)) {
- Z_ADDREF_P(call->object); /* For $this pointer */
+ if (!Z_ISREF(call->object)) {
+ Z_ADDREF(call->object); /* For $this pointer */
} else {
- zval *this_ptr;
- ALLOC_ZVAL(this_ptr);
- INIT_PZVAL_COPY(this_ptr, call->object);
- zval_copy_ctor(this_ptr);
- call->object = this_ptr;
+ ZVAL_DUP(&call->object, Z_REFVAL(call->object));
}
}
}
- if (UNEXPECTED(call->fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", ce->name, Z_STRVAL_PP(method));
- }
-
call->num_additional_args = 0;
call->is_ctor_call = 0;
EX(call) = call;
@@ -1926,7 +1900,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_
zend_exception_save(TSRMLS_C);
}
if (IS_VAR == IS_UNUSED) {
- EX_T(opline->result.var).class_entry = zend_fetch_class(NULL, 0, opline->extended_value TSRMLS_CC);
+ Z_CE_P(EX_VAR(opline->result.var)) = zend_fetch_class(NULL, opline->extended_value TSRMLS_CC);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
} else {
@@ -1935,15 +1909,15 @@ static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_
if (IS_VAR == IS_CONST) {
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- EX_T(opline->result.var).class_entry = CACHED_PTR(opline->op2.literal->cache_slot);
+ Z_CE_P(EX_VAR(opline->result.var)) = CACHED_PTR(opline->op2.literal->cache_slot);
} else {
- EX_T(opline->result.var).class_entry = zend_fetch_class_by_name(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->op2.literal + 1, opline->extended_value TSRMLS_CC);
- CACHE_PTR(opline->op2.literal->cache_slot, EX_T(opline->result.var).class_entry);
+ Z_CE_P(EX_VAR(opline->result.var)) = zend_fetch_class_by_name(Z_STR_P(class_name), opline->op2.literal + 1, opline->extended_value TSRMLS_CC);
+ CACHE_PTR(opline->op2.literal->cache_slot, Z_CE_P(EX_VAR(opline->result.var)));
}
} else if (Z_TYPE_P(class_name) == IS_OBJECT) {
- EX_T(opline->result.var).class_entry = Z_OBJCE_P(class_name);
+ Z_CE_P(EX_VAR(opline->result.var)) = Z_OBJCE_P(class_name);
} else if (Z_TYPE_P(class_name) == IS_STRING) {
- EX_T(opline->result.var).class_entry = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->extended_value TSRMLS_CC);
+ Z_CE_P(EX_VAR(opline->result.var)) = zend_fetch_class(Z_STR_P(class_name), opline->extended_value TSRMLS_CC);
} else {
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
@@ -1951,7 +1925,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_
zend_error_noreturn(E_ERROR, "Class name must be a valid object or a string");
}
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -1960,21 +1934,22 @@ static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_
static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zval *function_name;
+ zval *function_name, *func;
call_slot *call = EX(call_slots) + opline->result.num;
if (IS_VAR == IS_CONST) {
function_name = (zval*)(opline->op2.literal+1);
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
call->fbc = CACHED_PTR(opline->op2.literal->cache_slot);
- } else if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(function_name), Z_STRLEN_P(function_name)+1, Z_HASH_P(function_name), (void **) &call->fbc) == FAILURE)) {
+ } else if (UNEXPECTED((func = zend_hash_find(EG(function_table), Z_STR_P(function_name))) == NULL)) {
SAVE_OPLINE();
zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(opline->op2.zv));
} else {
+ call->fbc = Z_FUNC_P(func);
CACHE_PTR(opline->op2.literal->cache_slot, call->fbc);
}
- call->object = NULL;
+ ZVAL_UNDEF(&call->object);
call->called_scope = NULL;
call->num_additional_args = 0;
call->is_ctor_call = 0;
@@ -1983,29 +1958,28 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_VAR_HANDLER(ZEND_OPCODE_H
/*CHECK_EXCEPTION();*/
ZEND_VM_NEXT_OPCODE();
} else {
- char *function_name_strval, *lcname;
- int function_name_strlen;
+ zend_string *lcname;
zend_free_op free_op2;
SAVE_OPLINE();
function_name = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
if (EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) {
- function_name_strval = Z_STRVAL_P(function_name);
- function_name_strlen = Z_STRLEN_P(function_name);
- if (function_name_strval[0] == '\\') {
- function_name_strlen -= 1;
- lcname = zend_str_tolower_dup(function_name_strval + 1, function_name_strlen);
+ if (Z_STRVAL_P(function_name)[0] == '\\') {
+ lcname = STR_ALLOC(Z_STRLEN_P(function_name) - 1, 0);
+ zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name) + 1, Z_STRLEN_P(function_name) - 1);
} else {
- lcname = zend_str_tolower_dup(function_name_strval, function_name_strlen);
+ lcname = STR_ALLOC(Z_STRLEN_P(function_name), 0);
+ zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name), Z_STRLEN_P(function_name));
}
- if (UNEXPECTED(zend_hash_find(EG(function_table), lcname, function_name_strlen+1, (void **) &call->fbc) == FAILURE)) {
- zend_error_noreturn(E_ERROR, "Call to undefined function %s()", function_name_strval);
+ if (UNEXPECTED((func = zend_hash_find(EG(function_table), lcname)) == NULL)) {
+ zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(function_name));
}
- efree(lcname);
- zval_ptr_dtor_nogc(&free_op2.var);
+ STR_FREE(lcname);
+ zval_ptr_dtor_nogc(free_op2.var);
- call->object = NULL;
+ call->fbc = Z_FUNC_P(func);
+ ZVAL_UNDEF(&call->object);
call->called_scope = NULL;
call->num_additional_args = 0;
call->is_ctor_call = 0;
@@ -2017,15 +1991,15 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_VAR_HANDLER(ZEND_OPCODE_H
EXPECTED(Z_TYPE_P(function_name) == IS_OBJECT) &&
Z_OBJ_HANDLER_P(function_name, get_closure) &&
Z_OBJ_HANDLER_P(function_name, get_closure)(function_name, &call->called_scope, &call->fbc, &call->object TSRMLS_CC) == SUCCESS) {
- if (call->object) {
- Z_ADDREF_P(call->object);
+ if (Z_REFCOUNTED(call->object)) {
+ Z_ADDREF(call->object);
}
if (IS_VAR == IS_VAR && (free_op2.var != NULL) && Z_REFCOUNT_P(function_name) == 1 &&
call->fbc->common.fn_flags & ZEND_ACC_CLOSURE) {
/* Delay closure destruction until its invocation */
call->fbc->common.prototype = (zend_function*)function_name;
} else {
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
}
call->num_additional_args = 0;
@@ -2037,72 +2011,65 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_VAR_HANDLER(ZEND_OPCODE_H
} else if (IS_VAR != IS_CONST &&
EXPECTED(Z_TYPE_P(function_name) == IS_ARRAY) &&
zend_hash_num_elements(Z_ARRVAL_P(function_name)) == 2) {
- zend_class_entry *ce;
- zval **method = NULL;
- zval **obj = NULL;
+ zval *obj;
+ zval *method;
- zend_hash_index_find(Z_ARRVAL_P(function_name), 0, (void **) &obj);
- zend_hash_index_find(Z_ARRVAL_P(function_name), 1, (void **) &method);
+ obj = zend_hash_index_find(Z_ARRVAL_P(function_name), 0);
+ method = zend_hash_index_find(Z_ARRVAL_P(function_name), 1);
if (!obj || !method) {
zend_error_noreturn(E_ERROR, "Array callback has to contain indices 0 and 1");
}
- if (Z_TYPE_PP(obj) != IS_STRING && Z_TYPE_PP(obj) != IS_OBJECT) {
+ if (Z_TYPE_P(obj) != IS_STRING && Z_TYPE_P(obj) != IS_OBJECT) {
zend_error_noreturn(E_ERROR, "First array member is not a valid class name or object");
}
- if (Z_TYPE_PP(method) != IS_STRING) {
+ if (Z_TYPE_P(method) != IS_STRING) {
zend_error_noreturn(E_ERROR, "Second array member is not a valid method");
}
- if (Z_TYPE_PP(obj) == IS_STRING) {
- ce = zend_fetch_class_by_name(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj), NULL, 0 TSRMLS_CC);
- if (UNEXPECTED(ce == NULL)) {
+ if (Z_TYPE_P(obj) == IS_STRING) {
+ ZVAL_UNDEF(&call->object);
+ call->called_scope = zend_fetch_class_by_name(Z_STR_P(obj), NULL, 0 TSRMLS_CC);
+ if (UNEXPECTED(call->called_scope == NULL)) {
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
- call->called_scope = ce;
- call->object = NULL;
- if (ce->get_static_method) {
- call->fbc = ce->get_static_method(ce, Z_STRVAL_PP(method), Z_STRLEN_PP(method) TSRMLS_CC);
+ if (call->called_scope->get_static_method) {
+ call->fbc = call->called_scope->get_static_method(call->called_scope, Z_STR_P(method) TSRMLS_CC);
} else {
- call->fbc = zend_std_get_static_method(ce, Z_STRVAL_PP(method), Z_STRLEN_PP(method), NULL TSRMLS_CC);
+ call->fbc = zend_std_get_static_method(call->called_scope, Z_STR_P(method), NULL TSRMLS_CC);
+ }
+ if (UNEXPECTED(call->fbc == NULL)) {
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", call->called_scope->name->val, Z_STRVAL_P(method));
}
} else {
- call->object = *obj;
- ce = call->called_scope = Z_OBJCE_PP(obj);
+ call->called_scope = Z_OBJCE_P(obj);
+ ZVAL_COPY_VALUE(&call->object, obj);
- call->fbc = Z_OBJ_HT_P(call->object)->get_method(&call->object, Z_STRVAL_PP(method), Z_STRLEN_PP(method), NULL TSRMLS_CC);
+ call->fbc = Z_OBJ_HT_P(obj)->get_method(obj, Z_STR_P(method), NULL TSRMLS_CC);
if (UNEXPECTED(call->fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(call->object), Z_STRVAL_PP(method));
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(obj), Z_STRVAL_P(method));
}
if ((call->fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) {
- call->object = NULL;
+ ZVAL_UNDEF(&call->object);
} else {
- if (!PZVAL_IS_REF(call->object)) {
- Z_ADDREF_P(call->object); /* For $this pointer */
+ if (!Z_ISREF(call->object)) {
+ Z_ADDREF(call->object); /* For $this pointer */
} else {
- zval *this_ptr;
- ALLOC_ZVAL(this_ptr);
- INIT_PZVAL_COPY(this_ptr, call->object);
- zval_copy_ctor(this_ptr);
- call->object = this_ptr;
+ ZVAL_DUP(&call->object, Z_REFVAL(call->object));
}
}
}
- if (UNEXPECTED(call->fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", ce->name, Z_STRVAL_PP(method));
- }
-
call->num_additional_args = 0;
call->is_ctor_call = 0;
EX(call) = call;
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
} else {
@@ -2125,7 +2092,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDL
zend_exception_save(TSRMLS_C);
}
if (IS_UNUSED == IS_UNUSED) {
- EX_T(opline->result.var).class_entry = zend_fetch_class(NULL, 0, opline->extended_value TSRMLS_CC);
+ Z_CE_P(EX_VAR(opline->result.var)) = zend_fetch_class(NULL, opline->extended_value TSRMLS_CC);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
} else {
@@ -2134,15 +2101,15 @@ static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDL
if (IS_UNUSED == IS_CONST) {
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- EX_T(opline->result.var).class_entry = CACHED_PTR(opline->op2.literal->cache_slot);
+ Z_CE_P(EX_VAR(opline->result.var)) = CACHED_PTR(opline->op2.literal->cache_slot);
} else {
- EX_T(opline->result.var).class_entry = zend_fetch_class_by_name(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->op2.literal + 1, opline->extended_value TSRMLS_CC);
- CACHE_PTR(opline->op2.literal->cache_slot, EX_T(opline->result.var).class_entry);
+ Z_CE_P(EX_VAR(opline->result.var)) = zend_fetch_class_by_name(Z_STR_P(class_name), opline->op2.literal + 1, opline->extended_value TSRMLS_CC);
+ CACHE_PTR(opline->op2.literal->cache_slot, Z_CE_P(EX_VAR(opline->result.var)));
}
} else if (Z_TYPE_P(class_name) == IS_OBJECT) {
- EX_T(opline->result.var).class_entry = Z_OBJCE_P(class_name);
+ Z_CE_P(EX_VAR(opline->result.var)) = Z_OBJCE_P(class_name);
} else if (Z_TYPE_P(class_name) == IS_STRING) {
- EX_T(opline->result.var).class_entry = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->extended_value TSRMLS_CC);
+ Z_CE_P(EX_VAR(opline->result.var)) = zend_fetch_class(Z_STR_P(class_name), opline->extended_value TSRMLS_CC);
} else {
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
@@ -2164,7 +2131,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_A
zend_exception_save(TSRMLS_C);
}
if (IS_CV == IS_UNUSED) {
- EX_T(opline->result.var).class_entry = zend_fetch_class(NULL, 0, opline->extended_value TSRMLS_CC);
+ Z_CE_P(EX_VAR(opline->result.var)) = zend_fetch_class(NULL, opline->extended_value TSRMLS_CC);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
} else {
@@ -2173,15 +2140,15 @@ static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_A
if (IS_CV == IS_CONST) {
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
- EX_T(opline->result.var).class_entry = CACHED_PTR(opline->op2.literal->cache_slot);
+ Z_CE_P(EX_VAR(opline->result.var)) = CACHED_PTR(opline->op2.literal->cache_slot);
} else {
- EX_T(opline->result.var).class_entry = zend_fetch_class_by_name(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->op2.literal + 1, opline->extended_value TSRMLS_CC);
- CACHE_PTR(opline->op2.literal->cache_slot, EX_T(opline->result.var).class_entry);
+ Z_CE_P(EX_VAR(opline->result.var)) = zend_fetch_class_by_name(Z_STR_P(class_name), opline->op2.literal + 1, opline->extended_value TSRMLS_CC);
+ CACHE_PTR(opline->op2.literal->cache_slot, Z_CE_P(EX_VAR(opline->result.var)));
}
} else if (Z_TYPE_P(class_name) == IS_OBJECT) {
- EX_T(opline->result.var).class_entry = Z_OBJCE_P(class_name);
+ Z_CE_P(EX_VAR(opline->result.var)) = Z_OBJCE_P(class_name);
} else if (Z_TYPE_P(class_name) == IS_STRING) {
- EX_T(opline->result.var).class_entry = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->extended_value TSRMLS_CC);
+ Z_CE_P(EX_VAR(opline->result.var)) = zend_fetch_class(Z_STR_P(class_name), opline->extended_value TSRMLS_CC);
} else {
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
@@ -2197,21 +2164,22 @@ static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_A
static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zval *function_name;
+ zval *function_name, *func;
call_slot *call = EX(call_slots) + opline->result.num;
if (IS_CV == IS_CONST) {
function_name = (zval*)(opline->op2.literal+1);
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
call->fbc = CACHED_PTR(opline->op2.literal->cache_slot);
- } else if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(function_name), Z_STRLEN_P(function_name)+1, Z_HASH_P(function_name), (void **) &call->fbc) == FAILURE)) {
+ } else if (UNEXPECTED((func = zend_hash_find(EG(function_table), Z_STR_P(function_name))) == NULL)) {
SAVE_OPLINE();
zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(opline->op2.zv));
} else {
+ call->fbc = Z_FUNC_P(func);
CACHE_PTR(opline->op2.literal->cache_slot, call->fbc);
}
- call->object = NULL;
+ ZVAL_UNDEF(&call->object);
call->called_scope = NULL;
call->num_additional_args = 0;
call->is_ctor_call = 0;
@@ -2220,28 +2188,27 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CV_HANDLER(ZEND_OPCODE_HA
/*CHECK_EXCEPTION();*/
ZEND_VM_NEXT_OPCODE();
} else {
- char *function_name_strval, *lcname;
- int function_name_strlen;
+ zend_string *lcname;
SAVE_OPLINE();
function_name = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
if (EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) {
- function_name_strval = Z_STRVAL_P(function_name);
- function_name_strlen = Z_STRLEN_P(function_name);
- if (function_name_strval[0] == '\\') {
- function_name_strlen -= 1;
- lcname = zend_str_tolower_dup(function_name_strval + 1, function_name_strlen);
+ if (Z_STRVAL_P(function_name)[0] == '\\') {
+ lcname = STR_ALLOC(Z_STRLEN_P(function_name) - 1, 0);
+ zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name) + 1, Z_STRLEN_P(function_name) - 1);
} else {
- lcname = zend_str_tolower_dup(function_name_strval, function_name_strlen);
+ lcname = STR_ALLOC(Z_STRLEN_P(function_name), 0);
+ zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name), Z_STRLEN_P(function_name));
}
- if (UNEXPECTED(zend_hash_find(EG(function_table), lcname, function_name_strlen+1, (void **) &call->fbc) == FAILURE)) {
- zend_error_noreturn(E_ERROR, "Call to undefined function %s()", function_name_strval);
+ if (UNEXPECTED((func = zend_hash_find(EG(function_table), lcname)) == NULL)) {
+ zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(function_name));
}
- efree(lcname);
+ STR_FREE(lcname);
- call->object = NULL;
+ call->fbc = Z_FUNC_P(func);
+ ZVAL_UNDEF(&call->object);
call->called_scope = NULL;
call->num_additional_args = 0;
call->is_ctor_call = 0;
@@ -2253,8 +2220,8 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CV_HANDLER(ZEND_OPCODE_HA
EXPECTED(Z_TYPE_P(function_name) == IS_OBJECT) &&
Z_OBJ_HANDLER_P(function_name, get_closure) &&
Z_OBJ_HANDLER_P(function_name, get_closure)(function_name, &call->called_scope, &call->fbc, &call->object TSRMLS_CC) == SUCCESS) {
- if (call->object) {
- Z_ADDREF_P(call->object);
+ if (Z_REFCOUNTED(call->object)) {
+ Z_ADDREF(call->object);
}
if (IS_CV == IS_VAR && 0 && Z_REFCOUNT_P(function_name) == 1 &&
call->fbc->common.fn_flags & ZEND_ACC_CLOSURE) {
@@ -2273,67 +2240,60 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CV_HANDLER(ZEND_OPCODE_HA
} else if (IS_CV != IS_CONST &&
EXPECTED(Z_TYPE_P(function_name) == IS_ARRAY) &&
zend_hash_num_elements(Z_ARRVAL_P(function_name)) == 2) {
- zend_class_entry *ce;
- zval **method = NULL;
- zval **obj = NULL;
+ zval *obj;
+ zval *method;
- zend_hash_index_find(Z_ARRVAL_P(function_name), 0, (void **) &obj);
- zend_hash_index_find(Z_ARRVAL_P(function_name), 1, (void **) &method);
+ obj = zend_hash_index_find(Z_ARRVAL_P(function_name), 0);
+ method = zend_hash_index_find(Z_ARRVAL_P(function_name), 1);
if (!obj || !method) {
zend_error_noreturn(E_ERROR, "Array callback has to contain indices 0 and 1");
}
- if (Z_TYPE_PP(obj) != IS_STRING && Z_TYPE_PP(obj) != IS_OBJECT) {
+ if (Z_TYPE_P(obj) != IS_STRING && Z_TYPE_P(obj) != IS_OBJECT) {
zend_error_noreturn(E_ERROR, "First array member is not a valid class name or object");
}
- if (Z_TYPE_PP(method) != IS_STRING) {
+ if (Z_TYPE_P(method) != IS_STRING) {
zend_error_noreturn(E_ERROR, "Second array member is not a valid method");
}
- if (Z_TYPE_PP(obj) == IS_STRING) {
- ce = zend_fetch_class_by_name(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj), NULL, 0 TSRMLS_CC);
- if (UNEXPECTED(ce == NULL)) {
+ if (Z_TYPE_P(obj) == IS_STRING) {
+ ZVAL_UNDEF(&call->object);
+ call->called_scope = zend_fetch_class_by_name(Z_STR_P(obj), NULL, 0 TSRMLS_CC);
+ if (UNEXPECTED(call->called_scope == NULL)) {
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
- call->called_scope = ce;
- call->object = NULL;
- if (ce->get_static_method) {
- call->fbc = ce->get_static_method(ce, Z_STRVAL_PP(method), Z_STRLEN_PP(method) TSRMLS_CC);
+ if (call->called_scope->get_static_method) {
+ call->fbc = call->called_scope->get_static_method(call->called_scope, Z_STR_P(method) TSRMLS_CC);
} else {
- call->fbc = zend_std_get_static_method(ce, Z_STRVAL_PP(method), Z_STRLEN_PP(method), NULL TSRMLS_CC);
+ call->fbc = zend_std_get_static_method(call->called_scope, Z_STR_P(method), NULL TSRMLS_CC);
+ }
+ if (UNEXPECTED(call->fbc == NULL)) {
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", call->called_scope->name->val, Z_STRVAL_P(method));
}
} else {
- call->object = *obj;
- ce = call->called_scope = Z_OBJCE_PP(obj);
+ call->called_scope = Z_OBJCE_P(obj);
+ ZVAL_COPY_VALUE(&call->object, obj);
- call->fbc = Z_OBJ_HT_P(call->object)->get_method(&call->object, Z_STRVAL_PP(method), Z_STRLEN_PP(method), NULL TSRMLS_CC);
+ call->fbc = Z_OBJ_HT_P(obj)->get_method(obj, Z_STR_P(method), NULL TSRMLS_CC);
if (UNEXPECTED(call->fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(call->object), Z_STRVAL_PP(method));
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(obj), Z_STRVAL_P(method));
}
if ((call->fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) {
- call->object = NULL;
+ ZVAL_UNDEF(&call->object);
} else {
- if (!PZVAL_IS_REF(call->object)) {
- Z_ADDREF_P(call->object); /* For $this pointer */
+ if (!Z_ISREF(call->object)) {
+ Z_ADDREF(call->object); /* For $this pointer */
} else {
- zval *this_ptr;
- ALLOC_ZVAL(this_ptr);
- INIT_PZVAL_COPY(this_ptr, call->object);
- zval_copy_ctor(this_ptr);
- call->object = this_ptr;
+ ZVAL_DUP(&call->object, Z_REFVAL(call->object));
}
}
}
- if (UNEXPECTED(call->fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", ce->name, Z_STRVAL_PP(method));
- }
-
call->num_additional_args = 0;
call->is_ctor_call = 0;
EX(call) = call;
@@ -2357,7 +2317,7 @@ static int ZEND_FASTCALL ZEND_BW_NOT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG
SAVE_OPLINE();
- bitwise_not_function(&EX_T(opline->result.var).tmp_var,
+ bitwise_not_function(EX_VAR(opline->result.var),
opline->op1.zv TSRMLS_CC);
CHECK_EXCEPTION();
@@ -2370,7 +2330,7 @@ static int ZEND_FASTCALL ZEND_BOOL_NOT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_A
SAVE_OPLINE();
- boolean_not_function(&EX_T(opline->result.var).tmp_var,
+ boolean_not_function(EX_VAR(opline->result.var),
opline->op1.zv TSRMLS_CC);
CHECK_EXCEPTION();
@@ -2387,7 +2347,7 @@ static int ZEND_FASTCALL ZEND_ECHO_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
z = opline->op1.zv;
if (IS_CONST == IS_TMP_VAR && Z_TYPE_P(z) == IS_OBJECT) {
- INIT_PZVAL(z);
+//??? INIT_PZVAL(z);
}
zend_print_variable(z);
@@ -2399,7 +2359,7 @@ static int ZEND_FASTCALL ZEND_PRINT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS
{
USE_OPLINE
- ZVAL_LONG(&EX_T(opline->result.var).tmp_var, 1);
+ ZVAL_LONG(EX_VAR(opline->result.var), 1);
return ZEND_ECHO_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
@@ -2516,8 +2476,7 @@ static int ZEND_FASTCALL ZEND_JMPZ_EX_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_AR
HANDLE_EXCEPTION();
}
}
- Z_LVAL(EX_T(opline->result.var).tmp_var) = retval;
- Z_TYPE(EX_T(opline->result.var).tmp_var) = IS_BOOL;
+ ZVAL_BOOL(EX_VAR(opline->result.var), retval);
if (!retval) {
#if DEBUG_ZEND>=2
printf("Conditional jmp to %d\n", opline->op2.opline_num);
@@ -2547,8 +2506,7 @@ static int ZEND_FASTCALL ZEND_JMPNZ_EX_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_A
HANDLE_EXCEPTION();
}
}
- Z_LVAL(EX_T(opline->result.var).tmp_var) = retval;
- Z_TYPE(EX_T(opline->result.var).tmp_var) = IS_BOOL;
+ ZVAL_BOOL(EX_VAR(opline->result.var), retval);
if (retval) {
#if DEBUG_ZEND>=2
printf("Conditional jmp to %d\n", opline->op2.opline_num);
@@ -2564,19 +2522,21 @@ static int ZEND_FASTCALL ZEND_DO_FCALL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_A
USE_OPLINE
zval *fname = opline->op1.zv;
+ zval *func;
call_slot *call = EX(call_slots) + opline->op2.num;
if (CACHED_PTR(opline->op1.literal->cache_slot)) {
EX(function_state).function = CACHED_PTR(opline->op1.literal->cache_slot);
- } else if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(fname), Z_STRLEN_P(fname)+1, Z_HASH_P(fname), (void **) &EX(function_state).function)==FAILURE)) {
+ } else if (UNEXPECTED((func = zend_hash_find(EG(function_table), Z_STR_P(fname))) == NULL)) {
SAVE_OPLINE();
- zend_error_noreturn(E_ERROR, "Call to undefined function %s()", fname->value.str.val);
+ zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(fname));
} else {
+ EX(function_state).function = Z_FUNC_P(func);
CACHE_PTR(opline->op1.literal->cache_slot, EX(function_state).function);
}
call->fbc = EX(function_state).function;
- call->object = NULL;
+ ZVAL_UNDEF(&call->object);
call->called_scope = NULL;
call->num_additional_args = 0;
call->is_ctor_call = 0;
@@ -2594,32 +2554,22 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG
SAVE_OPLINE();
retval_ptr = opline->op1.zv;
- if (!EG(return_value_ptr_ptr)) {
+ if (/*???!EG(return_value_ptr_ptr)*/0) {
} else {
if (IS_CONST == IS_CONST ||
IS_CONST == IS_TMP_VAR ||
- PZVAL_IS_REF(retval_ptr)) {
- zval *ret;
+ Z_ISREF_P(retval_ptr)) {
+ zval ret;
- ALLOC_ZVAL(ret);
- INIT_PZVAL_COPY(ret, retval_ptr);
+ ZVAL_COPY_VALUE(&ret, retval_ptr);
if (IS_CONST != IS_TMP_VAR) {
- zval_copy_ctor(ret);
+ zval_copy_ctor(&ret);
}
- *EG(return_value_ptr_ptr) = ret;
-
- } else if ((IS_CONST == IS_CV || IS_CONST == IS_VAR) &&
- retval_ptr == &EG(uninitialized_zval)) {
- zval *ret;
+//??? *EG(return_value_ptr_ptr) = ret;
- if (IS_CONST == IS_VAR) {
- Z_DELREF_P(retval_ptr);
- }
- ALLOC_INIT_ZVAL(ret);
- *EG(return_value_ptr_ptr) = ret;
} else {
- *EG(return_value_ptr_ptr) = retval_ptr;
+//??? *EG(return_value_ptr_ptr) = retval_ptr;
if (IS_CONST == IS_CV) {
Z_ADDREF_P(retval_ptr);
}
@@ -2632,7 +2582,6 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CONST_HANDLER(ZEND_OPCODE_HAND
{
USE_OPLINE
zval *retval_ptr;
- zval **retval_ptr_ptr;
SAVE_OPLINE();
@@ -2644,33 +2593,32 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CONST_HANDLER(ZEND_OPCODE_HAND
zend_error(E_NOTICE, "Only variable references should be returned by reference");
retval_ptr = opline->op1.zv;
- if (!EG(return_value_ptr_ptr)) {
+ if (/*???!EG(return_value_ptr_ptr)*/0) {
if (IS_CONST == IS_TMP_VAR) {
}
} else if (!0) { /* Not a temp var */
- zval *ret;
+ zval ret;
- ALLOC_ZVAL(ret);
- INIT_PZVAL_COPY(ret, retval_ptr);
- zval_copy_ctor(ret);
- *EG(return_value_ptr_ptr) = ret;
+ ZVAL_DUP(&ret, retval_ptr);
+//??? *EG(return_value_ptr_ptr) = ret;
} else {
- zval *ret;
+ zval ret;
- ALLOC_ZVAL(ret);
- INIT_PZVAL_COPY(ret, retval_ptr);
- *EG(return_value_ptr_ptr) = ret;
+ ZVAL_COPY_VALUE(&ret, retval_ptr);
+//??? *EG(return_value_ptr_ptr) = ret;
}
break;
}
- retval_ptr_ptr = NULL;
+ retval_ptr = opline->op1.zv;
- if (IS_CONST == IS_VAR && UNEXPECTED(retval_ptr_ptr == NULL)) {
+ if (IS_CONST == IS_VAR && UNEXPECTED(Z_TYPE_P(retval_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot return string offsets by reference");
}
+//???
+#if 0
if (IS_CONST == IS_VAR && !Z_ISREF_PP(retval_ptr_ptr)) {
if (opline->extended_value == ZEND_RETURNS_FUNCTION &&
EX_T(opline->op1.var).var.fcall_returned_reference) {
@@ -2680,8 +2628,7 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CONST_HANDLER(ZEND_OPCODE_HAND
zval *ret;
ALLOC_ZVAL(ret);
- INIT_PZVAL_COPY(ret, *retval_ptr_ptr);
- zval_copy_ctor(ret);
+ INIT_DUP(ret, *retval_ptr_ptr);
*EG(return_value_ptr_ptr) = ret;
}
break;
@@ -2694,6 +2641,7 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CONST_HANDLER(ZEND_OPCODE_HAND
*EG(return_value_ptr_ptr) = *retval_ptr_ptr;
}
+#endif
} while (0);
return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
@@ -2703,7 +2651,7 @@ static int ZEND_FASTCALL ZEND_THROW_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS
{
USE_OPLINE
zval *value;
- zval *exception;
+ zval exception;
SAVE_OPLINE();
@@ -2718,13 +2666,12 @@ static int ZEND_FASTCALL ZEND_THROW_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS
zend_exception_save(TSRMLS_C);
/* Not sure if a complete copy is what we want here */
- ALLOC_ZVAL(exception);
- INIT_PZVAL_COPY(exception, value);
+ ZVAL_COPY_VALUE(&exception, value);
if (!0) {
- zval_copy_ctor(exception);
+ zval_copy_ctor(&exception);
}
- zend_throw_exception_object(exception TSRMLS_CC);
+ zend_throw_exception_object(&exception TSRMLS_CC);
zend_exception_restore(TSRMLS_C);
HANDLE_EXCEPTION();
@@ -2743,18 +2690,17 @@ static int ZEND_FASTCALL ZEND_SEND_VAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_A
}
{
- zval *valptr;
+ zval valptr;
zval *value;
value = opline->op1.zv;
- ALLOC_ZVAL(valptr);
- INIT_PZVAL_COPY(valptr, value);
+ ZVAL_COPY_VALUE(&valptr, value);
if (!0) {
- zval_copy_ctor(valptr);
+ zval_copy_ctor(&valptr);
}
- zend_vm_stack_push(valptr TSRMLS_CC);
+ zend_vm_stack_push(&valptr TSRMLS_CC);
}
CHECK_EXCEPTION();
@@ -2765,7 +2711,7 @@ static int ZEND_FASTCALL ZEND_BOOL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zval *retval = &EX_T(opline->result.var).tmp_var;
+ zval *retval = EX_VAR(opline->result.var);
SAVE_OPLINE();
/* PHP 3.0 returned "" for false and 1 for true, here we use 0 and 1 for now */
@@ -2811,29 +2757,22 @@ static int ZEND_FASTCALL ZEND_CLONE_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS
/* Ensure that if we're calling a private function, we're allowed to do so.
*/
if (UNEXPECTED(ce != EG(scope))) {
- zend_error_noreturn(E_ERROR, "Call to private %s::__clone() from context '%s'", ce->name, EG(scope) ? EG(scope)->name : "");
+ zend_error_noreturn(E_ERROR, "Call to private %s::__clone() from context '%s'", ce->name->val, EG(scope) ? EG(scope)->name->val : "");
}
} else if ((clone->common.fn_flags & ZEND_ACC_PROTECTED)) {
/* Ensure that if we're calling a protected function, we're allowed to do so.
*/
if (UNEXPECTED(!zend_check_protected(zend_get_function_root_class(clone), EG(scope)))) {
- zend_error_noreturn(E_ERROR, "Call to protected %s::__clone() from context '%s'", ce->name, EG(scope) ? EG(scope)->name : "");
+ zend_error_noreturn(E_ERROR, "Call to protected %s::__clone() from context '%s'", ce->name->val, EG(scope) ? EG(scope)->name->val : "");
}
}
}
if (EXPECTED(EG(exception) == NULL)) {
- zval *retval;
-
- ALLOC_ZVAL(retval);
- Z_OBJVAL_P(retval) = clone_call(obj TSRMLS_CC);
- Z_TYPE_P(retval) = IS_OBJECT;
- Z_SET_REFCOUNT_P(retval, 1);
- Z_SET_ISREF_P(retval);
+ ZVAL_OBJ(EX_VAR(opline->result.var), clone_call(obj TSRMLS_CC));
+//??? Z_SET_ISREF_P(retval);
if (!RETURN_VALUE_USED(opline) || UNEXPECTED(EG(exception) != NULL)) {
- zval_ptr_dtor(&retval);
- } else {
- EX_T(opline->result.var).var.ptr = retval;
+ zval_ptr_dtor(EX_VAR(opline->result.var));
}
}
@@ -2846,7 +2785,7 @@ static int ZEND_FASTCALL ZEND_CAST_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
USE_OPLINE
zval *expr;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
expr = opline->op1.zv;
@@ -2854,7 +2793,7 @@ static int ZEND_FASTCALL ZEND_CAST_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
if (opline->extended_value != IS_STRING) {
ZVAL_COPY_VALUE(result, expr);
if (!0) {
- zendi_zval_copy_ctor(*result);
+ zval_copy_ctor(result);
}
}
switch (opline->extended_value) {
@@ -2883,7 +2822,7 @@ static int ZEND_FASTCALL ZEND_CAST_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
} else {
ZVAL_COPY_VALUE(result, expr);
if (!0) {
- zendi_zval_copy_ctor(*result);
+ zval_copy_ctor(result);
}
}
break;
@@ -2906,18 +2845,17 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HA
zend_op_array *new_op_array=NULL;
zval *inc_filename;
- zval *tmp_inc_filename = NULL;
+ zval tmp_inc_filename;
zend_bool failure_retval=0;
SAVE_OPLINE();
inc_filename = opline->op1.zv;
+ ZVAL_UNDEF(&tmp_inc_filename);
if (inc_filename->type!=IS_STRING) {
- MAKE_STD_ZVAL(tmp_inc_filename);
- ZVAL_COPY_VALUE(tmp_inc_filename, inc_filename);
- zval_copy_ctor(tmp_inc_filename);
- convert_to_string(tmp_inc_filename);
- inc_filename = tmp_inc_filename;
+ ZVAL_DUP(&tmp_inc_filename, inc_filename);
+ convert_to_string(&tmp_inc_filename);
+ inc_filename = &tmp_inc_filename;
}
if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRLEN_P(inc_filename)) {
@@ -2935,7 +2873,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HA
resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename) TSRMLS_CC);
if (resolved_path) {
- failure_retval = zend_hash_exists(&EG(included_files), resolved_path, strlen(resolved_path)+1);
+//??? failure_retval = zend_hash_exists(&EG(included_files), resolved_path, strlen(resolved_path)+1);
} else {
resolved_path = Z_STRVAL_P(inc_filename);
}
@@ -2948,13 +2886,13 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HA
file_handle.opened_path = estrdup(resolved_path);
}
- if (zend_hash_add_empty_element(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path)+1)==SUCCESS) {
- new_op_array = zend_compile_file(&file_handle, (opline->extended_value==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC);
- zend_destroy_file_handle(&file_handle TSRMLS_CC);
- } else {
- zend_file_handle_dtor(&file_handle TSRMLS_CC);
- failure_retval=1;
- }
+//??? if (zend_hash_add_empty_element(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path)+1)==SUCCESS) {
+//??? new_op_array = zend_compile_file(&file_handle, (opline->extended_value==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC);
+//??? zend_destroy_file_handle(&file_handle TSRMLS_CC);
+//??? } else {
+//??? zend_file_handle_dtor(&file_handle TSRMLS_CC);
+//??? failure_retval=1;
+//??? }
} else {
if (opline->extended_value == ZEND_INCLUDE_ONCE) {
zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC);
@@ -2981,24 +2919,24 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HA
EMPTY_SWITCH_DEFAULT_CASE()
}
}
- if (tmp_inc_filename) {
+ if (Z_TYPE(tmp_inc_filename) != IS_UNDEF) {
zval_ptr_dtor(&tmp_inc_filename);
}
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
} else if (EXPECTED(new_op_array != NULL)) {
- EX(original_return_value) = EG(return_value_ptr_ptr);
+//??? EX(original_return_value) = EG(return_value_ptr_ptr);
EG(active_op_array) = new_op_array;
if (RETURN_VALUE_USED(opline)) {
- EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
- EG(return_value_ptr_ptr) = EX_T(opline->result.var).var.ptr_ptr;
+//??? EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
+//??? EG(return_value_ptr_ptr) = EX_T(opline->result.var).var.ptr_ptr;
} else {
- EG(return_value_ptr_ptr) = NULL;
+//??? EG(return_value_ptr_ptr) = NULL;
}
EX(function_state).function = (zend_function *) new_op_array;
- EX(object) = NULL;
+ ZVAL_UNDEF(&EX(object));
if (!EG(active_symbol_table)) {
zend_rebuild_symbol_table(TSRMLS_C);
@@ -3014,7 +2952,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HA
EG(opline_ptr) = &EX(opline);
EG(active_op_array) = EX(op_array);
- EG(return_value_ptr_ptr) = EX(original_return_value);
+//??? EG(return_value_ptr_ptr) = EX(original_return_value);
destroy_op_array(new_op_array TSRMLS_CC);
efree(new_op_array);
if (UNEXPECTED(EG(exception) != NULL)) {
@@ -3023,12 +2961,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HA
}
} else if (RETURN_VALUE_USED(opline)) {
- zval *retval;
-
- ALLOC_ZVAL(retval);
- ZVAL_BOOL(retval, failure_retval);
- INIT_PZVAL(retval);
- EX_T(opline->result.var).var.ptr = retval;
+ ZVAL_BOOL(EX_VAR(opline->result.var), failure_retval);
}
ZEND_VM_NEXT_OPCODE();
}
@@ -3037,7 +2970,7 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_A
{
USE_OPLINE
- zval *array_ptr, **array_ptr_ptr;
+ zval *array_ptr;
HashTable *fe_ht;
zend_object_iterator *iter = NULL;
zend_class_entry *ce = NULL;
@@ -3047,40 +2980,35 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_A
if ((IS_CONST == IS_CV || IS_CONST == IS_VAR) &&
(opline->extended_value & ZEND_FE_RESET_VARIABLE)) {
- array_ptr_ptr = NULL;
- if (array_ptr_ptr == NULL || array_ptr_ptr == &EG(uninitialized_zval_ptr)) {
- MAKE_STD_ZVAL(array_ptr);
- ZVAL_NULL(array_ptr);
- } else if (Z_TYPE_PP(array_ptr_ptr) == IS_OBJECT) {
- if(Z_OBJ_HT_PP(array_ptr_ptr)->get_class_entry == NULL) {
+ array_ptr = opline->op1.zv;
+ if (Z_TYPE_P(array_ptr) == IS_NULL) {
+ } else if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
+ if(Z_OBJ_HT_P(array_ptr)->get_class_entry == NULL) {
zend_error(E_WARNING, "foreach() cannot iterate over objects without PHP class");
ZEND_VM_JMP(EX(op_array)->opcodes+opline->op2.opline_num);
}
- ce = Z_OBJCE_PP(array_ptr_ptr);
+ ce = Z_OBJCE_P(array_ptr);
if (!ce || ce->get_iterator == NULL) {
- SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr);
- Z_ADDREF_PP(array_ptr_ptr);
+ SEPARATE_ZVAL_IF_NOT_REF(array_ptr);
+ Z_ADDREF_P(array_ptr);
}
- array_ptr = *array_ptr_ptr;
} else {
- if (Z_TYPE_PP(array_ptr_ptr) == IS_ARRAY) {
- SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr);
+ if (Z_TYPE_P(array_ptr) == IS_ARRAY) {
+ SEPARATE_ZVAL_IF_NOT_REF(array_ptr);
if (opline->extended_value & ZEND_FE_FETCH_BYREF) {
- Z_SET_ISREF_PP(array_ptr_ptr);
+ ZVAL_NEW_REF(array_ptr, array_ptr);
}
}
- array_ptr = *array_ptr_ptr;
Z_ADDREF_P(array_ptr);
}
} else {
array_ptr = opline->op1.zv;
if (0) { /* IS_TMP_VAR */
- zval *tmp;
+ zval tmp;
- ALLOC_ZVAL(tmp);
- INIT_PZVAL_COPY(tmp, array_ptr);
- array_ptr = tmp;
+ ZVAL_COPY_VALUE(&tmp, array_ptr);
+ array_ptr = &tmp;
if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
ce = Z_OBJCE_P(array_ptr);
if (ce && ce->get_iterator) {
@@ -3101,15 +3029,13 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_A
(IS_CONST == IS_VAR &&
!Z_ISREF_P(array_ptr) &&
Z_REFCOUNT_P(array_ptr) > 2)) {
- zval *tmp;
+ zval tmp;
if (IS_CONST == IS_VAR) {
Z_DELREF_P(array_ptr);
}
- ALLOC_ZVAL(tmp);
- INIT_PZVAL_COPY(tmp, array_ptr);
- zval_copy_ctor(tmp);
- array_ptr = tmp;
+ ZVAL_DUP(&tmp, array_ptr);
+ array_ptr = &tmp;
} else if (IS_CONST == IS_CV) {
Z_ADDREF_P(array_ptr);
}
@@ -3135,14 +3061,14 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_A
}
}
- EX_T(opline->result.var).fe.ptr = array_ptr;
+ ZVAL_COPY_VALUE(EX_VAR(opline->result.var), array_ptr);
if (iter) {
iter->index = 0;
if (iter->funcs->rewind) {
iter->funcs->rewind(iter TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
- zval_ptr_dtor(&array_ptr);
+ zval_ptr_dtor(array_ptr);
if (IS_CONST == IS_VAR && opline->extended_value & ZEND_FE_RESET_VARIABLE) {
}
@@ -3151,7 +3077,7 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_A
}
is_empty = iter->funcs->valid(iter TSRMLS_CC) != SUCCESS;
if (UNEXPECTED(EG(exception) != NULL)) {
- zval_ptr_dtor(&array_ptr);
+ zval_ptr_dtor(array_ptr);
if (IS_CONST == IS_VAR && opline->extended_value & ZEND_FE_RESET_VARIABLE) {
}
@@ -3161,24 +3087,23 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_A
} else if ((fe_ht = HASH_OF(array_ptr)) != NULL) {
zend_hash_internal_pointer_reset(fe_ht);
if (ce) {
- zend_object *zobj = zend_objects_get_address(array_ptr TSRMLS_CC);
+ zend_object *zobj = Z_OBJ_P(array_ptr);
while (zend_hash_has_more_elements(fe_ht) == SUCCESS) {
- char *str_key;
- uint str_key_len;
+ zend_string *str_key;
ulong int_key;
zend_uchar key_type;
- key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &str_key_len, &int_key, 0, NULL);
+ key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &int_key, 0, NULL);
if (key_type != HASH_KEY_NON_EXISTENT &&
(key_type == HASH_KEY_IS_LONG ||
- zend_check_property_access(zobj, str_key, str_key_len-1 TSRMLS_CC) == SUCCESS)) {
+ zend_check_property_access(zobj, str_key TSRMLS_CC) == SUCCESS)) {
break;
}
zend_hash_move_forward(fe_ht);
}
}
is_empty = zend_hash_has_more_elements(fe_ht) != SUCCESS;
- zend_hash_get_pointer(fe_ht, &EX_T(opline->result.var).fe.fe_pos);
+//??? zend_hash_get_pointer(fe_ht, EX_VAR(opline->result.var));
} else {
zend_error(E_WARNING, "Invalid argument supplied for foreach()");
is_empty = 1;
@@ -3227,9 +3152,9 @@ static int ZEND_FASTCALL ZEND_JMP_SET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_AR
value = opline->op1.zv;
if (i_zend_is_true(value TSRMLS_CC)) {
- ZVAL_COPY_VALUE(&EX_T(opline->result.var).tmp_var, value);
+ ZVAL_COPY_VALUE(EX_VAR(opline->result.var), value);
if (!0) {
- zendi_zval_copy_ctor(EX_T(opline->result.var).tmp_var);
+ zval_copy_ctor(EX_VAR(opline->result.var));
}
#if DEBUG_ZEND>=2
@@ -3246,23 +3171,19 @@ static int ZEND_FASTCALL ZEND_JMP_SET_VAR_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLE
{
USE_OPLINE
- zval *value, *ret;
+ zval *value;
SAVE_OPLINE();
value = opline->op1.zv;
if (i_zend_is_true(value TSRMLS_CC)) {
if (IS_CONST == IS_VAR || IS_CONST == IS_CV) {
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
Z_ADDREF_P(value);
- EX_T(opline->result.var).var.ptr = value;
- EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
} else {
- ALLOC_ZVAL(ret);
- INIT_PZVAL_COPY(ret, value);
- EX_T(opline->result.var).var.ptr = ret;
- EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
+ ZVAL_COPY_VALUE(EX_VAR(opline->result.var), value);
if (!0) {
- zval_copy_ctor(EX_T(opline->result.var).var.ptr);
+ zval_copy_ctor(EX_VAR(opline->result.var));
}
}
@@ -3285,9 +3206,9 @@ static int ZEND_FASTCALL ZEND_QM_ASSIGN_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_
SAVE_OPLINE();
value = opline->op1.zv;
- ZVAL_COPY_VALUE(&EX_T(opline->result.var).tmp_var, value);
+ ZVAL_COPY_VALUE(EX_VAR(opline->result.var), value);
if (!0) {
- zval_copy_ctor(&EX_T(opline->result.var).tmp_var);
+ zval_copy_ctor(EX_VAR(opline->result.var));
}
CHECK_EXCEPTION();
@@ -3298,22 +3219,17 @@ static int ZEND_FASTCALL ZEND_QM_ASSIGN_VAR_SPEC_CONST_HANDLER(ZEND_OPCODE_HAND
{
USE_OPLINE
- zval *value, *ret;
+ zval *value;
SAVE_OPLINE();
value = opline->op1.zv;
if (IS_CONST == IS_VAR || IS_CONST == IS_CV) {
- Z_ADDREF_P(value);
- EX_T(opline->result.var).var.ptr = value;
- EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
} else {
- ALLOC_ZVAL(ret);
- INIT_PZVAL_COPY(ret, value);
- EX_T(opline->result.var).var.ptr = ret;
- EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
+ ZVAL_COPY_VALUE(EX_VAR(opline->result.var), value);
if (!0) {
- zval_copy_ctor(EX_T(opline->result.var).var.ptr);
+ zval_copy_ctor(EX_VAR(opline->result.var));
}
}
@@ -3327,7 +3243,7 @@ static int ZEND_FASTCALL ZEND_ADD_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_
SAVE_OPLINE();
- fast_add_function(&EX_T(opline->result.var).tmp_var,
+ fast_add_function(EX_VAR(opline->result.var),
opline->op1.zv,
opline->op2.zv TSRMLS_CC);
@@ -3342,7 +3258,7 @@ static int ZEND_FASTCALL ZEND_SUB_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_
SAVE_OPLINE();
- fast_sub_function(&EX_T(opline->result.var).tmp_var,
+ fast_sub_function(EX_VAR(opline->result.var),
opline->op1.zv,
opline->op2.zv TSRMLS_CC);
@@ -3357,7 +3273,7 @@ static int ZEND_FASTCALL ZEND_MUL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_
SAVE_OPLINE();
- fast_mul_function(&EX_T(opline->result.var).tmp_var,
+ fast_mul_function(EX_VAR(opline->result.var),
opline->op1.zv,
opline->op2.zv TSRMLS_CC);
@@ -3372,7 +3288,7 @@ static int ZEND_FASTCALL ZEND_DIV_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_
SAVE_OPLINE();
- fast_div_function(&EX_T(opline->result.var).tmp_var,
+ fast_div_function(EX_VAR(opline->result.var),
opline->op1.zv,
opline->op2.zv TSRMLS_CC);
@@ -3387,7 +3303,7 @@ static int ZEND_FASTCALL ZEND_MOD_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_
SAVE_OPLINE();
- fast_mod_function(&EX_T(opline->result.var).tmp_var,
+ fast_mod_function(EX_VAR(opline->result.var),
opline->op1.zv,
opline->op2.zv TSRMLS_CC);
@@ -3402,7 +3318,7 @@ static int ZEND_FASTCALL ZEND_SL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_A
SAVE_OPLINE();
- shift_left_function(&EX_T(opline->result.var).tmp_var,
+ shift_left_function(EX_VAR(opline->result.var),
opline->op1.zv,
opline->op2.zv TSRMLS_CC);
@@ -3417,7 +3333,7 @@ static int ZEND_FASTCALL ZEND_SR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_A
SAVE_OPLINE();
- shift_right_function(&EX_T(opline->result.var).tmp_var,
+ shift_right_function(EX_VAR(opline->result.var),
opline->op1.zv,
opline->op2.zv TSRMLS_CC);
@@ -3432,7 +3348,7 @@ static int ZEND_FASTCALL ZEND_CONCAT_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDL
SAVE_OPLINE();
- concat_function(&EX_T(opline->result.var).tmp_var,
+ concat_function(EX_VAR(opline->result.var),
opline->op1.zv,
opline->op2.zv TSRMLS_CC);
@@ -3447,7 +3363,7 @@ static int ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE
SAVE_OPLINE();
- is_identical_function(&EX_T(opline->result.var).tmp_var,
+ is_identical_function(EX_VAR(opline->result.var),
opline->op1.zv,
opline->op2.zv TSRMLS_CC);
@@ -3460,7 +3376,7 @@ static int ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_CONST_CONST_HANDLER(ZEND_OP
{
USE_OPLINE
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
is_identical_function(result,
@@ -3477,7 +3393,7 @@ static int ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HAN
{
USE_OPLINE
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_equal_function(result,
@@ -3493,7 +3409,7 @@ static int ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE
{
USE_OPLINE
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_not_equal_function(result,
@@ -3509,7 +3425,7 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_H
{
USE_OPLINE
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_is_smaller_function(result,
@@ -3525,7 +3441,7 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_CONST_CONST_HANDLER(ZEND
{
USE_OPLINE
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_is_smaller_or_equal_function(result,
@@ -3543,7 +3459,7 @@ static int ZEND_FASTCALL ZEND_BW_OR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLE
SAVE_OPLINE();
- bitwise_or_function(&EX_T(opline->result.var).tmp_var,
+ bitwise_or_function(EX_VAR(opline->result.var),
opline->op1.zv,
opline->op2.zv TSRMLS_CC);
@@ -3558,7 +3474,7 @@ static int ZEND_FASTCALL ZEND_BW_AND_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDL
SAVE_OPLINE();
- bitwise_and_function(&EX_T(opline->result.var).tmp_var,
+ bitwise_and_function(EX_VAR(opline->result.var),
opline->op1.zv,
opline->op2.zv TSRMLS_CC);
@@ -3573,7 +3489,7 @@ static int ZEND_FASTCALL ZEND_BW_XOR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDL
SAVE_OPLINE();
- bitwise_xor_function(&EX_T(opline->result.var).tmp_var,
+ bitwise_xor_function(EX_VAR(opline->result.var),
opline->op1.zv,
opline->op2.zv TSRMLS_CC);
@@ -3588,7 +3504,7 @@ static int ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HAN
SAVE_OPLINE();
- boolean_xor_function(&EX_T(opline->result.var).tmp_var,
+ boolean_xor_function(EX_VAR(opline->result.var),
opline->op1.zv,
opline->op2.zv TSRMLS_CC);
@@ -3602,19 +3518,17 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_CONST(int type
USE_OPLINE
zend_free_op free_op1;
zval *varname;
- zval **retval;
+ zval *retval;
zval tmp_varname;
HashTable *target_symbol_table;
- ulong hash_value;
SAVE_OPLINE();
varname = opline->op1.zv;
if (IS_CONST != IS_CONST && UNEXPECTED(Z_TYPE_P(varname) != IS_STRING)) {
- ZVAL_COPY_VALUE(&tmp_varname, varname);
- zval_copy_ctor(&tmp_varname);
- Z_SET_REFCOUNT(tmp_varname, 1);
- Z_UNSET_ISREF(tmp_varname);
+ ZVAL_DUP(&tmp_varname, varname);
+//??? Z_SET_REFCOUNT(tmp_varname, 1);
+//??? Z_UNSET_ISREF(tmp_varname);
convert_to_string(&tmp_varname);
varname = &tmp_varname;
}
@@ -3626,7 +3540,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_CONST(int type
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
ce = CACHED_PTR(opline->op2.literal->cache_slot);
} else {
- ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
if (IS_CONST != IS_CONST && varname == &tmp_varname) {
zval_dtor(&tmp_varname);
@@ -3638,9 +3552,9 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_CONST(int type
CACHE_PTR(opline->op2.literal->cache_slot, ce);
}
} else {
- ce = EX_T(opline->op2.var).class_entry;
+ ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0, ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ retval = zend_std_get_static_property(ce, Z_STR_P(varname), 0, ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
} else {
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
@@ -3650,27 +3564,21 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_CONST(int type
ZEND_VM_NEXT_OPCODE();
}
*/
- if (IS_CONST == IS_CONST) {
- hash_value = Z_HASH_P(varname);
- } else {
- hash_value = str_hash(Z_STRVAL_P(varname), Z_STRLEN_P(varname));
- }
-
- if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) {
+ if ((retval = zend_hash_find(target_symbol_table, Z_STR_P(varname))) == NULL) {
switch (type) {
case BP_VAR_R:
case BP_VAR_UNSET:
zend_error(E_NOTICE,"Undefined variable: %s", Z_STRVAL_P(varname));
/* break missing intentionally */
case BP_VAR_IS:
- retval = &EG(uninitialized_zval_ptr);
+ ZVAL_NULL(retval);
break;
case BP_VAR_RW:
zend_error(E_NOTICE,"Undefined variable: %s", Z_STRVAL_P(varname));
/* break missing intentionally */
case BP_VAR_W:
Z_ADDREF_P(&EG(uninitialized_zval));
- zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval);
+ retval = zend_hash_update(target_symbol_table, Z_STR_P(varname), &EG(uninitialized_zval));
break;
EMPTY_SWITCH_DEFAULT_CASE()
}
@@ -3689,7 +3597,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_CONST(int type
break;
case ZEND_FETCH_GLOBAL_LOCK:
if (IS_CONST == IS_VAR && !free_op1.var) {
- PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
+ Z_ADDREF_P(EX_VAR(opline->op1.var));
}
break;
}
@@ -3702,27 +3610,26 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_CONST(int type
if (opline->extended_value & ZEND_FETCH_MAKE_REF) {
SEPARATE_ZVAL_TO_MAKE_IS_REF(retval);
}
- PZVAL_LOCK(*retval);
- switch (type) {
- case BP_VAR_R:
- case BP_VAR_IS:
- EX_T(opline->result.var).var.ptr = *retval;
- break;
- case BP_VAR_UNSET: {
- zend_free_op free_res;
-
- PZVAL_UNLOCK(*retval, &free_res);
- if (retval != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(retval);
- }
- PZVAL_LOCK(*retval);
- FREE_OP_VAR_PTR(free_res);
- }
- /* break missing intentionally */
- default:
- EX_T(opline->result.var).var.ptr_ptr = retval;
- break;
- }
+ ZVAL_COPY(EX_VAR(opline->result.var), retval);
+//??? switch (type) {
+//??? case BP_VAR_R:
+//??? case BP_VAR_IS:
+//??? break;
+//??? case BP_VAR_UNSET: {
+//??? zend_free_op free_res;
+//???
+//??? PZVAL_UNLOCK(*retval, &free_res);
+//??? if (retval != &EG(uninitialized_zval_ptr)) {
+//??? SEPARATE_ZVAL_IF_NOT_REF(retval);
+//??? }
+//??? PZVAL_LOCK(*retval);
+//??? FREE_OP_VAR_PTR(free_res);
+//??? }
+//??? /* break missing intentionally */
+//??? default:
+//??? EX_T(opline->result.var).var.ptr_ptr = retval;
+//??? break;
+//??? }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -3767,7 +3674,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_
SAVE_OPLINE();
container = opline->op1.zv;
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC);
+ zend_fetch_dimension_address_read(EX_VAR(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC);
if (IS_CONST != IS_VAR || !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
@@ -3786,14 +3693,12 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_TMP_VAR_SPEC_CONST_CONST_HANDLER(ZEND_O
container = opline->op1.zv;
if (UNEXPECTED(Z_TYPE_P(container) != IS_ARRAY)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
} else {
- zval *value = *zend_fetch_dimension_address_inner(Z_ARRVAL_P(container), opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC);
+ zval *value = zend_fetch_dimension_address_inner(Z_ARRVAL_P(container), opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC);
- PZVAL_LOCK(value);
- EX_T(opline->result.var).var.ptr = value;
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
}
CHECK_EXCEPTION();
@@ -3814,7 +3719,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CONST_HANDLER(
if (CACHED_PTR(opline->op1.literal->cache_slot)) {
ce = CACHED_PTR(opline->op1.literal->cache_slot);
} else {
- ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
@@ -3825,7 +3730,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CONST_HANDLER(
}
call->called_scope = ce;
} else {
- ce = EX_T(opline->op1.var).class_entry;
+ ce = Z_CE_P(EX_VAR(opline->op1.var));
if (opline->extended_value == ZEND_FETCH_CLASS_PARENT || opline->extended_value == ZEND_FETCH_CLASS_SELF) {
call->called_scope = EG(called_scope);
@@ -3843,44 +3748,33 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CONST_HANDLER(
(call->fbc = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce))) {
/* do nothing */
} else if (IS_CONST != IS_UNUSED) {
- char *function_name_strval = NULL;
- int function_name_strlen = 0;
- if (IS_CONST == IS_CONST) {
- function_name_strval = Z_STRVAL_P(opline->op2.zv);
- function_name_strlen = Z_STRLEN_P(opline->op2.zv);
- } else {
- function_name = opline->op2.zv;
-
+ function_name = opline->op2.zv;
+ if (IS_CONST != IS_CONST) {
if (UNEXPECTED(Z_TYPE_P(function_name) != IS_STRING)) {
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
zend_error_noreturn(E_ERROR, "Function name must be a string");
- } else {
- function_name_strval = Z_STRVAL_P(function_name);
- function_name_strlen = Z_STRLEN_P(function_name);
}
}
- if (function_name_strval) {
- if (ce->get_static_method) {
- call->fbc = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
+ if (ce->get_static_method) {
+ call->fbc = ce->get_static_method(ce, Z_STR_P(function_name) TSRMLS_CC);
+ } else {
+ call->fbc = zend_std_get_static_method(ce, Z_STR_P(function_name), ((IS_CONST == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
+ }
+ if (UNEXPECTED(call->fbc == NULL)) {
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", ce->name->val, Z_STRVAL_P(function_name));
+ }
+ if (IS_CONST == IS_CONST &&
+ EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
+ EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0)) {
+ if (IS_CONST == IS_CONST) {
+ CACHE_PTR(opline->op2.literal->cache_slot, call->fbc);
} else {
- call->fbc = zend_std_get_static_method(ce, function_name_strval, function_name_strlen, ((IS_CONST == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
- }
- if (UNEXPECTED(call->fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", ce->name, function_name_strval);
- }
- if (IS_CONST == IS_CONST &&
- EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
- EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0)) {
- if (IS_CONST == IS_CONST) {
- CACHE_PTR(opline->op2.literal->cache_slot, call->fbc);
- } else {
- CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce, call->fbc);
- }
+ CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce, call->fbc);
}
}
if (IS_CONST != IS_CONST) {
@@ -3890,31 +3784,28 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CONST_HANDLER(
if (UNEXPECTED(ce->constructor == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot call constructor");
}
- if (EG(This) && Z_OBJCE_P(EG(This)) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
- zend_error_noreturn(E_ERROR, "Cannot call private %s::__construct()", ce->name);
+ if (Z_TYPE(EG(This)) != IS_UNDEF && Z_OBJCE(EG(This)) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
+ zend_error_noreturn(E_ERROR, "Cannot call private %s::__construct()", ce->name->val);
}
call->fbc = ce->constructor;
}
if (call->fbc->common.fn_flags & ZEND_ACC_STATIC) {
- call->object = NULL;
+ ZVAL_UNDEF(&call->object);
} else {
- if (EG(This) &&
- Z_OBJ_HT_P(EG(This))->get_class_entry &&
- !instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) {
+ if (Z_TYPE(EG(This)) != IS_UNDEF &&
+ Z_OBJ_HT(EG(This))->get_class_entry &&
+ !instanceof_function(Z_OBJCE(EG(This)), ce TSRMLS_CC)) {
/* We are calling method of the other (incompatible) class,
but passing $this. This is done for compatibility with php-4. */
if (call->fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
- zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name);
+ zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name->val, call->fbc->common.function_name->val);
} else {
/* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */
- zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name);
+ zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", call->fbc->common.scope->name->val, call->fbc->common.function_name->val);
}
}
- if ((call->object = EG(This))) {
- Z_ADDREF_P(call->object);
- call->called_scope = Z_OBJCE_P(call->object);
- }
+ ZVAL_COPY(&call->object, &EG(This));
}
call->num_additional_args = 0;
@@ -3931,7 +3822,7 @@ static int ZEND_FASTCALL ZEND_CASE_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER
SAVE_OPLINE();
- is_equal_function(&EX_T(opline->result.var).tmp_var,
+ is_equal_function(EX_VAR(opline->result.var),
opline->op1.zv,
opline->op2.zv TSRMLS_CC);
@@ -3960,7 +3851,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_CONST_CONST_HANDLER(ZEND_OPCO
}
/* non-qualified constant - allow text substitution */
zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", actual, actual);
- ZVAL_STRINGL(&EX_T(opline->result.var).tmp_var, actual, Z_STRLEN_P(opline->op2.zv)-(actual - Z_STRVAL_P(opline->op2.zv)), 1);
+ ZVAL_STRINGL(EX_VAR(opline->result.var), actual, Z_STRLEN_P(opline->op2.zv)-(actual - Z_STRVAL_P(opline->op2.zv)));
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
} else {
@@ -3969,27 +3860,25 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_CONST_CONST_HANDLER(ZEND_OPCO
} else {
CACHE_PTR(opline->op2.literal->cache_slot, c);
}
- retval = &EX_T(opline->result.var).tmp_var;
- ZVAL_COPY_VALUE(retval, &c->value);
- zval_copy_ctor(retval);
+ retval = EX_VAR(opline->result.var);
+ ZVAL_DUP(retval, &c->value);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
} else {
/* class constant */
zend_class_entry *ce;
- zval **value;
+ zval *value;
if (IS_CONST == IS_CONST) {
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
value = CACHED_PTR(opline->op2.literal->cache_slot);
- ZVAL_COPY_VALUE(&EX_T(opline->result.var).tmp_var, *value);
- zval_copy_ctor(&EX_T(opline->result.var).tmp_var);
+ ZVAL_DUP(EX_VAR(opline->result.var), value);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
} else if (CACHED_PTR(opline->op1.literal->cache_slot)) {
ce = CACHED_PTR(opline->op1.literal->cache_slot);
} else {
- ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
@@ -3999,17 +3888,16 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_CONST_CONST_HANDLER(ZEND_OPCO
CACHE_PTR(opline->op1.literal->cache_slot, ce);
}
} else {
- ce = EX_T(opline->op1.var).class_entry;
+ ce = Z_CE_P(EX_VAR(opline->op1.var));
if ((value = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce)) != NULL) {
- ZVAL_COPY_VALUE(&EX_T(opline->result.var).tmp_var, *value);
- zval_copy_ctor(&EX_T(opline->result.var).tmp_var);
+ ZVAL_DUP(EX_VAR(opline->result.var), value);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
}
- if (EXPECTED(zend_hash_quick_find(&ce->constants_table, Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv)+1, Z_HASH_P(opline->op2.zv), (void **) &value) == SUCCESS)) {
- if (IS_CONSTANT_TYPE(Z_TYPE_PP(value))) {
+ if (EXPECTED((value = zend_hash_find(&ce->constants_table, Z_STR_P(opline->op2.zv))) != NULL)) {
+ if (IS_CONSTANT_TYPE(Z_TYPE_P(value))) {
zend_class_entry *old_scope = EG(scope);
EG(scope) = ce;
@@ -4021,11 +3909,11 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_CONST_CONST_HANDLER(ZEND_OPCO
} else {
CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce, value);
}
- ZVAL_COPY_VALUE(&EX_T(opline->result.var).tmp_var, *value);
- zval_copy_ctor(&EX_T(opline->result.var).tmp_var);
+ ZVAL_DUP(EX_VAR(opline->result.var), value);
} else if (Z_STRLEN_P(opline->op2.zv) == sizeof("class")-1 && memcmp(Z_STRVAL_P(opline->op2.zv), "class", sizeof("class") - 1) == 0) {
/* "class" is assigned as a case-sensitive keyword from zend_do_resolve_class_name */
- ZVAL_STRINGL(&EX_T(opline->result.var).tmp_var, ce->name, ce->name_length, 1);
+ ZVAL_STR(EX_VAR(opline->result.var), ce->name);
+ STR_ADDREF(ce->name);
} else {
zend_error_noreturn(E_ERROR, "Undefined class constant '%s'", Z_STRVAL_P(opline->op2.zv));
}
@@ -4043,29 +3931,24 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CONST_HANDLER(ZEND_O
SAVE_OPLINE();
if ((IS_CONST == IS_VAR || IS_CONST == IS_CV) && opline->extended_value) {
- zval **expr_ptr_ptr = NULL;
-
- if (IS_CONST == IS_VAR && UNEXPECTED(expr_ptr_ptr == NULL)) {
+ expr_ptr = opline->op1.zv;
+ if (IS_CONST == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets");
}
- SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr_ptr);
- expr_ptr = *expr_ptr_ptr;
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr);
Z_ADDREF_P(expr_ptr);
} else {
expr_ptr=opline->op1.zv;
if (0) { /* temporary variable */
- zval *new_expr;
+ zval new_expr;
- ALLOC_ZVAL(new_expr);
- INIT_PZVAL_COPY(new_expr, expr_ptr);
- expr_ptr = new_expr;
- } else if (IS_CONST == IS_CONST || PZVAL_IS_REF(expr_ptr)) {
- zval *new_expr;
+ ZVAL_COPY_VALUE(&new_expr, expr_ptr);
+ expr_ptr = &new_expr;
+ } else if (IS_CONST == IS_CONST || Z_ISREF_P(expr_ptr)) {
+ zval new_expr;
- ALLOC_ZVAL(new_expr);
- INIT_PZVAL_COPY(new_expr, expr_ptr);
- expr_ptr = new_expr;
- zendi_zval_copy_ctor(*expr_ptr);
+ ZVAL_DUP(&new_expr, expr_ptr);
+ expr_ptr = &new_expr;
} else if (IS_CONST == IS_CV) {
Z_ADDREF_P(expr_ptr);
@@ -4085,29 +3968,26 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CONST_HANDLER(ZEND_O
case IS_BOOL:
hval = Z_LVAL_P(offset);
num_index:
- zend_hash_index_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), hval, &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr);
break;
case IS_STRING:
- if (IS_CONST == IS_CONST) {
- hval = Z_HASH_P(offset);
- } else {
+ if (IS_CONST != IS_CONST) {
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index);
- hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset));
}
- zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), Z_STR_P(offset), expr_ptr);
break;
case IS_NULL:
- zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), STR_EMPTY_ALLOC(), expr_ptr);
break;
default:
zend_error(E_WARNING, "Illegal offset type");
- zval_ptr_dtor(&expr_ptr);
+ zval_ptr_dtor(expr_ptr);
/* do nothing */
break;
}
} else {
- zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr);
}
if ((IS_CONST == IS_VAR || IS_CONST == IS_CV) && opline->extended_value) {
@@ -4120,7 +4000,7 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_H
{
USE_OPLINE
- array_init(&EX_T(opline->result.var).tmp_var);
+ array_init(EX_VAR(opline->result.var));
if (IS_CONST == IS_UNUSED) {
ZEND_VM_NEXT_OPCODE();
#if 0 || IS_CONST != IS_UNUSED
@@ -4142,13 +4022,13 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HA
IS_CONST == IS_UNUSED &&
(opline->extended_value & ZEND_QUICK_SET)) {
if (EG(active_symbol_table)) {
- zend_compiled_variable *cv = &CV_DEF_OF(opline->op1.var);
+ zend_string *cv = CV_DEF_OF(opline->op1.var);
- zend_delete_variable(EX(prev_execute_data), EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value TSRMLS_CC);
- EX_CV(opline->op1.var) = NULL;
- } else if (EX_CV(opline->op1.var)) {
- zval_ptr_dtor(EX_CV(opline->op1.var));
- EX_CV(opline->op1.var) = NULL;
+ zend_delete_variable(EX(prev_execute_data), EG(active_symbol_table), cv TSRMLS_CC);
+ ZVAL_UNDEF(EX_VAR_NUM(opline->op1.var));
+ } else if (Z_TYPE_P(EX_VAR_NUM(opline->op1.var)) != IS_UNDEF) {
+ zval_ptr_dtor(EX_VAR_NUM(opline->op1.var));
+ ZVAL_UNDEF(EX_VAR_NUM(opline->op1.var));
}
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -4157,8 +4037,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HA
varname = opline->op1.zv;
if (IS_CONST != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
- ZVAL_COPY_VALUE(&tmp, varname);
- zval_copy_ctor(&tmp);
+ ZVAL_DUP(&tmp, varname);
convert_to_string(&tmp);
varname = &tmp;
} else if (IS_CONST == IS_VAR || IS_CONST == IS_CV) {
@@ -4172,12 +4051,12 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HA
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
ce = CACHED_PTR(opline->op2.literal->cache_slot);
} else {
- ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
if (IS_CONST != IS_CONST && varname == &tmp) {
zval_dtor(&tmp);
} else if (IS_CONST == IS_VAR || IS_CONST == IS_CV) {
- zval_ptr_dtor(&varname);
+ zval_ptr_dtor(varname);
}
HANDLE_EXCEPTION();
@@ -4188,20 +4067,18 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HA
CACHE_PTR(opline->op2.literal->cache_slot, ce);
}
} else {
- ce = EX_T(opline->op2.var).class_entry;
+ ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ zend_std_unset_static_property(ce, Z_STR_P(varname), ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
} else {
- ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1);
-
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
- zend_delete_variable(execute_data, target_symbol_table, varname->value.str.val, varname->value.str.len+1, hash_value TSRMLS_CC);
+ zend_delete_variable(execute_data, target_symbol_table, Z_STR_P(varname) TSRMLS_CC);
}
if (IS_CONST != IS_CONST && varname == &tmp) {
zval_dtor(&tmp);
} else if (IS_CONST == IS_VAR || IS_CONST == IS_CV) {
- zval_ptr_dtor(&varname);
+ zval_ptr_dtor(varname);
}
CHECK_EXCEPTION();
@@ -4211,19 +4088,19 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HA
static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zval **value;
+ zval *value;
zend_bool isset = 1;
SAVE_OPLINE();
if (IS_CONST == IS_CV &&
IS_CONST == IS_UNUSED &&
(opline->extended_value & ZEND_QUICK_SET)) {
- if (EX_CV(opline->op1.var)) {
- value = EX_CV(opline->op1.var);
+ if (Z_TYPE_P(EX_VAR_NUM(opline->op1.var)) != IS_UNDEF) {
+ value = EX_VAR_NUM(opline->op1.var);
} else if (EG(active_symbol_table)) {
- zend_compiled_variable *cv = &CV_DEF_OF(opline->op1.var);
+ zend_string *cv = CV_DEF_OF(opline->op1.var);
- if (zend_hash_quick_find(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, (void **) &value) == FAILURE) {
+ if ((value = zend_hash_find(EG(active_symbol_table), cv)) == NULL) {
isset = 0;
}
} else {
@@ -4235,8 +4112,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_CONST_HANDLER(ZEND_O
zval tmp, *varname = opline->op1.zv;
if (IS_CONST != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
- ZVAL_COPY_VALUE(&tmp, varname);
- zval_copy_ctor(&tmp);
+ ZVAL_DUP(&tmp, varname);
convert_to_string(&tmp);
varname = &tmp;
}
@@ -4248,7 +4124,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_CONST_HANDLER(ZEND_O
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
ce = CACHED_PTR(opline->op2.literal->cache_slot);
} else {
- ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -4256,15 +4132,15 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_CONST_HANDLER(ZEND_O
CACHE_PTR(opline->op2.literal->cache_slot, ce);
}
} else {
- ce = EX_T(opline->op2.var).class_entry;
+ ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1, ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ value = zend_std_get_static_property(ce, Z_STR_P(varname), 1, ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
if (!value) {
isset = 0;
}
} else {
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
- if (zend_hash_find(target_symbol_table, varname->value.str.val, varname->value.str.len+1, (void **) &value) == FAILURE) {
+ if ((value = zend_hash_find(target_symbol_table, Z_STR_P(varname))) == NULL) {
isset = 0;
}
}
@@ -4276,16 +4152,16 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_CONST_HANDLER(ZEND_O
}
if (opline->extended_value & ZEND_ISSET) {
- if (isset && Z_TYPE_PP(value) != IS_NULL) {
- ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, 1);
+ if (isset && Z_TYPE_P(value) != IS_NULL) {
+ ZVAL_BOOL(EX_VAR(opline->result.var), 1);
} else {
- ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, 0);
+ ZVAL_BOOL(EX_VAR(opline->result.var), 0);
}
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (!isset || !i_zend_is_true(*value TSRMLS_CC)) {
- ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, 1);
+ if (!isset || !i_zend_is_true(value TSRMLS_CC)) {
+ ZVAL_BOOL(EX_VAR(opline->result.var), 1);
} else {
- ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, 0);
+ ZVAL_BOOL(EX_VAR(opline->result.var), 0);
}
}
@@ -4306,23 +4182,16 @@ static int ZEND_FASTCALL ZEND_DECLARE_CONST_SPEC_CONST_CONST_HANDLER(ZEND_OPCOD
val = opline->op2.zv;
if (IS_CONSTANT_TYPE(Z_TYPE_P(val))) {
- zval tmp;
- zval *tmp_ptr = &tmp;
-
- ZVAL_COPY_VALUE(&tmp, val);
+ ZVAL_COPY_VALUE(&c.value, val);
if (Z_TYPE_P(val) == IS_CONSTANT_ARRAY) {
- zval_copy_ctor(&tmp);
+ zval_copy_ctor(&c.value);
}
- INIT_PZVAL(&tmp);
- zval_update_constant(&tmp_ptr, NULL TSRMLS_CC);
- c.value = *tmp_ptr;
+ zval_update_constant(&c.value, NULL TSRMLS_CC);
} else {
- INIT_PZVAL_COPY(&c.value, val);
- zval_copy_ctor(&c.value);
+ ZVAL_DUP(&c.value, val);
}
c.flags = CONST_CS; /* non persistent, case sensetive */
- c.name = str_strndup(Z_STRVAL_P(name), Z_STRLEN_P(name));
- c.name_len = Z_STRLEN_P(name)+1;
+ c.name = STR_DUP(Z_STR_P(name), 0);
c.module_number = PHP_USER_CONSTANT;
if (zend_register_constant(&c TSRMLS_CC) == FAILURE) {
@@ -4335,6 +4204,9 @@ static int ZEND_FASTCALL ZEND_DECLARE_CONST_SPEC_CONST_CONST_HANDLER(ZEND_OPCOD
static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
+//???
+return 0;
+#if 0
USE_OPLINE
/* The generator object is stored in return_value_ptr_ptr */
@@ -4377,7 +4249,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLE
generator->value = copy;
} else {
- zval **value_ptr = NULL;
+ zval **value_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W);
if (IS_CONST == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
@@ -4405,7 +4277,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLE
/* Consts, temporary variables and references need copying */
if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR
- || PZVAL_IS_REF(value)
+ || Z_ISREF_P(value)
) {
zval *copy;
@@ -4439,7 +4311,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLE
/* Consts, temporary variables and references need copying */
if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR
- || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0)
+ || (Z_ISREF_P(key) && Z_REFCOUNT_P(key) > 0)
) {
zval *copy;
@@ -4490,6 +4362,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLE
SAVE_OPLINE();
ZEND_VM_RETURN();
+#endif
}
static int ZEND_FASTCALL ZEND_ADD_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -4498,7 +4371,7 @@ static int ZEND_FASTCALL ZEND_ADD_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR
zend_free_op free_op2;
SAVE_OPLINE();
- fast_add_function(&EX_T(opline->result.var).tmp_var,
+ fast_add_function(EX_VAR(opline->result.var),
opline->op1.zv,
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
@@ -4513,7 +4386,7 @@ static int ZEND_FASTCALL ZEND_SUB_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR
zend_free_op free_op2;
SAVE_OPLINE();
- fast_sub_function(&EX_T(opline->result.var).tmp_var,
+ fast_sub_function(EX_VAR(opline->result.var),
opline->op1.zv,
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
@@ -4528,7 +4401,7 @@ static int ZEND_FASTCALL ZEND_MUL_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR
zend_free_op free_op2;
SAVE_OPLINE();
- fast_mul_function(&EX_T(opline->result.var).tmp_var,
+ fast_mul_function(EX_VAR(opline->result.var),
opline->op1.zv,
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
@@ -4543,7 +4416,7 @@ static int ZEND_FASTCALL ZEND_DIV_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR
zend_free_op free_op2;
SAVE_OPLINE();
- fast_div_function(&EX_T(opline->result.var).tmp_var,
+ fast_div_function(EX_VAR(opline->result.var),
opline->op1.zv,
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
@@ -4558,7 +4431,7 @@ static int ZEND_FASTCALL ZEND_MOD_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR
zend_free_op free_op2;
SAVE_OPLINE();
- fast_mod_function(&EX_T(opline->result.var).tmp_var,
+ fast_mod_function(EX_VAR(opline->result.var),
opline->op1.zv,
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
@@ -4573,7 +4446,7 @@ static int ZEND_FASTCALL ZEND_SL_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG
zend_free_op free_op2;
SAVE_OPLINE();
- shift_left_function(&EX_T(opline->result.var).tmp_var,
+ shift_left_function(EX_VAR(opline->result.var),
opline->op1.zv,
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
@@ -4588,7 +4461,7 @@ static int ZEND_FASTCALL ZEND_SR_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG
zend_free_op free_op2;
SAVE_OPLINE();
- shift_right_function(&EX_T(opline->result.var).tmp_var,
+ shift_right_function(EX_VAR(opline->result.var),
opline->op1.zv,
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
@@ -4603,7 +4476,7 @@ static int ZEND_FASTCALL ZEND_CONCAT_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER
zend_free_op free_op2;
SAVE_OPLINE();
- concat_function(&EX_T(opline->result.var).tmp_var,
+ concat_function(EX_VAR(opline->result.var),
opline->op1.zv,
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
@@ -4618,7 +4491,7 @@ static int ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_H
zend_free_op free_op2;
SAVE_OPLINE();
- is_identical_function(&EX_T(opline->result.var).tmp_var,
+ is_identical_function(EX_VAR(opline->result.var),
opline->op1.zv,
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
@@ -4631,7 +4504,7 @@ static int ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_CONST_TMP_HANDLER(ZEND_OPCO
{
USE_OPLINE
zend_free_op free_op2;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
is_identical_function(result,
@@ -4648,7 +4521,7 @@ static int ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDL
{
USE_OPLINE
zend_free_op free_op2;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_equal_function(result,
@@ -4664,7 +4537,7 @@ static int ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_H
{
USE_OPLINE
zend_free_op free_op2;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_not_equal_function(result,
@@ -4680,7 +4553,7 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HAN
{
USE_OPLINE
zend_free_op free_op2;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_is_smaller_function(result,
@@ -4696,7 +4569,7 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_CONST_TMP_HANDLER(ZEND_O
{
USE_OPLINE
zend_free_op free_op2;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_is_smaller_or_equal_function(result,
@@ -4714,7 +4587,7 @@ static int ZEND_FASTCALL ZEND_BW_OR_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_
zend_free_op free_op2;
SAVE_OPLINE();
- bitwise_or_function(&EX_T(opline->result.var).tmp_var,
+ bitwise_or_function(EX_VAR(opline->result.var),
opline->op1.zv,
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
@@ -4729,7 +4602,7 @@ static int ZEND_FASTCALL ZEND_BW_AND_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER
zend_free_op free_op2;
SAVE_OPLINE();
- bitwise_and_function(&EX_T(opline->result.var).tmp_var,
+ bitwise_and_function(EX_VAR(opline->result.var),
opline->op1.zv,
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
@@ -4744,7 +4617,7 @@ static int ZEND_FASTCALL ZEND_BW_XOR_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER
zend_free_op free_op2;
SAVE_OPLINE();
- bitwise_xor_function(&EX_T(opline->result.var).tmp_var,
+ bitwise_xor_function(EX_VAR(opline->result.var),
opline->op1.zv,
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
@@ -4759,7 +4632,7 @@ static int ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDL
zend_free_op free_op2;
SAVE_OPLINE();
- boolean_xor_function(&EX_T(opline->result.var).tmp_var,
+ boolean_xor_function(EX_VAR(opline->result.var),
opline->op1.zv,
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
@@ -4776,7 +4649,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HA
SAVE_OPLINE();
container = opline->op1.zv;
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_R TSRMLS_CC);
+ zend_fetch_dimension_address_read(EX_VAR(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_R TSRMLS_CC);
zval_dtor(free_op2.var);
if (IS_CONST != IS_VAR || !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
@@ -4799,7 +4672,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_TMP_HANDLER(ZE
if (CACHED_PTR(opline->op1.literal->cache_slot)) {
ce = CACHED_PTR(opline->op1.literal->cache_slot);
} else {
- ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
@@ -4810,7 +4683,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_TMP_HANDLER(ZE
}
call->called_scope = ce;
} else {
- ce = EX_T(opline->op1.var).class_entry;
+ ce = Z_CE_P(EX_VAR(opline->op1.var));
if (opline->extended_value == ZEND_FETCH_CLASS_PARENT || opline->extended_value == ZEND_FETCH_CLASS_SELF) {
call->called_scope = EG(called_scope);
@@ -4828,44 +4701,33 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_TMP_HANDLER(ZE
(call->fbc = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce))) {
/* do nothing */
} else if (IS_TMP_VAR != IS_UNUSED) {
- char *function_name_strval = NULL;
- int function_name_strlen = 0;
zend_free_op free_op2;
- if (IS_TMP_VAR == IS_CONST) {
- function_name_strval = Z_STRVAL_P(opline->op2.zv);
- function_name_strlen = Z_STRLEN_P(opline->op2.zv);
- } else {
- function_name = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
-
+ function_name = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
+ if (IS_TMP_VAR != IS_CONST) {
if (UNEXPECTED(Z_TYPE_P(function_name) != IS_STRING)) {
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
zend_error_noreturn(E_ERROR, "Function name must be a string");
- } else {
- function_name_strval = Z_STRVAL_P(function_name);
- function_name_strlen = Z_STRLEN_P(function_name);
}
}
- if (function_name_strval) {
- if (ce->get_static_method) {
- call->fbc = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
+ if (ce->get_static_method) {
+ call->fbc = ce->get_static_method(ce, Z_STR_P(function_name) TSRMLS_CC);
+ } else {
+ call->fbc = zend_std_get_static_method(ce, Z_STR_P(function_name), ((IS_TMP_VAR == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
+ }
+ if (UNEXPECTED(call->fbc == NULL)) {
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", ce->name->val, Z_STRVAL_P(function_name));
+ }
+ if (IS_TMP_VAR == IS_CONST &&
+ EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
+ EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0)) {
+ if (IS_CONST == IS_CONST) {
+ CACHE_PTR(opline->op2.literal->cache_slot, call->fbc);
} else {
- call->fbc = zend_std_get_static_method(ce, function_name_strval, function_name_strlen, ((IS_TMP_VAR == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
- }
- if (UNEXPECTED(call->fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", ce->name, function_name_strval);
- }
- if (IS_TMP_VAR == IS_CONST &&
- EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
- EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0)) {
- if (IS_CONST == IS_CONST) {
- CACHE_PTR(opline->op2.literal->cache_slot, call->fbc);
- } else {
- CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce, call->fbc);
- }
+ CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce, call->fbc);
}
}
if (IS_TMP_VAR != IS_CONST) {
@@ -4875,31 +4737,28 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_TMP_HANDLER(ZE
if (UNEXPECTED(ce->constructor == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot call constructor");
}
- if (EG(This) && Z_OBJCE_P(EG(This)) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
- zend_error_noreturn(E_ERROR, "Cannot call private %s::__construct()", ce->name);
+ if (Z_TYPE(EG(This)) != IS_UNDEF && Z_OBJCE(EG(This)) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
+ zend_error_noreturn(E_ERROR, "Cannot call private %s::__construct()", ce->name->val);
}
call->fbc = ce->constructor;
}
if (call->fbc->common.fn_flags & ZEND_ACC_STATIC) {
- call->object = NULL;
+ ZVAL_UNDEF(&call->object);
} else {
- if (EG(This) &&
- Z_OBJ_HT_P(EG(This))->get_class_entry &&
- !instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) {
+ if (Z_TYPE(EG(This)) != IS_UNDEF &&
+ Z_OBJ_HT(EG(This))->get_class_entry &&
+ !instanceof_function(Z_OBJCE(EG(This)), ce TSRMLS_CC)) {
/* We are calling method of the other (incompatible) class,
but passing $this. This is done for compatibility with php-4. */
if (call->fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
- zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name);
+ zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name->val, call->fbc->common.function_name->val);
} else {
/* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */
- zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name);
+ zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", call->fbc->common.scope->name->val, call->fbc->common.function_name->val);
}
}
- if ((call->object = EG(This))) {
- Z_ADDREF_P(call->object);
- call->called_scope = Z_OBJCE_P(call->object);
- }
+ ZVAL_COPY(&call->object, &EG(This));
}
call->num_additional_args = 0;
@@ -4916,7 +4775,7 @@ static int ZEND_FASTCALL ZEND_CASE_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_A
zend_free_op free_op2;
SAVE_OPLINE();
- is_equal_function(&EX_T(opline->result.var).tmp_var,
+ is_equal_function(EX_VAR(opline->result.var),
opline->op1.zv,
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
@@ -4933,29 +4792,24 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_TMP_HANDLER(ZEND_OPC
SAVE_OPLINE();
if ((IS_CONST == IS_VAR || IS_CONST == IS_CV) && opline->extended_value) {
- zval **expr_ptr_ptr = NULL;
-
- if (IS_CONST == IS_VAR && UNEXPECTED(expr_ptr_ptr == NULL)) {
+ expr_ptr = opline->op1.zv;
+ if (IS_CONST == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets");
}
- SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr_ptr);
- expr_ptr = *expr_ptr_ptr;
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr);
Z_ADDREF_P(expr_ptr);
} else {
expr_ptr=opline->op1.zv;
if (0) { /* temporary variable */
- zval *new_expr;
+ zval new_expr;
- ALLOC_ZVAL(new_expr);
- INIT_PZVAL_COPY(new_expr, expr_ptr);
- expr_ptr = new_expr;
- } else if (IS_CONST == IS_CONST || PZVAL_IS_REF(expr_ptr)) {
- zval *new_expr;
+ ZVAL_COPY_VALUE(&new_expr, expr_ptr);
+ expr_ptr = &new_expr;
+ } else if (IS_CONST == IS_CONST || Z_ISREF_P(expr_ptr)) {
+ zval new_expr;
- ALLOC_ZVAL(new_expr);
- INIT_PZVAL_COPY(new_expr, expr_ptr);
- expr_ptr = new_expr;
- zendi_zval_copy_ctor(*expr_ptr);
+ ZVAL_DUP(&new_expr, expr_ptr);
+ expr_ptr = &new_expr;
} else if (IS_CONST == IS_CV) {
Z_ADDREF_P(expr_ptr);
@@ -4975,29 +4829,26 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_TMP_HANDLER(ZEND_OPC
case IS_BOOL:
hval = Z_LVAL_P(offset);
num_index:
- zend_hash_index_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), hval, &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr);
break;
case IS_STRING:
- if (IS_TMP_VAR == IS_CONST) {
- hval = Z_HASH_P(offset);
- } else {
+ if (IS_TMP_VAR != IS_CONST) {
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index);
- hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset));
}
- zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), Z_STR_P(offset), expr_ptr);
break;
case IS_NULL:
- zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), STR_EMPTY_ALLOC(), expr_ptr);
break;
default:
zend_error(E_WARNING, "Illegal offset type");
- zval_ptr_dtor(&expr_ptr);
+ zval_ptr_dtor(expr_ptr);
/* do nothing */
break;
}
zval_dtor(free_op2.var);
} else {
- zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr);
}
if ((IS_CONST == IS_VAR || IS_CONST == IS_CV) && opline->extended_value) {
@@ -5010,7 +4861,7 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HAN
{
USE_OPLINE
- array_init(&EX_T(opline->result.var).tmp_var);
+ array_init(EX_VAR(opline->result.var));
if (IS_CONST == IS_UNUSED) {
ZEND_VM_NEXT_OPCODE();
#if 0 || IS_CONST != IS_UNUSED
@@ -5022,6 +4873,9 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HAN
static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
+//???
+return 0;
+#if 0
USE_OPLINE
/* The generator object is stored in return_value_ptr_ptr */
@@ -5064,7 +4918,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_
generator->value = copy;
} else {
- zval **value_ptr = NULL;
+ zval **value_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W);
if (IS_CONST == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
@@ -5092,7 +4946,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_
/* Consts, temporary variables and references need copying */
if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR
- || PZVAL_IS_REF(value)
+ || Z_ISREF_P(value)
) {
zval *copy;
@@ -5126,7 +4980,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_
/* Consts, temporary variables and references need copying */
if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR
- || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0)
+ || (Z_ISREF_P(key) && Z_REFCOUNT_P(key) > 0)
) {
zval *copy;
@@ -5177,6 +5031,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_
SAVE_OPLINE();
ZEND_VM_RETURN();
+#endif
}
static int ZEND_FASTCALL ZEND_ADD_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -5185,11 +5040,11 @@ static int ZEND_FASTCALL ZEND_ADD_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR
zend_free_op free_op2;
SAVE_OPLINE();
- fast_add_function(&EX_T(opline->result.var).tmp_var,
+ fast_add_function(EX_VAR(opline->result.var),
opline->op1.zv,
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -5200,11 +5055,11 @@ static int ZEND_FASTCALL ZEND_SUB_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR
zend_free_op free_op2;
SAVE_OPLINE();
- fast_sub_function(&EX_T(opline->result.var).tmp_var,
+ fast_sub_function(EX_VAR(opline->result.var),
opline->op1.zv,
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -5215,11 +5070,11 @@ static int ZEND_FASTCALL ZEND_MUL_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR
zend_free_op free_op2;
SAVE_OPLINE();
- fast_mul_function(&EX_T(opline->result.var).tmp_var,
+ fast_mul_function(EX_VAR(opline->result.var),
opline->op1.zv,
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -5230,11 +5085,11 @@ static int ZEND_FASTCALL ZEND_DIV_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR
zend_free_op free_op2;
SAVE_OPLINE();
- fast_div_function(&EX_T(opline->result.var).tmp_var,
+ fast_div_function(EX_VAR(opline->result.var),
opline->op1.zv,
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -5245,11 +5100,11 @@ static int ZEND_FASTCALL ZEND_MOD_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR
zend_free_op free_op2;
SAVE_OPLINE();
- fast_mod_function(&EX_T(opline->result.var).tmp_var,
+ fast_mod_function(EX_VAR(opline->result.var),
opline->op1.zv,
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -5260,11 +5115,11 @@ static int ZEND_FASTCALL ZEND_SL_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
zend_free_op free_op2;
SAVE_OPLINE();
- shift_left_function(&EX_T(opline->result.var).tmp_var,
+ shift_left_function(EX_VAR(opline->result.var),
opline->op1.zv,
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -5275,11 +5130,11 @@ static int ZEND_FASTCALL ZEND_SR_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
zend_free_op free_op2;
SAVE_OPLINE();
- shift_right_function(&EX_T(opline->result.var).tmp_var,
+ shift_right_function(EX_VAR(opline->result.var),
opline->op1.zv,
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -5290,11 +5145,11 @@ static int ZEND_FASTCALL ZEND_CONCAT_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER
zend_free_op free_op2;
SAVE_OPLINE();
- concat_function(&EX_T(opline->result.var).tmp_var,
+ concat_function(EX_VAR(opline->result.var),
opline->op1.zv,
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -5305,11 +5160,11 @@ static int ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_H
zend_free_op free_op2;
SAVE_OPLINE();
- is_identical_function(&EX_T(opline->result.var).tmp_var,
+ is_identical_function(EX_VAR(opline->result.var),
opline->op1.zv,
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -5318,7 +5173,7 @@ static int ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_CONST_VAR_HANDLER(ZEND_OPCO
{
USE_OPLINE
zend_free_op free_op2;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
is_identical_function(result,
@@ -5326,7 +5181,7 @@ static int ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_CONST_VAR_HANDLER(ZEND_OPCO
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
Z_LVAL_P(result) = !Z_LVAL_P(result);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -5335,14 +5190,14 @@ static int ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDL
{
USE_OPLINE
zend_free_op free_op2;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_equal_function(result,
opline->op1.zv,
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC));
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -5351,14 +5206,14 @@ static int ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_H
{
USE_OPLINE
zend_free_op free_op2;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_not_equal_function(result,
opline->op1.zv,
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC));
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -5367,14 +5222,14 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HAN
{
USE_OPLINE
zend_free_op free_op2;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_is_smaller_function(result,
opline->op1.zv,
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC));
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -5383,14 +5238,14 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_CONST_VAR_HANDLER(ZEND_O
{
USE_OPLINE
zend_free_op free_op2;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_is_smaller_or_equal_function(result,
opline->op1.zv,
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC));
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -5401,11 +5256,11 @@ static int ZEND_FASTCALL ZEND_BW_OR_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_
zend_free_op free_op2;
SAVE_OPLINE();
- bitwise_or_function(&EX_T(opline->result.var).tmp_var,
+ bitwise_or_function(EX_VAR(opline->result.var),
opline->op1.zv,
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -5416,11 +5271,11 @@ static int ZEND_FASTCALL ZEND_BW_AND_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER
zend_free_op free_op2;
SAVE_OPLINE();
- bitwise_and_function(&EX_T(opline->result.var).tmp_var,
+ bitwise_and_function(EX_VAR(opline->result.var),
opline->op1.zv,
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -5431,11 +5286,11 @@ static int ZEND_FASTCALL ZEND_BW_XOR_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER
zend_free_op free_op2;
SAVE_OPLINE();
- bitwise_xor_function(&EX_T(opline->result.var).tmp_var,
+ bitwise_xor_function(EX_VAR(opline->result.var),
opline->op1.zv,
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -5446,11 +5301,11 @@ static int ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDL
zend_free_op free_op2;
SAVE_OPLINE();
- boolean_xor_function(&EX_T(opline->result.var).tmp_var,
+ boolean_xor_function(EX_VAR(opline->result.var),
opline->op1.zv,
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -5460,19 +5315,17 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_VAR(int type,
USE_OPLINE
zend_free_op free_op1;
zval *varname;
- zval **retval;
+ zval *retval;
zval tmp_varname;
HashTable *target_symbol_table;
- ulong hash_value;
SAVE_OPLINE();
varname = opline->op1.zv;
if (IS_CONST != IS_CONST && UNEXPECTED(Z_TYPE_P(varname) != IS_STRING)) {
- ZVAL_COPY_VALUE(&tmp_varname, varname);
- zval_copy_ctor(&tmp_varname);
- Z_SET_REFCOUNT(tmp_varname, 1);
- Z_UNSET_ISREF(tmp_varname);
+ ZVAL_DUP(&tmp_varname, varname);
+//??? Z_SET_REFCOUNT(tmp_varname, 1);
+//??? Z_UNSET_ISREF(tmp_varname);
convert_to_string(&tmp_varname);
varname = &tmp_varname;
}
@@ -5484,7 +5337,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_VAR(int type,
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
ce = CACHED_PTR(opline->op2.literal->cache_slot);
} else {
- ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
if (IS_CONST != IS_CONST && varname == &tmp_varname) {
zval_dtor(&tmp_varname);
@@ -5496,9 +5349,9 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_VAR(int type,
CACHE_PTR(opline->op2.literal->cache_slot, ce);
}
} else {
- ce = EX_T(opline->op2.var).class_entry;
+ ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0, ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ retval = zend_std_get_static_property(ce, Z_STR_P(varname), 0, ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
} else {
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
@@ -5508,27 +5361,21 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_VAR(int type,
ZEND_VM_NEXT_OPCODE();
}
*/
- if (IS_CONST == IS_CONST) {
- hash_value = Z_HASH_P(varname);
- } else {
- hash_value = str_hash(Z_STRVAL_P(varname), Z_STRLEN_P(varname));
- }
-
- if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) {
+ if ((retval = zend_hash_find(target_symbol_table, Z_STR_P(varname))) == NULL) {
switch (type) {
case BP_VAR_R:
case BP_VAR_UNSET:
zend_error(E_NOTICE,"Undefined variable: %s", Z_STRVAL_P(varname));
/* break missing intentionally */
case BP_VAR_IS:
- retval = &EG(uninitialized_zval_ptr);
+ ZVAL_NULL(retval);
break;
case BP_VAR_RW:
zend_error(E_NOTICE,"Undefined variable: %s", Z_STRVAL_P(varname));
/* break missing intentionally */
case BP_VAR_W:
Z_ADDREF_P(&EG(uninitialized_zval));
- zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval);
+ retval = zend_hash_update(target_symbol_table, Z_STR_P(varname), &EG(uninitialized_zval));
break;
EMPTY_SWITCH_DEFAULT_CASE()
}
@@ -5547,7 +5394,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_VAR(int type,
break;
case ZEND_FETCH_GLOBAL_LOCK:
if (IS_CONST == IS_VAR && !free_op1.var) {
- PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
+ Z_ADDREF_P(EX_VAR(opline->op1.var));
}
break;
}
@@ -5560,27 +5407,26 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_VAR(int type,
if (opline->extended_value & ZEND_FETCH_MAKE_REF) {
SEPARATE_ZVAL_TO_MAKE_IS_REF(retval);
}
- PZVAL_LOCK(*retval);
- switch (type) {
- case BP_VAR_R:
- case BP_VAR_IS:
- EX_T(opline->result.var).var.ptr = *retval;
- break;
- case BP_VAR_UNSET: {
- zend_free_op free_res;
-
- PZVAL_UNLOCK(*retval, &free_res);
- if (retval != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(retval);
- }
- PZVAL_LOCK(*retval);
- FREE_OP_VAR_PTR(free_res);
- }
- /* break missing intentionally */
- default:
- EX_T(opline->result.var).var.ptr_ptr = retval;
- break;
- }
+ ZVAL_COPY(EX_VAR(opline->result.var), retval);
+//??? switch (type) {
+//??? case BP_VAR_R:
+//??? case BP_VAR_IS:
+//??? break;
+//??? case BP_VAR_UNSET: {
+//??? zend_free_op free_res;
+//???
+//??? PZVAL_UNLOCK(*retval, &free_res);
+//??? if (retval != &EG(uninitialized_zval_ptr)) {
+//??? SEPARATE_ZVAL_IF_NOT_REF(retval);
+//??? }
+//??? PZVAL_LOCK(*retval);
+//??? FREE_OP_VAR_PTR(free_res);
+//??? }
+//??? /* break missing intentionally */
+//??? default:
+//??? EX_T(opline->result.var).var.ptr_ptr = retval;
+//??? break;
+//??? }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -5625,8 +5471,8 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HA
SAVE_OPLINE();
container = opline->op1.zv;
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zend_fetch_dimension_address_read(EX_VAR(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC);
+ zval_ptr_dtor_nogc(free_op2.var);
if (IS_CONST != IS_VAR || !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
}
@@ -5648,7 +5494,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_VAR_HANDLER(ZE
if (CACHED_PTR(opline->op1.literal->cache_slot)) {
ce = CACHED_PTR(opline->op1.literal->cache_slot);
} else {
- ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
@@ -5659,7 +5505,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_VAR_HANDLER(ZE
}
call->called_scope = ce;
} else {
- ce = EX_T(opline->op1.var).class_entry;
+ ce = Z_CE_P(EX_VAR(opline->op1.var));
if (opline->extended_value == ZEND_FETCH_CLASS_PARENT || opline->extended_value == ZEND_FETCH_CLASS_SELF) {
call->called_scope = EG(called_scope);
@@ -5677,78 +5523,64 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_VAR_HANDLER(ZE
(call->fbc = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce))) {
/* do nothing */
} else if (IS_VAR != IS_UNUSED) {
- char *function_name_strval = NULL;
- int function_name_strlen = 0;
zend_free_op free_op2;
- if (IS_VAR == IS_CONST) {
- function_name_strval = Z_STRVAL_P(opline->op2.zv);
- function_name_strlen = Z_STRLEN_P(opline->op2.zv);
- } else {
- function_name = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
-
+ function_name = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
+ if (IS_VAR != IS_CONST) {
if (UNEXPECTED(Z_TYPE_P(function_name) != IS_STRING)) {
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
zend_error_noreturn(E_ERROR, "Function name must be a string");
- } else {
- function_name_strval = Z_STRVAL_P(function_name);
- function_name_strlen = Z_STRLEN_P(function_name);
}
}
- if (function_name_strval) {
- if (ce->get_static_method) {
- call->fbc = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
+ if (ce->get_static_method) {
+ call->fbc = ce->get_static_method(ce, Z_STR_P(function_name) TSRMLS_CC);
+ } else {
+ call->fbc = zend_std_get_static_method(ce, Z_STR_P(function_name), ((IS_VAR == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
+ }
+ if (UNEXPECTED(call->fbc == NULL)) {
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", ce->name->val, Z_STRVAL_P(function_name));
+ }
+ if (IS_VAR == IS_CONST &&
+ EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
+ EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0)) {
+ if (IS_CONST == IS_CONST) {
+ CACHE_PTR(opline->op2.literal->cache_slot, call->fbc);
} else {
- call->fbc = zend_std_get_static_method(ce, function_name_strval, function_name_strlen, ((IS_VAR == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
- }
- if (UNEXPECTED(call->fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", ce->name, function_name_strval);
- }
- if (IS_VAR == IS_CONST &&
- EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
- EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0)) {
- if (IS_CONST == IS_CONST) {
- CACHE_PTR(opline->op2.literal->cache_slot, call->fbc);
- } else {
- CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce, call->fbc);
- }
+ CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce, call->fbc);
}
}
if (IS_VAR != IS_CONST) {
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
}
} else {
if (UNEXPECTED(ce->constructor == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot call constructor");
}
- if (EG(This) && Z_OBJCE_P(EG(This)) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
- zend_error_noreturn(E_ERROR, "Cannot call private %s::__construct()", ce->name);
+ if (Z_TYPE(EG(This)) != IS_UNDEF && Z_OBJCE(EG(This)) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
+ zend_error_noreturn(E_ERROR, "Cannot call private %s::__construct()", ce->name->val);
}
call->fbc = ce->constructor;
}
if (call->fbc->common.fn_flags & ZEND_ACC_STATIC) {
- call->object = NULL;
+ ZVAL_UNDEF(&call->object);
} else {
- if (EG(This) &&
- Z_OBJ_HT_P(EG(This))->get_class_entry &&
- !instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) {
+ if (Z_TYPE(EG(This)) != IS_UNDEF &&
+ Z_OBJ_HT(EG(This))->get_class_entry &&
+ !instanceof_function(Z_OBJCE(EG(This)), ce TSRMLS_CC)) {
/* We are calling method of the other (incompatible) class,
but passing $this. This is done for compatibility with php-4. */
if (call->fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
- zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name);
+ zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name->val, call->fbc->common.function_name->val);
} else {
/* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */
- zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name);
+ zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", call->fbc->common.scope->name->val, call->fbc->common.function_name->val);
}
}
- if ((call->object = EG(This))) {
- Z_ADDREF_P(call->object);
- call->called_scope = Z_OBJCE_P(call->object);
- }
+ ZVAL_COPY(&call->object, &EG(This));
}
call->num_additional_args = 0;
@@ -5765,11 +5597,11 @@ static int ZEND_FASTCALL ZEND_CASE_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_A
zend_free_op free_op2;
SAVE_OPLINE();
- is_equal_function(&EX_T(opline->result.var).tmp_var,
+ is_equal_function(EX_VAR(opline->result.var),
opline->op1.zv,
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -5782,29 +5614,24 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_VAR_HANDLER(ZEND_OPC
SAVE_OPLINE();
if ((IS_CONST == IS_VAR || IS_CONST == IS_CV) && opline->extended_value) {
- zval **expr_ptr_ptr = NULL;
-
- if (IS_CONST == IS_VAR && UNEXPECTED(expr_ptr_ptr == NULL)) {
+ expr_ptr = opline->op1.zv;
+ if (IS_CONST == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets");
}
- SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr_ptr);
- expr_ptr = *expr_ptr_ptr;
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr);
Z_ADDREF_P(expr_ptr);
} else {
expr_ptr=opline->op1.zv;
if (0) { /* temporary variable */
- zval *new_expr;
+ zval new_expr;
- ALLOC_ZVAL(new_expr);
- INIT_PZVAL_COPY(new_expr, expr_ptr);
- expr_ptr = new_expr;
- } else if (IS_CONST == IS_CONST || PZVAL_IS_REF(expr_ptr)) {
- zval *new_expr;
+ ZVAL_COPY_VALUE(&new_expr, expr_ptr);
+ expr_ptr = &new_expr;
+ } else if (IS_CONST == IS_CONST || Z_ISREF_P(expr_ptr)) {
+ zval new_expr;
- ALLOC_ZVAL(new_expr);
- INIT_PZVAL_COPY(new_expr, expr_ptr);
- expr_ptr = new_expr;
- zendi_zval_copy_ctor(*expr_ptr);
+ ZVAL_DUP(&new_expr, expr_ptr);
+ expr_ptr = &new_expr;
} else if (IS_CONST == IS_CV) {
Z_ADDREF_P(expr_ptr);
@@ -5824,29 +5651,26 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_VAR_HANDLER(ZEND_OPC
case IS_BOOL:
hval = Z_LVAL_P(offset);
num_index:
- zend_hash_index_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), hval, &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr);
break;
case IS_STRING:
- if (IS_VAR == IS_CONST) {
- hval = Z_HASH_P(offset);
- } else {
+ if (IS_VAR != IS_CONST) {
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index);
- hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset));
}
- zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), Z_STR_P(offset), expr_ptr);
break;
case IS_NULL:
- zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), STR_EMPTY_ALLOC(), expr_ptr);
break;
default:
zend_error(E_WARNING, "Illegal offset type");
- zval_ptr_dtor(&expr_ptr);
+ zval_ptr_dtor(expr_ptr);
/* do nothing */
break;
}
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
} else {
- zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr);
}
if ((IS_CONST == IS_VAR || IS_CONST == IS_CV) && opline->extended_value) {
@@ -5859,7 +5683,7 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HAN
{
USE_OPLINE
- array_init(&EX_T(opline->result.var).tmp_var);
+ array_init(EX_VAR(opline->result.var));
if (IS_CONST == IS_UNUSED) {
ZEND_VM_NEXT_OPCODE();
#if 0 || IS_CONST != IS_UNUSED
@@ -5881,13 +5705,13 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HAND
IS_VAR == IS_UNUSED &&
(opline->extended_value & ZEND_QUICK_SET)) {
if (EG(active_symbol_table)) {
- zend_compiled_variable *cv = &CV_DEF_OF(opline->op1.var);
+ zend_string *cv = CV_DEF_OF(opline->op1.var);
- zend_delete_variable(EX(prev_execute_data), EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value TSRMLS_CC);
- EX_CV(opline->op1.var) = NULL;
- } else if (EX_CV(opline->op1.var)) {
- zval_ptr_dtor(EX_CV(opline->op1.var));
- EX_CV(opline->op1.var) = NULL;
+ zend_delete_variable(EX(prev_execute_data), EG(active_symbol_table), cv TSRMLS_CC);
+ ZVAL_UNDEF(EX_VAR_NUM(opline->op1.var));
+ } else if (Z_TYPE_P(EX_VAR_NUM(opline->op1.var)) != IS_UNDEF) {
+ zval_ptr_dtor(EX_VAR_NUM(opline->op1.var));
+ ZVAL_UNDEF(EX_VAR_NUM(opline->op1.var));
}
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -5896,8 +5720,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HAND
varname = opline->op1.zv;
if (IS_CONST != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
- ZVAL_COPY_VALUE(&tmp, varname);
- zval_copy_ctor(&tmp);
+ ZVAL_DUP(&tmp, varname);
convert_to_string(&tmp);
varname = &tmp;
} else if (IS_CONST == IS_VAR || IS_CONST == IS_CV) {
@@ -5911,12 +5734,12 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HAND
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
ce = CACHED_PTR(opline->op2.literal->cache_slot);
} else {
- ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
if (IS_CONST != IS_CONST && varname == &tmp) {
zval_dtor(&tmp);
} else if (IS_CONST == IS_VAR || IS_CONST == IS_CV) {
- zval_ptr_dtor(&varname);
+ zval_ptr_dtor(varname);
}
HANDLE_EXCEPTION();
@@ -5927,20 +5750,18 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HAND
CACHE_PTR(opline->op2.literal->cache_slot, ce);
}
} else {
- ce = EX_T(opline->op2.var).class_entry;
+ ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ zend_std_unset_static_property(ce, Z_STR_P(varname), ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
} else {
- ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1);
-
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
- zend_delete_variable(execute_data, target_symbol_table, varname->value.str.val, varname->value.str.len+1, hash_value TSRMLS_CC);
+ zend_delete_variable(execute_data, target_symbol_table, Z_STR_P(varname) TSRMLS_CC);
}
if (IS_CONST != IS_CONST && varname == &tmp) {
zval_dtor(&tmp);
} else if (IS_CONST == IS_VAR || IS_CONST == IS_CV) {
- zval_ptr_dtor(&varname);
+ zval_ptr_dtor(varname);
}
CHECK_EXCEPTION();
@@ -5950,19 +5771,19 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HAND
static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zval **value;
+ zval *value;
zend_bool isset = 1;
SAVE_OPLINE();
if (IS_CONST == IS_CV &&
IS_VAR == IS_UNUSED &&
(opline->extended_value & ZEND_QUICK_SET)) {
- if (EX_CV(opline->op1.var)) {
- value = EX_CV(opline->op1.var);
+ if (Z_TYPE_P(EX_VAR_NUM(opline->op1.var)) != IS_UNDEF) {
+ value = EX_VAR_NUM(opline->op1.var);
} else if (EG(active_symbol_table)) {
- zend_compiled_variable *cv = &CV_DEF_OF(opline->op1.var);
+ zend_string *cv = CV_DEF_OF(opline->op1.var);
- if (zend_hash_quick_find(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, (void **) &value) == FAILURE) {
+ if ((value = zend_hash_find(EG(active_symbol_table), cv)) == NULL) {
isset = 0;
}
} else {
@@ -5974,8 +5795,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_VAR_HANDLER(ZEND_OPC
zval tmp, *varname = opline->op1.zv;
if (IS_CONST != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
- ZVAL_COPY_VALUE(&tmp, varname);
- zval_copy_ctor(&tmp);
+ ZVAL_DUP(&tmp, varname);
convert_to_string(&tmp);
varname = &tmp;
}
@@ -5987,7 +5807,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_VAR_HANDLER(ZEND_OPC
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
ce = CACHED_PTR(opline->op2.literal->cache_slot);
} else {
- ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -5995,15 +5815,15 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_VAR_HANDLER(ZEND_OPC
CACHE_PTR(opline->op2.literal->cache_slot, ce);
}
} else {
- ce = EX_T(opline->op2.var).class_entry;
+ ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1, ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ value = zend_std_get_static_property(ce, Z_STR_P(varname), 1, ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
if (!value) {
isset = 0;
}
} else {
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
- if (zend_hash_find(target_symbol_table, varname->value.str.val, varname->value.str.len+1, (void **) &value) == FAILURE) {
+ if ((value = zend_hash_find(target_symbol_table, Z_STR_P(varname))) == NULL) {
isset = 0;
}
}
@@ -6015,16 +5835,16 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_VAR_HANDLER(ZEND_OPC
}
if (opline->extended_value & ZEND_ISSET) {
- if (isset && Z_TYPE_PP(value) != IS_NULL) {
- ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, 1);
+ if (isset && Z_TYPE_P(value) != IS_NULL) {
+ ZVAL_BOOL(EX_VAR(opline->result.var), 1);
} else {
- ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, 0);
+ ZVAL_BOOL(EX_VAR(opline->result.var), 0);
}
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (!isset || !i_zend_is_true(*value TSRMLS_CC)) {
- ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, 1);
+ if (!isset || !i_zend_is_true(value TSRMLS_CC)) {
+ ZVAL_BOOL(EX_VAR(opline->result.var), 1);
} else {
- ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, 0);
+ ZVAL_BOOL(EX_VAR(opline->result.var), 0);
}
}
@@ -6034,6 +5854,9 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_VAR_HANDLER(ZEND_OPC
static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
+//???
+return 0;
+#if 0
USE_OPLINE
/* The generator object is stored in return_value_ptr_ptr */
@@ -6076,7 +5899,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_
generator->value = copy;
} else {
- zval **value_ptr = NULL;
+ zval **value_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W);
if (IS_CONST == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
@@ -6104,7 +5927,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_
/* Consts, temporary variables and references need copying */
if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR
- || PZVAL_IS_REF(value)
+ || Z_ISREF_P(value)
) {
zval *copy;
@@ -6138,7 +5961,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_
/* Consts, temporary variables and references need copying */
if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR
- || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0)
+ || (Z_ISREF_P(key) && Z_REFCOUNT_P(key) > 0)
) {
zval *copy;
@@ -6162,7 +5985,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_
generator->largest_used_integer_key = Z_LVAL_P(generator->key);
}
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
} else {
/* If no key was specified we use auto-increment keys */
generator->largest_used_integer_key++;
@@ -6190,6 +6013,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_
SAVE_OPLINE();
ZEND_VM_RETURN();
+#endif
}
static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_UNUSED(int type, ZEND_OPCODE_HANDLER_ARGS)
@@ -6197,19 +6021,17 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_UNUSED(int typ
USE_OPLINE
zend_free_op free_op1;
zval *varname;
- zval **retval;
+ zval *retval;
zval tmp_varname;
HashTable *target_symbol_table;
- ulong hash_value;
SAVE_OPLINE();
varname = opline->op1.zv;
if (IS_CONST != IS_CONST && UNEXPECTED(Z_TYPE_P(varname) != IS_STRING)) {
- ZVAL_COPY_VALUE(&tmp_varname, varname);
- zval_copy_ctor(&tmp_varname);
- Z_SET_REFCOUNT(tmp_varname, 1);
- Z_UNSET_ISREF(tmp_varname);
+ ZVAL_DUP(&tmp_varname, varname);
+//??? Z_SET_REFCOUNT(tmp_varname, 1);
+//??? Z_UNSET_ISREF(tmp_varname);
convert_to_string(&tmp_varname);
varname = &tmp_varname;
}
@@ -6221,7 +6043,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_UNUSED(int typ
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
ce = CACHED_PTR(opline->op2.literal->cache_slot);
} else {
- ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
if (IS_CONST != IS_CONST && varname == &tmp_varname) {
zval_dtor(&tmp_varname);
@@ -6233,9 +6055,9 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_UNUSED(int typ
CACHE_PTR(opline->op2.literal->cache_slot, ce);
}
} else {
- ce = EX_T(opline->op2.var).class_entry;
+ ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0, ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ retval = zend_std_get_static_property(ce, Z_STR_P(varname), 0, ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
} else {
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
@@ -6245,27 +6067,21 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_UNUSED(int typ
ZEND_VM_NEXT_OPCODE();
}
*/
- if (IS_CONST == IS_CONST) {
- hash_value = Z_HASH_P(varname);
- } else {
- hash_value = str_hash(Z_STRVAL_P(varname), Z_STRLEN_P(varname));
- }
-
- if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) {
+ if ((retval = zend_hash_find(target_symbol_table, Z_STR_P(varname))) == NULL) {
switch (type) {
case BP_VAR_R:
case BP_VAR_UNSET:
zend_error(E_NOTICE,"Undefined variable: %s", Z_STRVAL_P(varname));
/* break missing intentionally */
case BP_VAR_IS:
- retval = &EG(uninitialized_zval_ptr);
+ ZVAL_NULL(retval);
break;
case BP_VAR_RW:
zend_error(E_NOTICE,"Undefined variable: %s", Z_STRVAL_P(varname));
/* break missing intentionally */
case BP_VAR_W:
Z_ADDREF_P(&EG(uninitialized_zval));
- zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval);
+ retval = zend_hash_update(target_symbol_table, Z_STR_P(varname), &EG(uninitialized_zval));
break;
EMPTY_SWITCH_DEFAULT_CASE()
}
@@ -6284,7 +6100,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_UNUSED(int typ
break;
case ZEND_FETCH_GLOBAL_LOCK:
if (IS_CONST == IS_VAR && !free_op1.var) {
- PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
+ Z_ADDREF_P(EX_VAR(opline->op1.var));
}
break;
}
@@ -6297,27 +6113,26 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_UNUSED(int typ
if (opline->extended_value & ZEND_FETCH_MAKE_REF) {
SEPARATE_ZVAL_TO_MAKE_IS_REF(retval);
}
- PZVAL_LOCK(*retval);
- switch (type) {
- case BP_VAR_R:
- case BP_VAR_IS:
- EX_T(opline->result.var).var.ptr = *retval;
- break;
- case BP_VAR_UNSET: {
- zend_free_op free_res;
-
- PZVAL_UNLOCK(*retval, &free_res);
- if (retval != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(retval);
- }
- PZVAL_LOCK(*retval);
- FREE_OP_VAR_PTR(free_res);
- }
- /* break missing intentionally */
- default:
- EX_T(opline->result.var).var.ptr_ptr = retval;
- break;
- }
+ ZVAL_COPY(EX_VAR(opline->result.var), retval);
+//??? switch (type) {
+//??? case BP_VAR_R:
+//??? case BP_VAR_IS:
+//??? break;
+//??? case BP_VAR_UNSET: {
+//??? zend_free_op free_res;
+//???
+//??? PZVAL_UNLOCK(*retval, &free_res);
+//??? if (retval != &EG(uninitialized_zval_ptr)) {
+//??? SEPARATE_ZVAL_IF_NOT_REF(retval);
+//??? }
+//??? PZVAL_LOCK(*retval);
+//??? FREE_OP_VAR_PTR(free_res);
+//??? }
+//??? /* break missing intentionally */
+//??? default:
+//??? EX_T(opline->result.var).var.ptr_ptr = retval;
+//??? break;
+//??? }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -6368,7 +6183,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_UNUSED_HANDLER
if (CACHED_PTR(opline->op1.literal->cache_slot)) {
ce = CACHED_PTR(opline->op1.literal->cache_slot);
} else {
- ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
@@ -6379,7 +6194,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_UNUSED_HANDLER
}
call->called_scope = ce;
} else {
- ce = EX_T(opline->op1.var).class_entry;
+ ce = Z_CE_P(EX_VAR(opline->op1.var));
if (opline->extended_value == ZEND_FETCH_CLASS_PARENT || opline->extended_value == ZEND_FETCH_CLASS_SELF) {
call->called_scope = EG(called_scope);
@@ -6397,44 +6212,33 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_UNUSED_HANDLER
(call->fbc = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce))) {
/* do nothing */
} else if (IS_UNUSED != IS_UNUSED) {
- char *function_name_strval = NULL;
- int function_name_strlen = 0;
- if (IS_UNUSED == IS_CONST) {
- function_name_strval = Z_STRVAL_P(opline->op2.zv);
- function_name_strlen = Z_STRLEN_P(opline->op2.zv);
- } else {
- function_name = NULL;
-
+ function_name = NULL;
+ if (IS_UNUSED != IS_CONST) {
if (UNEXPECTED(Z_TYPE_P(function_name) != IS_STRING)) {
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
zend_error_noreturn(E_ERROR, "Function name must be a string");
- } else {
- function_name_strval = Z_STRVAL_P(function_name);
- function_name_strlen = Z_STRLEN_P(function_name);
}
}
- if (function_name_strval) {
- if (ce->get_static_method) {
- call->fbc = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
+ if (ce->get_static_method) {
+ call->fbc = ce->get_static_method(ce, Z_STR_P(function_name) TSRMLS_CC);
+ } else {
+ call->fbc = zend_std_get_static_method(ce, Z_STR_P(function_name), ((IS_UNUSED == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
+ }
+ if (UNEXPECTED(call->fbc == NULL)) {
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", ce->name->val, Z_STRVAL_P(function_name));
+ }
+ if (IS_UNUSED == IS_CONST &&
+ EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
+ EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0)) {
+ if (IS_CONST == IS_CONST) {
+ CACHE_PTR(opline->op2.literal->cache_slot, call->fbc);
} else {
- call->fbc = zend_std_get_static_method(ce, function_name_strval, function_name_strlen, ((IS_UNUSED == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
- }
- if (UNEXPECTED(call->fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", ce->name, function_name_strval);
- }
- if (IS_UNUSED == IS_CONST &&
- EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
- EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0)) {
- if (IS_CONST == IS_CONST) {
- CACHE_PTR(opline->op2.literal->cache_slot, call->fbc);
- } else {
- CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce, call->fbc);
- }
+ CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce, call->fbc);
}
}
if (IS_UNUSED != IS_CONST) {
@@ -6444,31 +6248,28 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_UNUSED_HANDLER
if (UNEXPECTED(ce->constructor == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot call constructor");
}
- if (EG(This) && Z_OBJCE_P(EG(This)) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
- zend_error_noreturn(E_ERROR, "Cannot call private %s::__construct()", ce->name);
+ if (Z_TYPE(EG(This)) != IS_UNDEF && Z_OBJCE(EG(This)) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
+ zend_error_noreturn(E_ERROR, "Cannot call private %s::__construct()", ce->name->val);
}
call->fbc = ce->constructor;
}
if (call->fbc->common.fn_flags & ZEND_ACC_STATIC) {
- call->object = NULL;
+ ZVAL_UNDEF(&call->object);
} else {
- if (EG(This) &&
- Z_OBJ_HT_P(EG(This))->get_class_entry &&
- !instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) {
+ if (Z_TYPE(EG(This)) != IS_UNDEF &&
+ Z_OBJ_HT(EG(This))->get_class_entry &&
+ !instanceof_function(Z_OBJCE(EG(This)), ce TSRMLS_CC)) {
/* We are calling method of the other (incompatible) class,
but passing $this. This is done for compatibility with php-4. */
if (call->fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
- zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name);
+ zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name->val, call->fbc->common.function_name->val);
} else {
/* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */
- zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name);
+ zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", call->fbc->common.scope->name->val, call->fbc->common.function_name->val);
}
}
- if ((call->object = EG(This))) {
- Z_ADDREF_P(call->object);
- call->called_scope = Z_OBJCE_P(call->object);
- }
+ ZVAL_COPY(&call->object, &EG(This));
}
call->num_additional_args = 0;
@@ -6487,29 +6288,24 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_UNUSED_HANDLER(ZEND_
SAVE_OPLINE();
if ((IS_CONST == IS_VAR || IS_CONST == IS_CV) && opline->extended_value) {
- zval **expr_ptr_ptr = NULL;
-
- if (IS_CONST == IS_VAR && UNEXPECTED(expr_ptr_ptr == NULL)) {
+ expr_ptr = opline->op1.zv;
+ if (IS_CONST == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets");
}
- SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr_ptr);
- expr_ptr = *expr_ptr_ptr;
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr);
Z_ADDREF_P(expr_ptr);
} else {
expr_ptr=opline->op1.zv;
if (0) { /* temporary variable */
- zval *new_expr;
+ zval new_expr;
- ALLOC_ZVAL(new_expr);
- INIT_PZVAL_COPY(new_expr, expr_ptr);
- expr_ptr = new_expr;
- } else if (IS_CONST == IS_CONST || PZVAL_IS_REF(expr_ptr)) {
- zval *new_expr;
+ ZVAL_COPY_VALUE(&new_expr, expr_ptr);
+ expr_ptr = &new_expr;
+ } else if (IS_CONST == IS_CONST || Z_ISREF_P(expr_ptr)) {
+ zval new_expr;
- ALLOC_ZVAL(new_expr);
- INIT_PZVAL_COPY(new_expr, expr_ptr);
- expr_ptr = new_expr;
- zendi_zval_copy_ctor(*expr_ptr);
+ ZVAL_DUP(&new_expr, expr_ptr);
+ expr_ptr = &new_expr;
} else if (IS_CONST == IS_CV) {
Z_ADDREF_P(expr_ptr);
@@ -6529,29 +6325,26 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_UNUSED_HANDLER(ZEND_
case IS_BOOL:
hval = Z_LVAL_P(offset);
num_index:
- zend_hash_index_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), hval, &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr);
break;
case IS_STRING:
- if (IS_UNUSED == IS_CONST) {
- hval = Z_HASH_P(offset);
- } else {
+ if (IS_UNUSED != IS_CONST) {
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index);
- hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset));
}
- zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), Z_STR_P(offset), expr_ptr);
break;
case IS_NULL:
- zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), STR_EMPTY_ALLOC(), expr_ptr);
break;
default:
zend_error(E_WARNING, "Illegal offset type");
- zval_ptr_dtor(&expr_ptr);
+ zval_ptr_dtor(expr_ptr);
/* do nothing */
break;
}
} else {
- zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr);
}
if ((IS_CONST == IS_VAR || IS_CONST == IS_CV) && opline->extended_value) {
@@ -6564,7 +6357,7 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_
{
USE_OPLINE
- array_init(&EX_T(opline->result.var).tmp_var);
+ array_init(EX_VAR(opline->result.var));
if (IS_CONST == IS_UNUSED) {
ZEND_VM_NEXT_OPCODE();
#if 0 || IS_CONST != IS_UNUSED
@@ -6586,13 +6379,13 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_H
IS_UNUSED == IS_UNUSED &&
(opline->extended_value & ZEND_QUICK_SET)) {
if (EG(active_symbol_table)) {
- zend_compiled_variable *cv = &CV_DEF_OF(opline->op1.var);
+ zend_string *cv = CV_DEF_OF(opline->op1.var);
- zend_delete_variable(EX(prev_execute_data), EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value TSRMLS_CC);
- EX_CV(opline->op1.var) = NULL;
- } else if (EX_CV(opline->op1.var)) {
- zval_ptr_dtor(EX_CV(opline->op1.var));
- EX_CV(opline->op1.var) = NULL;
+ zend_delete_variable(EX(prev_execute_data), EG(active_symbol_table), cv TSRMLS_CC);
+ ZVAL_UNDEF(EX_VAR_NUM(opline->op1.var));
+ } else if (Z_TYPE_P(EX_VAR_NUM(opline->op1.var)) != IS_UNDEF) {
+ zval_ptr_dtor(EX_VAR_NUM(opline->op1.var));
+ ZVAL_UNDEF(EX_VAR_NUM(opline->op1.var));
}
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -6601,8 +6394,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_H
varname = opline->op1.zv;
if (IS_CONST != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
- ZVAL_COPY_VALUE(&tmp, varname);
- zval_copy_ctor(&tmp);
+ ZVAL_DUP(&tmp, varname);
convert_to_string(&tmp);
varname = &tmp;
} else if (IS_CONST == IS_VAR || IS_CONST == IS_CV) {
@@ -6616,12 +6408,12 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_H
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
ce = CACHED_PTR(opline->op2.literal->cache_slot);
} else {
- ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
if (IS_CONST != IS_CONST && varname == &tmp) {
zval_dtor(&tmp);
} else if (IS_CONST == IS_VAR || IS_CONST == IS_CV) {
- zval_ptr_dtor(&varname);
+ zval_ptr_dtor(varname);
}
HANDLE_EXCEPTION();
@@ -6632,20 +6424,18 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_H
CACHE_PTR(opline->op2.literal->cache_slot, ce);
}
} else {
- ce = EX_T(opline->op2.var).class_entry;
+ ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ zend_std_unset_static_property(ce, Z_STR_P(varname), ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
} else {
- ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1);
-
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
- zend_delete_variable(execute_data, target_symbol_table, varname->value.str.val, varname->value.str.len+1, hash_value TSRMLS_CC);
+ zend_delete_variable(execute_data, target_symbol_table, Z_STR_P(varname) TSRMLS_CC);
}
if (IS_CONST != IS_CONST && varname == &tmp) {
zval_dtor(&tmp);
} else if (IS_CONST == IS_VAR || IS_CONST == IS_CV) {
- zval_ptr_dtor(&varname);
+ zval_ptr_dtor(varname);
}
CHECK_EXCEPTION();
@@ -6655,19 +6445,19 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_H
static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zval **value;
+ zval *value;
zend_bool isset = 1;
SAVE_OPLINE();
if (IS_CONST == IS_CV &&
IS_UNUSED == IS_UNUSED &&
(opline->extended_value & ZEND_QUICK_SET)) {
- if (EX_CV(opline->op1.var)) {
- value = EX_CV(opline->op1.var);
+ if (Z_TYPE_P(EX_VAR_NUM(opline->op1.var)) != IS_UNDEF) {
+ value = EX_VAR_NUM(opline->op1.var);
} else if (EG(active_symbol_table)) {
- zend_compiled_variable *cv = &CV_DEF_OF(opline->op1.var);
+ zend_string *cv = CV_DEF_OF(opline->op1.var);
- if (zend_hash_quick_find(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, (void **) &value) == FAILURE) {
+ if ((value = zend_hash_find(EG(active_symbol_table), cv)) == NULL) {
isset = 0;
}
} else {
@@ -6679,8 +6469,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_UNUSED_HANDLER(ZEND_
zval tmp, *varname = opline->op1.zv;
if (IS_CONST != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
- ZVAL_COPY_VALUE(&tmp, varname);
- zval_copy_ctor(&tmp);
+ ZVAL_DUP(&tmp, varname);
convert_to_string(&tmp);
varname = &tmp;
}
@@ -6692,7 +6481,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_UNUSED_HANDLER(ZEND_
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
ce = CACHED_PTR(opline->op2.literal->cache_slot);
} else {
- ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -6700,15 +6489,15 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_UNUSED_HANDLER(ZEND_
CACHE_PTR(opline->op2.literal->cache_slot, ce);
}
} else {
- ce = EX_T(opline->op2.var).class_entry;
+ ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1, ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ value = zend_std_get_static_property(ce, Z_STR_P(varname), 1, ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
if (!value) {
isset = 0;
}
} else {
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
- if (zend_hash_find(target_symbol_table, varname->value.str.val, varname->value.str.len+1, (void **) &value) == FAILURE) {
+ if ((value = zend_hash_find(target_symbol_table, Z_STR_P(varname))) == NULL) {
isset = 0;
}
}
@@ -6720,16 +6509,16 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_UNUSED_HANDLER(ZEND_
}
if (opline->extended_value & ZEND_ISSET) {
- if (isset && Z_TYPE_PP(value) != IS_NULL) {
- ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, 1);
+ if (isset && Z_TYPE_P(value) != IS_NULL) {
+ ZVAL_BOOL(EX_VAR(opline->result.var), 1);
} else {
- ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, 0);
+ ZVAL_BOOL(EX_VAR(opline->result.var), 0);
}
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (!isset || !i_zend_is_true(*value TSRMLS_CC)) {
- ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, 1);
+ if (!isset || !i_zend_is_true(value TSRMLS_CC)) {
+ ZVAL_BOOL(EX_VAR(opline->result.var), 1);
} else {
- ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, 0);
+ ZVAL_BOOL(EX_VAR(opline->result.var), 0);
}
}
@@ -6740,16 +6529,16 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_UNUSED_HANDLER(ZEND_
static int ZEND_FASTCALL ZEND_DECLARE_LAMBDA_FUNCTION_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_function *op_array;
+ zval *zfunc;
SAVE_OPLINE();
- if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), Z_HASH_P(opline->op1.zv), (void *) &op_array) == FAILURE) ||
- UNEXPECTED(op_array->type != ZEND_USER_FUNCTION)) {
+ if (UNEXPECTED((zfunc = zend_hash_find(EG(function_table), Z_STR_P(opline->op1.zv))) == NULL) ||
+ UNEXPECTED(Z_FUNC_P(zfunc)->type != ZEND_USER_FUNCTION)) {
zend_error_noreturn(E_ERROR, "Base lambda function for closure not found");
}
- zend_create_closure(&EX_T(opline->result.var).tmp_var, (zend_function *) op_array, EG(scope), EG(This) TSRMLS_CC);
+ zend_create_closure(EX_VAR(opline->result.var), Z_FUNC_P(zfunc), EG(scope), &EG(This) TSRMLS_CC);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -6757,6 +6546,9 @@ static int ZEND_FASTCALL ZEND_DECLARE_LAMBDA_FUNCTION_SPEC_CONST_UNUSED_HANDLER
static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
+//???
+return 0;
+#if 0
USE_OPLINE
/* The generator object is stored in return_value_ptr_ptr */
@@ -6799,7 +6591,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDL
generator->value = copy;
} else {
- zval **value_ptr = NULL;
+ zval **value_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W);
if (IS_CONST == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
@@ -6827,7 +6619,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDL
/* Consts, temporary variables and references need copying */
if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR
- || PZVAL_IS_REF(value)
+ || Z_ISREF_P(value)
) {
zval *copy;
@@ -6861,7 +6653,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDL
/* Consts, temporary variables and references need copying */
if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR
- || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0)
+ || (Z_ISREF_P(key) && Z_REFCOUNT_P(key) > 0)
) {
zval *copy;
@@ -6912,6 +6704,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDL
SAVE_OPLINE();
ZEND_VM_RETURN();
+#endif
}
static int ZEND_FASTCALL ZEND_ADD_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -6920,7 +6713,7 @@ static int ZEND_FASTCALL ZEND_ADD_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG
SAVE_OPLINE();
- fast_add_function(&EX_T(opline->result.var).tmp_var,
+ fast_add_function(EX_VAR(opline->result.var),
opline->op1.zv,
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
@@ -6935,7 +6728,7 @@ static int ZEND_FASTCALL ZEND_SUB_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG
SAVE_OPLINE();
- fast_sub_function(&EX_T(opline->result.var).tmp_var,
+ fast_sub_function(EX_VAR(opline->result.var),
opline->op1.zv,
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
@@ -6950,7 +6743,7 @@ static int ZEND_FASTCALL ZEND_MUL_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG
SAVE_OPLINE();
- fast_mul_function(&EX_T(opline->result.var).tmp_var,
+ fast_mul_function(EX_VAR(opline->result.var),
opline->op1.zv,
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
@@ -6965,7 +6758,7 @@ static int ZEND_FASTCALL ZEND_DIV_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG
SAVE_OPLINE();
- fast_div_function(&EX_T(opline->result.var).tmp_var,
+ fast_div_function(EX_VAR(opline->result.var),
opline->op1.zv,
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
@@ -6980,7 +6773,7 @@ static int ZEND_FASTCALL ZEND_MOD_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG
SAVE_OPLINE();
- fast_mod_function(&EX_T(opline->result.var).tmp_var,
+ fast_mod_function(EX_VAR(opline->result.var),
opline->op1.zv,
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
@@ -6995,7 +6788,7 @@ static int ZEND_FASTCALL ZEND_SL_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS
SAVE_OPLINE();
- shift_left_function(&EX_T(opline->result.var).tmp_var,
+ shift_left_function(EX_VAR(opline->result.var),
opline->op1.zv,
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
@@ -7010,7 +6803,7 @@ static int ZEND_FASTCALL ZEND_SR_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS
SAVE_OPLINE();
- shift_right_function(&EX_T(opline->result.var).tmp_var,
+ shift_right_function(EX_VAR(opline->result.var),
opline->op1.zv,
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
@@ -7025,7 +6818,7 @@ static int ZEND_FASTCALL ZEND_CONCAT_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_
SAVE_OPLINE();
- concat_function(&EX_T(opline->result.var).tmp_var,
+ concat_function(EX_VAR(opline->result.var),
opline->op1.zv,
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
@@ -7040,7 +6833,7 @@ static int ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HA
SAVE_OPLINE();
- is_identical_function(&EX_T(opline->result.var).tmp_var,
+ is_identical_function(EX_VAR(opline->result.var),
opline->op1.zv,
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
@@ -7053,7 +6846,7 @@ static int ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_CONST_CV_HANDLER(ZEND_OPCOD
{
USE_OPLINE
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
is_identical_function(result,
@@ -7070,7 +6863,7 @@ static int ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLE
{
USE_OPLINE
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_equal_function(result,
@@ -7086,7 +6879,7 @@ static int ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HA
{
USE_OPLINE
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_not_equal_function(result,
@@ -7102,7 +6895,7 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HAND
{
USE_OPLINE
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_is_smaller_function(result,
@@ -7118,7 +6911,7 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_CONST_CV_HANDLER(ZEND_OP
{
USE_OPLINE
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_is_smaller_or_equal_function(result,
@@ -7136,7 +6929,7 @@ static int ZEND_FASTCALL ZEND_BW_OR_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_A
SAVE_OPLINE();
- bitwise_or_function(&EX_T(opline->result.var).tmp_var,
+ bitwise_or_function(EX_VAR(opline->result.var),
opline->op1.zv,
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
@@ -7151,7 +6944,7 @@ static int ZEND_FASTCALL ZEND_BW_AND_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_
SAVE_OPLINE();
- bitwise_and_function(&EX_T(opline->result.var).tmp_var,
+ bitwise_and_function(EX_VAR(opline->result.var),
opline->op1.zv,
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
@@ -7166,7 +6959,7 @@ static int ZEND_FASTCALL ZEND_BW_XOR_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_
SAVE_OPLINE();
- bitwise_xor_function(&EX_T(opline->result.var).tmp_var,
+ bitwise_xor_function(EX_VAR(opline->result.var),
opline->op1.zv,
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
@@ -7181,7 +6974,7 @@ static int ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLE
SAVE_OPLINE();
- boolean_xor_function(&EX_T(opline->result.var).tmp_var,
+ boolean_xor_function(EX_VAR(opline->result.var),
opline->op1.zv,
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
@@ -7198,7 +6991,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HAN
SAVE_OPLINE();
container = opline->op1.zv;
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_R TSRMLS_CC);
+ zend_fetch_dimension_address_read(EX_VAR(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_R TSRMLS_CC);
if (IS_CONST != IS_VAR || !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
@@ -7221,7 +7014,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CV_HANDLER(ZEN
if (CACHED_PTR(opline->op1.literal->cache_slot)) {
ce = CACHED_PTR(opline->op1.literal->cache_slot);
} else {
- ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
@@ -7232,7 +7025,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CV_HANDLER(ZEN
}
call->called_scope = ce;
} else {
- ce = EX_T(opline->op1.var).class_entry;
+ ce = Z_CE_P(EX_VAR(opline->op1.var));
if (opline->extended_value == ZEND_FETCH_CLASS_PARENT || opline->extended_value == ZEND_FETCH_CLASS_SELF) {
call->called_scope = EG(called_scope);
@@ -7250,44 +7043,33 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CV_HANDLER(ZEN
(call->fbc = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce))) {
/* do nothing */
} else if (IS_CV != IS_UNUSED) {
- char *function_name_strval = NULL;
- int function_name_strlen = 0;
- if (IS_CV == IS_CONST) {
- function_name_strval = Z_STRVAL_P(opline->op2.zv);
- function_name_strlen = Z_STRLEN_P(opline->op2.zv);
- } else {
- function_name = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
-
+ function_name = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
+ if (IS_CV != IS_CONST) {
if (UNEXPECTED(Z_TYPE_P(function_name) != IS_STRING)) {
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
zend_error_noreturn(E_ERROR, "Function name must be a string");
- } else {
- function_name_strval = Z_STRVAL_P(function_name);
- function_name_strlen = Z_STRLEN_P(function_name);
}
}
- if (function_name_strval) {
- if (ce->get_static_method) {
- call->fbc = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
+ if (ce->get_static_method) {
+ call->fbc = ce->get_static_method(ce, Z_STR_P(function_name) TSRMLS_CC);
+ } else {
+ call->fbc = zend_std_get_static_method(ce, Z_STR_P(function_name), ((IS_CV == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
+ }
+ if (UNEXPECTED(call->fbc == NULL)) {
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", ce->name->val, Z_STRVAL_P(function_name));
+ }
+ if (IS_CV == IS_CONST &&
+ EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
+ EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0)) {
+ if (IS_CONST == IS_CONST) {
+ CACHE_PTR(opline->op2.literal->cache_slot, call->fbc);
} else {
- call->fbc = zend_std_get_static_method(ce, function_name_strval, function_name_strlen, ((IS_CV == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
- }
- if (UNEXPECTED(call->fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", ce->name, function_name_strval);
- }
- if (IS_CV == IS_CONST &&
- EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
- EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0)) {
- if (IS_CONST == IS_CONST) {
- CACHE_PTR(opline->op2.literal->cache_slot, call->fbc);
- } else {
- CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce, call->fbc);
- }
+ CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce, call->fbc);
}
}
if (IS_CV != IS_CONST) {
@@ -7297,31 +7079,28 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CV_HANDLER(ZEN
if (UNEXPECTED(ce->constructor == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot call constructor");
}
- if (EG(This) && Z_OBJCE_P(EG(This)) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
- zend_error_noreturn(E_ERROR, "Cannot call private %s::__construct()", ce->name);
+ if (Z_TYPE(EG(This)) != IS_UNDEF && Z_OBJCE(EG(This)) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
+ zend_error_noreturn(E_ERROR, "Cannot call private %s::__construct()", ce->name->val);
}
call->fbc = ce->constructor;
}
if (call->fbc->common.fn_flags & ZEND_ACC_STATIC) {
- call->object = NULL;
+ ZVAL_UNDEF(&call->object);
} else {
- if (EG(This) &&
- Z_OBJ_HT_P(EG(This))->get_class_entry &&
- !instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) {
+ if (Z_TYPE(EG(This)) != IS_UNDEF &&
+ Z_OBJ_HT(EG(This))->get_class_entry &&
+ !instanceof_function(Z_OBJCE(EG(This)), ce TSRMLS_CC)) {
/* We are calling method of the other (incompatible) class,
but passing $this. This is done for compatibility with php-4. */
if (call->fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
- zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name);
+ zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name->val, call->fbc->common.function_name->val);
} else {
/* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */
- zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name);
+ zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", call->fbc->common.scope->name->val, call->fbc->common.function_name->val);
}
}
- if ((call->object = EG(This))) {
- Z_ADDREF_P(call->object);
- call->called_scope = Z_OBJCE_P(call->object);
- }
+ ZVAL_COPY(&call->object, &EG(This));
}
call->num_additional_args = 0;
@@ -7336,7 +7115,7 @@ static int ZEND_FASTCALL ZEND_CATCH_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_A
{
USE_OPLINE
zend_class_entry *ce, *catch_ce;
- zval *exception;
+ zend_object *exception;
SAVE_OPLINE();
/* Check whether an exception has been thrown, if not, jump over code */
@@ -7348,11 +7127,12 @@ static int ZEND_FASTCALL ZEND_CATCH_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_A
if (CACHED_PTR(opline->op1.literal->cache_slot)) {
catch_ce = CACHED_PTR(opline->op1.literal->cache_slot);
} else {
- catch_ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, ZEND_FETCH_CLASS_NO_AUTOLOAD TSRMLS_CC);
+ catch_ce = zend_fetch_class_by_name(Z_STR_P(opline->op1.zv), opline->op1.literal + 1, ZEND_FETCH_CLASS_NO_AUTOLOAD TSRMLS_CC);
CACHE_PTR(opline->op1.literal->cache_slot, catch_ce);
}
- ce = Z_OBJCE_P(EG(exception));
+//??? ce = Z_OBJCE_P(EG(exception));
+ ce = EG(exception)->ce;
#ifdef HAVE_DTRACE
if (DTRACE_EXCEPTION_CAUGHT_ENABLED()) {
@@ -7372,19 +7152,17 @@ static int ZEND_FASTCALL ZEND_CATCH_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_A
}
exception = EG(exception);
- if (!EG(active_symbol_table)) {
- if (EX_CV(opline->op2.var)) {
- zval_ptr_dtor(EX_CV(opline->op2.var));
- }
- EX_CV(opline->op2.var) = (zval**)EX_CV_NUM(execute_data, EX(op_array)->last_var + opline->op2.var);
- *EX_CV(opline->op2.var) = EG(exception);
- } else {
- zend_compiled_variable *cv = &CV_DEF_OF(opline->op2.var);
- zend_hash_quick_update(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value,
- &EG(exception), sizeof(zval *), (void**)&EX_CV(opline->op2.var));
+ if (Z_REFCOUNTED_P(EX_VAR_NUM(opline->op2.var))) {
+ zval_ptr_dtor(EX_VAR_NUM(opline->op2.var));
+ }
+ ZVAL_OBJ(EX_VAR_NUM(opline->op2.var), EG(exception));
+ if (EG(active_symbol_table)) {
+ zend_string *cv = CV_DEF_OF(opline->op2.var);
+ // TODO: indirect???
+ zend_hash_update(EG(active_symbol_table), cv, EX_VAR_NUM(opline->op2.var));
}
if (UNEXPECTED(EG(exception) != exception)) {
- Z_ADDREF_P(EG(exception));
+ EG(exception)->gc.refcount++;
HANDLE_EXCEPTION();
} else {
EG(exception) = NULL;
@@ -7398,7 +7176,7 @@ static int ZEND_FASTCALL ZEND_CASE_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_AR
SAVE_OPLINE();
- is_equal_function(&EX_T(opline->result.var).tmp_var,
+ is_equal_function(EX_VAR(opline->result.var),
opline->op1.zv,
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
@@ -7414,29 +7192,24 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CV_HANDLER(ZEND_OPCO
SAVE_OPLINE();
if ((IS_CONST == IS_VAR || IS_CONST == IS_CV) && opline->extended_value) {
- zval **expr_ptr_ptr = NULL;
-
- if (IS_CONST == IS_VAR && UNEXPECTED(expr_ptr_ptr == NULL)) {
+ expr_ptr = opline->op1.zv;
+ if (IS_CONST == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets");
}
- SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr_ptr);
- expr_ptr = *expr_ptr_ptr;
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr);
Z_ADDREF_P(expr_ptr);
} else {
expr_ptr=opline->op1.zv;
if (0) { /* temporary variable */
- zval *new_expr;
+ zval new_expr;
- ALLOC_ZVAL(new_expr);
- INIT_PZVAL_COPY(new_expr, expr_ptr);
- expr_ptr = new_expr;
- } else if (IS_CONST == IS_CONST || PZVAL_IS_REF(expr_ptr)) {
- zval *new_expr;
+ ZVAL_COPY_VALUE(&new_expr, expr_ptr);
+ expr_ptr = &new_expr;
+ } else if (IS_CONST == IS_CONST || Z_ISREF_P(expr_ptr)) {
+ zval new_expr;
- ALLOC_ZVAL(new_expr);
- INIT_PZVAL_COPY(new_expr, expr_ptr);
- expr_ptr = new_expr;
- zendi_zval_copy_ctor(*expr_ptr);
+ ZVAL_DUP(&new_expr, expr_ptr);
+ expr_ptr = &new_expr;
} else if (IS_CONST == IS_CV) {
Z_ADDREF_P(expr_ptr);
@@ -7456,29 +7229,26 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CV_HANDLER(ZEND_OPCO
case IS_BOOL:
hval = Z_LVAL_P(offset);
num_index:
- zend_hash_index_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), hval, &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr);
break;
case IS_STRING:
- if (IS_CV == IS_CONST) {
- hval = Z_HASH_P(offset);
- } else {
+ if (IS_CV != IS_CONST) {
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index);
- hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset));
}
- zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), Z_STR_P(offset), expr_ptr);
break;
case IS_NULL:
- zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), STR_EMPTY_ALLOC(), expr_ptr);
break;
default:
zend_error(E_WARNING, "Illegal offset type");
- zval_ptr_dtor(&expr_ptr);
+ zval_ptr_dtor(expr_ptr);
/* do nothing */
break;
}
} else {
- zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr);
}
if ((IS_CONST == IS_VAR || IS_CONST == IS_CV) && opline->extended_value) {
@@ -7491,7 +7261,7 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HAND
{
USE_OPLINE
- array_init(&EX_T(opline->result.var).tmp_var);
+ array_init(EX_VAR(opline->result.var));
if (IS_CONST == IS_UNUSED) {
ZEND_VM_NEXT_OPCODE();
#if 0 || IS_CONST != IS_UNUSED
@@ -7503,6 +7273,9 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HAND
static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
+//???
+return 0;
+#if 0
USE_OPLINE
/* The generator object is stored in return_value_ptr_ptr */
@@ -7545,7 +7318,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_A
generator->value = copy;
} else {
- zval **value_ptr = NULL;
+ zval **value_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W);
if (IS_CONST == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
@@ -7573,7 +7346,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_A
/* Consts, temporary variables and references need copying */
if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR
- || PZVAL_IS_REF(value)
+ || Z_ISREF_P(value)
) {
zval *copy;
@@ -7607,7 +7380,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_A
/* Consts, temporary variables and references need copying */
if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR
- || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0)
+ || (Z_ISREF_P(key) && Z_REFCOUNT_P(key) > 0)
) {
zval *copy;
@@ -7658,6 +7431,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_A
SAVE_OPLINE();
ZEND_VM_RETURN();
+#endif
}
static int ZEND_FASTCALL ZEND_BW_NOT_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -7666,7 +7440,7 @@ static int ZEND_FASTCALL ZEND_BW_NOT_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_free_op free_op1;
SAVE_OPLINE();
- bitwise_not_function(&EX_T(opline->result.var).tmp_var,
+ bitwise_not_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC) TSRMLS_CC);
zval_dtor(free_op1.var);
CHECK_EXCEPTION();
@@ -7679,7 +7453,7 @@ static int ZEND_FASTCALL ZEND_BOOL_NOT_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG
zend_free_op free_op1;
SAVE_OPLINE();
- boolean_not_function(&EX_T(opline->result.var).tmp_var,
+ boolean_not_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC) TSRMLS_CC);
zval_dtor(free_op1.var);
CHECK_EXCEPTION();
@@ -7696,7 +7470,7 @@ static int ZEND_FASTCALL ZEND_ECHO_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
z = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (IS_TMP_VAR == IS_TMP_VAR && Z_TYPE_P(z) == IS_OBJECT) {
- INIT_PZVAL(z);
+//??? INIT_PZVAL(z);
}
zend_print_variable(z);
@@ -7709,7 +7483,7 @@ static int ZEND_FASTCALL ZEND_PRINT_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- ZVAL_LONG(&EX_T(opline->result.var).tmp_var, 1);
+ ZVAL_LONG(EX_VAR(opline->result.var), 1);
return ZEND_ECHO_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
@@ -7826,8 +7600,7 @@ static int ZEND_FASTCALL ZEND_JMPZ_EX_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS
HANDLE_EXCEPTION();
}
}
- Z_LVAL(EX_T(opline->result.var).tmp_var) = retval;
- Z_TYPE(EX_T(opline->result.var).tmp_var) = IS_BOOL;
+ ZVAL_BOOL(EX_VAR(opline->result.var), retval);
if (!retval) {
#if DEBUG_ZEND>=2
printf("Conditional jmp to %d\n", opline->op2.opline_num);
@@ -7857,8 +7630,7 @@ static int ZEND_FASTCALL ZEND_JMPNZ_EX_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG
HANDLE_EXCEPTION();
}
}
- Z_LVAL(EX_T(opline->result.var).tmp_var) = retval;
- Z_TYPE(EX_T(opline->result.var).tmp_var) = IS_BOOL;
+ ZVAL_BOOL(EX_VAR(opline->result.var), retval);
if (retval) {
#if DEBUG_ZEND>=2
printf("Conditional jmp to %d\n", opline->op2.opline_num);
@@ -7875,9 +7647,9 @@ static int ZEND_FASTCALL ZEND_FREE_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
SAVE_OPLINE();
if (IS_TMP_VAR == IS_TMP_VAR) {
- zendi_zval_dtor(EX_T(opline->op1.var).tmp_var);
+ zval_dtor(EX_VAR(opline->op1.var));
} else {
- zval_ptr_dtor(&EX_T(opline->op1.var).var.ptr);
+ zval_ptr_dtor(EX_VAR(opline->op1.var));
}
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -7892,32 +7664,22 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
SAVE_OPLINE();
retval_ptr = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (!EG(return_value_ptr_ptr)) {
+ if (/*???!EG(return_value_ptr_ptr)*/0) {
zval_dtor(free_op1.var);
} else {
if (IS_TMP_VAR == IS_CONST ||
IS_TMP_VAR == IS_TMP_VAR ||
- PZVAL_IS_REF(retval_ptr)) {
- zval *ret;
+ Z_ISREF_P(retval_ptr)) {
+ zval ret;
- ALLOC_ZVAL(ret);
- INIT_PZVAL_COPY(ret, retval_ptr);
+ ZVAL_COPY_VALUE(&ret, retval_ptr);
if (IS_TMP_VAR != IS_TMP_VAR) {
- zval_copy_ctor(ret);
+ zval_copy_ctor(&ret);
}
- *EG(return_value_ptr_ptr) = ret;
-
- } else if ((IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) &&
- retval_ptr == &EG(uninitialized_zval)) {
- zval *ret;
+//??? *EG(return_value_ptr_ptr) = ret;
- if (IS_TMP_VAR == IS_VAR) {
- Z_DELREF_P(retval_ptr);
- }
- ALLOC_INIT_ZVAL(ret);
- *EG(return_value_ptr_ptr) = ret;
} else {
- *EG(return_value_ptr_ptr) = retval_ptr;
+//??? *EG(return_value_ptr_ptr) = retval_ptr;
if (IS_TMP_VAR == IS_CV) {
Z_ADDREF_P(retval_ptr);
}
@@ -7930,7 +7692,6 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLE
{
USE_OPLINE
zval *retval_ptr;
- zval **retval_ptr_ptr;
zend_free_op free_op1;
SAVE_OPLINE();
@@ -7942,33 +7703,32 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLE
zend_error(E_NOTICE, "Only variable references should be returned by reference");
retval_ptr = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (!EG(return_value_ptr_ptr)) {
+ if (/*???!EG(return_value_ptr_ptr)*/0) {
if (IS_TMP_VAR == IS_TMP_VAR) {
zval_dtor(free_op1.var);
}
} else if (!1) { /* Not a temp var */
- zval *ret;
+ zval ret;
- ALLOC_ZVAL(ret);
- INIT_PZVAL_COPY(ret, retval_ptr);
- zval_copy_ctor(ret);
- *EG(return_value_ptr_ptr) = ret;
+ ZVAL_DUP(&ret, retval_ptr);
+//??? *EG(return_value_ptr_ptr) = ret;
} else {
- zval *ret;
+ zval ret;
- ALLOC_ZVAL(ret);
- INIT_PZVAL_COPY(ret, retval_ptr);
- *EG(return_value_ptr_ptr) = ret;
+ ZVAL_COPY_VALUE(&ret, retval_ptr);
+//??? *EG(return_value_ptr_ptr) = ret;
}
break;
}
- retval_ptr_ptr = NULL;
+ retval_ptr = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_TMP_VAR == IS_VAR && UNEXPECTED(retval_ptr_ptr == NULL)) {
+ if (IS_TMP_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(retval_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot return string offsets by reference");
}
+//???
+#if 0
if (IS_TMP_VAR == IS_VAR && !Z_ISREF_PP(retval_ptr_ptr)) {
if (opline->extended_value == ZEND_RETURNS_FUNCTION &&
EX_T(opline->op1.var).var.fcall_returned_reference) {
@@ -7978,8 +7738,7 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLE
zval *ret;
ALLOC_ZVAL(ret);
- INIT_PZVAL_COPY(ret, *retval_ptr_ptr);
- zval_copy_ctor(ret);
+ INIT_DUP(ret, *retval_ptr_ptr);
*EG(return_value_ptr_ptr) = ret;
}
break;
@@ -7992,6 +7751,7 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLE
*EG(return_value_ptr_ptr) = *retval_ptr_ptr;
}
+#endif
} while (0);
return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
@@ -8001,7 +7761,7 @@ static int ZEND_FASTCALL ZEND_THROW_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
zval *value;
- zval *exception;
+ zval exception;
zend_free_op free_op1;
SAVE_OPLINE();
@@ -8016,13 +7776,12 @@ static int ZEND_FASTCALL ZEND_THROW_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_exception_save(TSRMLS_C);
/* Not sure if a complete copy is what we want here */
- ALLOC_ZVAL(exception);
- INIT_PZVAL_COPY(exception, value);
+ ZVAL_COPY_VALUE(&exception, value);
if (!1) {
- zval_copy_ctor(exception);
+ zval_copy_ctor(&exception);
}
- zend_throw_exception_object(exception TSRMLS_CC);
+ zend_throw_exception_object(&exception TSRMLS_CC);
zend_exception_restore(TSRMLS_C);
HANDLE_EXCEPTION();
@@ -8041,18 +7800,17 @@ static int ZEND_FASTCALL ZEND_SEND_VAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG
}
{
- zval *valptr;
+ zval valptr;
zval *value;
zend_free_op free_op1;
value = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- ALLOC_ZVAL(valptr);
- INIT_PZVAL_COPY(valptr, value);
+ ZVAL_COPY_VALUE(&valptr, value);
if (!1) {
- zval_copy_ctor(valptr);
+ zval_copy_ctor(&valptr);
}
- zend_vm_stack_push(valptr TSRMLS_CC);
+ zend_vm_stack_push(&valptr TSRMLS_CC);
}
CHECK_EXCEPTION();
@@ -8063,7 +7821,7 @@ static int ZEND_FASTCALL ZEND_BOOL_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
zend_free_op free_op1;
- zval *retval = &EX_T(opline->result.var).tmp_var;
+ zval *retval = EX_VAR(opline->result.var);
SAVE_OPLINE();
/* PHP 3.0 returned "" for false and 1 for true, here we use 0 and 1 for now */
@@ -8110,29 +7868,22 @@ static int ZEND_FASTCALL ZEND_CLONE_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
/* Ensure that if we're calling a private function, we're allowed to do so.
*/
if (UNEXPECTED(ce != EG(scope))) {
- zend_error_noreturn(E_ERROR, "Call to private %s::__clone() from context '%s'", ce->name, EG(scope) ? EG(scope)->name : "");
+ zend_error_noreturn(E_ERROR, "Call to private %s::__clone() from context '%s'", ce->name->val, EG(scope) ? EG(scope)->name->val : "");
}
} else if ((clone->common.fn_flags & ZEND_ACC_PROTECTED)) {
/* Ensure that if we're calling a protected function, we're allowed to do so.
*/
if (UNEXPECTED(!zend_check_protected(zend_get_function_root_class(clone), EG(scope)))) {
- zend_error_noreturn(E_ERROR, "Call to protected %s::__clone() from context '%s'", ce->name, EG(scope) ? EG(scope)->name : "");
+ zend_error_noreturn(E_ERROR, "Call to protected %s::__clone() from context '%s'", ce->name->val, EG(scope) ? EG(scope)->name->val : "");
}
}
}
if (EXPECTED(EG(exception) == NULL)) {
- zval *retval;
-
- ALLOC_ZVAL(retval);
- Z_OBJVAL_P(retval) = clone_call(obj TSRMLS_CC);
- Z_TYPE_P(retval) = IS_OBJECT;
- Z_SET_REFCOUNT_P(retval, 1);
- Z_SET_ISREF_P(retval);
+ ZVAL_OBJ(EX_VAR(opline->result.var), clone_call(obj TSRMLS_CC));
+//??? Z_SET_ISREF_P(retval);
if (!RETURN_VALUE_USED(opline) || UNEXPECTED(EG(exception) != NULL)) {
- zval_ptr_dtor(&retval);
- } else {
- EX_T(opline->result.var).var.ptr = retval;
+ zval_ptr_dtor(EX_VAR(opline->result.var));
}
}
@@ -8145,7 +7896,7 @@ static int ZEND_FASTCALL ZEND_CAST_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
USE_OPLINE
zend_free_op free_op1;
zval *expr;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
expr = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
@@ -8153,7 +7904,7 @@ static int ZEND_FASTCALL ZEND_CAST_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
if (opline->extended_value != IS_STRING) {
ZVAL_COPY_VALUE(result, expr);
if (!1) {
- zendi_zval_copy_ctor(*result);
+ zval_copy_ctor(result);
}
}
switch (opline->extended_value) {
@@ -8182,7 +7933,7 @@ static int ZEND_FASTCALL ZEND_CAST_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
} else {
ZVAL_COPY_VALUE(result, expr);
if (!1) {
- zendi_zval_copy_ctor(*result);
+ zval_copy_ctor(result);
}
}
break;
@@ -8205,18 +7956,17 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HAND
zend_op_array *new_op_array=NULL;
zend_free_op free_op1;
zval *inc_filename;
- zval *tmp_inc_filename = NULL;
+ zval tmp_inc_filename;
zend_bool failure_retval=0;
SAVE_OPLINE();
inc_filename = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ ZVAL_UNDEF(&tmp_inc_filename);
if (inc_filename->type!=IS_STRING) {
- MAKE_STD_ZVAL(tmp_inc_filename);
- ZVAL_COPY_VALUE(tmp_inc_filename, inc_filename);
- zval_copy_ctor(tmp_inc_filename);
- convert_to_string(tmp_inc_filename);
- inc_filename = tmp_inc_filename;
+ ZVAL_DUP(&tmp_inc_filename, inc_filename);
+ convert_to_string(&tmp_inc_filename);
+ inc_filename = &tmp_inc_filename;
}
if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRLEN_P(inc_filename)) {
@@ -8234,7 +7984,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HAND
resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename) TSRMLS_CC);
if (resolved_path) {
- failure_retval = zend_hash_exists(&EG(included_files), resolved_path, strlen(resolved_path)+1);
+//??? failure_retval = zend_hash_exists(&EG(included_files), resolved_path, strlen(resolved_path)+1);
} else {
resolved_path = Z_STRVAL_P(inc_filename);
}
@@ -8247,13 +7997,13 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HAND
file_handle.opened_path = estrdup(resolved_path);
}
- if (zend_hash_add_empty_element(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path)+1)==SUCCESS) {
- new_op_array = zend_compile_file(&file_handle, (opline->extended_value==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC);
- zend_destroy_file_handle(&file_handle TSRMLS_CC);
- } else {
- zend_file_handle_dtor(&file_handle TSRMLS_CC);
- failure_retval=1;
- }
+//??? if (zend_hash_add_empty_element(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path)+1)==SUCCESS) {
+//??? new_op_array = zend_compile_file(&file_handle, (opline->extended_value==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC);
+//??? zend_destroy_file_handle(&file_handle TSRMLS_CC);
+//??? } else {
+//??? zend_file_handle_dtor(&file_handle TSRMLS_CC);
+//??? failure_retval=1;
+//??? }
} else {
if (opline->extended_value == ZEND_INCLUDE_ONCE) {
zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC);
@@ -8280,24 +8030,24 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HAND
EMPTY_SWITCH_DEFAULT_CASE()
}
}
- if (tmp_inc_filename) {
+ if (Z_TYPE(tmp_inc_filename) != IS_UNDEF) {
zval_ptr_dtor(&tmp_inc_filename);
}
zval_dtor(free_op1.var);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
} else if (EXPECTED(new_op_array != NULL)) {
- EX(original_return_value) = EG(return_value_ptr_ptr);
+//??? EX(original_return_value) = EG(return_value_ptr_ptr);
EG(active_op_array) = new_op_array;
if (RETURN_VALUE_USED(opline)) {
- EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
- EG(return_value_ptr_ptr) = EX_T(opline->result.var).var.ptr_ptr;
+//??? EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
+//??? EG(return_value_ptr_ptr) = EX_T(opline->result.var).var.ptr_ptr;
} else {
- EG(return_value_ptr_ptr) = NULL;
+//??? EG(return_value_ptr_ptr) = NULL;
}
EX(function_state).function = (zend_function *) new_op_array;
- EX(object) = NULL;
+ ZVAL_UNDEF(&EX(object));
if (!EG(active_symbol_table)) {
zend_rebuild_symbol_table(TSRMLS_C);
@@ -8313,7 +8063,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HAND
EG(opline_ptr) = &EX(opline);
EG(active_op_array) = EX(op_array);
- EG(return_value_ptr_ptr) = EX(original_return_value);
+//??? EG(return_value_ptr_ptr) = EX(original_return_value);
destroy_op_array(new_op_array TSRMLS_CC);
efree(new_op_array);
if (UNEXPECTED(EG(exception) != NULL)) {
@@ -8322,12 +8072,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HAND
}
} else if (RETURN_VALUE_USED(opline)) {
- zval *retval;
-
- ALLOC_ZVAL(retval);
- ZVAL_BOOL(retval, failure_retval);
- INIT_PZVAL(retval);
- EX_T(opline->result.var).var.ptr = retval;
+ ZVAL_BOOL(EX_VAR(opline->result.var), failure_retval);
}
ZEND_VM_NEXT_OPCODE();
}
@@ -8336,7 +8081,7 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG
{
USE_OPLINE
zend_free_op free_op1;
- zval *array_ptr, **array_ptr_ptr;
+ zval *array_ptr;
HashTable *fe_ht;
zend_object_iterator *iter = NULL;
zend_class_entry *ce = NULL;
@@ -8346,40 +8091,35 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG
if ((IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) &&
(opline->extended_value & ZEND_FE_RESET_VARIABLE)) {
- array_ptr_ptr = NULL;
- if (array_ptr_ptr == NULL || array_ptr_ptr == &EG(uninitialized_zval_ptr)) {
- MAKE_STD_ZVAL(array_ptr);
- ZVAL_NULL(array_ptr);
- } else if (Z_TYPE_PP(array_ptr_ptr) == IS_OBJECT) {
- if(Z_OBJ_HT_PP(array_ptr_ptr)->get_class_entry == NULL) {
+ array_ptr = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ if (Z_TYPE_P(array_ptr) == IS_NULL) {
+ } else if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
+ if(Z_OBJ_HT_P(array_ptr)->get_class_entry == NULL) {
zend_error(E_WARNING, "foreach() cannot iterate over objects without PHP class");
ZEND_VM_JMP(EX(op_array)->opcodes+opline->op2.opline_num);
}
- ce = Z_OBJCE_PP(array_ptr_ptr);
+ ce = Z_OBJCE_P(array_ptr);
if (!ce || ce->get_iterator == NULL) {
- SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr);
- Z_ADDREF_PP(array_ptr_ptr);
+ SEPARATE_ZVAL_IF_NOT_REF(array_ptr);
+ Z_ADDREF_P(array_ptr);
}
- array_ptr = *array_ptr_ptr;
} else {
- if (Z_TYPE_PP(array_ptr_ptr) == IS_ARRAY) {
- SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr);
+ if (Z_TYPE_P(array_ptr) == IS_ARRAY) {
+ SEPARATE_ZVAL_IF_NOT_REF(array_ptr);
if (opline->extended_value & ZEND_FE_FETCH_BYREF) {
- Z_SET_ISREF_PP(array_ptr_ptr);
+ ZVAL_NEW_REF(array_ptr, array_ptr);
}
}
- array_ptr = *array_ptr_ptr;
Z_ADDREF_P(array_ptr);
}
} else {
array_ptr = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (1) { /* IS_TMP_VAR */
- zval *tmp;
+ zval tmp;
- ALLOC_ZVAL(tmp);
- INIT_PZVAL_COPY(tmp, array_ptr);
- array_ptr = tmp;
+ ZVAL_COPY_VALUE(&tmp, array_ptr);
+ array_ptr = &tmp;
if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
ce = Z_OBJCE_P(array_ptr);
if (ce && ce->get_iterator) {
@@ -8400,15 +8140,13 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG
(IS_TMP_VAR == IS_VAR &&
!Z_ISREF_P(array_ptr) &&
Z_REFCOUNT_P(array_ptr) > 2)) {
- zval *tmp;
+ zval tmp;
if (IS_TMP_VAR == IS_VAR) {
Z_DELREF_P(array_ptr);
}
- ALLOC_ZVAL(tmp);
- INIT_PZVAL_COPY(tmp, array_ptr);
- zval_copy_ctor(tmp);
- array_ptr = tmp;
+ ZVAL_DUP(&tmp, array_ptr);
+ array_ptr = &tmp;
} else if (IS_TMP_VAR == IS_CV) {
Z_ADDREF_P(array_ptr);
}
@@ -8434,14 +8172,14 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG
}
}
- EX_T(opline->result.var).fe.ptr = array_ptr;
+ ZVAL_COPY_VALUE(EX_VAR(opline->result.var), array_ptr);
if (iter) {
iter->index = 0;
if (iter->funcs->rewind) {
iter->funcs->rewind(iter TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
- zval_ptr_dtor(&array_ptr);
+ zval_ptr_dtor(array_ptr);
if (IS_TMP_VAR == IS_VAR && opline->extended_value & ZEND_FE_RESET_VARIABLE) {
}
@@ -8450,7 +8188,7 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG
}
is_empty = iter->funcs->valid(iter TSRMLS_CC) != SUCCESS;
if (UNEXPECTED(EG(exception) != NULL)) {
- zval_ptr_dtor(&array_ptr);
+ zval_ptr_dtor(array_ptr);
if (IS_TMP_VAR == IS_VAR && opline->extended_value & ZEND_FE_RESET_VARIABLE) {
}
@@ -8460,24 +8198,23 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG
} else if ((fe_ht = HASH_OF(array_ptr)) != NULL) {
zend_hash_internal_pointer_reset(fe_ht);
if (ce) {
- zend_object *zobj = zend_objects_get_address(array_ptr TSRMLS_CC);
+ zend_object *zobj = Z_OBJ_P(array_ptr);
while (zend_hash_has_more_elements(fe_ht) == SUCCESS) {
- char *str_key;
- uint str_key_len;
+ zend_string *str_key;
ulong int_key;
zend_uchar key_type;
- key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &str_key_len, &int_key, 0, NULL);
+ key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &int_key, 0, NULL);
if (key_type != HASH_KEY_NON_EXISTENT &&
(key_type == HASH_KEY_IS_LONG ||
- zend_check_property_access(zobj, str_key, str_key_len-1 TSRMLS_CC) == SUCCESS)) {
+ zend_check_property_access(zobj, str_key TSRMLS_CC) == SUCCESS)) {
break;
}
zend_hash_move_forward(fe_ht);
}
}
is_empty = zend_hash_has_more_elements(fe_ht) != SUCCESS;
- zend_hash_get_pointer(fe_ht, &EX_T(opline->result.var).fe.fe_pos);
+//??? zend_hash_get_pointer(fe_ht, EX_VAR(opline->result.var));
} else {
zend_error(E_WARNING, "Invalid argument supplied for foreach()");
is_empty = 1;
@@ -8522,9 +8259,8 @@ static int ZEND_FASTCALL ZEND_END_SILENCE_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_
zval restored_error_reporting;
SAVE_OPLINE();
- if (!EG(error_reporting) && Z_LVAL(EX_T(opline->op1.var).tmp_var) != 0) {
- Z_TYPE(restored_error_reporting) = IS_LONG;
- Z_LVAL(restored_error_reporting) = Z_LVAL(EX_T(opline->op1.var).tmp_var);
+ if (!EG(error_reporting) && Z_LVAL_P(EX_VAR(opline->op1.var)) != 0) {
+ ZVAL_LONG(&restored_error_reporting, Z_LVAL_P(EX_VAR(opline->op1.var)));
EG(error_reporting) = Z_LVAL(restored_error_reporting);
convert_to_string(&restored_error_reporting);
if (EXPECTED(EG(error_reporting_ini_entry) != NULL)) {
@@ -8535,12 +8271,12 @@ static int ZEND_FASTCALL ZEND_END_SILENCE_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_
EG(error_reporting_ini_entry)->value = Z_STRVAL(restored_error_reporting);
EG(error_reporting_ini_entry)->value_length = Z_STRLEN(restored_error_reporting);
} else {
- zendi_zval_dtor(restored_error_reporting);
+ zval_dtor(&restored_error_reporting);
}
}
- if (EX(old_error_reporting) == &EX_T(opline->op1.var).tmp_var) {
- EX(old_error_reporting) = NULL;
- }
+//??? if (EX(old_error_reporting) == EX_VAR(opline->op1.var)) {
+//??? EX(old_error_reporting) = NULL;
+//??? }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -8555,9 +8291,9 @@ static int ZEND_FASTCALL ZEND_JMP_SET_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS
value = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (i_zend_is_true(value TSRMLS_CC)) {
- ZVAL_COPY_VALUE(&EX_T(opline->result.var).tmp_var, value);
+ ZVAL_COPY_VALUE(EX_VAR(opline->result.var), value);
if (!1) {
- zendi_zval_copy_ctor(EX_T(opline->result.var).tmp_var);
+ zval_copy_ctor(EX_VAR(opline->result.var));
}
#if DEBUG_ZEND>=2
@@ -8575,23 +8311,19 @@ static int ZEND_FASTCALL ZEND_JMP_SET_VAR_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_
{
USE_OPLINE
zend_free_op free_op1;
- zval *value, *ret;
+ zval *value;
SAVE_OPLINE();
value = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (i_zend_is_true(value TSRMLS_CC)) {
if (IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) {
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
Z_ADDREF_P(value);
- EX_T(opline->result.var).var.ptr = value;
- EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
} else {
- ALLOC_ZVAL(ret);
- INIT_PZVAL_COPY(ret, value);
- EX_T(opline->result.var).var.ptr = ret;
- EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
+ ZVAL_COPY_VALUE(EX_VAR(opline->result.var), value);
if (!1) {
- zval_copy_ctor(EX_T(opline->result.var).var.ptr);
+ zval_copy_ctor(EX_VAR(opline->result.var));
}
}
@@ -8615,9 +8347,9 @@ static int ZEND_FASTCALL ZEND_QM_ASSIGN_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR
SAVE_OPLINE();
value = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- ZVAL_COPY_VALUE(&EX_T(opline->result.var).tmp_var, value);
+ ZVAL_COPY_VALUE(EX_VAR(opline->result.var), value);
if (!1) {
- zval_copy_ctor(&EX_T(opline->result.var).tmp_var);
+ zval_copy_ctor(EX_VAR(opline->result.var));
}
CHECK_EXCEPTION();
@@ -8628,22 +8360,17 @@ static int ZEND_FASTCALL ZEND_QM_ASSIGN_VAR_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLE
{
USE_OPLINE
zend_free_op free_op1;
- zval *value, *ret;
+ zval *value;
SAVE_OPLINE();
value = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) {
- Z_ADDREF_P(value);
- EX_T(opline->result.var).var.ptr = value;
- EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
} else {
- ALLOC_ZVAL(ret);
- INIT_PZVAL_COPY(ret, value);
- EX_T(opline->result.var).var.ptr = ret;
- EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
+ ZVAL_COPY_VALUE(EX_VAR(opline->result.var), value);
if (!1) {
- zval_copy_ctor(EX_T(opline->result.var).var.ptr);
+ zval_copy_ctor(EX_VAR(opline->result.var));
}
}
@@ -8662,11 +8389,11 @@ static int ZEND_FASTCALL ZEND_INSTANCEOF_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_A
expr = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (Z_TYPE_P(expr) == IS_OBJECT && Z_OBJ_HT_P(expr)->get_class_entry) {
- result = instanceof_function(Z_OBJCE_P(expr), EX_T(opline->op2.var).class_entry TSRMLS_CC);
+ result = instanceof_function(Z_OBJCE_P(expr), Z_CE_P(EX_VAR(opline->op2.var)) TSRMLS_CC);
} else {
result = 0;
}
- ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, result);
+ ZVAL_BOOL(EX_VAR(opline->result.var), result);
zval_dtor(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -8678,7 +8405,7 @@ static int ZEND_FASTCALL ZEND_ADD_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_AR
zend_free_op free_op1;
SAVE_OPLINE();
- fast_add_function(&EX_T(opline->result.var).tmp_var,
+ fast_add_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
zval_dtor(free_op1.var);
@@ -8693,7 +8420,7 @@ static int ZEND_FASTCALL ZEND_SUB_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_AR
zend_free_op free_op1;
SAVE_OPLINE();
- fast_sub_function(&EX_T(opline->result.var).tmp_var,
+ fast_sub_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
zval_dtor(free_op1.var);
@@ -8708,7 +8435,7 @@ static int ZEND_FASTCALL ZEND_MUL_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_AR
zend_free_op free_op1;
SAVE_OPLINE();
- fast_mul_function(&EX_T(opline->result.var).tmp_var,
+ fast_mul_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
zval_dtor(free_op1.var);
@@ -8723,7 +8450,7 @@ static int ZEND_FASTCALL ZEND_DIV_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_AR
zend_free_op free_op1;
SAVE_OPLINE();
- fast_div_function(&EX_T(opline->result.var).tmp_var,
+ fast_div_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
zval_dtor(free_op1.var);
@@ -8738,7 +8465,7 @@ static int ZEND_FASTCALL ZEND_MOD_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_AR
zend_free_op free_op1;
SAVE_OPLINE();
- fast_mod_function(&EX_T(opline->result.var).tmp_var,
+ fast_mod_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
zval_dtor(free_op1.var);
@@ -8753,7 +8480,7 @@ static int ZEND_FASTCALL ZEND_SL_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG
zend_free_op free_op1;
SAVE_OPLINE();
- shift_left_function(&EX_T(opline->result.var).tmp_var,
+ shift_left_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
zval_dtor(free_op1.var);
@@ -8768,7 +8495,7 @@ static int ZEND_FASTCALL ZEND_SR_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG
zend_free_op free_op1;
SAVE_OPLINE();
- shift_right_function(&EX_T(opline->result.var).tmp_var,
+ shift_right_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
zval_dtor(free_op1.var);
@@ -8783,7 +8510,7 @@ static int ZEND_FASTCALL ZEND_CONCAT_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER
zend_free_op free_op1;
SAVE_OPLINE();
- concat_function(&EX_T(opline->result.var).tmp_var,
+ concat_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
zval_dtor(free_op1.var);
@@ -8798,7 +8525,7 @@ static int ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_H
zend_free_op free_op1;
SAVE_OPLINE();
- is_identical_function(&EX_T(opline->result.var).tmp_var,
+ is_identical_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
zval_dtor(free_op1.var);
@@ -8811,7 +8538,7 @@ static int ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_TMP_CONST_HANDLER(ZEND_OPCO
{
USE_OPLINE
zend_free_op free_op1;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
is_identical_function(result,
@@ -8828,7 +8555,7 @@ static int ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDL
{
USE_OPLINE
zend_free_op free_op1;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_equal_function(result,
@@ -8844,7 +8571,7 @@ static int ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_H
{
USE_OPLINE
zend_free_op free_op1;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_not_equal_function(result,
@@ -8860,7 +8587,7 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HAN
{
USE_OPLINE
zend_free_op free_op1;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_is_smaller_function(result,
@@ -8876,7 +8603,7 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_TMP_CONST_HANDLER(ZEND_O
{
USE_OPLINE
zend_free_op free_op1;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_is_smaller_or_equal_function(result,
@@ -8894,7 +8621,7 @@ static int ZEND_FASTCALL ZEND_BW_OR_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_
zend_free_op free_op1;
SAVE_OPLINE();
- bitwise_or_function(&EX_T(opline->result.var).tmp_var,
+ bitwise_or_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
zval_dtor(free_op1.var);
@@ -8909,7 +8636,7 @@ static int ZEND_FASTCALL ZEND_BW_AND_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER
zend_free_op free_op1;
SAVE_OPLINE();
- bitwise_and_function(&EX_T(opline->result.var).tmp_var,
+ bitwise_and_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
zval_dtor(free_op1.var);
@@ -8924,7 +8651,7 @@ static int ZEND_FASTCALL ZEND_BW_XOR_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER
zend_free_op free_op1;
SAVE_OPLINE();
- bitwise_xor_function(&EX_T(opline->result.var).tmp_var,
+ bitwise_xor_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
zval_dtor(free_op1.var);
@@ -8939,7 +8666,7 @@ static int ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDL
zend_free_op free_op1;
SAVE_OPLINE();
- boolean_xor_function(&EX_T(opline->result.var).tmp_var,
+ boolean_xor_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
zval_dtor(free_op1.var);
@@ -8953,19 +8680,17 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_CONST(int type,
USE_OPLINE
zend_free_op free_op1;
zval *varname;
- zval **retval;
+ zval *retval;
zval tmp_varname;
HashTable *target_symbol_table;
- ulong hash_value;
SAVE_OPLINE();
varname = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (IS_TMP_VAR != IS_CONST && UNEXPECTED(Z_TYPE_P(varname) != IS_STRING)) {
- ZVAL_COPY_VALUE(&tmp_varname, varname);
- zval_copy_ctor(&tmp_varname);
- Z_SET_REFCOUNT(tmp_varname, 1);
- Z_UNSET_ISREF(tmp_varname);
+ ZVAL_DUP(&tmp_varname, varname);
+//??? Z_SET_REFCOUNT(tmp_varname, 1);
+//??? Z_UNSET_ISREF(tmp_varname);
convert_to_string(&tmp_varname);
varname = &tmp_varname;
}
@@ -8977,7 +8702,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_CONST(int type,
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
ce = CACHED_PTR(opline->op2.literal->cache_slot);
} else {
- ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
if (IS_TMP_VAR != IS_CONST && varname == &tmp_varname) {
zval_dtor(&tmp_varname);
@@ -8989,9 +8714,9 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_CONST(int type,
CACHE_PTR(opline->op2.literal->cache_slot, ce);
}
} else {
- ce = EX_T(opline->op2.var).class_entry;
+ ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0, ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ retval = zend_std_get_static_property(ce, Z_STR_P(varname), 0, ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
zval_dtor(free_op1.var);
} else {
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
@@ -9001,27 +8726,21 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_CONST(int type,
ZEND_VM_NEXT_OPCODE();
}
*/
- if (IS_TMP_VAR == IS_CONST) {
- hash_value = Z_HASH_P(varname);
- } else {
- hash_value = str_hash(Z_STRVAL_P(varname), Z_STRLEN_P(varname));
- }
-
- if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) {
+ if ((retval = zend_hash_find(target_symbol_table, Z_STR_P(varname))) == NULL) {
switch (type) {
case BP_VAR_R:
case BP_VAR_UNSET:
zend_error(E_NOTICE,"Undefined variable: %s", Z_STRVAL_P(varname));
/* break missing intentionally */
case BP_VAR_IS:
- retval = &EG(uninitialized_zval_ptr);
+ ZVAL_NULL(retval);
break;
case BP_VAR_RW:
zend_error(E_NOTICE,"Undefined variable: %s", Z_STRVAL_P(varname));
/* break missing intentionally */
case BP_VAR_W:
Z_ADDREF_P(&EG(uninitialized_zval));
- zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval);
+ retval = zend_hash_update(target_symbol_table, Z_STR_P(varname), &EG(uninitialized_zval));
break;
EMPTY_SWITCH_DEFAULT_CASE()
}
@@ -9040,7 +8759,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_CONST(int type,
break;
case ZEND_FETCH_GLOBAL_LOCK:
if (IS_TMP_VAR == IS_VAR && !free_op1.var) {
- PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
+ Z_ADDREF_P(EX_VAR(opline->op1.var));
}
break;
}
@@ -9053,27 +8772,26 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_CONST(int type,
if (opline->extended_value & ZEND_FETCH_MAKE_REF) {
SEPARATE_ZVAL_TO_MAKE_IS_REF(retval);
}
- PZVAL_LOCK(*retval);
- switch (type) {
- case BP_VAR_R:
- case BP_VAR_IS:
- EX_T(opline->result.var).var.ptr = *retval;
- break;
- case BP_VAR_UNSET: {
- zend_free_op free_res;
-
- PZVAL_UNLOCK(*retval, &free_res);
- if (retval != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(retval);
- }
- PZVAL_LOCK(*retval);
- FREE_OP_VAR_PTR(free_res);
- }
- /* break missing intentionally */
- default:
- EX_T(opline->result.var).var.ptr_ptr = retval;
- break;
- }
+ ZVAL_COPY(EX_VAR(opline->result.var), retval);
+//??? switch (type) {
+//??? case BP_VAR_R:
+//??? case BP_VAR_IS:
+//??? break;
+//??? case BP_VAR_UNSET: {
+//??? zend_free_op free_res;
+//???
+//??? PZVAL_UNLOCK(*retval, &free_res);
+//??? if (retval != &EG(uninitialized_zval_ptr)) {
+//??? SEPARATE_ZVAL_IF_NOT_REF(retval);
+//??? }
+//??? PZVAL_LOCK(*retval);
+//??? FREE_OP_VAR_PTR(free_res);
+//??? }
+//??? /* break missing intentionally */
+//??? default:
+//??? EX_T(opline->result.var).var.ptr_ptr = retval;
+//??? break;
+//??? }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -9118,7 +8836,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HA
SAVE_OPLINE();
container = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC);
+ zend_fetch_dimension_address_read(EX_VAR(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC);
if (IS_TMP_VAR != IS_VAR || !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
zval_dtor(free_op1.var);
@@ -9137,14 +8855,12 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_TMP_VAR_SPEC_TMP_CONST_HANDLER(ZEND_OPC
container = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (UNEXPECTED(Z_TYPE_P(container) != IS_ARRAY)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
} else {
- zval *value = *zend_fetch_dimension_address_inner(Z_ARRVAL_P(container), opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC);
+ zval *value = zend_fetch_dimension_address_inner(Z_ARRVAL_P(container), opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC);
- PZVAL_LOCK(value);
- EX_T(opline->result.var).var.ptr = value;
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
}
CHECK_EXCEPTION();
@@ -9154,17 +8870,13 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_TMP_VAR_SPEC_TMP_CONST_HANDLER(ZEND_OPC
static int ZEND_FASTCALL ZEND_ADD_CHAR_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zval *str = &EX_T(opline->result.var).tmp_var;
+ zval *str = EX_VAR(opline->result.var);
SAVE_OPLINE();
if (IS_TMP_VAR == IS_UNUSED) {
/* Initialize for erealloc in add_char_to_string */
- Z_STRVAL_P(str) = NULL;
- Z_STRLEN_P(str) = 0;
- Z_TYPE_P(str) = IS_STRING;
-
- INIT_PZVAL(str);
+ ZVAL_STR(str, STR_EMPTY_ALLOC());
}
add_char_to_string(str, str, opline->op2.zv);
@@ -9177,17 +8889,13 @@ static int ZEND_FASTCALL ZEND_ADD_CHAR_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDL
static int ZEND_FASTCALL ZEND_ADD_STRING_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zval *str = &EX_T(opline->result.var).tmp_var;
+ zval *str = EX_VAR(opline->result.var);
SAVE_OPLINE();
if (IS_TMP_VAR == IS_UNUSED) {
/* Initialize for erealloc in add_string_to_string */
- Z_STRVAL_P(str) = NULL;
- Z_STRLEN_P(str) = 0;
- Z_TYPE_P(str) = IS_STRING;
-
- INIT_PZVAL(str);
+ ZVAL_STR(str, STR_EMPTY_ALLOC());
}
add_string_to_string(str, str, opline->op2.zv);
@@ -9201,8 +8909,6 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_CONST_HANDLER(ZEND_OPCO
{
USE_OPLINE
zval *function_name;
- char *function_name_strval;
- int function_name_strlen;
zend_free_op free_op1;
call_slot *call = EX(call_slots) + opline->result.num;
@@ -9218,32 +8924,29 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_CONST_HANDLER(ZEND_OPCO
zend_error_noreturn(E_ERROR, "Method name must be a string");
}
- function_name_strval = Z_STRVAL_P(function_name);
- function_name_strlen = Z_STRLEN_P(function_name);
+ ZVAL_COPY_VALUE(&call->object, _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC));
- call->object = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
-
- if (EXPECTED(call->object != NULL) &&
- EXPECTED(Z_TYPE_P(call->object) == IS_OBJECT)) {
- call->called_scope = Z_OBJCE_P(call->object);
+ if (EXPECTED(Z_TYPE(call->object) != IS_UNDEF) &&
+ EXPECTED(Z_TYPE(call->object) == IS_OBJECT)) {
+ call->called_scope = Z_OBJCE(call->object);
if (IS_CONST != IS_CONST ||
(call->fbc = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope)) == NULL) {
- zval *object = call->object;
+ zend_object *object = Z_OBJ(call->object);
- if (UNEXPECTED(Z_OBJ_HT_P(call->object)->get_method == NULL)) {
+ if (UNEXPECTED(Z_OBJ_HT(call->object)->get_method == NULL)) {
zend_error_noreturn(E_ERROR, "Object does not support method calls");
}
/* First, locate the function. */
- call->fbc = Z_OBJ_HT_P(call->object)->get_method(&call->object, function_name_strval, function_name_strlen, ((IS_CONST == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
+ call->fbc = Z_OBJ_HT(call->object)->get_method(&call->object, Z_STR_P(function_name), ((IS_CONST == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
if (UNEXPECTED(call->fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(call->object), function_name_strval);
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(&call->object), Z_STRVAL_P(function_name));
}
if (IS_CONST == IS_CONST &&
EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0) &&
- EXPECTED(call->object == object)) {
+ EXPECTED(Z_OBJ(call->object) == object)) {
CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope, call->fbc);
}
}
@@ -9252,20 +8955,16 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_CONST_HANDLER(ZEND_OPCO
HANDLE_EXCEPTION();
}
- zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval);
+ zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", Z_STRVAL_P(function_name));
}
if ((call->fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) {
- call->object = NULL;
+ ZVAL_UNDEF(&call->object);
} else {
- if (!PZVAL_IS_REF(call->object)) {
- Z_ADDREF_P(call->object); /* For $this pointer */
+ if (!Z_ISREF(call->object)) {
+ Z_ADDREF(call->object); /* For $this pointer */
} else {
- zval *this_ptr;
- ALLOC_ZVAL(this_ptr);
- INIT_PZVAL_COPY(this_ptr, call->object);
- zval_copy_ctor(this_ptr);
- call->object = this_ptr;
+ ZVAL_DUP(&call->object, Z_REFVAL(call->object));
}
}
@@ -9284,7 +8983,7 @@ static int ZEND_FASTCALL ZEND_CASE_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_A
zend_free_op free_op1;
SAVE_OPLINE();
- is_equal_function(&EX_T(opline->result.var).tmp_var,
+ is_equal_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
@@ -9300,29 +8999,24 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CONST_HANDLER(ZEND_OPC
SAVE_OPLINE();
if ((IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) && opline->extended_value) {
- zval **expr_ptr_ptr = NULL;
-
- if (IS_TMP_VAR == IS_VAR && UNEXPECTED(expr_ptr_ptr == NULL)) {
+ expr_ptr = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ if (IS_TMP_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets");
}
- SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr_ptr);
- expr_ptr = *expr_ptr_ptr;
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr);
Z_ADDREF_P(expr_ptr);
} else {
expr_ptr=_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (1) { /* temporary variable */
- zval *new_expr;
+ zval new_expr;
- ALLOC_ZVAL(new_expr);
- INIT_PZVAL_COPY(new_expr, expr_ptr);
- expr_ptr = new_expr;
- } else if (IS_TMP_VAR == IS_CONST || PZVAL_IS_REF(expr_ptr)) {
- zval *new_expr;
+ ZVAL_COPY_VALUE(&new_expr, expr_ptr);
+ expr_ptr = &new_expr;
+ } else if (IS_TMP_VAR == IS_CONST || Z_ISREF_P(expr_ptr)) {
+ zval new_expr;
- ALLOC_ZVAL(new_expr);
- INIT_PZVAL_COPY(new_expr, expr_ptr);
- expr_ptr = new_expr;
- zendi_zval_copy_ctor(*expr_ptr);
+ ZVAL_DUP(&new_expr, expr_ptr);
+ expr_ptr = &new_expr;
} else if (IS_TMP_VAR == IS_CV) {
Z_ADDREF_P(expr_ptr);
@@ -9342,29 +9036,26 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CONST_HANDLER(ZEND_OPC
case IS_BOOL:
hval = Z_LVAL_P(offset);
num_index:
- zend_hash_index_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), hval, &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr);
break;
case IS_STRING:
- if (IS_CONST == IS_CONST) {
- hval = Z_HASH_P(offset);
- } else {
+ if (IS_CONST != IS_CONST) {
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index);
- hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset));
}
- zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), Z_STR_P(offset), expr_ptr);
break;
case IS_NULL:
- zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), STR_EMPTY_ALLOC(), expr_ptr);
break;
default:
zend_error(E_WARNING, "Illegal offset type");
- zval_ptr_dtor(&expr_ptr);
+ zval_ptr_dtor(expr_ptr);
/* do nothing */
break;
}
} else {
- zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr);
}
if ((IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) && opline->extended_value) {
@@ -9377,7 +9068,7 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HAN
{
USE_OPLINE
- array_init(&EX_T(opline->result.var).tmp_var);
+ array_init(EX_VAR(opline->result.var));
if (IS_TMP_VAR == IS_UNUSED) {
ZEND_VM_NEXT_OPCODE();
#if 0 || IS_TMP_VAR != IS_UNUSED
@@ -9399,13 +9090,13 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HAND
IS_CONST == IS_UNUSED &&
(opline->extended_value & ZEND_QUICK_SET)) {
if (EG(active_symbol_table)) {
- zend_compiled_variable *cv = &CV_DEF_OF(opline->op1.var);
+ zend_string *cv = CV_DEF_OF(opline->op1.var);
- zend_delete_variable(EX(prev_execute_data), EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value TSRMLS_CC);
- EX_CV(opline->op1.var) = NULL;
- } else if (EX_CV(opline->op1.var)) {
- zval_ptr_dtor(EX_CV(opline->op1.var));
- EX_CV(opline->op1.var) = NULL;
+ zend_delete_variable(EX(prev_execute_data), EG(active_symbol_table), cv TSRMLS_CC);
+ ZVAL_UNDEF(EX_VAR_NUM(opline->op1.var));
+ } else if (Z_TYPE_P(EX_VAR_NUM(opline->op1.var)) != IS_UNDEF) {
+ zval_ptr_dtor(EX_VAR_NUM(opline->op1.var));
+ ZVAL_UNDEF(EX_VAR_NUM(opline->op1.var));
}
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -9414,8 +9105,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HAND
varname = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (IS_TMP_VAR != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
- ZVAL_COPY_VALUE(&tmp, varname);
- zval_copy_ctor(&tmp);
+ ZVAL_DUP(&tmp, varname);
convert_to_string(&tmp);
varname = &tmp;
} else if (IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) {
@@ -9429,12 +9119,12 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HAND
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
ce = CACHED_PTR(opline->op2.literal->cache_slot);
} else {
- ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
if (IS_TMP_VAR != IS_CONST && varname == &tmp) {
zval_dtor(&tmp);
} else if (IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) {
- zval_ptr_dtor(&varname);
+ zval_ptr_dtor(varname);
}
zval_dtor(free_op1.var);
HANDLE_EXCEPTION();
@@ -9445,20 +9135,18 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HAND
CACHE_PTR(opline->op2.literal->cache_slot, ce);
}
} else {
- ce = EX_T(opline->op2.var).class_entry;
+ ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ zend_std_unset_static_property(ce, Z_STR_P(varname), ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
} else {
- ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1);
-
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
- zend_delete_variable(execute_data, target_symbol_table, varname->value.str.val, varname->value.str.len+1, hash_value TSRMLS_CC);
+ zend_delete_variable(execute_data, target_symbol_table, Z_STR_P(varname) TSRMLS_CC);
}
if (IS_TMP_VAR != IS_CONST && varname == &tmp) {
zval_dtor(&tmp);
} else if (IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) {
- zval_ptr_dtor(&varname);
+ zval_ptr_dtor(varname);
}
zval_dtor(free_op1.var);
CHECK_EXCEPTION();
@@ -9468,19 +9156,19 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HAND
static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zval **value;
+ zval *value;
zend_bool isset = 1;
SAVE_OPLINE();
if (IS_TMP_VAR == IS_CV &&
IS_CONST == IS_UNUSED &&
(opline->extended_value & ZEND_QUICK_SET)) {
- if (EX_CV(opline->op1.var)) {
- value = EX_CV(opline->op1.var);
+ if (Z_TYPE_P(EX_VAR_NUM(opline->op1.var)) != IS_UNDEF) {
+ value = EX_VAR_NUM(opline->op1.var);
} else if (EG(active_symbol_table)) {
- zend_compiled_variable *cv = &CV_DEF_OF(opline->op1.var);
+ zend_string *cv = CV_DEF_OF(opline->op1.var);
- if (zend_hash_quick_find(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, (void **) &value) == FAILURE) {
+ if ((value = zend_hash_find(EG(active_symbol_table), cv)) == NULL) {
isset = 0;
}
} else {
@@ -9492,8 +9180,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_CONST_HANDLER(ZEND_OPC
zval tmp, *varname = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (IS_TMP_VAR != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
- ZVAL_COPY_VALUE(&tmp, varname);
- zval_copy_ctor(&tmp);
+ ZVAL_DUP(&tmp, varname);
convert_to_string(&tmp);
varname = &tmp;
}
@@ -9505,7 +9192,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_CONST_HANDLER(ZEND_OPC
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
ce = CACHED_PTR(opline->op2.literal->cache_slot);
} else {
- ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -9513,15 +9200,15 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_CONST_HANDLER(ZEND_OPC
CACHE_PTR(opline->op2.literal->cache_slot, ce);
}
} else {
- ce = EX_T(opline->op2.var).class_entry;
+ ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1, ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ value = zend_std_get_static_property(ce, Z_STR_P(varname), 1, ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
if (!value) {
isset = 0;
}
} else {
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
- if (zend_hash_find(target_symbol_table, varname->value.str.val, varname->value.str.len+1, (void **) &value) == FAILURE) {
+ if ((value = zend_hash_find(target_symbol_table, Z_STR_P(varname))) == NULL) {
isset = 0;
}
}
@@ -9533,16 +9220,16 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_CONST_HANDLER(ZEND_OPC
}
if (opline->extended_value & ZEND_ISSET) {
- if (isset && Z_TYPE_PP(value) != IS_NULL) {
- ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, 1);
+ if (isset && Z_TYPE_P(value) != IS_NULL) {
+ ZVAL_BOOL(EX_VAR(opline->result.var), 1);
} else {
- ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, 0);
+ ZVAL_BOOL(EX_VAR(opline->result.var), 0);
}
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (!isset || !i_zend_is_true(*value TSRMLS_CC)) {
- ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, 1);
+ if (!isset || !i_zend_is_true(value TSRMLS_CC)) {
+ ZVAL_BOOL(EX_VAR(opline->result.var), 1);
} else {
- ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, 0);
+ ZVAL_BOOL(EX_VAR(opline->result.var), 0);
}
}
@@ -9552,6 +9239,9 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_CONST_HANDLER(ZEND_OPC
static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
+//???
+return 0;
+#if 0
USE_OPLINE
/* The generator object is stored in return_value_ptr_ptr */
@@ -9594,7 +9284,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_
generator->value = copy;
} else {
- zval **value_ptr = NULL;
+ zval **value_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W);
if (IS_TMP_VAR == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
@@ -9622,7 +9312,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_
/* Consts, temporary variables and references need copying */
if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR
- || PZVAL_IS_REF(value)
+ || Z_ISREF_P(value)
) {
zval *copy;
@@ -9656,7 +9346,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_
/* Consts, temporary variables and references need copying */
if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR
- || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0)
+ || (Z_ISREF_P(key) && Z_REFCOUNT_P(key) > 0)
) {
zval *copy;
@@ -9707,6 +9397,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_
SAVE_OPLINE();
ZEND_VM_RETURN();
+#endif
}
static int ZEND_FASTCALL ZEND_ADD_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -9715,7 +9406,7 @@ static int ZEND_FASTCALL ZEND_ADD_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- fast_add_function(&EX_T(opline->result.var).tmp_var,
+ fast_add_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
zval_dtor(free_op1.var);
@@ -9730,7 +9421,7 @@ static int ZEND_FASTCALL ZEND_SUB_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- fast_sub_function(&EX_T(opline->result.var).tmp_var,
+ fast_sub_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
zval_dtor(free_op1.var);
@@ -9745,7 +9436,7 @@ static int ZEND_FASTCALL ZEND_MUL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- fast_mul_function(&EX_T(opline->result.var).tmp_var,
+ fast_mul_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
zval_dtor(free_op1.var);
@@ -9760,7 +9451,7 @@ static int ZEND_FASTCALL ZEND_DIV_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- fast_div_function(&EX_T(opline->result.var).tmp_var,
+ fast_div_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
zval_dtor(free_op1.var);
@@ -9775,7 +9466,7 @@ static int ZEND_FASTCALL ZEND_MOD_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- fast_mod_function(&EX_T(opline->result.var).tmp_var,
+ fast_mod_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
zval_dtor(free_op1.var);
@@ -9790,7 +9481,7 @@ static int ZEND_FASTCALL ZEND_SL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- shift_left_function(&EX_T(opline->result.var).tmp_var,
+ shift_left_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
zval_dtor(free_op1.var);
@@ -9805,7 +9496,7 @@ static int ZEND_FASTCALL ZEND_SR_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- shift_right_function(&EX_T(opline->result.var).tmp_var,
+ shift_right_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
zval_dtor(free_op1.var);
@@ -9820,7 +9511,7 @@ static int ZEND_FASTCALL ZEND_CONCAT_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_A
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- concat_function(&EX_T(opline->result.var).tmp_var,
+ concat_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
zval_dtor(free_op1.var);
@@ -9835,7 +9526,7 @@ static int ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HAN
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- is_identical_function(&EX_T(opline->result.var).tmp_var,
+ is_identical_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
zval_dtor(free_op1.var);
@@ -9848,7 +9539,7 @@ static int ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
is_identical_function(result,
@@ -9865,7 +9556,7 @@ static int ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_equal_function(result,
@@ -9881,7 +9572,7 @@ static int ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HAN
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_not_equal_function(result,
@@ -9897,7 +9588,7 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDL
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_is_smaller_function(result,
@@ -9913,7 +9604,7 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_TMP_TMP_HANDLER(ZEND_OPC
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_is_smaller_or_equal_function(result,
@@ -9931,7 +9622,7 @@ static int ZEND_FASTCALL ZEND_BW_OR_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- bitwise_or_function(&EX_T(opline->result.var).tmp_var,
+ bitwise_or_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
zval_dtor(free_op1.var);
@@ -9946,7 +9637,7 @@ static int ZEND_FASTCALL ZEND_BW_AND_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_A
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- bitwise_and_function(&EX_T(opline->result.var).tmp_var,
+ bitwise_and_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
zval_dtor(free_op1.var);
@@ -9961,7 +9652,7 @@ static int ZEND_FASTCALL ZEND_BW_XOR_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_A
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- bitwise_xor_function(&EX_T(opline->result.var).tmp_var,
+ bitwise_xor_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
zval_dtor(free_op1.var);
@@ -9976,7 +9667,7 @@ static int ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- boolean_xor_function(&EX_T(opline->result.var).tmp_var,
+ boolean_xor_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
zval_dtor(free_op1.var);
@@ -9993,7 +9684,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HAND
SAVE_OPLINE();
container = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_R TSRMLS_CC);
+ zend_fetch_dimension_address_read(EX_VAR(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_R TSRMLS_CC);
zval_dtor(free_op2.var);
if (IS_TMP_VAR != IS_VAR || !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
zval_dtor(free_op1.var);
@@ -10006,7 +9697,7 @@ static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_
{
USE_OPLINE
zend_free_op free_op2;
- zval *str = &EX_T(opline->result.var).tmp_var;
+ zval *str = EX_VAR(opline->result.var);
zval *var;
zval var_copy;
int use_copy = 0;
@@ -10016,11 +9707,7 @@ static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_
if (IS_TMP_VAR == IS_UNUSED) {
/* Initialize for erealloc in add_string_to_string */
- Z_STRVAL_P(str) = NULL;
- Z_STRLEN_P(str) = 0;
- Z_TYPE_P(str) = IS_STRING;
-
- INIT_PZVAL(str);
+ ZVAL_STR(str, STR_EMPTY_ALLOC());
}
if (Z_TYPE_P(var) != IS_STRING) {
@@ -10051,8 +9738,6 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE
{
USE_OPLINE
zval *function_name;
- char *function_name_strval;
- int function_name_strlen;
zend_free_op free_op1, free_op2;
call_slot *call = EX(call_slots) + opline->result.num;
@@ -10068,32 +9753,29 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE
zend_error_noreturn(E_ERROR, "Method name must be a string");
}
- function_name_strval = Z_STRVAL_P(function_name);
- function_name_strlen = Z_STRLEN_P(function_name);
+ ZVAL_COPY_VALUE(&call->object, _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC));
- call->object = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
-
- if (EXPECTED(call->object != NULL) &&
- EXPECTED(Z_TYPE_P(call->object) == IS_OBJECT)) {
- call->called_scope = Z_OBJCE_P(call->object);
+ if (EXPECTED(Z_TYPE(call->object) != IS_UNDEF) &&
+ EXPECTED(Z_TYPE(call->object) == IS_OBJECT)) {
+ call->called_scope = Z_OBJCE(call->object);
if (IS_TMP_VAR != IS_CONST ||
(call->fbc = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope)) == NULL) {
- zval *object = call->object;
+ zend_object *object = Z_OBJ(call->object);
- if (UNEXPECTED(Z_OBJ_HT_P(call->object)->get_method == NULL)) {
+ if (UNEXPECTED(Z_OBJ_HT(call->object)->get_method == NULL)) {
zend_error_noreturn(E_ERROR, "Object does not support method calls");
}
/* First, locate the function. */
- call->fbc = Z_OBJ_HT_P(call->object)->get_method(&call->object, function_name_strval, function_name_strlen, ((IS_TMP_VAR == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
+ call->fbc = Z_OBJ_HT(call->object)->get_method(&call->object, Z_STR_P(function_name), ((IS_TMP_VAR == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
if (UNEXPECTED(call->fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(call->object), function_name_strval);
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(&call->object), Z_STRVAL_P(function_name));
}
if (IS_TMP_VAR == IS_CONST &&
EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0) &&
- EXPECTED(call->object == object)) {
+ EXPECTED(Z_OBJ(call->object) == object)) {
CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope, call->fbc);
}
}
@@ -10102,20 +9784,16 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE
zval_dtor(free_op2.var);
HANDLE_EXCEPTION();
}
- zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval);
+ zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", Z_STRVAL_P(function_name));
}
if ((call->fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) {
- call->object = NULL;
+ ZVAL_UNDEF(&call->object);
} else {
- if (!PZVAL_IS_REF(call->object)) {
- Z_ADDREF_P(call->object); /* For $this pointer */
+ if (!Z_ISREF(call->object)) {
+ Z_ADDREF(call->object); /* For $this pointer */
} else {
- zval *this_ptr;
- ALLOC_ZVAL(this_ptr);
- INIT_PZVAL_COPY(this_ptr, call->object);
- zval_copy_ctor(this_ptr);
- call->object = this_ptr;
+ ZVAL_DUP(&call->object, Z_REFVAL(call->object));
}
}
@@ -10135,7 +9813,7 @@ static int ZEND_FASTCALL ZEND_CASE_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- is_equal_function(&EX_T(opline->result.var).tmp_var,
+ is_equal_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
@@ -10152,29 +9830,24 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_TMP_HANDLER(ZEND_OPCOD
SAVE_OPLINE();
if ((IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) && opline->extended_value) {
- zval **expr_ptr_ptr = NULL;
-
- if (IS_TMP_VAR == IS_VAR && UNEXPECTED(expr_ptr_ptr == NULL)) {
+ expr_ptr = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ if (IS_TMP_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets");
}
- SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr_ptr);
- expr_ptr = *expr_ptr_ptr;
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr);
Z_ADDREF_P(expr_ptr);
} else {
expr_ptr=_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (1) { /* temporary variable */
- zval *new_expr;
+ zval new_expr;
- ALLOC_ZVAL(new_expr);
- INIT_PZVAL_COPY(new_expr, expr_ptr);
- expr_ptr = new_expr;
- } else if (IS_TMP_VAR == IS_CONST || PZVAL_IS_REF(expr_ptr)) {
- zval *new_expr;
+ ZVAL_COPY_VALUE(&new_expr, expr_ptr);
+ expr_ptr = &new_expr;
+ } else if (IS_TMP_VAR == IS_CONST || Z_ISREF_P(expr_ptr)) {
+ zval new_expr;
- ALLOC_ZVAL(new_expr);
- INIT_PZVAL_COPY(new_expr, expr_ptr);
- expr_ptr = new_expr;
- zendi_zval_copy_ctor(*expr_ptr);
+ ZVAL_DUP(&new_expr, expr_ptr);
+ expr_ptr = &new_expr;
} else if (IS_TMP_VAR == IS_CV) {
Z_ADDREF_P(expr_ptr);
@@ -10194,29 +9867,26 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_TMP_HANDLER(ZEND_OPCOD
case IS_BOOL:
hval = Z_LVAL_P(offset);
num_index:
- zend_hash_index_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), hval, &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr);
break;
case IS_STRING:
- if (IS_TMP_VAR == IS_CONST) {
- hval = Z_HASH_P(offset);
- } else {
+ if (IS_TMP_VAR != IS_CONST) {
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index);
- hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset));
}
- zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), Z_STR_P(offset), expr_ptr);
break;
case IS_NULL:
- zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), STR_EMPTY_ALLOC(), expr_ptr);
break;
default:
zend_error(E_WARNING, "Illegal offset type");
- zval_ptr_dtor(&expr_ptr);
+ zval_ptr_dtor(expr_ptr);
/* do nothing */
break;
}
zval_dtor(free_op2.var);
} else {
- zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr);
}
if ((IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) && opline->extended_value) {
@@ -10229,7 +9899,7 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDL
{
USE_OPLINE
- array_init(&EX_T(opline->result.var).tmp_var);
+ array_init(EX_VAR(opline->result.var));
if (IS_TMP_VAR == IS_UNUSED) {
ZEND_VM_NEXT_OPCODE();
#if 0 || IS_TMP_VAR != IS_UNUSED
@@ -10241,6 +9911,9 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDL
static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
+//???
+return 0;
+#if 0
USE_OPLINE
/* The generator object is stored in return_value_ptr_ptr */
@@ -10283,7 +9956,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR
generator->value = copy;
} else {
- zval **value_ptr = NULL;
+ zval **value_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W);
if (IS_TMP_VAR == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
@@ -10311,7 +9984,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR
/* Consts, temporary variables and references need copying */
if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR
- || PZVAL_IS_REF(value)
+ || Z_ISREF_P(value)
) {
zval *copy;
@@ -10345,7 +10018,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR
/* Consts, temporary variables and references need copying */
if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR
- || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0)
+ || (Z_ISREF_P(key) && Z_REFCOUNT_P(key) > 0)
) {
zval *copy;
@@ -10396,6 +10069,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR
SAVE_OPLINE();
ZEND_VM_RETURN();
+#endif
}
static int ZEND_FASTCALL ZEND_ADD_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -10404,11 +10078,11 @@ static int ZEND_FASTCALL ZEND_ADD_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- fast_add_function(&EX_T(opline->result.var).tmp_var,
+ fast_add_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
zval_dtor(free_op1.var);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -10419,11 +10093,11 @@ static int ZEND_FASTCALL ZEND_SUB_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- fast_sub_function(&EX_T(opline->result.var).tmp_var,
+ fast_sub_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
zval_dtor(free_op1.var);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -10434,11 +10108,11 @@ static int ZEND_FASTCALL ZEND_MUL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- fast_mul_function(&EX_T(opline->result.var).tmp_var,
+ fast_mul_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
zval_dtor(free_op1.var);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -10449,11 +10123,11 @@ static int ZEND_FASTCALL ZEND_DIV_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- fast_div_function(&EX_T(opline->result.var).tmp_var,
+ fast_div_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
zval_dtor(free_op1.var);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -10464,11 +10138,11 @@ static int ZEND_FASTCALL ZEND_MOD_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- fast_mod_function(&EX_T(opline->result.var).tmp_var,
+ fast_mod_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
zval_dtor(free_op1.var);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -10479,11 +10153,11 @@ static int ZEND_FASTCALL ZEND_SL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- shift_left_function(&EX_T(opline->result.var).tmp_var,
+ shift_left_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
zval_dtor(free_op1.var);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -10494,11 +10168,11 @@ static int ZEND_FASTCALL ZEND_SR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- shift_right_function(&EX_T(opline->result.var).tmp_var,
+ shift_right_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
zval_dtor(free_op1.var);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -10509,11 +10183,11 @@ static int ZEND_FASTCALL ZEND_CONCAT_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_A
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- concat_function(&EX_T(opline->result.var).tmp_var,
+ concat_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
zval_dtor(free_op1.var);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -10524,11 +10198,11 @@ static int ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HAN
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- is_identical_function(&EX_T(opline->result.var).tmp_var,
+ is_identical_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
zval_dtor(free_op1.var);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -10537,7 +10211,7 @@ static int ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
is_identical_function(result,
@@ -10545,7 +10219,7 @@ static int ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
Z_LVAL_P(result) = !Z_LVAL_P(result);
zval_dtor(free_op1.var);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -10554,14 +10228,14 @@ static int ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_equal_function(result,
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC));
zval_dtor(free_op1.var);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -10570,14 +10244,14 @@ static int ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HAN
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_not_equal_function(result,
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC));
zval_dtor(free_op1.var);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -10586,14 +10260,14 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDL
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_is_smaller_function(result,
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC));
zval_dtor(free_op1.var);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -10602,14 +10276,14 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_TMP_VAR_HANDLER(ZEND_OPC
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_is_smaller_or_equal_function(result,
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC));
zval_dtor(free_op1.var);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -10620,11 +10294,11 @@ static int ZEND_FASTCALL ZEND_BW_OR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- bitwise_or_function(&EX_T(opline->result.var).tmp_var,
+ bitwise_or_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
zval_dtor(free_op1.var);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -10635,11 +10309,11 @@ static int ZEND_FASTCALL ZEND_BW_AND_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_A
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- bitwise_and_function(&EX_T(opline->result.var).tmp_var,
+ bitwise_and_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
zval_dtor(free_op1.var);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -10650,11 +10324,11 @@ static int ZEND_FASTCALL ZEND_BW_XOR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_A
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- bitwise_xor_function(&EX_T(opline->result.var).tmp_var,
+ bitwise_xor_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
zval_dtor(free_op1.var);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -10665,11 +10339,11 @@ static int ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- boolean_xor_function(&EX_T(opline->result.var).tmp_var,
+ boolean_xor_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
zval_dtor(free_op1.var);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -10679,19 +10353,17 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_VAR(int type, ZE
USE_OPLINE
zend_free_op free_op1;
zval *varname;
- zval **retval;
+ zval *retval;
zval tmp_varname;
HashTable *target_symbol_table;
- ulong hash_value;
SAVE_OPLINE();
varname = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (IS_TMP_VAR != IS_CONST && UNEXPECTED(Z_TYPE_P(varname) != IS_STRING)) {
- ZVAL_COPY_VALUE(&tmp_varname, varname);
- zval_copy_ctor(&tmp_varname);
- Z_SET_REFCOUNT(tmp_varname, 1);
- Z_UNSET_ISREF(tmp_varname);
+ ZVAL_DUP(&tmp_varname, varname);
+//??? Z_SET_REFCOUNT(tmp_varname, 1);
+//??? Z_UNSET_ISREF(tmp_varname);
convert_to_string(&tmp_varname);
varname = &tmp_varname;
}
@@ -10703,7 +10375,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_VAR(int type, ZE
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
ce = CACHED_PTR(opline->op2.literal->cache_slot);
} else {
- ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
if (IS_TMP_VAR != IS_CONST && varname == &tmp_varname) {
zval_dtor(&tmp_varname);
@@ -10715,9 +10387,9 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_VAR(int type, ZE
CACHE_PTR(opline->op2.literal->cache_slot, ce);
}
} else {
- ce = EX_T(opline->op2.var).class_entry;
+ ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0, ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ retval = zend_std_get_static_property(ce, Z_STR_P(varname), 0, ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
zval_dtor(free_op1.var);
} else {
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
@@ -10727,27 +10399,21 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_VAR(int type, ZE
ZEND_VM_NEXT_OPCODE();
}
*/
- if (IS_TMP_VAR == IS_CONST) {
- hash_value = Z_HASH_P(varname);
- } else {
- hash_value = str_hash(Z_STRVAL_P(varname), Z_STRLEN_P(varname));
- }
-
- if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) {
+ if ((retval = zend_hash_find(target_symbol_table, Z_STR_P(varname))) == NULL) {
switch (type) {
case BP_VAR_R:
case BP_VAR_UNSET:
zend_error(E_NOTICE,"Undefined variable: %s", Z_STRVAL_P(varname));
/* break missing intentionally */
case BP_VAR_IS:
- retval = &EG(uninitialized_zval_ptr);
+ ZVAL_NULL(retval);
break;
case BP_VAR_RW:
zend_error(E_NOTICE,"Undefined variable: %s", Z_STRVAL_P(varname));
/* break missing intentionally */
case BP_VAR_W:
Z_ADDREF_P(&EG(uninitialized_zval));
- zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval);
+ retval = zend_hash_update(target_symbol_table, Z_STR_P(varname), &EG(uninitialized_zval));
break;
EMPTY_SWITCH_DEFAULT_CASE()
}
@@ -10766,7 +10432,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_VAR(int type, ZE
break;
case ZEND_FETCH_GLOBAL_LOCK:
if (IS_TMP_VAR == IS_VAR && !free_op1.var) {
- PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
+ Z_ADDREF_P(EX_VAR(opline->op1.var));
}
break;
}
@@ -10779,27 +10445,26 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_VAR(int type, ZE
if (opline->extended_value & ZEND_FETCH_MAKE_REF) {
SEPARATE_ZVAL_TO_MAKE_IS_REF(retval);
}
- PZVAL_LOCK(*retval);
- switch (type) {
- case BP_VAR_R:
- case BP_VAR_IS:
- EX_T(opline->result.var).var.ptr = *retval;
- break;
- case BP_VAR_UNSET: {
- zend_free_op free_res;
-
- PZVAL_UNLOCK(*retval, &free_res);
- if (retval != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(retval);
- }
- PZVAL_LOCK(*retval);
- FREE_OP_VAR_PTR(free_res);
- }
- /* break missing intentionally */
- default:
- EX_T(opline->result.var).var.ptr_ptr = retval;
- break;
- }
+ ZVAL_COPY(EX_VAR(opline->result.var), retval);
+//??? switch (type) {
+//??? case BP_VAR_R:
+//??? case BP_VAR_IS:
+//??? break;
+//??? case BP_VAR_UNSET: {
+//??? zend_free_op free_res;
+//???
+//??? PZVAL_UNLOCK(*retval, &free_res);
+//??? if (retval != &EG(uninitialized_zval_ptr)) {
+//??? SEPARATE_ZVAL_IF_NOT_REF(retval);
+//??? }
+//??? PZVAL_LOCK(*retval);
+//??? FREE_OP_VAR_PTR(free_res);
+//??? }
+//??? /* break missing intentionally */
+//??? default:
+//??? EX_T(opline->result.var).var.ptr_ptr = retval;
+//??? break;
+//??? }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -10844,8 +10509,8 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HAND
SAVE_OPLINE();
container = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zend_fetch_dimension_address_read(EX_VAR(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC);
+ zval_ptr_dtor_nogc(free_op2.var);
if (IS_TMP_VAR != IS_VAR || !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
zval_dtor(free_op1.var);
}
@@ -10857,7 +10522,7 @@ static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_
{
USE_OPLINE
zend_free_op free_op2;
- zval *str = &EX_T(opline->result.var).tmp_var;
+ zval *str = EX_VAR(opline->result.var);
zval *var;
zval var_copy;
int use_copy = 0;
@@ -10867,11 +10532,7 @@ static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_
if (IS_TMP_VAR == IS_UNUSED) {
/* Initialize for erealloc in add_string_to_string */
- Z_STRVAL_P(str) = NULL;
- Z_STRLEN_P(str) = 0;
- Z_TYPE_P(str) = IS_STRING;
-
- INIT_PZVAL(str);
+ ZVAL_STR(str, STR_EMPTY_ALLOC());
}
if (Z_TYPE_P(var) != IS_STRING) {
@@ -10892,7 +10553,7 @@ static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_
* which aren't affected by FREE_OP(Ts, )'s anyway, unless they're
* string offsets or overloaded objects
*/
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -10902,8 +10563,6 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE
{
USE_OPLINE
zval *function_name;
- char *function_name_strval;
- int function_name_strlen;
zend_free_op free_op1, free_op2;
call_slot *call = EX(call_slots) + opline->result.num;
@@ -10919,54 +10578,47 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE
zend_error_noreturn(E_ERROR, "Method name must be a string");
}
- function_name_strval = Z_STRVAL_P(function_name);
- function_name_strlen = Z_STRLEN_P(function_name);
-
- call->object = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ ZVAL_COPY_VALUE(&call->object, _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC));
- if (EXPECTED(call->object != NULL) &&
- EXPECTED(Z_TYPE_P(call->object) == IS_OBJECT)) {
- call->called_scope = Z_OBJCE_P(call->object);
+ if (EXPECTED(Z_TYPE(call->object) != IS_UNDEF) &&
+ EXPECTED(Z_TYPE(call->object) == IS_OBJECT)) {
+ call->called_scope = Z_OBJCE(call->object);
if (IS_VAR != IS_CONST ||
(call->fbc = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope)) == NULL) {
- zval *object = call->object;
+ zend_object *object = Z_OBJ(call->object);
- if (UNEXPECTED(Z_OBJ_HT_P(call->object)->get_method == NULL)) {
+ if (UNEXPECTED(Z_OBJ_HT(call->object)->get_method == NULL)) {
zend_error_noreturn(E_ERROR, "Object does not support method calls");
}
/* First, locate the function. */
- call->fbc = Z_OBJ_HT_P(call->object)->get_method(&call->object, function_name_strval, function_name_strlen, ((IS_VAR == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
+ call->fbc = Z_OBJ_HT(call->object)->get_method(&call->object, Z_STR_P(function_name), ((IS_VAR == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
if (UNEXPECTED(call->fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(call->object), function_name_strval);
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(&call->object), Z_STRVAL_P(function_name));
}
if (IS_VAR == IS_CONST &&
EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0) &&
- EXPECTED(call->object == object)) {
+ EXPECTED(Z_OBJ(call->object) == object)) {
CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope, call->fbc);
}
}
} else {
if (UNEXPECTED(EG(exception) != NULL)) {
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
HANDLE_EXCEPTION();
}
- zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval);
+ zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", Z_STRVAL_P(function_name));
}
if ((call->fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) {
- call->object = NULL;
+ ZVAL_UNDEF(&call->object);
} else {
- if (!PZVAL_IS_REF(call->object)) {
- Z_ADDREF_P(call->object); /* For $this pointer */
+ if (!Z_ISREF(call->object)) {
+ Z_ADDREF(call->object); /* For $this pointer */
} else {
- zval *this_ptr;
- ALLOC_ZVAL(this_ptr);
- INIT_PZVAL_COPY(this_ptr, call->object);
- zval_copy_ctor(this_ptr);
- call->object = this_ptr;
+ ZVAL_DUP(&call->object, Z_REFVAL(call->object));
}
}
@@ -10974,7 +10626,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE
call->is_ctor_call = 0;
EX(call) = call;
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -10986,11 +10638,11 @@ static int ZEND_FASTCALL ZEND_CASE_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- is_equal_function(&EX_T(opline->result.var).tmp_var,
+ is_equal_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -11003,29 +10655,24 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_VAR_HANDLER(ZEND_OPCOD
SAVE_OPLINE();
if ((IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) && opline->extended_value) {
- zval **expr_ptr_ptr = NULL;
-
- if (IS_TMP_VAR == IS_VAR && UNEXPECTED(expr_ptr_ptr == NULL)) {
+ expr_ptr = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ if (IS_TMP_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets");
}
- SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr_ptr);
- expr_ptr = *expr_ptr_ptr;
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr);
Z_ADDREF_P(expr_ptr);
} else {
expr_ptr=_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (1) { /* temporary variable */
- zval *new_expr;
+ zval new_expr;
- ALLOC_ZVAL(new_expr);
- INIT_PZVAL_COPY(new_expr, expr_ptr);
- expr_ptr = new_expr;
- } else if (IS_TMP_VAR == IS_CONST || PZVAL_IS_REF(expr_ptr)) {
- zval *new_expr;
+ ZVAL_COPY_VALUE(&new_expr, expr_ptr);
+ expr_ptr = &new_expr;
+ } else if (IS_TMP_VAR == IS_CONST || Z_ISREF_P(expr_ptr)) {
+ zval new_expr;
- ALLOC_ZVAL(new_expr);
- INIT_PZVAL_COPY(new_expr, expr_ptr);
- expr_ptr = new_expr;
- zendi_zval_copy_ctor(*expr_ptr);
+ ZVAL_DUP(&new_expr, expr_ptr);
+ expr_ptr = &new_expr;
} else if (IS_TMP_VAR == IS_CV) {
Z_ADDREF_P(expr_ptr);
@@ -11045,29 +10692,26 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_VAR_HANDLER(ZEND_OPCOD
case IS_BOOL:
hval = Z_LVAL_P(offset);
num_index:
- zend_hash_index_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), hval, &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr);
break;
case IS_STRING:
- if (IS_VAR == IS_CONST) {
- hval = Z_HASH_P(offset);
- } else {
+ if (IS_VAR != IS_CONST) {
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index);
- hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset));
}
- zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), Z_STR_P(offset), expr_ptr);
break;
case IS_NULL:
- zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), STR_EMPTY_ALLOC(), expr_ptr);
break;
default:
zend_error(E_WARNING, "Illegal offset type");
- zval_ptr_dtor(&expr_ptr);
+ zval_ptr_dtor(expr_ptr);
/* do nothing */
break;
}
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
} else {
- zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr);
}
if ((IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) && opline->extended_value) {
@@ -11080,7 +10724,7 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDL
{
USE_OPLINE
- array_init(&EX_T(opline->result.var).tmp_var);
+ array_init(EX_VAR(opline->result.var));
if (IS_TMP_VAR == IS_UNUSED) {
ZEND_VM_NEXT_OPCODE();
#if 0 || IS_TMP_VAR != IS_UNUSED
@@ -11102,13 +10746,13 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLE
IS_VAR == IS_UNUSED &&
(opline->extended_value & ZEND_QUICK_SET)) {
if (EG(active_symbol_table)) {
- zend_compiled_variable *cv = &CV_DEF_OF(opline->op1.var);
+ zend_string *cv = CV_DEF_OF(opline->op1.var);
- zend_delete_variable(EX(prev_execute_data), EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value TSRMLS_CC);
- EX_CV(opline->op1.var) = NULL;
- } else if (EX_CV(opline->op1.var)) {
- zval_ptr_dtor(EX_CV(opline->op1.var));
- EX_CV(opline->op1.var) = NULL;
+ zend_delete_variable(EX(prev_execute_data), EG(active_symbol_table), cv TSRMLS_CC);
+ ZVAL_UNDEF(EX_VAR_NUM(opline->op1.var));
+ } else if (Z_TYPE_P(EX_VAR_NUM(opline->op1.var)) != IS_UNDEF) {
+ zval_ptr_dtor(EX_VAR_NUM(opline->op1.var));
+ ZVAL_UNDEF(EX_VAR_NUM(opline->op1.var));
}
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -11117,8 +10761,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLE
varname = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (IS_TMP_VAR != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
- ZVAL_COPY_VALUE(&tmp, varname);
- zval_copy_ctor(&tmp);
+ ZVAL_DUP(&tmp, varname);
convert_to_string(&tmp);
varname = &tmp;
} else if (IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) {
@@ -11132,12 +10775,12 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLE
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
ce = CACHED_PTR(opline->op2.literal->cache_slot);
} else {
- ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
if (IS_TMP_VAR != IS_CONST && varname == &tmp) {
zval_dtor(&tmp);
} else if (IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) {
- zval_ptr_dtor(&varname);
+ zval_ptr_dtor(varname);
}
zval_dtor(free_op1.var);
HANDLE_EXCEPTION();
@@ -11148,20 +10791,18 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLE
CACHE_PTR(opline->op2.literal->cache_slot, ce);
}
} else {
- ce = EX_T(opline->op2.var).class_entry;
+ ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ zend_std_unset_static_property(ce, Z_STR_P(varname), ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
} else {
- ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1);
-
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
- zend_delete_variable(execute_data, target_symbol_table, varname->value.str.val, varname->value.str.len+1, hash_value TSRMLS_CC);
+ zend_delete_variable(execute_data, target_symbol_table, Z_STR_P(varname) TSRMLS_CC);
}
if (IS_TMP_VAR != IS_CONST && varname == &tmp) {
zval_dtor(&tmp);
} else if (IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) {
- zval_ptr_dtor(&varname);
+ zval_ptr_dtor(varname);
}
zval_dtor(free_op1.var);
CHECK_EXCEPTION();
@@ -11171,19 +10812,19 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLE
static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zval **value;
+ zval *value;
zend_bool isset = 1;
SAVE_OPLINE();
if (IS_TMP_VAR == IS_CV &&
IS_VAR == IS_UNUSED &&
(opline->extended_value & ZEND_QUICK_SET)) {
- if (EX_CV(opline->op1.var)) {
- value = EX_CV(opline->op1.var);
+ if (Z_TYPE_P(EX_VAR_NUM(opline->op1.var)) != IS_UNDEF) {
+ value = EX_VAR_NUM(opline->op1.var);
} else if (EG(active_symbol_table)) {
- zend_compiled_variable *cv = &CV_DEF_OF(opline->op1.var);
+ zend_string *cv = CV_DEF_OF(opline->op1.var);
- if (zend_hash_quick_find(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, (void **) &value) == FAILURE) {
+ if ((value = zend_hash_find(EG(active_symbol_table), cv)) == NULL) {
isset = 0;
}
} else {
@@ -11195,8 +10836,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_VAR_HANDLER(ZEND_OPCOD
zval tmp, *varname = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (IS_TMP_VAR != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
- ZVAL_COPY_VALUE(&tmp, varname);
- zval_copy_ctor(&tmp);
+ ZVAL_DUP(&tmp, varname);
convert_to_string(&tmp);
varname = &tmp;
}
@@ -11208,7 +10848,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_VAR_HANDLER(ZEND_OPCOD
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
ce = CACHED_PTR(opline->op2.literal->cache_slot);
} else {
- ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -11216,15 +10856,15 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_VAR_HANDLER(ZEND_OPCOD
CACHE_PTR(opline->op2.literal->cache_slot, ce);
}
} else {
- ce = EX_T(opline->op2.var).class_entry;
+ ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1, ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ value = zend_std_get_static_property(ce, Z_STR_P(varname), 1, ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
if (!value) {
isset = 0;
}
} else {
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
- if (zend_hash_find(target_symbol_table, varname->value.str.val, varname->value.str.len+1, (void **) &value) == FAILURE) {
+ if ((value = zend_hash_find(target_symbol_table, Z_STR_P(varname))) == NULL) {
isset = 0;
}
}
@@ -11236,16 +10876,16 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_VAR_HANDLER(ZEND_OPCOD
}
if (opline->extended_value & ZEND_ISSET) {
- if (isset && Z_TYPE_PP(value) != IS_NULL) {
- ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, 1);
+ if (isset && Z_TYPE_P(value) != IS_NULL) {
+ ZVAL_BOOL(EX_VAR(opline->result.var), 1);
} else {
- ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, 0);
+ ZVAL_BOOL(EX_VAR(opline->result.var), 0);
}
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (!isset || !i_zend_is_true(*value TSRMLS_CC)) {
- ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, 1);
+ if (!isset || !i_zend_is_true(value TSRMLS_CC)) {
+ ZVAL_BOOL(EX_VAR(opline->result.var), 1);
} else {
- ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, 0);
+ ZVAL_BOOL(EX_VAR(opline->result.var), 0);
}
}
@@ -11255,6 +10895,9 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_VAR_HANDLER(ZEND_OPCOD
static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
+//???
+return 0;
+#if 0
USE_OPLINE
/* The generator object is stored in return_value_ptr_ptr */
@@ -11297,7 +10940,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR
generator->value = copy;
} else {
- zval **value_ptr = NULL;
+ zval **value_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W);
if (IS_TMP_VAR == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
@@ -11325,7 +10968,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR
/* Consts, temporary variables and references need copying */
if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR
- || PZVAL_IS_REF(value)
+ || Z_ISREF_P(value)
) {
zval *copy;
@@ -11359,7 +11002,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR
/* Consts, temporary variables and references need copying */
if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR
- || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0)
+ || (Z_ISREF_P(key) && Z_REFCOUNT_P(key) > 0)
) {
zval *copy;
@@ -11383,7 +11026,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR
generator->largest_used_integer_key = Z_LVAL_P(generator->key);
}
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
} else {
/* If no key was specified we use auto-increment keys */
generator->largest_used_integer_key++;
@@ -11411,6 +11054,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR
SAVE_OPLINE();
ZEND_VM_RETURN();
+#endif
}
static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_UNUSED(int type, ZEND_OPCODE_HANDLER_ARGS)
@@ -11418,19 +11062,17 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_UNUSED(int type,
USE_OPLINE
zend_free_op free_op1;
zval *varname;
- zval **retval;
+ zval *retval;
zval tmp_varname;
HashTable *target_symbol_table;
- ulong hash_value;
SAVE_OPLINE();
varname = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (IS_TMP_VAR != IS_CONST && UNEXPECTED(Z_TYPE_P(varname) != IS_STRING)) {
- ZVAL_COPY_VALUE(&tmp_varname, varname);
- zval_copy_ctor(&tmp_varname);
- Z_SET_REFCOUNT(tmp_varname, 1);
- Z_UNSET_ISREF(tmp_varname);
+ ZVAL_DUP(&tmp_varname, varname);
+//??? Z_SET_REFCOUNT(tmp_varname, 1);
+//??? Z_UNSET_ISREF(tmp_varname);
convert_to_string(&tmp_varname);
varname = &tmp_varname;
}
@@ -11442,7 +11084,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_UNUSED(int type,
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
ce = CACHED_PTR(opline->op2.literal->cache_slot);
} else {
- ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
if (IS_TMP_VAR != IS_CONST && varname == &tmp_varname) {
zval_dtor(&tmp_varname);
@@ -11454,9 +11096,9 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_UNUSED(int type,
CACHE_PTR(opline->op2.literal->cache_slot, ce);
}
} else {
- ce = EX_T(opline->op2.var).class_entry;
+ ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0, ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ retval = zend_std_get_static_property(ce, Z_STR_P(varname), 0, ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
zval_dtor(free_op1.var);
} else {
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
@@ -11466,27 +11108,21 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_UNUSED(int type,
ZEND_VM_NEXT_OPCODE();
}
*/
- if (IS_TMP_VAR == IS_CONST) {
- hash_value = Z_HASH_P(varname);
- } else {
- hash_value = str_hash(Z_STRVAL_P(varname), Z_STRLEN_P(varname));
- }
-
- if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) {
+ if ((retval = zend_hash_find(target_symbol_table, Z_STR_P(varname))) == NULL) {
switch (type) {
case BP_VAR_R:
case BP_VAR_UNSET:
zend_error(E_NOTICE,"Undefined variable: %s", Z_STRVAL_P(varname));
/* break missing intentionally */
case BP_VAR_IS:
- retval = &EG(uninitialized_zval_ptr);
+ ZVAL_NULL(retval);
break;
case BP_VAR_RW:
zend_error(E_NOTICE,"Undefined variable: %s", Z_STRVAL_P(varname));
/* break missing intentionally */
case BP_VAR_W:
Z_ADDREF_P(&EG(uninitialized_zval));
- zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval);
+ retval = zend_hash_update(target_symbol_table, Z_STR_P(varname), &EG(uninitialized_zval));
break;
EMPTY_SWITCH_DEFAULT_CASE()
}
@@ -11505,7 +11141,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_UNUSED(int type,
break;
case ZEND_FETCH_GLOBAL_LOCK:
if (IS_TMP_VAR == IS_VAR && !free_op1.var) {
- PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
+ Z_ADDREF_P(EX_VAR(opline->op1.var));
}
break;
}
@@ -11518,27 +11154,26 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_UNUSED(int type,
if (opline->extended_value & ZEND_FETCH_MAKE_REF) {
SEPARATE_ZVAL_TO_MAKE_IS_REF(retval);
}
- PZVAL_LOCK(*retval);
- switch (type) {
- case BP_VAR_R:
- case BP_VAR_IS:
- EX_T(opline->result.var).var.ptr = *retval;
- break;
- case BP_VAR_UNSET: {
- zend_free_op free_res;
-
- PZVAL_UNLOCK(*retval, &free_res);
- if (retval != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(retval);
- }
- PZVAL_LOCK(*retval);
- FREE_OP_VAR_PTR(free_res);
- }
- /* break missing intentionally */
- default:
- EX_T(opline->result.var).var.ptr_ptr = retval;
- break;
- }
+ ZVAL_COPY(EX_VAR(opline->result.var), retval);
+//??? switch (type) {
+//??? case BP_VAR_R:
+//??? case BP_VAR_IS:
+//??? break;
+//??? case BP_VAR_UNSET: {
+//??? zend_free_op free_res;
+//???
+//??? PZVAL_UNLOCK(*retval, &free_res);
+//??? if (retval != &EG(uninitialized_zval_ptr)) {
+//??? SEPARATE_ZVAL_IF_NOT_REF(retval);
+//??? }
+//??? PZVAL_LOCK(*retval);
+//??? FREE_OP_VAR_PTR(free_res);
+//??? }
+//??? /* break missing intentionally */
+//??? default:
+//??? EX_T(opline->result.var).var.ptr_ptr = retval;
+//??? break;
+//??? }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -11583,29 +11218,24 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_UNUSED_HANDLER(ZEND_OP
SAVE_OPLINE();
if ((IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) && opline->extended_value) {
- zval **expr_ptr_ptr = NULL;
-
- if (IS_TMP_VAR == IS_VAR && UNEXPECTED(expr_ptr_ptr == NULL)) {
+ expr_ptr = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ if (IS_TMP_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets");
}
- SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr_ptr);
- expr_ptr = *expr_ptr_ptr;
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr);
Z_ADDREF_P(expr_ptr);
} else {
expr_ptr=_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (1) { /* temporary variable */
- zval *new_expr;
+ zval new_expr;
- ALLOC_ZVAL(new_expr);
- INIT_PZVAL_COPY(new_expr, expr_ptr);
- expr_ptr = new_expr;
- } else if (IS_TMP_VAR == IS_CONST || PZVAL_IS_REF(expr_ptr)) {
- zval *new_expr;
+ ZVAL_COPY_VALUE(&new_expr, expr_ptr);
+ expr_ptr = &new_expr;
+ } else if (IS_TMP_VAR == IS_CONST || Z_ISREF_P(expr_ptr)) {
+ zval new_expr;
- ALLOC_ZVAL(new_expr);
- INIT_PZVAL_COPY(new_expr, expr_ptr);
- expr_ptr = new_expr;
- zendi_zval_copy_ctor(*expr_ptr);
+ ZVAL_DUP(&new_expr, expr_ptr);
+ expr_ptr = &new_expr;
} else if (IS_TMP_VAR == IS_CV) {
Z_ADDREF_P(expr_ptr);
@@ -11625,29 +11255,26 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_UNUSED_HANDLER(ZEND_OP
case IS_BOOL:
hval = Z_LVAL_P(offset);
num_index:
- zend_hash_index_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), hval, &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr);
break;
case IS_STRING:
- if (IS_UNUSED == IS_CONST) {
- hval = Z_HASH_P(offset);
- } else {
+ if (IS_UNUSED != IS_CONST) {
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index);
- hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset));
}
- zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), Z_STR_P(offset), expr_ptr);
break;
case IS_NULL:
- zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), STR_EMPTY_ALLOC(), expr_ptr);
break;
default:
zend_error(E_WARNING, "Illegal offset type");
- zval_ptr_dtor(&expr_ptr);
+ zval_ptr_dtor(expr_ptr);
/* do nothing */
break;
}
} else {
- zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr);
}
if ((IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) && opline->extended_value) {
@@ -11660,7 +11287,7 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HA
{
USE_OPLINE
- array_init(&EX_T(opline->result.var).tmp_var);
+ array_init(EX_VAR(opline->result.var));
if (IS_TMP_VAR == IS_UNUSED) {
ZEND_VM_NEXT_OPCODE();
#if 0 || IS_TMP_VAR != IS_UNUSED
@@ -11682,13 +11309,13 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HAN
IS_UNUSED == IS_UNUSED &&
(opline->extended_value & ZEND_QUICK_SET)) {
if (EG(active_symbol_table)) {
- zend_compiled_variable *cv = &CV_DEF_OF(opline->op1.var);
+ zend_string *cv = CV_DEF_OF(opline->op1.var);
- zend_delete_variable(EX(prev_execute_data), EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value TSRMLS_CC);
- EX_CV(opline->op1.var) = NULL;
- } else if (EX_CV(opline->op1.var)) {
- zval_ptr_dtor(EX_CV(opline->op1.var));
- EX_CV(opline->op1.var) = NULL;
+ zend_delete_variable(EX(prev_execute_data), EG(active_symbol_table), cv TSRMLS_CC);
+ ZVAL_UNDEF(EX_VAR_NUM(opline->op1.var));
+ } else if (Z_TYPE_P(EX_VAR_NUM(opline->op1.var)) != IS_UNDEF) {
+ zval_ptr_dtor(EX_VAR_NUM(opline->op1.var));
+ ZVAL_UNDEF(EX_VAR_NUM(opline->op1.var));
}
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -11697,8 +11324,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HAN
varname = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (IS_TMP_VAR != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
- ZVAL_COPY_VALUE(&tmp, varname);
- zval_copy_ctor(&tmp);
+ ZVAL_DUP(&tmp, varname);
convert_to_string(&tmp);
varname = &tmp;
} else if (IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) {
@@ -11712,12 +11338,12 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HAN
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
ce = CACHED_PTR(opline->op2.literal->cache_slot);
} else {
- ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
if (IS_TMP_VAR != IS_CONST && varname == &tmp) {
zval_dtor(&tmp);
} else if (IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) {
- zval_ptr_dtor(&varname);
+ zval_ptr_dtor(varname);
}
zval_dtor(free_op1.var);
HANDLE_EXCEPTION();
@@ -11728,20 +11354,18 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HAN
CACHE_PTR(opline->op2.literal->cache_slot, ce);
}
} else {
- ce = EX_T(opline->op2.var).class_entry;
+ ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ zend_std_unset_static_property(ce, Z_STR_P(varname), ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
} else {
- ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1);
-
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
- zend_delete_variable(execute_data, target_symbol_table, varname->value.str.val, varname->value.str.len+1, hash_value TSRMLS_CC);
+ zend_delete_variable(execute_data, target_symbol_table, Z_STR_P(varname) TSRMLS_CC);
}
if (IS_TMP_VAR != IS_CONST && varname == &tmp) {
zval_dtor(&tmp);
} else if (IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) {
- zval_ptr_dtor(&varname);
+ zval_ptr_dtor(varname);
}
zval_dtor(free_op1.var);
CHECK_EXCEPTION();
@@ -11751,19 +11375,19 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HAN
static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zval **value;
+ zval *value;
zend_bool isset = 1;
SAVE_OPLINE();
if (IS_TMP_VAR == IS_CV &&
IS_UNUSED == IS_UNUSED &&
(opline->extended_value & ZEND_QUICK_SET)) {
- if (EX_CV(opline->op1.var)) {
- value = EX_CV(opline->op1.var);
+ if (Z_TYPE_P(EX_VAR_NUM(opline->op1.var)) != IS_UNDEF) {
+ value = EX_VAR_NUM(opline->op1.var);
} else if (EG(active_symbol_table)) {
- zend_compiled_variable *cv = &CV_DEF_OF(opline->op1.var);
+ zend_string *cv = CV_DEF_OF(opline->op1.var);
- if (zend_hash_quick_find(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, (void **) &value) == FAILURE) {
+ if ((value = zend_hash_find(EG(active_symbol_table), cv)) == NULL) {
isset = 0;
}
} else {
@@ -11775,8 +11399,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_UNUSED_HANDLER(ZEND_OP
zval tmp, *varname = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (IS_TMP_VAR != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
- ZVAL_COPY_VALUE(&tmp, varname);
- zval_copy_ctor(&tmp);
+ ZVAL_DUP(&tmp, varname);
convert_to_string(&tmp);
varname = &tmp;
}
@@ -11788,7 +11411,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_UNUSED_HANDLER(ZEND_OP
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
ce = CACHED_PTR(opline->op2.literal->cache_slot);
} else {
- ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -11796,15 +11419,15 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_UNUSED_HANDLER(ZEND_OP
CACHE_PTR(opline->op2.literal->cache_slot, ce);
}
} else {
- ce = EX_T(opline->op2.var).class_entry;
+ ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1, ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ value = zend_std_get_static_property(ce, Z_STR_P(varname), 1, ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
if (!value) {
isset = 0;
}
} else {
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
- if (zend_hash_find(target_symbol_table, varname->value.str.val, varname->value.str.len+1, (void **) &value) == FAILURE) {
+ if ((value = zend_hash_find(target_symbol_table, Z_STR_P(varname))) == NULL) {
isset = 0;
}
}
@@ -11816,16 +11439,16 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_UNUSED_HANDLER(ZEND_OP
}
if (opline->extended_value & ZEND_ISSET) {
- if (isset && Z_TYPE_PP(value) != IS_NULL) {
- ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, 1);
+ if (isset && Z_TYPE_P(value) != IS_NULL) {
+ ZVAL_BOOL(EX_VAR(opline->result.var), 1);
} else {
- ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, 0);
+ ZVAL_BOOL(EX_VAR(opline->result.var), 0);
}
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (!isset || !i_zend_is_true(*value TSRMLS_CC)) {
- ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, 1);
+ if (!isset || !i_zend_is_true(value TSRMLS_CC)) {
+ ZVAL_BOOL(EX_VAR(opline->result.var), 1);
} else {
- ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, 0);
+ ZVAL_BOOL(EX_VAR(opline->result.var), 0);
}
}
@@ -11835,6 +11458,9 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_UNUSED_HANDLER(ZEND_OP
static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
+//???
+return 0;
+#if 0
USE_OPLINE
/* The generator object is stored in return_value_ptr_ptr */
@@ -11877,7 +11503,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HANDLER
generator->value = copy;
} else {
- zval **value_ptr = NULL;
+ zval **value_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W);
if (IS_TMP_VAR == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
@@ -11905,7 +11531,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HANDLER
/* Consts, temporary variables and references need copying */
if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR
- || PZVAL_IS_REF(value)
+ || Z_ISREF_P(value)
) {
zval *copy;
@@ -11939,7 +11565,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HANDLER
/* Consts, temporary variables and references need copying */
if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR
- || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0)
+ || (Z_ISREF_P(key) && Z_REFCOUNT_P(key) > 0)
) {
zval *copy;
@@ -11990,6 +11616,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HANDLER
SAVE_OPLINE();
ZEND_VM_RETURN();
+#endif
}
static int ZEND_FASTCALL ZEND_ADD_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -11998,7 +11625,7 @@ static int ZEND_FASTCALL ZEND_ADD_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_free_op free_op1;
SAVE_OPLINE();
- fast_add_function(&EX_T(opline->result.var).tmp_var,
+ fast_add_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
zval_dtor(free_op1.var);
@@ -12013,7 +11640,7 @@ static int ZEND_FASTCALL ZEND_SUB_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_free_op free_op1;
SAVE_OPLINE();
- fast_sub_function(&EX_T(opline->result.var).tmp_var,
+ fast_sub_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
zval_dtor(free_op1.var);
@@ -12028,7 +11655,7 @@ static int ZEND_FASTCALL ZEND_MUL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_free_op free_op1;
SAVE_OPLINE();
- fast_mul_function(&EX_T(opline->result.var).tmp_var,
+ fast_mul_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
zval_dtor(free_op1.var);
@@ -12043,7 +11670,7 @@ static int ZEND_FASTCALL ZEND_DIV_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_free_op free_op1;
SAVE_OPLINE();
- fast_div_function(&EX_T(opline->result.var).tmp_var,
+ fast_div_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
zval_dtor(free_op1.var);
@@ -12058,7 +11685,7 @@ static int ZEND_FASTCALL ZEND_MOD_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_free_op free_op1;
SAVE_OPLINE();
- fast_mod_function(&EX_T(opline->result.var).tmp_var,
+ fast_mod_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
zval_dtor(free_op1.var);
@@ -12073,7 +11700,7 @@ static int ZEND_FASTCALL ZEND_SL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_free_op free_op1;
SAVE_OPLINE();
- shift_left_function(&EX_T(opline->result.var).tmp_var,
+ shift_left_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
zval_dtor(free_op1.var);
@@ -12088,7 +11715,7 @@ static int ZEND_FASTCALL ZEND_SR_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_free_op free_op1;
SAVE_OPLINE();
- shift_right_function(&EX_T(opline->result.var).tmp_var,
+ shift_right_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
zval_dtor(free_op1.var);
@@ -12103,7 +11730,7 @@ static int ZEND_FASTCALL ZEND_CONCAT_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_AR
zend_free_op free_op1;
SAVE_OPLINE();
- concat_function(&EX_T(opline->result.var).tmp_var,
+ concat_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
zval_dtor(free_op1.var);
@@ -12118,7 +11745,7 @@ static int ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HAND
zend_free_op free_op1;
SAVE_OPLINE();
- is_identical_function(&EX_T(opline->result.var).tmp_var,
+ is_identical_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
zval_dtor(free_op1.var);
@@ -12131,7 +11758,7 @@ static int ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_
{
USE_OPLINE
zend_free_op free_op1;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
is_identical_function(result,
@@ -12148,7 +11775,7 @@ static int ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_
{
USE_OPLINE
zend_free_op free_op1;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_equal_function(result,
@@ -12164,7 +11791,7 @@ static int ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HAND
{
USE_OPLINE
zend_free_op free_op1;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_not_equal_function(result,
@@ -12180,7 +11807,7 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLE
{
USE_OPLINE
zend_free_op free_op1;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_is_smaller_function(result,
@@ -12196,7 +11823,7 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_TMP_CV_HANDLER(ZEND_OPCO
{
USE_OPLINE
zend_free_op free_op1;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_is_smaller_or_equal_function(result,
@@ -12214,7 +11841,7 @@ static int ZEND_FASTCALL ZEND_BW_OR_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG
zend_free_op free_op1;
SAVE_OPLINE();
- bitwise_or_function(&EX_T(opline->result.var).tmp_var,
+ bitwise_or_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
zval_dtor(free_op1.var);
@@ -12229,7 +11856,7 @@ static int ZEND_FASTCALL ZEND_BW_AND_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_AR
zend_free_op free_op1;
SAVE_OPLINE();
- bitwise_and_function(&EX_T(opline->result.var).tmp_var,
+ bitwise_and_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
zval_dtor(free_op1.var);
@@ -12244,7 +11871,7 @@ static int ZEND_FASTCALL ZEND_BW_XOR_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_AR
zend_free_op free_op1;
SAVE_OPLINE();
- bitwise_xor_function(&EX_T(opline->result.var).tmp_var,
+ bitwise_xor_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
zval_dtor(free_op1.var);
@@ -12259,7 +11886,7 @@ static int ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_
zend_free_op free_op1;
SAVE_OPLINE();
- boolean_xor_function(&EX_T(opline->result.var).tmp_var,
+ boolean_xor_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
zval_dtor(free_op1.var);
@@ -12276,7 +11903,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDL
SAVE_OPLINE();
container = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_R TSRMLS_CC);
+ zend_fetch_dimension_address_read(EX_VAR(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_R TSRMLS_CC);
if (IS_TMP_VAR != IS_VAR || !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
zval_dtor(free_op1.var);
@@ -12289,7 +11916,7 @@ static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_A
{
USE_OPLINE
- zval *str = &EX_T(opline->result.var).tmp_var;
+ zval *str = EX_VAR(opline->result.var);
zval *var;
zval var_copy;
int use_copy = 0;
@@ -12299,11 +11926,7 @@ static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_A
if (IS_TMP_VAR == IS_UNUSED) {
/* Initialize for erealloc in add_string_to_string */
- Z_STRVAL_P(str) = NULL;
- Z_STRLEN_P(str) = 0;
- Z_TYPE_P(str) = IS_STRING;
-
- INIT_PZVAL(str);
+ ZVAL_STR(str, STR_EMPTY_ALLOC());
}
if (Z_TYPE_P(var) != IS_STRING) {
@@ -12333,8 +11956,6 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_
{
USE_OPLINE
zval *function_name;
- char *function_name_strval;
- int function_name_strlen;
zend_free_op free_op1;
call_slot *call = EX(call_slots) + opline->result.num;
@@ -12350,32 +11971,29 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_
zend_error_noreturn(E_ERROR, "Method name must be a string");
}
- function_name_strval = Z_STRVAL_P(function_name);
- function_name_strlen = Z_STRLEN_P(function_name);
-
- call->object = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ ZVAL_COPY_VALUE(&call->object, _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC));
- if (EXPECTED(call->object != NULL) &&
- EXPECTED(Z_TYPE_P(call->object) == IS_OBJECT)) {
- call->called_scope = Z_OBJCE_P(call->object);
+ if (EXPECTED(Z_TYPE(call->object) != IS_UNDEF) &&
+ EXPECTED(Z_TYPE(call->object) == IS_OBJECT)) {
+ call->called_scope = Z_OBJCE(call->object);
if (IS_CV != IS_CONST ||
(call->fbc = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope)) == NULL) {
- zval *object = call->object;
+ zend_object *object = Z_OBJ(call->object);
- if (UNEXPECTED(Z_OBJ_HT_P(call->object)->get_method == NULL)) {
+ if (UNEXPECTED(Z_OBJ_HT(call->object)->get_method == NULL)) {
zend_error_noreturn(E_ERROR, "Object does not support method calls");
}
/* First, locate the function. */
- call->fbc = Z_OBJ_HT_P(call->object)->get_method(&call->object, function_name_strval, function_name_strlen, ((IS_CV == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
+ call->fbc = Z_OBJ_HT(call->object)->get_method(&call->object, Z_STR_P(function_name), ((IS_CV == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
if (UNEXPECTED(call->fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(call->object), function_name_strval);
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(&call->object), Z_STRVAL_P(function_name));
}
if (IS_CV == IS_CONST &&
EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0) &&
- EXPECTED(call->object == object)) {
+ EXPECTED(Z_OBJ(call->object) == object)) {
CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope, call->fbc);
}
}
@@ -12384,20 +12002,16 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_
HANDLE_EXCEPTION();
}
- zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval);
+ zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", Z_STRVAL_P(function_name));
}
if ((call->fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) {
- call->object = NULL;
+ ZVAL_UNDEF(&call->object);
} else {
- if (!PZVAL_IS_REF(call->object)) {
- Z_ADDREF_P(call->object); /* For $this pointer */
+ if (!Z_ISREF(call->object)) {
+ Z_ADDREF(call->object); /* For $this pointer */
} else {
- zval *this_ptr;
- ALLOC_ZVAL(this_ptr);
- INIT_PZVAL_COPY(this_ptr, call->object);
- zval_copy_ctor(this_ptr);
- call->object = this_ptr;
+ ZVAL_DUP(&call->object, Z_REFVAL(call->object));
}
}
@@ -12416,7 +12030,7 @@ static int ZEND_FASTCALL ZEND_CASE_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS
zend_free_op free_op1;
SAVE_OPLINE();
- is_equal_function(&EX_T(opline->result.var).tmp_var,
+ is_equal_function(EX_VAR(opline->result.var),
_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
@@ -12432,29 +12046,24 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CV_HANDLER(ZEND_OPCODE
SAVE_OPLINE();
if ((IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) && opline->extended_value) {
- zval **expr_ptr_ptr = NULL;
-
- if (IS_TMP_VAR == IS_VAR && UNEXPECTED(expr_ptr_ptr == NULL)) {
+ expr_ptr = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ if (IS_TMP_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets");
}
- SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr_ptr);
- expr_ptr = *expr_ptr_ptr;
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr);
Z_ADDREF_P(expr_ptr);
} else {
expr_ptr=_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (1) { /* temporary variable */
- zval *new_expr;
+ zval new_expr;
- ALLOC_ZVAL(new_expr);
- INIT_PZVAL_COPY(new_expr, expr_ptr);
- expr_ptr = new_expr;
- } else if (IS_TMP_VAR == IS_CONST || PZVAL_IS_REF(expr_ptr)) {
- zval *new_expr;
+ ZVAL_COPY_VALUE(&new_expr, expr_ptr);
+ expr_ptr = &new_expr;
+ } else if (IS_TMP_VAR == IS_CONST || Z_ISREF_P(expr_ptr)) {
+ zval new_expr;
- ALLOC_ZVAL(new_expr);
- INIT_PZVAL_COPY(new_expr, expr_ptr);
- expr_ptr = new_expr;
- zendi_zval_copy_ctor(*expr_ptr);
+ ZVAL_DUP(&new_expr, expr_ptr);
+ expr_ptr = &new_expr;
} else if (IS_TMP_VAR == IS_CV) {
Z_ADDREF_P(expr_ptr);
@@ -12474,29 +12083,26 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CV_HANDLER(ZEND_OPCODE
case IS_BOOL:
hval = Z_LVAL_P(offset);
num_index:
- zend_hash_index_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), hval, &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr);
break;
case IS_STRING:
- if (IS_CV == IS_CONST) {
- hval = Z_HASH_P(offset);
- } else {
+ if (IS_CV != IS_CONST) {
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index);
- hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset));
}
- zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), Z_STR_P(offset), expr_ptr);
break;
case IS_NULL:
- zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), STR_EMPTY_ALLOC(), expr_ptr);
break;
default:
zend_error(E_WARNING, "Illegal offset type");
- zval_ptr_dtor(&expr_ptr);
+ zval_ptr_dtor(expr_ptr);
/* do nothing */
break;
}
} else {
- zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr);
}
if ((IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) && opline->extended_value) {
@@ -12509,7 +12115,7 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLE
{
USE_OPLINE
- array_init(&EX_T(opline->result.var).tmp_var);
+ array_init(EX_VAR(opline->result.var));
if (IS_TMP_VAR == IS_UNUSED) {
ZEND_VM_NEXT_OPCODE();
#if 0 || IS_TMP_VAR != IS_UNUSED
@@ -12521,6 +12127,9 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLE
static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
+//???
+return 0;
+#if 0
USE_OPLINE
/* The generator object is stored in return_value_ptr_ptr */
@@ -12563,7 +12172,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG
generator->value = copy;
} else {
- zval **value_ptr = NULL;
+ zval **value_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W);
if (IS_TMP_VAR == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
@@ -12591,7 +12200,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG
/* Consts, temporary variables and references need copying */
if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR
- || PZVAL_IS_REF(value)
+ || Z_ISREF_P(value)
) {
zval *copy;
@@ -12625,7 +12234,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG
/* Consts, temporary variables and references need copying */
if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR
- || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0)
+ || (Z_ISREF_P(key) && Z_REFCOUNT_P(key) > 0)
) {
zval *copy;
@@ -12676,6 +12285,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG
SAVE_OPLINE();
ZEND_VM_RETURN();
+#endif
}
static int ZEND_FASTCALL ZEND_BW_NOT_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -12684,9 +12294,9 @@ static int ZEND_FASTCALL ZEND_BW_NOT_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_free_op free_op1;
SAVE_OPLINE();
- bitwise_not_function(&EX_T(opline->result.var).tmp_var,
+ bitwise_not_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -12697,9 +12307,9 @@ static int ZEND_FASTCALL ZEND_BOOL_NOT_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
zend_free_op free_op1;
SAVE_OPLINE();
- boolean_not_function(&EX_T(opline->result.var).tmp_var,
+ boolean_not_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -12708,45 +12318,43 @@ static int ZEND_FASTCALL ZEND_PRE_INC_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS
{
USE_OPLINE
zend_free_op free_op1;
- zval **var_ptr;
+ zval *var_ptr;
SAVE_OPLINE();
- var_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ var_ptr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- if (IS_VAR == IS_VAR && UNEXPECTED(*var_ptr == &EG(error_zval))) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(var_ptr == &EG(error_zval))) {
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
SEPARATE_ZVAL_IF_NOT_REF(var_ptr);
- if (UNEXPECTED(Z_TYPE_PP(var_ptr) == IS_OBJECT)
- && Z_OBJ_HANDLER_PP(var_ptr, get)
- && Z_OBJ_HANDLER_PP(var_ptr, set)) {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_OBJECT)
+ && Z_OBJ_HANDLER_P(var_ptr, get)
+ && Z_OBJ_HANDLER_P(var_ptr, set)) {
/* proxy object */
- zval *val = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC);
+ zval *val = Z_OBJ_HANDLER_P(var_ptr, get)(var_ptr TSRMLS_CC);
Z_ADDREF_P(val);
fast_increment_function(val);
- Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, val TSRMLS_CC);
- zval_ptr_dtor(&val);
+ Z_OBJ_HANDLER_P(var_ptr, set)(var_ptr, val TSRMLS_CC);
+ zval_ptr_dtor(val);
} else {
- fast_increment_function(*var_ptr);
+ fast_increment_function(var_ptr);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(*var_ptr);
- EX_T(opline->result.var).var.ptr = *var_ptr;
+ ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -12755,45 +12363,43 @@ static int ZEND_FASTCALL ZEND_PRE_DEC_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS
{
USE_OPLINE
zend_free_op free_op1;
- zval **var_ptr;
+ zval *var_ptr;
SAVE_OPLINE();
- var_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ var_ptr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- if (IS_VAR == IS_VAR && UNEXPECTED(*var_ptr == &EG(error_zval))) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(var_ptr == &EG(error_zval))) {
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
SEPARATE_ZVAL_IF_NOT_REF(var_ptr);
- if (UNEXPECTED(Z_TYPE_PP(var_ptr) == IS_OBJECT)
- && Z_OBJ_HANDLER_PP(var_ptr, get)
- && Z_OBJ_HANDLER_PP(var_ptr, set)) {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_OBJECT)
+ && Z_OBJ_HANDLER_P(var_ptr, get)
+ && Z_OBJ_HANDLER_P(var_ptr, set)) {
/* proxy object */
- zval *val = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC);
+ zval *val = Z_OBJ_HANDLER_P(var_ptr, get)(var_ptr TSRMLS_CC);
Z_ADDREF_P(val);
fast_decrement_function(val);
- Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, val TSRMLS_CC);
- zval_ptr_dtor(&val);
+ Z_OBJ_HANDLER_P(var_ptr, set)(var_ptr, val TSRMLS_CC);
+ zval_ptr_dtor(val);
} else {
- fast_decrement_function(*var_ptr);
+ fast_decrement_function(var_ptr);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(*var_ptr);
- EX_T(opline->result.var).var.ptr = *var_ptr;
+ ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -12802,41 +12408,40 @@ static int ZEND_FASTCALL ZEND_POST_INC_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
{
USE_OPLINE
zend_free_op free_op1;
- zval **var_ptr, *retval;
+ zval *var_ptr, *retval;
SAVE_OPLINE();
- var_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ var_ptr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- if (IS_VAR == IS_VAR && UNEXPECTED(*var_ptr == &EG(error_zval))) {
- ZVAL_NULL(&EX_T(opline->result.var).tmp_var);
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (IS_VAR == IS_VAR && UNEXPECTED(var_ptr == &EG(error_zval))) {
+ ZVAL_NULL(EX_VAR(opline->result.var));
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
- retval = &EX_T(opline->result.var).tmp_var;
- ZVAL_COPY_VALUE(retval, *var_ptr);
- zendi_zval_copy_ctor(*retval);
+ retval = EX_VAR(opline->result.var);
+ ZVAL_DUP(retval, var_ptr);
SEPARATE_ZVAL_IF_NOT_REF(var_ptr);
- if (UNEXPECTED(Z_TYPE_PP(var_ptr) == IS_OBJECT)
- && Z_OBJ_HANDLER_PP(var_ptr, get)
- && Z_OBJ_HANDLER_PP(var_ptr, set)) {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_OBJECT)
+ && Z_OBJ_HANDLER_P(var_ptr, get)
+ && Z_OBJ_HANDLER_P(var_ptr, set)) {
/* proxy object */
- zval *val = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC);
+ zval *val = Z_OBJ_HANDLER_P(var_ptr, get)(var_ptr TSRMLS_CC);
Z_ADDREF_P(val);
fast_increment_function(val);
- Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, val TSRMLS_CC);
- zval_ptr_dtor(&val);
+ Z_OBJ_HANDLER_P(var_ptr, set)(var_ptr, val TSRMLS_CC);
+ zval_ptr_dtor(val);
} else {
- fast_increment_function(*var_ptr);
+ fast_increment_function(var_ptr);
}
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -12845,41 +12450,40 @@ static int ZEND_FASTCALL ZEND_POST_DEC_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
{
USE_OPLINE
zend_free_op free_op1;
- zval **var_ptr, *retval;
+ zval *var_ptr, *retval;
SAVE_OPLINE();
- var_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ var_ptr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- if (IS_VAR == IS_VAR && UNEXPECTED(*var_ptr == &EG(error_zval))) {
- ZVAL_NULL(&EX_T(opline->result.var).tmp_var);
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (IS_VAR == IS_VAR && UNEXPECTED(var_ptr == &EG(error_zval))) {
+ ZVAL_NULL(EX_VAR(opline->result.var));
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
- retval = &EX_T(opline->result.var).tmp_var;
- ZVAL_COPY_VALUE(retval, *var_ptr);
- zendi_zval_copy_ctor(*retval);
+ retval = EX_VAR(opline->result.var);
+ ZVAL_DUP(retval, var_ptr);
SEPARATE_ZVAL_IF_NOT_REF(var_ptr);
- if (UNEXPECTED(Z_TYPE_PP(var_ptr) == IS_OBJECT)
- && Z_OBJ_HANDLER_PP(var_ptr, get)
- && Z_OBJ_HANDLER_PP(var_ptr, set)) {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_OBJECT)
+ && Z_OBJ_HANDLER_P(var_ptr, get)
+ && Z_OBJ_HANDLER_P(var_ptr, set)) {
/* proxy object */
- zval *val = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC);
+ zval *val = Z_OBJ_HANDLER_P(var_ptr, get)(var_ptr TSRMLS_CC);
Z_ADDREF_P(val);
fast_decrement_function(val);
- Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, val TSRMLS_CC);
- zval_ptr_dtor(&val);
+ Z_OBJ_HANDLER_P(var_ptr, set)(var_ptr, val TSRMLS_CC);
+ zval_ptr_dtor(val);
} else {
- fast_decrement_function(*var_ptr);
+ fast_decrement_function(var_ptr);
}
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -12894,11 +12498,11 @@ static int ZEND_FASTCALL ZEND_ECHO_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
z = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (IS_VAR == IS_TMP_VAR && Z_TYPE_P(z) == IS_OBJECT) {
- INIT_PZVAL(z);
+//??? INIT_PZVAL(z);
}
zend_print_variable(z);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -12907,7 +12511,7 @@ static int ZEND_FASTCALL ZEND_PRINT_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- ZVAL_LONG(&EX_T(opline->result.var).tmp_var, 1);
+ ZVAL_LONG(EX_VAR(opline->result.var), 1);
return ZEND_ECHO_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
@@ -12925,7 +12529,7 @@ static int ZEND_FASTCALL ZEND_JMPZ_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
ret = Z_LVAL_P(val);
} else {
ret = i_zend_is_true(val TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
@@ -12955,7 +12559,7 @@ static int ZEND_FASTCALL ZEND_JMPNZ_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
ret = Z_LVAL_P(val);
} else {
ret = i_zend_is_true(val TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
@@ -12985,7 +12589,7 @@ static int ZEND_FASTCALL ZEND_JMPZNZ_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
retval = Z_LVAL_P(val);
} else {
retval = i_zend_is_true(val TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
@@ -13019,13 +12623,12 @@ static int ZEND_FASTCALL ZEND_JMPZ_EX_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS
retval = Z_LVAL_P(val);
} else {
retval = i_zend_is_true(val TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
}
- Z_LVAL(EX_T(opline->result.var).tmp_var) = retval;
- Z_TYPE(EX_T(opline->result.var).tmp_var) = IS_BOOL;
+ ZVAL_BOOL(EX_VAR(opline->result.var), retval);
if (!retval) {
#if DEBUG_ZEND>=2
printf("Conditional jmp to %d\n", opline->op2.opline_num);
@@ -13050,13 +12653,12 @@ static int ZEND_FASTCALL ZEND_JMPNZ_EX_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
retval = Z_LVAL_P(val);
} else {
retval = i_zend_is_true(val TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
}
- Z_LVAL(EX_T(opline->result.var).tmp_var) = retval;
- Z_TYPE(EX_T(opline->result.var).tmp_var) = IS_BOOL;
+ ZVAL_BOOL(EX_VAR(opline->result.var), retval);
if (retval) {
#if DEBUG_ZEND>=2
printf("Conditional jmp to %d\n", opline->op2.opline_num);
@@ -13073,9 +12675,9 @@ static int ZEND_FASTCALL ZEND_FREE_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
SAVE_OPLINE();
if (IS_VAR == IS_TMP_VAR) {
- zendi_zval_dtor(EX_T(opline->op1.var).tmp_var);
+ zval_dtor(EX_VAR(opline->op1.var));
} else {
- zval_ptr_dtor(&EX_T(opline->op1.var).var.ptr);
+ zval_ptr_dtor(EX_VAR(opline->op1.var));
}
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -13090,32 +12692,22 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
SAVE_OPLINE();
retval_ptr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (!EG(return_value_ptr_ptr)) {
- zval_ptr_dtor_nogc(&free_op1.var);
+ if (/*???!EG(return_value_ptr_ptr)*/0) {
+ zval_ptr_dtor_nogc(free_op1.var);
} else {
if (IS_VAR == IS_CONST ||
IS_VAR == IS_TMP_VAR ||
- PZVAL_IS_REF(retval_ptr)) {
- zval *ret;
+ Z_ISREF_P(retval_ptr)) {
+ zval ret;
- ALLOC_ZVAL(ret);
- INIT_PZVAL_COPY(ret, retval_ptr);
+ ZVAL_COPY_VALUE(&ret, retval_ptr);
if (IS_VAR != IS_TMP_VAR) {
- zval_copy_ctor(ret);
+ zval_copy_ctor(&ret);
}
- *EG(return_value_ptr_ptr) = ret;
- zval_ptr_dtor_nogc(&free_op1.var);
- } else if ((IS_VAR == IS_CV || IS_VAR == IS_VAR) &&
- retval_ptr == &EG(uninitialized_zval)) {
- zval *ret;
-
- if (IS_VAR == IS_VAR) {
- Z_DELREF_P(retval_ptr);
- }
- ALLOC_INIT_ZVAL(ret);
- *EG(return_value_ptr_ptr) = ret;
+//??? *EG(return_value_ptr_ptr) = ret;
+ zval_ptr_dtor_nogc(free_op1.var);
} else {
- *EG(return_value_ptr_ptr) = retval_ptr;
+//??? *EG(return_value_ptr_ptr) = retval_ptr;
if (IS_VAR == IS_CV) {
Z_ADDREF_P(retval_ptr);
}
@@ -13128,7 +12720,6 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLE
{
USE_OPLINE
zval *retval_ptr;
- zval **retval_ptr_ptr;
zend_free_op free_op1;
SAVE_OPLINE();
@@ -13140,33 +12731,32 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLE
zend_error(E_NOTICE, "Only variable references should be returned by reference");
retval_ptr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (!EG(return_value_ptr_ptr)) {
+ if (/*???!EG(return_value_ptr_ptr)*/0) {
if (IS_VAR == IS_TMP_VAR) {
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
}
} else if (!0) { /* Not a temp var */
- zval *ret;
+ zval ret;
- ALLOC_ZVAL(ret);
- INIT_PZVAL_COPY(ret, retval_ptr);
- zval_copy_ctor(ret);
- *EG(return_value_ptr_ptr) = ret;
+ ZVAL_DUP(&ret, retval_ptr);
+//??? *EG(return_value_ptr_ptr) = ret;
} else {
- zval *ret;
+ zval ret;
- ALLOC_ZVAL(ret);
- INIT_PZVAL_COPY(ret, retval_ptr);
- *EG(return_value_ptr_ptr) = ret;
+ ZVAL_COPY_VALUE(&ret, retval_ptr);
+//??? *EG(return_value_ptr_ptr) = ret;
}
break;
}
- retval_ptr_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ retval_ptr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(retval_ptr_ptr == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(retval_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot return string offsets by reference");
}
+//???
+#if 0
if (IS_VAR == IS_VAR && !Z_ISREF_PP(retval_ptr_ptr)) {
if (opline->extended_value == ZEND_RETURNS_FUNCTION &&
EX_T(opline->op1.var).var.fcall_returned_reference) {
@@ -13176,8 +12766,7 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLE
zval *ret;
ALLOC_ZVAL(ret);
- INIT_PZVAL_COPY(ret, *retval_ptr_ptr);
- zval_copy_ctor(ret);
+ INIT_DUP(ret, *retval_ptr_ptr);
*EG(return_value_ptr_ptr) = ret;
}
break;
@@ -13190,9 +12779,10 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLE
*EG(return_value_ptr_ptr) = *retval_ptr_ptr;
}
+#endif
} while (0);
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
@@ -13200,7 +12790,7 @@ static int ZEND_FASTCALL ZEND_THROW_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
zval *value;
- zval *exception;
+ zval exception;
zend_free_op free_op1;
SAVE_OPLINE();
@@ -13215,41 +12805,32 @@ static int ZEND_FASTCALL ZEND_THROW_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_exception_save(TSRMLS_C);
/* Not sure if a complete copy is what we want here */
- ALLOC_ZVAL(exception);
- INIT_PZVAL_COPY(exception, value);
+ ZVAL_COPY_VALUE(&exception, value);
if (!0) {
- zval_copy_ctor(exception);
+ zval_copy_ctor(&exception);
}
- zend_throw_exception_object(exception TSRMLS_CC);
+ zend_throw_exception_object(&exception TSRMLS_CC);
zend_exception_restore(TSRMLS_C);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
HANDLE_EXCEPTION();
}
static int ZEND_FASTCALL zend_send_by_var_helper_SPEC_VAR(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zval *varptr;
+ zval *varptr, var;
zend_free_op free_op1;
- varptr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (varptr == &EG(uninitialized_zval)) {
- if (IS_VAR == IS_VAR) {
- Z_DELREF_P(varptr);
- }
- ALLOC_INIT_ZVAL(varptr);
- } else if (PZVAL_IS_REF(varptr)) {
+ varptr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ if (Z_ISREF_P(varptr)) {
if (IS_VAR == IS_CV ||
(IS_VAR == IS_VAR && Z_REFCOUNT_P(varptr) > 2)) {
- zval *original_var = varptr;
-
- ALLOC_ZVAL(varptr);
- INIT_PZVAL_COPY(varptr, original_var);
- zval_copy_ctor(varptr);
- zval_ptr_dtor_nogc(&free_op1.var);
+ ZVAL_DUP(&var, Z_REFVAL_P(varptr));
+ varptr = &var;
+ zval_ptr_dtor_nogc(free_op1.var);
} else {
- Z_UNSET_ISREF_P(varptr);
+ varptr = Z_REFVAL_P(varptr);
}
} else if (IS_VAR == IS_CV) {
Z_ADDREF_P(varptr);
@@ -13280,31 +12861,29 @@ static int ZEND_FASTCALL ZEND_SEND_VAR_NO_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HAND
}
varptr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if ((!(opline->extended_value & ZEND_ARG_SEND_FUNCTION) ||
- EX_T(opline->op1.var).var.fcall_returned_reference) &&
- varptr != &EG(uninitialized_zval) &&
- (PZVAL_IS_REF(varptr) || Z_REFCOUNT_P(varptr) == 1)) {
- Z_SET_ISREF_P(varptr);
- if (IS_VAR == IS_CV) {
- Z_ADDREF_P(varptr);
- }
- zend_vm_stack_push(varptr TSRMLS_CC);
- } else {
- zval *valptr;
+//??? if ((!(opline->extended_value & ZEND_ARG_SEND_FUNCTION) ||
+//??? EX_T(opline->op1.var).var.fcall_returned_reference) &&
+//??? (Z_ISREF_P(varptr) || Z_REFCOUNT_P(varptr) == 1)) {
+//??? Z_SET_ISREF_P(varptr);
+//??? if (IS_VAR == IS_CV) {
+//??? Z_ADDREF_P(varptr);
+//??? }
+//??? zend_vm_stack_push(varptr TSRMLS_CC);
+//??? } else {
+ zval val;
if ((opline->extended_value & ZEND_ARG_COMPILE_TIME_BOUND) ?
!(opline->extended_value & ZEND_ARG_SEND_SILENT) :
!ARG_MAY_BE_SENT_BY_REF(EX(call)->fbc, arg_num)) {
zend_error(E_STRICT, "Only variables should be passed by reference");
}
- ALLOC_ZVAL(valptr);
- INIT_PZVAL_COPY(valptr, varptr);
+ ZVAL_COPY_VALUE(&val, varptr);
if (!0) {
- zval_copy_ctor(valptr);
+ zval_copy_ctor(&val);
}
- zval_ptr_dtor_nogc(&free_op1.var);
- zend_vm_stack_push(valptr TSRMLS_CC);
- }
+ zval_ptr_dtor_nogc(free_op1.var);
+ zend_vm_stack_push(&val TSRMLS_CC);
+//??? }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -13313,19 +12892,17 @@ static int ZEND_FASTCALL ZEND_SEND_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
{
USE_OPLINE
zend_free_op free_op1;
- zval **varptr_ptr;
zval *varptr;
SAVE_OPLINE();
- varptr_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ varptr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(varptr_ptr == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(varptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Only variables can be passed by reference");
}
- if (IS_VAR == IS_VAR && UNEXPECTED(*varptr_ptr == &EG(error_zval))) {
- ALLOC_INIT_ZVAL(varptr);
- zend_vm_stack_push(varptr TSRMLS_CC);
+ if (IS_VAR == IS_VAR && UNEXPECTED(varptr == &EG(error_zval))) {
+ zend_vm_stack_push(&EG(uninitialized_zval) TSRMLS_CC);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -13338,12 +12915,11 @@ static int ZEND_FASTCALL ZEND_SEND_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
}
}
- SEPARATE_ZVAL_TO_MAKE_IS_REF(varptr_ptr);
- varptr = *varptr_ptr;
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(varptr);
Z_ADDREF_P(varptr);
zend_vm_stack_push(varptr TSRMLS_CC);
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -13366,12 +12942,12 @@ static int ZEND_FASTCALL ZEND_BOOL_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
zend_free_op free_op1;
- zval *retval = &EX_T(opline->result.var).tmp_var;
+ zval *retval = EX_VAR(opline->result.var);
SAVE_OPLINE();
/* PHP 3.0 returned "" for false and 1 for true, here we use 0 and 1 for now */
ZVAL_BOOL(retval, i_zend_is_true(_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC) TSRMLS_CC));
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -13382,7 +12958,7 @@ static int ZEND_FASTCALL ZEND_SWITCH_FREE_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_
USE_OPLINE
SAVE_OPLINE();
- zval_ptr_dtor(&EX_T(opline->op1.var).var.ptr);
+ zval_ptr_dtor(EX_VAR(opline->op1.var));
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -13423,32 +12999,25 @@ static int ZEND_FASTCALL ZEND_CLONE_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
/* Ensure that if we're calling a private function, we're allowed to do so.
*/
if (UNEXPECTED(ce != EG(scope))) {
- zend_error_noreturn(E_ERROR, "Call to private %s::__clone() from context '%s'", ce->name, EG(scope) ? EG(scope)->name : "");
+ zend_error_noreturn(E_ERROR, "Call to private %s::__clone() from context '%s'", ce->name->val, EG(scope) ? EG(scope)->name->val : "");
}
} else if ((clone->common.fn_flags & ZEND_ACC_PROTECTED)) {
/* Ensure that if we're calling a protected function, we're allowed to do so.
*/
if (UNEXPECTED(!zend_check_protected(zend_get_function_root_class(clone), EG(scope)))) {
- zend_error_noreturn(E_ERROR, "Call to protected %s::__clone() from context '%s'", ce->name, EG(scope) ? EG(scope)->name : "");
+ zend_error_noreturn(E_ERROR, "Call to protected %s::__clone() from context '%s'", ce->name->val, EG(scope) ? EG(scope)->name->val : "");
}
}
}
if (EXPECTED(EG(exception) == NULL)) {
- zval *retval;
-
- ALLOC_ZVAL(retval);
- Z_OBJVAL_P(retval) = clone_call(obj TSRMLS_CC);
- Z_TYPE_P(retval) = IS_OBJECT;
- Z_SET_REFCOUNT_P(retval, 1);
- Z_SET_ISREF_P(retval);
+ ZVAL_OBJ(EX_VAR(opline->result.var), clone_call(obj TSRMLS_CC));
+//??? Z_SET_ISREF_P(retval);
if (!RETURN_VALUE_USED(opline) || UNEXPECTED(EG(exception) != NULL)) {
- zval_ptr_dtor(&retval);
- } else {
- EX_T(opline->result.var).var.ptr = retval;
+ zval_ptr_dtor(EX_VAR(opline->result.var));
}
}
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -13458,7 +13027,7 @@ static int ZEND_FASTCALL ZEND_CAST_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
USE_OPLINE
zend_free_op free_op1;
zval *expr;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
expr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
@@ -13466,7 +13035,7 @@ static int ZEND_FASTCALL ZEND_CAST_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
if (opline->extended_value != IS_STRING) {
ZVAL_COPY_VALUE(result, expr);
if (!0) {
- zendi_zval_copy_ctor(*result);
+ zval_copy_ctor(result);
}
}
switch (opline->extended_value) {
@@ -13490,12 +13059,12 @@ static int ZEND_FASTCALL ZEND_CAST_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
if (use_copy) {
ZVAL_COPY_VALUE(result, &var_copy);
if (0) {
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
}
} else {
ZVAL_COPY_VALUE(result, expr);
if (!0) {
- zendi_zval_copy_ctor(*result);
+ zval_copy_ctor(result);
}
}
break;
@@ -13507,7 +13076,7 @@ static int ZEND_FASTCALL ZEND_CAST_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
convert_to_object(result);
break;
}
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -13518,18 +13087,17 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_VAR_HANDLER(ZEND_OPCODE_HAND
zend_op_array *new_op_array=NULL;
zend_free_op free_op1;
zval *inc_filename;
- zval *tmp_inc_filename = NULL;
+ zval tmp_inc_filename;
zend_bool failure_retval=0;
SAVE_OPLINE();
inc_filename = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ ZVAL_UNDEF(&tmp_inc_filename);
if (inc_filename->type!=IS_STRING) {
- MAKE_STD_ZVAL(tmp_inc_filename);
- ZVAL_COPY_VALUE(tmp_inc_filename, inc_filename);
- zval_copy_ctor(tmp_inc_filename);
- convert_to_string(tmp_inc_filename);
- inc_filename = tmp_inc_filename;
+ ZVAL_DUP(&tmp_inc_filename, inc_filename);
+ convert_to_string(&tmp_inc_filename);
+ inc_filename = &tmp_inc_filename;
}
if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRLEN_P(inc_filename)) {
@@ -13547,7 +13115,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_VAR_HANDLER(ZEND_OPCODE_HAND
resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename) TSRMLS_CC);
if (resolved_path) {
- failure_retval = zend_hash_exists(&EG(included_files), resolved_path, strlen(resolved_path)+1);
+//??? failure_retval = zend_hash_exists(&EG(included_files), resolved_path, strlen(resolved_path)+1);
} else {
resolved_path = Z_STRVAL_P(inc_filename);
}
@@ -13560,13 +13128,13 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_VAR_HANDLER(ZEND_OPCODE_HAND
file_handle.opened_path = estrdup(resolved_path);
}
- if (zend_hash_add_empty_element(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path)+1)==SUCCESS) {
- new_op_array = zend_compile_file(&file_handle, (opline->extended_value==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC);
- zend_destroy_file_handle(&file_handle TSRMLS_CC);
- } else {
- zend_file_handle_dtor(&file_handle TSRMLS_CC);
- failure_retval=1;
- }
+//??? if (zend_hash_add_empty_element(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path)+1)==SUCCESS) {
+//??? new_op_array = zend_compile_file(&file_handle, (opline->extended_value==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC);
+//??? zend_destroy_file_handle(&file_handle TSRMLS_CC);
+//??? } else {
+//??? zend_file_handle_dtor(&file_handle TSRMLS_CC);
+//??? failure_retval=1;
+//??? }
} else {
if (opline->extended_value == ZEND_INCLUDE_ONCE) {
zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC);
@@ -13593,24 +13161,24 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_VAR_HANDLER(ZEND_OPCODE_HAND
EMPTY_SWITCH_DEFAULT_CASE()
}
}
- if (tmp_inc_filename) {
+ if (Z_TYPE(tmp_inc_filename) != IS_UNDEF) {
zval_ptr_dtor(&tmp_inc_filename);
}
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
} else if (EXPECTED(new_op_array != NULL)) {
- EX(original_return_value) = EG(return_value_ptr_ptr);
+//??? EX(original_return_value) = EG(return_value_ptr_ptr);
EG(active_op_array) = new_op_array;
if (RETURN_VALUE_USED(opline)) {
- EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
- EG(return_value_ptr_ptr) = EX_T(opline->result.var).var.ptr_ptr;
+//??? EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
+//??? EG(return_value_ptr_ptr) = EX_T(opline->result.var).var.ptr_ptr;
} else {
- EG(return_value_ptr_ptr) = NULL;
+//??? EG(return_value_ptr_ptr) = NULL;
}
EX(function_state).function = (zend_function *) new_op_array;
- EX(object) = NULL;
+ ZVAL_UNDEF(&EX(object));
if (!EG(active_symbol_table)) {
zend_rebuild_symbol_table(TSRMLS_C);
@@ -13626,7 +13194,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_VAR_HANDLER(ZEND_OPCODE_HAND
EG(opline_ptr) = &EX(opline);
EG(active_op_array) = EX(op_array);
- EG(return_value_ptr_ptr) = EX(original_return_value);
+//??? EG(return_value_ptr_ptr) = EX(original_return_value);
destroy_op_array(new_op_array TSRMLS_CC);
efree(new_op_array);
if (UNEXPECTED(EG(exception) != NULL)) {
@@ -13635,12 +13203,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_VAR_HANDLER(ZEND_OPCODE_HAND
}
} else if (RETURN_VALUE_USED(opline)) {
- zval *retval;
-
- ALLOC_ZVAL(retval);
- ZVAL_BOOL(retval, failure_retval);
- INIT_PZVAL(retval);
- EX_T(opline->result.var).var.ptr = retval;
+ ZVAL_BOOL(EX_VAR(opline->result.var), failure_retval);
}
ZEND_VM_NEXT_OPCODE();
}
@@ -13649,7 +13212,7 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
{
USE_OPLINE
zend_free_op free_op1;
- zval *array_ptr, **array_ptr_ptr;
+ zval *array_ptr;
HashTable *fe_ht;
zend_object_iterator *iter = NULL;
zend_class_entry *ce = NULL;
@@ -13659,40 +13222,35 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
if ((IS_VAR == IS_CV || IS_VAR == IS_VAR) &&
(opline->extended_value & ZEND_FE_RESET_VARIABLE)) {
- array_ptr_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (array_ptr_ptr == NULL || array_ptr_ptr == &EG(uninitialized_zval_ptr)) {
- MAKE_STD_ZVAL(array_ptr);
- ZVAL_NULL(array_ptr);
- } else if (Z_TYPE_PP(array_ptr_ptr) == IS_OBJECT) {
- if(Z_OBJ_HT_PP(array_ptr_ptr)->get_class_entry == NULL) {
+ array_ptr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ if (Z_TYPE_P(array_ptr) == IS_NULL) {
+ } else if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
+ if(Z_OBJ_HT_P(array_ptr)->get_class_entry == NULL) {
zend_error(E_WARNING, "foreach() cannot iterate over objects without PHP class");
ZEND_VM_JMP(EX(op_array)->opcodes+opline->op2.opline_num);
}
- ce = Z_OBJCE_PP(array_ptr_ptr);
+ ce = Z_OBJCE_P(array_ptr);
if (!ce || ce->get_iterator == NULL) {
- SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr);
- Z_ADDREF_PP(array_ptr_ptr);
+ SEPARATE_ZVAL_IF_NOT_REF(array_ptr);
+ Z_ADDREF_P(array_ptr);
}
- array_ptr = *array_ptr_ptr;
} else {
- if (Z_TYPE_PP(array_ptr_ptr) == IS_ARRAY) {
- SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr);
+ if (Z_TYPE_P(array_ptr) == IS_ARRAY) {
+ SEPARATE_ZVAL_IF_NOT_REF(array_ptr);
if (opline->extended_value & ZEND_FE_FETCH_BYREF) {
- Z_SET_ISREF_PP(array_ptr_ptr);
+ ZVAL_NEW_REF(array_ptr, array_ptr);
}
}
- array_ptr = *array_ptr_ptr;
Z_ADDREF_P(array_ptr);
}
} else {
array_ptr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (0) { /* IS_TMP_VAR */
- zval *tmp;
+ zval tmp;
- ALLOC_ZVAL(tmp);
- INIT_PZVAL_COPY(tmp, array_ptr);
- array_ptr = tmp;
+ ZVAL_COPY_VALUE(&tmp, array_ptr);
+ array_ptr = &tmp;
if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
ce = Z_OBJCE_P(array_ptr);
if (ce && ce->get_iterator) {
@@ -13713,15 +13271,13 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
(IS_VAR == IS_VAR &&
!Z_ISREF_P(array_ptr) &&
Z_REFCOUNT_P(array_ptr) > 2)) {
- zval *tmp;
+ zval tmp;
if (IS_VAR == IS_VAR) {
Z_DELREF_P(array_ptr);
}
- ALLOC_ZVAL(tmp);
- INIT_PZVAL_COPY(tmp, array_ptr);
- zval_copy_ctor(tmp);
- array_ptr = tmp;
+ ZVAL_DUP(&tmp, array_ptr);
+ array_ptr = &tmp;
} else if (IS_VAR == IS_CV) {
Z_ADDREF_P(array_ptr);
}
@@ -13731,13 +13287,13 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
iter = ce->get_iterator(ce, array_ptr, opline->extended_value & ZEND_FE_RESET_REFERENCE TSRMLS_CC);
if (IS_VAR == IS_VAR && !(opline->extended_value & ZEND_FE_RESET_VARIABLE)) {
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
}
if (iter && EXPECTED(EG(exception) == NULL)) {
array_ptr = zend_iterator_wrap(iter TSRMLS_CC);
} else {
if (IS_VAR == IS_VAR && opline->extended_value & ZEND_FE_RESET_VARIABLE) {
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
}
if (!EG(exception)) {
zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "Object of type %s did not create an Iterator", ce->name);
@@ -13747,25 +13303,25 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
}
}
- EX_T(opline->result.var).fe.ptr = array_ptr;
+ ZVAL_COPY_VALUE(EX_VAR(opline->result.var), array_ptr);
if (iter) {
iter->index = 0;
if (iter->funcs->rewind) {
iter->funcs->rewind(iter TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
- zval_ptr_dtor(&array_ptr);
+ zval_ptr_dtor(array_ptr);
if (IS_VAR == IS_VAR && opline->extended_value & ZEND_FE_RESET_VARIABLE) {
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
}
HANDLE_EXCEPTION();
}
}
is_empty = iter->funcs->valid(iter TSRMLS_CC) != SUCCESS;
if (UNEXPECTED(EG(exception) != NULL)) {
- zval_ptr_dtor(&array_ptr);
+ zval_ptr_dtor(array_ptr);
if (IS_VAR == IS_VAR && opline->extended_value & ZEND_FE_RESET_VARIABLE) {
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
}
HANDLE_EXCEPTION();
}
@@ -13773,31 +13329,30 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
} else if ((fe_ht = HASH_OF(array_ptr)) != NULL) {
zend_hash_internal_pointer_reset(fe_ht);
if (ce) {
- zend_object *zobj = zend_objects_get_address(array_ptr TSRMLS_CC);
+ zend_object *zobj = Z_OBJ_P(array_ptr);
while (zend_hash_has_more_elements(fe_ht) == SUCCESS) {
- char *str_key;
- uint str_key_len;
+ zend_string *str_key;
ulong int_key;
zend_uchar key_type;
- key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &str_key_len, &int_key, 0, NULL);
+ key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &int_key, 0, NULL);
if (key_type != HASH_KEY_NON_EXISTENT &&
(key_type == HASH_KEY_IS_LONG ||
- zend_check_property_access(zobj, str_key, str_key_len-1 TSRMLS_CC) == SUCCESS)) {
+ zend_check_property_access(zobj, str_key TSRMLS_CC) == SUCCESS)) {
break;
}
zend_hash_move_forward(fe_ht);
}
}
is_empty = zend_hash_has_more_elements(fe_ht) != SUCCESS;
- zend_hash_get_pointer(fe_ht, &EX_T(opline->result.var).fe.fe_pos);
+//??? zend_hash_get_pointer(fe_ht, EX_VAR(opline->result.var));
} else {
zend_error(E_WARNING, "Invalid argument supplied for foreach()");
is_empty = 1;
}
if (IS_VAR == IS_VAR && opline->extended_value & ZEND_FE_RESET_VARIABLE) {
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
}
if (is_empty) {
ZEND_VM_JMP(EX(op_array)->opcodes+opline->op2.opline_num);
@@ -13811,14 +13366,14 @@ static int ZEND_FASTCALL ZEND_FE_FETCH_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
{
USE_OPLINE
- zval *array = EX_T(opline->op1.var).fe.ptr;
- zval **value;
+ zval *array = EX_VAR(opline->op1.var);
+ zval *value;
HashTable *fe_ht;
zend_object_iterator *iter = NULL;
zval *key = NULL;
if (opline->extended_value & ZEND_FE_FETCH_WITH_KEY) {
- key = &EX_T((opline+1)->result.var).tmp_var;
+ key = EX_VAR((opline+1)->result.var);
}
SAVE_OPLINE();
@@ -13830,46 +13385,45 @@ static int ZEND_FASTCALL ZEND_FE_FETCH_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
ZEND_VM_JMP(EX(op_array)->opcodes+opline->op2.opline_num);
case ZEND_ITER_PLAIN_OBJECT: {
- zend_object *zobj = zend_objects_get_address(array TSRMLS_CC);
+ zend_object *zobj = Z_OBJ_P(array);
int key_type;
- char *str_key;
- zend_uint str_key_len;
+ zend_string *str_key;
zend_ulong int_key;
fe_ht = Z_OBJPROP_P(array);
- zend_hash_set_pointer(fe_ht, &EX_T(opline->op1.var).fe.fe_pos);
+//??? zend_hash_set_pointer(fe_ht, &EX_T(opline->op1.var).fe.fe_pos);
do {
- if (zend_hash_get_current_data(fe_ht, (void **) &value)==FAILURE) {
+ if ((value = zend_hash_get_current_data(fe_ht)) == NULL) {
/* reached end of iteration */
ZEND_VM_JMP(EX(op_array)->opcodes+opline->op2.opline_num);
}
- key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &str_key_len, &int_key, 0, NULL);
+ key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &int_key, 0, NULL);
zend_hash_move_forward(fe_ht);
} while (key_type != HASH_KEY_IS_LONG &&
- zend_check_property_access(zobj, str_key, str_key_len - 1 TSRMLS_CC) != SUCCESS);
+ zend_check_property_access(zobj, str_key TSRMLS_CC) != SUCCESS);
if (key) {
if (key_type == HASH_KEY_IS_LONG) {
ZVAL_LONG(key, int_key);
} else {
- const char *class_name, *prop_name;
- int prop_name_len;
- zend_unmangle_property_name_ex(
- str_key, str_key_len - 1, &class_name, &prop_name, &prop_name_len
- );
- ZVAL_STRINGL(key, prop_name, prop_name_len, 1);
+//??? const char *class_name, *prop_name;
+//??? int prop_name_len;
+//??? zend_unmangle_property_name_ex(
+//??? str_key, &class_name, &prop_name, &prop_name_len
+//??? );
+//??? ZVAL_STRINGL(key, prop_name, prop_name_len, 1);
}
}
- zend_hash_get_pointer(fe_ht, &EX_T(opline->op1.var).fe.fe_pos);
+//??? zend_hash_get_pointer(fe_ht, &EX_T(opline->op1.var).fe.fe_pos);
break;
}
case ZEND_ITER_PLAIN_ARRAY:
fe_ht = Z_ARRVAL_P(array);
- zend_hash_set_pointer(fe_ht, &EX_T(opline->op1.var).fe.fe_pos);
- if (zend_hash_get_current_data(fe_ht, (void **) &value)==FAILURE) {
+//??? zend_hash_set_pointer(fe_ht, &EX_T(opline->op1.var).fe.fe_pos);
+ if ((value = zend_hash_get_current_data(fe_ht)) == NULL) {
/* reached end of iteration */
ZEND_VM_JMP(EX(op_array)->opcodes+opline->op2.opline_num);
}
@@ -13877,7 +13431,7 @@ static int ZEND_FASTCALL ZEND_FE_FETCH_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
zend_hash_get_current_key_zval(fe_ht, key);
}
zend_hash_move_forward(fe_ht);
- zend_hash_get_pointer(fe_ht, &EX_T(opline->op1.var).fe.fe_pos);
+//??? zend_hash_get_pointer(fe_ht, &EX_T(opline->op1.var).fe.fe_pos);
break;
case ZEND_ITER_OBJECT:
@@ -13887,7 +13441,7 @@ static int ZEND_FASTCALL ZEND_FE_FETCH_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
* In case that ever happens we need an additional flag. */
iter->funcs->move_forward(iter TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
- zval_ptr_dtor(&array);
+ zval_ptr_dtor(array);
HANDLE_EXCEPTION();
}
}
@@ -13895,14 +13449,14 @@ static int ZEND_FASTCALL ZEND_FE_FETCH_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
if (!iter || (iter->index > 0 && iter->funcs->valid(iter TSRMLS_CC) == FAILURE)) {
/* reached end of iteration */
if (UNEXPECTED(EG(exception) != NULL)) {
- zval_ptr_dtor(&array);
+ zval_ptr_dtor(array);
HANDLE_EXCEPTION();
}
ZEND_VM_JMP(EX(op_array)->opcodes+opline->op2.opline_num);
}
- iter->funcs->get_current_data(iter, &value TSRMLS_CC);
+ value = iter->funcs->get_current_data(iter TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
- zval_ptr_dtor(&array);
+ zval_ptr_dtor(array);
HANDLE_EXCEPTION();
}
if (!value) {
@@ -13913,7 +13467,7 @@ static int ZEND_FASTCALL ZEND_FE_FETCH_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
if (iter->funcs->get_current_key) {
iter->funcs->get_current_key(iter, key TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
- zval_ptr_dtor(&array);
+ zval_ptr_dtor(array);
HANDLE_EXCEPTION();
}
} else {
@@ -13925,12 +13479,10 @@ static int ZEND_FASTCALL ZEND_FE_FETCH_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
if (opline->extended_value & ZEND_FE_FETCH_BYREF) {
SEPARATE_ZVAL_IF_NOT_REF(value);
- Z_SET_ISREF_PP(value);
- EX_T(opline->result.var).var.ptr_ptr = value;
- Z_ADDREF_PP(value);
+ ZVAL_NEW_REF(value, value);
+ Z_ADDREF_P(value);
} else {
- PZVAL_LOCK(*value);
- EX_T(opline->result.var).var.ptr = *value;
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
}
CHECK_EXCEPTION();
@@ -13953,7 +13505,7 @@ static int ZEND_FASTCALL ZEND_EXIT_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
} else {
zend_print_variable(ptr);
}
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
}
#endif
zend_bailout();
@@ -13970,18 +13522,18 @@ static int ZEND_FASTCALL ZEND_JMP_SET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS
value = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (i_zend_is_true(value TSRMLS_CC)) {
- ZVAL_COPY_VALUE(&EX_T(opline->result.var).tmp_var, value);
+ ZVAL_COPY_VALUE(EX_VAR(opline->result.var), value);
if (!0) {
- zendi_zval_copy_ctor(EX_T(opline->result.var).tmp_var);
+ zval_copy_ctor(EX_VAR(opline->result.var));
}
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
#if DEBUG_ZEND>=2
printf("Conditional jmp to %d\n", opline->op2.opline_num);
#endif
ZEND_VM_JMP(opline->op2.jmp_addr);
}
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -13990,33 +13542,29 @@ static int ZEND_FASTCALL ZEND_JMP_SET_VAR_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_
{
USE_OPLINE
zend_free_op free_op1;
- zval *value, *ret;
+ zval *value;
SAVE_OPLINE();
value = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (i_zend_is_true(value TSRMLS_CC)) {
if (IS_VAR == IS_VAR || IS_VAR == IS_CV) {
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
Z_ADDREF_P(value);
- EX_T(opline->result.var).var.ptr = value;
- EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
} else {
- ALLOC_ZVAL(ret);
- INIT_PZVAL_COPY(ret, value);
- EX_T(opline->result.var).var.ptr = ret;
- EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
+ ZVAL_COPY_VALUE(EX_VAR(opline->result.var), value);
if (!0) {
- zval_copy_ctor(EX_T(opline->result.var).var.ptr);
+ zval_copy_ctor(EX_VAR(opline->result.var));
}
}
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
#if DEBUG_ZEND>=2
printf("Conditional jmp to %d\n", opline->op2.opline_num);
#endif
ZEND_VM_JMP(opline->op2.jmp_addr);
}
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -14030,11 +13578,11 @@ static int ZEND_FASTCALL ZEND_QM_ASSIGN_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR
SAVE_OPLINE();
value = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- ZVAL_COPY_VALUE(&EX_T(opline->result.var).tmp_var, value);
+ ZVAL_COPY_VALUE(EX_VAR(opline->result.var), value);
if (!0) {
- zval_copy_ctor(&EX_T(opline->result.var).tmp_var);
+ zval_copy_ctor(EX_VAR(opline->result.var));
}
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -14043,26 +13591,21 @@ static int ZEND_FASTCALL ZEND_QM_ASSIGN_VAR_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLE
{
USE_OPLINE
zend_free_op free_op1;
- zval *value, *ret;
+ zval *value;
SAVE_OPLINE();
value = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (IS_VAR == IS_VAR || IS_VAR == IS_CV) {
- Z_ADDREF_P(value);
- EX_T(opline->result.var).var.ptr = value;
- EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
} else {
- ALLOC_ZVAL(ret);
- INIT_PZVAL_COPY(ret, value);
- EX_T(opline->result.var).var.ptr = ret;
- EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
+ ZVAL_COPY_VALUE(EX_VAR(opline->result.var), value);
if (!0) {
- zval_copy_ctor(EX_T(opline->result.var).var.ptr);
+ zval_copy_ctor(EX_VAR(opline->result.var));
}
}
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -14078,12 +13621,12 @@ static int ZEND_FASTCALL ZEND_INSTANCEOF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_A
expr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (Z_TYPE_P(expr) == IS_OBJECT && Z_OBJ_HT_P(expr)->get_class_entry) {
- result = instanceof_function(Z_OBJCE_P(expr), EX_T(opline->op2.var).class_entry TSRMLS_CC);
+ result = instanceof_function(Z_OBJCE_P(expr), Z_CE_P(EX_VAR(opline->op2.var)) TSRMLS_CC);
} else {
result = 0;
}
- ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, result);
- zval_ptr_dtor_nogc(&free_op1.var);
+ ZVAL_BOOL(EX_VAR(opline->result.var), result);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -14094,10 +13637,10 @@ static int ZEND_FASTCALL ZEND_ADD_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_AR
zend_free_op free_op1;
SAVE_OPLINE();
- fast_add_function(&EX_T(opline->result.var).tmp_var,
+ fast_add_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -14109,10 +13652,10 @@ static int ZEND_FASTCALL ZEND_SUB_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_AR
zend_free_op free_op1;
SAVE_OPLINE();
- fast_sub_function(&EX_T(opline->result.var).tmp_var,
+ fast_sub_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -14124,10 +13667,10 @@ static int ZEND_FASTCALL ZEND_MUL_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_AR
zend_free_op free_op1;
SAVE_OPLINE();
- fast_mul_function(&EX_T(opline->result.var).tmp_var,
+ fast_mul_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -14139,10 +13682,10 @@ static int ZEND_FASTCALL ZEND_DIV_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_AR
zend_free_op free_op1;
SAVE_OPLINE();
- fast_div_function(&EX_T(opline->result.var).tmp_var,
+ fast_div_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -14154,10 +13697,10 @@ static int ZEND_FASTCALL ZEND_MOD_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_AR
zend_free_op free_op1;
SAVE_OPLINE();
- fast_mod_function(&EX_T(opline->result.var).tmp_var,
+ fast_mod_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -14169,10 +13712,10 @@ static int ZEND_FASTCALL ZEND_SL_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG
zend_free_op free_op1;
SAVE_OPLINE();
- shift_left_function(&EX_T(opline->result.var).tmp_var,
+ shift_left_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -14184,10 +13727,10 @@ static int ZEND_FASTCALL ZEND_SR_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG
zend_free_op free_op1;
SAVE_OPLINE();
- shift_right_function(&EX_T(opline->result.var).tmp_var,
+ shift_right_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -14199,10 +13742,10 @@ static int ZEND_FASTCALL ZEND_CONCAT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER
zend_free_op free_op1;
SAVE_OPLINE();
- concat_function(&EX_T(opline->result.var).tmp_var,
+ concat_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -14214,10 +13757,10 @@ static int ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_H
zend_free_op free_op1;
SAVE_OPLINE();
- is_identical_function(&EX_T(opline->result.var).tmp_var,
+ is_identical_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -14227,14 +13770,14 @@ static int ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_VAR_CONST_HANDLER(ZEND_OPCO
{
USE_OPLINE
zend_free_op free_op1;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
is_identical_function(result,
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
Z_LVAL_P(result) = !Z_LVAL_P(result);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -14244,13 +13787,13 @@ static int ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDL
{
USE_OPLINE
zend_free_op free_op1;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_equal_function(result,
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
opline->op2.zv TSRMLS_CC));
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -14260,13 +13803,13 @@ static int ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_H
{
USE_OPLINE
zend_free_op free_op1;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_not_equal_function(result,
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
opline->op2.zv TSRMLS_CC));
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -14276,13 +13819,13 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HAN
{
USE_OPLINE
zend_free_op free_op1;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_is_smaller_function(result,
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
opline->op2.zv TSRMLS_CC));
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -14292,13 +13835,13 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_VAR_CONST_HANDLER(ZEND_O
{
USE_OPLINE
zend_free_op free_op1;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_is_smaller_or_equal_function(result,
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
opline->op2.zv TSRMLS_CC));
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -14310,10 +13853,10 @@ static int ZEND_FASTCALL ZEND_BW_OR_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_
zend_free_op free_op1;
SAVE_OPLINE();
- bitwise_or_function(&EX_T(opline->result.var).tmp_var,
+ bitwise_or_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -14325,10 +13868,10 @@ static int ZEND_FASTCALL ZEND_BW_AND_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER
zend_free_op free_op1;
SAVE_OPLINE();
- bitwise_and_function(&EX_T(opline->result.var).tmp_var,
+ bitwise_and_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -14340,10 +13883,10 @@ static int ZEND_FASTCALL ZEND_BW_XOR_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER
zend_free_op free_op1;
SAVE_OPLINE();
- bitwise_xor_function(&EX_T(opline->result.var).tmp_var,
+ bitwise_xor_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -14355,10 +13898,10 @@ static int ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDL
zend_free_op free_op1;
SAVE_OPLINE();
- boolean_xor_function(&EX_T(opline->result.var).tmp_var,
+ boolean_xor_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -14368,18 +13911,16 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_CONST(int (*b
{
USE_OPLINE
zend_free_op free_op1, free_op_data1;
- zval **object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- zval *object;
+ zval *object = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
zval *property = opline->op2.zv;
zval *value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
int have_get_ptr = 0;
- if (IS_VAR == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- make_real_object(object_ptr TSRMLS_CC);
- object = *object_ptr;
+ make_real_object(object TSRMLS_CC);
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to assign property of non-object");
@@ -14387,8 +13928,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_CONST(int (*b
FREE_OP(free_op_data1);
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
} else {
/* here we are sure we are dealing with an object */
@@ -14399,15 +13939,14 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_CONST(int (*b
/* here property is a string */
if (opline->extended_value == ZEND_ASSIGN_OBJ
&& Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval **zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
have_get_ptr = 1;
- binary_op(*zptr, *zptr, value TSRMLS_CC);
+ binary_op(zptr, zptr, value TSRMLS_CC);
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(*zptr);
- EX_T(opline->result.var).var.ptr = *zptr;
+ ZVAL_COPY(EX_VAR(opline->result.var), zptr);
}
}
}
@@ -14431,12 +13970,11 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_CONST(int (*b
if (Z_REFCOUNT_P(z) == 0) {
GC_REMOVE_ZVAL_FROM_BUFFER(z);
zval_dtor(z);
- FREE_ZVAL(z);
}
z = value;
}
Z_ADDREF_P(z);
- SEPARATE_ZVAL_IF_NOT_REF(&z);
+ SEPARATE_ZVAL_IF_NOT_REF(z);
binary_op(z, z, value TSRMLS_CC);
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
@@ -14444,28 +13982,26 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_CONST(int (*b
Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(z);
- EX_T(opline->result.var).var.ptr = z;
+ ZVAL_COPY(EX_VAR(opline->result.var), z);
}
- zval_ptr_dtor(&z);
+ zval_ptr_dtor(z);
} else {
zend_error(E_WARNING, "Attempt to assign property of non-object");
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
}
}
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
}
FREE_OP(free_op_data1);
}
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
/* assign_obj has two opcodes! */
CHECK_EXCEPTION();
ZEND_VM_INC_OPCODE();
@@ -14476,7 +14012,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_VAR_CONST(int (*binar
{
USE_OPLINE
zend_free_op free_op1, free_op_data2, free_op_data1;
- zval **var_ptr;
+ zval *var_ptr;
zval *value;
SAVE_OPLINE();
@@ -14485,42 +14021,41 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_VAR_CONST(int (*binar
return zend_binary_assign_op_obj_helper_SPEC_VAR_CONST(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
break;
case ZEND_ASSIGN_DIM: {
- zval **container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ zval *container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- } else if (UNEXPECTED(Z_TYPE_PP(container) == IS_OBJECT)) {
+ } else if (UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
if (IS_VAR == IS_VAR && !(free_op1.var != NULL)) {
- Z_ADDREF_PP(container); /* undo the effect of get_obj_zval_ptr_ptr() */
+ Z_ADDREF_P(container); /* undo the effect of get_obj_zval_ptr_ptr() */
}
return zend_binary_assign_op_obj_helper_SPEC_VAR_CONST(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
} else {
zval *dim = opline->op2.zv;
- zend_fetch_dimension_address(&EX_T((opline+1)->op2.var), container, dim, IS_CONST, BP_VAR_RW TSRMLS_CC);
+ zend_fetch_dimension_address(EX_VAR((opline+1)->op2.var), container, dim, IS_CONST, BP_VAR_RW TSRMLS_CC);
value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
- var_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
+ var_ptr = _get_zval_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
}
}
break;
default:
value = opline->op2.zv;
- var_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ var_ptr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
/* do nothing */
break;
}
- if (UNEXPECTED(var_ptr == NULL)) {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
}
- if (UNEXPECTED(*var_ptr == &EG(error_zval))) {
+ if (UNEXPECTED(var_ptr == &EG(error_zval))) {
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
if (opline->extended_value == ZEND_ASSIGN_DIM) {
ZEND_VM_INC_OPCODE();
@@ -14530,32 +14065,31 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_VAR_CONST(int (*binar
SEPARATE_ZVAL_IF_NOT_REF(var_ptr);
- if (UNEXPECTED(Z_TYPE_PP(var_ptr) == IS_OBJECT)
- && Z_OBJ_HANDLER_PP(var_ptr, get)
- && Z_OBJ_HANDLER_PP(var_ptr, set)) {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_OBJECT)
+ && Z_OBJ_HANDLER_P(var_ptr, get)
+ && Z_OBJ_HANDLER_P(var_ptr, set)) {
/* proxy object */
- zval *objval = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC);
+ zval *objval = Z_OBJ_HANDLER_P(var_ptr, get)(var_ptr TSRMLS_CC);
Z_ADDREF_P(objval);
binary_op(objval, objval, value TSRMLS_CC);
- Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, objval TSRMLS_CC);
- zval_ptr_dtor(&objval);
+ Z_OBJ_HANDLER_P(var_ptr, set)(var_ptr, objval TSRMLS_CC);
+ zval_ptr_dtor(objval);
} else {
- binary_op(*var_ptr, *var_ptr, value TSRMLS_CC);
+ binary_op(var_ptr, var_ptr, value TSRMLS_CC);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(*var_ptr);
- EX_T(opline->result.var).var.ptr = *var_ptr;
+ ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
if (opline->extended_value == ZEND_ASSIGN_DIM) {
FREE_OP(free_op_data1);
FREE_OP_VAR_PTR(free_op_data2);
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_INC_OPCODE();
} else {
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
}
ZEND_VM_NEXT_OPCODE();
@@ -14620,32 +14154,29 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_CONST(incdec_t
{
USE_OPLINE
zend_free_op free_op1;
- zval **object_ptr;
zval *object;
zval *property;
- zval **retval;
+ zval *retval;
int have_get_ptr = 0;
SAVE_OPLINE();
- object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ object = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
property = opline->op2.zv;
- retval = &EX_T(opline->result.var).var.ptr;
+ retval = EX_VAR(opline->result.var);
- if (IS_VAR == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
- object = *object_ptr;
+ make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- *retval = &EG(uninitialized_zval);
+ ZVAL_NULL(retval);
}
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -14657,15 +14188,14 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_CONST(incdec_t
}
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval **zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
have_get_ptr = 1;
- incdec_op(*zptr);
+ incdec_op(zptr);
if (RETURN_VALUE_USED(opline)) {
- *retval = *zptr;
- PZVAL_LOCK(*retval);
+ ZVAL_COPY(retval, zptr);
}
}
}
@@ -14680,32 +14210,30 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_CONST(incdec_t
if (Z_REFCOUNT_P(z) == 0) {
GC_REMOVE_ZVAL_FROM_BUFFER(z);
zval_dtor(z);
- FREE_ZVAL(z);
}
z = value;
}
Z_ADDREF_P(z);
- SEPARATE_ZVAL_IF_NOT_REF(&z);
+ SEPARATE_ZVAL_IF_NOT_REF(z);
incdec_op(z);
- *retval = z;
+ ZVAL_COPY_VALUE(retval, z);
Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- SELECTIVE_PZVAL_LOCK(*retval, opline);
- zval_ptr_dtor(&z);
+ SELECTIVE_PZVAL_LOCK(retval, opline);
+ zval_ptr_dtor(z);
} else {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- *retval = &EG(uninitialized_zval);
+ ZVAL_NULL(retval);
}
}
}
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
}
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -14724,29 +14252,27 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_CONST(incdec_
{
USE_OPLINE
zend_free_op free_op1;
- zval **object_ptr;
zval *object;
zval *property;
zval *retval;
int have_get_ptr = 0;
SAVE_OPLINE();
- object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ object = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
property = opline->op2.zv;
- retval = &EX_T(opline->result.var).tmp_var;
+ retval = EX_VAR(opline->result.var);
- if (IS_VAR == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
- object = *object_ptr;
+ make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
ZVAL_NULL(retval);
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -14758,15 +14284,14 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_CONST(incdec_
}
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval **zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
have_get_ptr = 1;
SEPARATE_ZVAL_IF_NOT_REF(zptr);
- ZVAL_COPY_VALUE(retval, *zptr);
- zendi_zval_copy_ctor(*retval);
+ ZVAL_DUP(retval, zptr);
- incdec_op(*zptr);
+ incdec_op(zptr);
}
}
@@ -14774,7 +14299,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_CONST(incdec_
if (!have_get_ptr) {
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- zval *z_copy;
+ zval z_copy;
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC);
@@ -14782,20 +14307,16 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_CONST(incdec_
if (Z_REFCOUNT_P(z) == 0) {
GC_REMOVE_ZVAL_FROM_BUFFER(z);
zval_dtor(z);
- FREE_ZVAL(z);
}
z = value;
}
- ZVAL_COPY_VALUE(retval, z);
- zendi_zval_copy_ctor(*retval);
- ALLOC_ZVAL(z_copy);
- INIT_PZVAL_COPY(z_copy, z);
- zendi_zval_copy_ctor(*z_copy);
- incdec_op(z_copy);
+ ZVAL_DUP(retval, z);
+ ZVAL_DUP(&z_copy, z);
+ incdec_op(&z_copy);
Z_ADDREF_P(z);
- Z_OBJ_HT_P(object)->write_property(object, property, z_copy, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(object)->write_property(object, property, &z_copy, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval_ptr_dtor(&z_copy);
- zval_ptr_dtor(&z);
+ zval_ptr_dtor(z);
} else {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
ZVAL_NULL(retval);
@@ -14803,11 +14324,11 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_CONST(incdec_
}
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
}
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -14827,19 +14348,17 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_CONST(int type,
USE_OPLINE
zend_free_op free_op1;
zval *varname;
- zval **retval;
+ zval *retval;
zval tmp_varname;
HashTable *target_symbol_table;
- ulong hash_value;
SAVE_OPLINE();
varname = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (IS_VAR != IS_CONST && UNEXPECTED(Z_TYPE_P(varname) != IS_STRING)) {
- ZVAL_COPY_VALUE(&tmp_varname, varname);
- zval_copy_ctor(&tmp_varname);
- Z_SET_REFCOUNT(tmp_varname, 1);
- Z_UNSET_ISREF(tmp_varname);
+ ZVAL_DUP(&tmp_varname, varname);
+//??? Z_SET_REFCOUNT(tmp_varname, 1);
+//??? Z_UNSET_ISREF(tmp_varname);
convert_to_string(&tmp_varname);
varname = &tmp_varname;
}
@@ -14851,22 +14370,22 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_CONST(int type,
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
ce = CACHED_PTR(opline->op2.literal->cache_slot);
} else {
- ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
if (IS_VAR != IS_CONST && varname == &tmp_varname) {
zval_dtor(&tmp_varname);
}
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
CACHE_PTR(opline->op2.literal->cache_slot, ce);
}
} else {
- ce = EX_T(opline->op2.var).class_entry;
+ ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0, ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
+ retval = zend_std_get_static_property(ce, Z_STR_P(varname), 0, ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ zval_ptr_dtor_nogc(free_op1.var);
} else {
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
/*
@@ -14875,27 +14394,21 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_CONST(int type,
ZEND_VM_NEXT_OPCODE();
}
*/
- if (IS_VAR == IS_CONST) {
- hash_value = Z_HASH_P(varname);
- } else {
- hash_value = str_hash(Z_STRVAL_P(varname), Z_STRLEN_P(varname));
- }
-
- if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) {
+ if ((retval = zend_hash_find(target_symbol_table, Z_STR_P(varname))) == NULL) {
switch (type) {
case BP_VAR_R:
case BP_VAR_UNSET:
zend_error(E_NOTICE,"Undefined variable: %s", Z_STRVAL_P(varname));
/* break missing intentionally */
case BP_VAR_IS:
- retval = &EG(uninitialized_zval_ptr);
+ ZVAL_NULL(retval);
break;
case BP_VAR_RW:
zend_error(E_NOTICE,"Undefined variable: %s", Z_STRVAL_P(varname));
/* break missing intentionally */
case BP_VAR_W:
Z_ADDREF_P(&EG(uninitialized_zval));
- zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval);
+ retval = zend_hash_update(target_symbol_table, Z_STR_P(varname), &EG(uninitialized_zval));
break;
EMPTY_SWITCH_DEFAULT_CASE()
}
@@ -14903,18 +14416,18 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_CONST(int type,
switch (opline->extended_value & ZEND_FETCH_TYPE_MASK) {
case ZEND_FETCH_GLOBAL:
if (IS_VAR != IS_TMP_VAR) {
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
}
break;
case ZEND_FETCH_LOCAL:
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
break;
case ZEND_FETCH_STATIC:
zval_update_constant(retval, (void*) 1 TSRMLS_CC);
break;
case ZEND_FETCH_GLOBAL_LOCK:
if (IS_VAR == IS_VAR && !free_op1.var) {
- PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
+ Z_ADDREF_P(EX_VAR(opline->op1.var));
}
break;
}
@@ -14927,27 +14440,26 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_CONST(int type,
if (opline->extended_value & ZEND_FETCH_MAKE_REF) {
SEPARATE_ZVAL_TO_MAKE_IS_REF(retval);
}
- PZVAL_LOCK(*retval);
- switch (type) {
- case BP_VAR_R:
- case BP_VAR_IS:
- EX_T(opline->result.var).var.ptr = *retval;
- break;
- case BP_VAR_UNSET: {
- zend_free_op free_res;
-
- PZVAL_UNLOCK(*retval, &free_res);
- if (retval != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(retval);
- }
- PZVAL_LOCK(*retval);
- FREE_OP_VAR_PTR(free_res);
- }
- /* break missing intentionally */
- default:
- EX_T(opline->result.var).var.ptr_ptr = retval;
- break;
- }
+ ZVAL_COPY(EX_VAR(opline->result.var), retval);
+//??? switch (type) {
+//??? case BP_VAR_R:
+//??? case BP_VAR_IS:
+//??? break;
+//??? case BP_VAR_UNSET: {
+//??? zend_free_op free_res;
+//???
+//??? PZVAL_UNLOCK(*retval, &free_res);
+//??? if (retval != &EG(uninitialized_zval_ptr)) {
+//??? SEPARATE_ZVAL_IF_NOT_REF(retval);
+//??? }
+//??? PZVAL_LOCK(*retval);
+//??? FREE_OP_VAR_PTR(free_res);
+//??? }
+//??? /* break missing intentionally */
+//??? default:
+//??? EX_T(opline->result.var).var.ptr_ptr = retval;
+//??? break;
+//??? }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -14992,10 +14504,10 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HA
SAVE_OPLINE();
container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC);
+ zend_fetch_dimension_address_read(EX_VAR(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC);
if (IS_VAR != IS_VAR || !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
}
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -15005,30 +14517,28 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HA
{
USE_OPLINE
zend_free_op free_op1;
- zval **container;
+ zval *container;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_fetch_dimension_address(&EX_T(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_W TSRMLS_CC);
+ zend_fetch_dimension_address(EX_VAR(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_W TSRMLS_CC);
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+//??? if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
+//??? }
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
/* We are going to assign the result by reference */
if (UNEXPECTED(opline->extended_value != 0)) {
- zval **retval_ptr = EX_T(opline->result.var).var.ptr_ptr;
+ zval *retval_ptr = EX_VAR(opline->result.var);
- if (retval_ptr) {
- Z_DELREF_PP(retval_ptr);
- SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
- Z_ADDREF_PP(retval_ptr);
- }
+ Z_DELREF_P(retval_ptr);
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
+ Z_ADDREF_P(retval_ptr);
}
CHECK_EXCEPTION();
@@ -15039,20 +14549,20 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_H
{
USE_OPLINE
zend_free_op free_op1;
- zval **container;
+ zval *container;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_fetch_dimension_address(&EX_T(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_RW TSRMLS_CC);
+ zend_fetch_dimension_address(EX_VAR(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_RW TSRMLS_CC);
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+//??? if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -15065,9 +14575,9 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_H
SAVE_OPLINE();
container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_IS TSRMLS_CC);
+ zend_fetch_dimension_address_read(EX_VAR(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_IS TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -15075,31 +14585,30 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_H
static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
+ zval *container;
zend_free_op free_op1;
SAVE_OPLINE();
if (zend_is_by_ref_func_arg_fetch(opline, EX(call) TSRMLS_CC)) {
- zval **container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_fetch_dimension_address(&EX_T(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_W TSRMLS_CC);
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
+ zend_fetch_dimension_address(EX_VAR(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_W TSRMLS_CC);
+//??? if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
} else {
- zval *container;
-
if (IS_CONST == IS_UNUSED) {
zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
}
container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC);
+ zend_fetch_dimension_address_read(EX_VAR(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
}
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -15109,37 +14618,33 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_VAR_CONST_HANDLER(ZEND_OPCOD
{
USE_OPLINE
zend_free_op free_op1;
- zval **container;
+ zval *container;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (IS_VAR == IS_CV) {
- if (container != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(container);
- }
+ SEPARATE_ZVAL_IF_NOT_REF(container);
}
- if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_fetch_dimension_address(&EX_T(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_UNSET TSRMLS_CC);
+ zend_fetch_dimension_address(EX_VAR(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_UNSET TSRMLS_CC);
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
- if (UNEXPECTED(EX_T(opline->result.var).var.ptr_ptr == NULL)) {
+//??? if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
+ if (UNEXPECTED(Z_TYPE_P(EX_VAR(opline->result.var)) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
ZEND_VM_NEXT_OPCODE();
} else {
zend_free_op free_res;
- zval **retval_ptr = EX_T(opline->result.var).var.ptr_ptr;
+ zval *retval_ptr = EX_VAR(opline->result.var);
- PZVAL_UNLOCK(*retval_ptr, &free_res);
- if (retval_ptr != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(retval_ptr);
- }
- PZVAL_LOCK(*retval_ptr);
+ PZVAL_UNLOCK(retval_ptr, &free_res);
+ SEPARATE_ZVAL_IF_NOT_REF(retval_ptr);
+ PZVAL_LOCK(retval_ptr);
FREE_OP_VAR_PTR(free_res);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -15161,8 +14666,7 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_VAR_CONST(
if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
zend_error(E_NOTICE, "Trying to get property of non-object");
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
} else {
zval *retval;
@@ -15174,17 +14678,16 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_VAR_CONST(
/* here we are sure we are dealing with an object */
retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_R, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- PZVAL_LOCK(retval);
- EX_T(opline->result.var).var.ptr = retval;
+ ZVAL_COPY(EX_VAR(opline->result.var), retval);
if (0) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
}
}
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -15199,7 +14702,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HA
USE_OPLINE
zend_free_op free_op1;
zval *property;
- zval **container;
+ zval *container;
SAVE_OPLINE();
property = opline->op2.zv;
@@ -15207,31 +14710,31 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HA
if (0) {
MAKE_REAL_ZVAL_PTR(property);
}
- container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
+ container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(&EX_T(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
}
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+//??? if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
/* We are going to assign the result by reference */
if (opline->extended_value & ZEND_FETCH_MAKE_REF) {
- zval **retval_ptr = EX_T(opline->result.var).var.ptr_ptr;
+ zval *retval_ptr = EX_VAR(opline->result.var);
- Z_DELREF_PP(retval_ptr);
+ Z_DELREF_P(retval_ptr);
SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
- Z_ADDREF_PP(retval_ptr);
- EX_T(opline->result.var).var.ptr = *EX_T(opline->result.var).var.ptr_ptr;
- EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
+ Z_ADDREF_P(retval_ptr);
+//??? EX_T(opline->result.var).var.ptr = *EX_T(opline->result.var).var.ptr_ptr;
+//??? EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
}
CHECK_EXCEPTION();
@@ -15243,28 +14746,28 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_H
USE_OPLINE
zend_free_op free_op1;
zval *property;
- zval **container;
+ zval *container;
SAVE_OPLINE();
property = opline->op2.zv;
- container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (0) {
MAKE_REAL_ZVAL_PTR(property);
}
- if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(&EX_T(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_RW TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_RW TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
}
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+//??? if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -15283,8 +14786,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_H
if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
} else {
zval *retval;
@@ -15296,17 +14798,16 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_H
/* here we are sure we are dealing with an object */
retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_IS, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- PZVAL_LOCK(retval);
- EX_T(opline->result.var).var.ptr = retval;
+ ZVAL_COPY(EX_VAR(opline->result.var), retval);
if (0) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
}
}
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -15314,33 +14815,33 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_H
static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
+ zval *container;
if (zend_is_by_ref_func_arg_fetch(opline, EX(call) TSRMLS_CC)) {
/* Behave like FETCH_OBJ_W */
zend_free_op free_op1;
zval *property;
- zval **container;
SAVE_OPLINE();
property = opline->op2.zv;
- container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (0) {
MAKE_REAL_ZVAL_PTR(property);
}
- if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(&EX_T(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
}
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+//??? if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
} else {
@@ -15352,40 +14853,38 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_VAR_CONST_HANDLER(ZEND_OPCOD
{
USE_OPLINE
zend_free_op free_op1, free_res;
- zval **container;
+ zval *container;
zval *property;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
property = opline->op2.zv;
if (IS_VAR == IS_CV) {
- if (container != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(container);
- }
+ SEPARATE_ZVAL_IF_NOT_REF(container);
}
if (0) {
MAKE_REAL_ZVAL_PTR(property);
}
- if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(&EX_T(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_UNSET TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_UNSET TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
}
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+//??? if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
- PZVAL_UNLOCK(*EX_T(opline->result.var).var.ptr_ptr, &free_res);
- if (EX_T(opline->result.var).var.ptr_ptr != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(EX_T(opline->result.var).var.ptr_ptr);
- }
- PZVAL_LOCK(*EX_T(opline->result.var).var.ptr_ptr);
+//??? PZVAL_UNLOCK(EX_VAR(opline->result.var), &free_res);
+//??? if (EX_T(opline->result.var).var.ptr_ptr != &EG(uninitialized_zval_ptr)) {
+//??? SEPARATE_ZVAL_IF_NOT_REF(EX_T(opline->result.var).var.ptr_ptr);
+//??? }
+//??? PZVAL_LOCK(EX_VAR(opline->result.var));
FREE_OP_VAR_PTR(free_res);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -15395,26 +14894,26 @@ static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HAN
{
USE_OPLINE
zend_free_op free_op1;
- zval **object_ptr;
+ zval *object;
zval *property_name;
SAVE_OPLINE();
- object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ object = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
property_name = opline->op2.zv;
if (0) {
MAKE_REAL_ZVAL_PTR(property_name);
}
- if (IS_VAR == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_assign_to_object(RETURN_VALUE_USED(opline)?&EX_T(opline->result.var).var.ptr:NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&property_name);
+ zval_ptr_dtor(property_name);
} else {
}
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
/* assign_obj has two opcodes! */
CHECK_EXCEPTION();
ZEND_VM_INC_OPCODE();
@@ -15425,24 +14924,24 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HAN
{
USE_OPLINE
zend_free_op free_op1;
- zval **object_ptr;
+ zval *object_ptr;
SAVE_OPLINE();
- object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ object_ptr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(object_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- if (Z_TYPE_PP(object_ptr) == IS_OBJECT) {
+ if (Z_TYPE_P(object_ptr) == IS_OBJECT) {
zval *property_name = opline->op2.zv;
if (0) {
MAKE_REAL_ZVAL_PTR(property_name);
}
- zend_assign_to_object(RETURN_VALUE_USED(opline)?&EX_T(opline->result.var).var.ptr:NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&property_name);
+ zval_ptr_dtor(property_name);
} else {
}
@@ -15450,51 +14949,43 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HAN
zend_free_op free_op_data1, free_op_data2;
zval *value;
zval *dim = opline->op2.zv;
- zval **variable_ptr_ptr;
+ zval *variable_ptr;
- zend_fetch_dimension_address(&EX_T((opline+1)->op2.var), object_ptr, dim, IS_CONST, BP_VAR_W TSRMLS_CC);
+ zend_fetch_dimension_address(EX_VAR((opline+1)->op2.var), object_ptr, dim, IS_CONST, BP_VAR_W TSRMLS_CC);
value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
- variable_ptr_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
- if (UNEXPECTED(variable_ptr_ptr == NULL)) {
- if (zend_assign_to_string_offset(&EX_T((opline+1)->op2.var), value, (opline+1)->op1_type TSRMLS_CC)) {
+ variable_ptr = _get_zval_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
+ if (UNEXPECTED(Z_TYPE_P(variable_ptr) == IS_STR_OFFSET)) {
+ if (zend_assign_to_string_offset(EX_VAR((opline+1)->op2.var), value, (opline+1)->op1_type TSRMLS_CC)) {
if (RETURN_VALUE_USED(opline)) {
- zval *retval;
-
- ALLOC_ZVAL(retval);
- ZVAL_STRINGL(retval, Z_STRVAL_P(EX_T((opline+1)->op2.var).str_offset.str)+EX_T((opline+1)->op2.var).str_offset.offset, 1, 1);
- INIT_PZVAL(retval);
- EX_T(opline->result.var).var.ptr = retval;
+ ZVAL_STRINGL(EX_VAR(opline->result.var), Z_STR_OFFSET_P(EX_VAR((opline+1)->op2.var))->str + Z_STR_OFFSET_P(EX_VAR((opline+1)->op2.var))->offset, 1);
}
} else if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
- } else if (UNEXPECTED(*variable_ptr_ptr == &EG(error_zval))) {
+ } else if (UNEXPECTED(variable_ptr == &EG(error_zval))) {
if (IS_TMP_FREE(free_op_data1)) {
zval_dtor(value);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
} else {
if ((opline+1)->op1_type == IS_TMP_VAR) {
- value = zend_assign_tmp_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_tmp_to_variable(variable_ptr, value TSRMLS_CC);
} else if ((opline+1)->op1_type == IS_CONST) {
- value = zend_assign_const_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_const_to_variable(variable_ptr, value TSRMLS_CC);
} else {
- value = zend_assign_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_to_variable(variable_ptr, value TSRMLS_CC);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(value);
- EX_T(opline->result.var).var.ptr = value;
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
}
}
FREE_OP_VAR_PTR(free_op_data2);
FREE_OP_IF_VAR(free_op_data1);
}
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
/* assign_dim has two opcodes! */
CHECK_EXCEPTION();
ZEND_VM_INC_OPCODE();
@@ -15506,49 +14997,41 @@ static int ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER
USE_OPLINE
zend_free_op free_op1;
zval *value;
- zval **variable_ptr_ptr;
+ zval *variable_ptr;
SAVE_OPLINE();
value = opline->op2.zv;
- variable_ptr_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ variable_ptr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(variable_ptr_ptr == NULL)) {
- if (zend_assign_to_string_offset(&EX_T(opline->op1.var), value, IS_CONST TSRMLS_CC)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(variable_ptr) == IS_STR_OFFSET)) {
+ if (zend_assign_to_string_offset(EX_VAR(opline->op1.var), value, IS_CONST TSRMLS_CC)) {
if (RETURN_VALUE_USED(opline)) {
- zval *retval;
-
- ALLOC_ZVAL(retval);
- ZVAL_STRINGL(retval, Z_STRVAL_P(EX_T(opline->op1.var).str_offset.str)+EX_T(opline->op1.var).str_offset.offset, 1, 1);
- INIT_PZVAL(retval);
- EX_T(opline->result.var).var.ptr = retval;
+ ZVAL_STRINGL(EX_VAR(opline->result.var), Z_STR_OFFSET_P(EX_VAR(opline->op1.var))->str + Z_STR_OFFSET_P(EX_VAR(opline->op1.var))->offset, 1);
}
} else if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
- } else if (IS_VAR == IS_VAR && UNEXPECTED(*variable_ptr_ptr == &EG(error_zval))) {
+ } else if (IS_VAR == IS_VAR && UNEXPECTED(variable_ptr == &EG(error_zval))) {
if (0) {
zval_dtor(value);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
} else {
if (IS_CONST == IS_TMP_VAR) {
- value = zend_assign_tmp_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_tmp_to_variable(variable_ptr, value TSRMLS_CC);
} else if (IS_CONST == IS_CONST) {
- value = zend_assign_const_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_const_to_variable(variable_ptr, value TSRMLS_CC);
} else {
- value = zend_assign_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_to_variable(variable_ptr, value TSRMLS_CC);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(value);
- EX_T(opline->result.var).var.ptr = value;
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
}
}
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
/* zend_assign_to_variable() always takes care of op2, never free it! */
@@ -15560,8 +15043,6 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZEND_OPCO
{
USE_OPLINE
zval *function_name;
- char *function_name_strval;
- int function_name_strlen;
zend_free_op free_op1;
call_slot *call = EX(call_slots) + opline->result.num;
@@ -15577,32 +15058,29 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZEND_OPCO
zend_error_noreturn(E_ERROR, "Method name must be a string");
}
- function_name_strval = Z_STRVAL_P(function_name);
- function_name_strlen = Z_STRLEN_P(function_name);
+ ZVAL_COPY_VALUE(&call->object, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC));
- call->object = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
-
- if (EXPECTED(call->object != NULL) &&
- EXPECTED(Z_TYPE_P(call->object) == IS_OBJECT)) {
- call->called_scope = Z_OBJCE_P(call->object);
+ if (EXPECTED(Z_TYPE(call->object) != IS_UNDEF) &&
+ EXPECTED(Z_TYPE(call->object) == IS_OBJECT)) {
+ call->called_scope = Z_OBJCE(call->object);
if (IS_CONST != IS_CONST ||
(call->fbc = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope)) == NULL) {
- zval *object = call->object;
+ zend_object *object = Z_OBJ(call->object);
- if (UNEXPECTED(Z_OBJ_HT_P(call->object)->get_method == NULL)) {
+ if (UNEXPECTED(Z_OBJ_HT(call->object)->get_method == NULL)) {
zend_error_noreturn(E_ERROR, "Object does not support method calls");
}
/* First, locate the function. */
- call->fbc = Z_OBJ_HT_P(call->object)->get_method(&call->object, function_name_strval, function_name_strlen, ((IS_CONST == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
+ call->fbc = Z_OBJ_HT(call->object)->get_method(&call->object, Z_STR_P(function_name), ((IS_CONST == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
if (UNEXPECTED(call->fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(call->object), function_name_strval);
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(&call->object), Z_STRVAL_P(function_name));
}
if (IS_CONST == IS_CONST &&
EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0) &&
- EXPECTED(call->object == object)) {
+ EXPECTED(Z_OBJ(call->object) == object)) {
CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope, call->fbc);
}
}
@@ -15611,20 +15089,16 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZEND_OPCO
HANDLE_EXCEPTION();
}
- zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval);
+ zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", Z_STRVAL_P(function_name));
}
if ((call->fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) {
- call->object = NULL;
+ ZVAL_UNDEF(&call->object);
} else {
- if (!PZVAL_IS_REF(call->object)) {
- Z_ADDREF_P(call->object); /* For $this pointer */
+ if (!Z_ISREF(call->object)) {
+ Z_ADDREF(call->object); /* For $this pointer */
} else {
- zval *this_ptr;
- ALLOC_ZVAL(this_ptr);
- INIT_PZVAL_COPY(this_ptr, call->object);
- zval_copy_ctor(this_ptr);
- call->object = this_ptr;
+ ZVAL_DUP(&call->object, Z_REFVAL(call->object));
}
}
@@ -15632,7 +15106,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZEND_OPCO
call->is_ctor_call = 0;
EX(call) = call;
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -15652,7 +15126,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZE
if (CACHED_PTR(opline->op1.literal->cache_slot)) {
ce = CACHED_PTR(opline->op1.literal->cache_slot);
} else {
- ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
@@ -15663,7 +15137,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZE
}
call->called_scope = ce;
} else {
- ce = EX_T(opline->op1.var).class_entry;
+ ce = Z_CE_P(EX_VAR(opline->op1.var));
if (opline->extended_value == ZEND_FETCH_CLASS_PARENT || opline->extended_value == ZEND_FETCH_CLASS_SELF) {
call->called_scope = EG(called_scope);
@@ -15681,44 +15155,33 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZE
(call->fbc = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce))) {
/* do nothing */
} else if (IS_CONST != IS_UNUSED) {
- char *function_name_strval = NULL;
- int function_name_strlen = 0;
- if (IS_CONST == IS_CONST) {
- function_name_strval = Z_STRVAL_P(opline->op2.zv);
- function_name_strlen = Z_STRLEN_P(opline->op2.zv);
- } else {
- function_name = opline->op2.zv;
-
+ function_name = opline->op2.zv;
+ if (IS_CONST != IS_CONST) {
if (UNEXPECTED(Z_TYPE_P(function_name) != IS_STRING)) {
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
zend_error_noreturn(E_ERROR, "Function name must be a string");
- } else {
- function_name_strval = Z_STRVAL_P(function_name);
- function_name_strlen = Z_STRLEN_P(function_name);
}
}
- if (function_name_strval) {
- if (ce->get_static_method) {
- call->fbc = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
+ if (ce->get_static_method) {
+ call->fbc = ce->get_static_method(ce, Z_STR_P(function_name) TSRMLS_CC);
+ } else {
+ call->fbc = zend_std_get_static_method(ce, Z_STR_P(function_name), ((IS_CONST == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
+ }
+ if (UNEXPECTED(call->fbc == NULL)) {
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", ce->name->val, Z_STRVAL_P(function_name));
+ }
+ if (IS_CONST == IS_CONST &&
+ EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
+ EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0)) {
+ if (IS_VAR == IS_CONST) {
+ CACHE_PTR(opline->op2.literal->cache_slot, call->fbc);
} else {
- call->fbc = zend_std_get_static_method(ce, function_name_strval, function_name_strlen, ((IS_CONST == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
- }
- if (UNEXPECTED(call->fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", ce->name, function_name_strval);
- }
- if (IS_CONST == IS_CONST &&
- EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
- EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0)) {
- if (IS_VAR == IS_CONST) {
- CACHE_PTR(opline->op2.literal->cache_slot, call->fbc);
- } else {
- CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce, call->fbc);
- }
+ CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce, call->fbc);
}
}
if (IS_CONST != IS_CONST) {
@@ -15728,31 +15191,28 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZE
if (UNEXPECTED(ce->constructor == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot call constructor");
}
- if (EG(This) && Z_OBJCE_P(EG(This)) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
- zend_error_noreturn(E_ERROR, "Cannot call private %s::__construct()", ce->name);
+ if (Z_TYPE(EG(This)) != IS_UNDEF && Z_OBJCE(EG(This)) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
+ zend_error_noreturn(E_ERROR, "Cannot call private %s::__construct()", ce->name->val);
}
call->fbc = ce->constructor;
}
if (call->fbc->common.fn_flags & ZEND_ACC_STATIC) {
- call->object = NULL;
+ ZVAL_UNDEF(&call->object);
} else {
- if (EG(This) &&
- Z_OBJ_HT_P(EG(This))->get_class_entry &&
- !instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) {
+ if (Z_TYPE(EG(This)) != IS_UNDEF &&
+ Z_OBJ_HT(EG(This))->get_class_entry &&
+ !instanceof_function(Z_OBJCE(EG(This)), ce TSRMLS_CC)) {
/* We are calling method of the other (incompatible) class,
but passing $this. This is done for compatibility with php-4. */
if (call->fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
- zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name);
+ zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name->val, call->fbc->common.function_name->val);
} else {
/* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */
- zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name);
+ zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", call->fbc->common.scope->name->val, call->fbc->common.function_name->val);
}
}
- if ((call->object = EG(This))) {
- Z_ADDREF_P(call->object);
- call->called_scope = Z_OBJCE_P(call->object);
- }
+ ZVAL_COPY(&call->object, &EG(This));
}
call->num_additional_args = 0;
@@ -15769,7 +15229,7 @@ static int ZEND_FASTCALL ZEND_CASE_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_A
zend_free_op free_op1;
SAVE_OPLINE();
- is_equal_function(&EX_T(opline->result.var).tmp_var,
+ is_equal_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
@@ -15798,7 +15258,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE
}
/* non-qualified constant - allow text substitution */
zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", actual, actual);
- ZVAL_STRINGL(&EX_T(opline->result.var).tmp_var, actual, Z_STRLEN_P(opline->op2.zv)-(actual - Z_STRVAL_P(opline->op2.zv)), 1);
+ ZVAL_STRINGL(EX_VAR(opline->result.var), actual, Z_STRLEN_P(opline->op2.zv)-(actual - Z_STRVAL_P(opline->op2.zv)));
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
} else {
@@ -15807,27 +15267,25 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE
} else {
CACHE_PTR(opline->op2.literal->cache_slot, c);
}
- retval = &EX_T(opline->result.var).tmp_var;
- ZVAL_COPY_VALUE(retval, &c->value);
- zval_copy_ctor(retval);
+ retval = EX_VAR(opline->result.var);
+ ZVAL_DUP(retval, &c->value);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
} else {
/* class constant */
zend_class_entry *ce;
- zval **value;
+ zval *value;
if (IS_VAR == IS_CONST) {
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
value = CACHED_PTR(opline->op2.literal->cache_slot);
- ZVAL_COPY_VALUE(&EX_T(opline->result.var).tmp_var, *value);
- zval_copy_ctor(&EX_T(opline->result.var).tmp_var);
+ ZVAL_DUP(EX_VAR(opline->result.var), value);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
} else if (CACHED_PTR(opline->op1.literal->cache_slot)) {
ce = CACHED_PTR(opline->op1.literal->cache_slot);
} else {
- ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
@@ -15837,17 +15295,16 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE
CACHE_PTR(opline->op1.literal->cache_slot, ce);
}
} else {
- ce = EX_T(opline->op1.var).class_entry;
+ ce = Z_CE_P(EX_VAR(opline->op1.var));
if ((value = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce)) != NULL) {
- ZVAL_COPY_VALUE(&EX_T(opline->result.var).tmp_var, *value);
- zval_copy_ctor(&EX_T(opline->result.var).tmp_var);
+ ZVAL_DUP(EX_VAR(opline->result.var), value);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
}
- if (EXPECTED(zend_hash_quick_find(&ce->constants_table, Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv)+1, Z_HASH_P(opline->op2.zv), (void **) &value) == SUCCESS)) {
- if (IS_CONSTANT_TYPE(Z_TYPE_PP(value))) {
+ if (EXPECTED((value = zend_hash_find(&ce->constants_table, Z_STR_P(opline->op2.zv))) != NULL)) {
+ if (IS_CONSTANT_TYPE(Z_TYPE_P(value))) {
zend_class_entry *old_scope = EG(scope);
EG(scope) = ce;
@@ -15859,11 +15316,11 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE
} else {
CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce, value);
}
- ZVAL_COPY_VALUE(&EX_T(opline->result.var).tmp_var, *value);
- zval_copy_ctor(&EX_T(opline->result.var).tmp_var);
+ ZVAL_DUP(EX_VAR(opline->result.var), value);
} else if (Z_STRLEN_P(opline->op2.zv) == sizeof("class")-1 && memcmp(Z_STRVAL_P(opline->op2.zv), "class", sizeof("class") - 1) == 0) {
/* "class" is assigned as a case-sensitive keyword from zend_do_resolve_class_name */
- ZVAL_STRINGL(&EX_T(opline->result.var).tmp_var, ce->name, ce->name_length, 1);
+ ZVAL_STR(EX_VAR(opline->result.var), ce->name);
+ STR_ADDREF(ce->name);
} else {
zend_error_noreturn(E_ERROR, "Undefined class constant '%s'", Z_STRVAL_P(opline->op2.zv));
}
@@ -15881,30 +15338,25 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CONST_HANDLER(ZEND_OPC
SAVE_OPLINE();
if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) && opline->extended_value) {
- zval **expr_ptr_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
-
- if (IS_VAR == IS_VAR && UNEXPECTED(expr_ptr_ptr == NULL)) {
+ expr_ptr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets");
}
- SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr_ptr);
- expr_ptr = *expr_ptr_ptr;
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr);
Z_ADDREF_P(expr_ptr);
} else {
expr_ptr=_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (0) { /* temporary variable */
- zval *new_expr;
-
- ALLOC_ZVAL(new_expr);
- INIT_PZVAL_COPY(new_expr, expr_ptr);
- expr_ptr = new_expr;
- } else if (IS_VAR == IS_CONST || PZVAL_IS_REF(expr_ptr)) {
- zval *new_expr;
-
- ALLOC_ZVAL(new_expr);
- INIT_PZVAL_COPY(new_expr, expr_ptr);
- expr_ptr = new_expr;
- zendi_zval_copy_ctor(*expr_ptr);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval new_expr;
+
+ ZVAL_COPY_VALUE(&new_expr, expr_ptr);
+ expr_ptr = &new_expr;
+ } else if (IS_VAR == IS_CONST || Z_ISREF_P(expr_ptr)) {
+ zval new_expr;
+
+ ZVAL_DUP(&new_expr, expr_ptr);
+ expr_ptr = &new_expr;
+ zval_ptr_dtor_nogc(free_op1.var);
} else if (IS_VAR == IS_CV) {
Z_ADDREF_P(expr_ptr);
}
@@ -15923,32 +15375,29 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CONST_HANDLER(ZEND_OPC
case IS_BOOL:
hval = Z_LVAL_P(offset);
num_index:
- zend_hash_index_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), hval, &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr);
break;
case IS_STRING:
- if (IS_CONST == IS_CONST) {
- hval = Z_HASH_P(offset);
- } else {
+ if (IS_CONST != IS_CONST) {
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index);
- hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset));
}
- zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), Z_STR_P(offset), expr_ptr);
break;
case IS_NULL:
- zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), STR_EMPTY_ALLOC(), expr_ptr);
break;
default:
zend_error(E_WARNING, "Illegal offset type");
- zval_ptr_dtor(&expr_ptr);
+ zval_ptr_dtor(expr_ptr);
/* do nothing */
break;
}
} else {
- zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr);
}
if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) && opline->extended_value) {
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
}
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -15958,7 +15407,7 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HAN
{
USE_OPLINE
- array_init(&EX_T(opline->result.var).tmp_var);
+ array_init(EX_VAR(opline->result.var));
if (IS_VAR == IS_UNUSED) {
ZEND_VM_NEXT_OPCODE();
#if 0 || IS_VAR != IS_UNUSED
@@ -15980,13 +15429,13 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HAND
IS_CONST == IS_UNUSED &&
(opline->extended_value & ZEND_QUICK_SET)) {
if (EG(active_symbol_table)) {
- zend_compiled_variable *cv = &CV_DEF_OF(opline->op1.var);
+ zend_string *cv = CV_DEF_OF(opline->op1.var);
- zend_delete_variable(EX(prev_execute_data), EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value TSRMLS_CC);
- EX_CV(opline->op1.var) = NULL;
- } else if (EX_CV(opline->op1.var)) {
- zval_ptr_dtor(EX_CV(opline->op1.var));
- EX_CV(opline->op1.var) = NULL;
+ zend_delete_variable(EX(prev_execute_data), EG(active_symbol_table), cv TSRMLS_CC);
+ ZVAL_UNDEF(EX_VAR_NUM(opline->op1.var));
+ } else if (Z_TYPE_P(EX_VAR_NUM(opline->op1.var)) != IS_UNDEF) {
+ zval_ptr_dtor(EX_VAR_NUM(opline->op1.var));
+ ZVAL_UNDEF(EX_VAR_NUM(opline->op1.var));
}
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -15995,8 +15444,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HAND
varname = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (IS_VAR != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
- ZVAL_COPY_VALUE(&tmp, varname);
- zval_copy_ctor(&tmp);
+ ZVAL_DUP(&tmp, varname);
convert_to_string(&tmp);
varname = &tmp;
} else if (IS_VAR == IS_VAR || IS_VAR == IS_CV) {
@@ -16010,14 +15458,14 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HAND
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
ce = CACHED_PTR(opline->op2.literal->cache_slot);
} else {
- ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
if (IS_VAR != IS_CONST && varname == &tmp) {
zval_dtor(&tmp);
} else if (IS_VAR == IS_VAR || IS_VAR == IS_CV) {
- zval_ptr_dtor(&varname);
+ zval_ptr_dtor(varname);
}
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
HANDLE_EXCEPTION();
}
if (UNEXPECTED(ce == NULL)) {
@@ -16026,22 +15474,20 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HAND
CACHE_PTR(opline->op2.literal->cache_slot, ce);
}
} else {
- ce = EX_T(opline->op2.var).class_entry;
+ ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ zend_std_unset_static_property(ce, Z_STR_P(varname), ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
} else {
- ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1);
-
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
- zend_delete_variable(execute_data, target_symbol_table, varname->value.str.val, varname->value.str.len+1, hash_value TSRMLS_CC);
+ zend_delete_variable(execute_data, target_symbol_table, Z_STR_P(varname) TSRMLS_CC);
}
if (IS_VAR != IS_CONST && varname == &tmp) {
zval_dtor(&tmp);
} else if (IS_VAR == IS_VAR || IS_VAR == IS_CV) {
- zval_ptr_dtor(&varname);
+ zval_ptr_dtor(varname);
}
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -16050,21 +15496,21 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HAND
{
USE_OPLINE
zend_free_op free_op1;
- zval **container;
+ zval *container;
zval *offset;
ulong hval;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_CV && container != &EG(uninitialized_zval_ptr)) {
+ container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ if (IS_VAR == IS_CV) {
SEPARATE_ZVAL_IF_NOT_REF(container);
}
offset = opline->op2.zv;
if (IS_VAR != IS_VAR || container) {
- switch (Z_TYPE_PP(container)) {
+ switch (Z_TYPE_P(container)) {
case IS_ARRAY: {
- HashTable *ht = Z_ARRVAL_PP(container);
+ HashTable *ht = Z_ARRVAL_P(container);
switch (Z_TYPE_P(offset)) {
case IS_DOUBLE:
@@ -16081,29 +15527,26 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HAND
if (IS_CONST == IS_CV || IS_CONST == IS_VAR) {
Z_ADDREF_P(offset);
}
- if (IS_CONST == IS_CONST) {
- hval = Z_HASH_P(offset);
- } else {
+ if (IS_CONST != IS_CONST) {
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim);
- hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset));
}
- if (ht == &EG(symbol_table)) {
- zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC);
+ if (ht == &EG(symbol_table).ht) {
+ zend_delete_global_variable(Z_STR_P(offset) TSRMLS_CC);
} else {
- zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval);
+ zend_hash_del(ht, Z_STR_P(offset));
}
if (IS_CONST == IS_CV || IS_CONST == IS_VAR) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
}
break;
num_index_dim:
zend_hash_index_del(ht, hval);
if (IS_CONST == IS_CV || IS_CONST == IS_VAR) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
}
break;
case IS_NULL:
- zend_hash_del(ht, "", sizeof(""));
+ zend_hash_del(ht, STR_EMPTY_ALLOC());
break;
default:
zend_error(E_WARNING, "Illegal offset type in unset");
@@ -16113,15 +15556,15 @@ num_index_dim:
break;
}
case IS_OBJECT:
- if (UNEXPECTED(Z_OBJ_HT_P(*container)->unset_dimension == NULL)) {
+ if (UNEXPECTED(Z_OBJ_HT_P(container)->unset_dimension == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use object as array");
}
if (0) {
MAKE_REAL_ZVAL_PTR(offset);
}
- Z_OBJ_HT_P(*container)->unset_dimension(*container, offset TSRMLS_CC);
+ Z_OBJ_HT_P(container)->unset_dimension(container, offset TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
}
@@ -16136,7 +15579,7 @@ num_index_dim:
} else {
}
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -16146,28 +15589,28 @@ static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HAND
{
USE_OPLINE
zend_free_op free_op1;
- zval **container;
+ zval *container;
zval *offset;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
offset = opline->op2.zv;
if (IS_VAR != IS_VAR || container) {
- if (IS_VAR == IS_CV && container != &EG(uninitialized_zval_ptr)) {
+ if (IS_VAR == IS_CV) {
SEPARATE_ZVAL_IF_NOT_REF(container);
}
- if (Z_TYPE_PP(container) == IS_OBJECT) {
+ if (Z_TYPE_P(container) == IS_OBJECT) {
if (0) {
MAKE_REAL_ZVAL_PTR(offset);
}
- if (Z_OBJ_HT_P(*container)->unset_property) {
- Z_OBJ_HT_P(*container)->unset_property(*container, offset, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ if (Z_OBJ_HT_P(container)->unset_property) {
+ Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to unset property of non-object");
}
if (0) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
}
@@ -16177,7 +15620,7 @@ static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HAND
} else {
}
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -16186,19 +15629,19 @@ static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HAND
static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zval **value;
+ zval *value;
zend_bool isset = 1;
SAVE_OPLINE();
if (IS_VAR == IS_CV &&
IS_CONST == IS_UNUSED &&
(opline->extended_value & ZEND_QUICK_SET)) {
- if (EX_CV(opline->op1.var)) {
- value = EX_CV(opline->op1.var);
+ if (Z_TYPE_P(EX_VAR_NUM(opline->op1.var)) != IS_UNDEF) {
+ value = EX_VAR_NUM(opline->op1.var);
} else if (EG(active_symbol_table)) {
- zend_compiled_variable *cv = &CV_DEF_OF(opline->op1.var);
+ zend_string *cv = CV_DEF_OF(opline->op1.var);
- if (zend_hash_quick_find(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, (void **) &value) == FAILURE) {
+ if ((value = zend_hash_find(EG(active_symbol_table), cv)) == NULL) {
isset = 0;
}
} else {
@@ -16210,8 +15653,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_CONST_HANDLER(ZEND_OPC
zval tmp, *varname = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (IS_VAR != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
- ZVAL_COPY_VALUE(&tmp, varname);
- zval_copy_ctor(&tmp);
+ ZVAL_DUP(&tmp, varname);
convert_to_string(&tmp);
varname = &tmp;
}
@@ -16223,7 +15665,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_CONST_HANDLER(ZEND_OPC
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
ce = CACHED_PTR(opline->op2.literal->cache_slot);
} else {
- ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -16231,15 +15673,15 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_CONST_HANDLER(ZEND_OPC
CACHE_PTR(opline->op2.literal->cache_slot, ce);
}
} else {
- ce = EX_T(opline->op2.var).class_entry;
+ ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1, ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ value = zend_std_get_static_property(ce, Z_STR_P(varname), 1, ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
if (!value) {
isset = 0;
}
} else {
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
- if (zend_hash_find(target_symbol_table, varname->value.str.val, varname->value.str.len+1, (void **) &value) == FAILURE) {
+ if ((value = zend_hash_find(target_symbol_table, Z_STR_P(varname))) == NULL) {
isset = 0;
}
}
@@ -16247,20 +15689,20 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_CONST_HANDLER(ZEND_OPC
if (IS_VAR != IS_CONST && varname == &tmp) {
zval_dtor(&tmp);
}
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
}
if (opline->extended_value & ZEND_ISSET) {
- if (isset && Z_TYPE_PP(value) != IS_NULL) {
- ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, 1);
+ if (isset && Z_TYPE_P(value) != IS_NULL) {
+ ZVAL_BOOL(EX_VAR(opline->result.var), 1);
} else {
- ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, 0);
+ ZVAL_BOOL(EX_VAR(opline->result.var), 0);
}
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (!isset || !i_zend_is_true(*value TSRMLS_CC)) {
- ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, 1);
+ if (!isset || !i_zend_is_true(value TSRMLS_CC)) {
+ ZVAL_BOOL(EX_VAR(opline->result.var), 1);
} else {
- ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, 0);
+ ZVAL_BOOL(EX_VAR(opline->result.var), 0);
}
}
@@ -16273,7 +15715,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CONST(
USE_OPLINE
zend_free_op free_op1;
zval *container;
- zval **value = NULL;
+ zval *value;
int result = 0;
ulong hval;
zval *offset;
@@ -16297,23 +15739,20 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CONST(
case IS_LONG:
hval = Z_LVAL_P(offset);
num_index_prop:
- if (zend_hash_index_find(ht, hval, (void **) &value) == SUCCESS) {
+ if ((value = zend_hash_index_find(ht, hval)) != NULL) {
isset = 1;
}
break;
case IS_STRING:
- if (IS_CONST == IS_CONST) {
- hval = Z_HASH_P(offset);
- } else {
+ if (IS_CONST != IS_CONST) {
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop);
- hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset));
}
- if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) {
+ if ((value = zend_hash_find(ht, Z_STR_P(offset))) != NULL) {
isset = 1;
}
break;
case IS_NULL:
- if (zend_hash_find(ht, "", sizeof(""), (void **) &value) == SUCCESS) {
+ if ((value = zend_hash_find(ht, STR_EMPTY_ALLOC())) != NULL) {
isset = 1;
}
break;
@@ -16323,13 +15762,13 @@ num_index_prop:
}
if (opline->extended_value & ZEND_ISSET) {
- if (isset && Z_TYPE_PP(value) == IS_NULL) {
+ if (isset && Z_TYPE_P(value) == IS_NULL) {
result = 0;
} else {
result = isset;
}
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (!isset || !i_zend_is_true(*value TSRMLS_CC)) {
+ if (!isset || !i_zend_is_true(value TSRMLS_CC)) {
result = 0;
} else {
result = 1;
@@ -16356,7 +15795,7 @@ num_index_prop:
}
}
if (0) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
}
@@ -16367,8 +15806,7 @@ num_index_prop:
if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */
|| (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
&& IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) {
- ZVAL_COPY_VALUE(&tmp, offset);
- zval_copy_ctor(&tmp);
+ ZVAL_DUP(&tmp, offset);
convert_to_long(&tmp);
offset = &tmp;
} else {
@@ -16392,14 +15830,13 @@ num_index_prop:
}
- Z_TYPE(EX_T(opline->result.var).tmp_var) = IS_BOOL;
if (opline->extended_value & ZEND_ISSET) {
- Z_LVAL(EX_T(opline->result.var).tmp_var) = result;
+ ZVAL_BOOL(EX_VAR(opline->result.var), result);
} else {
- Z_LVAL(EX_T(opline->result.var).tmp_var) = !result;
+ ZVAL_BOOL(EX_VAR(opline->result.var), !result);
}
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -16417,6 +15854,9 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_VAR_CONST_HANDLER(ZEN
static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
+//???
+return 0;
+#if 0
USE_OPLINE
/* The generator object is stored in return_value_ptr_ptr */
@@ -16459,7 +15899,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_
generator->value = copy;
} else {
- zval **value_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ zval **value_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W);
if (IS_VAR == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
@@ -16481,14 +15921,14 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_
generator->value = *value_ptr;
}
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
}
} else {
zval *value = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
/* Consts, temporary variables and references need copying */
if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR
- || PZVAL_IS_REF(value)
+ || Z_ISREF_P(value)
) {
zval *copy;
@@ -16501,7 +15941,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_
}
generator->value = copy;
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
} else {
if (IS_VAR == IS_CV) {
Z_ADDREF_P(value);
@@ -16522,7 +15962,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_
/* Consts, temporary variables and references need copying */
if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR
- || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0)
+ || (Z_ISREF_P(key) && Z_REFCOUNT_P(key) > 0)
) {
zval *copy;
@@ -16573,6 +16013,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_
SAVE_OPLINE();
ZEND_VM_RETURN();
+#endif
}
static int ZEND_FASTCALL ZEND_ADD_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -16581,10 +16022,10 @@ static int ZEND_FASTCALL ZEND_ADD_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- fast_add_function(&EX_T(opline->result.var).tmp_var,
+ fast_add_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
zval_dtor(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -16596,10 +16037,10 @@ static int ZEND_FASTCALL ZEND_SUB_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- fast_sub_function(&EX_T(opline->result.var).tmp_var,
+ fast_sub_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
zval_dtor(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -16611,10 +16052,10 @@ static int ZEND_FASTCALL ZEND_MUL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- fast_mul_function(&EX_T(opline->result.var).tmp_var,
+ fast_mul_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
zval_dtor(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -16626,10 +16067,10 @@ static int ZEND_FASTCALL ZEND_DIV_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- fast_div_function(&EX_T(opline->result.var).tmp_var,
+ fast_div_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
zval_dtor(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -16641,10 +16082,10 @@ static int ZEND_FASTCALL ZEND_MOD_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- fast_mod_function(&EX_T(opline->result.var).tmp_var,
+ fast_mod_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
zval_dtor(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -16656,10 +16097,10 @@ static int ZEND_FASTCALL ZEND_SL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- shift_left_function(&EX_T(opline->result.var).tmp_var,
+ shift_left_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
zval_dtor(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -16671,10 +16112,10 @@ static int ZEND_FASTCALL ZEND_SR_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- shift_right_function(&EX_T(opline->result.var).tmp_var,
+ shift_right_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
zval_dtor(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -16686,10 +16127,10 @@ static int ZEND_FASTCALL ZEND_CONCAT_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_A
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- concat_function(&EX_T(opline->result.var).tmp_var,
+ concat_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
zval_dtor(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -16701,10 +16142,10 @@ static int ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HAN
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- is_identical_function(&EX_T(opline->result.var).tmp_var,
+ is_identical_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
zval_dtor(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -16714,14 +16155,14 @@ static int ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
is_identical_function(result,
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
Z_LVAL_P(result) = !Z_LVAL_P(result);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
zval_dtor(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -16731,13 +16172,13 @@ static int ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_equal_function(result,
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC));
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
zval_dtor(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -16747,13 +16188,13 @@ static int ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HAN
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_not_equal_function(result,
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC));
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
zval_dtor(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -16763,13 +16204,13 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDL
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_is_smaller_function(result,
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC));
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
zval_dtor(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -16779,13 +16220,13 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_VAR_TMP_HANDLER(ZEND_OPC
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_is_smaller_or_equal_function(result,
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC));
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
zval_dtor(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -16797,10 +16238,10 @@ static int ZEND_FASTCALL ZEND_BW_OR_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- bitwise_or_function(&EX_T(opline->result.var).tmp_var,
+ bitwise_or_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
zval_dtor(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -16812,10 +16253,10 @@ static int ZEND_FASTCALL ZEND_BW_AND_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_A
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- bitwise_and_function(&EX_T(opline->result.var).tmp_var,
+ bitwise_and_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
zval_dtor(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -16827,10 +16268,10 @@ static int ZEND_FASTCALL ZEND_BW_XOR_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_A
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- bitwise_xor_function(&EX_T(opline->result.var).tmp_var,
+ bitwise_xor_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
zval_dtor(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -16842,10 +16283,10 @@ static int ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- boolean_xor_function(&EX_T(opline->result.var).tmp_var,
+ boolean_xor_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
zval_dtor(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -16855,18 +16296,16 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_TMP(int (*bin
{
USE_OPLINE
zend_free_op free_op1, free_op2, free_op_data1;
- zval **object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- zval *object;
+ zval *object = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
zval *property = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
zval *value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
int have_get_ptr = 0;
- if (IS_VAR == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- make_real_object(object_ptr TSRMLS_CC);
- object = *object_ptr;
+ make_real_object(object TSRMLS_CC);
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to assign property of non-object");
@@ -16874,8 +16313,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_TMP(int (*bin
FREE_OP(free_op_data1);
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
} else {
/* here we are sure we are dealing with an object */
@@ -16886,15 +16324,14 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_TMP(int (*bin
/* here property is a string */
if (opline->extended_value == ZEND_ASSIGN_OBJ
&& Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval **zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
have_get_ptr = 1;
- binary_op(*zptr, *zptr, value TSRMLS_CC);
+ binary_op(zptr, zptr, value TSRMLS_CC);
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(*zptr);
- EX_T(opline->result.var).var.ptr = *zptr;
+ ZVAL_COPY(EX_VAR(opline->result.var), zptr);
}
}
}
@@ -16918,12 +16355,11 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_TMP(int (*bin
if (Z_REFCOUNT_P(z) == 0) {
GC_REMOVE_ZVAL_FROM_BUFFER(z);
zval_dtor(z);
- FREE_ZVAL(z);
}
z = value;
}
Z_ADDREF_P(z);
- SEPARATE_ZVAL_IF_NOT_REF(&z);
+ SEPARATE_ZVAL_IF_NOT_REF(z);
binary_op(z, z, value TSRMLS_CC);
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
@@ -16931,28 +16367,26 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_TMP(int (*bin
Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(z);
- EX_T(opline->result.var).var.ptr = z;
+ ZVAL_COPY(EX_VAR(opline->result.var), z);
}
- zval_ptr_dtor(&z);
+ zval_ptr_dtor(z);
} else {
zend_error(E_WARNING, "Attempt to assign property of non-object");
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
}
}
if (1) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
zval_dtor(free_op2.var);
}
FREE_OP(free_op_data1);
}
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
/* assign_obj has two opcodes! */
CHECK_EXCEPTION();
ZEND_VM_INC_OPCODE();
@@ -16963,7 +16397,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_VAR_TMP(int (*binary_
{
USE_OPLINE
zend_free_op free_op1, free_op2, free_op_data2, free_op_data1;
- zval **var_ptr;
+ zval *var_ptr;
zval *value;
SAVE_OPLINE();
@@ -16972,42 +16406,41 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_VAR_TMP(int (*binary_
return zend_binary_assign_op_obj_helper_SPEC_VAR_TMP(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
break;
case ZEND_ASSIGN_DIM: {
- zval **container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ zval *container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- } else if (UNEXPECTED(Z_TYPE_PP(container) == IS_OBJECT)) {
+ } else if (UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
if (IS_VAR == IS_VAR && !(free_op1.var != NULL)) {
- Z_ADDREF_PP(container); /* undo the effect of get_obj_zval_ptr_ptr() */
+ Z_ADDREF_P(container); /* undo the effect of get_obj_zval_ptr_ptr() */
}
return zend_binary_assign_op_obj_helper_SPEC_VAR_TMP(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
} else {
zval *dim = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- zend_fetch_dimension_address(&EX_T((opline+1)->op2.var), container, dim, IS_TMP_VAR, BP_VAR_RW TSRMLS_CC);
+ zend_fetch_dimension_address(EX_VAR((opline+1)->op2.var), container, dim, IS_TMP_VAR, BP_VAR_RW TSRMLS_CC);
value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
- var_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
+ var_ptr = _get_zval_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
}
}
break;
default:
value = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- var_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ var_ptr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
/* do nothing */
break;
}
- if (UNEXPECTED(var_ptr == NULL)) {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
}
- if (UNEXPECTED(*var_ptr == &EG(error_zval))) {
+ if (UNEXPECTED(var_ptr == &EG(error_zval))) {
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
zval_dtor(free_op2.var);
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
if (opline->extended_value == ZEND_ASSIGN_DIM) {
ZEND_VM_INC_OPCODE();
@@ -17017,33 +16450,32 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_VAR_TMP(int (*binary_
SEPARATE_ZVAL_IF_NOT_REF(var_ptr);
- if (UNEXPECTED(Z_TYPE_PP(var_ptr) == IS_OBJECT)
- && Z_OBJ_HANDLER_PP(var_ptr, get)
- && Z_OBJ_HANDLER_PP(var_ptr, set)) {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_OBJECT)
+ && Z_OBJ_HANDLER_P(var_ptr, get)
+ && Z_OBJ_HANDLER_P(var_ptr, set)) {
/* proxy object */
- zval *objval = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC);
+ zval *objval = Z_OBJ_HANDLER_P(var_ptr, get)(var_ptr TSRMLS_CC);
Z_ADDREF_P(objval);
binary_op(objval, objval, value TSRMLS_CC);
- Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, objval TSRMLS_CC);
- zval_ptr_dtor(&objval);
+ Z_OBJ_HANDLER_P(var_ptr, set)(var_ptr, objval TSRMLS_CC);
+ zval_ptr_dtor(objval);
} else {
- binary_op(*var_ptr, *var_ptr, value TSRMLS_CC);
+ binary_op(var_ptr, var_ptr, value TSRMLS_CC);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(*var_ptr);
- EX_T(opline->result.var).var.ptr = *var_ptr;
+ ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
zval_dtor(free_op2.var);
if (opline->extended_value == ZEND_ASSIGN_DIM) {
FREE_OP(free_op_data1);
FREE_OP_VAR_PTR(free_op_data2);
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_INC_OPCODE();
} else {
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
}
ZEND_VM_NEXT_OPCODE();
@@ -17108,32 +16540,29 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_TMP(incdec_t i
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval **object_ptr;
zval *object;
zval *property;
- zval **retval;
+ zval *retval;
int have_get_ptr = 0;
SAVE_OPLINE();
- object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ object = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
property = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- retval = &EX_T(opline->result.var).var.ptr;
+ retval = EX_VAR(opline->result.var);
- if (IS_VAR == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
- object = *object_ptr;
+ make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
zval_dtor(free_op2.var);
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- *retval = &EG(uninitialized_zval);
+ ZVAL_NULL(retval);
}
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -17145,15 +16574,14 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_TMP(incdec_t i
}
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval **zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
have_get_ptr = 1;
- incdec_op(*zptr);
+ incdec_op(zptr);
if (RETURN_VALUE_USED(opline)) {
- *retval = *zptr;
- PZVAL_LOCK(*retval);
+ ZVAL_COPY(retval, zptr);
}
}
}
@@ -17168,32 +16596,30 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_TMP(incdec_t i
if (Z_REFCOUNT_P(z) == 0) {
GC_REMOVE_ZVAL_FROM_BUFFER(z);
zval_dtor(z);
- FREE_ZVAL(z);
}
z = value;
}
Z_ADDREF_P(z);
- SEPARATE_ZVAL_IF_NOT_REF(&z);
+ SEPARATE_ZVAL_IF_NOT_REF(z);
incdec_op(z);
- *retval = z;
+ ZVAL_COPY_VALUE(retval, z);
Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- SELECTIVE_PZVAL_LOCK(*retval, opline);
- zval_ptr_dtor(&z);
+ SELECTIVE_PZVAL_LOCK(retval, opline);
+ zval_ptr_dtor(z);
} else {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- *retval = &EG(uninitialized_zval);
+ ZVAL_NULL(retval);
}
}
}
if (1) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
zval_dtor(free_op2.var);
}
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -17212,29 +16638,27 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_TMP(incdec_t
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval **object_ptr;
zval *object;
zval *property;
zval *retval;
int have_get_ptr = 0;
SAVE_OPLINE();
- object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ object = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
property = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- retval = &EX_T(opline->result.var).tmp_var;
+ retval = EX_VAR(opline->result.var);
- if (IS_VAR == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
- object = *object_ptr;
+ make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
zval_dtor(free_op2.var);
ZVAL_NULL(retval);
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -17246,15 +16670,14 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_TMP(incdec_t
}
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval **zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
have_get_ptr = 1;
SEPARATE_ZVAL_IF_NOT_REF(zptr);
- ZVAL_COPY_VALUE(retval, *zptr);
- zendi_zval_copy_ctor(*retval);
+ ZVAL_DUP(retval, zptr);
- incdec_op(*zptr);
+ incdec_op(zptr);
}
}
@@ -17262,7 +16685,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_TMP(incdec_t
if (!have_get_ptr) {
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- zval *z_copy;
+ zval z_copy;
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC);
@@ -17270,20 +16693,16 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_TMP(incdec_t
if (Z_REFCOUNT_P(z) == 0) {
GC_REMOVE_ZVAL_FROM_BUFFER(z);
zval_dtor(z);
- FREE_ZVAL(z);
}
z = value;
}
- ZVAL_COPY_VALUE(retval, z);
- zendi_zval_copy_ctor(*retval);
- ALLOC_ZVAL(z_copy);
- INIT_PZVAL_COPY(z_copy, z);
- zendi_zval_copy_ctor(*z_copy);
- incdec_op(z_copy);
+ ZVAL_DUP(retval, z);
+ ZVAL_DUP(&z_copy, z);
+ incdec_op(&z_copy);
Z_ADDREF_P(z);
- Z_OBJ_HT_P(object)->write_property(object, property, z_copy, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(object)->write_property(object, property, &z_copy, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval_ptr_dtor(&z_copy);
- zval_ptr_dtor(&z);
+ zval_ptr_dtor(z);
} else {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
ZVAL_NULL(retval);
@@ -17291,11 +16710,11 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_TMP(incdec_t
}
if (1) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
zval_dtor(free_op2.var);
}
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -17318,10 +16737,10 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HAND
SAVE_OPLINE();
container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_R TSRMLS_CC);
+ zend_fetch_dimension_address_read(EX_VAR(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_R TSRMLS_CC);
zval_dtor(free_op2.var);
if (IS_VAR != IS_VAR || !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
}
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -17331,30 +16750,28 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HAND
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval **container;
+ zval *container;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_fetch_dimension_address(&EX_T(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_W TSRMLS_CC);
+ zend_fetch_dimension_address(EX_VAR(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_W TSRMLS_CC);
zval_dtor(free_op2.var);
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+//??? if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
+//??? }
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
/* We are going to assign the result by reference */
if (UNEXPECTED(opline->extended_value != 0)) {
- zval **retval_ptr = EX_T(opline->result.var).var.ptr_ptr;
+ zval *retval_ptr = EX_VAR(opline->result.var);
- if (retval_ptr) {
- Z_DELREF_PP(retval_ptr);
- SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
- Z_ADDREF_PP(retval_ptr);
- }
+ Z_DELREF_P(retval_ptr);
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
+ Z_ADDREF_P(retval_ptr);
}
CHECK_EXCEPTION();
@@ -17365,20 +16782,20 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HAN
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval **container;
+ zval *container;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_fetch_dimension_address(&EX_T(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_RW TSRMLS_CC);
+ zend_fetch_dimension_address(EX_VAR(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_RW TSRMLS_CC);
zval_dtor(free_op2.var);
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+//??? if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -17391,9 +16808,9 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HAN
SAVE_OPLINE();
container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_IS TSRMLS_CC);
+ zend_fetch_dimension_address_read(EX_VAR(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_IS TSRMLS_CC);
zval_dtor(free_op2.var);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -17401,31 +16818,30 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HAN
static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
+ zval *container;
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
if (zend_is_by_ref_func_arg_fetch(opline, EX(call) TSRMLS_CC)) {
- zval **container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_fetch_dimension_address(&EX_T(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_W TSRMLS_CC);
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
+ zend_fetch_dimension_address(EX_VAR(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_W TSRMLS_CC);
+//??? if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
zval_dtor(free_op2.var);
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
} else {
- zval *container;
-
if (IS_TMP_VAR == IS_UNUSED) {
zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
}
container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_R TSRMLS_CC);
+ zend_fetch_dimension_address_read(EX_VAR(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_R TSRMLS_CC);
zval_dtor(free_op2.var);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
}
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -17435,37 +16851,33 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval **container;
+ zval *container;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (IS_VAR == IS_CV) {
- if (container != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(container);
- }
+ SEPARATE_ZVAL_IF_NOT_REF(container);
}
- if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_fetch_dimension_address(&EX_T(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_UNSET TSRMLS_CC);
+ zend_fetch_dimension_address(EX_VAR(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_UNSET TSRMLS_CC);
zval_dtor(free_op2.var);
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
- if (UNEXPECTED(EX_T(opline->result.var).var.ptr_ptr == NULL)) {
+//??? if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
+ if (UNEXPECTED(Z_TYPE_P(EX_VAR(opline->result.var)) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
ZEND_VM_NEXT_OPCODE();
} else {
zend_free_op free_res;
- zval **retval_ptr = EX_T(opline->result.var).var.ptr_ptr;
+ zval *retval_ptr = EX_VAR(opline->result.var);
- PZVAL_UNLOCK(*retval_ptr, &free_res);
- if (retval_ptr != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(retval_ptr);
- }
- PZVAL_LOCK(*retval_ptr);
+ PZVAL_UNLOCK(retval_ptr, &free_res);
+ SEPARATE_ZVAL_IF_NOT_REF(retval_ptr);
+ PZVAL_LOCK(retval_ptr);
FREE_OP_VAR_PTR(free_res);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -17487,8 +16899,7 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_VAR_TMP(ZE
if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
zend_error(E_NOTICE, "Trying to get property of non-object");
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
zval_dtor(free_op2.var);
} else {
zval *retval;
@@ -17500,17 +16911,16 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_VAR_TMP(ZE
/* here we are sure we are dealing with an object */
retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_R, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- PZVAL_LOCK(retval);
- EX_T(opline->result.var).var.ptr = retval;
+ ZVAL_COPY(EX_VAR(opline->result.var), retval);
if (1) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
zval_dtor(free_op2.var);
}
}
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -17525,7 +16935,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HAND
USE_OPLINE
zend_free_op free_op1, free_op2;
zval *property;
- zval **container;
+ zval *container;
SAVE_OPLINE();
property = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
@@ -17533,31 +16943,31 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HAND
if (1) {
MAKE_REAL_ZVAL_PTR(property);
}
- container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
+ container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(&EX_T(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W TSRMLS_CC);
if (1) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
zval_dtor(free_op2.var);
}
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+//??? if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
/* We are going to assign the result by reference */
if (opline->extended_value & ZEND_FETCH_MAKE_REF) {
- zval **retval_ptr = EX_T(opline->result.var).var.ptr_ptr;
+ zval *retval_ptr = EX_VAR(opline->result.var);
- Z_DELREF_PP(retval_ptr);
+ Z_DELREF_P(retval_ptr);
SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
- Z_ADDREF_PP(retval_ptr);
- EX_T(opline->result.var).var.ptr = *EX_T(opline->result.var).var.ptr_ptr;
- EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
+ Z_ADDREF_P(retval_ptr);
+//??? EX_T(opline->result.var).var.ptr = *EX_T(opline->result.var).var.ptr_ptr;
+//??? EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
}
CHECK_EXCEPTION();
@@ -17569,28 +16979,28 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HAN
USE_OPLINE
zend_free_op free_op1, free_op2;
zval *property;
- zval **container;
+ zval *container;
SAVE_OPLINE();
property = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (1) {
MAKE_REAL_ZVAL_PTR(property);
}
- if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(&EX_T(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_RW TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_RW TSRMLS_CC);
if (1) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
zval_dtor(free_op2.var);
}
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+//??? if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -17609,8 +17019,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HAN
if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
zval_dtor(free_op2.var);
} else {
zval *retval;
@@ -17622,17 +17031,16 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HAN
/* here we are sure we are dealing with an object */
retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_IS, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- PZVAL_LOCK(retval);
- EX_T(opline->result.var).var.ptr = retval;
+ ZVAL_COPY(EX_VAR(opline->result.var), retval);
if (1) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
zval_dtor(free_op2.var);
}
}
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -17640,33 +17048,33 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HAN
static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
+ zval *container;
if (zend_is_by_ref_func_arg_fetch(opline, EX(call) TSRMLS_CC)) {
/* Behave like FETCH_OBJ_W */
zend_free_op free_op1, free_op2;
zval *property;
- zval **container;
SAVE_OPLINE();
property = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (1) {
MAKE_REAL_ZVAL_PTR(property);
}
- if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(&EX_T(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W TSRMLS_CC);
if (1) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
zval_dtor(free_op2.var);
}
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+//??? if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
} else {
@@ -17678,40 +17086,38 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_
{
USE_OPLINE
zend_free_op free_op1, free_op2, free_res;
- zval **container;
+ zval *container;
zval *property;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
property = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
if (IS_VAR == IS_CV) {
- if (container != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(container);
- }
+ SEPARATE_ZVAL_IF_NOT_REF(container);
}
if (1) {
MAKE_REAL_ZVAL_PTR(property);
}
- if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(&EX_T(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_UNSET TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_UNSET TSRMLS_CC);
if (1) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
zval_dtor(free_op2.var);
}
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+//??? if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
- PZVAL_UNLOCK(*EX_T(opline->result.var).var.ptr_ptr, &free_res);
- if (EX_T(opline->result.var).var.ptr_ptr != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(EX_T(opline->result.var).var.ptr_ptr);
- }
- PZVAL_LOCK(*EX_T(opline->result.var).var.ptr_ptr);
+//??? PZVAL_UNLOCK(EX_VAR(opline->result.var), &free_res);
+//??? if (EX_T(opline->result.var).var.ptr_ptr != &EG(uninitialized_zval_ptr)) {
+//??? SEPARATE_ZVAL_IF_NOT_REF(EX_T(opline->result.var).var.ptr_ptr);
+//??? }
+//??? PZVAL_LOCK(EX_VAR(opline->result.var));
FREE_OP_VAR_PTR(free_res);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -17721,26 +17127,26 @@ static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDL
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval **object_ptr;
+ zval *object;
zval *property_name;
SAVE_OPLINE();
- object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ object = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
property_name = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
if (1) {
MAKE_REAL_ZVAL_PTR(property_name);
}
- if (IS_VAR == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_assign_to_object(RETURN_VALUE_USED(opline)?&EX_T(opline->result.var).var.ptr:NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (1) {
- zval_ptr_dtor(&property_name);
+ zval_ptr_dtor(property_name);
} else {
zval_dtor(free_op2.var);
}
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
/* assign_obj has two opcodes! */
CHECK_EXCEPTION();
ZEND_VM_INC_OPCODE();
@@ -17751,24 +17157,24 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDL
{
USE_OPLINE
zend_free_op free_op1;
- zval **object_ptr;
+ zval *object_ptr;
SAVE_OPLINE();
- object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ object_ptr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(object_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- if (Z_TYPE_PP(object_ptr) == IS_OBJECT) {
+ if (Z_TYPE_P(object_ptr) == IS_OBJECT) {
zend_free_op free_op2;
zval *property_name = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
if (1) {
MAKE_REAL_ZVAL_PTR(property_name);
}
- zend_assign_to_object(RETURN_VALUE_USED(opline)?&EX_T(opline->result.var).var.ptr:NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (1) {
- zval_ptr_dtor(&property_name);
+ zval_ptr_dtor(property_name);
} else {
zval_dtor(free_op2.var);
}
@@ -17776,52 +17182,44 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDL
zend_free_op free_op2, free_op_data1, free_op_data2;
zval *value;
zval *dim = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- zval **variable_ptr_ptr;
+ zval *variable_ptr;
- zend_fetch_dimension_address(&EX_T((opline+1)->op2.var), object_ptr, dim, IS_TMP_VAR, BP_VAR_W TSRMLS_CC);
+ zend_fetch_dimension_address(EX_VAR((opline+1)->op2.var), object_ptr, dim, IS_TMP_VAR, BP_VAR_W TSRMLS_CC);
zval_dtor(free_op2.var);
value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
- variable_ptr_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
- if (UNEXPECTED(variable_ptr_ptr == NULL)) {
- if (zend_assign_to_string_offset(&EX_T((opline+1)->op2.var), value, (opline+1)->op1_type TSRMLS_CC)) {
+ variable_ptr = _get_zval_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
+ if (UNEXPECTED(Z_TYPE_P(variable_ptr) == IS_STR_OFFSET)) {
+ if (zend_assign_to_string_offset(EX_VAR((opline+1)->op2.var), value, (opline+1)->op1_type TSRMLS_CC)) {
if (RETURN_VALUE_USED(opline)) {
- zval *retval;
-
- ALLOC_ZVAL(retval);
- ZVAL_STRINGL(retval, Z_STRVAL_P(EX_T((opline+1)->op2.var).str_offset.str)+EX_T((opline+1)->op2.var).str_offset.offset, 1, 1);
- INIT_PZVAL(retval);
- EX_T(opline->result.var).var.ptr = retval;
+ ZVAL_STRINGL(EX_VAR(opline->result.var), Z_STR_OFFSET_P(EX_VAR((opline+1)->op2.var))->str + Z_STR_OFFSET_P(EX_VAR((opline+1)->op2.var))->offset, 1);
}
} else if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
- } else if (UNEXPECTED(*variable_ptr_ptr == &EG(error_zval))) {
+ } else if (UNEXPECTED(variable_ptr == &EG(error_zval))) {
if (IS_TMP_FREE(free_op_data1)) {
zval_dtor(value);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
} else {
if ((opline+1)->op1_type == IS_TMP_VAR) {
- value = zend_assign_tmp_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_tmp_to_variable(variable_ptr, value TSRMLS_CC);
} else if ((opline+1)->op1_type == IS_CONST) {
- value = zend_assign_const_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_const_to_variable(variable_ptr, value TSRMLS_CC);
} else {
- value = zend_assign_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_to_variable(variable_ptr, value TSRMLS_CC);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(value);
- EX_T(opline->result.var).var.ptr = value;
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
}
}
FREE_OP_VAR_PTR(free_op_data2);
FREE_OP_IF_VAR(free_op_data1);
}
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
/* assign_dim has two opcodes! */
CHECK_EXCEPTION();
ZEND_VM_INC_OPCODE();
@@ -17833,49 +17231,41 @@ static int ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_A
USE_OPLINE
zend_free_op free_op1, free_op2;
zval *value;
- zval **variable_ptr_ptr;
+ zval *variable_ptr;
SAVE_OPLINE();
value = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- variable_ptr_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ variable_ptr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(variable_ptr_ptr == NULL)) {
- if (zend_assign_to_string_offset(&EX_T(opline->op1.var), value, IS_TMP_VAR TSRMLS_CC)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(variable_ptr) == IS_STR_OFFSET)) {
+ if (zend_assign_to_string_offset(EX_VAR(opline->op1.var), value, IS_TMP_VAR TSRMLS_CC)) {
if (RETURN_VALUE_USED(opline)) {
- zval *retval;
-
- ALLOC_ZVAL(retval);
- ZVAL_STRINGL(retval, Z_STRVAL_P(EX_T(opline->op1.var).str_offset.str)+EX_T(opline->op1.var).str_offset.offset, 1, 1);
- INIT_PZVAL(retval);
- EX_T(opline->result.var).var.ptr = retval;
+ ZVAL_STRINGL(EX_VAR(opline->result.var), Z_STR_OFFSET_P(EX_VAR(opline->op1.var))->str + Z_STR_OFFSET_P(EX_VAR(opline->op1.var))->offset, 1);
}
} else if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
- } else if (IS_VAR == IS_VAR && UNEXPECTED(*variable_ptr_ptr == &EG(error_zval))) {
+ } else if (IS_VAR == IS_VAR && UNEXPECTED(variable_ptr == &EG(error_zval))) {
if (1) {
zval_dtor(value);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
} else {
if (IS_TMP_VAR == IS_TMP_VAR) {
- value = zend_assign_tmp_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_tmp_to_variable(variable_ptr, value TSRMLS_CC);
} else if (IS_TMP_VAR == IS_CONST) {
- value = zend_assign_const_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_const_to_variable(variable_ptr, value TSRMLS_CC);
} else {
- value = zend_assign_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_to_variable(variable_ptr, value TSRMLS_CC);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(value);
- EX_T(opline->result.var).var.ptr = value;
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
}
}
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
/* zend_assign_to_variable() always takes care of op2, never free it! */
@@ -17887,8 +17277,6 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE
{
USE_OPLINE
zval *function_name;
- char *function_name_strval;
- int function_name_strlen;
zend_free_op free_op1, free_op2;
call_slot *call = EX(call_slots) + opline->result.num;
@@ -17904,32 +17292,29 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE
zend_error_noreturn(E_ERROR, "Method name must be a string");
}
- function_name_strval = Z_STRVAL_P(function_name);
- function_name_strlen = Z_STRLEN_P(function_name);
-
- call->object = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ ZVAL_COPY_VALUE(&call->object, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC));
- if (EXPECTED(call->object != NULL) &&
- EXPECTED(Z_TYPE_P(call->object) == IS_OBJECT)) {
- call->called_scope = Z_OBJCE_P(call->object);
+ if (EXPECTED(Z_TYPE(call->object) != IS_UNDEF) &&
+ EXPECTED(Z_TYPE(call->object) == IS_OBJECT)) {
+ call->called_scope = Z_OBJCE(call->object);
if (IS_TMP_VAR != IS_CONST ||
(call->fbc = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope)) == NULL) {
- zval *object = call->object;
+ zend_object *object = Z_OBJ(call->object);
- if (UNEXPECTED(Z_OBJ_HT_P(call->object)->get_method == NULL)) {
+ if (UNEXPECTED(Z_OBJ_HT(call->object)->get_method == NULL)) {
zend_error_noreturn(E_ERROR, "Object does not support method calls");
}
/* First, locate the function. */
- call->fbc = Z_OBJ_HT_P(call->object)->get_method(&call->object, function_name_strval, function_name_strlen, ((IS_TMP_VAR == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
+ call->fbc = Z_OBJ_HT(call->object)->get_method(&call->object, Z_STR_P(function_name), ((IS_TMP_VAR == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
if (UNEXPECTED(call->fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(call->object), function_name_strval);
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(&call->object), Z_STRVAL_P(function_name));
}
if (IS_TMP_VAR == IS_CONST &&
EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0) &&
- EXPECTED(call->object == object)) {
+ EXPECTED(Z_OBJ(call->object) == object)) {
CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope, call->fbc);
}
}
@@ -17938,20 +17323,16 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE
zval_dtor(free_op2.var);
HANDLE_EXCEPTION();
}
- zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval);
+ zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", Z_STRVAL_P(function_name));
}
if ((call->fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) {
- call->object = NULL;
+ ZVAL_UNDEF(&call->object);
} else {
- if (!PZVAL_IS_REF(call->object)) {
- Z_ADDREF_P(call->object); /* For $this pointer */
+ if (!Z_ISREF(call->object)) {
+ Z_ADDREF(call->object); /* For $this pointer */
} else {
- zval *this_ptr;
- ALLOC_ZVAL(this_ptr);
- INIT_PZVAL_COPY(this_ptr, call->object);
- zval_copy_ctor(this_ptr);
- call->object = this_ptr;
+ ZVAL_DUP(&call->object, Z_REFVAL(call->object));
}
}
@@ -17960,7 +17341,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE
EX(call) = call;
zval_dtor(free_op2.var);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -17980,7 +17361,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND
if (CACHED_PTR(opline->op1.literal->cache_slot)) {
ce = CACHED_PTR(opline->op1.literal->cache_slot);
} else {
- ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
@@ -17991,7 +17372,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND
}
call->called_scope = ce;
} else {
- ce = EX_T(opline->op1.var).class_entry;
+ ce = Z_CE_P(EX_VAR(opline->op1.var));
if (opline->extended_value == ZEND_FETCH_CLASS_PARENT || opline->extended_value == ZEND_FETCH_CLASS_SELF) {
call->called_scope = EG(called_scope);
@@ -18009,44 +17390,33 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND
(call->fbc = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce))) {
/* do nothing */
} else if (IS_TMP_VAR != IS_UNUSED) {
- char *function_name_strval = NULL;
- int function_name_strlen = 0;
zend_free_op free_op2;
- if (IS_TMP_VAR == IS_CONST) {
- function_name_strval = Z_STRVAL_P(opline->op2.zv);
- function_name_strlen = Z_STRLEN_P(opline->op2.zv);
- } else {
- function_name = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
-
+ function_name = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
+ if (IS_TMP_VAR != IS_CONST) {
if (UNEXPECTED(Z_TYPE_P(function_name) != IS_STRING)) {
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
zend_error_noreturn(E_ERROR, "Function name must be a string");
- } else {
- function_name_strval = Z_STRVAL_P(function_name);
- function_name_strlen = Z_STRLEN_P(function_name);
}
}
- if (function_name_strval) {
- if (ce->get_static_method) {
- call->fbc = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
+ if (ce->get_static_method) {
+ call->fbc = ce->get_static_method(ce, Z_STR_P(function_name) TSRMLS_CC);
+ } else {
+ call->fbc = zend_std_get_static_method(ce, Z_STR_P(function_name), ((IS_TMP_VAR == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
+ }
+ if (UNEXPECTED(call->fbc == NULL)) {
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", ce->name->val, Z_STRVAL_P(function_name));
+ }
+ if (IS_TMP_VAR == IS_CONST &&
+ EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
+ EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0)) {
+ if (IS_VAR == IS_CONST) {
+ CACHE_PTR(opline->op2.literal->cache_slot, call->fbc);
} else {
- call->fbc = zend_std_get_static_method(ce, function_name_strval, function_name_strlen, ((IS_TMP_VAR == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
- }
- if (UNEXPECTED(call->fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", ce->name, function_name_strval);
- }
- if (IS_TMP_VAR == IS_CONST &&
- EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
- EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0)) {
- if (IS_VAR == IS_CONST) {
- CACHE_PTR(opline->op2.literal->cache_slot, call->fbc);
- } else {
- CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce, call->fbc);
- }
+ CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce, call->fbc);
}
}
if (IS_TMP_VAR != IS_CONST) {
@@ -18056,31 +17426,28 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND
if (UNEXPECTED(ce->constructor == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot call constructor");
}
- if (EG(This) && Z_OBJCE_P(EG(This)) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
- zend_error_noreturn(E_ERROR, "Cannot call private %s::__construct()", ce->name);
+ if (Z_TYPE(EG(This)) != IS_UNDEF && Z_OBJCE(EG(This)) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
+ zend_error_noreturn(E_ERROR, "Cannot call private %s::__construct()", ce->name->val);
}
call->fbc = ce->constructor;
}
if (call->fbc->common.fn_flags & ZEND_ACC_STATIC) {
- call->object = NULL;
+ ZVAL_UNDEF(&call->object);
} else {
- if (EG(This) &&
- Z_OBJ_HT_P(EG(This))->get_class_entry &&
- !instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) {
+ if (Z_TYPE(EG(This)) != IS_UNDEF &&
+ Z_OBJ_HT(EG(This))->get_class_entry &&
+ !instanceof_function(Z_OBJCE(EG(This)), ce TSRMLS_CC)) {
/* We are calling method of the other (incompatible) class,
but passing $this. This is done for compatibility with php-4. */
if (call->fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
- zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name);
+ zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name->val, call->fbc->common.function_name->val);
} else {
/* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */
- zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name);
+ zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", call->fbc->common.scope->name->val, call->fbc->common.function_name->val);
}
}
- if ((call->object = EG(This))) {
- Z_ADDREF_P(call->object);
- call->called_scope = Z_OBJCE_P(call->object);
- }
+ ZVAL_COPY(&call->object, &EG(This));
}
call->num_additional_args = 0;
@@ -18097,7 +17464,7 @@ static int ZEND_FASTCALL ZEND_CASE_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- is_equal_function(&EX_T(opline->result.var).tmp_var,
+ is_equal_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
@@ -18114,30 +17481,25 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_TMP_HANDLER(ZEND_OPCOD
SAVE_OPLINE();
if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) && opline->extended_value) {
- zval **expr_ptr_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
-
- if (IS_VAR == IS_VAR && UNEXPECTED(expr_ptr_ptr == NULL)) {
+ expr_ptr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets");
}
- SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr_ptr);
- expr_ptr = *expr_ptr_ptr;
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr);
Z_ADDREF_P(expr_ptr);
} else {
expr_ptr=_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (0) { /* temporary variable */
- zval *new_expr;
-
- ALLOC_ZVAL(new_expr);
- INIT_PZVAL_COPY(new_expr, expr_ptr);
- expr_ptr = new_expr;
- } else if (IS_VAR == IS_CONST || PZVAL_IS_REF(expr_ptr)) {
- zval *new_expr;
-
- ALLOC_ZVAL(new_expr);
- INIT_PZVAL_COPY(new_expr, expr_ptr);
- expr_ptr = new_expr;
- zendi_zval_copy_ctor(*expr_ptr);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval new_expr;
+
+ ZVAL_COPY_VALUE(&new_expr, expr_ptr);
+ expr_ptr = &new_expr;
+ } else if (IS_VAR == IS_CONST || Z_ISREF_P(expr_ptr)) {
+ zval new_expr;
+
+ ZVAL_DUP(&new_expr, expr_ptr);
+ expr_ptr = &new_expr;
+ zval_ptr_dtor_nogc(free_op1.var);
} else if (IS_VAR == IS_CV) {
Z_ADDREF_P(expr_ptr);
}
@@ -18156,32 +17518,29 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_TMP_HANDLER(ZEND_OPCOD
case IS_BOOL:
hval = Z_LVAL_P(offset);
num_index:
- zend_hash_index_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), hval, &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr);
break;
case IS_STRING:
- if (IS_TMP_VAR == IS_CONST) {
- hval = Z_HASH_P(offset);
- } else {
+ if (IS_TMP_VAR != IS_CONST) {
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index);
- hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset));
}
- zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), Z_STR_P(offset), expr_ptr);
break;
case IS_NULL:
- zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), STR_EMPTY_ALLOC(), expr_ptr);
break;
default:
zend_error(E_WARNING, "Illegal offset type");
- zval_ptr_dtor(&expr_ptr);
+ zval_ptr_dtor(expr_ptr);
/* do nothing */
break;
}
zval_dtor(free_op2.var);
} else {
- zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr);
}
if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) && opline->extended_value) {
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
}
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -18191,7 +17550,7 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDL
{
USE_OPLINE
- array_init(&EX_T(opline->result.var).tmp_var);
+ array_init(EX_VAR(opline->result.var));
if (IS_VAR == IS_UNUSED) {
ZEND_VM_NEXT_OPCODE();
#if 0 || IS_VAR != IS_UNUSED
@@ -18205,21 +17564,21 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLE
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval **container;
+ zval *container;
zval *offset;
ulong hval;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_CV && container != &EG(uninitialized_zval_ptr)) {
+ container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ if (IS_VAR == IS_CV) {
SEPARATE_ZVAL_IF_NOT_REF(container);
}
offset = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
if (IS_VAR != IS_VAR || container) {
- switch (Z_TYPE_PP(container)) {
+ switch (Z_TYPE_P(container)) {
case IS_ARRAY: {
- HashTable *ht = Z_ARRVAL_PP(container);
+ HashTable *ht = Z_ARRVAL_P(container);
switch (Z_TYPE_P(offset)) {
case IS_DOUBLE:
@@ -18236,29 +17595,26 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLE
if (IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) {
Z_ADDREF_P(offset);
}
- if (IS_TMP_VAR == IS_CONST) {
- hval = Z_HASH_P(offset);
- } else {
+ if (IS_TMP_VAR != IS_CONST) {
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim);
- hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset));
}
- if (ht == &EG(symbol_table)) {
- zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC);
+ if (ht == &EG(symbol_table).ht) {
+ zend_delete_global_variable(Z_STR_P(offset) TSRMLS_CC);
} else {
- zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval);
+ zend_hash_del(ht, Z_STR_P(offset));
}
if (IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
}
break;
num_index_dim:
zend_hash_index_del(ht, hval);
if (IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
}
break;
case IS_NULL:
- zend_hash_del(ht, "", sizeof(""));
+ zend_hash_del(ht, STR_EMPTY_ALLOC());
break;
default:
zend_error(E_WARNING, "Illegal offset type in unset");
@@ -18268,15 +17624,15 @@ num_index_dim:
break;
}
case IS_OBJECT:
- if (UNEXPECTED(Z_OBJ_HT_P(*container)->unset_dimension == NULL)) {
+ if (UNEXPECTED(Z_OBJ_HT_P(container)->unset_dimension == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use object as array");
}
if (1) {
MAKE_REAL_ZVAL_PTR(offset);
}
- Z_OBJ_HT_P(*container)->unset_dimension(*container, offset TSRMLS_CC);
+ Z_OBJ_HT_P(container)->unset_dimension(container, offset TSRMLS_CC);
if (1) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
zval_dtor(free_op2.var);
}
@@ -18291,7 +17647,7 @@ num_index_dim:
} else {
zval_dtor(free_op2.var);
}
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -18301,28 +17657,28 @@ static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLE
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval **container;
+ zval *container;
zval *offset;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
offset = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
if (IS_VAR != IS_VAR || container) {
- if (IS_VAR == IS_CV && container != &EG(uninitialized_zval_ptr)) {
+ if (IS_VAR == IS_CV) {
SEPARATE_ZVAL_IF_NOT_REF(container);
}
- if (Z_TYPE_PP(container) == IS_OBJECT) {
+ if (Z_TYPE_P(container) == IS_OBJECT) {
if (1) {
MAKE_REAL_ZVAL_PTR(offset);
}
- if (Z_OBJ_HT_P(*container)->unset_property) {
- Z_OBJ_HT_P(*container)->unset_property(*container, offset, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ if (Z_OBJ_HT_P(container)->unset_property) {
+ Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to unset property of non-object");
}
if (1) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
zval_dtor(free_op2.var);
}
@@ -18332,7 +17688,7 @@ static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLE
} else {
zval_dtor(free_op2.var);
}
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -18343,7 +17699,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_TMP(in
USE_OPLINE
zend_free_op free_op1, free_op2;
zval *container;
- zval **value = NULL;
+ zval *value;
int result = 0;
ulong hval;
zval *offset;
@@ -18367,23 +17723,20 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_TMP(in
case IS_LONG:
hval = Z_LVAL_P(offset);
num_index_prop:
- if (zend_hash_index_find(ht, hval, (void **) &value) == SUCCESS) {
+ if ((value = zend_hash_index_find(ht, hval)) != NULL) {
isset = 1;
}
break;
case IS_STRING:
- if (IS_TMP_VAR == IS_CONST) {
- hval = Z_HASH_P(offset);
- } else {
+ if (IS_TMP_VAR != IS_CONST) {
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop);
- hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset));
}
- if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) {
+ if ((value = zend_hash_find(ht, Z_STR_P(offset))) != NULL) {
isset = 1;
}
break;
case IS_NULL:
- if (zend_hash_find(ht, "", sizeof(""), (void **) &value) == SUCCESS) {
+ if ((value = zend_hash_find(ht, STR_EMPTY_ALLOC())) != NULL) {
isset = 1;
}
break;
@@ -18393,13 +17746,13 @@ num_index_prop:
}
if (opline->extended_value & ZEND_ISSET) {
- if (isset && Z_TYPE_PP(value) == IS_NULL) {
+ if (isset && Z_TYPE_P(value) == IS_NULL) {
result = 0;
} else {
result = isset;
}
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (!isset || !i_zend_is_true(*value TSRMLS_CC)) {
+ if (!isset || !i_zend_is_true(value TSRMLS_CC)) {
result = 0;
} else {
result = 1;
@@ -18426,7 +17779,7 @@ num_index_prop:
}
}
if (1) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
zval_dtor(free_op2.var);
}
@@ -18437,8 +17790,7 @@ num_index_prop:
if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */
|| (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
&& IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) {
- ZVAL_COPY_VALUE(&tmp, offset);
- zval_copy_ctor(&tmp);
+ ZVAL_DUP(&tmp, offset);
convert_to_long(&tmp);
offset = &tmp;
} else {
@@ -18462,14 +17814,13 @@ num_index_prop:
zval_dtor(free_op2.var);
}
- Z_TYPE(EX_T(opline->result.var).tmp_var) = IS_BOOL;
if (opline->extended_value & ZEND_ISSET) {
- Z_LVAL(EX_T(opline->result.var).tmp_var) = result;
+ ZVAL_BOOL(EX_VAR(opline->result.var), result);
} else {
- Z_LVAL(EX_T(opline->result.var).tmp_var) = !result;
+ ZVAL_BOOL(EX_VAR(opline->result.var), !result);
}
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -18487,6 +17838,9 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_VAR_TMP_HANDLER(ZEND_
static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
+//???
+return 0;
+#if 0
USE_OPLINE
/* The generator object is stored in return_value_ptr_ptr */
@@ -18529,7 +17883,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR
generator->value = copy;
} else {
- zval **value_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ zval **value_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W);
if (IS_VAR == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
@@ -18551,14 +17905,14 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR
generator->value = *value_ptr;
}
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
}
} else {
zval *value = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
/* Consts, temporary variables and references need copying */
if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR
- || PZVAL_IS_REF(value)
+ || Z_ISREF_P(value)
) {
zval *copy;
@@ -18571,7 +17925,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR
}
generator->value = copy;
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
} else {
if (IS_VAR == IS_CV) {
Z_ADDREF_P(value);
@@ -18592,7 +17946,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR
/* Consts, temporary variables and references need copying */
if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR
- || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0)
+ || (Z_ISREF_P(key) && Z_REFCOUNT_P(key) > 0)
) {
zval *copy;
@@ -18643,6 +17997,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR
SAVE_OPLINE();
ZEND_VM_RETURN();
+#endif
}
static int ZEND_FASTCALL ZEND_ADD_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -18651,11 +18006,11 @@ static int ZEND_FASTCALL ZEND_ADD_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- fast_add_function(&EX_T(opline->result.var).tmp_var,
+ fast_add_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op1.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -18666,11 +18021,11 @@ static int ZEND_FASTCALL ZEND_SUB_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- fast_sub_function(&EX_T(opline->result.var).tmp_var,
+ fast_sub_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op1.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -18681,11 +18036,11 @@ static int ZEND_FASTCALL ZEND_MUL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- fast_mul_function(&EX_T(opline->result.var).tmp_var,
+ fast_mul_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op1.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -18696,11 +18051,11 @@ static int ZEND_FASTCALL ZEND_DIV_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- fast_div_function(&EX_T(opline->result.var).tmp_var,
+ fast_div_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op1.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -18711,11 +18066,11 @@ static int ZEND_FASTCALL ZEND_MOD_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- fast_mod_function(&EX_T(opline->result.var).tmp_var,
+ fast_mod_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op1.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -18726,11 +18081,11 @@ static int ZEND_FASTCALL ZEND_SL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- shift_left_function(&EX_T(opline->result.var).tmp_var,
+ shift_left_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op1.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -18741,11 +18096,11 @@ static int ZEND_FASTCALL ZEND_SR_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- shift_right_function(&EX_T(opline->result.var).tmp_var,
+ shift_right_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op1.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -18756,11 +18111,11 @@ static int ZEND_FASTCALL ZEND_CONCAT_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_A
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- concat_function(&EX_T(opline->result.var).tmp_var,
+ concat_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op1.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -18771,11 +18126,11 @@ static int ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HAN
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- is_identical_function(&EX_T(opline->result.var).tmp_var,
+ is_identical_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op1.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -18784,15 +18139,15 @@ static int ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
is_identical_function(result,
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
Z_LVAL_P(result) = !Z_LVAL_P(result);
- zval_ptr_dtor_nogc(&free_op1.var);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op1.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -18801,14 +18156,14 @@ static int ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_equal_function(result,
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC));
- zval_ptr_dtor_nogc(&free_op1.var);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op1.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -18817,14 +18172,14 @@ static int ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HAN
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_not_equal_function(result,
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC));
- zval_ptr_dtor_nogc(&free_op1.var);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op1.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -18833,14 +18188,14 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDL
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_is_smaller_function(result,
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC));
- zval_ptr_dtor_nogc(&free_op1.var);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op1.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -18849,14 +18204,14 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_VAR_VAR_HANDLER(ZEND_OPC
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_is_smaller_or_equal_function(result,
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC));
- zval_ptr_dtor_nogc(&free_op1.var);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op1.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -18867,11 +18222,11 @@ static int ZEND_FASTCALL ZEND_BW_OR_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- bitwise_or_function(&EX_T(opline->result.var).tmp_var,
+ bitwise_or_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op1.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -18882,11 +18237,11 @@ static int ZEND_FASTCALL ZEND_BW_AND_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_A
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- bitwise_and_function(&EX_T(opline->result.var).tmp_var,
+ bitwise_and_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op1.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -18897,11 +18252,11 @@ static int ZEND_FASTCALL ZEND_BW_XOR_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_A
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- bitwise_xor_function(&EX_T(opline->result.var).tmp_var,
+ bitwise_xor_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op1.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -18912,11 +18267,11 @@ static int ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- boolean_xor_function(&EX_T(opline->result.var).tmp_var,
+ boolean_xor_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op1.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -18925,27 +18280,24 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_VAR(int (*bin
{
USE_OPLINE
zend_free_op free_op1, free_op2, free_op_data1;
- zval **object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- zval *object;
+ zval *object = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
zval *property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
zval *value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
int have_get_ptr = 0;
- if (IS_VAR == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- make_real_object(object_ptr TSRMLS_CC);
- object = *object_ptr;
+ make_real_object(object TSRMLS_CC);
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to assign property of non-object");
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
FREE_OP(free_op_data1);
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
} else {
/* here we are sure we are dealing with an object */
@@ -18956,15 +18308,14 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_VAR(int (*bin
/* here property is a string */
if (opline->extended_value == ZEND_ASSIGN_OBJ
&& Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval **zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
have_get_ptr = 1;
- binary_op(*zptr, *zptr, value TSRMLS_CC);
+ binary_op(zptr, zptr, value TSRMLS_CC);
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(*zptr);
- EX_T(opline->result.var).var.ptr = *zptr;
+ ZVAL_COPY(EX_VAR(opline->result.var), zptr);
}
}
}
@@ -18988,12 +18339,11 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_VAR(int (*bin
if (Z_REFCOUNT_P(z) == 0) {
GC_REMOVE_ZVAL_FROM_BUFFER(z);
zval_dtor(z);
- FREE_ZVAL(z);
}
z = value;
}
Z_ADDREF_P(z);
- SEPARATE_ZVAL_IF_NOT_REF(&z);
+ SEPARATE_ZVAL_IF_NOT_REF(z);
binary_op(z, z, value TSRMLS_CC);
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
@@ -19001,28 +18351,26 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_VAR(int (*bin
Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(z);
- EX_T(opline->result.var).var.ptr = z;
+ ZVAL_COPY(EX_VAR(opline->result.var), z);
}
- zval_ptr_dtor(&z);
+ zval_ptr_dtor(z);
} else {
zend_error(E_WARNING, "Attempt to assign property of non-object");
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
}
}
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
}
FREE_OP(free_op_data1);
}
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
/* assign_obj has two opcodes! */
CHECK_EXCEPTION();
ZEND_VM_INC_OPCODE();
@@ -19033,7 +18381,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_VAR_VAR(int (*binary_
{
USE_OPLINE
zend_free_op free_op1, free_op2, free_op_data2, free_op_data1;
- zval **var_ptr;
+ zval *var_ptr;
zval *value;
SAVE_OPLINE();
@@ -19042,42 +18390,41 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_VAR_VAR(int (*binary_
return zend_binary_assign_op_obj_helper_SPEC_VAR_VAR(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
break;
case ZEND_ASSIGN_DIM: {
- zval **container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ zval *container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- } else if (UNEXPECTED(Z_TYPE_PP(container) == IS_OBJECT)) {
+ } else if (UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
if (IS_VAR == IS_VAR && !(free_op1.var != NULL)) {
- Z_ADDREF_PP(container); /* undo the effect of get_obj_zval_ptr_ptr() */
+ Z_ADDREF_P(container); /* undo the effect of get_obj_zval_ptr_ptr() */
}
return zend_binary_assign_op_obj_helper_SPEC_VAR_VAR(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
} else {
zval *dim = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- zend_fetch_dimension_address(&EX_T((opline+1)->op2.var), container, dim, IS_VAR, BP_VAR_RW TSRMLS_CC);
+ zend_fetch_dimension_address(EX_VAR((opline+1)->op2.var), container, dim, IS_VAR, BP_VAR_RW TSRMLS_CC);
value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
- var_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
+ var_ptr = _get_zval_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
}
}
break;
default:
value = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- var_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ var_ptr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
/* do nothing */
break;
}
- if (UNEXPECTED(var_ptr == NULL)) {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
}
- if (UNEXPECTED(*var_ptr == &EG(error_zval))) {
+ if (UNEXPECTED(var_ptr == &EG(error_zval))) {
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
- zval_ptr_dtor_nogc(&free_op2.var);
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ zval_ptr_dtor_nogc(free_op2.var);
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
if (opline->extended_value == ZEND_ASSIGN_DIM) {
ZEND_VM_INC_OPCODE();
@@ -19087,33 +18434,32 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_VAR_VAR(int (*binary_
SEPARATE_ZVAL_IF_NOT_REF(var_ptr);
- if (UNEXPECTED(Z_TYPE_PP(var_ptr) == IS_OBJECT)
- && Z_OBJ_HANDLER_PP(var_ptr, get)
- && Z_OBJ_HANDLER_PP(var_ptr, set)) {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_OBJECT)
+ && Z_OBJ_HANDLER_P(var_ptr, get)
+ && Z_OBJ_HANDLER_P(var_ptr, set)) {
/* proxy object */
- zval *objval = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC);
+ zval *objval = Z_OBJ_HANDLER_P(var_ptr, get)(var_ptr TSRMLS_CC);
Z_ADDREF_P(objval);
binary_op(objval, objval, value TSRMLS_CC);
- Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, objval TSRMLS_CC);
- zval_ptr_dtor(&objval);
+ Z_OBJ_HANDLER_P(var_ptr, set)(var_ptr, objval TSRMLS_CC);
+ zval_ptr_dtor(objval);
} else {
- binary_op(*var_ptr, *var_ptr, value TSRMLS_CC);
+ binary_op(var_ptr, var_ptr, value TSRMLS_CC);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(*var_ptr);
- EX_T(opline->result.var).var.ptr = *var_ptr;
+ ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
if (opline->extended_value == ZEND_ASSIGN_DIM) {
FREE_OP(free_op_data1);
FREE_OP_VAR_PTR(free_op_data2);
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_INC_OPCODE();
} else {
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
}
ZEND_VM_NEXT_OPCODE();
@@ -19178,32 +18524,29 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_VAR(incdec_t i
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval **object_ptr;
zval *object;
zval *property;
- zval **retval;
+ zval *retval;
int have_get_ptr = 0;
SAVE_OPLINE();
- object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ object = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- retval = &EX_T(opline->result.var).var.ptr;
+ retval = EX_VAR(opline->result.var);
- if (IS_VAR == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
- object = *object_ptr;
+ make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- *retval = &EG(uninitialized_zval);
+ ZVAL_NULL(retval);
}
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -19215,15 +18558,14 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_VAR(incdec_t i
}
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval **zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
have_get_ptr = 1;
- incdec_op(*zptr);
+ incdec_op(zptr);
if (RETURN_VALUE_USED(opline)) {
- *retval = *zptr;
- PZVAL_LOCK(*retval);
+ ZVAL_COPY(retval, zptr);
}
}
}
@@ -19238,32 +18580,30 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_VAR(incdec_t i
if (Z_REFCOUNT_P(z) == 0) {
GC_REMOVE_ZVAL_FROM_BUFFER(z);
zval_dtor(z);
- FREE_ZVAL(z);
}
z = value;
}
Z_ADDREF_P(z);
- SEPARATE_ZVAL_IF_NOT_REF(&z);
+ SEPARATE_ZVAL_IF_NOT_REF(z);
incdec_op(z);
- *retval = z;
+ ZVAL_COPY_VALUE(retval, z);
Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- SELECTIVE_PZVAL_LOCK(*retval, opline);
- zval_ptr_dtor(&z);
+ SELECTIVE_PZVAL_LOCK(retval, opline);
+ zval_ptr_dtor(z);
} else {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- *retval = &EG(uninitialized_zval);
+ ZVAL_NULL(retval);
}
}
}
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
}
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -19282,29 +18622,27 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_VAR(incdec_t
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval **object_ptr;
zval *object;
zval *property;
zval *retval;
int have_get_ptr = 0;
SAVE_OPLINE();
- object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ object = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- retval = &EX_T(opline->result.var).tmp_var;
+ retval = EX_VAR(opline->result.var);
- if (IS_VAR == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
- object = *object_ptr;
+ make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
ZVAL_NULL(retval);
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -19316,15 +18654,14 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_VAR(incdec_t
}
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval **zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
have_get_ptr = 1;
SEPARATE_ZVAL_IF_NOT_REF(zptr);
- ZVAL_COPY_VALUE(retval, *zptr);
- zendi_zval_copy_ctor(*retval);
+ ZVAL_DUP(retval, zptr);
- incdec_op(*zptr);
+ incdec_op(zptr);
}
}
@@ -19332,7 +18669,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_VAR(incdec_t
if (!have_get_ptr) {
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- zval *z_copy;
+ zval z_copy;
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC);
@@ -19340,20 +18677,16 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_VAR(incdec_t
if (Z_REFCOUNT_P(z) == 0) {
GC_REMOVE_ZVAL_FROM_BUFFER(z);
zval_dtor(z);
- FREE_ZVAL(z);
}
z = value;
}
- ZVAL_COPY_VALUE(retval, z);
- zendi_zval_copy_ctor(*retval);
- ALLOC_ZVAL(z_copy);
- INIT_PZVAL_COPY(z_copy, z);
- zendi_zval_copy_ctor(*z_copy);
- incdec_op(z_copy);
+ ZVAL_DUP(retval, z);
+ ZVAL_DUP(&z_copy, z);
+ incdec_op(&z_copy);
Z_ADDREF_P(z);
- Z_OBJ_HT_P(object)->write_property(object, property, z_copy, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(object)->write_property(object, property, &z_copy, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval_ptr_dtor(&z_copy);
- zval_ptr_dtor(&z);
+ zval_ptr_dtor(z);
} else {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
ZVAL_NULL(retval);
@@ -19361,11 +18694,11 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_VAR(incdec_t
}
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
}
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -19385,19 +18718,17 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_VAR(int type, ZE
USE_OPLINE
zend_free_op free_op1;
zval *varname;
- zval **retval;
+ zval *retval;
zval tmp_varname;
HashTable *target_symbol_table;
- ulong hash_value;
SAVE_OPLINE();
varname = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (IS_VAR != IS_CONST && UNEXPECTED(Z_TYPE_P(varname) != IS_STRING)) {
- ZVAL_COPY_VALUE(&tmp_varname, varname);
- zval_copy_ctor(&tmp_varname);
- Z_SET_REFCOUNT(tmp_varname, 1);
- Z_UNSET_ISREF(tmp_varname);
+ ZVAL_DUP(&tmp_varname, varname);
+//??? Z_SET_REFCOUNT(tmp_varname, 1);
+//??? Z_UNSET_ISREF(tmp_varname);
convert_to_string(&tmp_varname);
varname = &tmp_varname;
}
@@ -19409,22 +18740,22 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_VAR(int type, ZE
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
ce = CACHED_PTR(opline->op2.literal->cache_slot);
} else {
- ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
if (IS_VAR != IS_CONST && varname == &tmp_varname) {
zval_dtor(&tmp_varname);
}
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
CACHE_PTR(opline->op2.literal->cache_slot, ce);
}
} else {
- ce = EX_T(opline->op2.var).class_entry;
+ ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0, ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
+ retval = zend_std_get_static_property(ce, Z_STR_P(varname), 0, ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ zval_ptr_dtor_nogc(free_op1.var);
} else {
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
/*
@@ -19433,27 +18764,21 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_VAR(int type, ZE
ZEND_VM_NEXT_OPCODE();
}
*/
- if (IS_VAR == IS_CONST) {
- hash_value = Z_HASH_P(varname);
- } else {
- hash_value = str_hash(Z_STRVAL_P(varname), Z_STRLEN_P(varname));
- }
-
- if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) {
+ if ((retval = zend_hash_find(target_symbol_table, Z_STR_P(varname))) == NULL) {
switch (type) {
case BP_VAR_R:
case BP_VAR_UNSET:
zend_error(E_NOTICE,"Undefined variable: %s", Z_STRVAL_P(varname));
/* break missing intentionally */
case BP_VAR_IS:
- retval = &EG(uninitialized_zval_ptr);
+ ZVAL_NULL(retval);
break;
case BP_VAR_RW:
zend_error(E_NOTICE,"Undefined variable: %s", Z_STRVAL_P(varname));
/* break missing intentionally */
case BP_VAR_W:
Z_ADDREF_P(&EG(uninitialized_zval));
- zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval);
+ retval = zend_hash_update(target_symbol_table, Z_STR_P(varname), &EG(uninitialized_zval));
break;
EMPTY_SWITCH_DEFAULT_CASE()
}
@@ -19461,18 +18786,18 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_VAR(int type, ZE
switch (opline->extended_value & ZEND_FETCH_TYPE_MASK) {
case ZEND_FETCH_GLOBAL:
if (IS_VAR != IS_TMP_VAR) {
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
}
break;
case ZEND_FETCH_LOCAL:
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
break;
case ZEND_FETCH_STATIC:
zval_update_constant(retval, (void*) 1 TSRMLS_CC);
break;
case ZEND_FETCH_GLOBAL_LOCK:
if (IS_VAR == IS_VAR && !free_op1.var) {
- PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
+ Z_ADDREF_P(EX_VAR(opline->op1.var));
}
break;
}
@@ -19485,27 +18810,26 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_VAR(int type, ZE
if (opline->extended_value & ZEND_FETCH_MAKE_REF) {
SEPARATE_ZVAL_TO_MAKE_IS_REF(retval);
}
- PZVAL_LOCK(*retval);
- switch (type) {
- case BP_VAR_R:
- case BP_VAR_IS:
- EX_T(opline->result.var).var.ptr = *retval;
- break;
- case BP_VAR_UNSET: {
- zend_free_op free_res;
-
- PZVAL_UNLOCK(*retval, &free_res);
- if (retval != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(retval);
- }
- PZVAL_LOCK(*retval);
- FREE_OP_VAR_PTR(free_res);
- }
- /* break missing intentionally */
- default:
- EX_T(opline->result.var).var.ptr_ptr = retval;
- break;
- }
+ ZVAL_COPY(EX_VAR(opline->result.var), retval);
+//??? switch (type) {
+//??? case BP_VAR_R:
+//??? case BP_VAR_IS:
+//??? break;
+//??? case BP_VAR_UNSET: {
+//??? zend_free_op free_res;
+//???
+//??? PZVAL_UNLOCK(*retval, &free_res);
+//??? if (retval != &EG(uninitialized_zval_ptr)) {
+//??? SEPARATE_ZVAL_IF_NOT_REF(retval);
+//??? }
+//??? PZVAL_LOCK(*retval);
+//??? FREE_OP_VAR_PTR(free_res);
+//??? }
+//??? /* break missing intentionally */
+//??? default:
+//??? EX_T(opline->result.var).var.ptr_ptr = retval;
+//??? break;
+//??? }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -19550,10 +18874,10 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HAND
SAVE_OPLINE();
container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zend_fetch_dimension_address_read(EX_VAR(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC);
+ zval_ptr_dtor_nogc(free_op2.var);
if (IS_VAR != IS_VAR || !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
}
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -19563,30 +18887,28 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HAND
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval **container;
+ zval *container;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_fetch_dimension_address(&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_W TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op2.var);
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ zend_fetch_dimension_address(EX_VAR(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_W TSRMLS_CC);
+ zval_ptr_dtor_nogc(free_op2.var);
+//??? if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
+//??? }
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
/* We are going to assign the result by reference */
if (UNEXPECTED(opline->extended_value != 0)) {
- zval **retval_ptr = EX_T(opline->result.var).var.ptr_ptr;
+ zval *retval_ptr = EX_VAR(opline->result.var);
- if (retval_ptr) {
- Z_DELREF_PP(retval_ptr);
- SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
- Z_ADDREF_PP(retval_ptr);
- }
+ Z_DELREF_P(retval_ptr);
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
+ Z_ADDREF_P(retval_ptr);
}
CHECK_EXCEPTION();
@@ -19597,20 +18919,20 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HAN
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval **container;
+ zval *container;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_fetch_dimension_address(&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_RW TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op2.var);
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ zend_fetch_dimension_address(EX_VAR(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_RW TSRMLS_CC);
+ zval_ptr_dtor_nogc(free_op2.var);
+//??? if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -19623,9 +18945,9 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HAN
SAVE_OPLINE();
container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_IS TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op2.var);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zend_fetch_dimension_address_read(EX_VAR(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_IS TSRMLS_CC);
+ zval_ptr_dtor_nogc(free_op2.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -19633,31 +18955,30 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HAN
static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
+ zval *container;
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
if (zend_is_by_ref_func_arg_fetch(opline, EX(call) TSRMLS_CC)) {
- zval **container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_fetch_dimension_address(&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_W TSRMLS_CC);
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
- zval_ptr_dtor_nogc(&free_op2.var);
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ zend_fetch_dimension_address(EX_VAR(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_W TSRMLS_CC);
+//??? if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
+ zval_ptr_dtor_nogc(free_op2.var);
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
} else {
- zval *container;
-
if (IS_VAR == IS_UNUSED) {
zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
}
container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op2.var);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zend_fetch_dimension_address_read(EX_VAR(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC);
+ zval_ptr_dtor_nogc(free_op2.var);
+ zval_ptr_dtor_nogc(free_op1.var);
}
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -19667,37 +18988,33 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval **container;
+ zval *container;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (IS_VAR == IS_CV) {
- if (container != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(container);
- }
+ SEPARATE_ZVAL_IF_NOT_REF(container);
}
- if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_fetch_dimension_address(&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_UNSET TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op2.var);
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
- if (UNEXPECTED(EX_T(opline->result.var).var.ptr_ptr == NULL)) {
+ zend_fetch_dimension_address(EX_VAR(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_UNSET TSRMLS_CC);
+ zval_ptr_dtor_nogc(free_op2.var);
+//??? if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
+ if (UNEXPECTED(Z_TYPE_P(EX_VAR(opline->result.var)) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
ZEND_VM_NEXT_OPCODE();
} else {
zend_free_op free_res;
- zval **retval_ptr = EX_T(opline->result.var).var.ptr_ptr;
+ zval *retval_ptr = EX_VAR(opline->result.var);
- PZVAL_UNLOCK(*retval_ptr, &free_res);
- if (retval_ptr != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(retval_ptr);
- }
- PZVAL_LOCK(*retval_ptr);
+ PZVAL_UNLOCK(retval_ptr, &free_res);
+ SEPARATE_ZVAL_IF_NOT_REF(retval_ptr);
+ PZVAL_LOCK(retval_ptr);
FREE_OP_VAR_PTR(free_res);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -19719,9 +19036,8 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_VAR_VAR(ZE
if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
zend_error(E_NOTICE, "Trying to get property of non-object");
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
- zval_ptr_dtor_nogc(&free_op2.var);
+ ZVAL_NULL(EX_VAR(opline->result.var));
+ zval_ptr_dtor_nogc(free_op2.var);
} else {
zval *retval;
@@ -19732,17 +19048,16 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_VAR_VAR(ZE
/* here we are sure we are dealing with an object */
retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_R, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- PZVAL_LOCK(retval);
- EX_T(opline->result.var).var.ptr = retval;
+ ZVAL_COPY(EX_VAR(opline->result.var), retval);
if (0) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
}
}
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -19757,7 +19072,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HAND
USE_OPLINE
zend_free_op free_op1, free_op2;
zval *property;
- zval **container;
+ zval *container;
SAVE_OPLINE();
property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
@@ -19765,31 +19080,31 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HAND
if (0) {
MAKE_REAL_ZVAL_PTR(property);
}
- container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
+ container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(&EX_T(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
- zval_ptr_dtor_nogc(&free_op2.var);
- }
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+ zval_ptr_dtor_nogc(free_op2.var);
}
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+//??? if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
/* We are going to assign the result by reference */
if (opline->extended_value & ZEND_FETCH_MAKE_REF) {
- zval **retval_ptr = EX_T(opline->result.var).var.ptr_ptr;
+ zval *retval_ptr = EX_VAR(opline->result.var);
- Z_DELREF_PP(retval_ptr);
+ Z_DELREF_P(retval_ptr);
SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
- Z_ADDREF_PP(retval_ptr);
- EX_T(opline->result.var).var.ptr = *EX_T(opline->result.var).var.ptr_ptr;
- EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
+ Z_ADDREF_P(retval_ptr);
+//??? EX_T(opline->result.var).var.ptr = *EX_T(opline->result.var).var.ptr_ptr;
+//??? EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
}
CHECK_EXCEPTION();
@@ -19801,28 +19116,28 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HAN
USE_OPLINE
zend_free_op free_op1, free_op2;
zval *property;
- zval **container;
+ zval *container;
SAVE_OPLINE();
property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (0) {
MAKE_REAL_ZVAL_PTR(property);
}
- if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(&EX_T(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_RW TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_RW TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
}
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+//??? if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -19841,9 +19156,8 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HAN
if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
- zval_ptr_dtor_nogc(&free_op2.var);
+ ZVAL_NULL(EX_VAR(opline->result.var));
+ zval_ptr_dtor_nogc(free_op2.var);
} else {
zval *retval;
@@ -19854,17 +19168,16 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HAN
/* here we are sure we are dealing with an object */
retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_IS, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- PZVAL_LOCK(retval);
- EX_T(opline->result.var).var.ptr = retval;
+ ZVAL_COPY(EX_VAR(opline->result.var), retval);
if (0) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
}
}
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -19872,33 +19185,33 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HAN
static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
+ zval *container;
if (zend_is_by_ref_func_arg_fetch(opline, EX(call) TSRMLS_CC)) {
/* Behave like FETCH_OBJ_W */
zend_free_op free_op1, free_op2;
zval *property;
- zval **container;
SAVE_OPLINE();
property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (0) {
MAKE_REAL_ZVAL_PTR(property);
}
- if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(&EX_T(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
}
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+//??? if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
} else {
@@ -19910,40 +19223,38 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_
{
USE_OPLINE
zend_free_op free_op1, free_op2, free_res;
- zval **container;
+ zval *container;
zval *property;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
if (IS_VAR == IS_CV) {
- if (container != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(container);
- }
+ SEPARATE_ZVAL_IF_NOT_REF(container);
}
if (0) {
MAKE_REAL_ZVAL_PTR(property);
}
- if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(&EX_T(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_UNSET TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_UNSET TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
}
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+//??? if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
- PZVAL_UNLOCK(*EX_T(opline->result.var).var.ptr_ptr, &free_res);
- if (EX_T(opline->result.var).var.ptr_ptr != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(EX_T(opline->result.var).var.ptr_ptr);
- }
- PZVAL_LOCK(*EX_T(opline->result.var).var.ptr_ptr);
+//??? PZVAL_UNLOCK(EX_VAR(opline->result.var), &free_res);
+//??? if (EX_T(opline->result.var).var.ptr_ptr != &EG(uninitialized_zval_ptr)) {
+//??? SEPARATE_ZVAL_IF_NOT_REF(EX_T(opline->result.var).var.ptr_ptr);
+//??? }
+//??? PZVAL_LOCK(EX_VAR(opline->result.var));
FREE_OP_VAR_PTR(free_res);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -19953,26 +19264,26 @@ static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDL
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval **object_ptr;
+ zval *object;
zval *property_name;
SAVE_OPLINE();
- object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ object = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
property_name = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
if (0) {
MAKE_REAL_ZVAL_PTR(property_name);
}
- if (IS_VAR == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_assign_to_object(RETURN_VALUE_USED(opline)?&EX_T(opline->result.var).var.ptr:NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&property_name);
+ zval_ptr_dtor(property_name);
} else {
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
}
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
/* assign_obj has two opcodes! */
CHECK_EXCEPTION();
ZEND_VM_INC_OPCODE();
@@ -19983,77 +19294,69 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDL
{
USE_OPLINE
zend_free_op free_op1;
- zval **object_ptr;
+ zval *object_ptr;
SAVE_OPLINE();
- object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ object_ptr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(object_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- if (Z_TYPE_PP(object_ptr) == IS_OBJECT) {
+ if (Z_TYPE_P(object_ptr) == IS_OBJECT) {
zend_free_op free_op2;
zval *property_name = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
if (0) {
MAKE_REAL_ZVAL_PTR(property_name);
}
- zend_assign_to_object(RETURN_VALUE_USED(opline)?&EX_T(opline->result.var).var.ptr:NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&property_name);
+ zval_ptr_dtor(property_name);
} else {
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
}
} else {
zend_free_op free_op2, free_op_data1, free_op_data2;
zval *value;
zval *dim = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- zval **variable_ptr_ptr;
+ zval *variable_ptr;
- zend_fetch_dimension_address(&EX_T((opline+1)->op2.var), object_ptr, dim, IS_VAR, BP_VAR_W TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zend_fetch_dimension_address(EX_VAR((opline+1)->op2.var), object_ptr, dim, IS_VAR, BP_VAR_W TSRMLS_CC);
+ zval_ptr_dtor_nogc(free_op2.var);
value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
- variable_ptr_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
- if (UNEXPECTED(variable_ptr_ptr == NULL)) {
- if (zend_assign_to_string_offset(&EX_T((opline+1)->op2.var), value, (opline+1)->op1_type TSRMLS_CC)) {
+ variable_ptr = _get_zval_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
+ if (UNEXPECTED(Z_TYPE_P(variable_ptr) == IS_STR_OFFSET)) {
+ if (zend_assign_to_string_offset(EX_VAR((opline+1)->op2.var), value, (opline+1)->op1_type TSRMLS_CC)) {
if (RETURN_VALUE_USED(opline)) {
- zval *retval;
-
- ALLOC_ZVAL(retval);
- ZVAL_STRINGL(retval, Z_STRVAL_P(EX_T((opline+1)->op2.var).str_offset.str)+EX_T((opline+1)->op2.var).str_offset.offset, 1, 1);
- INIT_PZVAL(retval);
- EX_T(opline->result.var).var.ptr = retval;
+ ZVAL_STRINGL(EX_VAR(opline->result.var), Z_STR_OFFSET_P(EX_VAR((opline+1)->op2.var))->str + Z_STR_OFFSET_P(EX_VAR((opline+1)->op2.var))->offset, 1);
}
} else if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
- } else if (UNEXPECTED(*variable_ptr_ptr == &EG(error_zval))) {
+ } else if (UNEXPECTED(variable_ptr == &EG(error_zval))) {
if (IS_TMP_FREE(free_op_data1)) {
zval_dtor(value);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
} else {
if ((opline+1)->op1_type == IS_TMP_VAR) {
- value = zend_assign_tmp_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_tmp_to_variable(variable_ptr, value TSRMLS_CC);
} else if ((opline+1)->op1_type == IS_CONST) {
- value = zend_assign_const_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_const_to_variable(variable_ptr, value TSRMLS_CC);
} else {
- value = zend_assign_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_to_variable(variable_ptr, value TSRMLS_CC);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(value);
- EX_T(opline->result.var).var.ptr = value;
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
}
}
FREE_OP_VAR_PTR(free_op_data2);
FREE_OP_IF_VAR(free_op_data1);
}
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
/* assign_dim has two opcodes! */
CHECK_EXCEPTION();
ZEND_VM_INC_OPCODE();
@@ -20065,52 +19368,44 @@ static int ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_A
USE_OPLINE
zend_free_op free_op1, free_op2;
zval *value;
- zval **variable_ptr_ptr;
+ zval *variable_ptr;
SAVE_OPLINE();
value = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- variable_ptr_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ variable_ptr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(variable_ptr_ptr == NULL)) {
- if (zend_assign_to_string_offset(&EX_T(opline->op1.var), value, IS_VAR TSRMLS_CC)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(variable_ptr) == IS_STR_OFFSET)) {
+ if (zend_assign_to_string_offset(EX_VAR(opline->op1.var), value, IS_VAR TSRMLS_CC)) {
if (RETURN_VALUE_USED(opline)) {
- zval *retval;
-
- ALLOC_ZVAL(retval);
- ZVAL_STRINGL(retval, Z_STRVAL_P(EX_T(opline->op1.var).str_offset.str)+EX_T(opline->op1.var).str_offset.offset, 1, 1);
- INIT_PZVAL(retval);
- EX_T(opline->result.var).var.ptr = retval;
+ ZVAL_STRINGL(EX_VAR(opline->result.var), Z_STR_OFFSET_P(EX_VAR(opline->op1.var))->str + Z_STR_OFFSET_P(EX_VAR(opline->op1.var))->offset, 1);
}
} else if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
- } else if (IS_VAR == IS_VAR && UNEXPECTED(*variable_ptr_ptr == &EG(error_zval))) {
+ } else if (IS_VAR == IS_VAR && UNEXPECTED(variable_ptr == &EG(error_zval))) {
if (0) {
zval_dtor(value);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
} else {
if (IS_VAR == IS_TMP_VAR) {
- value = zend_assign_tmp_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_tmp_to_variable(variable_ptr, value TSRMLS_CC);
} else if (IS_VAR == IS_CONST) {
- value = zend_assign_const_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_const_to_variable(variable_ptr, value TSRMLS_CC);
} else {
- value = zend_assign_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_to_variable(variable_ptr, value TSRMLS_CC);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(value);
- EX_T(opline->result.var).var.ptr = value;
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
}
}
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
/* zend_assign_to_variable() always takes care of op2, never free it! */
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -20120,51 +19415,50 @@ static int ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDL
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval **variable_ptr_ptr;
- zval **value_ptr_ptr;
+ zval *variable_ptr;
+ zval *value_ptr;
SAVE_OPLINE();
- value_ptr_ptr = _get_zval_ptr_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
+ value_ptr = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
if (IS_VAR == IS_VAR &&
- value_ptr_ptr &&
- !Z_ISREF_PP(value_ptr_ptr) &&
- opline->extended_value == ZEND_RETURNS_FUNCTION &&
- !EX_T(opline->op2.var).var.fcall_returned_reference) {
+ value_ptr &&
+ !Z_ISREF_P(value_ptr) &&
+ opline->extended_value == ZEND_RETURNS_FUNCTION /*???&&
+ !EX_T(opline->op2.var).var.fcall_returned_reference*/) {
if (free_op2.var == NULL) {
- PZVAL_LOCK(*value_ptr_ptr); /* undo the effect of get_zval_ptr_ptr() */
+ PZVAL_LOCK(value_ptr); /* undo the effect of get_zval_ptr_ptr() */
}
zend_error(E_STRICT, "Only variables should be assigned by reference");
if (UNEXPECTED(EG(exception) != NULL)) {
- if (free_op2.var) {zval_ptr_dtor_nogc(&free_op2.var);};
+ if (free_op2.var) {zval_ptr_dtor_nogc(free_op2.var);};
HANDLE_EXCEPTION();
}
return ZEND_ASSIGN_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
} else if (IS_VAR == IS_VAR && opline->extended_value == ZEND_RETURNS_NEW) {
- PZVAL_LOCK(*value_ptr_ptr);
- }
- if (IS_VAR == IS_VAR && UNEXPECTED(EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr)) {
- zend_error_noreturn(E_ERROR, "Cannot assign by reference to overloaded object");
+ PZVAL_LOCK(value_ptr);
}
+//??? if (IS_VAR == IS_VAR && UNEXPECTED(EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr)) {
+//??? zend_error_noreturn(E_ERROR, "Cannot assign by reference to overloaded object");
+//??? }
- variable_ptr_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if ((IS_VAR == IS_VAR && UNEXPECTED(value_ptr_ptr == NULL)) ||
- (IS_VAR == IS_VAR && UNEXPECTED(variable_ptr_ptr == NULL))) {
+ variable_ptr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ if ((IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(value_ptr) == IS_STR_OFFSET)) ||
+ (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(variable_ptr) == IS_STR_OFFSET))) {
zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets nor overloaded objects");
}
- zend_assign_to_variable_reference(variable_ptr_ptr, value_ptr_ptr TSRMLS_CC);
+ zend_assign_to_variable_reference(variable_ptr, value_ptr TSRMLS_CC);
if (IS_VAR == IS_VAR && opline->extended_value == ZEND_RETURNS_NEW) {
- Z_DELREF_PP(variable_ptr_ptr);
+ Z_DELREF_P(variable_ptr);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(*variable_ptr_ptr);
- EX_T(opline->result.var).var.ptr = *variable_ptr_ptr;
+ ZVAL_COPY(EX_VAR(opline->result.var), variable_ptr);
}
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
- if (free_op2.var) {zval_ptr_dtor_nogc(&free_op2.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
+ if (free_op2.var) {zval_ptr_dtor_nogc(free_op2.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -20174,8 +19468,6 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE
{
USE_OPLINE
zval *function_name;
- char *function_name_strval;
- int function_name_strlen;
zend_free_op free_op1, free_op2;
call_slot *call = EX(call_slots) + opline->result.num;
@@ -20191,54 +19483,47 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE
zend_error_noreturn(E_ERROR, "Method name must be a string");
}
- function_name_strval = Z_STRVAL_P(function_name);
- function_name_strlen = Z_STRLEN_P(function_name);
-
- call->object = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ ZVAL_COPY_VALUE(&call->object, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC));
- if (EXPECTED(call->object != NULL) &&
- EXPECTED(Z_TYPE_P(call->object) == IS_OBJECT)) {
- call->called_scope = Z_OBJCE_P(call->object);
+ if (EXPECTED(Z_TYPE(call->object) != IS_UNDEF) &&
+ EXPECTED(Z_TYPE(call->object) == IS_OBJECT)) {
+ call->called_scope = Z_OBJCE(call->object);
if (IS_VAR != IS_CONST ||
(call->fbc = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope)) == NULL) {
- zval *object = call->object;
+ zend_object *object = Z_OBJ(call->object);
- if (UNEXPECTED(Z_OBJ_HT_P(call->object)->get_method == NULL)) {
+ if (UNEXPECTED(Z_OBJ_HT(call->object)->get_method == NULL)) {
zend_error_noreturn(E_ERROR, "Object does not support method calls");
}
/* First, locate the function. */
- call->fbc = Z_OBJ_HT_P(call->object)->get_method(&call->object, function_name_strval, function_name_strlen, ((IS_VAR == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
+ call->fbc = Z_OBJ_HT(call->object)->get_method(&call->object, Z_STR_P(function_name), ((IS_VAR == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
if (UNEXPECTED(call->fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(call->object), function_name_strval);
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(&call->object), Z_STRVAL_P(function_name));
}
if (IS_VAR == IS_CONST &&
EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0) &&
- EXPECTED(call->object == object)) {
+ EXPECTED(Z_OBJ(call->object) == object)) {
CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope, call->fbc);
}
}
} else {
if (UNEXPECTED(EG(exception) != NULL)) {
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
HANDLE_EXCEPTION();
}
- zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval);
+ zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", Z_STRVAL_P(function_name));
}
if ((call->fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) {
- call->object = NULL;
+ ZVAL_UNDEF(&call->object);
} else {
- if (!PZVAL_IS_REF(call->object)) {
- Z_ADDREF_P(call->object); /* For $this pointer */
+ if (!Z_ISREF(call->object)) {
+ Z_ADDREF(call->object); /* For $this pointer */
} else {
- zval *this_ptr;
- ALLOC_ZVAL(this_ptr);
- INIT_PZVAL_COPY(this_ptr, call->object);
- zval_copy_ctor(this_ptr);
- call->object = this_ptr;
+ ZVAL_DUP(&call->object, Z_REFVAL(call->object));
}
}
@@ -20246,8 +19531,8 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE
call->is_ctor_call = 0;
EX(call) = call;
- zval_ptr_dtor_nogc(&free_op2.var);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op2.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -20267,7 +19552,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND
if (CACHED_PTR(opline->op1.literal->cache_slot)) {
ce = CACHED_PTR(opline->op1.literal->cache_slot);
} else {
- ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
@@ -20278,7 +19563,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND
}
call->called_scope = ce;
} else {
- ce = EX_T(opline->op1.var).class_entry;
+ ce = Z_CE_P(EX_VAR(opline->op1.var));
if (opline->extended_value == ZEND_FETCH_CLASS_PARENT || opline->extended_value == ZEND_FETCH_CLASS_SELF) {
call->called_scope = EG(called_scope);
@@ -20296,78 +19581,64 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND
(call->fbc = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce))) {
/* do nothing */
} else if (IS_VAR != IS_UNUSED) {
- char *function_name_strval = NULL;
- int function_name_strlen = 0;
zend_free_op free_op2;
- if (IS_VAR == IS_CONST) {
- function_name_strval = Z_STRVAL_P(opline->op2.zv);
- function_name_strlen = Z_STRLEN_P(opline->op2.zv);
- } else {
- function_name = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
-
+ function_name = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
+ if (IS_VAR != IS_CONST) {
if (UNEXPECTED(Z_TYPE_P(function_name) != IS_STRING)) {
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
zend_error_noreturn(E_ERROR, "Function name must be a string");
- } else {
- function_name_strval = Z_STRVAL_P(function_name);
- function_name_strlen = Z_STRLEN_P(function_name);
}
}
- if (function_name_strval) {
- if (ce->get_static_method) {
- call->fbc = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
+ if (ce->get_static_method) {
+ call->fbc = ce->get_static_method(ce, Z_STR_P(function_name) TSRMLS_CC);
+ } else {
+ call->fbc = zend_std_get_static_method(ce, Z_STR_P(function_name), ((IS_VAR == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
+ }
+ if (UNEXPECTED(call->fbc == NULL)) {
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", ce->name->val, Z_STRVAL_P(function_name));
+ }
+ if (IS_VAR == IS_CONST &&
+ EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
+ EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0)) {
+ if (IS_VAR == IS_CONST) {
+ CACHE_PTR(opline->op2.literal->cache_slot, call->fbc);
} else {
- call->fbc = zend_std_get_static_method(ce, function_name_strval, function_name_strlen, ((IS_VAR == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
- }
- if (UNEXPECTED(call->fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", ce->name, function_name_strval);
- }
- if (IS_VAR == IS_CONST &&
- EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
- EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0)) {
- if (IS_VAR == IS_CONST) {
- CACHE_PTR(opline->op2.literal->cache_slot, call->fbc);
- } else {
- CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce, call->fbc);
- }
+ CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce, call->fbc);
}
}
if (IS_VAR != IS_CONST) {
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
}
} else {
if (UNEXPECTED(ce->constructor == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot call constructor");
}
- if (EG(This) && Z_OBJCE_P(EG(This)) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
- zend_error_noreturn(E_ERROR, "Cannot call private %s::__construct()", ce->name);
+ if (Z_TYPE(EG(This)) != IS_UNDEF && Z_OBJCE(EG(This)) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
+ zend_error_noreturn(E_ERROR, "Cannot call private %s::__construct()", ce->name->val);
}
call->fbc = ce->constructor;
}
if (call->fbc->common.fn_flags & ZEND_ACC_STATIC) {
- call->object = NULL;
+ ZVAL_UNDEF(&call->object);
} else {
- if (EG(This) &&
- Z_OBJ_HT_P(EG(This))->get_class_entry &&
- !instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) {
+ if (Z_TYPE(EG(This)) != IS_UNDEF &&
+ Z_OBJ_HT(EG(This))->get_class_entry &&
+ !instanceof_function(Z_OBJCE(EG(This)), ce TSRMLS_CC)) {
/* We are calling method of the other (incompatible) class,
but passing $this. This is done for compatibility with php-4. */
if (call->fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
- zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name);
+ zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name->val, call->fbc->common.function_name->val);
} else {
/* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */
- zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name);
+ zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", call->fbc->common.scope->name->val, call->fbc->common.function_name->val);
}
}
- if ((call->object = EG(This))) {
- Z_ADDREF_P(call->object);
- call->called_scope = Z_OBJCE_P(call->object);
- }
+ ZVAL_COPY(&call->object, &EG(This));
}
call->num_additional_args = 0;
@@ -20384,11 +19655,11 @@ static int ZEND_FASTCALL ZEND_CASE_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
- is_equal_function(&EX_T(opline->result.var).tmp_var,
+ is_equal_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -20401,30 +19672,25 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_VAR_HANDLER(ZEND_OPCOD
SAVE_OPLINE();
if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) && opline->extended_value) {
- zval **expr_ptr_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
-
- if (IS_VAR == IS_VAR && UNEXPECTED(expr_ptr_ptr == NULL)) {
+ expr_ptr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets");
}
- SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr_ptr);
- expr_ptr = *expr_ptr_ptr;
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr);
Z_ADDREF_P(expr_ptr);
} else {
expr_ptr=_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (0) { /* temporary variable */
- zval *new_expr;
-
- ALLOC_ZVAL(new_expr);
- INIT_PZVAL_COPY(new_expr, expr_ptr);
- expr_ptr = new_expr;
- } else if (IS_VAR == IS_CONST || PZVAL_IS_REF(expr_ptr)) {
- zval *new_expr;
-
- ALLOC_ZVAL(new_expr);
- INIT_PZVAL_COPY(new_expr, expr_ptr);
- expr_ptr = new_expr;
- zendi_zval_copy_ctor(*expr_ptr);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval new_expr;
+
+ ZVAL_COPY_VALUE(&new_expr, expr_ptr);
+ expr_ptr = &new_expr;
+ } else if (IS_VAR == IS_CONST || Z_ISREF_P(expr_ptr)) {
+ zval new_expr;
+
+ ZVAL_DUP(&new_expr, expr_ptr);
+ expr_ptr = &new_expr;
+ zval_ptr_dtor_nogc(free_op1.var);
} else if (IS_VAR == IS_CV) {
Z_ADDREF_P(expr_ptr);
}
@@ -20443,32 +19709,29 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_VAR_HANDLER(ZEND_OPCOD
case IS_BOOL:
hval = Z_LVAL_P(offset);
num_index:
- zend_hash_index_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), hval, &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr);
break;
case IS_STRING:
- if (IS_VAR == IS_CONST) {
- hval = Z_HASH_P(offset);
- } else {
+ if (IS_VAR != IS_CONST) {
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index);
- hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset));
}
- zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), Z_STR_P(offset), expr_ptr);
break;
case IS_NULL:
- zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), STR_EMPTY_ALLOC(), expr_ptr);
break;
default:
zend_error(E_WARNING, "Illegal offset type");
- zval_ptr_dtor(&expr_ptr);
+ zval_ptr_dtor(expr_ptr);
/* do nothing */
break;
}
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
} else {
- zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr);
}
if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) && opline->extended_value) {
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
}
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -20478,7 +19741,7 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDL
{
USE_OPLINE
- array_init(&EX_T(opline->result.var).tmp_var);
+ array_init(EX_VAR(opline->result.var));
if (IS_VAR == IS_UNUSED) {
ZEND_VM_NEXT_OPCODE();
#if 0 || IS_VAR != IS_UNUSED
@@ -20500,13 +19763,13 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLE
IS_VAR == IS_UNUSED &&
(opline->extended_value & ZEND_QUICK_SET)) {
if (EG(active_symbol_table)) {
- zend_compiled_variable *cv = &CV_DEF_OF(opline->op1.var);
+ zend_string *cv = CV_DEF_OF(opline->op1.var);
- zend_delete_variable(EX(prev_execute_data), EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value TSRMLS_CC);
- EX_CV(opline->op1.var) = NULL;
- } else if (EX_CV(opline->op1.var)) {
- zval_ptr_dtor(EX_CV(opline->op1.var));
- EX_CV(opline->op1.var) = NULL;
+ zend_delete_variable(EX(prev_execute_data), EG(active_symbol_table), cv TSRMLS_CC);
+ ZVAL_UNDEF(EX_VAR_NUM(opline->op1.var));
+ } else if (Z_TYPE_P(EX_VAR_NUM(opline->op1.var)) != IS_UNDEF) {
+ zval_ptr_dtor(EX_VAR_NUM(opline->op1.var));
+ ZVAL_UNDEF(EX_VAR_NUM(opline->op1.var));
}
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -20515,8 +19778,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLE
varname = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (IS_VAR != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
- ZVAL_COPY_VALUE(&tmp, varname);
- zval_copy_ctor(&tmp);
+ ZVAL_DUP(&tmp, varname);
convert_to_string(&tmp);
varname = &tmp;
} else if (IS_VAR == IS_VAR || IS_VAR == IS_CV) {
@@ -20530,14 +19792,14 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLE
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
ce = CACHED_PTR(opline->op2.literal->cache_slot);
} else {
- ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
if (IS_VAR != IS_CONST && varname == &tmp) {
zval_dtor(&tmp);
} else if (IS_VAR == IS_VAR || IS_VAR == IS_CV) {
- zval_ptr_dtor(&varname);
+ zval_ptr_dtor(varname);
}
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
HANDLE_EXCEPTION();
}
if (UNEXPECTED(ce == NULL)) {
@@ -20546,22 +19808,20 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLE
CACHE_PTR(opline->op2.literal->cache_slot, ce);
}
} else {
- ce = EX_T(opline->op2.var).class_entry;
+ ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ zend_std_unset_static_property(ce, Z_STR_P(varname), ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
} else {
- ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1);
-
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
- zend_delete_variable(execute_data, target_symbol_table, varname->value.str.val, varname->value.str.len+1, hash_value TSRMLS_CC);
+ zend_delete_variable(execute_data, target_symbol_table, Z_STR_P(varname) TSRMLS_CC);
}
if (IS_VAR != IS_CONST && varname == &tmp) {
zval_dtor(&tmp);
} else if (IS_VAR == IS_VAR || IS_VAR == IS_CV) {
- zval_ptr_dtor(&varname);
+ zval_ptr_dtor(varname);
}
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -20570,21 +19830,21 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLE
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval **container;
+ zval *container;
zval *offset;
ulong hval;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_CV && container != &EG(uninitialized_zval_ptr)) {
+ container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ if (IS_VAR == IS_CV) {
SEPARATE_ZVAL_IF_NOT_REF(container);
}
offset = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
if (IS_VAR != IS_VAR || container) {
- switch (Z_TYPE_PP(container)) {
+ switch (Z_TYPE_P(container)) {
case IS_ARRAY: {
- HashTable *ht = Z_ARRVAL_PP(container);
+ HashTable *ht = Z_ARRVAL_P(container);
switch (Z_TYPE_P(offset)) {
case IS_DOUBLE:
@@ -20601,62 +19861,59 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLE
if (IS_VAR == IS_CV || IS_VAR == IS_VAR) {
Z_ADDREF_P(offset);
}
- if (IS_VAR == IS_CONST) {
- hval = Z_HASH_P(offset);
- } else {
+ if (IS_VAR != IS_CONST) {
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim);
- hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset));
}
- if (ht == &EG(symbol_table)) {
- zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC);
+ if (ht == &EG(symbol_table).ht) {
+ zend_delete_global_variable(Z_STR_P(offset) TSRMLS_CC);
} else {
- zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval);
+ zend_hash_del(ht, Z_STR_P(offset));
}
if (IS_VAR == IS_CV || IS_VAR == IS_VAR) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
}
break;
num_index_dim:
zend_hash_index_del(ht, hval);
if (IS_VAR == IS_CV || IS_VAR == IS_VAR) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
}
break;
case IS_NULL:
- zend_hash_del(ht, "", sizeof(""));
+ zend_hash_del(ht, STR_EMPTY_ALLOC());
break;
default:
zend_error(E_WARNING, "Illegal offset type in unset");
break;
}
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
break;
}
case IS_OBJECT:
- if (UNEXPECTED(Z_OBJ_HT_P(*container)->unset_dimension == NULL)) {
+ if (UNEXPECTED(Z_OBJ_HT_P(container)->unset_dimension == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use object as array");
}
if (0) {
MAKE_REAL_ZVAL_PTR(offset);
}
- Z_OBJ_HT_P(*container)->unset_dimension(*container, offset TSRMLS_CC);
+ Z_OBJ_HT_P(container)->unset_dimension(container, offset TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
}
break;
case IS_STRING:
zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
ZEND_VM_CONTINUE(); /* bailed out before */
default:
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
break;
}
} else {
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
}
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -20666,38 +19923,38 @@ static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLE
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval **container;
+ zval *container;
zval *offset;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
offset = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
if (IS_VAR != IS_VAR || container) {
- if (IS_VAR == IS_CV && container != &EG(uninitialized_zval_ptr)) {
+ if (IS_VAR == IS_CV) {
SEPARATE_ZVAL_IF_NOT_REF(container);
}
- if (Z_TYPE_PP(container) == IS_OBJECT) {
+ if (Z_TYPE_P(container) == IS_OBJECT) {
if (0) {
MAKE_REAL_ZVAL_PTR(offset);
}
- if (Z_OBJ_HT_P(*container)->unset_property) {
- Z_OBJ_HT_P(*container)->unset_property(*container, offset, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ if (Z_OBJ_HT_P(container)->unset_property) {
+ Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to unset property of non-object");
}
if (0) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
}
} else {
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
}
} else {
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
}
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -20706,19 +19963,19 @@ static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLE
static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zval **value;
+ zval *value;
zend_bool isset = 1;
SAVE_OPLINE();
if (IS_VAR == IS_CV &&
IS_VAR == IS_UNUSED &&
(opline->extended_value & ZEND_QUICK_SET)) {
- if (EX_CV(opline->op1.var)) {
- value = EX_CV(opline->op1.var);
+ if (Z_TYPE_P(EX_VAR_NUM(opline->op1.var)) != IS_UNDEF) {
+ value = EX_VAR_NUM(opline->op1.var);
} else if (EG(active_symbol_table)) {
- zend_compiled_variable *cv = &CV_DEF_OF(opline->op1.var);
+ zend_string *cv = CV_DEF_OF(opline->op1.var);
- if (zend_hash_quick_find(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, (void **) &value) == FAILURE) {
+ if ((value = zend_hash_find(EG(active_symbol_table), cv)) == NULL) {
isset = 0;
}
} else {
@@ -20730,8 +19987,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_VAR_HANDLER(ZEND_OPCOD
zval tmp, *varname = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (IS_VAR != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
- ZVAL_COPY_VALUE(&tmp, varname);
- zval_copy_ctor(&tmp);
+ ZVAL_DUP(&tmp, varname);
convert_to_string(&tmp);
varname = &tmp;
}
@@ -20743,7 +19999,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_VAR_HANDLER(ZEND_OPCOD
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
ce = CACHED_PTR(opline->op2.literal->cache_slot);
} else {
- ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -20751,15 +20007,15 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_VAR_HANDLER(ZEND_OPCOD
CACHE_PTR(opline->op2.literal->cache_slot, ce);
}
} else {
- ce = EX_T(opline->op2.var).class_entry;
+ ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1, ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ value = zend_std_get_static_property(ce, Z_STR_P(varname), 1, ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
if (!value) {
isset = 0;
}
} else {
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
- if (zend_hash_find(target_symbol_table, varname->value.str.val, varname->value.str.len+1, (void **) &value) == FAILURE) {
+ if ((value = zend_hash_find(target_symbol_table, Z_STR_P(varname))) == NULL) {
isset = 0;
}
}
@@ -20767,20 +20023,20 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_VAR_HANDLER(ZEND_OPCOD
if (IS_VAR != IS_CONST && varname == &tmp) {
zval_dtor(&tmp);
}
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
}
if (opline->extended_value & ZEND_ISSET) {
- if (isset && Z_TYPE_PP(value) != IS_NULL) {
- ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, 1);
+ if (isset && Z_TYPE_P(value) != IS_NULL) {
+ ZVAL_BOOL(EX_VAR(opline->result.var), 1);
} else {
- ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, 0);
+ ZVAL_BOOL(EX_VAR(opline->result.var), 0);
}
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (!isset || !i_zend_is_true(*value TSRMLS_CC)) {
- ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, 1);
+ if (!isset || !i_zend_is_true(value TSRMLS_CC)) {
+ ZVAL_BOOL(EX_VAR(opline->result.var), 1);
} else {
- ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, 0);
+ ZVAL_BOOL(EX_VAR(opline->result.var), 0);
}
}
@@ -20793,7 +20049,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_VAR(in
USE_OPLINE
zend_free_op free_op1, free_op2;
zval *container;
- zval **value = NULL;
+ zval *value;
int result = 0;
ulong hval;
zval *offset;
@@ -20817,23 +20073,20 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_VAR(in
case IS_LONG:
hval = Z_LVAL_P(offset);
num_index_prop:
- if (zend_hash_index_find(ht, hval, (void **) &value) == SUCCESS) {
+ if ((value = zend_hash_index_find(ht, hval)) != NULL) {
isset = 1;
}
break;
case IS_STRING:
- if (IS_VAR == IS_CONST) {
- hval = Z_HASH_P(offset);
- } else {
+ if (IS_VAR != IS_CONST) {
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop);
- hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset));
}
- if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) {
+ if ((value = zend_hash_find(ht, Z_STR_P(offset))) != NULL) {
isset = 1;
}
break;
case IS_NULL:
- if (zend_hash_find(ht, "", sizeof(""), (void **) &value) == SUCCESS) {
+ if ((value = zend_hash_find(ht, STR_EMPTY_ALLOC())) != NULL) {
isset = 1;
}
break;
@@ -20843,19 +20096,19 @@ num_index_prop:
}
if (opline->extended_value & ZEND_ISSET) {
- if (isset && Z_TYPE_PP(value) == IS_NULL) {
+ if (isset && Z_TYPE_P(value) == IS_NULL) {
result = 0;
} else {
result = isset;
}
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (!isset || !i_zend_is_true(*value TSRMLS_CC)) {
+ if (!isset || !i_zend_is_true(value TSRMLS_CC)) {
result = 0;
} else {
result = 1;
}
}
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
} else if (Z_TYPE_P(container) == IS_OBJECT) {
if (0) {
MAKE_REAL_ZVAL_PTR(offset);
@@ -20876,9 +20129,9 @@ num_index_prop:
}
}
if (0) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
}
} else if (Z_TYPE_P(container) == IS_STRING && !prop_dim) { /* string offsets */
zval tmp;
@@ -20887,8 +20140,7 @@ num_index_prop:
if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */
|| (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
&& IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) {
- ZVAL_COPY_VALUE(&tmp, offset);
- zval_copy_ctor(&tmp);
+ ZVAL_DUP(&tmp, offset);
convert_to_long(&tmp);
offset = &tmp;
} else {
@@ -20907,19 +20159,18 @@ num_index_prop:
}
}
}
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
} else {
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
}
- Z_TYPE(EX_T(opline->result.var).tmp_var) = IS_BOOL;
if (opline->extended_value & ZEND_ISSET) {
- Z_LVAL(EX_T(opline->result.var).tmp_var) = result;
+ ZVAL_BOOL(EX_VAR(opline->result.var), result);
} else {
- Z_LVAL(EX_T(opline->result.var).tmp_var) = !result;
+ ZVAL_BOOL(EX_VAR(opline->result.var), !result);
}
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -20937,6 +20188,9 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_VAR_VAR_HANDLER(ZEND_
static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
+//???
+return 0;
+#if 0
USE_OPLINE
/* The generator object is stored in return_value_ptr_ptr */
@@ -20979,7 +20233,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR
generator->value = copy;
} else {
- zval **value_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ zval **value_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W);
if (IS_VAR == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
@@ -21001,14 +20255,14 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR
generator->value = *value_ptr;
}
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
}
} else {
zval *value = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
/* Consts, temporary variables and references need copying */
if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR
- || PZVAL_IS_REF(value)
+ || Z_ISREF_P(value)
) {
zval *copy;
@@ -21021,7 +20275,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR
}
generator->value = copy;
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
} else {
if (IS_VAR == IS_CV) {
Z_ADDREF_P(value);
@@ -21042,7 +20296,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR
/* Consts, temporary variables and references need copying */
if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR
- || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0)
+ || (Z_ISREF_P(key) && Z_REFCOUNT_P(key) > 0)
) {
zval *copy;
@@ -21066,7 +20320,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR
generator->largest_used_integer_key = Z_LVAL_P(generator->key);
}
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
} else {
/* If no key was specified we use auto-increment keys */
generator->largest_used_integer_key++;
@@ -21094,24 +20348,23 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR
SAVE_OPLINE();
ZEND_VM_RETURN();
+#endif
}
static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_UNUSED(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
zend_free_op free_op1, free_op_data1;
- zval **object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- zval *object;
+ zval *object = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
zval *property = NULL;
zval *value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
int have_get_ptr = 0;
- if (IS_VAR == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- make_real_object(object_ptr TSRMLS_CC);
- object = *object_ptr;
+ make_real_object(object TSRMLS_CC);
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to assign property of non-object");
@@ -21119,8 +20372,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_UNUSED(int (*
FREE_OP(free_op_data1);
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
} else {
/* here we are sure we are dealing with an object */
@@ -21131,15 +20383,14 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_UNUSED(int (*
/* here property is a string */
if (opline->extended_value == ZEND_ASSIGN_OBJ
&& Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval **zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_UNUSED == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_UNUSED == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
have_get_ptr = 1;
- binary_op(*zptr, *zptr, value TSRMLS_CC);
+ binary_op(zptr, zptr, value TSRMLS_CC);
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(*zptr);
- EX_T(opline->result.var).var.ptr = *zptr;
+ ZVAL_COPY(EX_VAR(opline->result.var), zptr);
}
}
}
@@ -21163,12 +20414,11 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_UNUSED(int (*
if (Z_REFCOUNT_P(z) == 0) {
GC_REMOVE_ZVAL_FROM_BUFFER(z);
zval_dtor(z);
- FREE_ZVAL(z);
}
z = value;
}
Z_ADDREF_P(z);
- SEPARATE_ZVAL_IF_NOT_REF(&z);
+ SEPARATE_ZVAL_IF_NOT_REF(z);
binary_op(z, z, value TSRMLS_CC);
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_UNUSED == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
@@ -21176,28 +20426,26 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_UNUSED(int (*
Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(z);
- EX_T(opline->result.var).var.ptr = z;
+ ZVAL_COPY(EX_VAR(opline->result.var), z);
}
- zval_ptr_dtor(&z);
+ zval_ptr_dtor(z);
} else {
zend_error(E_WARNING, "Attempt to assign property of non-object");
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
}
}
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
}
FREE_OP(free_op_data1);
}
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
/* assign_obj has two opcodes! */
CHECK_EXCEPTION();
ZEND_VM_INC_OPCODE();
@@ -21208,7 +20456,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_VAR_UNUSED(int (*bina
{
USE_OPLINE
zend_free_op free_op1, free_op_data2, free_op_data1;
- zval **var_ptr;
+ zval *var_ptr;
zval *value;
SAVE_OPLINE();
@@ -21217,42 +20465,41 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_VAR_UNUSED(int (*bina
return zend_binary_assign_op_obj_helper_SPEC_VAR_UNUSED(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
break;
case ZEND_ASSIGN_DIM: {
- zval **container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ zval *container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- } else if (UNEXPECTED(Z_TYPE_PP(container) == IS_OBJECT)) {
+ } else if (UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
if (IS_VAR == IS_VAR && !(free_op1.var != NULL)) {
- Z_ADDREF_PP(container); /* undo the effect of get_obj_zval_ptr_ptr() */
+ Z_ADDREF_P(container); /* undo the effect of get_obj_zval_ptr_ptr() */
}
return zend_binary_assign_op_obj_helper_SPEC_VAR_UNUSED(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
} else {
zval *dim = NULL;
- zend_fetch_dimension_address(&EX_T((opline+1)->op2.var), container, dim, IS_UNUSED, BP_VAR_RW TSRMLS_CC);
+ zend_fetch_dimension_address(EX_VAR((opline+1)->op2.var), container, dim, IS_UNUSED, BP_VAR_RW TSRMLS_CC);
value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
- var_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
+ var_ptr = _get_zval_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
}
}
break;
default:
value = NULL;
- var_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ var_ptr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
/* do nothing */
break;
}
- if (UNEXPECTED(var_ptr == NULL)) {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
}
- if (UNEXPECTED(*var_ptr == &EG(error_zval))) {
+ if (UNEXPECTED(var_ptr == &EG(error_zval))) {
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
if (opline->extended_value == ZEND_ASSIGN_DIM) {
ZEND_VM_INC_OPCODE();
@@ -21262,32 +20509,31 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_VAR_UNUSED(int (*bina
SEPARATE_ZVAL_IF_NOT_REF(var_ptr);
- if (UNEXPECTED(Z_TYPE_PP(var_ptr) == IS_OBJECT)
- && Z_OBJ_HANDLER_PP(var_ptr, get)
- && Z_OBJ_HANDLER_PP(var_ptr, set)) {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_OBJECT)
+ && Z_OBJ_HANDLER_P(var_ptr, get)
+ && Z_OBJ_HANDLER_P(var_ptr, set)) {
/* proxy object */
- zval *objval = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC);
+ zval *objval = Z_OBJ_HANDLER_P(var_ptr, get)(var_ptr TSRMLS_CC);
Z_ADDREF_P(objval);
binary_op(objval, objval, value TSRMLS_CC);
- Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, objval TSRMLS_CC);
- zval_ptr_dtor(&objval);
+ Z_OBJ_HANDLER_P(var_ptr, set)(var_ptr, objval TSRMLS_CC);
+ zval_ptr_dtor(objval);
} else {
- binary_op(*var_ptr, *var_ptr, value TSRMLS_CC);
+ binary_op(var_ptr, var_ptr, value TSRMLS_CC);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(*var_ptr);
- EX_T(opline->result.var).var.ptr = *var_ptr;
+ ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
if (opline->extended_value == ZEND_ASSIGN_DIM) {
FREE_OP(free_op_data1);
FREE_OP_VAR_PTR(free_op_data2);
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_INC_OPCODE();
} else {
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
}
ZEND_VM_NEXT_OPCODE();
@@ -21353,19 +20599,17 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_UNUSED(int type,
USE_OPLINE
zend_free_op free_op1;
zval *varname;
- zval **retval;
+ zval *retval;
zval tmp_varname;
HashTable *target_symbol_table;
- ulong hash_value;
SAVE_OPLINE();
varname = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (IS_VAR != IS_CONST && UNEXPECTED(Z_TYPE_P(varname) != IS_STRING)) {
- ZVAL_COPY_VALUE(&tmp_varname, varname);
- zval_copy_ctor(&tmp_varname);
- Z_SET_REFCOUNT(tmp_varname, 1);
- Z_UNSET_ISREF(tmp_varname);
+ ZVAL_DUP(&tmp_varname, varname);
+//??? Z_SET_REFCOUNT(tmp_varname, 1);
+//??? Z_UNSET_ISREF(tmp_varname);
convert_to_string(&tmp_varname);
varname = &tmp_varname;
}
@@ -21377,22 +20621,22 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_UNUSED(int type,
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
ce = CACHED_PTR(opline->op2.literal->cache_slot);
} else {
- ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
if (IS_VAR != IS_CONST && varname == &tmp_varname) {
zval_dtor(&tmp_varname);
}
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
CACHE_PTR(opline->op2.literal->cache_slot, ce);
}
} else {
- ce = EX_T(opline->op2.var).class_entry;
+ ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0, ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
+ retval = zend_std_get_static_property(ce, Z_STR_P(varname), 0, ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ zval_ptr_dtor_nogc(free_op1.var);
} else {
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
/*
@@ -21401,27 +20645,21 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_UNUSED(int type,
ZEND_VM_NEXT_OPCODE();
}
*/
- if (IS_VAR == IS_CONST) {
- hash_value = Z_HASH_P(varname);
- } else {
- hash_value = str_hash(Z_STRVAL_P(varname), Z_STRLEN_P(varname));
- }
-
- if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) {
+ if ((retval = zend_hash_find(target_symbol_table, Z_STR_P(varname))) == NULL) {
switch (type) {
case BP_VAR_R:
case BP_VAR_UNSET:
zend_error(E_NOTICE,"Undefined variable: %s", Z_STRVAL_P(varname));
/* break missing intentionally */
case BP_VAR_IS:
- retval = &EG(uninitialized_zval_ptr);
+ ZVAL_NULL(retval);
break;
case BP_VAR_RW:
zend_error(E_NOTICE,"Undefined variable: %s", Z_STRVAL_P(varname));
/* break missing intentionally */
case BP_VAR_W:
Z_ADDREF_P(&EG(uninitialized_zval));
- zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval);
+ retval = zend_hash_update(target_symbol_table, Z_STR_P(varname), &EG(uninitialized_zval));
break;
EMPTY_SWITCH_DEFAULT_CASE()
}
@@ -21429,18 +20667,18 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_UNUSED(int type,
switch (opline->extended_value & ZEND_FETCH_TYPE_MASK) {
case ZEND_FETCH_GLOBAL:
if (IS_VAR != IS_TMP_VAR) {
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
}
break;
case ZEND_FETCH_LOCAL:
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
break;
case ZEND_FETCH_STATIC:
zval_update_constant(retval, (void*) 1 TSRMLS_CC);
break;
case ZEND_FETCH_GLOBAL_LOCK:
if (IS_VAR == IS_VAR && !free_op1.var) {
- PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
+ Z_ADDREF_P(EX_VAR(opline->op1.var));
}
break;
}
@@ -21453,27 +20691,26 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_UNUSED(int type,
if (opline->extended_value & ZEND_FETCH_MAKE_REF) {
SEPARATE_ZVAL_TO_MAKE_IS_REF(retval);
}
- PZVAL_LOCK(*retval);
- switch (type) {
- case BP_VAR_R:
- case BP_VAR_IS:
- EX_T(opline->result.var).var.ptr = *retval;
- break;
- case BP_VAR_UNSET: {
- zend_free_op free_res;
-
- PZVAL_UNLOCK(*retval, &free_res);
- if (retval != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(retval);
- }
- PZVAL_LOCK(*retval);
- FREE_OP_VAR_PTR(free_res);
- }
- /* break missing intentionally */
- default:
- EX_T(opline->result.var).var.ptr_ptr = retval;
- break;
- }
+ ZVAL_COPY(EX_VAR(opline->result.var), retval);
+//??? switch (type) {
+//??? case BP_VAR_R:
+//??? case BP_VAR_IS:
+//??? break;
+//??? case BP_VAR_UNSET: {
+//??? zend_free_op free_res;
+//???
+//??? PZVAL_UNLOCK(*retval, &free_res);
+//??? if (retval != &EG(uninitialized_zval_ptr)) {
+//??? SEPARATE_ZVAL_IF_NOT_REF(retval);
+//??? }
+//??? PZVAL_LOCK(*retval);
+//??? FREE_OP_VAR_PTR(free_res);
+//??? }
+//??? /* break missing intentionally */
+//??? default:
+//??? EX_T(opline->result.var).var.ptr_ptr = retval;
+//??? break;
+//??? }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -21514,30 +20751,28 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_H
{
USE_OPLINE
zend_free_op free_op1;
- zval **container;
+ zval *container;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_fetch_dimension_address(&EX_T(opline->result.var), container, NULL, IS_UNUSED, BP_VAR_W TSRMLS_CC);
+ zend_fetch_dimension_address(EX_VAR(opline->result.var), container, NULL, IS_UNUSED, BP_VAR_W TSRMLS_CC);
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+//??? if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
+//??? }
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
/* We are going to assign the result by reference */
if (UNEXPECTED(opline->extended_value != 0)) {
- zval **retval_ptr = EX_T(opline->result.var).var.ptr_ptr;
+ zval *retval_ptr = EX_VAR(opline->result.var);
- if (retval_ptr) {
- Z_DELREF_PP(retval_ptr);
- SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
- Z_ADDREF_PP(retval_ptr);
- }
+ Z_DELREF_P(retval_ptr);
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
+ Z_ADDREF_P(retval_ptr);
}
CHECK_EXCEPTION();
@@ -21548,20 +20783,20 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_
{
USE_OPLINE
zend_free_op free_op1;
- zval **container;
+ zval *container;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_fetch_dimension_address(&EX_T(opline->result.var), container, NULL, IS_UNUSED, BP_VAR_RW TSRMLS_CC);
+ zend_fetch_dimension_address(EX_VAR(opline->result.var), container, NULL, IS_UNUSED, BP_VAR_RW TSRMLS_CC);
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+//??? if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -21569,31 +20804,30 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_
static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
+ zval *container;
zend_free_op free_op1;
SAVE_OPLINE();
if (zend_is_by_ref_func_arg_fetch(opline, EX(call) TSRMLS_CC)) {
- zval **container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_fetch_dimension_address(&EX_T(opline->result.var), container, NULL, IS_UNUSED, BP_VAR_W TSRMLS_CC);
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
+ zend_fetch_dimension_address(EX_VAR(opline->result.var), container, NULL, IS_UNUSED, BP_VAR_W TSRMLS_CC);
+//??? if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
} else {
- zval *container;
-
if (IS_UNUSED == IS_UNUSED) {
zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
}
container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, NULL, IS_UNUSED, BP_VAR_R TSRMLS_CC);
+ zend_fetch_dimension_address_read(EX_VAR(opline->result.var), container, NULL, IS_UNUSED, BP_VAR_R TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
}
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -21603,24 +20837,24 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HA
{
USE_OPLINE
zend_free_op free_op1;
- zval **object_ptr;
+ zval *object_ptr;
SAVE_OPLINE();
- object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ object_ptr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(object_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- if (Z_TYPE_PP(object_ptr) == IS_OBJECT) {
+ if (Z_TYPE_P(object_ptr) == IS_OBJECT) {
zval *property_name = NULL;
if (0) {
MAKE_REAL_ZVAL_PTR(property_name);
}
- zend_assign_to_object(RETURN_VALUE_USED(opline)?&EX_T(opline->result.var).var.ptr:NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_UNUSED == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_UNUSED == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&property_name);
+ zval_ptr_dtor(property_name);
} else {
}
@@ -21628,51 +20862,43 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HA
zend_free_op free_op_data1, free_op_data2;
zval *value;
zval *dim = NULL;
- zval **variable_ptr_ptr;
+ zval *variable_ptr;
- zend_fetch_dimension_address(&EX_T((opline+1)->op2.var), object_ptr, dim, IS_UNUSED, BP_VAR_W TSRMLS_CC);
+ zend_fetch_dimension_address(EX_VAR((opline+1)->op2.var), object_ptr, dim, IS_UNUSED, BP_VAR_W TSRMLS_CC);
value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
- variable_ptr_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
- if (UNEXPECTED(variable_ptr_ptr == NULL)) {
- if (zend_assign_to_string_offset(&EX_T((opline+1)->op2.var), value, (opline+1)->op1_type TSRMLS_CC)) {
+ variable_ptr = _get_zval_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
+ if (UNEXPECTED(Z_TYPE_P(variable_ptr) == IS_STR_OFFSET)) {
+ if (zend_assign_to_string_offset(EX_VAR((opline+1)->op2.var), value, (opline+1)->op1_type TSRMLS_CC)) {
if (RETURN_VALUE_USED(opline)) {
- zval *retval;
-
- ALLOC_ZVAL(retval);
- ZVAL_STRINGL(retval, Z_STRVAL_P(EX_T((opline+1)->op2.var).str_offset.str)+EX_T((opline+1)->op2.var).str_offset.offset, 1, 1);
- INIT_PZVAL(retval);
- EX_T(opline->result.var).var.ptr = retval;
+ ZVAL_STRINGL(EX_VAR(opline->result.var), Z_STR_OFFSET_P(EX_VAR((opline+1)->op2.var))->str + Z_STR_OFFSET_P(EX_VAR((opline+1)->op2.var))->offset, 1);
}
} else if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
- } else if (UNEXPECTED(*variable_ptr_ptr == &EG(error_zval))) {
+ } else if (UNEXPECTED(variable_ptr == &EG(error_zval))) {
if (IS_TMP_FREE(free_op_data1)) {
zval_dtor(value);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
} else {
if ((opline+1)->op1_type == IS_TMP_VAR) {
- value = zend_assign_tmp_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_tmp_to_variable(variable_ptr, value TSRMLS_CC);
} else if ((opline+1)->op1_type == IS_CONST) {
- value = zend_assign_const_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_const_to_variable(variable_ptr, value TSRMLS_CC);
} else {
- value = zend_assign_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_to_variable(variable_ptr, value TSRMLS_CC);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(value);
- EX_T(opline->result.var).var.ptr = value;
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
}
}
FREE_OP_VAR_PTR(free_op_data2);
FREE_OP_IF_VAR(free_op_data1);
}
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
/* assign_dim has two opcodes! */
CHECK_EXCEPTION();
ZEND_VM_INC_OPCODE();
@@ -21693,7 +20919,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_UNUSED_HANDLER(Z
if (CACHED_PTR(opline->op1.literal->cache_slot)) {
ce = CACHED_PTR(opline->op1.literal->cache_slot);
} else {
- ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
@@ -21704,7 +20930,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_UNUSED_HANDLER(Z
}
call->called_scope = ce;
} else {
- ce = EX_T(opline->op1.var).class_entry;
+ ce = Z_CE_P(EX_VAR(opline->op1.var));
if (opline->extended_value == ZEND_FETCH_CLASS_PARENT || opline->extended_value == ZEND_FETCH_CLASS_SELF) {
call->called_scope = EG(called_scope);
@@ -21722,44 +20948,33 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_UNUSED_HANDLER(Z
(call->fbc = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce))) {
/* do nothing */
} else if (IS_UNUSED != IS_UNUSED) {
- char *function_name_strval = NULL;
- int function_name_strlen = 0;
- if (IS_UNUSED == IS_CONST) {
- function_name_strval = Z_STRVAL_P(opline->op2.zv);
- function_name_strlen = Z_STRLEN_P(opline->op2.zv);
- } else {
- function_name = NULL;
-
+ function_name = NULL;
+ if (IS_UNUSED != IS_CONST) {
if (UNEXPECTED(Z_TYPE_P(function_name) != IS_STRING)) {
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
zend_error_noreturn(E_ERROR, "Function name must be a string");
- } else {
- function_name_strval = Z_STRVAL_P(function_name);
- function_name_strlen = Z_STRLEN_P(function_name);
}
}
- if (function_name_strval) {
- if (ce->get_static_method) {
- call->fbc = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
+ if (ce->get_static_method) {
+ call->fbc = ce->get_static_method(ce, Z_STR_P(function_name) TSRMLS_CC);
+ } else {
+ call->fbc = zend_std_get_static_method(ce, Z_STR_P(function_name), ((IS_UNUSED == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
+ }
+ if (UNEXPECTED(call->fbc == NULL)) {
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", ce->name->val, Z_STRVAL_P(function_name));
+ }
+ if (IS_UNUSED == IS_CONST &&
+ EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
+ EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0)) {
+ if (IS_VAR == IS_CONST) {
+ CACHE_PTR(opline->op2.literal->cache_slot, call->fbc);
} else {
- call->fbc = zend_std_get_static_method(ce, function_name_strval, function_name_strlen, ((IS_UNUSED == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
- }
- if (UNEXPECTED(call->fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", ce->name, function_name_strval);
- }
- if (IS_UNUSED == IS_CONST &&
- EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
- EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0)) {
- if (IS_VAR == IS_CONST) {
- CACHE_PTR(opline->op2.literal->cache_slot, call->fbc);
- } else {
- CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce, call->fbc);
- }
+ CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce, call->fbc);
}
}
if (IS_UNUSED != IS_CONST) {
@@ -21769,31 +20984,28 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_UNUSED_HANDLER(Z
if (UNEXPECTED(ce->constructor == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot call constructor");
}
- if (EG(This) && Z_OBJCE_P(EG(This)) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
- zend_error_noreturn(E_ERROR, "Cannot call private %s::__construct()", ce->name);
+ if (Z_TYPE(EG(This)) != IS_UNDEF && Z_OBJCE(EG(This)) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
+ zend_error_noreturn(E_ERROR, "Cannot call private %s::__construct()", ce->name->val);
}
call->fbc = ce->constructor;
}
if (call->fbc->common.fn_flags & ZEND_ACC_STATIC) {
- call->object = NULL;
+ ZVAL_UNDEF(&call->object);
} else {
- if (EG(This) &&
- Z_OBJ_HT_P(EG(This))->get_class_entry &&
- !instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) {
+ if (Z_TYPE(EG(This)) != IS_UNDEF &&
+ Z_OBJ_HT(EG(This))->get_class_entry &&
+ !instanceof_function(Z_OBJCE(EG(This)), ce TSRMLS_CC)) {
/* We are calling method of the other (incompatible) class,
but passing $this. This is done for compatibility with php-4. */
if (call->fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
- zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name);
+ zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name->val, call->fbc->common.function_name->val);
} else {
/* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */
- zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name);
+ zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", call->fbc->common.scope->name->val, call->fbc->common.function_name->val);
}
}
- if ((call->object = EG(This))) {
- Z_ADDREF_P(call->object);
- call->called_scope = Z_OBJCE_P(call->object);
- }
+ ZVAL_COPY(&call->object, &EG(This));
}
call->num_additional_args = 0;
@@ -21812,30 +21024,25 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_UNUSED_HANDLER(ZEND_OP
SAVE_OPLINE();
if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) && opline->extended_value) {
- zval **expr_ptr_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
-
- if (IS_VAR == IS_VAR && UNEXPECTED(expr_ptr_ptr == NULL)) {
+ expr_ptr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets");
}
- SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr_ptr);
- expr_ptr = *expr_ptr_ptr;
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr);
Z_ADDREF_P(expr_ptr);
} else {
expr_ptr=_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (0) { /* temporary variable */
- zval *new_expr;
-
- ALLOC_ZVAL(new_expr);
- INIT_PZVAL_COPY(new_expr, expr_ptr);
- expr_ptr = new_expr;
- } else if (IS_VAR == IS_CONST || PZVAL_IS_REF(expr_ptr)) {
- zval *new_expr;
-
- ALLOC_ZVAL(new_expr);
- INIT_PZVAL_COPY(new_expr, expr_ptr);
- expr_ptr = new_expr;
- zendi_zval_copy_ctor(*expr_ptr);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval new_expr;
+
+ ZVAL_COPY_VALUE(&new_expr, expr_ptr);
+ expr_ptr = &new_expr;
+ } else if (IS_VAR == IS_CONST || Z_ISREF_P(expr_ptr)) {
+ zval new_expr;
+
+ ZVAL_DUP(&new_expr, expr_ptr);
+ expr_ptr = &new_expr;
+ zval_ptr_dtor_nogc(free_op1.var);
} else if (IS_VAR == IS_CV) {
Z_ADDREF_P(expr_ptr);
}
@@ -21854,32 +21061,29 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_UNUSED_HANDLER(ZEND_OP
case IS_BOOL:
hval = Z_LVAL_P(offset);
num_index:
- zend_hash_index_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), hval, &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr);
break;
case IS_STRING:
- if (IS_UNUSED == IS_CONST) {
- hval = Z_HASH_P(offset);
- } else {
+ if (IS_UNUSED != IS_CONST) {
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index);
- hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset));
}
- zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), Z_STR_P(offset), expr_ptr);
break;
case IS_NULL:
- zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), STR_EMPTY_ALLOC(), expr_ptr);
break;
default:
zend_error(E_WARNING, "Illegal offset type");
- zval_ptr_dtor(&expr_ptr);
+ zval_ptr_dtor(expr_ptr);
/* do nothing */
break;
}
} else {
- zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr);
}
if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) && opline->extended_value) {
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
}
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -21889,7 +21093,7 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HA
{
USE_OPLINE
- array_init(&EX_T(opline->result.var).tmp_var);
+ array_init(EX_VAR(opline->result.var));
if (IS_VAR == IS_UNUSED) {
ZEND_VM_NEXT_OPCODE();
#if 0 || IS_VAR != IS_UNUSED
@@ -21911,13 +21115,13 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HAN
IS_UNUSED == IS_UNUSED &&
(opline->extended_value & ZEND_QUICK_SET)) {
if (EG(active_symbol_table)) {
- zend_compiled_variable *cv = &CV_DEF_OF(opline->op1.var);
+ zend_string *cv = CV_DEF_OF(opline->op1.var);
- zend_delete_variable(EX(prev_execute_data), EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value TSRMLS_CC);
- EX_CV(opline->op1.var) = NULL;
- } else if (EX_CV(opline->op1.var)) {
- zval_ptr_dtor(EX_CV(opline->op1.var));
- EX_CV(opline->op1.var) = NULL;
+ zend_delete_variable(EX(prev_execute_data), EG(active_symbol_table), cv TSRMLS_CC);
+ ZVAL_UNDEF(EX_VAR_NUM(opline->op1.var));
+ } else if (Z_TYPE_P(EX_VAR_NUM(opline->op1.var)) != IS_UNDEF) {
+ zval_ptr_dtor(EX_VAR_NUM(opline->op1.var));
+ ZVAL_UNDEF(EX_VAR_NUM(opline->op1.var));
}
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -21926,8 +21130,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HAN
varname = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (IS_VAR != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
- ZVAL_COPY_VALUE(&tmp, varname);
- zval_copy_ctor(&tmp);
+ ZVAL_DUP(&tmp, varname);
convert_to_string(&tmp);
varname = &tmp;
} else if (IS_VAR == IS_VAR || IS_VAR == IS_CV) {
@@ -21941,14 +21144,14 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HAN
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
ce = CACHED_PTR(opline->op2.literal->cache_slot);
} else {
- ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
if (IS_VAR != IS_CONST && varname == &tmp) {
zval_dtor(&tmp);
} else if (IS_VAR == IS_VAR || IS_VAR == IS_CV) {
- zval_ptr_dtor(&varname);
+ zval_ptr_dtor(varname);
}
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
HANDLE_EXCEPTION();
}
if (UNEXPECTED(ce == NULL)) {
@@ -21957,22 +21160,20 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HAN
CACHE_PTR(opline->op2.literal->cache_slot, ce);
}
} else {
- ce = EX_T(opline->op2.var).class_entry;
+ ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ zend_std_unset_static_property(ce, Z_STR_P(varname), ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
} else {
- ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1);
-
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
- zend_delete_variable(execute_data, target_symbol_table, varname->value.str.val, varname->value.str.len+1, hash_value TSRMLS_CC);
+ zend_delete_variable(execute_data, target_symbol_table, Z_STR_P(varname) TSRMLS_CC);
}
if (IS_VAR != IS_CONST && varname == &tmp) {
zval_dtor(&tmp);
} else if (IS_VAR == IS_VAR || IS_VAR == IS_CV) {
- zval_ptr_dtor(&varname);
+ zval_ptr_dtor(varname);
}
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -21980,19 +21181,19 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HAN
static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zval **value;
+ zval *value;
zend_bool isset = 1;
SAVE_OPLINE();
if (IS_VAR == IS_CV &&
IS_UNUSED == IS_UNUSED &&
(opline->extended_value & ZEND_QUICK_SET)) {
- if (EX_CV(opline->op1.var)) {
- value = EX_CV(opline->op1.var);
+ if (Z_TYPE_P(EX_VAR_NUM(opline->op1.var)) != IS_UNDEF) {
+ value = EX_VAR_NUM(opline->op1.var);
} else if (EG(active_symbol_table)) {
- zend_compiled_variable *cv = &CV_DEF_OF(opline->op1.var);
+ zend_string *cv = CV_DEF_OF(opline->op1.var);
- if (zend_hash_quick_find(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, (void **) &value) == FAILURE) {
+ if ((value = zend_hash_find(EG(active_symbol_table), cv)) == NULL) {
isset = 0;
}
} else {
@@ -22004,8 +21205,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_UNUSED_HANDLER(ZEND_OP
zval tmp, *varname = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (IS_VAR != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
- ZVAL_COPY_VALUE(&tmp, varname);
- zval_copy_ctor(&tmp);
+ ZVAL_DUP(&tmp, varname);
convert_to_string(&tmp);
varname = &tmp;
}
@@ -22017,7 +21217,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_UNUSED_HANDLER(ZEND_OP
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
ce = CACHED_PTR(opline->op2.literal->cache_slot);
} else {
- ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -22025,15 +21225,15 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_UNUSED_HANDLER(ZEND_OP
CACHE_PTR(opline->op2.literal->cache_slot, ce);
}
} else {
- ce = EX_T(opline->op2.var).class_entry;
+ ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1, ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ value = zend_std_get_static_property(ce, Z_STR_P(varname), 1, ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
if (!value) {
isset = 0;
}
} else {
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
- if (zend_hash_find(target_symbol_table, varname->value.str.val, varname->value.str.len+1, (void **) &value) == FAILURE) {
+ if ((value = zend_hash_find(target_symbol_table, Z_STR_P(varname))) == NULL) {
isset = 0;
}
}
@@ -22041,20 +21241,20 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_UNUSED_HANDLER(ZEND_OP
if (IS_VAR != IS_CONST && varname == &tmp) {
zval_dtor(&tmp);
}
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
}
if (opline->extended_value & ZEND_ISSET) {
- if (isset && Z_TYPE_PP(value) != IS_NULL) {
- ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, 1);
+ if (isset && Z_TYPE_P(value) != IS_NULL) {
+ ZVAL_BOOL(EX_VAR(opline->result.var), 1);
} else {
- ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, 0);
+ ZVAL_BOOL(EX_VAR(opline->result.var), 0);
}
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (!isset || !i_zend_is_true(*value TSRMLS_CC)) {
- ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, 1);
+ if (!isset || !i_zend_is_true(value TSRMLS_CC)) {
+ ZVAL_BOOL(EX_VAR(opline->result.var), 1);
} else {
- ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, 0);
+ ZVAL_BOOL(EX_VAR(opline->result.var), 0);
}
}
@@ -22065,26 +21265,25 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_UNUSED_HANDLER(ZEND_OP
static int ZEND_FASTCALL ZEND_SEPARATE_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zval *var_ptr, *new_zv;
+ zval *var_ptr;
SAVE_OPLINE();
- var_ptr = EX_T(opline->op1.var).var.ptr;
+ var_ptr = EX_VAR(opline->op1.var);
if (Z_TYPE_P(var_ptr) != IS_OBJECT &&
- !PZVAL_IS_REF(var_ptr) &&
+ !Z_ISREF_P(var_ptr) &&
Z_REFCOUNT_P(var_ptr) > 1) {
Z_DELREF_P(var_ptr);
- ALLOC_ZVAL(new_zv);
- INIT_PZVAL_COPY(new_zv, var_ptr);
- var_ptr = new_zv;
- zval_copy_ctor(var_ptr);
- EX_T(opline->op1.var).var.ptr = var_ptr;
+ ZVAL_DUP(EX_VAR(opline->op1.var), var_ptr);
}
ZEND_VM_NEXT_OPCODE();
}
static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
+//???
+return 0;
+#if 0
USE_OPLINE
/* The generator object is stored in return_value_ptr_ptr */
@@ -22127,7 +21326,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER
generator->value = copy;
} else {
- zval **value_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ zval **value_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W);
if (IS_VAR == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
@@ -22149,14 +21348,14 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER
generator->value = *value_ptr;
}
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
}
} else {
zval *value = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
/* Consts, temporary variables and references need copying */
if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR
- || PZVAL_IS_REF(value)
+ || Z_ISREF_P(value)
) {
zval *copy;
@@ -22169,7 +21368,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER
}
generator->value = copy;
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
} else {
if (IS_VAR == IS_CV) {
Z_ADDREF_P(value);
@@ -22190,7 +21389,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER
/* Consts, temporary variables and references need copying */
if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR
- || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0)
+ || (Z_ISREF_P(key) && Z_REFCOUNT_P(key) > 0)
) {
zval *copy;
@@ -22241,6 +21440,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER
SAVE_OPLINE();
ZEND_VM_RETURN();
+#endif
}
static int ZEND_FASTCALL ZEND_ADD_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -22249,10 +21449,10 @@ static int ZEND_FASTCALL ZEND_ADD_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_free_op free_op1;
SAVE_OPLINE();
- fast_add_function(&EX_T(opline->result.var).tmp_var,
+ fast_add_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -22264,10 +21464,10 @@ static int ZEND_FASTCALL ZEND_SUB_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_free_op free_op1;
SAVE_OPLINE();
- fast_sub_function(&EX_T(opline->result.var).tmp_var,
+ fast_sub_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -22279,10 +21479,10 @@ static int ZEND_FASTCALL ZEND_MUL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_free_op free_op1;
SAVE_OPLINE();
- fast_mul_function(&EX_T(opline->result.var).tmp_var,
+ fast_mul_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -22294,10 +21494,10 @@ static int ZEND_FASTCALL ZEND_DIV_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_free_op free_op1;
SAVE_OPLINE();
- fast_div_function(&EX_T(opline->result.var).tmp_var,
+ fast_div_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -22309,10 +21509,10 @@ static int ZEND_FASTCALL ZEND_MOD_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_free_op free_op1;
SAVE_OPLINE();
- fast_mod_function(&EX_T(opline->result.var).tmp_var,
+ fast_mod_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -22324,10 +21524,10 @@ static int ZEND_FASTCALL ZEND_SL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_free_op free_op1;
SAVE_OPLINE();
- shift_left_function(&EX_T(opline->result.var).tmp_var,
+ shift_left_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -22339,10 +21539,10 @@ static int ZEND_FASTCALL ZEND_SR_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_free_op free_op1;
SAVE_OPLINE();
- shift_right_function(&EX_T(opline->result.var).tmp_var,
+ shift_right_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -22354,10 +21554,10 @@ static int ZEND_FASTCALL ZEND_CONCAT_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_AR
zend_free_op free_op1;
SAVE_OPLINE();
- concat_function(&EX_T(opline->result.var).tmp_var,
+ concat_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -22369,10 +21569,10 @@ static int ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HAND
zend_free_op free_op1;
SAVE_OPLINE();
- is_identical_function(&EX_T(opline->result.var).tmp_var,
+ is_identical_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -22382,14 +21582,14 @@ static int ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_
{
USE_OPLINE
zend_free_op free_op1;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
is_identical_function(result,
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
Z_LVAL_P(result) = !Z_LVAL_P(result);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -22399,13 +21599,13 @@ static int ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_
{
USE_OPLINE
zend_free_op free_op1;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_equal_function(result,
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC));
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -22415,13 +21615,13 @@ static int ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HAND
{
USE_OPLINE
zend_free_op free_op1;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_not_equal_function(result,
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC));
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -22431,13 +21631,13 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLE
{
USE_OPLINE
zend_free_op free_op1;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_is_smaller_function(result,
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC));
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -22447,13 +21647,13 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_VAR_CV_HANDLER(ZEND_OPCO
{
USE_OPLINE
zend_free_op free_op1;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_is_smaller_or_equal_function(result,
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC));
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -22465,10 +21665,10 @@ static int ZEND_FASTCALL ZEND_BW_OR_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG
zend_free_op free_op1;
SAVE_OPLINE();
- bitwise_or_function(&EX_T(opline->result.var).tmp_var,
+ bitwise_or_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -22480,10 +21680,10 @@ static int ZEND_FASTCALL ZEND_BW_AND_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_AR
zend_free_op free_op1;
SAVE_OPLINE();
- bitwise_and_function(&EX_T(opline->result.var).tmp_var,
+ bitwise_and_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -22495,10 +21695,10 @@ static int ZEND_FASTCALL ZEND_BW_XOR_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_AR
zend_free_op free_op1;
SAVE_OPLINE();
- bitwise_xor_function(&EX_T(opline->result.var).tmp_var,
+ bitwise_xor_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -22510,10 +21710,10 @@ static int ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_
zend_free_op free_op1;
SAVE_OPLINE();
- boolean_xor_function(&EX_T(opline->result.var).tmp_var,
+ boolean_xor_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -22523,18 +21723,16 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_CV(int (*bina
{
USE_OPLINE
zend_free_op free_op1, free_op_data1;
- zval **object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- zval *object;
+ zval *object = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
zval *property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
zval *value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
int have_get_ptr = 0;
- if (IS_VAR == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- make_real_object(object_ptr TSRMLS_CC);
- object = *object_ptr;
+ make_real_object(object TSRMLS_CC);
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to assign property of non-object");
@@ -22542,8 +21740,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_CV(int (*bina
FREE_OP(free_op_data1);
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
} else {
/* here we are sure we are dealing with an object */
@@ -22554,15 +21751,14 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_CV(int (*bina
/* here property is a string */
if (opline->extended_value == ZEND_ASSIGN_OBJ
&& Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval **zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
have_get_ptr = 1;
- binary_op(*zptr, *zptr, value TSRMLS_CC);
+ binary_op(zptr, zptr, value TSRMLS_CC);
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(*zptr);
- EX_T(opline->result.var).var.ptr = *zptr;
+ ZVAL_COPY(EX_VAR(opline->result.var), zptr);
}
}
}
@@ -22586,12 +21782,11 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_CV(int (*bina
if (Z_REFCOUNT_P(z) == 0) {
GC_REMOVE_ZVAL_FROM_BUFFER(z);
zval_dtor(z);
- FREE_ZVAL(z);
}
z = value;
}
Z_ADDREF_P(z);
- SEPARATE_ZVAL_IF_NOT_REF(&z);
+ SEPARATE_ZVAL_IF_NOT_REF(z);
binary_op(z, z, value TSRMLS_CC);
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
@@ -22599,28 +21794,26 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_CV(int (*bina
Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(z);
- EX_T(opline->result.var).var.ptr = z;
+ ZVAL_COPY(EX_VAR(opline->result.var), z);
}
- zval_ptr_dtor(&z);
+ zval_ptr_dtor(z);
} else {
zend_error(E_WARNING, "Attempt to assign property of non-object");
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
}
}
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
}
FREE_OP(free_op_data1);
}
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
/* assign_obj has two opcodes! */
CHECK_EXCEPTION();
ZEND_VM_INC_OPCODE();
@@ -22631,7 +21824,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_VAR_CV(int (*binary_o
{
USE_OPLINE
zend_free_op free_op1, free_op_data2, free_op_data1;
- zval **var_ptr;
+ zval *var_ptr;
zval *value;
SAVE_OPLINE();
@@ -22640,42 +21833,41 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_VAR_CV(int (*binary_o
return zend_binary_assign_op_obj_helper_SPEC_VAR_CV(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
break;
case ZEND_ASSIGN_DIM: {
- zval **container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ zval *container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- } else if (UNEXPECTED(Z_TYPE_PP(container) == IS_OBJECT)) {
+ } else if (UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
if (IS_VAR == IS_VAR && !(free_op1.var != NULL)) {
- Z_ADDREF_PP(container); /* undo the effect of get_obj_zval_ptr_ptr() */
+ Z_ADDREF_P(container); /* undo the effect of get_obj_zval_ptr_ptr() */
}
return zend_binary_assign_op_obj_helper_SPEC_VAR_CV(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
} else {
zval *dim = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- zend_fetch_dimension_address(&EX_T((opline+1)->op2.var), container, dim, IS_CV, BP_VAR_RW TSRMLS_CC);
+ zend_fetch_dimension_address(EX_VAR((opline+1)->op2.var), container, dim, IS_CV, BP_VAR_RW TSRMLS_CC);
value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
- var_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
+ var_ptr = _get_zval_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
}
}
break;
default:
value = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- var_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ var_ptr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
/* do nothing */
break;
}
- if (UNEXPECTED(var_ptr == NULL)) {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
}
- if (UNEXPECTED(*var_ptr == &EG(error_zval))) {
+ if (UNEXPECTED(var_ptr == &EG(error_zval))) {
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
if (opline->extended_value == ZEND_ASSIGN_DIM) {
ZEND_VM_INC_OPCODE();
@@ -22685,32 +21877,31 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_VAR_CV(int (*binary_o
SEPARATE_ZVAL_IF_NOT_REF(var_ptr);
- if (UNEXPECTED(Z_TYPE_PP(var_ptr) == IS_OBJECT)
- && Z_OBJ_HANDLER_PP(var_ptr, get)
- && Z_OBJ_HANDLER_PP(var_ptr, set)) {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_OBJECT)
+ && Z_OBJ_HANDLER_P(var_ptr, get)
+ && Z_OBJ_HANDLER_P(var_ptr, set)) {
/* proxy object */
- zval *objval = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC);
+ zval *objval = Z_OBJ_HANDLER_P(var_ptr, get)(var_ptr TSRMLS_CC);
Z_ADDREF_P(objval);
binary_op(objval, objval, value TSRMLS_CC);
- Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, objval TSRMLS_CC);
- zval_ptr_dtor(&objval);
+ Z_OBJ_HANDLER_P(var_ptr, set)(var_ptr, objval TSRMLS_CC);
+ zval_ptr_dtor(objval);
} else {
- binary_op(*var_ptr, *var_ptr, value TSRMLS_CC);
+ binary_op(var_ptr, var_ptr, value TSRMLS_CC);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(*var_ptr);
- EX_T(opline->result.var).var.ptr = *var_ptr;
+ ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
if (opline->extended_value == ZEND_ASSIGN_DIM) {
FREE_OP(free_op_data1);
FREE_OP_VAR_PTR(free_op_data2);
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_INC_OPCODE();
} else {
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
}
ZEND_VM_NEXT_OPCODE();
@@ -22775,32 +21966,29 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_CV(incdec_t in
{
USE_OPLINE
zend_free_op free_op1;
- zval **object_ptr;
zval *object;
zval *property;
- zval **retval;
+ zval *retval;
int have_get_ptr = 0;
SAVE_OPLINE();
- object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ object = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- retval = &EX_T(opline->result.var).var.ptr;
+ retval = EX_VAR(opline->result.var);
- if (IS_VAR == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
- object = *object_ptr;
+ make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- *retval = &EG(uninitialized_zval);
+ ZVAL_NULL(retval);
}
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -22812,15 +22000,14 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_CV(incdec_t in
}
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval **zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
have_get_ptr = 1;
- incdec_op(*zptr);
+ incdec_op(zptr);
if (RETURN_VALUE_USED(opline)) {
- *retval = *zptr;
- PZVAL_LOCK(*retval);
+ ZVAL_COPY(retval, zptr);
}
}
}
@@ -22835,32 +22022,30 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_CV(incdec_t in
if (Z_REFCOUNT_P(z) == 0) {
GC_REMOVE_ZVAL_FROM_BUFFER(z);
zval_dtor(z);
- FREE_ZVAL(z);
}
z = value;
}
Z_ADDREF_P(z);
- SEPARATE_ZVAL_IF_NOT_REF(&z);
+ SEPARATE_ZVAL_IF_NOT_REF(z);
incdec_op(z);
- *retval = z;
+ ZVAL_COPY_VALUE(retval, z);
Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- SELECTIVE_PZVAL_LOCK(*retval, opline);
- zval_ptr_dtor(&z);
+ SELECTIVE_PZVAL_LOCK(retval, opline);
+ zval_ptr_dtor(z);
} else {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- *retval = &EG(uninitialized_zval);
+ ZVAL_NULL(retval);
}
}
}
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
}
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -22879,29 +22064,27 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_CV(incdec_t i
{
USE_OPLINE
zend_free_op free_op1;
- zval **object_ptr;
zval *object;
zval *property;
zval *retval;
int have_get_ptr = 0;
SAVE_OPLINE();
- object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ object = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- retval = &EX_T(opline->result.var).tmp_var;
+ retval = EX_VAR(opline->result.var);
- if (IS_VAR == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
- object = *object_ptr;
+ make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
ZVAL_NULL(retval);
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -22913,15 +22096,14 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_CV(incdec_t i
}
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval **zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
have_get_ptr = 1;
SEPARATE_ZVAL_IF_NOT_REF(zptr);
- ZVAL_COPY_VALUE(retval, *zptr);
- zendi_zval_copy_ctor(*retval);
+ ZVAL_DUP(retval, zptr);
- incdec_op(*zptr);
+ incdec_op(zptr);
}
}
@@ -22929,7 +22111,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_CV(incdec_t i
if (!have_get_ptr) {
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- zval *z_copy;
+ zval z_copy;
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC);
@@ -22937,20 +22119,16 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_CV(incdec_t i
if (Z_REFCOUNT_P(z) == 0) {
GC_REMOVE_ZVAL_FROM_BUFFER(z);
zval_dtor(z);
- FREE_ZVAL(z);
}
z = value;
}
- ZVAL_COPY_VALUE(retval, z);
- zendi_zval_copy_ctor(*retval);
- ALLOC_ZVAL(z_copy);
- INIT_PZVAL_COPY(z_copy, z);
- zendi_zval_copy_ctor(*z_copy);
- incdec_op(z_copy);
+ ZVAL_DUP(retval, z);
+ ZVAL_DUP(&z_copy, z);
+ incdec_op(&z_copy);
Z_ADDREF_P(z);
- Z_OBJ_HT_P(object)->write_property(object, property, z_copy, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(object)->write_property(object, property, &z_copy, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval_ptr_dtor(&z_copy);
- zval_ptr_dtor(&z);
+ zval_ptr_dtor(z);
} else {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
ZVAL_NULL(retval);
@@ -22958,11 +22136,11 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_CV(incdec_t i
}
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
}
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -22985,10 +22163,10 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDL
SAVE_OPLINE();
container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_R TSRMLS_CC);
+ zend_fetch_dimension_address_read(EX_VAR(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_R TSRMLS_CC);
if (IS_VAR != IS_VAR || !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
}
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -22998,30 +22176,28 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDL
{
USE_OPLINE
zend_free_op free_op1;
- zval **container;
+ zval *container;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_fetch_dimension_address(&EX_T(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_W TSRMLS_CC);
+ zend_fetch_dimension_address(EX_VAR(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_W TSRMLS_CC);
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+//??? if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
+//??? }
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
/* We are going to assign the result by reference */
if (UNEXPECTED(opline->extended_value != 0)) {
- zval **retval_ptr = EX_T(opline->result.var).var.ptr_ptr;
+ zval *retval_ptr = EX_VAR(opline->result.var);
- if (retval_ptr) {
- Z_DELREF_PP(retval_ptr);
- SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
- Z_ADDREF_PP(retval_ptr);
- }
+ Z_DELREF_P(retval_ptr);
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
+ Z_ADDREF_P(retval_ptr);
}
CHECK_EXCEPTION();
@@ -23032,20 +22208,20 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HAND
{
USE_OPLINE
zend_free_op free_op1;
- zval **container;
+ zval *container;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_fetch_dimension_address(&EX_T(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_RW TSRMLS_CC);
+ zend_fetch_dimension_address(EX_VAR(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_RW TSRMLS_CC);
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+//??? if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -23058,9 +22234,9 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HAND
SAVE_OPLINE();
container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_IS TSRMLS_CC);
+ zend_fetch_dimension_address_read(EX_VAR(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_IS TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -23068,31 +22244,30 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HAND
static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
+ zval *container;
zend_free_op free_op1;
SAVE_OPLINE();
if (zend_is_by_ref_func_arg_fetch(opline, EX(call) TSRMLS_CC)) {
- zval **container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_fetch_dimension_address(&EX_T(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_W TSRMLS_CC);
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
+ zend_fetch_dimension_address(EX_VAR(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_W TSRMLS_CC);
+//??? if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
} else {
- zval *container;
-
if (IS_CV == IS_UNUSED) {
zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
}
container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_R TSRMLS_CC);
+ zend_fetch_dimension_address_read(EX_VAR(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_R TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
}
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -23102,37 +22277,33 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_H
{
USE_OPLINE
zend_free_op free_op1;
- zval **container;
+ zval *container;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (IS_VAR == IS_CV) {
- if (container != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(container);
- }
+ SEPARATE_ZVAL_IF_NOT_REF(container);
}
- if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_fetch_dimension_address(&EX_T(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_UNSET TSRMLS_CC);
+ zend_fetch_dimension_address(EX_VAR(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_UNSET TSRMLS_CC);
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
- if (UNEXPECTED(EX_T(opline->result.var).var.ptr_ptr == NULL)) {
+//??? if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
+ if (UNEXPECTED(Z_TYPE_P(EX_VAR(opline->result.var)) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
ZEND_VM_NEXT_OPCODE();
} else {
zend_free_op free_res;
- zval **retval_ptr = EX_T(opline->result.var).var.ptr_ptr;
+ zval *retval_ptr = EX_VAR(opline->result.var);
- PZVAL_UNLOCK(*retval_ptr, &free_res);
- if (retval_ptr != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(retval_ptr);
- }
- PZVAL_LOCK(*retval_ptr);
+ PZVAL_UNLOCK(retval_ptr, &free_res);
+ SEPARATE_ZVAL_IF_NOT_REF(retval_ptr);
+ PZVAL_LOCK(retval_ptr);
FREE_OP_VAR_PTR(free_res);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -23154,8 +22325,7 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_VAR_CV(ZEN
if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
zend_error(E_NOTICE, "Trying to get property of non-object");
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
} else {
zval *retval;
@@ -23167,17 +22337,16 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_VAR_CV(ZEN
/* here we are sure we are dealing with an object */
retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_R, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- PZVAL_LOCK(retval);
- EX_T(opline->result.var).var.ptr = retval;
+ ZVAL_COPY(EX_VAR(opline->result.var), retval);
if (0) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
}
}
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -23192,7 +22361,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDL
USE_OPLINE
zend_free_op free_op1;
zval *property;
- zval **container;
+ zval *container;
SAVE_OPLINE();
property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
@@ -23200,31 +22369,31 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDL
if (0) {
MAKE_REAL_ZVAL_PTR(property);
}
- container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
+ container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(&EX_T(opline->result.var), container, property, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
}
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+//??? if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
/* We are going to assign the result by reference */
if (opline->extended_value & ZEND_FETCH_MAKE_REF) {
- zval **retval_ptr = EX_T(opline->result.var).var.ptr_ptr;
+ zval *retval_ptr = EX_VAR(opline->result.var);
- Z_DELREF_PP(retval_ptr);
+ Z_DELREF_P(retval_ptr);
SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
- Z_ADDREF_PP(retval_ptr);
- EX_T(opline->result.var).var.ptr = *EX_T(opline->result.var).var.ptr_ptr;
- EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
+ Z_ADDREF_P(retval_ptr);
+//??? EX_T(opline->result.var).var.ptr = *EX_T(opline->result.var).var.ptr_ptr;
+//??? EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
}
CHECK_EXCEPTION();
@@ -23236,28 +22405,28 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HAND
USE_OPLINE
zend_free_op free_op1;
zval *property;
- zval **container;
+ zval *container;
SAVE_OPLINE();
property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (0) {
MAKE_REAL_ZVAL_PTR(property);
}
- if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(&EX_T(opline->result.var), container, property, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_RW TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_RW TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
}
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+//??? if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -23276,8 +22445,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HAND
if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
} else {
zval *retval;
@@ -23289,17 +22457,16 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HAND
/* here we are sure we are dealing with an object */
retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_IS, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- PZVAL_LOCK(retval);
- EX_T(opline->result.var).var.ptr = retval;
+ ZVAL_COPY(EX_VAR(opline->result.var), retval);
if (0) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
}
}
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -23307,33 +22474,33 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HAND
static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
+ zval *container;
if (zend_is_by_ref_func_arg_fetch(opline, EX(call) TSRMLS_CC)) {
/* Behave like FETCH_OBJ_W */
zend_free_op free_op1;
zval *property;
- zval **container;
SAVE_OPLINE();
property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (0) {
MAKE_REAL_ZVAL_PTR(property);
}
- if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(&EX_T(opline->result.var), container, property, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
}
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+//??? if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
} else {
@@ -23345,40 +22512,38 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_H
{
USE_OPLINE
zend_free_op free_op1, free_res;
- zval **container;
+ zval *container;
zval *property;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
if (IS_VAR == IS_CV) {
- if (container != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(container);
- }
+ SEPARATE_ZVAL_IF_NOT_REF(container);
}
if (0) {
MAKE_REAL_ZVAL_PTR(property);
}
- if (IS_VAR == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(&EX_T(opline->result.var), container, property, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_UNSET TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_UNSET TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
}
- if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+//??? if (IS_VAR == IS_VAR && (free_op1.var != NULL) && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
- PZVAL_UNLOCK(*EX_T(opline->result.var).var.ptr_ptr, &free_res);
- if (EX_T(opline->result.var).var.ptr_ptr != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(EX_T(opline->result.var).var.ptr_ptr);
- }
- PZVAL_LOCK(*EX_T(opline->result.var).var.ptr_ptr);
+//??? PZVAL_UNLOCK(EX_VAR(opline->result.var), &free_res);
+//??? if (EX_T(opline->result.var).var.ptr_ptr != &EG(uninitialized_zval_ptr)) {
+//??? SEPARATE_ZVAL_IF_NOT_REF(EX_T(opline->result.var).var.ptr_ptr);
+//??? }
+//??? PZVAL_LOCK(EX_VAR(opline->result.var));
FREE_OP_VAR_PTR(free_res);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -23388,26 +22553,26 @@ static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLE
{
USE_OPLINE
zend_free_op free_op1;
- zval **object_ptr;
+ zval *object;
zval *property_name;
SAVE_OPLINE();
- object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ object = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
property_name = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
if (0) {
MAKE_REAL_ZVAL_PTR(property_name);
}
- if (IS_VAR == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_assign_to_object(RETURN_VALUE_USED(opline)?&EX_T(opline->result.var).var.ptr:NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&property_name);
+ zval_ptr_dtor(property_name);
} else {
}
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
/* assign_obj has two opcodes! */
CHECK_EXCEPTION();
ZEND_VM_INC_OPCODE();
@@ -23418,24 +22583,24 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLE
{
USE_OPLINE
zend_free_op free_op1;
- zval **object_ptr;
+ zval *object_ptr;
SAVE_OPLINE();
- object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ object_ptr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(object_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- if (Z_TYPE_PP(object_ptr) == IS_OBJECT) {
+ if (Z_TYPE_P(object_ptr) == IS_OBJECT) {
zval *property_name = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
if (0) {
MAKE_REAL_ZVAL_PTR(property_name);
}
- zend_assign_to_object(RETURN_VALUE_USED(opline)?&EX_T(opline->result.var).var.ptr:NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&property_name);
+ zval_ptr_dtor(property_name);
} else {
}
@@ -23443,51 +22608,43 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLE
zend_free_op free_op_data1, free_op_data2;
zval *value;
zval *dim = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- zval **variable_ptr_ptr;
+ zval *variable_ptr;
- zend_fetch_dimension_address(&EX_T((opline+1)->op2.var), object_ptr, dim, IS_CV, BP_VAR_W TSRMLS_CC);
+ zend_fetch_dimension_address(EX_VAR((opline+1)->op2.var), object_ptr, dim, IS_CV, BP_VAR_W TSRMLS_CC);
value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
- variable_ptr_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
- if (UNEXPECTED(variable_ptr_ptr == NULL)) {
- if (zend_assign_to_string_offset(&EX_T((opline+1)->op2.var), value, (opline+1)->op1_type TSRMLS_CC)) {
+ variable_ptr = _get_zval_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
+ if (UNEXPECTED(Z_TYPE_P(variable_ptr) == IS_STR_OFFSET)) {
+ if (zend_assign_to_string_offset(EX_VAR((opline+1)->op2.var), value, (opline+1)->op1_type TSRMLS_CC)) {
if (RETURN_VALUE_USED(opline)) {
- zval *retval;
-
- ALLOC_ZVAL(retval);
- ZVAL_STRINGL(retval, Z_STRVAL_P(EX_T((opline+1)->op2.var).str_offset.str)+EX_T((opline+1)->op2.var).str_offset.offset, 1, 1);
- INIT_PZVAL(retval);
- EX_T(opline->result.var).var.ptr = retval;
+ ZVAL_STRINGL(EX_VAR(opline->result.var), Z_STR_OFFSET_P(EX_VAR((opline+1)->op2.var))->str + Z_STR_OFFSET_P(EX_VAR((opline+1)->op2.var))->offset, 1);
}
} else if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
- } else if (UNEXPECTED(*variable_ptr_ptr == &EG(error_zval))) {
+ } else if (UNEXPECTED(variable_ptr == &EG(error_zval))) {
if (IS_TMP_FREE(free_op_data1)) {
zval_dtor(value);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
} else {
if ((opline+1)->op1_type == IS_TMP_VAR) {
- value = zend_assign_tmp_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_tmp_to_variable(variable_ptr, value TSRMLS_CC);
} else if ((opline+1)->op1_type == IS_CONST) {
- value = zend_assign_const_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_const_to_variable(variable_ptr, value TSRMLS_CC);
} else {
- value = zend_assign_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_to_variable(variable_ptr, value TSRMLS_CC);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(value);
- EX_T(opline->result.var).var.ptr = value;
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
}
}
FREE_OP_VAR_PTR(free_op_data2);
FREE_OP_IF_VAR(free_op_data1);
}
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
/* assign_dim has two opcodes! */
CHECK_EXCEPTION();
ZEND_VM_INC_OPCODE();
@@ -23499,49 +22656,41 @@ static int ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_AR
USE_OPLINE
zend_free_op free_op1;
zval *value;
- zval **variable_ptr_ptr;
+ zval *variable_ptr;
SAVE_OPLINE();
value = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- variable_ptr_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ variable_ptr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(variable_ptr_ptr == NULL)) {
- if (zend_assign_to_string_offset(&EX_T(opline->op1.var), value, IS_CV TSRMLS_CC)) {
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(variable_ptr) == IS_STR_OFFSET)) {
+ if (zend_assign_to_string_offset(EX_VAR(opline->op1.var), value, IS_CV TSRMLS_CC)) {
if (RETURN_VALUE_USED(opline)) {
- zval *retval;
-
- ALLOC_ZVAL(retval);
- ZVAL_STRINGL(retval, Z_STRVAL_P(EX_T(opline->op1.var).str_offset.str)+EX_T(opline->op1.var).str_offset.offset, 1, 1);
- INIT_PZVAL(retval);
- EX_T(opline->result.var).var.ptr = retval;
+ ZVAL_STRINGL(EX_VAR(opline->result.var), Z_STR_OFFSET_P(EX_VAR(opline->op1.var))->str + Z_STR_OFFSET_P(EX_VAR(opline->op1.var))->offset, 1);
}
} else if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
- } else if (IS_VAR == IS_VAR && UNEXPECTED(*variable_ptr_ptr == &EG(error_zval))) {
+ } else if (IS_VAR == IS_VAR && UNEXPECTED(variable_ptr == &EG(error_zval))) {
if (0) {
zval_dtor(value);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
} else {
if (IS_CV == IS_TMP_VAR) {
- value = zend_assign_tmp_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_tmp_to_variable(variable_ptr, value TSRMLS_CC);
} else if (IS_CV == IS_CONST) {
- value = zend_assign_const_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_const_to_variable(variable_ptr, value TSRMLS_CC);
} else {
- value = zend_assign_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_to_variable(variable_ptr, value TSRMLS_CC);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(value);
- EX_T(opline->result.var).var.ptr = value;
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
}
}
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
/* zend_assign_to_variable() always takes care of op2, never free it! */
@@ -23553,19 +22702,19 @@ static int ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLE
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval **variable_ptr_ptr;
- zval **value_ptr_ptr;
+ zval *variable_ptr;
+ zval *value_ptr;
SAVE_OPLINE();
- value_ptr_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->op2.var TSRMLS_CC);
+ value_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op2.var TSRMLS_CC);
if (IS_CV == IS_VAR &&
- value_ptr_ptr &&
- !Z_ISREF_PP(value_ptr_ptr) &&
- opline->extended_value == ZEND_RETURNS_FUNCTION &&
- !EX_T(opline->op2.var).var.fcall_returned_reference) {
+ value_ptr &&
+ !Z_ISREF_P(value_ptr) &&
+ opline->extended_value == ZEND_RETURNS_FUNCTION /*???&&
+ !EX_T(opline->op2.var).var.fcall_returned_reference*/) {
if (free_op2.var == NULL) {
- PZVAL_LOCK(*value_ptr_ptr); /* undo the effect of get_zval_ptr_ptr() */
+ PZVAL_LOCK(value_ptr); /* undo the effect of get_zval_ptr_ptr() */
}
zend_error(E_STRICT, "Only variables should be assigned by reference");
if (UNEXPECTED(EG(exception) != NULL)) {
@@ -23574,29 +22723,28 @@ static int ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLE
}
return ZEND_ASSIGN_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
} else if (IS_CV == IS_VAR && opline->extended_value == ZEND_RETURNS_NEW) {
- PZVAL_LOCK(*value_ptr_ptr);
- }
- if (IS_VAR == IS_VAR && UNEXPECTED(EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr)) {
- zend_error_noreturn(E_ERROR, "Cannot assign by reference to overloaded object");
+ PZVAL_LOCK(value_ptr);
}
+//??? if (IS_VAR == IS_VAR && UNEXPECTED(EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr)) {
+//??? zend_error_noreturn(E_ERROR, "Cannot assign by reference to overloaded object");
+//??? }
- variable_ptr_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if ((IS_CV == IS_VAR && UNEXPECTED(value_ptr_ptr == NULL)) ||
- (IS_VAR == IS_VAR && UNEXPECTED(variable_ptr_ptr == NULL))) {
+ variable_ptr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ if ((IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(value_ptr) == IS_STR_OFFSET)) ||
+ (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(variable_ptr) == IS_STR_OFFSET))) {
zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets nor overloaded objects");
}
- zend_assign_to_variable_reference(variable_ptr_ptr, value_ptr_ptr TSRMLS_CC);
+ zend_assign_to_variable_reference(variable_ptr, value_ptr TSRMLS_CC);
if (IS_CV == IS_VAR && opline->extended_value == ZEND_RETURNS_NEW) {
- Z_DELREF_PP(variable_ptr_ptr);
+ Z_DELREF_P(variable_ptr);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(*variable_ptr_ptr);
- EX_T(opline->result.var).var.ptr = *variable_ptr_ptr;
+ ZVAL_COPY(EX_VAR(opline->result.var), variable_ptr);
}
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -23606,8 +22754,6 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_
{
USE_OPLINE
zval *function_name;
- char *function_name_strval;
- int function_name_strlen;
zend_free_op free_op1;
call_slot *call = EX(call_slots) + opline->result.num;
@@ -23623,32 +22769,29 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_
zend_error_noreturn(E_ERROR, "Method name must be a string");
}
- function_name_strval = Z_STRVAL_P(function_name);
- function_name_strlen = Z_STRLEN_P(function_name);
-
- call->object = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ ZVAL_COPY_VALUE(&call->object, _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC));
- if (EXPECTED(call->object != NULL) &&
- EXPECTED(Z_TYPE_P(call->object) == IS_OBJECT)) {
- call->called_scope = Z_OBJCE_P(call->object);
+ if (EXPECTED(Z_TYPE(call->object) != IS_UNDEF) &&
+ EXPECTED(Z_TYPE(call->object) == IS_OBJECT)) {
+ call->called_scope = Z_OBJCE(call->object);
if (IS_CV != IS_CONST ||
(call->fbc = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope)) == NULL) {
- zval *object = call->object;
+ zend_object *object = Z_OBJ(call->object);
- if (UNEXPECTED(Z_OBJ_HT_P(call->object)->get_method == NULL)) {
+ if (UNEXPECTED(Z_OBJ_HT(call->object)->get_method == NULL)) {
zend_error_noreturn(E_ERROR, "Object does not support method calls");
}
/* First, locate the function. */
- call->fbc = Z_OBJ_HT_P(call->object)->get_method(&call->object, function_name_strval, function_name_strlen, ((IS_CV == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
+ call->fbc = Z_OBJ_HT(call->object)->get_method(&call->object, Z_STR_P(function_name), ((IS_CV == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
if (UNEXPECTED(call->fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(call->object), function_name_strval);
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(&call->object), Z_STRVAL_P(function_name));
}
if (IS_CV == IS_CONST &&
EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0) &&
- EXPECTED(call->object == object)) {
+ EXPECTED(Z_OBJ(call->object) == object)) {
CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope, call->fbc);
}
}
@@ -23657,20 +22800,16 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_
HANDLE_EXCEPTION();
}
- zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval);
+ zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", Z_STRVAL_P(function_name));
}
if ((call->fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) {
- call->object = NULL;
+ ZVAL_UNDEF(&call->object);
} else {
- if (!PZVAL_IS_REF(call->object)) {
- Z_ADDREF_P(call->object); /* For $this pointer */
+ if (!Z_ISREF(call->object)) {
+ Z_ADDREF(call->object); /* For $this pointer */
} else {
- zval *this_ptr;
- ALLOC_ZVAL(this_ptr);
- INIT_PZVAL_COPY(this_ptr, call->object);
- zval_copy_ctor(this_ptr);
- call->object = this_ptr;
+ ZVAL_DUP(&call->object, Z_REFVAL(call->object));
}
}
@@ -23678,7 +22817,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_
call->is_ctor_call = 0;
EX(call) = call;
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -23698,7 +22837,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_
if (CACHED_PTR(opline->op1.literal->cache_slot)) {
ce = CACHED_PTR(opline->op1.literal->cache_slot);
} else {
- ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
@@ -23709,7 +22848,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_
}
call->called_scope = ce;
} else {
- ce = EX_T(opline->op1.var).class_entry;
+ ce = Z_CE_P(EX_VAR(opline->op1.var));
if (opline->extended_value == ZEND_FETCH_CLASS_PARENT || opline->extended_value == ZEND_FETCH_CLASS_SELF) {
call->called_scope = EG(called_scope);
@@ -23727,44 +22866,33 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_
(call->fbc = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce))) {
/* do nothing */
} else if (IS_CV != IS_UNUSED) {
- char *function_name_strval = NULL;
- int function_name_strlen = 0;
- if (IS_CV == IS_CONST) {
- function_name_strval = Z_STRVAL_P(opline->op2.zv);
- function_name_strlen = Z_STRLEN_P(opline->op2.zv);
- } else {
- function_name = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
-
+ function_name = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
+ if (IS_CV != IS_CONST) {
if (UNEXPECTED(Z_TYPE_P(function_name) != IS_STRING)) {
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
zend_error_noreturn(E_ERROR, "Function name must be a string");
- } else {
- function_name_strval = Z_STRVAL_P(function_name);
- function_name_strlen = Z_STRLEN_P(function_name);
}
}
- if (function_name_strval) {
- if (ce->get_static_method) {
- call->fbc = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
+ if (ce->get_static_method) {
+ call->fbc = ce->get_static_method(ce, Z_STR_P(function_name) TSRMLS_CC);
+ } else {
+ call->fbc = zend_std_get_static_method(ce, Z_STR_P(function_name), ((IS_CV == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
+ }
+ if (UNEXPECTED(call->fbc == NULL)) {
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", ce->name->val, Z_STRVAL_P(function_name));
+ }
+ if (IS_CV == IS_CONST &&
+ EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
+ EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0)) {
+ if (IS_VAR == IS_CONST) {
+ CACHE_PTR(opline->op2.literal->cache_slot, call->fbc);
} else {
- call->fbc = zend_std_get_static_method(ce, function_name_strval, function_name_strlen, ((IS_CV == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
- }
- if (UNEXPECTED(call->fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", ce->name, function_name_strval);
- }
- if (IS_CV == IS_CONST &&
- EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
- EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0)) {
- if (IS_VAR == IS_CONST) {
- CACHE_PTR(opline->op2.literal->cache_slot, call->fbc);
- } else {
- CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce, call->fbc);
- }
+ CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce, call->fbc);
}
}
if (IS_CV != IS_CONST) {
@@ -23774,31 +22902,28 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_
if (UNEXPECTED(ce->constructor == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot call constructor");
}
- if (EG(This) && Z_OBJCE_P(EG(This)) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
- zend_error_noreturn(E_ERROR, "Cannot call private %s::__construct()", ce->name);
+ if (Z_TYPE(EG(This)) != IS_UNDEF && Z_OBJCE(EG(This)) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
+ zend_error_noreturn(E_ERROR, "Cannot call private %s::__construct()", ce->name->val);
}
call->fbc = ce->constructor;
}
if (call->fbc->common.fn_flags & ZEND_ACC_STATIC) {
- call->object = NULL;
+ ZVAL_UNDEF(&call->object);
} else {
- if (EG(This) &&
- Z_OBJ_HT_P(EG(This))->get_class_entry &&
- !instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) {
+ if (Z_TYPE(EG(This)) != IS_UNDEF &&
+ Z_OBJ_HT(EG(This))->get_class_entry &&
+ !instanceof_function(Z_OBJCE(EG(This)), ce TSRMLS_CC)) {
/* We are calling method of the other (incompatible) class,
but passing $this. This is done for compatibility with php-4. */
if (call->fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
- zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name);
+ zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name->val, call->fbc->common.function_name->val);
} else {
/* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */
- zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name);
+ zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", call->fbc->common.scope->name->val, call->fbc->common.function_name->val);
}
}
- if ((call->object = EG(This))) {
- Z_ADDREF_P(call->object);
- call->called_scope = Z_OBJCE_P(call->object);
- }
+ ZVAL_COPY(&call->object, &EG(This));
}
call->num_additional_args = 0;
@@ -23815,7 +22940,7 @@ static int ZEND_FASTCALL ZEND_CASE_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS
zend_free_op free_op1;
SAVE_OPLINE();
- is_equal_function(&EX_T(opline->result.var).tmp_var,
+ is_equal_function(EX_VAR(opline->result.var),
_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
@@ -23831,30 +22956,25 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CV_HANDLER(ZEND_OPCODE
SAVE_OPLINE();
if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) && opline->extended_value) {
- zval **expr_ptr_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
-
- if (IS_VAR == IS_VAR && UNEXPECTED(expr_ptr_ptr == NULL)) {
+ expr_ptr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ if (IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets");
}
- SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr_ptr);
- expr_ptr = *expr_ptr_ptr;
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr);
Z_ADDREF_P(expr_ptr);
} else {
expr_ptr=_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (0) { /* temporary variable */
- zval *new_expr;
-
- ALLOC_ZVAL(new_expr);
- INIT_PZVAL_COPY(new_expr, expr_ptr);
- expr_ptr = new_expr;
- } else if (IS_VAR == IS_CONST || PZVAL_IS_REF(expr_ptr)) {
- zval *new_expr;
-
- ALLOC_ZVAL(new_expr);
- INIT_PZVAL_COPY(new_expr, expr_ptr);
- expr_ptr = new_expr;
- zendi_zval_copy_ctor(*expr_ptr);
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval new_expr;
+
+ ZVAL_COPY_VALUE(&new_expr, expr_ptr);
+ expr_ptr = &new_expr;
+ } else if (IS_VAR == IS_CONST || Z_ISREF_P(expr_ptr)) {
+ zval new_expr;
+
+ ZVAL_DUP(&new_expr, expr_ptr);
+ expr_ptr = &new_expr;
+ zval_ptr_dtor_nogc(free_op1.var);
} else if (IS_VAR == IS_CV) {
Z_ADDREF_P(expr_ptr);
}
@@ -23873,32 +22993,29 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CV_HANDLER(ZEND_OPCODE
case IS_BOOL:
hval = Z_LVAL_P(offset);
num_index:
- zend_hash_index_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), hval, &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr);
break;
case IS_STRING:
- if (IS_CV == IS_CONST) {
- hval = Z_HASH_P(offset);
- } else {
+ if (IS_CV != IS_CONST) {
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index);
- hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset));
}
- zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), Z_STR_P(offset), expr_ptr);
break;
case IS_NULL:
- zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), STR_EMPTY_ALLOC(), expr_ptr);
break;
default:
zend_error(E_WARNING, "Illegal offset type");
- zval_ptr_dtor(&expr_ptr);
+ zval_ptr_dtor(expr_ptr);
/* do nothing */
break;
}
} else {
- zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr);
}
if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) && opline->extended_value) {
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
}
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -23908,7 +23025,7 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLE
{
USE_OPLINE
- array_init(&EX_T(opline->result.var).tmp_var);
+ array_init(EX_VAR(opline->result.var));
if (IS_VAR == IS_UNUSED) {
ZEND_VM_NEXT_OPCODE();
#if 0 || IS_VAR != IS_UNUSED
@@ -23922,21 +23039,21 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER
{
USE_OPLINE
zend_free_op free_op1;
- zval **container;
+ zval *container;
zval *offset;
ulong hval;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
- if (IS_VAR == IS_CV && container != &EG(uninitialized_zval_ptr)) {
+ container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ if (IS_VAR == IS_CV) {
SEPARATE_ZVAL_IF_NOT_REF(container);
}
offset = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
if (IS_VAR != IS_VAR || container) {
- switch (Z_TYPE_PP(container)) {
+ switch (Z_TYPE_P(container)) {
case IS_ARRAY: {
- HashTable *ht = Z_ARRVAL_PP(container);
+ HashTable *ht = Z_ARRVAL_P(container);
switch (Z_TYPE_P(offset)) {
case IS_DOUBLE:
@@ -23953,29 +23070,26 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER
if (IS_CV == IS_CV || IS_CV == IS_VAR) {
Z_ADDREF_P(offset);
}
- if (IS_CV == IS_CONST) {
- hval = Z_HASH_P(offset);
- } else {
+ if (IS_CV != IS_CONST) {
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim);
- hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset));
}
- if (ht == &EG(symbol_table)) {
- zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC);
+ if (ht == &EG(symbol_table).ht) {
+ zend_delete_global_variable(Z_STR_P(offset) TSRMLS_CC);
} else {
- zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval);
+ zend_hash_del(ht, Z_STR_P(offset));
}
if (IS_CV == IS_CV || IS_CV == IS_VAR) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
}
break;
num_index_dim:
zend_hash_index_del(ht, hval);
if (IS_CV == IS_CV || IS_CV == IS_VAR) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
}
break;
case IS_NULL:
- zend_hash_del(ht, "", sizeof(""));
+ zend_hash_del(ht, STR_EMPTY_ALLOC());
break;
default:
zend_error(E_WARNING, "Illegal offset type in unset");
@@ -23985,15 +23099,15 @@ num_index_dim:
break;
}
case IS_OBJECT:
- if (UNEXPECTED(Z_OBJ_HT_P(*container)->unset_dimension == NULL)) {
+ if (UNEXPECTED(Z_OBJ_HT_P(container)->unset_dimension == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use object as array");
}
if (0) {
MAKE_REAL_ZVAL_PTR(offset);
}
- Z_OBJ_HT_P(*container)->unset_dimension(*container, offset TSRMLS_CC);
+ Z_OBJ_HT_P(container)->unset_dimension(container, offset TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
}
@@ -24008,7 +23122,7 @@ num_index_dim:
} else {
}
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -24018,28 +23132,28 @@ static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER
{
USE_OPLINE
zend_free_op free_op1;
- zval **container;
+ zval *container;
zval *offset;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
offset = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
if (IS_VAR != IS_VAR || container) {
- if (IS_VAR == IS_CV && container != &EG(uninitialized_zval_ptr)) {
+ if (IS_VAR == IS_CV) {
SEPARATE_ZVAL_IF_NOT_REF(container);
}
- if (Z_TYPE_PP(container) == IS_OBJECT) {
+ if (Z_TYPE_P(container) == IS_OBJECT) {
if (0) {
MAKE_REAL_ZVAL_PTR(offset);
}
- if (Z_OBJ_HT_P(*container)->unset_property) {
- Z_OBJ_HT_P(*container)->unset_property(*container, offset, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ if (Z_OBJ_HT_P(container)->unset_property) {
+ Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to unset property of non-object");
}
if (0) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
}
@@ -24049,7 +23163,7 @@ static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER
} else {
}
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -24060,7 +23174,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CV(int
USE_OPLINE
zend_free_op free_op1;
zval *container;
- zval **value = NULL;
+ zval *value;
int result = 0;
ulong hval;
zval *offset;
@@ -24084,23 +23198,20 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CV(int
case IS_LONG:
hval = Z_LVAL_P(offset);
num_index_prop:
- if (zend_hash_index_find(ht, hval, (void **) &value) == SUCCESS) {
+ if ((value = zend_hash_index_find(ht, hval)) != NULL) {
isset = 1;
}
break;
case IS_STRING:
- if (IS_CV == IS_CONST) {
- hval = Z_HASH_P(offset);
- } else {
+ if (IS_CV != IS_CONST) {
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop);
- hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset));
}
- if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) {
+ if ((value = zend_hash_find(ht, Z_STR_P(offset))) != NULL) {
isset = 1;
}
break;
case IS_NULL:
- if (zend_hash_find(ht, "", sizeof(""), (void **) &value) == SUCCESS) {
+ if ((value = zend_hash_find(ht, STR_EMPTY_ALLOC())) != NULL) {
isset = 1;
}
break;
@@ -24110,13 +23221,13 @@ num_index_prop:
}
if (opline->extended_value & ZEND_ISSET) {
- if (isset && Z_TYPE_PP(value) == IS_NULL) {
+ if (isset && Z_TYPE_P(value) == IS_NULL) {
result = 0;
} else {
result = isset;
}
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (!isset || !i_zend_is_true(*value TSRMLS_CC)) {
+ if (!isset || !i_zend_is_true(value TSRMLS_CC)) {
result = 0;
} else {
result = 1;
@@ -24143,7 +23254,7 @@ num_index_prop:
}
}
if (0) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
}
@@ -24154,8 +23265,7 @@ num_index_prop:
if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */
|| (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
&& IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) {
- ZVAL_COPY_VALUE(&tmp, offset);
- zval_copy_ctor(&tmp);
+ ZVAL_DUP(&tmp, offset);
convert_to_long(&tmp);
offset = &tmp;
} else {
@@ -24179,14 +23289,13 @@ num_index_prop:
}
- Z_TYPE(EX_T(opline->result.var).tmp_var) = IS_BOOL;
if (opline->extended_value & ZEND_ISSET) {
- Z_LVAL(EX_T(opline->result.var).tmp_var) = result;
+ ZVAL_BOOL(EX_VAR(opline->result.var), result);
} else {
- Z_LVAL(EX_T(opline->result.var).tmp_var) = !result;
+ ZVAL_BOOL(EX_VAR(opline->result.var), !result);
}
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -24204,6 +23313,9 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_VAR_CV_HANDLER(ZEND_O
static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
+//???
+return 0;
+#if 0
USE_OPLINE
/* The generator object is stored in return_value_ptr_ptr */
@@ -24246,7 +23358,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG
generator->value = copy;
} else {
- zval **value_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
+ zval **value_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W);
if (IS_VAR == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
@@ -24268,14 +23380,14 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG
generator->value = *value_ptr;
}
- if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);};
+ if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);};
}
} else {
zval *value = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
/* Consts, temporary variables and references need copying */
if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR
- || PZVAL_IS_REF(value)
+ || Z_ISREF_P(value)
) {
zval *copy;
@@ -24288,7 +23400,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG
}
generator->value = copy;
- zval_ptr_dtor_nogc(&free_op1.var);
+ zval_ptr_dtor_nogc(free_op1.var);
} else {
if (IS_VAR == IS_CV) {
Z_ADDREF_P(value);
@@ -24309,7 +23421,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG
/* Consts, temporary variables and references need copying */
if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR
- || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0)
+ || (Z_ISREF_P(key) && Z_REFCOUNT_P(key) > 0)
) {
zval *copy;
@@ -24360,6 +23472,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG
SAVE_OPLINE();
ZEND_VM_RETURN();
+#endif
}
static int ZEND_FASTCALL ZEND_CLONE_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -24398,29 +23511,22 @@ static int ZEND_FASTCALL ZEND_CLONE_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARG
/* Ensure that if we're calling a private function, we're allowed to do so.
*/
if (UNEXPECTED(ce != EG(scope))) {
- zend_error_noreturn(E_ERROR, "Call to private %s::__clone() from context '%s'", ce->name, EG(scope) ? EG(scope)->name : "");
+ zend_error_noreturn(E_ERROR, "Call to private %s::__clone() from context '%s'", ce->name->val, EG(scope) ? EG(scope)->name->val : "");
}
} else if ((clone->common.fn_flags & ZEND_ACC_PROTECTED)) {
/* Ensure that if we're calling a protected function, we're allowed to do so.
*/
if (UNEXPECTED(!zend_check_protected(zend_get_function_root_class(clone), EG(scope)))) {
- zend_error_noreturn(E_ERROR, "Call to protected %s::__clone() from context '%s'", ce->name, EG(scope) ? EG(scope)->name : "");
+ zend_error_noreturn(E_ERROR, "Call to protected %s::__clone() from context '%s'", ce->name->val, EG(scope) ? EG(scope)->name->val : "");
}
}
}
if (EXPECTED(EG(exception) == NULL)) {
- zval *retval;
-
- ALLOC_ZVAL(retval);
- Z_OBJVAL_P(retval) = clone_call(obj TSRMLS_CC);
- Z_TYPE_P(retval) = IS_OBJECT;
- Z_SET_REFCOUNT_P(retval, 1);
- Z_SET_ISREF_P(retval);
+ ZVAL_OBJ(EX_VAR(opline->result.var), clone_call(obj TSRMLS_CC));
+//??? Z_SET_ISREF_P(retval);
if (!RETURN_VALUE_USED(opline) || UNEXPECTED(EG(exception) != NULL)) {
- zval_ptr_dtor(&retval);
- } else {
- EX_T(opline->result.var).var.ptr = retval;
+ zval_ptr_dtor(EX_VAR(opline->result.var));
}
}
@@ -24454,18 +23560,16 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_CONST(int
{
USE_OPLINE
zend_free_op free_op_data1;
- zval **object_ptr = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
- zval *object;
+ zval *object = _get_obj_zval_ptr_unused(TSRMLS_C);
zval *property = opline->op2.zv;
zval *value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
int have_get_ptr = 0;
- if (IS_UNUSED == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- make_real_object(object_ptr TSRMLS_CC);
- object = *object_ptr;
+ make_real_object(object TSRMLS_CC);
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to assign property of non-object");
@@ -24473,8 +23577,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_CONST(int
FREE_OP(free_op_data1);
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
} else {
/* here we are sure we are dealing with an object */
@@ -24485,15 +23588,14 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_CONST(int
/* here property is a string */
if (opline->extended_value == ZEND_ASSIGN_OBJ
&& Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval **zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
have_get_ptr = 1;
- binary_op(*zptr, *zptr, value TSRMLS_CC);
+ binary_op(zptr, zptr, value TSRMLS_CC);
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(*zptr);
- EX_T(opline->result.var).var.ptr = *zptr;
+ ZVAL_COPY(EX_VAR(opline->result.var), zptr);
}
}
}
@@ -24517,12 +23619,11 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_CONST(int
if (Z_REFCOUNT_P(z) == 0) {
GC_REMOVE_ZVAL_FROM_BUFFER(z);
zval_dtor(z);
- FREE_ZVAL(z);
}
z = value;
}
Z_ADDREF_P(z);
- SEPARATE_ZVAL_IF_NOT_REF(&z);
+ SEPARATE_ZVAL_IF_NOT_REF(z);
binary_op(z, z, value TSRMLS_CC);
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
@@ -24530,21 +23631,19 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_CONST(int
Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(z);
- EX_T(opline->result.var).var.ptr = z;
+ ZVAL_COPY(EX_VAR(opline->result.var), z);
}
- zval_ptr_dtor(&z);
+ zval_ptr_dtor(z);
} else {
zend_error(E_WARNING, "Attempt to assign property of non-object");
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
}
}
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
}
@@ -24561,7 +23660,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_UNUSED_CONST(int (*bi
{
USE_OPLINE
zend_free_op free_op_data2, free_op_data1;
- zval **var_ptr;
+ zval *var_ptr;
zval *value;
SAVE_OPLINE();
@@ -24570,21 +23669,21 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_UNUSED_CONST(int (*bi
return zend_binary_assign_op_obj_helper_SPEC_UNUSED_CONST(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
break;
case ZEND_ASSIGN_DIM: {
- zval **container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
+ zval *container = _get_obj_zval_ptr_unused(TSRMLS_C);
- if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- } else if (UNEXPECTED(Z_TYPE_PP(container) == IS_OBJECT)) {
+ } else if (UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
if (IS_UNUSED == IS_VAR && !0) {
- Z_ADDREF_PP(container); /* undo the effect of get_obj_zval_ptr_ptr() */
+ Z_ADDREF_P(container); /* undo the effect of get_obj_zval_ptr_ptr() */
}
return zend_binary_assign_op_obj_helper_SPEC_UNUSED_CONST(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
} else {
zval *dim = opline->op2.zv;
- zend_fetch_dimension_address(&EX_T((opline+1)->op2.var), container, dim, IS_CONST, BP_VAR_RW TSRMLS_CC);
+ zend_fetch_dimension_address(EX_VAR((opline+1)->op2.var), container, dim, IS_CONST, BP_VAR_RW TSRMLS_CC);
value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
- var_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
+ var_ptr = _get_zval_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
}
}
break;
@@ -24595,14 +23694,13 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_UNUSED_CONST(int (*bi
break;
}
- if (UNEXPECTED(var_ptr == NULL)) {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
}
- if (UNEXPECTED(*var_ptr == &EG(error_zval))) {
+ if (UNEXPECTED(var_ptr == &EG(error_zval))) {
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
@@ -24615,22 +23713,21 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_UNUSED_CONST(int (*bi
SEPARATE_ZVAL_IF_NOT_REF(var_ptr);
- if (UNEXPECTED(Z_TYPE_PP(var_ptr) == IS_OBJECT)
- && Z_OBJ_HANDLER_PP(var_ptr, get)
- && Z_OBJ_HANDLER_PP(var_ptr, set)) {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_OBJECT)
+ && Z_OBJ_HANDLER_P(var_ptr, get)
+ && Z_OBJ_HANDLER_P(var_ptr, set)) {
/* proxy object */
- zval *objval = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC);
+ zval *objval = Z_OBJ_HANDLER_P(var_ptr, get)(var_ptr TSRMLS_CC);
Z_ADDREF_P(objval);
binary_op(objval, objval, value TSRMLS_CC);
- Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, objval TSRMLS_CC);
- zval_ptr_dtor(&objval);
+ Z_OBJ_HANDLER_P(var_ptr, set)(var_ptr, objval TSRMLS_CC);
+ zval_ptr_dtor(objval);
} else {
- binary_op(*var_ptr, *var_ptr, value TSRMLS_CC);
+ binary_op(var_ptr, var_ptr, value TSRMLS_CC);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(*var_ptr);
- EX_T(opline->result.var).var.ptr = *var_ptr;
+ ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
if (opline->extended_value == ZEND_ASSIGN_DIM) {
@@ -24705,30 +23802,27 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_UNUSED_CONST(incde
{
USE_OPLINE
- zval **object_ptr;
zval *object;
zval *property;
- zval **retval;
+ zval *retval;
int have_get_ptr = 0;
SAVE_OPLINE();
- object_ptr = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
+ object = _get_obj_zval_ptr_unused(TSRMLS_C);
property = opline->op2.zv;
- retval = &EX_T(opline->result.var).var.ptr;
+ retval = EX_VAR(opline->result.var);
- if (IS_UNUSED == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
- object = *object_ptr;
+ make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- *retval = &EG(uninitialized_zval);
+ ZVAL_NULL(retval);
}
CHECK_EXCEPTION();
@@ -24742,15 +23836,14 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_UNUSED_CONST(incde
}
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval **zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
have_get_ptr = 1;
- incdec_op(*zptr);
+ incdec_op(zptr);
if (RETURN_VALUE_USED(opline)) {
- *retval = *zptr;
- PZVAL_LOCK(*retval);
+ ZVAL_COPY(retval, zptr);
}
}
}
@@ -24765,28 +23858,26 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_UNUSED_CONST(incde
if (Z_REFCOUNT_P(z) == 0) {
GC_REMOVE_ZVAL_FROM_BUFFER(z);
zval_dtor(z);
- FREE_ZVAL(z);
}
z = value;
}
Z_ADDREF_P(z);
- SEPARATE_ZVAL_IF_NOT_REF(&z);
+ SEPARATE_ZVAL_IF_NOT_REF(z);
incdec_op(z);
- *retval = z;
+ ZVAL_COPY_VALUE(retval, z);
Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- SELECTIVE_PZVAL_LOCK(*retval, opline);
- zval_ptr_dtor(&z);
+ SELECTIVE_PZVAL_LOCK(retval, opline);
+ zval_ptr_dtor(z);
} else {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- *retval = &EG(uninitialized_zval);
+ ZVAL_NULL(retval);
}
}
}
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
}
@@ -24809,23 +23900,21 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_CONST(incd
{
USE_OPLINE
- zval **object_ptr;
zval *object;
zval *property;
zval *retval;
int have_get_ptr = 0;
SAVE_OPLINE();
- object_ptr = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
+ object = _get_obj_zval_ptr_unused(TSRMLS_C);
property = opline->op2.zv;
- retval = &EX_T(opline->result.var).tmp_var;
+ retval = EX_VAR(opline->result.var);
- if (IS_UNUSED == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
- object = *object_ptr;
+ make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
@@ -24843,15 +23932,14 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_CONST(incd
}
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval **zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
have_get_ptr = 1;
SEPARATE_ZVAL_IF_NOT_REF(zptr);
- ZVAL_COPY_VALUE(retval, *zptr);
- zendi_zval_copy_ctor(*retval);
+ ZVAL_DUP(retval, zptr);
- incdec_op(*zptr);
+ incdec_op(zptr);
}
}
@@ -24859,7 +23947,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_CONST(incd
if (!have_get_ptr) {
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- zval *z_copy;
+ zval z_copy;
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC);
@@ -24867,20 +23955,16 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_CONST(incd
if (Z_REFCOUNT_P(z) == 0) {
GC_REMOVE_ZVAL_FROM_BUFFER(z);
zval_dtor(z);
- FREE_ZVAL(z);
}
z = value;
}
- ZVAL_COPY_VALUE(retval, z);
- zendi_zval_copy_ctor(*retval);
- ALLOC_ZVAL(z_copy);
- INIT_PZVAL_COPY(z_copy, z);
- zendi_zval_copy_ctor(*z_copy);
- incdec_op(z_copy);
+ ZVAL_DUP(retval, z);
+ ZVAL_DUP(&z_copy, z);
+ incdec_op(&z_copy);
Z_ADDREF_P(z);
- Z_OBJ_HT_P(object)->write_property(object, property, z_copy, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(object)->write_property(object, property, &z_copy, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval_ptr_dtor(&z_copy);
- zval_ptr_dtor(&z);
+ zval_ptr_dtor(z);
} else {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
ZVAL_NULL(retval);
@@ -24888,7 +23972,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_CONST(incd
}
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
}
@@ -24922,8 +24006,7 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_UNUSED_CON
if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
zend_error(E_NOTICE, "Trying to get property of non-object");
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
} else {
zval *retval;
@@ -24935,11 +24018,10 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_UNUSED_CON
/* here we are sure we are dealing with an object */
retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_R, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- PZVAL_LOCK(retval);
- EX_T(opline->result.var).var.ptr = retval;
+ ZVAL_COPY(EX_VAR(opline->result.var), retval);
if (0) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
}
@@ -24959,7 +24041,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE
USE_OPLINE
zend_free_op free_op1;
zval *property;
- zval **container;
+ zval *container;
SAVE_OPLINE();
property = opline->op2.zv;
@@ -24967,30 +24049,30 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE
if (0) {
MAKE_REAL_ZVAL_PTR(property);
}
- container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
- if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
+ container = _get_obj_zval_ptr_unused(TSRMLS_C);
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(&EX_T(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
}
- if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
+//??? if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
/* We are going to assign the result by reference */
if (opline->extended_value & ZEND_FETCH_MAKE_REF) {
- zval **retval_ptr = EX_T(opline->result.var).var.ptr_ptr;
+ zval *retval_ptr = EX_VAR(opline->result.var);
- Z_DELREF_PP(retval_ptr);
+ Z_DELREF_P(retval_ptr);
SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
- Z_ADDREF_PP(retval_ptr);
- EX_T(opline->result.var).var.ptr = *EX_T(opline->result.var).var.ptr_ptr;
- EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
+ Z_ADDREF_P(retval_ptr);
+//??? EX_T(opline->result.var).var.ptr = *EX_T(opline->result.var).var.ptr_ptr;
+//??? EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
}
CHECK_EXCEPTION();
@@ -25002,27 +24084,27 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCOD
USE_OPLINE
zend_free_op free_op1;
zval *property;
- zval **container;
+ zval *container;
SAVE_OPLINE();
property = opline->op2.zv;
- container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
+ container = _get_obj_zval_ptr_unused(TSRMLS_C);
if (0) {
MAKE_REAL_ZVAL_PTR(property);
}
- if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(&EX_T(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_RW TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_RW TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
}
- if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
+//??? if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -25042,8 +24124,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCOD
if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
} else {
zval *retval;
@@ -25055,11 +24136,10 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCOD
/* here we are sure we are dealing with an object */
retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_IS, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- PZVAL_LOCK(retval);
- EX_T(opline->result.var).var.ptr = retval;
+ ZVAL_COPY(EX_VAR(opline->result.var), retval);
if (0) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
}
@@ -25072,32 +24152,32 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCOD
static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
+ zval *container;
if (zend_is_by_ref_func_arg_fetch(opline, EX(call) TSRMLS_CC)) {
/* Behave like FETCH_OBJ_W */
zend_free_op free_op1;
zval *property;
- zval **container;
SAVE_OPLINE();
property = opline->op2.zv;
- container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
+ container = _get_obj_zval_ptr_unused(TSRMLS_C);
if (0) {
MAKE_REAL_ZVAL_PTR(property);
}
- if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(&EX_T(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
}
- if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
+//??? if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -25110,39 +24190,37 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_CONST_HANDLER(ZEND_OP
{
USE_OPLINE
zend_free_op free_op1, free_res;
- zval **container;
+ zval *container;
zval *property;
SAVE_OPLINE();
- container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
+ container = _get_obj_zval_ptr_unused(TSRMLS_C);
property = opline->op2.zv;
if (IS_UNUSED == IS_CV) {
- if (container != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(container);
- }
+ SEPARATE_ZVAL_IF_NOT_REF(container);
}
if (0) {
MAKE_REAL_ZVAL_PTR(property);
}
- if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(&EX_T(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_UNSET TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_UNSET TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
}
- if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
+//??? if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
- PZVAL_UNLOCK(*EX_T(opline->result.var).var.ptr_ptr, &free_res);
- if (EX_T(opline->result.var).var.ptr_ptr != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(EX_T(opline->result.var).var.ptr_ptr);
- }
- PZVAL_LOCK(*EX_T(opline->result.var).var.ptr_ptr);
+//??? PZVAL_UNLOCK(EX_VAR(opline->result.var), &free_res);
+//??? if (EX_T(opline->result.var).var.ptr_ptr != &EG(uninitialized_zval_ptr)) {
+//??? SEPARATE_ZVAL_IF_NOT_REF(EX_T(opline->result.var).var.ptr_ptr);
+//??? }
+//??? PZVAL_LOCK(EX_VAR(opline->result.var));
FREE_OP_VAR_PTR(free_res);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -25152,22 +24230,22 @@ static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_
{
USE_OPLINE
- zval **object_ptr;
+ zval *object;
zval *property_name;
SAVE_OPLINE();
- object_ptr = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
+ object = _get_obj_zval_ptr_unused(TSRMLS_C);
property_name = opline->op2.zv;
if (0) {
MAKE_REAL_ZVAL_PTR(property_name);
}
- if (IS_UNUSED == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_assign_to_object(RETURN_VALUE_USED(opline)?&EX_T(opline->result.var).var.ptr:NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&property_name);
+ zval_ptr_dtor(property_name);
} else {
}
@@ -25181,17 +24259,13 @@ static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_
static int ZEND_FASTCALL ZEND_ADD_CHAR_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zval *str = &EX_T(opline->result.var).tmp_var;
+ zval *str = EX_VAR(opline->result.var);
SAVE_OPLINE();
if (IS_UNUSED == IS_UNUSED) {
/* Initialize for erealloc in add_char_to_string */
- Z_STRVAL_P(str) = NULL;
- Z_STRLEN_P(str) = 0;
- Z_TYPE_P(str) = IS_STRING;
-
- INIT_PZVAL(str);
+ ZVAL_STR(str, STR_EMPTY_ALLOC());
}
add_char_to_string(str, str, opline->op2.zv);
@@ -25204,17 +24278,13 @@ static int ZEND_FASTCALL ZEND_ADD_CHAR_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HA
static int ZEND_FASTCALL ZEND_ADD_STRING_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zval *str = &EX_T(opline->result.var).tmp_var;
+ zval *str = EX_VAR(opline->result.var);
SAVE_OPLINE();
if (IS_UNUSED == IS_UNUSED) {
/* Initialize for erealloc in add_string_to_string */
- Z_STRVAL_P(str) = NULL;
- Z_STRLEN_P(str) = 0;
- Z_TYPE_P(str) = IS_STRING;
-
- INIT_PZVAL(str);
+ ZVAL_STR(str, STR_EMPTY_ALLOC());
}
add_string_to_string(str, str, opline->op2.zv);
@@ -25228,8 +24298,6 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CONST_HANDLER(ZEND_O
{
USE_OPLINE
zval *function_name;
- char *function_name_strval;
- int function_name_strlen;
call_slot *call = EX(call_slots) + opline->result.num;
@@ -25245,32 +24313,29 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CONST_HANDLER(ZEND_O
zend_error_noreturn(E_ERROR, "Method name must be a string");
}
- function_name_strval = Z_STRVAL_P(function_name);
- function_name_strlen = Z_STRLEN_P(function_name);
+ ZVAL_COPY_VALUE(&call->object, _get_obj_zval_ptr_unused(TSRMLS_C));
- call->object = _get_obj_zval_ptr_unused(TSRMLS_C);
-
- if (EXPECTED(call->object != NULL) &&
- EXPECTED(Z_TYPE_P(call->object) == IS_OBJECT)) {
- call->called_scope = Z_OBJCE_P(call->object);
+ if (EXPECTED(Z_TYPE(call->object) != IS_UNDEF) &&
+ EXPECTED(Z_TYPE(call->object) == IS_OBJECT)) {
+ call->called_scope = Z_OBJCE(call->object);
if (IS_CONST != IS_CONST ||
(call->fbc = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope)) == NULL) {
- zval *object = call->object;
+ zend_object *object = Z_OBJ(call->object);
- if (UNEXPECTED(Z_OBJ_HT_P(call->object)->get_method == NULL)) {
+ if (UNEXPECTED(Z_OBJ_HT(call->object)->get_method == NULL)) {
zend_error_noreturn(E_ERROR, "Object does not support method calls");
}
/* First, locate the function. */
- call->fbc = Z_OBJ_HT_P(call->object)->get_method(&call->object, function_name_strval, function_name_strlen, ((IS_CONST == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
+ call->fbc = Z_OBJ_HT(call->object)->get_method(&call->object, Z_STR_P(function_name), ((IS_CONST == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
if (UNEXPECTED(call->fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(call->object), function_name_strval);
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(&call->object), Z_STRVAL_P(function_name));
}
if (IS_CONST == IS_CONST &&
EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0) &&
- EXPECTED(call->object == object)) {
+ EXPECTED(Z_OBJ(call->object) == object)) {
CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope, call->fbc);
}
}
@@ -25279,20 +24344,16 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CONST_HANDLER(ZEND_O
HANDLE_EXCEPTION();
}
- zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval);
+ zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", Z_STRVAL_P(function_name));
}
if ((call->fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) {
- call->object = NULL;
+ ZVAL_UNDEF(&call->object);
} else {
- if (!PZVAL_IS_REF(call->object)) {
- Z_ADDREF_P(call->object); /* For $this pointer */
+ if (!Z_ISREF(call->object)) {
+ Z_ADDREF(call->object); /* For $this pointer */
} else {
- zval *this_ptr;
- ALLOC_ZVAL(this_ptr);
- INIT_PZVAL_COPY(this_ptr, call->object);
- zval_copy_ctor(this_ptr);
- call->object = this_ptr;
+ ZVAL_DUP(&call->object, Z_REFVAL(call->object));
}
}
@@ -25326,7 +24387,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPC
}
/* non-qualified constant - allow text substitution */
zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", actual, actual);
- ZVAL_STRINGL(&EX_T(opline->result.var).tmp_var, actual, Z_STRLEN_P(opline->op2.zv)-(actual - Z_STRVAL_P(opline->op2.zv)), 1);
+ ZVAL_STRINGL(EX_VAR(opline->result.var), actual, Z_STRLEN_P(opline->op2.zv)-(actual - Z_STRVAL_P(opline->op2.zv)));
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
} else {
@@ -25335,27 +24396,25 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPC
} else {
CACHE_PTR(opline->op2.literal->cache_slot, c);
}
- retval = &EX_T(opline->result.var).tmp_var;
- ZVAL_COPY_VALUE(retval, &c->value);
- zval_copy_ctor(retval);
+ retval = EX_VAR(opline->result.var);
+ ZVAL_DUP(retval, &c->value);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
} else {
/* class constant */
zend_class_entry *ce;
- zval **value;
+ zval *value;
if (IS_UNUSED == IS_CONST) {
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
value = CACHED_PTR(opline->op2.literal->cache_slot);
- ZVAL_COPY_VALUE(&EX_T(opline->result.var).tmp_var, *value);
- zval_copy_ctor(&EX_T(opline->result.var).tmp_var);
+ ZVAL_DUP(EX_VAR(opline->result.var), value);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
} else if (CACHED_PTR(opline->op1.literal->cache_slot)) {
ce = CACHED_PTR(opline->op1.literal->cache_slot);
} else {
- ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
@@ -25365,17 +24424,16 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPC
CACHE_PTR(opline->op1.literal->cache_slot, ce);
}
} else {
- ce = EX_T(opline->op1.var).class_entry;
+ ce = Z_CE_P(EX_VAR(opline->op1.var));
if ((value = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce)) != NULL) {
- ZVAL_COPY_VALUE(&EX_T(opline->result.var).tmp_var, *value);
- zval_copy_ctor(&EX_T(opline->result.var).tmp_var);
+ ZVAL_DUP(EX_VAR(opline->result.var), value);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
}
- if (EXPECTED(zend_hash_quick_find(&ce->constants_table, Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv)+1, Z_HASH_P(opline->op2.zv), (void **) &value) == SUCCESS)) {
- if (IS_CONSTANT_TYPE(Z_TYPE_PP(value))) {
+ if (EXPECTED((value = zend_hash_find(&ce->constants_table, Z_STR_P(opline->op2.zv))) != NULL)) {
+ if (IS_CONSTANT_TYPE(Z_TYPE_P(value))) {
zend_class_entry *old_scope = EG(scope);
EG(scope) = ce;
@@ -25387,11 +24445,11 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPC
} else {
CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce, value);
}
- ZVAL_COPY_VALUE(&EX_T(opline->result.var).tmp_var, *value);
- zval_copy_ctor(&EX_T(opline->result.var).tmp_var);
+ ZVAL_DUP(EX_VAR(opline->result.var), value);
} else if (Z_STRLEN_P(opline->op2.zv) == sizeof("class")-1 && memcmp(Z_STRVAL_P(opline->op2.zv), "class", sizeof("class") - 1) == 0) {
/* "class" is assigned as a case-sensitive keyword from zend_do_resolve_class_name */
- ZVAL_STRINGL(&EX_T(opline->result.var).tmp_var, ce->name, ce->name_length, 1);
+ ZVAL_STR(EX_VAR(opline->result.var), ce->name);
+ STR_ADDREF(ce->name);
} else {
zend_error_noreturn(E_ERROR, "Undefined class constant '%s'", Z_STRVAL_P(opline->op2.zv));
}
@@ -25405,7 +24463,7 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_
{
USE_OPLINE
- array_init(&EX_T(opline->result.var).tmp_var);
+ array_init(EX_VAR(opline->result.var));
if (IS_UNUSED == IS_UNUSED) {
ZEND_VM_NEXT_OPCODE();
#if 0 || IS_UNUSED != IS_UNUSED
@@ -25419,21 +24477,21 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_H
{
USE_OPLINE
- zval **container;
+ zval *container;
zval *offset;
ulong hval;
SAVE_OPLINE();
- container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
- if (IS_UNUSED == IS_CV && container != &EG(uninitialized_zval_ptr)) {
+ container = _get_obj_zval_ptr_unused(TSRMLS_C);
+ if (IS_UNUSED == IS_CV) {
SEPARATE_ZVAL_IF_NOT_REF(container);
}
offset = opline->op2.zv;
if (IS_UNUSED != IS_VAR || container) {
- switch (Z_TYPE_PP(container)) {
+ switch (Z_TYPE_P(container)) {
case IS_ARRAY: {
- HashTable *ht = Z_ARRVAL_PP(container);
+ HashTable *ht = Z_ARRVAL_P(container);
switch (Z_TYPE_P(offset)) {
case IS_DOUBLE:
@@ -25450,29 +24508,26 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_H
if (IS_CONST == IS_CV || IS_CONST == IS_VAR) {
Z_ADDREF_P(offset);
}
- if (IS_CONST == IS_CONST) {
- hval = Z_HASH_P(offset);
- } else {
+ if (IS_CONST != IS_CONST) {
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim);
- hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset));
}
- if (ht == &EG(symbol_table)) {
- zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC);
+ if (ht == &EG(symbol_table).ht) {
+ zend_delete_global_variable(Z_STR_P(offset) TSRMLS_CC);
} else {
- zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval);
+ zend_hash_del(ht, Z_STR_P(offset));
}
if (IS_CONST == IS_CV || IS_CONST == IS_VAR) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
}
break;
num_index_dim:
zend_hash_index_del(ht, hval);
if (IS_CONST == IS_CV || IS_CONST == IS_VAR) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
}
break;
case IS_NULL:
- zend_hash_del(ht, "", sizeof(""));
+ zend_hash_del(ht, STR_EMPTY_ALLOC());
break;
default:
zend_error(E_WARNING, "Illegal offset type in unset");
@@ -25482,15 +24537,15 @@ num_index_dim:
break;
}
case IS_OBJECT:
- if (UNEXPECTED(Z_OBJ_HT_P(*container)->unset_dimension == NULL)) {
+ if (UNEXPECTED(Z_OBJ_HT_P(container)->unset_dimension == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use object as array");
}
if (0) {
MAKE_REAL_ZVAL_PTR(offset);
}
- Z_OBJ_HT_P(*container)->unset_dimension(*container, offset TSRMLS_CC);
+ Z_OBJ_HT_P(container)->unset_dimension(container, offset TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
}
@@ -25514,28 +24569,28 @@ static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_H
{
USE_OPLINE
- zval **container;
+ zval *container;
zval *offset;
SAVE_OPLINE();
- container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
+ container = _get_obj_zval_ptr_unused(TSRMLS_C);
offset = opline->op2.zv;
if (IS_UNUSED != IS_VAR || container) {
- if (IS_UNUSED == IS_CV && container != &EG(uninitialized_zval_ptr)) {
+ if (IS_UNUSED == IS_CV) {
SEPARATE_ZVAL_IF_NOT_REF(container);
}
- if (Z_TYPE_PP(container) == IS_OBJECT) {
+ if (Z_TYPE_P(container) == IS_OBJECT) {
if (0) {
MAKE_REAL_ZVAL_PTR(offset);
}
- if (Z_OBJ_HT_P(*container)->unset_property) {
- Z_OBJ_HT_P(*container)->unset_property(*container, offset, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ if (Z_OBJ_HT_P(container)->unset_property) {
+ Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to unset property of non-object");
}
if (0) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
}
@@ -25555,7 +24610,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CON
USE_OPLINE
zval *container;
- zval **value = NULL;
+ zval *value;
int result = 0;
ulong hval;
zval *offset;
@@ -25579,23 +24634,20 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CON
case IS_LONG:
hval = Z_LVAL_P(offset);
num_index_prop:
- if (zend_hash_index_find(ht, hval, (void **) &value) == SUCCESS) {
+ if ((value = zend_hash_index_find(ht, hval)) != NULL) {
isset = 1;
}
break;
case IS_STRING:
- if (IS_CONST == IS_CONST) {
- hval = Z_HASH_P(offset);
- } else {
+ if (IS_CONST != IS_CONST) {
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop);
- hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset));
}
- if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) {
+ if ((value = zend_hash_find(ht, Z_STR_P(offset))) != NULL) {
isset = 1;
}
break;
case IS_NULL:
- if (zend_hash_find(ht, "", sizeof(""), (void **) &value) == SUCCESS) {
+ if ((value = zend_hash_find(ht, STR_EMPTY_ALLOC())) != NULL) {
isset = 1;
}
break;
@@ -25605,13 +24657,13 @@ num_index_prop:
}
if (opline->extended_value & ZEND_ISSET) {
- if (isset && Z_TYPE_PP(value) == IS_NULL) {
+ if (isset && Z_TYPE_P(value) == IS_NULL) {
result = 0;
} else {
result = isset;
}
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (!isset || !i_zend_is_true(*value TSRMLS_CC)) {
+ if (!isset || !i_zend_is_true(value TSRMLS_CC)) {
result = 0;
} else {
result = 1;
@@ -25638,7 +24690,7 @@ num_index_prop:
}
}
if (0) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
}
@@ -25649,8 +24701,7 @@ num_index_prop:
if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */
|| (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
&& IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) {
- ZVAL_COPY_VALUE(&tmp, offset);
- zval_copy_ctor(&tmp);
+ ZVAL_DUP(&tmp, offset);
convert_to_long(&tmp);
offset = &tmp;
} else {
@@ -25674,11 +24725,10 @@ num_index_prop:
}
- Z_TYPE(EX_T(opline->result.var).tmp_var) = IS_BOOL;
if (opline->extended_value & ZEND_ISSET) {
- Z_LVAL(EX_T(opline->result.var).tmp_var) = result;
+ ZVAL_BOOL(EX_VAR(opline->result.var), result);
} else {
- Z_LVAL(EX_T(opline->result.var).tmp_var) = !result;
+ ZVAL_BOOL(EX_VAR(opline->result.var), !result);
}
CHECK_EXCEPTION();
@@ -25697,6 +24747,9 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_UNUSED_CONST_HANDLER(
static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
+//???
+return 0;
+#if 0
USE_OPLINE
/* The generator object is stored in return_value_ptr_ptr */
@@ -25739,7 +24792,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDL
generator->value = copy;
} else {
- zval **value_ptr = NULL;
+ zval **value_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W);
if (IS_UNUSED == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
@@ -25767,7 +24820,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDL
/* Consts, temporary variables and references need copying */
if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR
- || PZVAL_IS_REF(value)
+ || Z_ISREF_P(value)
) {
zval *copy;
@@ -25801,7 +24854,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDL
/* Consts, temporary variables and references need copying */
if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR
- || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0)
+ || (Z_ISREF_P(key) && Z_REFCOUNT_P(key) > 0)
) {
zval *copy;
@@ -25852,24 +24905,23 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDL
SAVE_OPLINE();
ZEND_VM_RETURN();
+#endif
}
static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_TMP(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
zend_free_op free_op2, free_op_data1;
- zval **object_ptr = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
- zval *object;
+ zval *object = _get_obj_zval_ptr_unused(TSRMLS_C);
zval *property = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
zval *value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
int have_get_ptr = 0;
- if (IS_UNUSED == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- make_real_object(object_ptr TSRMLS_CC);
- object = *object_ptr;
+ make_real_object(object TSRMLS_CC);
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to assign property of non-object");
@@ -25877,8 +24929,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_TMP(int (*
FREE_OP(free_op_data1);
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
} else {
/* here we are sure we are dealing with an object */
@@ -25889,15 +24940,14 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_TMP(int (*
/* here property is a string */
if (opline->extended_value == ZEND_ASSIGN_OBJ
&& Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval **zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
have_get_ptr = 1;
- binary_op(*zptr, *zptr, value TSRMLS_CC);
+ binary_op(zptr, zptr, value TSRMLS_CC);
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(*zptr);
- EX_T(opline->result.var).var.ptr = *zptr;
+ ZVAL_COPY(EX_VAR(opline->result.var), zptr);
}
}
}
@@ -25921,12 +24971,11 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_TMP(int (*
if (Z_REFCOUNT_P(z) == 0) {
GC_REMOVE_ZVAL_FROM_BUFFER(z);
zval_dtor(z);
- FREE_ZVAL(z);
}
z = value;
}
Z_ADDREF_P(z);
- SEPARATE_ZVAL_IF_NOT_REF(&z);
+ SEPARATE_ZVAL_IF_NOT_REF(z);
binary_op(z, z, value TSRMLS_CC);
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
@@ -25934,21 +24983,19 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_TMP(int (*
Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(z);
- EX_T(opline->result.var).var.ptr = z;
+ ZVAL_COPY(EX_VAR(opline->result.var), z);
}
- zval_ptr_dtor(&z);
+ zval_ptr_dtor(z);
} else {
zend_error(E_WARNING, "Attempt to assign property of non-object");
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
}
}
if (1) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
zval_dtor(free_op2.var);
}
@@ -25965,7 +25012,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_UNUSED_TMP(int (*bina
{
USE_OPLINE
zend_free_op free_op2, free_op_data2, free_op_data1;
- zval **var_ptr;
+ zval *var_ptr;
zval *value;
SAVE_OPLINE();
@@ -25974,21 +25021,21 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_UNUSED_TMP(int (*bina
return zend_binary_assign_op_obj_helper_SPEC_UNUSED_TMP(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
break;
case ZEND_ASSIGN_DIM: {
- zval **container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
+ zval *container = _get_obj_zval_ptr_unused(TSRMLS_C);
- if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- } else if (UNEXPECTED(Z_TYPE_PP(container) == IS_OBJECT)) {
+ } else if (UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
if (IS_UNUSED == IS_VAR && !0) {
- Z_ADDREF_PP(container); /* undo the effect of get_obj_zval_ptr_ptr() */
+ Z_ADDREF_P(container); /* undo the effect of get_obj_zval_ptr_ptr() */
}
return zend_binary_assign_op_obj_helper_SPEC_UNUSED_TMP(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
} else {
zval *dim = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- zend_fetch_dimension_address(&EX_T((opline+1)->op2.var), container, dim, IS_TMP_VAR, BP_VAR_RW TSRMLS_CC);
+ zend_fetch_dimension_address(EX_VAR((opline+1)->op2.var), container, dim, IS_TMP_VAR, BP_VAR_RW TSRMLS_CC);
value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
- var_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
+ var_ptr = _get_zval_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
}
}
break;
@@ -25999,14 +25046,13 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_UNUSED_TMP(int (*bina
break;
}
- if (UNEXPECTED(var_ptr == NULL)) {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
}
- if (UNEXPECTED(*var_ptr == &EG(error_zval))) {
+ if (UNEXPECTED(var_ptr == &EG(error_zval))) {
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
zval_dtor(free_op2.var);
@@ -26019,22 +25065,21 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_UNUSED_TMP(int (*bina
SEPARATE_ZVAL_IF_NOT_REF(var_ptr);
- if (UNEXPECTED(Z_TYPE_PP(var_ptr) == IS_OBJECT)
- && Z_OBJ_HANDLER_PP(var_ptr, get)
- && Z_OBJ_HANDLER_PP(var_ptr, set)) {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_OBJECT)
+ && Z_OBJ_HANDLER_P(var_ptr, get)
+ && Z_OBJ_HANDLER_P(var_ptr, set)) {
/* proxy object */
- zval *objval = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC);
+ zval *objval = Z_OBJ_HANDLER_P(var_ptr, get)(var_ptr TSRMLS_CC);
Z_ADDREF_P(objval);
binary_op(objval, objval, value TSRMLS_CC);
- Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, objval TSRMLS_CC);
- zval_ptr_dtor(&objval);
+ Z_OBJ_HANDLER_P(var_ptr, set)(var_ptr, objval TSRMLS_CC);
+ zval_ptr_dtor(objval);
} else {
- binary_op(*var_ptr, *var_ptr, value TSRMLS_CC);
+ binary_op(var_ptr, var_ptr, value TSRMLS_CC);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(*var_ptr);
- EX_T(opline->result.var).var.ptr = *var_ptr;
+ ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
zval_dtor(free_op2.var);
@@ -26110,30 +25155,27 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_UNUSED_TMP(incdec_
{
USE_OPLINE
zend_free_op free_op2;
- zval **object_ptr;
zval *object;
zval *property;
- zval **retval;
+ zval *retval;
int have_get_ptr = 0;
SAVE_OPLINE();
- object_ptr = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
+ object = _get_obj_zval_ptr_unused(TSRMLS_C);
property = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- retval = &EX_T(opline->result.var).var.ptr;
+ retval = EX_VAR(opline->result.var);
- if (IS_UNUSED == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
- object = *object_ptr;
+ make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
zval_dtor(free_op2.var);
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- *retval = &EG(uninitialized_zval);
+ ZVAL_NULL(retval);
}
CHECK_EXCEPTION();
@@ -26147,15 +25189,14 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_UNUSED_TMP(incdec_
}
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval **zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
have_get_ptr = 1;
- incdec_op(*zptr);
+ incdec_op(zptr);
if (RETURN_VALUE_USED(opline)) {
- *retval = *zptr;
- PZVAL_LOCK(*retval);
+ ZVAL_COPY(retval, zptr);
}
}
}
@@ -26170,28 +25211,26 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_UNUSED_TMP(incdec_
if (Z_REFCOUNT_P(z) == 0) {
GC_REMOVE_ZVAL_FROM_BUFFER(z);
zval_dtor(z);
- FREE_ZVAL(z);
}
z = value;
}
Z_ADDREF_P(z);
- SEPARATE_ZVAL_IF_NOT_REF(&z);
+ SEPARATE_ZVAL_IF_NOT_REF(z);
incdec_op(z);
- *retval = z;
+ ZVAL_COPY_VALUE(retval, z);
Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- SELECTIVE_PZVAL_LOCK(*retval, opline);
- zval_ptr_dtor(&z);
+ SELECTIVE_PZVAL_LOCK(retval, opline);
+ zval_ptr_dtor(z);
} else {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- *retval = &EG(uninitialized_zval);
+ ZVAL_NULL(retval);
}
}
}
if (1) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
zval_dtor(free_op2.var);
}
@@ -26214,23 +25253,21 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_TMP(incdec
{
USE_OPLINE
zend_free_op free_op2;
- zval **object_ptr;
zval *object;
zval *property;
zval *retval;
int have_get_ptr = 0;
SAVE_OPLINE();
- object_ptr = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
+ object = _get_obj_zval_ptr_unused(TSRMLS_C);
property = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- retval = &EX_T(opline->result.var).tmp_var;
+ retval = EX_VAR(opline->result.var);
- if (IS_UNUSED == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
- object = *object_ptr;
+ make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
@@ -26248,15 +25285,14 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_TMP(incdec
}
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval **zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
have_get_ptr = 1;
SEPARATE_ZVAL_IF_NOT_REF(zptr);
- ZVAL_COPY_VALUE(retval, *zptr);
- zendi_zval_copy_ctor(*retval);
+ ZVAL_DUP(retval, zptr);
- incdec_op(*zptr);
+ incdec_op(zptr);
}
}
@@ -26264,7 +25300,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_TMP(incdec
if (!have_get_ptr) {
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- zval *z_copy;
+ zval z_copy;
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC);
@@ -26272,20 +25308,16 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_TMP(incdec
if (Z_REFCOUNT_P(z) == 0) {
GC_REMOVE_ZVAL_FROM_BUFFER(z);
zval_dtor(z);
- FREE_ZVAL(z);
}
z = value;
}
- ZVAL_COPY_VALUE(retval, z);
- zendi_zval_copy_ctor(*retval);
- ALLOC_ZVAL(z_copy);
- INIT_PZVAL_COPY(z_copy, z);
- zendi_zval_copy_ctor(*z_copy);
- incdec_op(z_copy);
+ ZVAL_DUP(retval, z);
+ ZVAL_DUP(&z_copy, z);
+ incdec_op(&z_copy);
Z_ADDREF_P(z);
- Z_OBJ_HT_P(object)->write_property(object, property, z_copy, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(object)->write_property(object, property, &z_copy, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval_ptr_dtor(&z_copy);
- zval_ptr_dtor(&z);
+ zval_ptr_dtor(z);
} else {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
ZVAL_NULL(retval);
@@ -26293,7 +25325,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_TMP(incdec
}
if (1) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
zval_dtor(free_op2.var);
}
@@ -26327,8 +25359,7 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_UNUSED_TMP
if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
zend_error(E_NOTICE, "Trying to get property of non-object");
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
zval_dtor(free_op2.var);
} else {
zval *retval;
@@ -26340,11 +25371,10 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_UNUSED_TMP
/* here we are sure we are dealing with an object */
retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_R, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- PZVAL_LOCK(retval);
- EX_T(opline->result.var).var.ptr = retval;
+ ZVAL_COPY(EX_VAR(opline->result.var), retval);
if (1) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
zval_dtor(free_op2.var);
}
@@ -26364,7 +25394,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_H
USE_OPLINE
zend_free_op free_op1, free_op2;
zval *property;
- zval **container;
+ zval *container;
SAVE_OPLINE();
property = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
@@ -26372,30 +25402,30 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_H
if (1) {
MAKE_REAL_ZVAL_PTR(property);
}
- container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
- if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
+ container = _get_obj_zval_ptr_unused(TSRMLS_C);
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(&EX_T(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W TSRMLS_CC);
if (1) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
zval_dtor(free_op2.var);
}
- if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
+//??? if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
/* We are going to assign the result by reference */
if (opline->extended_value & ZEND_FETCH_MAKE_REF) {
- zval **retval_ptr = EX_T(opline->result.var).var.ptr_ptr;
+ zval *retval_ptr = EX_VAR(opline->result.var);
- Z_DELREF_PP(retval_ptr);
+ Z_DELREF_P(retval_ptr);
SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
- Z_ADDREF_PP(retval_ptr);
- EX_T(opline->result.var).var.ptr = *EX_T(opline->result.var).var.ptr_ptr;
- EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
+ Z_ADDREF_P(retval_ptr);
+//??? EX_T(opline->result.var).var.ptr = *EX_T(opline->result.var).var.ptr_ptr;
+//??? EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
}
CHECK_EXCEPTION();
@@ -26407,27 +25437,27 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_
USE_OPLINE
zend_free_op free_op1, free_op2;
zval *property;
- zval **container;
+ zval *container;
SAVE_OPLINE();
property = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
+ container = _get_obj_zval_ptr_unused(TSRMLS_C);
if (1) {
MAKE_REAL_ZVAL_PTR(property);
}
- if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(&EX_T(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_RW TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_RW TSRMLS_CC);
if (1) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
zval_dtor(free_op2.var);
}
- if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
+//??? if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -26447,8 +25477,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_
if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
zval_dtor(free_op2.var);
} else {
zval *retval;
@@ -26460,11 +25489,10 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_
/* here we are sure we are dealing with an object */
retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_IS, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- PZVAL_LOCK(retval);
- EX_T(opline->result.var).var.ptr = retval;
+ ZVAL_COPY(EX_VAR(opline->result.var), retval);
if (1) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
zval_dtor(free_op2.var);
}
@@ -26477,32 +25505,32 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_
static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
+ zval *container;
if (zend_is_by_ref_func_arg_fetch(opline, EX(call) TSRMLS_CC)) {
/* Behave like FETCH_OBJ_W */
zend_free_op free_op1, free_op2;
zval *property;
- zval **container;
SAVE_OPLINE();
property = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
+ container = _get_obj_zval_ptr_unused(TSRMLS_C);
if (1) {
MAKE_REAL_ZVAL_PTR(property);
}
- if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(&EX_T(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W TSRMLS_CC);
if (1) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
zval_dtor(free_op2.var);
}
- if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
+//??? if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -26515,39 +25543,37 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCO
{
USE_OPLINE
zend_free_op free_op1, free_op2, free_res;
- zval **container;
+ zval *container;
zval *property;
SAVE_OPLINE();
- container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
+ container = _get_obj_zval_ptr_unused(TSRMLS_C);
property = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
if (IS_UNUSED == IS_CV) {
- if (container != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(container);
- }
+ SEPARATE_ZVAL_IF_NOT_REF(container);
}
if (1) {
MAKE_REAL_ZVAL_PTR(property);
}
- if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(&EX_T(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_UNSET TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_UNSET TSRMLS_CC);
if (1) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
zval_dtor(free_op2.var);
}
- if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
+//??? if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
- PZVAL_UNLOCK(*EX_T(opline->result.var).var.ptr_ptr, &free_res);
- if (EX_T(opline->result.var).var.ptr_ptr != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(EX_T(opline->result.var).var.ptr_ptr);
- }
- PZVAL_LOCK(*EX_T(opline->result.var).var.ptr_ptr);
+//??? PZVAL_UNLOCK(EX_VAR(opline->result.var), &free_res);
+//??? if (EX_T(opline->result.var).var.ptr_ptr != &EG(uninitialized_zval_ptr)) {
+//??? SEPARATE_ZVAL_IF_NOT_REF(EX_T(opline->result.var).var.ptr_ptr);
+//??? }
+//??? PZVAL_LOCK(EX_VAR(opline->result.var));
FREE_OP_VAR_PTR(free_res);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -26557,22 +25583,22 @@ static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HA
{
USE_OPLINE
zend_free_op free_op2;
- zval **object_ptr;
+ zval *object;
zval *property_name;
SAVE_OPLINE();
- object_ptr = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
+ object = _get_obj_zval_ptr_unused(TSRMLS_C);
property_name = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
if (1) {
MAKE_REAL_ZVAL_PTR(property_name);
}
- if (IS_UNUSED == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_assign_to_object(RETURN_VALUE_USED(opline)?&EX_T(opline->result.var).var.ptr:NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (1) {
- zval_ptr_dtor(&property_name);
+ zval_ptr_dtor(property_name);
} else {
zval_dtor(free_op2.var);
}
@@ -26587,7 +25613,7 @@ static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDL
{
USE_OPLINE
zend_free_op free_op2;
- zval *str = &EX_T(opline->result.var).tmp_var;
+ zval *str = EX_VAR(opline->result.var);
zval *var;
zval var_copy;
int use_copy = 0;
@@ -26597,11 +25623,7 @@ static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDL
if (IS_UNUSED == IS_UNUSED) {
/* Initialize for erealloc in add_string_to_string */
- Z_STRVAL_P(str) = NULL;
- Z_STRLEN_P(str) = 0;
- Z_TYPE_P(str) = IS_STRING;
-
- INIT_PZVAL(str);
+ ZVAL_STR(str, STR_EMPTY_ALLOC());
}
if (Z_TYPE_P(var) != IS_STRING) {
@@ -26632,8 +25654,6 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_TMP_HANDLER(ZEND_OPC
{
USE_OPLINE
zval *function_name;
- char *function_name_strval;
- int function_name_strlen;
zend_free_op free_op2;
call_slot *call = EX(call_slots) + opline->result.num;
@@ -26649,32 +25669,29 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_TMP_HANDLER(ZEND_OPC
zend_error_noreturn(E_ERROR, "Method name must be a string");
}
- function_name_strval = Z_STRVAL_P(function_name);
- function_name_strlen = Z_STRLEN_P(function_name);
-
- call->object = _get_obj_zval_ptr_unused(TSRMLS_C);
+ ZVAL_COPY_VALUE(&call->object, _get_obj_zval_ptr_unused(TSRMLS_C));
- if (EXPECTED(call->object != NULL) &&
- EXPECTED(Z_TYPE_P(call->object) == IS_OBJECT)) {
- call->called_scope = Z_OBJCE_P(call->object);
+ if (EXPECTED(Z_TYPE(call->object) != IS_UNDEF) &&
+ EXPECTED(Z_TYPE(call->object) == IS_OBJECT)) {
+ call->called_scope = Z_OBJCE(call->object);
if (IS_TMP_VAR != IS_CONST ||
(call->fbc = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope)) == NULL) {
- zval *object = call->object;
+ zend_object *object = Z_OBJ(call->object);
- if (UNEXPECTED(Z_OBJ_HT_P(call->object)->get_method == NULL)) {
+ if (UNEXPECTED(Z_OBJ_HT(call->object)->get_method == NULL)) {
zend_error_noreturn(E_ERROR, "Object does not support method calls");
}
/* First, locate the function. */
- call->fbc = Z_OBJ_HT_P(call->object)->get_method(&call->object, function_name_strval, function_name_strlen, ((IS_TMP_VAR == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
+ call->fbc = Z_OBJ_HT(call->object)->get_method(&call->object, Z_STR_P(function_name), ((IS_TMP_VAR == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
if (UNEXPECTED(call->fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(call->object), function_name_strval);
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(&call->object), Z_STRVAL_P(function_name));
}
if (IS_TMP_VAR == IS_CONST &&
EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0) &&
- EXPECTED(call->object == object)) {
+ EXPECTED(Z_OBJ(call->object) == object)) {
CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope, call->fbc);
}
}
@@ -26683,20 +25700,16 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_TMP_HANDLER(ZEND_OPC
zval_dtor(free_op2.var);
HANDLE_EXCEPTION();
}
- zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval);
+ zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", Z_STRVAL_P(function_name));
}
if ((call->fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) {
- call->object = NULL;
+ ZVAL_UNDEF(&call->object);
} else {
- if (!PZVAL_IS_REF(call->object)) {
- Z_ADDREF_P(call->object); /* For $this pointer */
+ if (!Z_ISREF(call->object)) {
+ Z_ADDREF(call->object); /* For $this pointer */
} else {
- zval *this_ptr;
- ALLOC_ZVAL(this_ptr);
- INIT_PZVAL_COPY(this_ptr, call->object);
- zval_copy_ctor(this_ptr);
- call->object = this_ptr;
+ ZVAL_DUP(&call->object, Z_REFVAL(call->object));
}
}
@@ -26714,7 +25727,7 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HA
{
USE_OPLINE
- array_init(&EX_T(opline->result.var).tmp_var);
+ array_init(EX_VAR(opline->result.var));
if (IS_UNUSED == IS_UNUSED) {
ZEND_VM_NEXT_OPCODE();
#if 0 || IS_UNUSED != IS_UNUSED
@@ -26728,21 +25741,21 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HAN
{
USE_OPLINE
zend_free_op free_op2;
- zval **container;
+ zval *container;
zval *offset;
ulong hval;
SAVE_OPLINE();
- container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
- if (IS_UNUSED == IS_CV && container != &EG(uninitialized_zval_ptr)) {
+ container = _get_obj_zval_ptr_unused(TSRMLS_C);
+ if (IS_UNUSED == IS_CV) {
SEPARATE_ZVAL_IF_NOT_REF(container);
}
offset = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
if (IS_UNUSED != IS_VAR || container) {
- switch (Z_TYPE_PP(container)) {
+ switch (Z_TYPE_P(container)) {
case IS_ARRAY: {
- HashTable *ht = Z_ARRVAL_PP(container);
+ HashTable *ht = Z_ARRVAL_P(container);
switch (Z_TYPE_P(offset)) {
case IS_DOUBLE:
@@ -26759,29 +25772,26 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HAN
if (IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) {
Z_ADDREF_P(offset);
}
- if (IS_TMP_VAR == IS_CONST) {
- hval = Z_HASH_P(offset);
- } else {
+ if (IS_TMP_VAR != IS_CONST) {
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim);
- hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset));
}
- if (ht == &EG(symbol_table)) {
- zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC);
+ if (ht == &EG(symbol_table).ht) {
+ zend_delete_global_variable(Z_STR_P(offset) TSRMLS_CC);
} else {
- zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval);
+ zend_hash_del(ht, Z_STR_P(offset));
}
if (IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
}
break;
num_index_dim:
zend_hash_index_del(ht, hval);
if (IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
}
break;
case IS_NULL:
- zend_hash_del(ht, "", sizeof(""));
+ zend_hash_del(ht, STR_EMPTY_ALLOC());
break;
default:
zend_error(E_WARNING, "Illegal offset type in unset");
@@ -26791,15 +25801,15 @@ num_index_dim:
break;
}
case IS_OBJECT:
- if (UNEXPECTED(Z_OBJ_HT_P(*container)->unset_dimension == NULL)) {
+ if (UNEXPECTED(Z_OBJ_HT_P(container)->unset_dimension == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use object as array");
}
if (1) {
MAKE_REAL_ZVAL_PTR(offset);
}
- Z_OBJ_HT_P(*container)->unset_dimension(*container, offset TSRMLS_CC);
+ Z_OBJ_HT_P(container)->unset_dimension(container, offset TSRMLS_CC);
if (1) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
zval_dtor(free_op2.var);
}
@@ -26823,28 +25833,28 @@ static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HAN
{
USE_OPLINE
zend_free_op free_op2;
- zval **container;
+ zval *container;
zval *offset;
SAVE_OPLINE();
- container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
+ container = _get_obj_zval_ptr_unused(TSRMLS_C);
offset = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
if (IS_UNUSED != IS_VAR || container) {
- if (IS_UNUSED == IS_CV && container != &EG(uninitialized_zval_ptr)) {
+ if (IS_UNUSED == IS_CV) {
SEPARATE_ZVAL_IF_NOT_REF(container);
}
- if (Z_TYPE_PP(container) == IS_OBJECT) {
+ if (Z_TYPE_P(container) == IS_OBJECT) {
if (1) {
MAKE_REAL_ZVAL_PTR(offset);
}
- if (Z_OBJ_HT_P(*container)->unset_property) {
- Z_OBJ_HT_P(*container)->unset_property(*container, offset, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ if (Z_OBJ_HT_P(container)->unset_property) {
+ Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to unset property of non-object");
}
if (1) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
zval_dtor(free_op2.var);
}
@@ -26864,7 +25874,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_TMP
USE_OPLINE
zend_free_op free_op2;
zval *container;
- zval **value = NULL;
+ zval *value;
int result = 0;
ulong hval;
zval *offset;
@@ -26888,23 +25898,20 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_TMP
case IS_LONG:
hval = Z_LVAL_P(offset);
num_index_prop:
- if (zend_hash_index_find(ht, hval, (void **) &value) == SUCCESS) {
+ if ((value = zend_hash_index_find(ht, hval)) != NULL) {
isset = 1;
}
break;
case IS_STRING:
- if (IS_TMP_VAR == IS_CONST) {
- hval = Z_HASH_P(offset);
- } else {
+ if (IS_TMP_VAR != IS_CONST) {
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop);
- hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset));
}
- if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) {
+ if ((value = zend_hash_find(ht, Z_STR_P(offset))) != NULL) {
isset = 1;
}
break;
case IS_NULL:
- if (zend_hash_find(ht, "", sizeof(""), (void **) &value) == SUCCESS) {
+ if ((value = zend_hash_find(ht, STR_EMPTY_ALLOC())) != NULL) {
isset = 1;
}
break;
@@ -26914,13 +25921,13 @@ num_index_prop:
}
if (opline->extended_value & ZEND_ISSET) {
- if (isset && Z_TYPE_PP(value) == IS_NULL) {
+ if (isset && Z_TYPE_P(value) == IS_NULL) {
result = 0;
} else {
result = isset;
}
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (!isset || !i_zend_is_true(*value TSRMLS_CC)) {
+ if (!isset || !i_zend_is_true(value TSRMLS_CC)) {
result = 0;
} else {
result = 1;
@@ -26947,7 +25954,7 @@ num_index_prop:
}
}
if (1) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
zval_dtor(free_op2.var);
}
@@ -26958,8 +25965,7 @@ num_index_prop:
if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */
|| (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
&& IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) {
- ZVAL_COPY_VALUE(&tmp, offset);
- zval_copy_ctor(&tmp);
+ ZVAL_DUP(&tmp, offset);
convert_to_long(&tmp);
offset = &tmp;
} else {
@@ -26983,11 +25989,10 @@ num_index_prop:
zval_dtor(free_op2.var);
}
- Z_TYPE(EX_T(opline->result.var).tmp_var) = IS_BOOL;
if (opline->extended_value & ZEND_ISSET) {
- Z_LVAL(EX_T(opline->result.var).tmp_var) = result;
+ ZVAL_BOOL(EX_VAR(opline->result.var), result);
} else {
- Z_LVAL(EX_T(opline->result.var).tmp_var) = !result;
+ ZVAL_BOOL(EX_VAR(opline->result.var), !result);
}
CHECK_EXCEPTION();
@@ -27006,6 +26011,9 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_UNUSED_TMP_HANDLER(ZE
static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
+//???
+return 0;
+#if 0
USE_OPLINE
/* The generator object is stored in return_value_ptr_ptr */
@@ -27048,7 +26056,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER
generator->value = copy;
} else {
- zval **value_ptr = NULL;
+ zval **value_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W);
if (IS_UNUSED == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
@@ -27076,7 +26084,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER
/* Consts, temporary variables and references need copying */
if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR
- || PZVAL_IS_REF(value)
+ || Z_ISREF_P(value)
) {
zval *copy;
@@ -27110,7 +26118,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER
/* Consts, temporary variables and references need copying */
if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR
- || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0)
+ || (Z_ISREF_P(key) && Z_REFCOUNT_P(key) > 0)
) {
zval *copy;
@@ -27161,33 +26169,31 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER
SAVE_OPLINE();
ZEND_VM_RETURN();
+#endif
}
static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_VAR(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
zend_free_op free_op2, free_op_data1;
- zval **object_ptr = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
- zval *object;
+ zval *object = _get_obj_zval_ptr_unused(TSRMLS_C);
zval *property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
zval *value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
int have_get_ptr = 0;
- if (IS_UNUSED == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- make_real_object(object_ptr TSRMLS_CC);
- object = *object_ptr;
+ make_real_object(object TSRMLS_CC);
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to assign property of non-object");
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
FREE_OP(free_op_data1);
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
} else {
/* here we are sure we are dealing with an object */
@@ -27198,15 +26204,14 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_VAR(int (*
/* here property is a string */
if (opline->extended_value == ZEND_ASSIGN_OBJ
&& Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval **zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
have_get_ptr = 1;
- binary_op(*zptr, *zptr, value TSRMLS_CC);
+ binary_op(zptr, zptr, value TSRMLS_CC);
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(*zptr);
- EX_T(opline->result.var).var.ptr = *zptr;
+ ZVAL_COPY(EX_VAR(opline->result.var), zptr);
}
}
}
@@ -27230,12 +26235,11 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_VAR(int (*
if (Z_REFCOUNT_P(z) == 0) {
GC_REMOVE_ZVAL_FROM_BUFFER(z);
zval_dtor(z);
- FREE_ZVAL(z);
}
z = value;
}
Z_ADDREF_P(z);
- SEPARATE_ZVAL_IF_NOT_REF(&z);
+ SEPARATE_ZVAL_IF_NOT_REF(z);
binary_op(z, z, value TSRMLS_CC);
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
@@ -27243,23 +26247,21 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_VAR(int (*
Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(z);
- EX_T(opline->result.var).var.ptr = z;
+ ZVAL_COPY(EX_VAR(opline->result.var), z);
}
- zval_ptr_dtor(&z);
+ zval_ptr_dtor(z);
} else {
zend_error(E_WARNING, "Attempt to assign property of non-object");
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
}
}
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
}
FREE_OP(free_op_data1);
}
@@ -27274,7 +26276,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_UNUSED_VAR(int (*bina
{
USE_OPLINE
zend_free_op free_op2, free_op_data2, free_op_data1;
- zval **var_ptr;
+ zval *var_ptr;
zval *value;
SAVE_OPLINE();
@@ -27283,21 +26285,21 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_UNUSED_VAR(int (*bina
return zend_binary_assign_op_obj_helper_SPEC_UNUSED_VAR(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
break;
case ZEND_ASSIGN_DIM: {
- zval **container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
+ zval *container = _get_obj_zval_ptr_unused(TSRMLS_C);
- if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- } else if (UNEXPECTED(Z_TYPE_PP(container) == IS_OBJECT)) {
+ } else if (UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
if (IS_UNUSED == IS_VAR && !0) {
- Z_ADDREF_PP(container); /* undo the effect of get_obj_zval_ptr_ptr() */
+ Z_ADDREF_P(container); /* undo the effect of get_obj_zval_ptr_ptr() */
}
return zend_binary_assign_op_obj_helper_SPEC_UNUSED_VAR(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
} else {
zval *dim = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- zend_fetch_dimension_address(&EX_T((opline+1)->op2.var), container, dim, IS_VAR, BP_VAR_RW TSRMLS_CC);
+ zend_fetch_dimension_address(EX_VAR((opline+1)->op2.var), container, dim, IS_VAR, BP_VAR_RW TSRMLS_CC);
value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
- var_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
+ var_ptr = _get_zval_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
}
}
break;
@@ -27308,16 +26310,15 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_UNUSED_VAR(int (*bina
break;
}
- if (UNEXPECTED(var_ptr == NULL)) {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
}
- if (UNEXPECTED(*var_ptr == &EG(error_zval))) {
+ if (UNEXPECTED(var_ptr == &EG(error_zval))) {
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
if (opline->extended_value == ZEND_ASSIGN_DIM) {
@@ -27328,24 +26329,23 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_UNUSED_VAR(int (*bina
SEPARATE_ZVAL_IF_NOT_REF(var_ptr);
- if (UNEXPECTED(Z_TYPE_PP(var_ptr) == IS_OBJECT)
- && Z_OBJ_HANDLER_PP(var_ptr, get)
- && Z_OBJ_HANDLER_PP(var_ptr, set)) {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_OBJECT)
+ && Z_OBJ_HANDLER_P(var_ptr, get)
+ && Z_OBJ_HANDLER_P(var_ptr, set)) {
/* proxy object */
- zval *objval = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC);
+ zval *objval = Z_OBJ_HANDLER_P(var_ptr, get)(var_ptr TSRMLS_CC);
Z_ADDREF_P(objval);
binary_op(objval, objval, value TSRMLS_CC);
- Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, objval TSRMLS_CC);
- zval_ptr_dtor(&objval);
+ Z_OBJ_HANDLER_P(var_ptr, set)(var_ptr, objval TSRMLS_CC);
+ zval_ptr_dtor(objval);
} else {
- binary_op(*var_ptr, *var_ptr, value TSRMLS_CC);
+ binary_op(var_ptr, var_ptr, value TSRMLS_CC);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(*var_ptr);
- EX_T(opline->result.var).var.ptr = *var_ptr;
+ ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
if (opline->extended_value == ZEND_ASSIGN_DIM) {
FREE_OP(free_op_data1);
@@ -27419,30 +26419,27 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_UNUSED_VAR(incdec_
{
USE_OPLINE
zend_free_op free_op2;
- zval **object_ptr;
zval *object;
zval *property;
- zval **retval;
+ zval *retval;
int have_get_ptr = 0;
SAVE_OPLINE();
- object_ptr = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
+ object = _get_obj_zval_ptr_unused(TSRMLS_C);
property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- retval = &EX_T(opline->result.var).var.ptr;
+ retval = EX_VAR(opline->result.var);
- if (IS_UNUSED == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
- object = *object_ptr;
+ make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- *retval = &EG(uninitialized_zval);
+ ZVAL_NULL(retval);
}
CHECK_EXCEPTION();
@@ -27456,15 +26453,14 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_UNUSED_VAR(incdec_
}
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval **zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
have_get_ptr = 1;
- incdec_op(*zptr);
+ incdec_op(zptr);
if (RETURN_VALUE_USED(opline)) {
- *retval = *zptr;
- PZVAL_LOCK(*retval);
+ ZVAL_COPY(retval, zptr);
}
}
}
@@ -27479,30 +26475,28 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_UNUSED_VAR(incdec_
if (Z_REFCOUNT_P(z) == 0) {
GC_REMOVE_ZVAL_FROM_BUFFER(z);
zval_dtor(z);
- FREE_ZVAL(z);
}
z = value;
}
Z_ADDREF_P(z);
- SEPARATE_ZVAL_IF_NOT_REF(&z);
+ SEPARATE_ZVAL_IF_NOT_REF(z);
incdec_op(z);
- *retval = z;
+ ZVAL_COPY_VALUE(retval, z);
Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- SELECTIVE_PZVAL_LOCK(*retval, opline);
- zval_ptr_dtor(&z);
+ SELECTIVE_PZVAL_LOCK(retval, opline);
+ zval_ptr_dtor(z);
} else {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- *retval = &EG(uninitialized_zval);
+ ZVAL_NULL(retval);
}
}
}
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
}
CHECK_EXCEPTION();
@@ -27523,27 +26517,25 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_VAR(incdec
{
USE_OPLINE
zend_free_op free_op2;
- zval **object_ptr;
zval *object;
zval *property;
zval *retval;
int have_get_ptr = 0;
SAVE_OPLINE();
- object_ptr = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
+ object = _get_obj_zval_ptr_unused(TSRMLS_C);
property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- retval = &EX_T(opline->result.var).tmp_var;
+ retval = EX_VAR(opline->result.var);
- if (IS_UNUSED == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
- object = *object_ptr;
+ make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
ZVAL_NULL(retval);
CHECK_EXCEPTION();
@@ -27557,15 +26549,14 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_VAR(incdec
}
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval **zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
have_get_ptr = 1;
SEPARATE_ZVAL_IF_NOT_REF(zptr);
- ZVAL_COPY_VALUE(retval, *zptr);
- zendi_zval_copy_ctor(*retval);
+ ZVAL_DUP(retval, zptr);
- incdec_op(*zptr);
+ incdec_op(zptr);
}
}
@@ -27573,7 +26564,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_VAR(incdec
if (!have_get_ptr) {
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- zval *z_copy;
+ zval z_copy;
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC);
@@ -27581,20 +26572,16 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_VAR(incdec
if (Z_REFCOUNT_P(z) == 0) {
GC_REMOVE_ZVAL_FROM_BUFFER(z);
zval_dtor(z);
- FREE_ZVAL(z);
}
z = value;
}
- ZVAL_COPY_VALUE(retval, z);
- zendi_zval_copy_ctor(*retval);
- ALLOC_ZVAL(z_copy);
- INIT_PZVAL_COPY(z_copy, z);
- zendi_zval_copy_ctor(*z_copy);
- incdec_op(z_copy);
+ ZVAL_DUP(retval, z);
+ ZVAL_DUP(&z_copy, z);
+ incdec_op(&z_copy);
Z_ADDREF_P(z);
- Z_OBJ_HT_P(object)->write_property(object, property, z_copy, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(object)->write_property(object, property, &z_copy, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval_ptr_dtor(&z_copy);
- zval_ptr_dtor(&z);
+ zval_ptr_dtor(z);
} else {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
ZVAL_NULL(retval);
@@ -27602,9 +26589,9 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_VAR(incdec
}
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
}
CHECK_EXCEPTION();
@@ -27636,9 +26623,8 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_UNUSED_VAR
if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
zend_error(E_NOTICE, "Trying to get property of non-object");
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
- zval_ptr_dtor_nogc(&free_op2.var);
+ ZVAL_NULL(EX_VAR(opline->result.var));
+ zval_ptr_dtor_nogc(free_op2.var);
} else {
zval *retval;
@@ -27649,13 +26635,12 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_UNUSED_VAR
/* here we are sure we are dealing with an object */
retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_R, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- PZVAL_LOCK(retval);
- EX_T(opline->result.var).var.ptr = retval;
+ ZVAL_COPY(EX_VAR(opline->result.var), retval);
if (0) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
}
}
@@ -27673,7 +26658,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_H
USE_OPLINE
zend_free_op free_op1, free_op2;
zval *property;
- zval **container;
+ zval *container;
SAVE_OPLINE();
property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
@@ -27681,30 +26666,30 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_H
if (0) {
MAKE_REAL_ZVAL_PTR(property);
}
- container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
- if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
+ container = _get_obj_zval_ptr_unused(TSRMLS_C);
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(&EX_T(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
- zval_ptr_dtor_nogc(&free_op2.var);
- }
- if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+ zval_ptr_dtor_nogc(free_op2.var);
}
+//??? if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
/* We are going to assign the result by reference */
if (opline->extended_value & ZEND_FETCH_MAKE_REF) {
- zval **retval_ptr = EX_T(opline->result.var).var.ptr_ptr;
+ zval *retval_ptr = EX_VAR(opline->result.var);
- Z_DELREF_PP(retval_ptr);
+ Z_DELREF_P(retval_ptr);
SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
- Z_ADDREF_PP(retval_ptr);
- EX_T(opline->result.var).var.ptr = *EX_T(opline->result.var).var.ptr_ptr;
- EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
+ Z_ADDREF_P(retval_ptr);
+//??? EX_T(opline->result.var).var.ptr = *EX_T(opline->result.var).var.ptr_ptr;
+//??? EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
}
CHECK_EXCEPTION();
@@ -27716,27 +26701,27 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_
USE_OPLINE
zend_free_op free_op1, free_op2;
zval *property;
- zval **container;
+ zval *container;
SAVE_OPLINE();
property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
+ container = _get_obj_zval_ptr_unused(TSRMLS_C);
if (0) {
MAKE_REAL_ZVAL_PTR(property);
}
- if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(&EX_T(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_RW TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_RW TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
- zval_ptr_dtor_nogc(&free_op2.var);
- }
- if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+ zval_ptr_dtor_nogc(free_op2.var);
}
+//??? if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -27756,9 +26741,8 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_
if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
- zval_ptr_dtor_nogc(&free_op2.var);
+ ZVAL_NULL(EX_VAR(opline->result.var));
+ zval_ptr_dtor_nogc(free_op2.var);
} else {
zval *retval;
@@ -27769,13 +26753,12 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_
/* here we are sure we are dealing with an object */
retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_IS, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- PZVAL_LOCK(retval);
- EX_T(opline->result.var).var.ptr = retval;
+ ZVAL_COPY(EX_VAR(opline->result.var), retval);
if (0) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
}
}
@@ -27786,32 +26769,32 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_
static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
+ zval *container;
if (zend_is_by_ref_func_arg_fetch(opline, EX(call) TSRMLS_CC)) {
/* Behave like FETCH_OBJ_W */
zend_free_op free_op1, free_op2;
zval *property;
- zval **container;
SAVE_OPLINE();
property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
+ container = _get_obj_zval_ptr_unused(TSRMLS_C);
if (0) {
MAKE_REAL_ZVAL_PTR(property);
}
- if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(&EX_T(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
- zval_ptr_dtor_nogc(&free_op2.var);
- }
- if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+ zval_ptr_dtor_nogc(free_op2.var);
}
+//??? if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -27824,39 +26807,37 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCO
{
USE_OPLINE
zend_free_op free_op1, free_op2, free_res;
- zval **container;
+ zval *container;
zval *property;
SAVE_OPLINE();
- container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
+ container = _get_obj_zval_ptr_unused(TSRMLS_C);
property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
if (IS_UNUSED == IS_CV) {
- if (container != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(container);
- }
+ SEPARATE_ZVAL_IF_NOT_REF(container);
}
if (0) {
MAKE_REAL_ZVAL_PTR(property);
}
- if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(&EX_T(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_UNSET TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_UNSET TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
- zval_ptr_dtor_nogc(&free_op2.var);
- }
- if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+ zval_ptr_dtor_nogc(free_op2.var);
}
+//??? if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
- PZVAL_UNLOCK(*EX_T(opline->result.var).var.ptr_ptr, &free_res);
- if (EX_T(opline->result.var).var.ptr_ptr != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(EX_T(opline->result.var).var.ptr_ptr);
- }
- PZVAL_LOCK(*EX_T(opline->result.var).var.ptr_ptr);
+//??? PZVAL_UNLOCK(EX_VAR(opline->result.var), &free_res);
+//??? if (EX_T(opline->result.var).var.ptr_ptr != &EG(uninitialized_zval_ptr)) {
+//??? SEPARATE_ZVAL_IF_NOT_REF(EX_T(opline->result.var).var.ptr_ptr);
+//??? }
+//??? PZVAL_LOCK(EX_VAR(opline->result.var));
FREE_OP_VAR_PTR(free_res);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -27866,24 +26847,24 @@ static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HA
{
USE_OPLINE
zend_free_op free_op2;
- zval **object_ptr;
+ zval *object;
zval *property_name;
SAVE_OPLINE();
- object_ptr = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
+ object = _get_obj_zval_ptr_unused(TSRMLS_C);
property_name = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
if (0) {
MAKE_REAL_ZVAL_PTR(property_name);
}
- if (IS_UNUSED == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_assign_to_object(RETURN_VALUE_USED(opline)?&EX_T(opline->result.var).var.ptr:NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&property_name);
+ zval_ptr_dtor(property_name);
} else {
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
}
/* assign_obj has two opcodes! */
@@ -27896,7 +26877,7 @@ static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDL
{
USE_OPLINE
zend_free_op free_op2;
- zval *str = &EX_T(opline->result.var).tmp_var;
+ zval *str = EX_VAR(opline->result.var);
zval *var;
zval var_copy;
int use_copy = 0;
@@ -27906,11 +26887,7 @@ static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDL
if (IS_UNUSED == IS_UNUSED) {
/* Initialize for erealloc in add_string_to_string */
- Z_STRVAL_P(str) = NULL;
- Z_STRLEN_P(str) = 0;
- Z_TYPE_P(str) = IS_STRING;
-
- INIT_PZVAL(str);
+ ZVAL_STR(str, STR_EMPTY_ALLOC());
}
if (Z_TYPE_P(var) != IS_STRING) {
@@ -27931,7 +26908,7 @@ static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDL
* which aren't affected by FREE_OP(Ts, )'s anyway, unless they're
* string offsets or overloaded objects
*/
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -27941,8 +26918,6 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_VAR_HANDLER(ZEND_OPC
{
USE_OPLINE
zval *function_name;
- char *function_name_strval;
- int function_name_strlen;
zend_free_op free_op2;
call_slot *call = EX(call_slots) + opline->result.num;
@@ -27958,54 +26933,47 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_VAR_HANDLER(ZEND_OPC
zend_error_noreturn(E_ERROR, "Method name must be a string");
}
- function_name_strval = Z_STRVAL_P(function_name);
- function_name_strlen = Z_STRLEN_P(function_name);
-
- call->object = _get_obj_zval_ptr_unused(TSRMLS_C);
+ ZVAL_COPY_VALUE(&call->object, _get_obj_zval_ptr_unused(TSRMLS_C));
- if (EXPECTED(call->object != NULL) &&
- EXPECTED(Z_TYPE_P(call->object) == IS_OBJECT)) {
- call->called_scope = Z_OBJCE_P(call->object);
+ if (EXPECTED(Z_TYPE(call->object) != IS_UNDEF) &&
+ EXPECTED(Z_TYPE(call->object) == IS_OBJECT)) {
+ call->called_scope = Z_OBJCE(call->object);
if (IS_VAR != IS_CONST ||
(call->fbc = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope)) == NULL) {
- zval *object = call->object;
+ zend_object *object = Z_OBJ(call->object);
- if (UNEXPECTED(Z_OBJ_HT_P(call->object)->get_method == NULL)) {
+ if (UNEXPECTED(Z_OBJ_HT(call->object)->get_method == NULL)) {
zend_error_noreturn(E_ERROR, "Object does not support method calls");
}
/* First, locate the function. */
- call->fbc = Z_OBJ_HT_P(call->object)->get_method(&call->object, function_name_strval, function_name_strlen, ((IS_VAR == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
+ call->fbc = Z_OBJ_HT(call->object)->get_method(&call->object, Z_STR_P(function_name), ((IS_VAR == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
if (UNEXPECTED(call->fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(call->object), function_name_strval);
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(&call->object), Z_STRVAL_P(function_name));
}
if (IS_VAR == IS_CONST &&
EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0) &&
- EXPECTED(call->object == object)) {
+ EXPECTED(Z_OBJ(call->object) == object)) {
CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope, call->fbc);
}
}
} else {
if (UNEXPECTED(EG(exception) != NULL)) {
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
HANDLE_EXCEPTION();
}
- zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval);
+ zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", Z_STRVAL_P(function_name));
}
if ((call->fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) {
- call->object = NULL;
+ ZVAL_UNDEF(&call->object);
} else {
- if (!PZVAL_IS_REF(call->object)) {
- Z_ADDREF_P(call->object); /* For $this pointer */
+ if (!Z_ISREF(call->object)) {
+ Z_ADDREF(call->object); /* For $this pointer */
} else {
- zval *this_ptr;
- ALLOC_ZVAL(this_ptr);
- INIT_PZVAL_COPY(this_ptr, call->object);
- zval_copy_ctor(this_ptr);
- call->object = this_ptr;
+ ZVAL_DUP(&call->object, Z_REFVAL(call->object));
}
}
@@ -28013,7 +26981,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_VAR_HANDLER(ZEND_OPC
call->is_ctor_call = 0;
EX(call) = call;
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -28023,7 +26991,7 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HA
{
USE_OPLINE
- array_init(&EX_T(opline->result.var).tmp_var);
+ array_init(EX_VAR(opline->result.var));
if (IS_UNUSED == IS_UNUSED) {
ZEND_VM_NEXT_OPCODE();
#if 0 || IS_UNUSED != IS_UNUSED
@@ -28037,21 +27005,21 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HAN
{
USE_OPLINE
zend_free_op free_op2;
- zval **container;
+ zval *container;
zval *offset;
ulong hval;
SAVE_OPLINE();
- container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
- if (IS_UNUSED == IS_CV && container != &EG(uninitialized_zval_ptr)) {
+ container = _get_obj_zval_ptr_unused(TSRMLS_C);
+ if (IS_UNUSED == IS_CV) {
SEPARATE_ZVAL_IF_NOT_REF(container);
}
offset = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
if (IS_UNUSED != IS_VAR || container) {
- switch (Z_TYPE_PP(container)) {
+ switch (Z_TYPE_P(container)) {
case IS_ARRAY: {
- HashTable *ht = Z_ARRVAL_PP(container);
+ HashTable *ht = Z_ARRVAL_P(container);
switch (Z_TYPE_P(offset)) {
case IS_DOUBLE:
@@ -28068,60 +27036,57 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HAN
if (IS_VAR == IS_CV || IS_VAR == IS_VAR) {
Z_ADDREF_P(offset);
}
- if (IS_VAR == IS_CONST) {
- hval = Z_HASH_P(offset);
- } else {
+ if (IS_VAR != IS_CONST) {
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim);
- hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset));
}
- if (ht == &EG(symbol_table)) {
- zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC);
+ if (ht == &EG(symbol_table).ht) {
+ zend_delete_global_variable(Z_STR_P(offset) TSRMLS_CC);
} else {
- zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval);
+ zend_hash_del(ht, Z_STR_P(offset));
}
if (IS_VAR == IS_CV || IS_VAR == IS_VAR) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
}
break;
num_index_dim:
zend_hash_index_del(ht, hval);
if (IS_VAR == IS_CV || IS_VAR == IS_VAR) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
}
break;
case IS_NULL:
- zend_hash_del(ht, "", sizeof(""));
+ zend_hash_del(ht, STR_EMPTY_ALLOC());
break;
default:
zend_error(E_WARNING, "Illegal offset type in unset");
break;
}
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
break;
}
case IS_OBJECT:
- if (UNEXPECTED(Z_OBJ_HT_P(*container)->unset_dimension == NULL)) {
+ if (UNEXPECTED(Z_OBJ_HT_P(container)->unset_dimension == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use object as array");
}
if (0) {
MAKE_REAL_ZVAL_PTR(offset);
}
- Z_OBJ_HT_P(*container)->unset_dimension(*container, offset TSRMLS_CC);
+ Z_OBJ_HT_P(container)->unset_dimension(container, offset TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
}
break;
case IS_STRING:
zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
ZEND_VM_CONTINUE(); /* bailed out before */
default:
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
break;
}
} else {
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
}
CHECK_EXCEPTION();
@@ -28132,36 +27097,36 @@ static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HAN
{
USE_OPLINE
zend_free_op free_op2;
- zval **container;
+ zval *container;
zval *offset;
SAVE_OPLINE();
- container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
+ container = _get_obj_zval_ptr_unused(TSRMLS_C);
offset = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
if (IS_UNUSED != IS_VAR || container) {
- if (IS_UNUSED == IS_CV && container != &EG(uninitialized_zval_ptr)) {
+ if (IS_UNUSED == IS_CV) {
SEPARATE_ZVAL_IF_NOT_REF(container);
}
- if (Z_TYPE_PP(container) == IS_OBJECT) {
+ if (Z_TYPE_P(container) == IS_OBJECT) {
if (0) {
MAKE_REAL_ZVAL_PTR(offset);
}
- if (Z_OBJ_HT_P(*container)->unset_property) {
- Z_OBJ_HT_P(*container)->unset_property(*container, offset, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ if (Z_OBJ_HT_P(container)->unset_property) {
+ Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to unset property of non-object");
}
if (0) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
}
} else {
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
}
} else {
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
}
CHECK_EXCEPTION();
@@ -28173,7 +27138,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_VAR
USE_OPLINE
zend_free_op free_op2;
zval *container;
- zval **value = NULL;
+ zval *value;
int result = 0;
ulong hval;
zval *offset;
@@ -28197,23 +27162,20 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_VAR
case IS_LONG:
hval = Z_LVAL_P(offset);
num_index_prop:
- if (zend_hash_index_find(ht, hval, (void **) &value) == SUCCESS) {
+ if ((value = zend_hash_index_find(ht, hval)) != NULL) {
isset = 1;
}
break;
case IS_STRING:
- if (IS_VAR == IS_CONST) {
- hval = Z_HASH_P(offset);
- } else {
+ if (IS_VAR != IS_CONST) {
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop);
- hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset));
}
- if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) {
+ if ((value = zend_hash_find(ht, Z_STR_P(offset))) != NULL) {
isset = 1;
}
break;
case IS_NULL:
- if (zend_hash_find(ht, "", sizeof(""), (void **) &value) == SUCCESS) {
+ if ((value = zend_hash_find(ht, STR_EMPTY_ALLOC())) != NULL) {
isset = 1;
}
break;
@@ -28223,19 +27185,19 @@ num_index_prop:
}
if (opline->extended_value & ZEND_ISSET) {
- if (isset && Z_TYPE_PP(value) == IS_NULL) {
+ if (isset && Z_TYPE_P(value) == IS_NULL) {
result = 0;
} else {
result = isset;
}
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (!isset || !i_zend_is_true(*value TSRMLS_CC)) {
+ if (!isset || !i_zend_is_true(value TSRMLS_CC)) {
result = 0;
} else {
result = 1;
}
}
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
} else if (Z_TYPE_P(container) == IS_OBJECT) {
if (0) {
MAKE_REAL_ZVAL_PTR(offset);
@@ -28256,9 +27218,9 @@ num_index_prop:
}
}
if (0) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
}
} else if (Z_TYPE_P(container) == IS_STRING && !prop_dim) { /* string offsets */
zval tmp;
@@ -28267,8 +27229,7 @@ num_index_prop:
if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */
|| (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
&& IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) {
- ZVAL_COPY_VALUE(&tmp, offset);
- zval_copy_ctor(&tmp);
+ ZVAL_DUP(&tmp, offset);
convert_to_long(&tmp);
offset = &tmp;
} else {
@@ -28287,16 +27248,15 @@ num_index_prop:
}
}
}
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
} else {
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
}
- Z_TYPE(EX_T(opline->result.var).tmp_var) = IS_BOOL;
if (opline->extended_value & ZEND_ISSET) {
- Z_LVAL(EX_T(opline->result.var).tmp_var) = result;
+ ZVAL_BOOL(EX_VAR(opline->result.var), result);
} else {
- Z_LVAL(EX_T(opline->result.var).tmp_var) = !result;
+ ZVAL_BOOL(EX_VAR(opline->result.var), !result);
}
CHECK_EXCEPTION();
@@ -28315,6 +27275,9 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_UNUSED_VAR_HANDLER(ZE
static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
+//???
+return 0;
+#if 0
USE_OPLINE
/* The generator object is stored in return_value_ptr_ptr */
@@ -28357,7 +27320,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER
generator->value = copy;
} else {
- zval **value_ptr = NULL;
+ zval **value_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W);
if (IS_UNUSED == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
@@ -28385,7 +27348,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER
/* Consts, temporary variables and references need copying */
if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR
- || PZVAL_IS_REF(value)
+ || Z_ISREF_P(value)
) {
zval *copy;
@@ -28419,7 +27382,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER
/* Consts, temporary variables and references need copying */
if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR
- || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0)
+ || (Z_ISREF_P(key) && Z_REFCOUNT_P(key) > 0)
) {
zval *copy;
@@ -28443,7 +27406,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER
generator->largest_used_integer_key = Z_LVAL_P(generator->key);
}
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
} else {
/* If no key was specified we use auto-increment keys */
generator->largest_used_integer_key++;
@@ -28471,24 +27434,23 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER
SAVE_OPLINE();
ZEND_VM_RETURN();
+#endif
}
static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_UNUSED(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
zend_free_op free_op_data1;
- zval **object_ptr = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
- zval *object;
+ zval *object = _get_obj_zval_ptr_unused(TSRMLS_C);
zval *property = NULL;
zval *value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
int have_get_ptr = 0;
- if (IS_UNUSED == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- make_real_object(object_ptr TSRMLS_CC);
- object = *object_ptr;
+ make_real_object(object TSRMLS_CC);
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to assign property of non-object");
@@ -28496,8 +27458,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_UNUSED(int
FREE_OP(free_op_data1);
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
} else {
/* here we are sure we are dealing with an object */
@@ -28508,15 +27469,14 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_UNUSED(int
/* here property is a string */
if (opline->extended_value == ZEND_ASSIGN_OBJ
&& Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval **zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_UNUSED == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_UNUSED == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
have_get_ptr = 1;
- binary_op(*zptr, *zptr, value TSRMLS_CC);
+ binary_op(zptr, zptr, value TSRMLS_CC);
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(*zptr);
- EX_T(opline->result.var).var.ptr = *zptr;
+ ZVAL_COPY(EX_VAR(opline->result.var), zptr);
}
}
}
@@ -28540,12 +27500,11 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_UNUSED(int
if (Z_REFCOUNT_P(z) == 0) {
GC_REMOVE_ZVAL_FROM_BUFFER(z);
zval_dtor(z);
- FREE_ZVAL(z);
}
z = value;
}
Z_ADDREF_P(z);
- SEPARATE_ZVAL_IF_NOT_REF(&z);
+ SEPARATE_ZVAL_IF_NOT_REF(z);
binary_op(z, z, value TSRMLS_CC);
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_UNUSED == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
@@ -28553,21 +27512,19 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_UNUSED(int
Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(z);
- EX_T(opline->result.var).var.ptr = z;
+ ZVAL_COPY(EX_VAR(opline->result.var), z);
}
- zval_ptr_dtor(&z);
+ zval_ptr_dtor(z);
} else {
zend_error(E_WARNING, "Attempt to assign property of non-object");
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
}
}
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
}
@@ -28584,7 +27541,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_UNUSED_UNUSED(int (*b
{
USE_OPLINE
zend_free_op free_op_data2, free_op_data1;
- zval **var_ptr;
+ zval *var_ptr;
zval *value;
SAVE_OPLINE();
@@ -28593,21 +27550,21 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_UNUSED_UNUSED(int (*b
return zend_binary_assign_op_obj_helper_SPEC_UNUSED_UNUSED(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
break;
case ZEND_ASSIGN_DIM: {
- zval **container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
+ zval *container = _get_obj_zval_ptr_unused(TSRMLS_C);
- if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- } else if (UNEXPECTED(Z_TYPE_PP(container) == IS_OBJECT)) {
+ } else if (UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
if (IS_UNUSED == IS_VAR && !0) {
- Z_ADDREF_PP(container); /* undo the effect of get_obj_zval_ptr_ptr() */
+ Z_ADDREF_P(container); /* undo the effect of get_obj_zval_ptr_ptr() */
}
return zend_binary_assign_op_obj_helper_SPEC_UNUSED_UNUSED(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
} else {
zval *dim = NULL;
- zend_fetch_dimension_address(&EX_T((opline+1)->op2.var), container, dim, IS_UNUSED, BP_VAR_RW TSRMLS_CC);
+ zend_fetch_dimension_address(EX_VAR((opline+1)->op2.var), container, dim, IS_UNUSED, BP_VAR_RW TSRMLS_CC);
value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
- var_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
+ var_ptr = _get_zval_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
}
}
break;
@@ -28618,14 +27575,13 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_UNUSED_UNUSED(int (*b
break;
}
- if (UNEXPECTED(var_ptr == NULL)) {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
}
- if (UNEXPECTED(*var_ptr == &EG(error_zval))) {
+ if (UNEXPECTED(var_ptr == &EG(error_zval))) {
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
@@ -28638,22 +27594,21 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_UNUSED_UNUSED(int (*b
SEPARATE_ZVAL_IF_NOT_REF(var_ptr);
- if (UNEXPECTED(Z_TYPE_PP(var_ptr) == IS_OBJECT)
- && Z_OBJ_HANDLER_PP(var_ptr, get)
- && Z_OBJ_HANDLER_PP(var_ptr, set)) {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_OBJECT)
+ && Z_OBJ_HANDLER_P(var_ptr, get)
+ && Z_OBJ_HANDLER_P(var_ptr, set)) {
/* proxy object */
- zval *objval = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC);
+ zval *objval = Z_OBJ_HANDLER_P(var_ptr, get)(var_ptr TSRMLS_CC);
Z_ADDREF_P(objval);
binary_op(objval, objval, value TSRMLS_CC);
- Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, objval TSRMLS_CC);
- zval_ptr_dtor(&objval);
+ Z_OBJ_HANDLER_P(var_ptr, set)(var_ptr, objval TSRMLS_CC);
+ zval_ptr_dtor(objval);
} else {
- binary_op(*var_ptr, *var_ptr, value TSRMLS_CC);
+ binary_op(var_ptr, var_ptr, value TSRMLS_CC);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(*var_ptr);
- EX_T(opline->result.var).var.ptr = *var_ptr;
+ ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
if (opline->extended_value == ZEND_ASSIGN_DIM) {
@@ -28728,7 +27683,7 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE
{
USE_OPLINE
- array_init(&EX_T(opline->result.var).tmp_var);
+ array_init(EX_VAR(opline->result.var));
if (IS_UNUSED == IS_UNUSED) {
ZEND_VM_NEXT_OPCODE();
#if 0 || IS_UNUSED != IS_UNUSED
@@ -28740,6 +27695,9 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE
static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
+//???
+return 0;
+#if 0
USE_OPLINE
/* The generator object is stored in return_value_ptr_ptr */
@@ -28782,7 +27740,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HAND
generator->value = copy;
} else {
- zval **value_ptr = NULL;
+ zval **value_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W);
if (IS_UNUSED == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
@@ -28810,7 +27768,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HAND
/* Consts, temporary variables and references need copying */
if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR
- || PZVAL_IS_REF(value)
+ || Z_ISREF_P(value)
) {
zval *copy;
@@ -28844,7 +27802,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HAND
/* Consts, temporary variables and references need copying */
if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR
- || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0)
+ || (Z_ISREF_P(key) && Z_REFCOUNT_P(key) > 0)
) {
zval *copy;
@@ -28895,24 +27853,23 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HAND
SAVE_OPLINE();
ZEND_VM_RETURN();
+#endif
}
static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_CV(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
zend_free_op free_op_data1;
- zval **object_ptr = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
- zval *object;
+ zval *object = _get_obj_zval_ptr_unused(TSRMLS_C);
zval *property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
zval *value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
int have_get_ptr = 0;
- if (IS_UNUSED == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- make_real_object(object_ptr TSRMLS_CC);
- object = *object_ptr;
+ make_real_object(object TSRMLS_CC);
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to assign property of non-object");
@@ -28920,8 +27877,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_CV(int (*b
FREE_OP(free_op_data1);
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
} else {
/* here we are sure we are dealing with an object */
@@ -28932,15 +27888,14 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_CV(int (*b
/* here property is a string */
if (opline->extended_value == ZEND_ASSIGN_OBJ
&& Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval **zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
have_get_ptr = 1;
- binary_op(*zptr, *zptr, value TSRMLS_CC);
+ binary_op(zptr, zptr, value TSRMLS_CC);
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(*zptr);
- EX_T(opline->result.var).var.ptr = *zptr;
+ ZVAL_COPY(EX_VAR(opline->result.var), zptr);
}
}
}
@@ -28964,12 +27919,11 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_CV(int (*b
if (Z_REFCOUNT_P(z) == 0) {
GC_REMOVE_ZVAL_FROM_BUFFER(z);
zval_dtor(z);
- FREE_ZVAL(z);
}
z = value;
}
Z_ADDREF_P(z);
- SEPARATE_ZVAL_IF_NOT_REF(&z);
+ SEPARATE_ZVAL_IF_NOT_REF(z);
binary_op(z, z, value TSRMLS_CC);
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
@@ -28977,21 +27931,19 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_CV(int (*b
Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(z);
- EX_T(opline->result.var).var.ptr = z;
+ ZVAL_COPY(EX_VAR(opline->result.var), z);
}
- zval_ptr_dtor(&z);
+ zval_ptr_dtor(z);
} else {
zend_error(E_WARNING, "Attempt to assign property of non-object");
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
}
}
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
}
@@ -29008,7 +27960,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_UNUSED_CV(int (*binar
{
USE_OPLINE
zend_free_op free_op_data2, free_op_data1;
- zval **var_ptr;
+ zval *var_ptr;
zval *value;
SAVE_OPLINE();
@@ -29017,21 +27969,21 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_UNUSED_CV(int (*binar
return zend_binary_assign_op_obj_helper_SPEC_UNUSED_CV(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
break;
case ZEND_ASSIGN_DIM: {
- zval **container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
+ zval *container = _get_obj_zval_ptr_unused(TSRMLS_C);
- if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- } else if (UNEXPECTED(Z_TYPE_PP(container) == IS_OBJECT)) {
+ } else if (UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
if (IS_UNUSED == IS_VAR && !0) {
- Z_ADDREF_PP(container); /* undo the effect of get_obj_zval_ptr_ptr() */
+ Z_ADDREF_P(container); /* undo the effect of get_obj_zval_ptr_ptr() */
}
return zend_binary_assign_op_obj_helper_SPEC_UNUSED_CV(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
} else {
zval *dim = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- zend_fetch_dimension_address(&EX_T((opline+1)->op2.var), container, dim, IS_CV, BP_VAR_RW TSRMLS_CC);
+ zend_fetch_dimension_address(EX_VAR((opline+1)->op2.var), container, dim, IS_CV, BP_VAR_RW TSRMLS_CC);
value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
- var_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
+ var_ptr = _get_zval_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
}
}
break;
@@ -29042,14 +27994,13 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_UNUSED_CV(int (*binar
break;
}
- if (UNEXPECTED(var_ptr == NULL)) {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
}
- if (UNEXPECTED(*var_ptr == &EG(error_zval))) {
+ if (UNEXPECTED(var_ptr == &EG(error_zval))) {
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
@@ -29062,22 +28013,21 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_UNUSED_CV(int (*binar
SEPARATE_ZVAL_IF_NOT_REF(var_ptr);
- if (UNEXPECTED(Z_TYPE_PP(var_ptr) == IS_OBJECT)
- && Z_OBJ_HANDLER_PP(var_ptr, get)
- && Z_OBJ_HANDLER_PP(var_ptr, set)) {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_OBJECT)
+ && Z_OBJ_HANDLER_P(var_ptr, get)
+ && Z_OBJ_HANDLER_P(var_ptr, set)) {
/* proxy object */
- zval *objval = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC);
+ zval *objval = Z_OBJ_HANDLER_P(var_ptr, get)(var_ptr TSRMLS_CC);
Z_ADDREF_P(objval);
binary_op(objval, objval, value TSRMLS_CC);
- Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, objval TSRMLS_CC);
- zval_ptr_dtor(&objval);
+ Z_OBJ_HANDLER_P(var_ptr, set)(var_ptr, objval TSRMLS_CC);
+ zval_ptr_dtor(objval);
} else {
- binary_op(*var_ptr, *var_ptr, value TSRMLS_CC);
+ binary_op(var_ptr, var_ptr, value TSRMLS_CC);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(*var_ptr);
- EX_T(opline->result.var).var.ptr = *var_ptr;
+ ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
if (opline->extended_value == ZEND_ASSIGN_DIM) {
@@ -29152,30 +28102,27 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_UNUSED_CV(incdec_t
{
USE_OPLINE
- zval **object_ptr;
zval *object;
zval *property;
- zval **retval;
+ zval *retval;
int have_get_ptr = 0;
SAVE_OPLINE();
- object_ptr = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
+ object = _get_obj_zval_ptr_unused(TSRMLS_C);
property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- retval = &EX_T(opline->result.var).var.ptr;
+ retval = EX_VAR(opline->result.var);
- if (IS_UNUSED == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
- object = *object_ptr;
+ make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- *retval = &EG(uninitialized_zval);
+ ZVAL_NULL(retval);
}
CHECK_EXCEPTION();
@@ -29189,15 +28136,14 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_UNUSED_CV(incdec_t
}
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval **zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
have_get_ptr = 1;
- incdec_op(*zptr);
+ incdec_op(zptr);
if (RETURN_VALUE_USED(opline)) {
- *retval = *zptr;
- PZVAL_LOCK(*retval);
+ ZVAL_COPY(retval, zptr);
}
}
}
@@ -29212,28 +28158,26 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_UNUSED_CV(incdec_t
if (Z_REFCOUNT_P(z) == 0) {
GC_REMOVE_ZVAL_FROM_BUFFER(z);
zval_dtor(z);
- FREE_ZVAL(z);
}
z = value;
}
Z_ADDREF_P(z);
- SEPARATE_ZVAL_IF_NOT_REF(&z);
+ SEPARATE_ZVAL_IF_NOT_REF(z);
incdec_op(z);
- *retval = z;
+ ZVAL_COPY_VALUE(retval, z);
Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- SELECTIVE_PZVAL_LOCK(*retval, opline);
- zval_ptr_dtor(&z);
+ SELECTIVE_PZVAL_LOCK(retval, opline);
+ zval_ptr_dtor(z);
} else {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- *retval = &EG(uninitialized_zval);
+ ZVAL_NULL(retval);
}
}
}
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
}
@@ -29256,23 +28200,21 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_CV(incdec_
{
USE_OPLINE
- zval **object_ptr;
zval *object;
zval *property;
zval *retval;
int have_get_ptr = 0;
SAVE_OPLINE();
- object_ptr = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
+ object = _get_obj_zval_ptr_unused(TSRMLS_C);
property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- retval = &EX_T(opline->result.var).tmp_var;
+ retval = EX_VAR(opline->result.var);
- if (IS_UNUSED == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
- object = *object_ptr;
+ make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
@@ -29290,15 +28232,14 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_CV(incdec_
}
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval **zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
have_get_ptr = 1;
SEPARATE_ZVAL_IF_NOT_REF(zptr);
- ZVAL_COPY_VALUE(retval, *zptr);
- zendi_zval_copy_ctor(*retval);
+ ZVAL_DUP(retval, zptr);
- incdec_op(*zptr);
+ incdec_op(zptr);
}
}
@@ -29306,7 +28247,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_CV(incdec_
if (!have_get_ptr) {
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- zval *z_copy;
+ zval z_copy;
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC);
@@ -29314,20 +28255,16 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_CV(incdec_
if (Z_REFCOUNT_P(z) == 0) {
GC_REMOVE_ZVAL_FROM_BUFFER(z);
zval_dtor(z);
- FREE_ZVAL(z);
}
z = value;
}
- ZVAL_COPY_VALUE(retval, z);
- zendi_zval_copy_ctor(*retval);
- ALLOC_ZVAL(z_copy);
- INIT_PZVAL_COPY(z_copy, z);
- zendi_zval_copy_ctor(*z_copy);
- incdec_op(z_copy);
+ ZVAL_DUP(retval, z);
+ ZVAL_DUP(&z_copy, z);
+ incdec_op(&z_copy);
Z_ADDREF_P(z);
- Z_OBJ_HT_P(object)->write_property(object, property, z_copy, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(object)->write_property(object, property, &z_copy, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval_ptr_dtor(&z_copy);
- zval_ptr_dtor(&z);
+ zval_ptr_dtor(z);
} else {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
ZVAL_NULL(retval);
@@ -29335,7 +28272,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_CV(incdec_
}
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
}
@@ -29369,8 +28306,7 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_UNUSED_CV(
if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
zend_error(E_NOTICE, "Trying to get property of non-object");
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
} else {
zval *retval;
@@ -29382,11 +28318,10 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_UNUSED_CV(
/* here we are sure we are dealing with an object */
retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_R, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- PZVAL_LOCK(retval);
- EX_T(opline->result.var).var.ptr = retval;
+ ZVAL_COPY(EX_VAR(opline->result.var), retval);
if (0) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
}
@@ -29406,7 +28341,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HA
USE_OPLINE
zend_free_op free_op1;
zval *property;
- zval **container;
+ zval *container;
SAVE_OPLINE();
property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
@@ -29414,30 +28349,30 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HA
if (0) {
MAKE_REAL_ZVAL_PTR(property);
}
- container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
- if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
+ container = _get_obj_zval_ptr_unused(TSRMLS_C);
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(&EX_T(opline->result.var), container, property, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
}
- if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
+//??? if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
/* We are going to assign the result by reference */
if (opline->extended_value & ZEND_FETCH_MAKE_REF) {
- zval **retval_ptr = EX_T(opline->result.var).var.ptr_ptr;
+ zval *retval_ptr = EX_VAR(opline->result.var);
- Z_DELREF_PP(retval_ptr);
+ Z_DELREF_P(retval_ptr);
SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
- Z_ADDREF_PP(retval_ptr);
- EX_T(opline->result.var).var.ptr = *EX_T(opline->result.var).var.ptr_ptr;
- EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
+ Z_ADDREF_P(retval_ptr);
+//??? EX_T(opline->result.var).var.ptr = *EX_T(opline->result.var).var.ptr_ptr;
+//??? EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
}
CHECK_EXCEPTION();
@@ -29449,27 +28384,27 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_H
USE_OPLINE
zend_free_op free_op1;
zval *property;
- zval **container;
+ zval *container;
SAVE_OPLINE();
property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
+ container = _get_obj_zval_ptr_unused(TSRMLS_C);
if (0) {
MAKE_REAL_ZVAL_PTR(property);
}
- if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(&EX_T(opline->result.var), container, property, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_RW TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_RW TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
}
- if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
+//??? if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -29489,8 +28424,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_H
if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
} else {
zval *retval;
@@ -29502,11 +28436,10 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_H
/* here we are sure we are dealing with an object */
retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_IS, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- PZVAL_LOCK(retval);
- EX_T(opline->result.var).var.ptr = retval;
+ ZVAL_COPY(EX_VAR(opline->result.var), retval);
if (0) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
}
@@ -29519,32 +28452,32 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_H
static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
+ zval *container;
if (zend_is_by_ref_func_arg_fetch(opline, EX(call) TSRMLS_CC)) {
/* Behave like FETCH_OBJ_W */
zend_free_op free_op1;
zval *property;
- zval **container;
SAVE_OPLINE();
property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
+ container = _get_obj_zval_ptr_unused(TSRMLS_C);
if (0) {
MAKE_REAL_ZVAL_PTR(property);
}
- if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(&EX_T(opline->result.var), container, property, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
}
- if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
+//??? if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -29557,39 +28490,37 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_CV_HANDLER(ZEND_OPCOD
{
USE_OPLINE
zend_free_op free_op1, free_res;
- zval **container;
+ zval *container;
zval *property;
SAVE_OPLINE();
- container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
+ container = _get_obj_zval_ptr_unused(TSRMLS_C);
property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
if (IS_UNUSED == IS_CV) {
- if (container != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(container);
- }
+ SEPARATE_ZVAL_IF_NOT_REF(container);
}
if (0) {
MAKE_REAL_ZVAL_PTR(property);
}
- if (IS_UNUSED == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(&EX_T(opline->result.var), container, property, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_UNSET TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_UNSET TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
}
- if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
+//??? if (IS_UNUSED == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
- PZVAL_UNLOCK(*EX_T(opline->result.var).var.ptr_ptr, &free_res);
- if (EX_T(opline->result.var).var.ptr_ptr != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(EX_T(opline->result.var).var.ptr_ptr);
- }
- PZVAL_LOCK(*EX_T(opline->result.var).var.ptr_ptr);
+//??? PZVAL_UNLOCK(EX_VAR(opline->result.var), &free_res);
+//??? if (EX_T(opline->result.var).var.ptr_ptr != &EG(uninitialized_zval_ptr)) {
+//??? SEPARATE_ZVAL_IF_NOT_REF(EX_T(opline->result.var).var.ptr_ptr);
+//??? }
+//??? PZVAL_LOCK(EX_VAR(opline->result.var));
FREE_OP_VAR_PTR(free_res);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -29599,22 +28530,22 @@ static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HAN
{
USE_OPLINE
- zval **object_ptr;
+ zval *object;
zval *property_name;
SAVE_OPLINE();
- object_ptr = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
+ object = _get_obj_zval_ptr_unused(TSRMLS_C);
property_name = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
if (0) {
MAKE_REAL_ZVAL_PTR(property_name);
}
- if (IS_UNUSED == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_assign_to_object(RETURN_VALUE_USED(opline)?&EX_T(opline->result.var).var.ptr:NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&property_name);
+ zval_ptr_dtor(property_name);
} else {
}
@@ -29629,7 +28560,7 @@ static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLE
{
USE_OPLINE
- zval *str = &EX_T(opline->result.var).tmp_var;
+ zval *str = EX_VAR(opline->result.var);
zval *var;
zval var_copy;
int use_copy = 0;
@@ -29639,11 +28570,7 @@ static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLE
if (IS_UNUSED == IS_UNUSED) {
/* Initialize for erealloc in add_string_to_string */
- Z_STRVAL_P(str) = NULL;
- Z_STRLEN_P(str) = 0;
- Z_TYPE_P(str) = IS_STRING;
-
- INIT_PZVAL(str);
+ ZVAL_STR(str, STR_EMPTY_ALLOC());
}
if (Z_TYPE_P(var) != IS_STRING) {
@@ -29673,8 +28600,6 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CV_HANDLER(ZEND_OPCO
{
USE_OPLINE
zval *function_name;
- char *function_name_strval;
- int function_name_strlen;
call_slot *call = EX(call_slots) + opline->result.num;
@@ -29690,32 +28615,29 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CV_HANDLER(ZEND_OPCO
zend_error_noreturn(E_ERROR, "Method name must be a string");
}
- function_name_strval = Z_STRVAL_P(function_name);
- function_name_strlen = Z_STRLEN_P(function_name);
-
- call->object = _get_obj_zval_ptr_unused(TSRMLS_C);
+ ZVAL_COPY_VALUE(&call->object, _get_obj_zval_ptr_unused(TSRMLS_C));
- if (EXPECTED(call->object != NULL) &&
- EXPECTED(Z_TYPE_P(call->object) == IS_OBJECT)) {
- call->called_scope = Z_OBJCE_P(call->object);
+ if (EXPECTED(Z_TYPE(call->object) != IS_UNDEF) &&
+ EXPECTED(Z_TYPE(call->object) == IS_OBJECT)) {
+ call->called_scope = Z_OBJCE(call->object);
if (IS_CV != IS_CONST ||
(call->fbc = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope)) == NULL) {
- zval *object = call->object;
+ zend_object *object = Z_OBJ(call->object);
- if (UNEXPECTED(Z_OBJ_HT_P(call->object)->get_method == NULL)) {
+ if (UNEXPECTED(Z_OBJ_HT(call->object)->get_method == NULL)) {
zend_error_noreturn(E_ERROR, "Object does not support method calls");
}
/* First, locate the function. */
- call->fbc = Z_OBJ_HT_P(call->object)->get_method(&call->object, function_name_strval, function_name_strlen, ((IS_CV == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
+ call->fbc = Z_OBJ_HT(call->object)->get_method(&call->object, Z_STR_P(function_name), ((IS_CV == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
if (UNEXPECTED(call->fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(call->object), function_name_strval);
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(&call->object), Z_STRVAL_P(function_name));
}
if (IS_CV == IS_CONST &&
EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0) &&
- EXPECTED(call->object == object)) {
+ EXPECTED(Z_OBJ(call->object) == object)) {
CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope, call->fbc);
}
}
@@ -29724,20 +28646,16 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CV_HANDLER(ZEND_OPCO
HANDLE_EXCEPTION();
}
- zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval);
+ zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", Z_STRVAL_P(function_name));
}
if ((call->fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) {
- call->object = NULL;
+ ZVAL_UNDEF(&call->object);
} else {
- if (!PZVAL_IS_REF(call->object)) {
- Z_ADDREF_P(call->object); /* For $this pointer */
+ if (!Z_ISREF(call->object)) {
+ Z_ADDREF(call->object); /* For $this pointer */
} else {
- zval *this_ptr;
- ALLOC_ZVAL(this_ptr);
- INIT_PZVAL_COPY(this_ptr, call->object);
- zval_copy_ctor(this_ptr);
- call->object = this_ptr;
+ ZVAL_DUP(&call->object, Z_REFVAL(call->object));
}
}
@@ -29754,7 +28672,7 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HAN
{
USE_OPLINE
- array_init(&EX_T(opline->result.var).tmp_var);
+ array_init(EX_VAR(opline->result.var));
if (IS_UNUSED == IS_UNUSED) {
ZEND_VM_NEXT_OPCODE();
#if 0 || IS_UNUSED != IS_UNUSED
@@ -29768,21 +28686,21 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HAND
{
USE_OPLINE
- zval **container;
+ zval *container;
zval *offset;
ulong hval;
SAVE_OPLINE();
- container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
- if (IS_UNUSED == IS_CV && container != &EG(uninitialized_zval_ptr)) {
+ container = _get_obj_zval_ptr_unused(TSRMLS_C);
+ if (IS_UNUSED == IS_CV) {
SEPARATE_ZVAL_IF_NOT_REF(container);
}
offset = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
if (IS_UNUSED != IS_VAR || container) {
- switch (Z_TYPE_PP(container)) {
+ switch (Z_TYPE_P(container)) {
case IS_ARRAY: {
- HashTable *ht = Z_ARRVAL_PP(container);
+ HashTable *ht = Z_ARRVAL_P(container);
switch (Z_TYPE_P(offset)) {
case IS_DOUBLE:
@@ -29799,29 +28717,26 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HAND
if (IS_CV == IS_CV || IS_CV == IS_VAR) {
Z_ADDREF_P(offset);
}
- if (IS_CV == IS_CONST) {
- hval = Z_HASH_P(offset);
- } else {
+ if (IS_CV != IS_CONST) {
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim);
- hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset));
}
- if (ht == &EG(symbol_table)) {
- zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC);
+ if (ht == &EG(symbol_table).ht) {
+ zend_delete_global_variable(Z_STR_P(offset) TSRMLS_CC);
} else {
- zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval);
+ zend_hash_del(ht, Z_STR_P(offset));
}
if (IS_CV == IS_CV || IS_CV == IS_VAR) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
}
break;
num_index_dim:
zend_hash_index_del(ht, hval);
if (IS_CV == IS_CV || IS_CV == IS_VAR) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
}
break;
case IS_NULL:
- zend_hash_del(ht, "", sizeof(""));
+ zend_hash_del(ht, STR_EMPTY_ALLOC());
break;
default:
zend_error(E_WARNING, "Illegal offset type in unset");
@@ -29831,15 +28746,15 @@ num_index_dim:
break;
}
case IS_OBJECT:
- if (UNEXPECTED(Z_OBJ_HT_P(*container)->unset_dimension == NULL)) {
+ if (UNEXPECTED(Z_OBJ_HT_P(container)->unset_dimension == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use object as array");
}
if (0) {
MAKE_REAL_ZVAL_PTR(offset);
}
- Z_OBJ_HT_P(*container)->unset_dimension(*container, offset TSRMLS_CC);
+ Z_OBJ_HT_P(container)->unset_dimension(container, offset TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
}
@@ -29863,28 +28778,28 @@ static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HAND
{
USE_OPLINE
- zval **container;
+ zval *container;
zval *offset;
SAVE_OPLINE();
- container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
+ container = _get_obj_zval_ptr_unused(TSRMLS_C);
offset = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
if (IS_UNUSED != IS_VAR || container) {
- if (IS_UNUSED == IS_CV && container != &EG(uninitialized_zval_ptr)) {
+ if (IS_UNUSED == IS_CV) {
SEPARATE_ZVAL_IF_NOT_REF(container);
}
- if (Z_TYPE_PP(container) == IS_OBJECT) {
+ if (Z_TYPE_P(container) == IS_OBJECT) {
if (0) {
MAKE_REAL_ZVAL_PTR(offset);
}
- if (Z_OBJ_HT_P(*container)->unset_property) {
- Z_OBJ_HT_P(*container)->unset_property(*container, offset, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ if (Z_OBJ_HT_P(container)->unset_property) {
+ Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to unset property of non-object");
}
if (0) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
}
@@ -29904,7 +28819,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CV(
USE_OPLINE
zval *container;
- zval **value = NULL;
+ zval *value;
int result = 0;
ulong hval;
zval *offset;
@@ -29928,23 +28843,20 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CV(
case IS_LONG:
hval = Z_LVAL_P(offset);
num_index_prop:
- if (zend_hash_index_find(ht, hval, (void **) &value) == SUCCESS) {
+ if ((value = zend_hash_index_find(ht, hval)) != NULL) {
isset = 1;
}
break;
case IS_STRING:
- if (IS_CV == IS_CONST) {
- hval = Z_HASH_P(offset);
- } else {
+ if (IS_CV != IS_CONST) {
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop);
- hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset));
}
- if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) {
+ if ((value = zend_hash_find(ht, Z_STR_P(offset))) != NULL) {
isset = 1;
}
break;
case IS_NULL:
- if (zend_hash_find(ht, "", sizeof(""), (void **) &value) == SUCCESS) {
+ if ((value = zend_hash_find(ht, STR_EMPTY_ALLOC())) != NULL) {
isset = 1;
}
break;
@@ -29954,13 +28866,13 @@ num_index_prop:
}
if (opline->extended_value & ZEND_ISSET) {
- if (isset && Z_TYPE_PP(value) == IS_NULL) {
+ if (isset && Z_TYPE_P(value) == IS_NULL) {
result = 0;
} else {
result = isset;
}
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (!isset || !i_zend_is_true(*value TSRMLS_CC)) {
+ if (!isset || !i_zend_is_true(value TSRMLS_CC)) {
result = 0;
} else {
result = 1;
@@ -29987,7 +28899,7 @@ num_index_prop:
}
}
if (0) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
}
@@ -29998,8 +28910,7 @@ num_index_prop:
if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */
|| (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
&& IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) {
- ZVAL_COPY_VALUE(&tmp, offset);
- zval_copy_ctor(&tmp);
+ ZVAL_DUP(&tmp, offset);
convert_to_long(&tmp);
offset = &tmp;
} else {
@@ -30023,11 +28934,10 @@ num_index_prop:
}
- Z_TYPE(EX_T(opline->result.var).tmp_var) = IS_BOOL;
if (opline->extended_value & ZEND_ISSET) {
- Z_LVAL(EX_T(opline->result.var).tmp_var) = result;
+ ZVAL_BOOL(EX_VAR(opline->result.var), result);
} else {
- Z_LVAL(EX_T(opline->result.var).tmp_var) = !result;
+ ZVAL_BOOL(EX_VAR(opline->result.var), !result);
}
CHECK_EXCEPTION();
@@ -30046,6 +28956,9 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_UNUSED_CV_HANDLER(ZEN
static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
+//???
+return 0;
+#if 0
USE_OPLINE
/* The generator object is stored in return_value_ptr_ptr */
@@ -30088,7 +29001,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_
generator->value = copy;
} else {
- zval **value_ptr = NULL;
+ zval **value_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W);
if (IS_UNUSED == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
@@ -30116,7 +29029,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_
/* Consts, temporary variables and references need copying */
if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR
- || PZVAL_IS_REF(value)
+ || Z_ISREF_P(value)
) {
zval *copy;
@@ -30150,7 +29063,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_
/* Consts, temporary variables and references need copying */
if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR
- || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0)
+ || (Z_ISREF_P(key) && Z_REFCOUNT_P(key) > 0)
) {
zval *copy;
@@ -30201,6 +29114,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_
SAVE_OPLINE();
ZEND_VM_RETURN();
+#endif
}
static int ZEND_FASTCALL ZEND_BW_NOT_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -30209,7 +29123,7 @@ static int ZEND_FASTCALL ZEND_BW_NOT_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
SAVE_OPLINE();
- bitwise_not_function(&EX_T(opline->result.var).tmp_var,
+ bitwise_not_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC) TSRMLS_CC);
CHECK_EXCEPTION();
@@ -30222,7 +29136,7 @@ static int ZEND_FASTCALL ZEND_BOOL_NOT_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS
SAVE_OPLINE();
- boolean_not_function(&EX_T(opline->result.var).tmp_var,
+ boolean_not_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC) TSRMLS_CC);
CHECK_EXCEPTION();
@@ -30233,18 +29147,17 @@ static int ZEND_FASTCALL ZEND_PRE_INC_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zval **var_ptr;
+ zval *var_ptr;
SAVE_OPLINE();
- var_ptr = _get_zval_ptr_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
+ var_ptr = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- if (IS_CV == IS_VAR && UNEXPECTED(*var_ptr == &EG(error_zval))) {
+ if (IS_CV == IS_VAR && UNEXPECTED(var_ptr == &EG(error_zval))) {
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
CHECK_EXCEPTION();
@@ -30253,22 +29166,21 @@ static int ZEND_FASTCALL ZEND_PRE_INC_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
SEPARATE_ZVAL_IF_NOT_REF(var_ptr);
- if (UNEXPECTED(Z_TYPE_PP(var_ptr) == IS_OBJECT)
- && Z_OBJ_HANDLER_PP(var_ptr, get)
- && Z_OBJ_HANDLER_PP(var_ptr, set)) {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_OBJECT)
+ && Z_OBJ_HANDLER_P(var_ptr, get)
+ && Z_OBJ_HANDLER_P(var_ptr, set)) {
/* proxy object */
- zval *val = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC);
+ zval *val = Z_OBJ_HANDLER_P(var_ptr, get)(var_ptr TSRMLS_CC);
Z_ADDREF_P(val);
fast_increment_function(val);
- Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, val TSRMLS_CC);
- zval_ptr_dtor(&val);
+ Z_OBJ_HANDLER_P(var_ptr, set)(var_ptr, val TSRMLS_CC);
+ zval_ptr_dtor(val);
} else {
- fast_increment_function(*var_ptr);
+ fast_increment_function(var_ptr);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(*var_ptr);
- EX_T(opline->result.var).var.ptr = *var_ptr;
+ ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
CHECK_EXCEPTION();
@@ -30279,18 +29191,17 @@ static int ZEND_FASTCALL ZEND_PRE_DEC_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zval **var_ptr;
+ zval *var_ptr;
SAVE_OPLINE();
- var_ptr = _get_zval_ptr_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
+ var_ptr = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- if (IS_CV == IS_VAR && UNEXPECTED(*var_ptr == &EG(error_zval))) {
+ if (IS_CV == IS_VAR && UNEXPECTED(var_ptr == &EG(error_zval))) {
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
CHECK_EXCEPTION();
@@ -30299,22 +29210,21 @@ static int ZEND_FASTCALL ZEND_PRE_DEC_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
SEPARATE_ZVAL_IF_NOT_REF(var_ptr);
- if (UNEXPECTED(Z_TYPE_PP(var_ptr) == IS_OBJECT)
- && Z_OBJ_HANDLER_PP(var_ptr, get)
- && Z_OBJ_HANDLER_PP(var_ptr, set)) {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_OBJECT)
+ && Z_OBJ_HANDLER_P(var_ptr, get)
+ && Z_OBJ_HANDLER_P(var_ptr, set)) {
/* proxy object */
- zval *val = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC);
+ zval *val = Z_OBJ_HANDLER_P(var_ptr, get)(var_ptr TSRMLS_CC);
Z_ADDREF_P(val);
fast_decrement_function(val);
- Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, val TSRMLS_CC);
- zval_ptr_dtor(&val);
+ Z_OBJ_HANDLER_P(var_ptr, set)(var_ptr, val TSRMLS_CC);
+ zval_ptr_dtor(val);
} else {
- fast_decrement_function(*var_ptr);
+ fast_decrement_function(var_ptr);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(*var_ptr);
- EX_T(opline->result.var).var.ptr = *var_ptr;
+ ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
CHECK_EXCEPTION();
@@ -30325,38 +29235,37 @@ static int ZEND_FASTCALL ZEND_POST_INC_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS
{
USE_OPLINE
- zval **var_ptr, *retval;
+ zval *var_ptr, *retval;
SAVE_OPLINE();
- var_ptr = _get_zval_ptr_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
+ var_ptr = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- if (IS_CV == IS_VAR && UNEXPECTED(*var_ptr == &EG(error_zval))) {
- ZVAL_NULL(&EX_T(opline->result.var).tmp_var);
+ if (IS_CV == IS_VAR && UNEXPECTED(var_ptr == &EG(error_zval))) {
+ ZVAL_NULL(EX_VAR(opline->result.var));
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
- retval = &EX_T(opline->result.var).tmp_var;
- ZVAL_COPY_VALUE(retval, *var_ptr);
- zendi_zval_copy_ctor(*retval);
+ retval = EX_VAR(opline->result.var);
+ ZVAL_DUP(retval, var_ptr);
SEPARATE_ZVAL_IF_NOT_REF(var_ptr);
- if (UNEXPECTED(Z_TYPE_PP(var_ptr) == IS_OBJECT)
- && Z_OBJ_HANDLER_PP(var_ptr, get)
- && Z_OBJ_HANDLER_PP(var_ptr, set)) {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_OBJECT)
+ && Z_OBJ_HANDLER_P(var_ptr, get)
+ && Z_OBJ_HANDLER_P(var_ptr, set)) {
/* proxy object */
- zval *val = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC);
+ zval *val = Z_OBJ_HANDLER_P(var_ptr, get)(var_ptr TSRMLS_CC);
Z_ADDREF_P(val);
fast_increment_function(val);
- Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, val TSRMLS_CC);
- zval_ptr_dtor(&val);
+ Z_OBJ_HANDLER_P(var_ptr, set)(var_ptr, val TSRMLS_CC);
+ zval_ptr_dtor(val);
} else {
- fast_increment_function(*var_ptr);
+ fast_increment_function(var_ptr);
}
CHECK_EXCEPTION();
@@ -30367,38 +29276,37 @@ static int ZEND_FASTCALL ZEND_POST_DEC_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS
{
USE_OPLINE
- zval **var_ptr, *retval;
+ zval *var_ptr, *retval;
SAVE_OPLINE();
- var_ptr = _get_zval_ptr_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
+ var_ptr = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- if (IS_CV == IS_VAR && UNEXPECTED(*var_ptr == &EG(error_zval))) {
- ZVAL_NULL(&EX_T(opline->result.var).tmp_var);
+ if (IS_CV == IS_VAR && UNEXPECTED(var_ptr == &EG(error_zval))) {
+ ZVAL_NULL(EX_VAR(opline->result.var));
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
- retval = &EX_T(opline->result.var).tmp_var;
- ZVAL_COPY_VALUE(retval, *var_ptr);
- zendi_zval_copy_ctor(*retval);
+ retval = EX_VAR(opline->result.var);
+ ZVAL_DUP(retval, var_ptr);
SEPARATE_ZVAL_IF_NOT_REF(var_ptr);
- if (UNEXPECTED(Z_TYPE_PP(var_ptr) == IS_OBJECT)
- && Z_OBJ_HANDLER_PP(var_ptr, get)
- && Z_OBJ_HANDLER_PP(var_ptr, set)) {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_OBJECT)
+ && Z_OBJ_HANDLER_P(var_ptr, get)
+ && Z_OBJ_HANDLER_P(var_ptr, set)) {
/* proxy object */
- zval *val = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC);
+ zval *val = Z_OBJ_HANDLER_P(var_ptr, get)(var_ptr TSRMLS_CC);
Z_ADDREF_P(val);
fast_decrement_function(val);
- Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, val TSRMLS_CC);
- zval_ptr_dtor(&val);
+ Z_OBJ_HANDLER_P(var_ptr, set)(var_ptr, val TSRMLS_CC);
+ zval_ptr_dtor(val);
} else {
- fast_decrement_function(*var_ptr);
+ fast_decrement_function(var_ptr);
}
CHECK_EXCEPTION();
@@ -30415,7 +29323,7 @@ static int ZEND_FASTCALL ZEND_ECHO_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
z = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
if (IS_CV == IS_TMP_VAR && Z_TYPE_P(z) == IS_OBJECT) {
- INIT_PZVAL(z);
+//??? INIT_PZVAL(z);
}
zend_print_variable(z);
@@ -30427,7 +29335,7 @@ static int ZEND_FASTCALL ZEND_PRINT_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- ZVAL_LONG(&EX_T(opline->result.var).tmp_var, 1);
+ ZVAL_LONG(EX_VAR(opline->result.var), 1);
return ZEND_ECHO_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
@@ -30544,8 +29452,7 @@ static int ZEND_FASTCALL ZEND_JMPZ_EX_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
HANDLE_EXCEPTION();
}
}
- Z_LVAL(EX_T(opline->result.var).tmp_var) = retval;
- Z_TYPE(EX_T(opline->result.var).tmp_var) = IS_BOOL;
+ ZVAL_BOOL(EX_VAR(opline->result.var), retval);
if (!retval) {
#if DEBUG_ZEND>=2
printf("Conditional jmp to %d\n", opline->op2.opline_num);
@@ -30575,8 +29482,7 @@ static int ZEND_FASTCALL ZEND_JMPNZ_EX_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS
HANDLE_EXCEPTION();
}
}
- Z_LVAL(EX_T(opline->result.var).tmp_var) = retval;
- Z_TYPE(EX_T(opline->result.var).tmp_var) = IS_BOOL;
+ ZVAL_BOOL(EX_VAR(opline->result.var), retval);
if (retval) {
#if DEBUG_ZEND>=2
printf("Conditional jmp to %d\n", opline->op2.opline_num);
@@ -30596,32 +29502,22 @@ static int ZEND_FASTCALL ZEND_RETURN_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
SAVE_OPLINE();
retval_ptr = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
- if (!EG(return_value_ptr_ptr)) {
+ if (/*???!EG(return_value_ptr_ptr)*/0) {
} else {
if (IS_CV == IS_CONST ||
IS_CV == IS_TMP_VAR ||
- PZVAL_IS_REF(retval_ptr)) {
- zval *ret;
+ Z_ISREF_P(retval_ptr)) {
+ zval ret;
- ALLOC_ZVAL(ret);
- INIT_PZVAL_COPY(ret, retval_ptr);
+ ZVAL_COPY_VALUE(&ret, retval_ptr);
if (IS_CV != IS_TMP_VAR) {
- zval_copy_ctor(ret);
+ zval_copy_ctor(&ret);
}
- *EG(return_value_ptr_ptr) = ret;
+//??? *EG(return_value_ptr_ptr) = ret;
- } else if ((IS_CV == IS_CV || IS_CV == IS_VAR) &&
- retval_ptr == &EG(uninitialized_zval)) {
- zval *ret;
-
- if (IS_CV == IS_VAR) {
- Z_DELREF_P(retval_ptr);
- }
- ALLOC_INIT_ZVAL(ret);
- *EG(return_value_ptr_ptr) = ret;
} else {
- *EG(return_value_ptr_ptr) = retval_ptr;
+//??? *EG(return_value_ptr_ptr) = retval_ptr;
if (IS_CV == IS_CV) {
Z_ADDREF_P(retval_ptr);
}
@@ -30634,7 +29530,6 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER
{
USE_OPLINE
zval *retval_ptr;
- zval **retval_ptr_ptr;
SAVE_OPLINE();
@@ -30646,33 +29541,32 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER
zend_error(E_NOTICE, "Only variable references should be returned by reference");
retval_ptr = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
- if (!EG(return_value_ptr_ptr)) {
+ if (/*???!EG(return_value_ptr_ptr)*/0) {
if (IS_CV == IS_TMP_VAR) {
}
} else if (!0) { /* Not a temp var */
- zval *ret;
+ zval ret;
- ALLOC_ZVAL(ret);
- INIT_PZVAL_COPY(ret, retval_ptr);
- zval_copy_ctor(ret);
- *EG(return_value_ptr_ptr) = ret;
+ ZVAL_DUP(&ret, retval_ptr);
+//??? *EG(return_value_ptr_ptr) = ret;
} else {
- zval *ret;
+ zval ret;
- ALLOC_ZVAL(ret);
- INIT_PZVAL_COPY(ret, retval_ptr);
- *EG(return_value_ptr_ptr) = ret;
+ ZVAL_COPY_VALUE(&ret, retval_ptr);
+//??? *EG(return_value_ptr_ptr) = ret;
}
break;
}
- retval_ptr_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
+ retval_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(retval_ptr_ptr == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(retval_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot return string offsets by reference");
}
+//???
+#if 0
if (IS_CV == IS_VAR && !Z_ISREF_PP(retval_ptr_ptr)) {
if (opline->extended_value == ZEND_RETURNS_FUNCTION &&
EX_T(opline->op1.var).var.fcall_returned_reference) {
@@ -30682,8 +29576,7 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER
zval *ret;
ALLOC_ZVAL(ret);
- INIT_PZVAL_COPY(ret, *retval_ptr_ptr);
- zval_copy_ctor(ret);
+ INIT_DUP(ret, *retval_ptr_ptr);
*EG(return_value_ptr_ptr) = ret;
}
break;
@@ -30696,6 +29589,7 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER
*EG(return_value_ptr_ptr) = *retval_ptr_ptr;
}
+#endif
} while (0);
return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
@@ -30705,7 +29599,7 @@ static int ZEND_FASTCALL ZEND_THROW_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
zval *value;
- zval *exception;
+ zval exception;
SAVE_OPLINE();
@@ -30720,13 +29614,12 @@ static int ZEND_FASTCALL ZEND_THROW_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_exception_save(TSRMLS_C);
/* Not sure if a complete copy is what we want here */
- ALLOC_ZVAL(exception);
- INIT_PZVAL_COPY(exception, value);
+ ZVAL_COPY_VALUE(&exception, value);
if (!0) {
- zval_copy_ctor(exception);
+ zval_copy_ctor(&exception);
}
- zend_throw_exception_object(exception TSRMLS_CC);
+ zend_throw_exception_object(&exception TSRMLS_CC);
zend_exception_restore(TSRMLS_C);
HANDLE_EXCEPTION();
@@ -30735,26 +29628,18 @@ static int ZEND_FASTCALL ZEND_THROW_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
static int ZEND_FASTCALL zend_send_by_var_helper_SPEC_CV(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zval *varptr;
+ zval *varptr, var;
- varptr = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
- if (varptr == &EG(uninitialized_zval)) {
- if (IS_CV == IS_VAR) {
- Z_DELREF_P(varptr);
- }
- ALLOC_INIT_ZVAL(varptr);
- } else if (PZVAL_IS_REF(varptr)) {
+ varptr = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
+ if (Z_ISREF_P(varptr)) {
if (IS_CV == IS_CV ||
(IS_CV == IS_VAR && Z_REFCOUNT_P(varptr) > 2)) {
- zval *original_var = varptr;
-
- ALLOC_ZVAL(varptr);
- INIT_PZVAL_COPY(varptr, original_var);
- zval_copy_ctor(varptr);
+ ZVAL_DUP(&var, Z_REFVAL_P(varptr));
+ varptr = &var;
} else {
- Z_UNSET_ISREF_P(varptr);
+ varptr = Z_REFVAL_P(varptr);
}
} else if (IS_CV == IS_CV) {
Z_ADDREF_P(varptr);
@@ -30785,31 +29670,29 @@ static int ZEND_FASTCALL ZEND_SEND_VAR_NO_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDL
}
varptr = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
- if ((!(opline->extended_value & ZEND_ARG_SEND_FUNCTION) ||
- EX_T(opline->op1.var).var.fcall_returned_reference) &&
- varptr != &EG(uninitialized_zval) &&
- (PZVAL_IS_REF(varptr) || Z_REFCOUNT_P(varptr) == 1)) {
- Z_SET_ISREF_P(varptr);
- if (IS_CV == IS_CV) {
- Z_ADDREF_P(varptr);
- }
- zend_vm_stack_push(varptr TSRMLS_CC);
- } else {
- zval *valptr;
+//??? if ((!(opline->extended_value & ZEND_ARG_SEND_FUNCTION) ||
+//??? EX_T(opline->op1.var).var.fcall_returned_reference) &&
+//??? (Z_ISREF_P(varptr) || Z_REFCOUNT_P(varptr) == 1)) {
+//??? Z_SET_ISREF_P(varptr);
+//??? if (IS_CV == IS_CV) {
+//??? Z_ADDREF_P(varptr);
+//??? }
+//??? zend_vm_stack_push(varptr TSRMLS_CC);
+//??? } else {
+ zval val;
if ((opline->extended_value & ZEND_ARG_COMPILE_TIME_BOUND) ?
!(opline->extended_value & ZEND_ARG_SEND_SILENT) :
!ARG_MAY_BE_SENT_BY_REF(EX(call)->fbc, arg_num)) {
zend_error(E_STRICT, "Only variables should be passed by reference");
}
- ALLOC_ZVAL(valptr);
- INIT_PZVAL_COPY(valptr, varptr);
+ ZVAL_COPY_VALUE(&val, varptr);
if (!0) {
- zval_copy_ctor(valptr);
+ zval_copy_ctor(&val);
}
- zend_vm_stack_push(valptr TSRMLS_CC);
- }
+ zend_vm_stack_push(&val TSRMLS_CC);
+//??? }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -30818,19 +29701,17 @@ static int ZEND_FASTCALL ZEND_SEND_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS
{
USE_OPLINE
- zval **varptr_ptr;
zval *varptr;
SAVE_OPLINE();
- varptr_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
+ varptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(varptr_ptr == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(varptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Only variables can be passed by reference");
}
- if (IS_CV == IS_VAR && UNEXPECTED(*varptr_ptr == &EG(error_zval))) {
- ALLOC_INIT_ZVAL(varptr);
- zend_vm_stack_push(varptr TSRMLS_CC);
+ if (IS_CV == IS_VAR && UNEXPECTED(varptr == &EG(error_zval))) {
+ zend_vm_stack_push(&EG(uninitialized_zval) TSRMLS_CC);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -30843,8 +29724,7 @@ static int ZEND_FASTCALL ZEND_SEND_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS
}
}
- SEPARATE_ZVAL_TO_MAKE_IS_REF(varptr_ptr);
- varptr = *varptr_ptr;
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(varptr);
Z_ADDREF_P(varptr);
zend_vm_stack_push(varptr TSRMLS_CC);
@@ -30870,7 +29750,7 @@ static int ZEND_FASTCALL ZEND_BOOL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zval *retval = &EX_T(opline->result.var).tmp_var;
+ zval *retval = EX_VAR(opline->result.var);
SAVE_OPLINE();
/* PHP 3.0 returned "" for false and 1 for true, here we use 0 and 1 for now */
@@ -30916,29 +29796,22 @@ static int ZEND_FASTCALL ZEND_CLONE_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
/* Ensure that if we're calling a private function, we're allowed to do so.
*/
if (UNEXPECTED(ce != EG(scope))) {
- zend_error_noreturn(E_ERROR, "Call to private %s::__clone() from context '%s'", ce->name, EG(scope) ? EG(scope)->name : "");
+ zend_error_noreturn(E_ERROR, "Call to private %s::__clone() from context '%s'", ce->name->val, EG(scope) ? EG(scope)->name->val : "");
}
} else if ((clone->common.fn_flags & ZEND_ACC_PROTECTED)) {
/* Ensure that if we're calling a protected function, we're allowed to do so.
*/
if (UNEXPECTED(!zend_check_protected(zend_get_function_root_class(clone), EG(scope)))) {
- zend_error_noreturn(E_ERROR, "Call to protected %s::__clone() from context '%s'", ce->name, EG(scope) ? EG(scope)->name : "");
+ zend_error_noreturn(E_ERROR, "Call to protected %s::__clone() from context '%s'", ce->name->val, EG(scope) ? EG(scope)->name->val : "");
}
}
}
if (EXPECTED(EG(exception) == NULL)) {
- zval *retval;
-
- ALLOC_ZVAL(retval);
- Z_OBJVAL_P(retval) = clone_call(obj TSRMLS_CC);
- Z_TYPE_P(retval) = IS_OBJECT;
- Z_SET_REFCOUNT_P(retval, 1);
- Z_SET_ISREF_P(retval);
+ ZVAL_OBJ(EX_VAR(opline->result.var), clone_call(obj TSRMLS_CC));
+//??? Z_SET_ISREF_P(retval);
if (!RETURN_VALUE_USED(opline) || UNEXPECTED(EG(exception) != NULL)) {
- zval_ptr_dtor(&retval);
- } else {
- EX_T(opline->result.var).var.ptr = retval;
+ zval_ptr_dtor(EX_VAR(opline->result.var));
}
}
@@ -30951,7 +29824,7 @@ static int ZEND_FASTCALL ZEND_CAST_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
USE_OPLINE
zval *expr;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
expr = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
@@ -30959,7 +29832,7 @@ static int ZEND_FASTCALL ZEND_CAST_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
if (opline->extended_value != IS_STRING) {
ZVAL_COPY_VALUE(result, expr);
if (!0) {
- zendi_zval_copy_ctor(*result);
+ zval_copy_ctor(result);
}
}
switch (opline->extended_value) {
@@ -30988,7 +29861,7 @@ static int ZEND_FASTCALL ZEND_CAST_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
} else {
ZVAL_COPY_VALUE(result, expr);
if (!0) {
- zendi_zval_copy_ctor(*result);
+ zval_copy_ctor(result);
}
}
break;
@@ -31011,18 +29884,17 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDL
zend_op_array *new_op_array=NULL;
zval *inc_filename;
- zval *tmp_inc_filename = NULL;
+ zval tmp_inc_filename;
zend_bool failure_retval=0;
SAVE_OPLINE();
inc_filename = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
+ ZVAL_UNDEF(&tmp_inc_filename);
if (inc_filename->type!=IS_STRING) {
- MAKE_STD_ZVAL(tmp_inc_filename);
- ZVAL_COPY_VALUE(tmp_inc_filename, inc_filename);
- zval_copy_ctor(tmp_inc_filename);
- convert_to_string(tmp_inc_filename);
- inc_filename = tmp_inc_filename;
+ ZVAL_DUP(&tmp_inc_filename, inc_filename);
+ convert_to_string(&tmp_inc_filename);
+ inc_filename = &tmp_inc_filename;
}
if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRLEN_P(inc_filename)) {
@@ -31040,7 +29912,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDL
resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename) TSRMLS_CC);
if (resolved_path) {
- failure_retval = zend_hash_exists(&EG(included_files), resolved_path, strlen(resolved_path)+1);
+//??? failure_retval = zend_hash_exists(&EG(included_files), resolved_path, strlen(resolved_path)+1);
} else {
resolved_path = Z_STRVAL_P(inc_filename);
}
@@ -31053,13 +29925,13 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDL
file_handle.opened_path = estrdup(resolved_path);
}
- if (zend_hash_add_empty_element(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path)+1)==SUCCESS) {
- new_op_array = zend_compile_file(&file_handle, (opline->extended_value==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC);
- zend_destroy_file_handle(&file_handle TSRMLS_CC);
- } else {
- zend_file_handle_dtor(&file_handle TSRMLS_CC);
- failure_retval=1;
- }
+//??? if (zend_hash_add_empty_element(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path)+1)==SUCCESS) {
+//??? new_op_array = zend_compile_file(&file_handle, (opline->extended_value==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC);
+//??? zend_destroy_file_handle(&file_handle TSRMLS_CC);
+//??? } else {
+//??? zend_file_handle_dtor(&file_handle TSRMLS_CC);
+//??? failure_retval=1;
+//??? }
} else {
if (opline->extended_value == ZEND_INCLUDE_ONCE) {
zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC);
@@ -31086,24 +29958,24 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDL
EMPTY_SWITCH_DEFAULT_CASE()
}
}
- if (tmp_inc_filename) {
+ if (Z_TYPE(tmp_inc_filename) != IS_UNDEF) {
zval_ptr_dtor(&tmp_inc_filename);
}
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
} else if (EXPECTED(new_op_array != NULL)) {
- EX(original_return_value) = EG(return_value_ptr_ptr);
+//??? EX(original_return_value) = EG(return_value_ptr_ptr);
EG(active_op_array) = new_op_array;
if (RETURN_VALUE_USED(opline)) {
- EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
- EG(return_value_ptr_ptr) = EX_T(opline->result.var).var.ptr_ptr;
+//??? EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
+//??? EG(return_value_ptr_ptr) = EX_T(opline->result.var).var.ptr_ptr;
} else {
- EG(return_value_ptr_ptr) = NULL;
+//??? EG(return_value_ptr_ptr) = NULL;
}
EX(function_state).function = (zend_function *) new_op_array;
- EX(object) = NULL;
+ ZVAL_UNDEF(&EX(object));
if (!EG(active_symbol_table)) {
zend_rebuild_symbol_table(TSRMLS_C);
@@ -31119,7 +29991,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDL
EG(opline_ptr) = &EX(opline);
EG(active_op_array) = EX(op_array);
- EG(return_value_ptr_ptr) = EX(original_return_value);
+//??? EG(return_value_ptr_ptr) = EX(original_return_value);
destroy_op_array(new_op_array TSRMLS_CC);
efree(new_op_array);
if (UNEXPECTED(EG(exception) != NULL)) {
@@ -31128,12 +30000,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDL
}
} else if (RETURN_VALUE_USED(opline)) {
- zval *retval;
-
- ALLOC_ZVAL(retval);
- ZVAL_BOOL(retval, failure_retval);
- INIT_PZVAL(retval);
- EX_T(opline->result.var).var.ptr = retval;
+ ZVAL_BOOL(EX_VAR(opline->result.var), failure_retval);
}
ZEND_VM_NEXT_OPCODE();
}
@@ -31142,7 +30009,7 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS
{
USE_OPLINE
- zval *array_ptr, **array_ptr_ptr;
+ zval *array_ptr;
HashTable *fe_ht;
zend_object_iterator *iter = NULL;
zend_class_entry *ce = NULL;
@@ -31152,40 +30019,35 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS
if ((IS_CV == IS_CV || IS_CV == IS_VAR) &&
(opline->extended_value & ZEND_FE_RESET_VARIABLE)) {
- array_ptr_ptr = _get_zval_ptr_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
- if (array_ptr_ptr == NULL || array_ptr_ptr == &EG(uninitialized_zval_ptr)) {
- MAKE_STD_ZVAL(array_ptr);
- ZVAL_NULL(array_ptr);
- } else if (Z_TYPE_PP(array_ptr_ptr) == IS_OBJECT) {
- if(Z_OBJ_HT_PP(array_ptr_ptr)->get_class_entry == NULL) {
+ array_ptr = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
+ if (Z_TYPE_P(array_ptr) == IS_NULL) {
+ } else if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
+ if(Z_OBJ_HT_P(array_ptr)->get_class_entry == NULL) {
zend_error(E_WARNING, "foreach() cannot iterate over objects without PHP class");
ZEND_VM_JMP(EX(op_array)->opcodes+opline->op2.opline_num);
}
- ce = Z_OBJCE_PP(array_ptr_ptr);
+ ce = Z_OBJCE_P(array_ptr);
if (!ce || ce->get_iterator == NULL) {
- SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr);
- Z_ADDREF_PP(array_ptr_ptr);
+ SEPARATE_ZVAL_IF_NOT_REF(array_ptr);
+ Z_ADDREF_P(array_ptr);
}
- array_ptr = *array_ptr_ptr;
} else {
- if (Z_TYPE_PP(array_ptr_ptr) == IS_ARRAY) {
- SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr);
+ if (Z_TYPE_P(array_ptr) == IS_ARRAY) {
+ SEPARATE_ZVAL_IF_NOT_REF(array_ptr);
if (opline->extended_value & ZEND_FE_FETCH_BYREF) {
- Z_SET_ISREF_PP(array_ptr_ptr);
+ ZVAL_NEW_REF(array_ptr, array_ptr);
}
}
- array_ptr = *array_ptr_ptr;
Z_ADDREF_P(array_ptr);
}
} else {
array_ptr = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
if (0) { /* IS_TMP_VAR */
- zval *tmp;
+ zval tmp;
- ALLOC_ZVAL(tmp);
- INIT_PZVAL_COPY(tmp, array_ptr);
- array_ptr = tmp;
+ ZVAL_COPY_VALUE(&tmp, array_ptr);
+ array_ptr = &tmp;
if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
ce = Z_OBJCE_P(array_ptr);
if (ce && ce->get_iterator) {
@@ -31206,15 +30068,13 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS
(IS_CV == IS_VAR &&
!Z_ISREF_P(array_ptr) &&
Z_REFCOUNT_P(array_ptr) > 2)) {
- zval *tmp;
+ zval tmp;
if (IS_CV == IS_VAR) {
Z_DELREF_P(array_ptr);
}
- ALLOC_ZVAL(tmp);
- INIT_PZVAL_COPY(tmp, array_ptr);
- zval_copy_ctor(tmp);
- array_ptr = tmp;
+ ZVAL_DUP(&tmp, array_ptr);
+ array_ptr = &tmp;
} else if (IS_CV == IS_CV) {
Z_ADDREF_P(array_ptr);
}
@@ -31240,14 +30100,14 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS
}
}
- EX_T(opline->result.var).fe.ptr = array_ptr;
+ ZVAL_COPY_VALUE(EX_VAR(opline->result.var), array_ptr);
if (iter) {
iter->index = 0;
if (iter->funcs->rewind) {
iter->funcs->rewind(iter TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
- zval_ptr_dtor(&array_ptr);
+ zval_ptr_dtor(array_ptr);
if (IS_CV == IS_VAR && opline->extended_value & ZEND_FE_RESET_VARIABLE) {
}
@@ -31256,7 +30116,7 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS
}
is_empty = iter->funcs->valid(iter TSRMLS_CC) != SUCCESS;
if (UNEXPECTED(EG(exception) != NULL)) {
- zval_ptr_dtor(&array_ptr);
+ zval_ptr_dtor(array_ptr);
if (IS_CV == IS_VAR && opline->extended_value & ZEND_FE_RESET_VARIABLE) {
}
@@ -31266,24 +30126,23 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS
} else if ((fe_ht = HASH_OF(array_ptr)) != NULL) {
zend_hash_internal_pointer_reset(fe_ht);
if (ce) {
- zend_object *zobj = zend_objects_get_address(array_ptr TSRMLS_CC);
+ zend_object *zobj = Z_OBJ_P(array_ptr);
while (zend_hash_has_more_elements(fe_ht) == SUCCESS) {
- char *str_key;
- uint str_key_len;
+ zend_string *str_key;
ulong int_key;
zend_uchar key_type;
- key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &str_key_len, &int_key, 0, NULL);
+ key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &int_key, 0, NULL);
if (key_type != HASH_KEY_NON_EXISTENT &&
(key_type == HASH_KEY_IS_LONG ||
- zend_check_property_access(zobj, str_key, str_key_len-1 TSRMLS_CC) == SUCCESS)) {
+ zend_check_property_access(zobj, str_key TSRMLS_CC) == SUCCESS)) {
break;
}
zend_hash_move_forward(fe_ht);
}
}
is_empty = zend_hash_has_more_elements(fe_ht) != SUCCESS;
- zend_hash_get_pointer(fe_ht, &EX_T(opline->result.var).fe.fe_pos);
+//??? zend_hash_get_pointer(fe_ht, EX_VAR(opline->result.var));
} else {
zend_error(E_WARNING, "Invalid argument supplied for foreach()");
is_empty = 1;
@@ -31332,9 +30191,9 @@ static int ZEND_FASTCALL ZEND_JMP_SET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
value = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
if (i_zend_is_true(value TSRMLS_CC)) {
- ZVAL_COPY_VALUE(&EX_T(opline->result.var).tmp_var, value);
+ ZVAL_COPY_VALUE(EX_VAR(opline->result.var), value);
if (!0) {
- zendi_zval_copy_ctor(EX_T(opline->result.var).tmp_var);
+ zval_copy_ctor(EX_VAR(opline->result.var));
}
#if DEBUG_ZEND>=2
@@ -31351,23 +30210,19 @@ static int ZEND_FASTCALL ZEND_JMP_SET_VAR_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_A
{
USE_OPLINE
- zval *value, *ret;
+ zval *value;
SAVE_OPLINE();
value = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
if (i_zend_is_true(value TSRMLS_CC)) {
if (IS_CV == IS_VAR || IS_CV == IS_CV) {
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
Z_ADDREF_P(value);
- EX_T(opline->result.var).var.ptr = value;
- EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
} else {
- ALLOC_ZVAL(ret);
- INIT_PZVAL_COPY(ret, value);
- EX_T(opline->result.var).var.ptr = ret;
- EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
+ ZVAL_COPY_VALUE(EX_VAR(opline->result.var), value);
if (!0) {
- zval_copy_ctor(EX_T(opline->result.var).var.ptr);
+ zval_copy_ctor(EX_VAR(opline->result.var));
}
}
@@ -31390,9 +30245,9 @@ static int ZEND_FASTCALL ZEND_QM_ASSIGN_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG
SAVE_OPLINE();
value = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
- ZVAL_COPY_VALUE(&EX_T(opline->result.var).tmp_var, value);
+ ZVAL_COPY_VALUE(EX_VAR(opline->result.var), value);
if (!0) {
- zval_copy_ctor(&EX_T(opline->result.var).tmp_var);
+ zval_copy_ctor(EX_VAR(opline->result.var));
}
CHECK_EXCEPTION();
@@ -31403,22 +30258,17 @@ static int ZEND_FASTCALL ZEND_QM_ASSIGN_VAR_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER
{
USE_OPLINE
- zval *value, *ret;
+ zval *value;
SAVE_OPLINE();
value = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
if (IS_CV == IS_VAR || IS_CV == IS_CV) {
- Z_ADDREF_P(value);
- EX_T(opline->result.var).var.ptr = value;
- EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
} else {
- ALLOC_ZVAL(ret);
- INIT_PZVAL_COPY(ret, value);
- EX_T(opline->result.var).var.ptr = ret;
- EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
+ ZVAL_COPY_VALUE(EX_VAR(opline->result.var), value);
if (!0) {
- zval_copy_ctor(EX_T(opline->result.var).var.ptr);
+ zval_copy_ctor(EX_VAR(opline->result.var));
}
}
@@ -31437,11 +30287,11 @@ static int ZEND_FASTCALL ZEND_INSTANCEOF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_AR
expr = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
if (Z_TYPE_P(expr) == IS_OBJECT && Z_OBJ_HT_P(expr)->get_class_entry) {
- result = instanceof_function(Z_OBJCE_P(expr), EX_T(opline->op2.var).class_entry TSRMLS_CC);
+ result = instanceof_function(Z_OBJCE_P(expr), Z_CE_P(EX_VAR(opline->op2.var)) TSRMLS_CC);
} else {
result = 0;
}
- ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, result);
+ ZVAL_BOOL(EX_VAR(opline->result.var), result);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -31453,7 +30303,7 @@ static int ZEND_FASTCALL ZEND_ADD_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG
SAVE_OPLINE();
- fast_add_function(&EX_T(opline->result.var).tmp_var,
+ fast_add_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
@@ -31468,7 +30318,7 @@ static int ZEND_FASTCALL ZEND_SUB_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG
SAVE_OPLINE();
- fast_sub_function(&EX_T(opline->result.var).tmp_var,
+ fast_sub_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
@@ -31483,7 +30333,7 @@ static int ZEND_FASTCALL ZEND_MUL_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG
SAVE_OPLINE();
- fast_mul_function(&EX_T(opline->result.var).tmp_var,
+ fast_mul_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
@@ -31498,7 +30348,7 @@ static int ZEND_FASTCALL ZEND_DIV_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG
SAVE_OPLINE();
- fast_div_function(&EX_T(opline->result.var).tmp_var,
+ fast_div_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
@@ -31513,7 +30363,7 @@ static int ZEND_FASTCALL ZEND_MOD_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG
SAVE_OPLINE();
- fast_mod_function(&EX_T(opline->result.var).tmp_var,
+ fast_mod_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
@@ -31528,7 +30378,7 @@ static int ZEND_FASTCALL ZEND_SL_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS
SAVE_OPLINE();
- shift_left_function(&EX_T(opline->result.var).tmp_var,
+ shift_left_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
@@ -31543,7 +30393,7 @@ static int ZEND_FASTCALL ZEND_SR_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS
SAVE_OPLINE();
- shift_right_function(&EX_T(opline->result.var).tmp_var,
+ shift_right_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
@@ -31558,7 +30408,7 @@ static int ZEND_FASTCALL ZEND_CONCAT_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_
SAVE_OPLINE();
- concat_function(&EX_T(opline->result.var).tmp_var,
+ concat_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
@@ -31573,7 +30423,7 @@ static int ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HA
SAVE_OPLINE();
- is_identical_function(&EX_T(opline->result.var).tmp_var,
+ is_identical_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
@@ -31586,7 +30436,7 @@ static int ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_CV_CONST_HANDLER(ZEND_OPCOD
{
USE_OPLINE
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
is_identical_function(result,
@@ -31603,7 +30453,7 @@ static int ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLE
{
USE_OPLINE
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_equal_function(result,
@@ -31619,7 +30469,7 @@ static int ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HA
{
USE_OPLINE
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_not_equal_function(result,
@@ -31635,7 +30485,7 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HAND
{
USE_OPLINE
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_is_smaller_function(result,
@@ -31651,7 +30501,7 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_CV_CONST_HANDLER(ZEND_OP
{
USE_OPLINE
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_is_smaller_or_equal_function(result,
@@ -31669,7 +30519,7 @@ static int ZEND_FASTCALL ZEND_BW_OR_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_A
SAVE_OPLINE();
- bitwise_or_function(&EX_T(opline->result.var).tmp_var,
+ bitwise_or_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
@@ -31684,7 +30534,7 @@ static int ZEND_FASTCALL ZEND_BW_AND_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_
SAVE_OPLINE();
- bitwise_and_function(&EX_T(opline->result.var).tmp_var,
+ bitwise_and_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
@@ -31699,7 +30549,7 @@ static int ZEND_FASTCALL ZEND_BW_XOR_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_
SAVE_OPLINE();
- bitwise_xor_function(&EX_T(opline->result.var).tmp_var,
+ bitwise_xor_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
@@ -31714,7 +30564,7 @@ static int ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLE
SAVE_OPLINE();
- boolean_xor_function(&EX_T(opline->result.var).tmp_var,
+ boolean_xor_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
@@ -31727,18 +30577,16 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_CONST(int (*bi
{
USE_OPLINE
zend_free_op free_op_data1;
- zval **object_ptr = _get_zval_ptr_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
- zval *object;
+ zval *object = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
zval *property = opline->op2.zv;
zval *value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
int have_get_ptr = 0;
- if (IS_CV == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- make_real_object(object_ptr TSRMLS_CC);
- object = *object_ptr;
+ make_real_object(object TSRMLS_CC);
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to assign property of non-object");
@@ -31746,8 +30594,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_CONST(int (*bi
FREE_OP(free_op_data1);
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
} else {
/* here we are sure we are dealing with an object */
@@ -31758,15 +30605,14 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_CONST(int (*bi
/* here property is a string */
if (opline->extended_value == ZEND_ASSIGN_OBJ
&& Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval **zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
have_get_ptr = 1;
- binary_op(*zptr, *zptr, value TSRMLS_CC);
+ binary_op(zptr, zptr, value TSRMLS_CC);
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(*zptr);
- EX_T(opline->result.var).var.ptr = *zptr;
+ ZVAL_COPY(EX_VAR(opline->result.var), zptr);
}
}
}
@@ -31790,12 +30636,11 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_CONST(int (*bi
if (Z_REFCOUNT_P(z) == 0) {
GC_REMOVE_ZVAL_FROM_BUFFER(z);
zval_dtor(z);
- FREE_ZVAL(z);
}
z = value;
}
Z_ADDREF_P(z);
- SEPARATE_ZVAL_IF_NOT_REF(&z);
+ SEPARATE_ZVAL_IF_NOT_REF(z);
binary_op(z, z, value TSRMLS_CC);
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
@@ -31803,21 +30648,19 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_CONST(int (*bi
Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(z);
- EX_T(opline->result.var).var.ptr = z;
+ ZVAL_COPY(EX_VAR(opline->result.var), z);
}
- zval_ptr_dtor(&z);
+ zval_ptr_dtor(z);
} else {
zend_error(E_WARNING, "Attempt to assign property of non-object");
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
}
}
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
}
@@ -31834,7 +30677,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_CV_CONST(int (*binary
{
USE_OPLINE
zend_free_op free_op_data2, free_op_data1;
- zval **var_ptr;
+ zval *var_ptr;
zval *value;
SAVE_OPLINE();
@@ -31843,39 +30686,38 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_CV_CONST(int (*binary
return zend_binary_assign_op_obj_helper_SPEC_CV_CONST(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
break;
case ZEND_ASSIGN_DIM: {
- zval **container = _get_zval_ptr_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
+ zval *container = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- } else if (UNEXPECTED(Z_TYPE_PP(container) == IS_OBJECT)) {
+ } else if (UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
if (IS_CV == IS_VAR && !0) {
- Z_ADDREF_PP(container); /* undo the effect of get_obj_zval_ptr_ptr() */
+ Z_ADDREF_P(container); /* undo the effect of get_obj_zval_ptr_ptr() */
}
return zend_binary_assign_op_obj_helper_SPEC_CV_CONST(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
} else {
zval *dim = opline->op2.zv;
- zend_fetch_dimension_address(&EX_T((opline+1)->op2.var), container, dim, IS_CONST, BP_VAR_RW TSRMLS_CC);
+ zend_fetch_dimension_address(EX_VAR((opline+1)->op2.var), container, dim, IS_CONST, BP_VAR_RW TSRMLS_CC);
value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
- var_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
+ var_ptr = _get_zval_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
}
}
break;
default:
value = opline->op2.zv;
- var_ptr = _get_zval_ptr_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
+ var_ptr = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
/* do nothing */
break;
}
- if (UNEXPECTED(var_ptr == NULL)) {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
}
- if (UNEXPECTED(*var_ptr == &EG(error_zval))) {
+ if (UNEXPECTED(var_ptr == &EG(error_zval))) {
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
@@ -31888,22 +30730,21 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_CV_CONST(int (*binary
SEPARATE_ZVAL_IF_NOT_REF(var_ptr);
- if (UNEXPECTED(Z_TYPE_PP(var_ptr) == IS_OBJECT)
- && Z_OBJ_HANDLER_PP(var_ptr, get)
- && Z_OBJ_HANDLER_PP(var_ptr, set)) {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_OBJECT)
+ && Z_OBJ_HANDLER_P(var_ptr, get)
+ && Z_OBJ_HANDLER_P(var_ptr, set)) {
/* proxy object */
- zval *objval = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC);
+ zval *objval = Z_OBJ_HANDLER_P(var_ptr, get)(var_ptr TSRMLS_CC);
Z_ADDREF_P(objval);
binary_op(objval, objval, value TSRMLS_CC);
- Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, objval TSRMLS_CC);
- zval_ptr_dtor(&objval);
+ Z_OBJ_HANDLER_P(var_ptr, set)(var_ptr, objval TSRMLS_CC);
+ zval_ptr_dtor(objval);
} else {
- binary_op(*var_ptr, *var_ptr, value TSRMLS_CC);
+ binary_op(var_ptr, var_ptr, value TSRMLS_CC);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(*var_ptr);
- EX_T(opline->result.var).var.ptr = *var_ptr;
+ ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
if (opline->extended_value == ZEND_ASSIGN_DIM) {
@@ -31978,30 +30819,27 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_CV_CONST(incdec_t
{
USE_OPLINE
- zval **object_ptr;
zval *object;
zval *property;
- zval **retval;
+ zval *retval;
int have_get_ptr = 0;
SAVE_OPLINE();
- object_ptr = _get_zval_ptr_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
+ object = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
property = opline->op2.zv;
- retval = &EX_T(opline->result.var).var.ptr;
+ retval = EX_VAR(opline->result.var);
- if (IS_CV == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
- object = *object_ptr;
+ make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- *retval = &EG(uninitialized_zval);
+ ZVAL_NULL(retval);
}
CHECK_EXCEPTION();
@@ -32015,15 +30853,14 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_CV_CONST(incdec_t
}
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval **zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
have_get_ptr = 1;
- incdec_op(*zptr);
+ incdec_op(zptr);
if (RETURN_VALUE_USED(opline)) {
- *retval = *zptr;
- PZVAL_LOCK(*retval);
+ ZVAL_COPY(retval, zptr);
}
}
}
@@ -32038,28 +30875,26 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_CV_CONST(incdec_t
if (Z_REFCOUNT_P(z) == 0) {
GC_REMOVE_ZVAL_FROM_BUFFER(z);
zval_dtor(z);
- FREE_ZVAL(z);
}
z = value;
}
Z_ADDREF_P(z);
- SEPARATE_ZVAL_IF_NOT_REF(&z);
+ SEPARATE_ZVAL_IF_NOT_REF(z);
incdec_op(z);
- *retval = z;
+ ZVAL_COPY_VALUE(retval, z);
Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- SELECTIVE_PZVAL_LOCK(*retval, opline);
- zval_ptr_dtor(&z);
+ SELECTIVE_PZVAL_LOCK(retval, opline);
+ zval_ptr_dtor(z);
} else {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- *retval = &EG(uninitialized_zval);
+ ZVAL_NULL(retval);
}
}
}
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
}
@@ -32082,23 +30917,21 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_CONST(incdec_t
{
USE_OPLINE
- zval **object_ptr;
zval *object;
zval *property;
zval *retval;
int have_get_ptr = 0;
SAVE_OPLINE();
- object_ptr = _get_zval_ptr_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
+ object = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
property = opline->op2.zv;
- retval = &EX_T(opline->result.var).tmp_var;
+ retval = EX_VAR(opline->result.var);
- if (IS_CV == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
- object = *object_ptr;
+ make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
@@ -32116,15 +30949,14 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_CONST(incdec_t
}
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval **zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
have_get_ptr = 1;
SEPARATE_ZVAL_IF_NOT_REF(zptr);
- ZVAL_COPY_VALUE(retval, *zptr);
- zendi_zval_copy_ctor(*retval);
+ ZVAL_DUP(retval, zptr);
- incdec_op(*zptr);
+ incdec_op(zptr);
}
}
@@ -32132,7 +30964,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_CONST(incdec_t
if (!have_get_ptr) {
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- zval *z_copy;
+ zval z_copy;
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC);
@@ -32140,20 +30972,16 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_CONST(incdec_t
if (Z_REFCOUNT_P(z) == 0) {
GC_REMOVE_ZVAL_FROM_BUFFER(z);
zval_dtor(z);
- FREE_ZVAL(z);
}
z = value;
}
- ZVAL_COPY_VALUE(retval, z);
- zendi_zval_copy_ctor(*retval);
- ALLOC_ZVAL(z_copy);
- INIT_PZVAL_COPY(z_copy, z);
- zendi_zval_copy_ctor(*z_copy);
- incdec_op(z_copy);
+ ZVAL_DUP(retval, z);
+ ZVAL_DUP(&z_copy, z);
+ incdec_op(&z_copy);
Z_ADDREF_P(z);
- Z_OBJ_HT_P(object)->write_property(object, property, z_copy, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(object)->write_property(object, property, &z_copy, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval_ptr_dtor(&z_copy);
- zval_ptr_dtor(&z);
+ zval_ptr_dtor(z);
} else {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
ZVAL_NULL(retval);
@@ -32161,7 +30989,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_CONST(incdec_t
}
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
}
@@ -32185,19 +31013,17 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_CONST(int type, Z
USE_OPLINE
zend_free_op free_op1;
zval *varname;
- zval **retval;
+ zval *retval;
zval tmp_varname;
HashTable *target_symbol_table;
- ulong hash_value;
SAVE_OPLINE();
varname = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
if (IS_CV != IS_CONST && UNEXPECTED(Z_TYPE_P(varname) != IS_STRING)) {
- ZVAL_COPY_VALUE(&tmp_varname, varname);
- zval_copy_ctor(&tmp_varname);
- Z_SET_REFCOUNT(tmp_varname, 1);
- Z_UNSET_ISREF(tmp_varname);
+ ZVAL_DUP(&tmp_varname, varname);
+//??? Z_SET_REFCOUNT(tmp_varname, 1);
+//??? Z_UNSET_ISREF(tmp_varname);
convert_to_string(&tmp_varname);
varname = &tmp_varname;
}
@@ -32209,7 +31035,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_CONST(int type, Z
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
ce = CACHED_PTR(opline->op2.literal->cache_slot);
} else {
- ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
if (IS_CV != IS_CONST && varname == &tmp_varname) {
zval_dtor(&tmp_varname);
@@ -32221,9 +31047,9 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_CONST(int type, Z
CACHE_PTR(opline->op2.literal->cache_slot, ce);
}
} else {
- ce = EX_T(opline->op2.var).class_entry;
+ ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0, ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ retval = zend_std_get_static_property(ce, Z_STR_P(varname), 0, ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
} else {
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
@@ -32233,27 +31059,21 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_CONST(int type, Z
ZEND_VM_NEXT_OPCODE();
}
*/
- if (IS_CV == IS_CONST) {
- hash_value = Z_HASH_P(varname);
- } else {
- hash_value = str_hash(Z_STRVAL_P(varname), Z_STRLEN_P(varname));
- }
-
- if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) {
+ if ((retval = zend_hash_find(target_symbol_table, Z_STR_P(varname))) == NULL) {
switch (type) {
case BP_VAR_R:
case BP_VAR_UNSET:
zend_error(E_NOTICE,"Undefined variable: %s", Z_STRVAL_P(varname));
/* break missing intentionally */
case BP_VAR_IS:
- retval = &EG(uninitialized_zval_ptr);
+ ZVAL_NULL(retval);
break;
case BP_VAR_RW:
zend_error(E_NOTICE,"Undefined variable: %s", Z_STRVAL_P(varname));
/* break missing intentionally */
case BP_VAR_W:
Z_ADDREF_P(&EG(uninitialized_zval));
- zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval);
+ retval = zend_hash_update(target_symbol_table, Z_STR_P(varname), &EG(uninitialized_zval));
break;
EMPTY_SWITCH_DEFAULT_CASE()
}
@@ -32272,7 +31092,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_CONST(int type, Z
break;
case ZEND_FETCH_GLOBAL_LOCK:
if (IS_CV == IS_VAR && !free_op1.var) {
- PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
+ Z_ADDREF_P(EX_VAR(opline->op1.var));
}
break;
}
@@ -32285,27 +31105,26 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_CONST(int type, Z
if (opline->extended_value & ZEND_FETCH_MAKE_REF) {
SEPARATE_ZVAL_TO_MAKE_IS_REF(retval);
}
- PZVAL_LOCK(*retval);
- switch (type) {
- case BP_VAR_R:
- case BP_VAR_IS:
- EX_T(opline->result.var).var.ptr = *retval;
- break;
- case BP_VAR_UNSET: {
- zend_free_op free_res;
-
- PZVAL_UNLOCK(*retval, &free_res);
- if (retval != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(retval);
- }
- PZVAL_LOCK(*retval);
- FREE_OP_VAR_PTR(free_res);
- }
- /* break missing intentionally */
- default:
- EX_T(opline->result.var).var.ptr_ptr = retval;
- break;
- }
+ ZVAL_COPY(EX_VAR(opline->result.var), retval);
+//??? switch (type) {
+//??? case BP_VAR_R:
+//??? case BP_VAR_IS:
+//??? break;
+//??? case BP_VAR_UNSET: {
+//??? zend_free_op free_res;
+//???
+//??? PZVAL_UNLOCK(*retval, &free_res);
+//??? if (retval != &EG(uninitialized_zval_ptr)) {
+//??? SEPARATE_ZVAL_IF_NOT_REF(retval);
+//??? }
+//??? PZVAL_LOCK(*retval);
+//??? FREE_OP_VAR_PTR(free_res);
+//??? }
+//??? /* break missing intentionally */
+//??? default:
+//??? EX_T(opline->result.var).var.ptr_ptr = retval;
+//??? break;
+//??? }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -32350,7 +31169,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HAN
SAVE_OPLINE();
container = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC);
+ zend_fetch_dimension_address_read(EX_VAR(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC);
if (IS_CV != IS_VAR || !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
@@ -32363,29 +31182,27 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HAN
{
USE_OPLINE
zend_free_op free_op1;
- zval **container;
+ zval *container;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
+ container = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_fetch_dimension_address(&EX_T(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_W TSRMLS_CC);
+ zend_fetch_dimension_address(EX_VAR(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_W TSRMLS_CC);
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
+//??? if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
+//??? }
/* We are going to assign the result by reference */
if (UNEXPECTED(opline->extended_value != 0)) {
- zval **retval_ptr = EX_T(opline->result.var).var.ptr_ptr;
+ zval *retval_ptr = EX_VAR(opline->result.var);
- if (retval_ptr) {
- Z_DELREF_PP(retval_ptr);
- SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
- Z_ADDREF_PP(retval_ptr);
- }
+ Z_DELREF_P(retval_ptr);
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
+ Z_ADDREF_P(retval_ptr);
}
CHECK_EXCEPTION();
@@ -32396,19 +31213,19 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HA
{
USE_OPLINE
zend_free_op free_op1;
- zval **container;
+ zval *container;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
+ container = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_fetch_dimension_address(&EX_T(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_RW TSRMLS_CC);
+ zend_fetch_dimension_address(EX_VAR(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_RW TSRMLS_CC);
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
+//??? if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -32422,7 +31239,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HA
SAVE_OPLINE();
container = _get_zval_ptr_cv_BP_VAR_IS(execute_data, opline->op1.var TSRMLS_CC);
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_IS TSRMLS_CC);
+ zend_fetch_dimension_address_read(EX_VAR(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_IS TSRMLS_CC);
CHECK_EXCEPTION();
@@ -32432,29 +31249,28 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HA
static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
+ zval *container;
zend_free_op free_op1;
SAVE_OPLINE();
if (zend_is_by_ref_func_arg_fetch(opline, EX(call) TSRMLS_CC)) {
- zval **container = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
+ container = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_fetch_dimension_address(&EX_T(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_W TSRMLS_CC);
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
+ zend_fetch_dimension_address(EX_VAR(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_W TSRMLS_CC);
+//??? if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
} else {
- zval *container;
-
if (IS_CONST == IS_UNUSED) {
zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
}
container = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC);
+ zend_fetch_dimension_address_read(EX_VAR(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC);
}
@@ -32466,37 +31282,33 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_CV_CONST_HANDLER(ZEND_OPCODE
{
USE_OPLINE
zend_free_op free_op1;
- zval **container;
+ zval *container;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var TSRMLS_CC);
+ container = _get_zval_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var TSRMLS_CC);
if (IS_CV == IS_CV) {
- if (container != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(container);
- }
+ SEPARATE_ZVAL_IF_NOT_REF(container);
}
- if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_fetch_dimension_address(&EX_T(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_UNSET TSRMLS_CC);
+ zend_fetch_dimension_address(EX_VAR(opline->result.var), container, opline->op2.zv, IS_CONST, BP_VAR_UNSET TSRMLS_CC);
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
+//??? if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
- if (UNEXPECTED(EX_T(opline->result.var).var.ptr_ptr == NULL)) {
+ if (UNEXPECTED(Z_TYPE_P(EX_VAR(opline->result.var)) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
ZEND_VM_NEXT_OPCODE();
} else {
zend_free_op free_res;
- zval **retval_ptr = EX_T(opline->result.var).var.ptr_ptr;
+ zval *retval_ptr = EX_VAR(opline->result.var);
- PZVAL_UNLOCK(*retval_ptr, &free_res);
- if (retval_ptr != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(retval_ptr);
- }
- PZVAL_LOCK(*retval_ptr);
+ PZVAL_UNLOCK(retval_ptr, &free_res);
+ SEPARATE_ZVAL_IF_NOT_REF(retval_ptr);
+ PZVAL_LOCK(retval_ptr);
FREE_OP_VAR_PTR(free_res);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -32518,8 +31330,7 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_CV_CONST(Z
if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
zend_error(E_NOTICE, "Trying to get property of non-object");
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
} else {
zval *retval;
@@ -32531,11 +31342,10 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_CV_CONST(Z
/* here we are sure we are dealing with an object */
retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_R, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- PZVAL_LOCK(retval);
- EX_T(opline->result.var).var.ptr = retval;
+ ZVAL_COPY(EX_VAR(opline->result.var), retval);
if (0) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
}
@@ -32555,7 +31365,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HAN
USE_OPLINE
zend_free_op free_op1;
zval *property;
- zval **container;
+ zval *container;
SAVE_OPLINE();
property = opline->op2.zv;
@@ -32563,30 +31373,30 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HAN
if (0) {
MAKE_REAL_ZVAL_PTR(property);
}
- container = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
+ container = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(&EX_T(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
}
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
+//??? if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
/* We are going to assign the result by reference */
if (opline->extended_value & ZEND_FETCH_MAKE_REF) {
- zval **retval_ptr = EX_T(opline->result.var).var.ptr_ptr;
+ zval *retval_ptr = EX_VAR(opline->result.var);
- Z_DELREF_PP(retval_ptr);
+ Z_DELREF_P(retval_ptr);
SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
- Z_ADDREF_PP(retval_ptr);
- EX_T(opline->result.var).var.ptr = *EX_T(opline->result.var).var.ptr_ptr;
- EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
+ Z_ADDREF_P(retval_ptr);
+//??? EX_T(opline->result.var).var.ptr = *EX_T(opline->result.var).var.ptr_ptr;
+//??? EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
}
CHECK_EXCEPTION();
@@ -32598,27 +31408,27 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HA
USE_OPLINE
zend_free_op free_op1;
zval *property;
- zval **container;
+ zval *container;
SAVE_OPLINE();
property = opline->op2.zv;
- container = _get_zval_ptr_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
+ container = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
if (0) {
MAKE_REAL_ZVAL_PTR(property);
}
- if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(&EX_T(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_RW TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_RW TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
}
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
+//??? if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -32638,8 +31448,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HA
if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
} else {
zval *retval;
@@ -32651,11 +31460,10 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HA
/* here we are sure we are dealing with an object */
retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_IS, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- PZVAL_LOCK(retval);
- EX_T(opline->result.var).var.ptr = retval;
+ ZVAL_COPY(EX_VAR(opline->result.var), retval);
if (0) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
}
@@ -32668,32 +31476,32 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HA
static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
+ zval *container;
if (zend_is_by_ref_func_arg_fetch(opline, EX(call) TSRMLS_CC)) {
/* Behave like FETCH_OBJ_W */
zend_free_op free_op1;
zval *property;
- zval **container;
SAVE_OPLINE();
property = opline->op2.zv;
- container = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
+ container = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
if (0) {
MAKE_REAL_ZVAL_PTR(property);
}
- if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(&EX_T(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
}
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
+//??? if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -32706,39 +31514,37 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_CV_CONST_HANDLER(ZEND_OPCODE
{
USE_OPLINE
zend_free_op free_op1, free_res;
- zval **container;
+ zval *container;
zval *property;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var TSRMLS_CC);
+ container = _get_zval_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var TSRMLS_CC);
property = opline->op2.zv;
if (IS_CV == IS_CV) {
- if (container != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(container);
- }
+ SEPARATE_ZVAL_IF_NOT_REF(container);
}
if (0) {
MAKE_REAL_ZVAL_PTR(property);
}
- if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(&EX_T(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_UNSET TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_UNSET TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
}
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
+//??? if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
- PZVAL_UNLOCK(*EX_T(opline->result.var).var.ptr_ptr, &free_res);
- if (EX_T(opline->result.var).var.ptr_ptr != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(EX_T(opline->result.var).var.ptr_ptr);
- }
- PZVAL_LOCK(*EX_T(opline->result.var).var.ptr_ptr);
+//??? PZVAL_UNLOCK(EX_VAR(opline->result.var), &free_res);
+//??? if (EX_T(opline->result.var).var.ptr_ptr != &EG(uninitialized_zval_ptr)) {
+//??? SEPARATE_ZVAL_IF_NOT_REF(EX_T(opline->result.var).var.ptr_ptr);
+//??? }
+//??? PZVAL_LOCK(EX_VAR(opline->result.var));
FREE_OP_VAR_PTR(free_res);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -32748,22 +31554,22 @@ static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HAND
{
USE_OPLINE
- zval **object_ptr;
+ zval *object;
zval *property_name;
SAVE_OPLINE();
- object_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
+ object = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
property_name = opline->op2.zv;
if (0) {
MAKE_REAL_ZVAL_PTR(property_name);
}
- if (IS_CV == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_assign_to_object(RETURN_VALUE_USED(opline)?&EX_T(opline->result.var).var.ptr:NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&property_name);
+ zval_ptr_dtor(property_name);
} else {
}
@@ -32778,24 +31584,24 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HAND
{
USE_OPLINE
- zval **object_ptr;
+ zval *object_ptr;
SAVE_OPLINE();
- object_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
+ object_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(object_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- if (Z_TYPE_PP(object_ptr) == IS_OBJECT) {
+ if (Z_TYPE_P(object_ptr) == IS_OBJECT) {
zval *property_name = opline->op2.zv;
if (0) {
MAKE_REAL_ZVAL_PTR(property_name);
}
- zend_assign_to_object(RETURN_VALUE_USED(opline)?&EX_T(opline->result.var).var.ptr:NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&property_name);
+ zval_ptr_dtor(property_name);
} else {
}
@@ -32803,45 +31609,37 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HAND
zend_free_op free_op_data1, free_op_data2;
zval *value;
zval *dim = opline->op2.zv;
- zval **variable_ptr_ptr;
+ zval *variable_ptr;
- zend_fetch_dimension_address(&EX_T((opline+1)->op2.var), object_ptr, dim, IS_CONST, BP_VAR_W TSRMLS_CC);
+ zend_fetch_dimension_address(EX_VAR((opline+1)->op2.var), object_ptr, dim, IS_CONST, BP_VAR_W TSRMLS_CC);
value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
- variable_ptr_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
- if (UNEXPECTED(variable_ptr_ptr == NULL)) {
- if (zend_assign_to_string_offset(&EX_T((opline+1)->op2.var), value, (opline+1)->op1_type TSRMLS_CC)) {
+ variable_ptr = _get_zval_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
+ if (UNEXPECTED(Z_TYPE_P(variable_ptr) == IS_STR_OFFSET)) {
+ if (zend_assign_to_string_offset(EX_VAR((opline+1)->op2.var), value, (opline+1)->op1_type TSRMLS_CC)) {
if (RETURN_VALUE_USED(opline)) {
- zval *retval;
-
- ALLOC_ZVAL(retval);
- ZVAL_STRINGL(retval, Z_STRVAL_P(EX_T((opline+1)->op2.var).str_offset.str)+EX_T((opline+1)->op2.var).str_offset.offset, 1, 1);
- INIT_PZVAL(retval);
- EX_T(opline->result.var).var.ptr = retval;
+ ZVAL_STRINGL(EX_VAR(opline->result.var), Z_STR_OFFSET_P(EX_VAR((opline+1)->op2.var))->str + Z_STR_OFFSET_P(EX_VAR((opline+1)->op2.var))->offset, 1);
}
} else if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
- } else if (UNEXPECTED(*variable_ptr_ptr == &EG(error_zval))) {
+ } else if (UNEXPECTED(variable_ptr == &EG(error_zval))) {
if (IS_TMP_FREE(free_op_data1)) {
zval_dtor(value);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
} else {
if ((opline+1)->op1_type == IS_TMP_VAR) {
- value = zend_assign_tmp_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_tmp_to_variable(variable_ptr, value TSRMLS_CC);
} else if ((opline+1)->op1_type == IS_CONST) {
- value = zend_assign_const_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_const_to_variable(variable_ptr, value TSRMLS_CC);
} else {
- value = zend_assign_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_to_variable(variable_ptr, value TSRMLS_CC);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(value);
- EX_T(opline->result.var).var.ptr = value;
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
}
}
FREE_OP_VAR_PTR(free_op_data2);
@@ -32859,45 +31657,37 @@ static int ZEND_FASTCALL ZEND_ASSIGN_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_
USE_OPLINE
zval *value;
- zval **variable_ptr_ptr;
+ zval *variable_ptr;
SAVE_OPLINE();
value = opline->op2.zv;
- variable_ptr_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
+ variable_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(variable_ptr_ptr == NULL)) {
- if (zend_assign_to_string_offset(&EX_T(opline->op1.var), value, IS_CONST TSRMLS_CC)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(variable_ptr) == IS_STR_OFFSET)) {
+ if (zend_assign_to_string_offset(EX_VAR(opline->op1.var), value, IS_CONST TSRMLS_CC)) {
if (RETURN_VALUE_USED(opline)) {
- zval *retval;
-
- ALLOC_ZVAL(retval);
- ZVAL_STRINGL(retval, Z_STRVAL_P(EX_T(opline->op1.var).str_offset.str)+EX_T(opline->op1.var).str_offset.offset, 1, 1);
- INIT_PZVAL(retval);
- EX_T(opline->result.var).var.ptr = retval;
+ ZVAL_STRINGL(EX_VAR(opline->result.var), Z_STR_OFFSET_P(EX_VAR(opline->op1.var))->str + Z_STR_OFFSET_P(EX_VAR(opline->op1.var))->offset, 1);
}
} else if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
- } else if (IS_CV == IS_VAR && UNEXPECTED(*variable_ptr_ptr == &EG(error_zval))) {
+ } else if (IS_CV == IS_VAR && UNEXPECTED(variable_ptr == &EG(error_zval))) {
if (0) {
zval_dtor(value);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
} else {
if (IS_CONST == IS_TMP_VAR) {
- value = zend_assign_tmp_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_tmp_to_variable(variable_ptr, value TSRMLS_CC);
} else if (IS_CONST == IS_CONST) {
- value = zend_assign_const_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_const_to_variable(variable_ptr, value TSRMLS_CC);
} else {
- value = zend_assign_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_to_variable(variable_ptr, value TSRMLS_CC);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(value);
- EX_T(opline->result.var).var.ptr = value;
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
}
}
@@ -32911,8 +31701,6 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CONST_HANDLER(ZEND_OPCOD
{
USE_OPLINE
zval *function_name;
- char *function_name_strval;
- int function_name_strlen;
call_slot *call = EX(call_slots) + opline->result.num;
@@ -32928,32 +31716,29 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CONST_HANDLER(ZEND_OPCOD
zend_error_noreturn(E_ERROR, "Method name must be a string");
}
- function_name_strval = Z_STRVAL_P(function_name);
- function_name_strlen = Z_STRLEN_P(function_name);
-
- call->object = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
+ ZVAL_COPY_VALUE(&call->object, _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC));
- if (EXPECTED(call->object != NULL) &&
- EXPECTED(Z_TYPE_P(call->object) == IS_OBJECT)) {
- call->called_scope = Z_OBJCE_P(call->object);
+ if (EXPECTED(Z_TYPE(call->object) != IS_UNDEF) &&
+ EXPECTED(Z_TYPE(call->object) == IS_OBJECT)) {
+ call->called_scope = Z_OBJCE(call->object);
if (IS_CONST != IS_CONST ||
(call->fbc = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope)) == NULL) {
- zval *object = call->object;
+ zend_object *object = Z_OBJ(call->object);
- if (UNEXPECTED(Z_OBJ_HT_P(call->object)->get_method == NULL)) {
+ if (UNEXPECTED(Z_OBJ_HT(call->object)->get_method == NULL)) {
zend_error_noreturn(E_ERROR, "Object does not support method calls");
}
/* First, locate the function. */
- call->fbc = Z_OBJ_HT_P(call->object)->get_method(&call->object, function_name_strval, function_name_strlen, ((IS_CONST == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
+ call->fbc = Z_OBJ_HT(call->object)->get_method(&call->object, Z_STR_P(function_name), ((IS_CONST == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
if (UNEXPECTED(call->fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(call->object), function_name_strval);
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(&call->object), Z_STRVAL_P(function_name));
}
if (IS_CONST == IS_CONST &&
EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0) &&
- EXPECTED(call->object == object)) {
+ EXPECTED(Z_OBJ(call->object) == object)) {
CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope, call->fbc);
}
}
@@ -32962,20 +31747,16 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CONST_HANDLER(ZEND_OPCOD
HANDLE_EXCEPTION();
}
- zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval);
+ zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", Z_STRVAL_P(function_name));
}
if ((call->fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) {
- call->object = NULL;
+ ZVAL_UNDEF(&call->object);
} else {
- if (!PZVAL_IS_REF(call->object)) {
- Z_ADDREF_P(call->object); /* For $this pointer */
+ if (!Z_ISREF(call->object)) {
+ Z_ADDREF(call->object); /* For $this pointer */
} else {
- zval *this_ptr;
- ALLOC_ZVAL(this_ptr);
- INIT_PZVAL_COPY(this_ptr, call->object);
- zval_copy_ctor(this_ptr);
- call->object = this_ptr;
+ ZVAL_DUP(&call->object, Z_REFVAL(call->object));
}
}
@@ -32994,7 +31775,7 @@ static int ZEND_FASTCALL ZEND_CASE_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_AR
SAVE_OPLINE();
- is_equal_function(&EX_T(opline->result.var).tmp_var,
+ is_equal_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
opline->op2.zv TSRMLS_CC);
@@ -33010,29 +31791,24 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_CONST_HANDLER(ZEND_OPCO
SAVE_OPLINE();
if ((IS_CV == IS_VAR || IS_CV == IS_CV) && opline->extended_value) {
- zval **expr_ptr_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
-
- if (IS_CV == IS_VAR && UNEXPECTED(expr_ptr_ptr == NULL)) {
+ expr_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets");
}
- SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr_ptr);
- expr_ptr = *expr_ptr_ptr;
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr);
Z_ADDREF_P(expr_ptr);
} else {
expr_ptr=_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
if (0) { /* temporary variable */
- zval *new_expr;
+ zval new_expr;
- ALLOC_ZVAL(new_expr);
- INIT_PZVAL_COPY(new_expr, expr_ptr);
- expr_ptr = new_expr;
- } else if (IS_CV == IS_CONST || PZVAL_IS_REF(expr_ptr)) {
- zval *new_expr;
+ ZVAL_COPY_VALUE(&new_expr, expr_ptr);
+ expr_ptr = &new_expr;
+ } else if (IS_CV == IS_CONST || Z_ISREF_P(expr_ptr)) {
+ zval new_expr;
- ALLOC_ZVAL(new_expr);
- INIT_PZVAL_COPY(new_expr, expr_ptr);
- expr_ptr = new_expr;
- zendi_zval_copy_ctor(*expr_ptr);
+ ZVAL_DUP(&new_expr, expr_ptr);
+ expr_ptr = &new_expr;
} else if (IS_CV == IS_CV) {
Z_ADDREF_P(expr_ptr);
@@ -33052,29 +31828,26 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_CONST_HANDLER(ZEND_OPCO
case IS_BOOL:
hval = Z_LVAL_P(offset);
num_index:
- zend_hash_index_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), hval, &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr);
break;
case IS_STRING:
- if (IS_CONST == IS_CONST) {
- hval = Z_HASH_P(offset);
- } else {
+ if (IS_CONST != IS_CONST) {
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index);
- hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset));
}
- zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), Z_STR_P(offset), expr_ptr);
break;
case IS_NULL:
- zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), STR_EMPTY_ALLOC(), expr_ptr);
break;
default:
zend_error(E_WARNING, "Illegal offset type");
- zval_ptr_dtor(&expr_ptr);
+ zval_ptr_dtor(expr_ptr);
/* do nothing */
break;
}
} else {
- zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr);
}
if ((IS_CV == IS_VAR || IS_CV == IS_CV) && opline->extended_value) {
@@ -33087,7 +31860,7 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HAND
{
USE_OPLINE
- array_init(&EX_T(opline->result.var).tmp_var);
+ array_init(EX_VAR(opline->result.var));
if (IS_CV == IS_UNUSED) {
ZEND_VM_NEXT_OPCODE();
#if 0 || IS_CV != IS_UNUSED
@@ -33109,13 +31882,13 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDL
IS_CONST == IS_UNUSED &&
(opline->extended_value & ZEND_QUICK_SET)) {
if (EG(active_symbol_table)) {
- zend_compiled_variable *cv = &CV_DEF_OF(opline->op1.var);
+ zend_string *cv = CV_DEF_OF(opline->op1.var);
- zend_delete_variable(EX(prev_execute_data), EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value TSRMLS_CC);
- EX_CV(opline->op1.var) = NULL;
- } else if (EX_CV(opline->op1.var)) {
- zval_ptr_dtor(EX_CV(opline->op1.var));
- EX_CV(opline->op1.var) = NULL;
+ zend_delete_variable(EX(prev_execute_data), EG(active_symbol_table), cv TSRMLS_CC);
+ ZVAL_UNDEF(EX_VAR_NUM(opline->op1.var));
+ } else if (Z_TYPE_P(EX_VAR_NUM(opline->op1.var)) != IS_UNDEF) {
+ zval_ptr_dtor(EX_VAR_NUM(opline->op1.var));
+ ZVAL_UNDEF(EX_VAR_NUM(opline->op1.var));
}
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -33124,8 +31897,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDL
varname = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
if (IS_CV != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
- ZVAL_COPY_VALUE(&tmp, varname);
- zval_copy_ctor(&tmp);
+ ZVAL_DUP(&tmp, varname);
convert_to_string(&tmp);
varname = &tmp;
} else if (IS_CV == IS_VAR || IS_CV == IS_CV) {
@@ -33139,12 +31911,12 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDL
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
ce = CACHED_PTR(opline->op2.literal->cache_slot);
} else {
- ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
if (IS_CV != IS_CONST && varname == &tmp) {
zval_dtor(&tmp);
} else if (IS_CV == IS_VAR || IS_CV == IS_CV) {
- zval_ptr_dtor(&varname);
+ zval_ptr_dtor(varname);
}
HANDLE_EXCEPTION();
@@ -33155,20 +31927,18 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDL
CACHE_PTR(opline->op2.literal->cache_slot, ce);
}
} else {
- ce = EX_T(opline->op2.var).class_entry;
+ ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ zend_std_unset_static_property(ce, Z_STR_P(varname), ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
} else {
- ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1);
-
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
- zend_delete_variable(execute_data, target_symbol_table, varname->value.str.val, varname->value.str.len+1, hash_value TSRMLS_CC);
+ zend_delete_variable(execute_data, target_symbol_table, Z_STR_P(varname) TSRMLS_CC);
}
if (IS_CV != IS_CONST && varname == &tmp) {
zval_dtor(&tmp);
} else if (IS_CV == IS_VAR || IS_CV == IS_CV) {
- zval_ptr_dtor(&varname);
+ zval_ptr_dtor(varname);
}
CHECK_EXCEPTION();
@@ -33179,21 +31949,21 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDL
{
USE_OPLINE
- zval **container;
+ zval *container;
zval *offset;
ulong hval;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_CV && container != &EG(uninitialized_zval_ptr)) {
+ container = _get_zval_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var TSRMLS_CC);
+ if (IS_CV == IS_CV) {
SEPARATE_ZVAL_IF_NOT_REF(container);
}
offset = opline->op2.zv;
if (IS_CV != IS_VAR || container) {
- switch (Z_TYPE_PP(container)) {
+ switch (Z_TYPE_P(container)) {
case IS_ARRAY: {
- HashTable *ht = Z_ARRVAL_PP(container);
+ HashTable *ht = Z_ARRVAL_P(container);
switch (Z_TYPE_P(offset)) {
case IS_DOUBLE:
@@ -33210,29 +31980,26 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDL
if (IS_CONST == IS_CV || IS_CONST == IS_VAR) {
Z_ADDREF_P(offset);
}
- if (IS_CONST == IS_CONST) {
- hval = Z_HASH_P(offset);
- } else {
+ if (IS_CONST != IS_CONST) {
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim);
- hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset));
}
- if (ht == &EG(symbol_table)) {
- zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC);
+ if (ht == &EG(symbol_table).ht) {
+ zend_delete_global_variable(Z_STR_P(offset) TSRMLS_CC);
} else {
- zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval);
+ zend_hash_del(ht, Z_STR_P(offset));
}
if (IS_CONST == IS_CV || IS_CONST == IS_VAR) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
}
break;
num_index_dim:
zend_hash_index_del(ht, hval);
if (IS_CONST == IS_CV || IS_CONST == IS_VAR) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
}
break;
case IS_NULL:
- zend_hash_del(ht, "", sizeof(""));
+ zend_hash_del(ht, STR_EMPTY_ALLOC());
break;
default:
zend_error(E_WARNING, "Illegal offset type in unset");
@@ -33242,15 +32009,15 @@ num_index_dim:
break;
}
case IS_OBJECT:
- if (UNEXPECTED(Z_OBJ_HT_P(*container)->unset_dimension == NULL)) {
+ if (UNEXPECTED(Z_OBJ_HT_P(container)->unset_dimension == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use object as array");
}
if (0) {
MAKE_REAL_ZVAL_PTR(offset);
}
- Z_OBJ_HT_P(*container)->unset_dimension(*container, offset TSRMLS_CC);
+ Z_OBJ_HT_P(container)->unset_dimension(container, offset TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
}
@@ -33274,28 +32041,28 @@ static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDL
{
USE_OPLINE
- zval **container;
+ zval *container;
zval *offset;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var TSRMLS_CC);
+ container = _get_zval_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var TSRMLS_CC);
offset = opline->op2.zv;
if (IS_CV != IS_VAR || container) {
- if (IS_CV == IS_CV && container != &EG(uninitialized_zval_ptr)) {
+ if (IS_CV == IS_CV) {
SEPARATE_ZVAL_IF_NOT_REF(container);
}
- if (Z_TYPE_PP(container) == IS_OBJECT) {
+ if (Z_TYPE_P(container) == IS_OBJECT) {
if (0) {
MAKE_REAL_ZVAL_PTR(offset);
}
- if (Z_OBJ_HT_P(*container)->unset_property) {
- Z_OBJ_HT_P(*container)->unset_property(*container, offset, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ if (Z_OBJ_HT_P(container)->unset_property) {
+ Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_CONST == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to unset property of non-object");
}
if (0) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
}
@@ -33313,19 +32080,19 @@ static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDL
static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zval **value;
+ zval *value;
zend_bool isset = 1;
SAVE_OPLINE();
if (IS_CV == IS_CV &&
IS_CONST == IS_UNUSED &&
(opline->extended_value & ZEND_QUICK_SET)) {
- if (EX_CV(opline->op1.var)) {
- value = EX_CV(opline->op1.var);
+ if (Z_TYPE_P(EX_VAR_NUM(opline->op1.var)) != IS_UNDEF) {
+ value = EX_VAR_NUM(opline->op1.var);
} else if (EG(active_symbol_table)) {
- zend_compiled_variable *cv = &CV_DEF_OF(opline->op1.var);
+ zend_string *cv = CV_DEF_OF(opline->op1.var);
- if (zend_hash_quick_find(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, (void **) &value) == FAILURE) {
+ if ((value = zend_hash_find(EG(active_symbol_table), cv)) == NULL) {
isset = 0;
}
} else {
@@ -33337,8 +32104,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_CONST_HANDLER(ZEND_OPCO
zval tmp, *varname = _get_zval_ptr_cv_BP_VAR_IS(execute_data, opline->op1.var TSRMLS_CC);
if (IS_CV != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
- ZVAL_COPY_VALUE(&tmp, varname);
- zval_copy_ctor(&tmp);
+ ZVAL_DUP(&tmp, varname);
convert_to_string(&tmp);
varname = &tmp;
}
@@ -33350,7 +32116,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_CONST_HANDLER(ZEND_OPCO
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
ce = CACHED_PTR(opline->op2.literal->cache_slot);
} else {
- ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -33358,15 +32124,15 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_CONST_HANDLER(ZEND_OPCO
CACHE_PTR(opline->op2.literal->cache_slot, ce);
}
} else {
- ce = EX_T(opline->op2.var).class_entry;
+ ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1, ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ value = zend_std_get_static_property(ce, Z_STR_P(varname), 1, ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
if (!value) {
isset = 0;
}
} else {
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
- if (zend_hash_find(target_symbol_table, varname->value.str.val, varname->value.str.len+1, (void **) &value) == FAILURE) {
+ if ((value = zend_hash_find(target_symbol_table, Z_STR_P(varname))) == NULL) {
isset = 0;
}
}
@@ -33378,16 +32144,16 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_CONST_HANDLER(ZEND_OPCO
}
if (opline->extended_value & ZEND_ISSET) {
- if (isset && Z_TYPE_PP(value) != IS_NULL) {
- ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, 1);
+ if (isset && Z_TYPE_P(value) != IS_NULL) {
+ ZVAL_BOOL(EX_VAR(opline->result.var), 1);
} else {
- ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, 0);
+ ZVAL_BOOL(EX_VAR(opline->result.var), 0);
}
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (!isset || !i_zend_is_true(*value TSRMLS_CC)) {
- ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, 1);
+ if (!isset || !i_zend_is_true(value TSRMLS_CC)) {
+ ZVAL_BOOL(EX_VAR(opline->result.var), 1);
} else {
- ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, 0);
+ ZVAL_BOOL(EX_VAR(opline->result.var), 0);
}
}
@@ -33400,7 +32166,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CONST(i
USE_OPLINE
zval *container;
- zval **value = NULL;
+ zval *value;
int result = 0;
ulong hval;
zval *offset;
@@ -33424,23 +32190,20 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CONST(i
case IS_LONG:
hval = Z_LVAL_P(offset);
num_index_prop:
- if (zend_hash_index_find(ht, hval, (void **) &value) == SUCCESS) {
+ if ((value = zend_hash_index_find(ht, hval)) != NULL) {
isset = 1;
}
break;
case IS_STRING:
- if (IS_CONST == IS_CONST) {
- hval = Z_HASH_P(offset);
- } else {
+ if (IS_CONST != IS_CONST) {
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop);
- hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset));
}
- if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) {
+ if ((value = zend_hash_find(ht, Z_STR_P(offset))) != NULL) {
isset = 1;
}
break;
case IS_NULL:
- if (zend_hash_find(ht, "", sizeof(""), (void **) &value) == SUCCESS) {
+ if ((value = zend_hash_find(ht, STR_EMPTY_ALLOC())) != NULL) {
isset = 1;
}
break;
@@ -33450,13 +32213,13 @@ num_index_prop:
}
if (opline->extended_value & ZEND_ISSET) {
- if (isset && Z_TYPE_PP(value) == IS_NULL) {
+ if (isset && Z_TYPE_P(value) == IS_NULL) {
result = 0;
} else {
result = isset;
}
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (!isset || !i_zend_is_true(*value TSRMLS_CC)) {
+ if (!isset || !i_zend_is_true(value TSRMLS_CC)) {
result = 0;
} else {
result = 1;
@@ -33483,7 +32246,7 @@ num_index_prop:
}
}
if (0) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
}
@@ -33494,8 +32257,7 @@ num_index_prop:
if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */
|| (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
&& IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) {
- ZVAL_COPY_VALUE(&tmp, offset);
- zval_copy_ctor(&tmp);
+ ZVAL_DUP(&tmp, offset);
convert_to_long(&tmp);
offset = &tmp;
} else {
@@ -33519,11 +32281,10 @@ num_index_prop:
}
- Z_TYPE(EX_T(opline->result.var).tmp_var) = IS_BOOL;
if (opline->extended_value & ZEND_ISSET) {
- Z_LVAL(EX_T(opline->result.var).tmp_var) = result;
+ ZVAL_BOOL(EX_VAR(opline->result.var), result);
} else {
- Z_LVAL(EX_T(opline->result.var).tmp_var) = !result;
+ ZVAL_BOOL(EX_VAR(opline->result.var), !result);
}
CHECK_EXCEPTION();
@@ -33542,6 +32303,9 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CV_CONST_HANDLER(ZEND
static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
+//???
+return 0;
+#if 0
USE_OPLINE
/* The generator object is stored in return_value_ptr_ptr */
@@ -33584,7 +32348,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_A
generator->value = copy;
} else {
- zval **value_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
+ zval **value_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W);
if (IS_CV == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
@@ -33612,7 +32376,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_A
/* Consts, temporary variables and references need copying */
if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR
- || PZVAL_IS_REF(value)
+ || Z_ISREF_P(value)
) {
zval *copy;
@@ -33646,7 +32410,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_A
/* Consts, temporary variables and references need copying */
if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR
- || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0)
+ || (Z_ISREF_P(key) && Z_REFCOUNT_P(key) > 0)
) {
zval *copy;
@@ -33697,6 +32461,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_A
SAVE_OPLINE();
ZEND_VM_RETURN();
+#endif
}
static int ZEND_FASTCALL ZEND_ADD_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -33705,7 +32470,7 @@ static int ZEND_FASTCALL ZEND_ADD_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_free_op free_op2;
SAVE_OPLINE();
- fast_add_function(&EX_T(opline->result.var).tmp_var,
+ fast_add_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
@@ -33720,7 +32485,7 @@ static int ZEND_FASTCALL ZEND_SUB_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_free_op free_op2;
SAVE_OPLINE();
- fast_sub_function(&EX_T(opline->result.var).tmp_var,
+ fast_sub_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
@@ -33735,7 +32500,7 @@ static int ZEND_FASTCALL ZEND_MUL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_free_op free_op2;
SAVE_OPLINE();
- fast_mul_function(&EX_T(opline->result.var).tmp_var,
+ fast_mul_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
@@ -33750,7 +32515,7 @@ static int ZEND_FASTCALL ZEND_DIV_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_free_op free_op2;
SAVE_OPLINE();
- fast_div_function(&EX_T(opline->result.var).tmp_var,
+ fast_div_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
@@ -33765,7 +32530,7 @@ static int ZEND_FASTCALL ZEND_MOD_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_free_op free_op2;
SAVE_OPLINE();
- fast_mod_function(&EX_T(opline->result.var).tmp_var,
+ fast_mod_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
@@ -33780,7 +32545,7 @@ static int ZEND_FASTCALL ZEND_SL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_free_op free_op2;
SAVE_OPLINE();
- shift_left_function(&EX_T(opline->result.var).tmp_var,
+ shift_left_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
@@ -33795,7 +32560,7 @@ static int ZEND_FASTCALL ZEND_SR_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_free_op free_op2;
SAVE_OPLINE();
- shift_right_function(&EX_T(opline->result.var).tmp_var,
+ shift_right_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
@@ -33810,7 +32575,7 @@ static int ZEND_FASTCALL ZEND_CONCAT_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR
zend_free_op free_op2;
SAVE_OPLINE();
- concat_function(&EX_T(opline->result.var).tmp_var,
+ concat_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
@@ -33825,7 +32590,7 @@ static int ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HAND
zend_free_op free_op2;
SAVE_OPLINE();
- is_identical_function(&EX_T(opline->result.var).tmp_var,
+ is_identical_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
@@ -33838,7 +32603,7 @@ static int ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_
{
USE_OPLINE
zend_free_op free_op2;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
is_identical_function(result,
@@ -33855,7 +32620,7 @@ static int ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_
{
USE_OPLINE
zend_free_op free_op2;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_equal_function(result,
@@ -33871,7 +32636,7 @@ static int ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HAND
{
USE_OPLINE
zend_free_op free_op2;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_not_equal_function(result,
@@ -33887,7 +32652,7 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLE
{
USE_OPLINE
zend_free_op free_op2;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_is_smaller_function(result,
@@ -33903,7 +32668,7 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_CV_TMP_HANDLER(ZEND_OPCO
{
USE_OPLINE
zend_free_op free_op2;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_is_smaller_or_equal_function(result,
@@ -33921,7 +32686,7 @@ static int ZEND_FASTCALL ZEND_BW_OR_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG
zend_free_op free_op2;
SAVE_OPLINE();
- bitwise_or_function(&EX_T(opline->result.var).tmp_var,
+ bitwise_or_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
@@ -33936,7 +32701,7 @@ static int ZEND_FASTCALL ZEND_BW_AND_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR
zend_free_op free_op2;
SAVE_OPLINE();
- bitwise_and_function(&EX_T(opline->result.var).tmp_var,
+ bitwise_and_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
@@ -33951,7 +32716,7 @@ static int ZEND_FASTCALL ZEND_BW_XOR_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR
zend_free_op free_op2;
SAVE_OPLINE();
- bitwise_xor_function(&EX_T(opline->result.var).tmp_var,
+ bitwise_xor_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
@@ -33966,7 +32731,7 @@ static int ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_
zend_free_op free_op2;
SAVE_OPLINE();
- boolean_xor_function(&EX_T(opline->result.var).tmp_var,
+ boolean_xor_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
@@ -33979,18 +32744,16 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_TMP(int (*bina
{
USE_OPLINE
zend_free_op free_op2, free_op_data1;
- zval **object_ptr = _get_zval_ptr_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
- zval *object;
+ zval *object = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
zval *property = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
zval *value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
int have_get_ptr = 0;
- if (IS_CV == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- make_real_object(object_ptr TSRMLS_CC);
- object = *object_ptr;
+ make_real_object(object TSRMLS_CC);
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to assign property of non-object");
@@ -33998,8 +32761,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_TMP(int (*bina
FREE_OP(free_op_data1);
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
} else {
/* here we are sure we are dealing with an object */
@@ -34010,15 +32772,14 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_TMP(int (*bina
/* here property is a string */
if (opline->extended_value == ZEND_ASSIGN_OBJ
&& Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval **zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
have_get_ptr = 1;
- binary_op(*zptr, *zptr, value TSRMLS_CC);
+ binary_op(zptr, zptr, value TSRMLS_CC);
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(*zptr);
- EX_T(opline->result.var).var.ptr = *zptr;
+ ZVAL_COPY(EX_VAR(opline->result.var), zptr);
}
}
}
@@ -34042,12 +32803,11 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_TMP(int (*bina
if (Z_REFCOUNT_P(z) == 0) {
GC_REMOVE_ZVAL_FROM_BUFFER(z);
zval_dtor(z);
- FREE_ZVAL(z);
}
z = value;
}
Z_ADDREF_P(z);
- SEPARATE_ZVAL_IF_NOT_REF(&z);
+ SEPARATE_ZVAL_IF_NOT_REF(z);
binary_op(z, z, value TSRMLS_CC);
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
@@ -34055,21 +32815,19 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_TMP(int (*bina
Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(z);
- EX_T(opline->result.var).var.ptr = z;
+ ZVAL_COPY(EX_VAR(opline->result.var), z);
}
- zval_ptr_dtor(&z);
+ zval_ptr_dtor(z);
} else {
zend_error(E_WARNING, "Attempt to assign property of non-object");
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
}
}
if (1) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
zval_dtor(free_op2.var);
}
@@ -34086,7 +32844,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_CV_TMP(int (*binary_o
{
USE_OPLINE
zend_free_op free_op2, free_op_data2, free_op_data1;
- zval **var_ptr;
+ zval *var_ptr;
zval *value;
SAVE_OPLINE();
@@ -34095,39 +32853,38 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_CV_TMP(int (*binary_o
return zend_binary_assign_op_obj_helper_SPEC_CV_TMP(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
break;
case ZEND_ASSIGN_DIM: {
- zval **container = _get_zval_ptr_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
+ zval *container = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- } else if (UNEXPECTED(Z_TYPE_PP(container) == IS_OBJECT)) {
+ } else if (UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
if (IS_CV == IS_VAR && !0) {
- Z_ADDREF_PP(container); /* undo the effect of get_obj_zval_ptr_ptr() */
+ Z_ADDREF_P(container); /* undo the effect of get_obj_zval_ptr_ptr() */
}
return zend_binary_assign_op_obj_helper_SPEC_CV_TMP(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
} else {
zval *dim = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- zend_fetch_dimension_address(&EX_T((opline+1)->op2.var), container, dim, IS_TMP_VAR, BP_VAR_RW TSRMLS_CC);
+ zend_fetch_dimension_address(EX_VAR((opline+1)->op2.var), container, dim, IS_TMP_VAR, BP_VAR_RW TSRMLS_CC);
value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
- var_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
+ var_ptr = _get_zval_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
}
}
break;
default:
value = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- var_ptr = _get_zval_ptr_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
+ var_ptr = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
/* do nothing */
break;
}
- if (UNEXPECTED(var_ptr == NULL)) {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
}
- if (UNEXPECTED(*var_ptr == &EG(error_zval))) {
+ if (UNEXPECTED(var_ptr == &EG(error_zval))) {
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
zval_dtor(free_op2.var);
@@ -34140,22 +32897,21 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_CV_TMP(int (*binary_o
SEPARATE_ZVAL_IF_NOT_REF(var_ptr);
- if (UNEXPECTED(Z_TYPE_PP(var_ptr) == IS_OBJECT)
- && Z_OBJ_HANDLER_PP(var_ptr, get)
- && Z_OBJ_HANDLER_PP(var_ptr, set)) {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_OBJECT)
+ && Z_OBJ_HANDLER_P(var_ptr, get)
+ && Z_OBJ_HANDLER_P(var_ptr, set)) {
/* proxy object */
- zval *objval = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC);
+ zval *objval = Z_OBJ_HANDLER_P(var_ptr, get)(var_ptr TSRMLS_CC);
Z_ADDREF_P(objval);
binary_op(objval, objval, value TSRMLS_CC);
- Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, objval TSRMLS_CC);
- zval_ptr_dtor(&objval);
+ Z_OBJ_HANDLER_P(var_ptr, set)(var_ptr, objval TSRMLS_CC);
+ zval_ptr_dtor(objval);
} else {
- binary_op(*var_ptr, *var_ptr, value TSRMLS_CC);
+ binary_op(var_ptr, var_ptr, value TSRMLS_CC);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(*var_ptr);
- EX_T(opline->result.var).var.ptr = *var_ptr;
+ ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
zval_dtor(free_op2.var);
@@ -34231,30 +32987,27 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_CV_TMP(incdec_t in
{
USE_OPLINE
zend_free_op free_op2;
- zval **object_ptr;
zval *object;
zval *property;
- zval **retval;
+ zval *retval;
int have_get_ptr = 0;
SAVE_OPLINE();
- object_ptr = _get_zval_ptr_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
+ object = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
property = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- retval = &EX_T(opline->result.var).var.ptr;
+ retval = EX_VAR(opline->result.var);
- if (IS_CV == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
- object = *object_ptr;
+ make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
zval_dtor(free_op2.var);
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- *retval = &EG(uninitialized_zval);
+ ZVAL_NULL(retval);
}
CHECK_EXCEPTION();
@@ -34268,15 +33021,14 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_CV_TMP(incdec_t in
}
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval **zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
have_get_ptr = 1;
- incdec_op(*zptr);
+ incdec_op(zptr);
if (RETURN_VALUE_USED(opline)) {
- *retval = *zptr;
- PZVAL_LOCK(*retval);
+ ZVAL_COPY(retval, zptr);
}
}
}
@@ -34291,28 +33043,26 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_CV_TMP(incdec_t in
if (Z_REFCOUNT_P(z) == 0) {
GC_REMOVE_ZVAL_FROM_BUFFER(z);
zval_dtor(z);
- FREE_ZVAL(z);
}
z = value;
}
Z_ADDREF_P(z);
- SEPARATE_ZVAL_IF_NOT_REF(&z);
+ SEPARATE_ZVAL_IF_NOT_REF(z);
incdec_op(z);
- *retval = z;
+ ZVAL_COPY_VALUE(retval, z);
Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- SELECTIVE_PZVAL_LOCK(*retval, opline);
- zval_ptr_dtor(&z);
+ SELECTIVE_PZVAL_LOCK(retval, opline);
+ zval_ptr_dtor(z);
} else {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- *retval = &EG(uninitialized_zval);
+ ZVAL_NULL(retval);
}
}
}
if (1) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
zval_dtor(free_op2.var);
}
@@ -34335,23 +33085,21 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_TMP(incdec_t i
{
USE_OPLINE
zend_free_op free_op2;
- zval **object_ptr;
zval *object;
zval *property;
zval *retval;
int have_get_ptr = 0;
SAVE_OPLINE();
- object_ptr = _get_zval_ptr_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
+ object = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
property = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- retval = &EX_T(opline->result.var).tmp_var;
+ retval = EX_VAR(opline->result.var);
- if (IS_CV == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
- object = *object_ptr;
+ make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
@@ -34369,15 +33117,14 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_TMP(incdec_t i
}
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval **zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
have_get_ptr = 1;
SEPARATE_ZVAL_IF_NOT_REF(zptr);
- ZVAL_COPY_VALUE(retval, *zptr);
- zendi_zval_copy_ctor(*retval);
+ ZVAL_DUP(retval, zptr);
- incdec_op(*zptr);
+ incdec_op(zptr);
}
}
@@ -34385,7 +33132,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_TMP(incdec_t i
if (!have_get_ptr) {
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- zval *z_copy;
+ zval z_copy;
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC);
@@ -34393,20 +33140,16 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_TMP(incdec_t i
if (Z_REFCOUNT_P(z) == 0) {
GC_REMOVE_ZVAL_FROM_BUFFER(z);
zval_dtor(z);
- FREE_ZVAL(z);
}
z = value;
}
- ZVAL_COPY_VALUE(retval, z);
- zendi_zval_copy_ctor(*retval);
- ALLOC_ZVAL(z_copy);
- INIT_PZVAL_COPY(z_copy, z);
- zendi_zval_copy_ctor(*z_copy);
- incdec_op(z_copy);
+ ZVAL_DUP(retval, z);
+ ZVAL_DUP(&z_copy, z);
+ incdec_op(&z_copy);
Z_ADDREF_P(z);
- Z_OBJ_HT_P(object)->write_property(object, property, z_copy, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(object)->write_property(object, property, &z_copy, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval_ptr_dtor(&z_copy);
- zval_ptr_dtor(&z);
+ zval_ptr_dtor(z);
} else {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
ZVAL_NULL(retval);
@@ -34414,7 +33157,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_TMP(incdec_t i
}
if (1) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
zval_dtor(free_op2.var);
}
@@ -34441,7 +33184,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDL
SAVE_OPLINE();
container = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_R TSRMLS_CC);
+ zend_fetch_dimension_address_read(EX_VAR(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_R TSRMLS_CC);
zval_dtor(free_op2.var);
if (IS_CV != IS_VAR || !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
@@ -34454,29 +33197,27 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDL
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval **container;
+ zval *container;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
+ container = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_fetch_dimension_address(&EX_T(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_W TSRMLS_CC);
+ zend_fetch_dimension_address(EX_VAR(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_W TSRMLS_CC);
zval_dtor(free_op2.var);
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
+//??? if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
+//??? }
/* We are going to assign the result by reference */
if (UNEXPECTED(opline->extended_value != 0)) {
- zval **retval_ptr = EX_T(opline->result.var).var.ptr_ptr;
+ zval *retval_ptr = EX_VAR(opline->result.var);
- if (retval_ptr) {
- Z_DELREF_PP(retval_ptr);
- SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
- Z_ADDREF_PP(retval_ptr);
- }
+ Z_DELREF_P(retval_ptr);
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
+ Z_ADDREF_P(retval_ptr);
}
CHECK_EXCEPTION();
@@ -34487,19 +33228,19 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HAND
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval **container;
+ zval *container;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
+ container = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_fetch_dimension_address(&EX_T(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_RW TSRMLS_CC);
+ zend_fetch_dimension_address(EX_VAR(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_RW TSRMLS_CC);
zval_dtor(free_op2.var);
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
+//??? if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -34513,7 +33254,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HAND
SAVE_OPLINE();
container = _get_zval_ptr_cv_BP_VAR_IS(execute_data, opline->op1.var TSRMLS_CC);
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_IS TSRMLS_CC);
+ zend_fetch_dimension_address_read(EX_VAR(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_IS TSRMLS_CC);
zval_dtor(free_op2.var);
CHECK_EXCEPTION();
@@ -34523,29 +33264,28 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HAND
static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
+ zval *container;
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
if (zend_is_by_ref_func_arg_fetch(opline, EX(call) TSRMLS_CC)) {
- zval **container = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
+ container = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_fetch_dimension_address(&EX_T(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_W TSRMLS_CC);
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
+ zend_fetch_dimension_address(EX_VAR(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_W TSRMLS_CC);
+//??? if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
zval_dtor(free_op2.var);
} else {
- zval *container;
-
if (IS_TMP_VAR == IS_UNUSED) {
zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
}
container = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_R TSRMLS_CC);
+ zend_fetch_dimension_address_read(EX_VAR(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_R TSRMLS_CC);
zval_dtor(free_op2.var);
}
@@ -34557,37 +33297,33 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_H
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval **container;
+ zval *container;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var TSRMLS_CC);
+ container = _get_zval_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var TSRMLS_CC);
if (IS_CV == IS_CV) {
- if (container != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(container);
- }
+ SEPARATE_ZVAL_IF_NOT_REF(container);
}
- if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_fetch_dimension_address(&EX_T(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_UNSET TSRMLS_CC);
+ zend_fetch_dimension_address(EX_VAR(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR, BP_VAR_UNSET TSRMLS_CC);
zval_dtor(free_op2.var);
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
+//??? if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
- if (UNEXPECTED(EX_T(opline->result.var).var.ptr_ptr == NULL)) {
+ if (UNEXPECTED(Z_TYPE_P(EX_VAR(opline->result.var)) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
ZEND_VM_NEXT_OPCODE();
} else {
zend_free_op free_res;
- zval **retval_ptr = EX_T(opline->result.var).var.ptr_ptr;
+ zval *retval_ptr = EX_VAR(opline->result.var);
- PZVAL_UNLOCK(*retval_ptr, &free_res);
- if (retval_ptr != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(retval_ptr);
- }
- PZVAL_LOCK(*retval_ptr);
+ PZVAL_UNLOCK(retval_ptr, &free_res);
+ SEPARATE_ZVAL_IF_NOT_REF(retval_ptr);
+ PZVAL_LOCK(retval_ptr);
FREE_OP_VAR_PTR(free_res);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -34609,8 +33345,7 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_CV_TMP(ZEN
if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
zend_error(E_NOTICE, "Trying to get property of non-object");
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
zval_dtor(free_op2.var);
} else {
zval *retval;
@@ -34622,11 +33357,10 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_CV_TMP(ZEN
/* here we are sure we are dealing with an object */
retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_R, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- PZVAL_LOCK(retval);
- EX_T(opline->result.var).var.ptr = retval;
+ ZVAL_COPY(EX_VAR(opline->result.var), retval);
if (1) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
zval_dtor(free_op2.var);
}
@@ -34646,7 +33380,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDL
USE_OPLINE
zend_free_op free_op1, free_op2;
zval *property;
- zval **container;
+ zval *container;
SAVE_OPLINE();
property = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
@@ -34654,30 +33388,30 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDL
if (1) {
MAKE_REAL_ZVAL_PTR(property);
}
- container = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
+ container = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(&EX_T(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W TSRMLS_CC);
if (1) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
zval_dtor(free_op2.var);
}
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
+//??? if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
/* We are going to assign the result by reference */
if (opline->extended_value & ZEND_FETCH_MAKE_REF) {
- zval **retval_ptr = EX_T(opline->result.var).var.ptr_ptr;
+ zval *retval_ptr = EX_VAR(opline->result.var);
- Z_DELREF_PP(retval_ptr);
+ Z_DELREF_P(retval_ptr);
SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
- Z_ADDREF_PP(retval_ptr);
- EX_T(opline->result.var).var.ptr = *EX_T(opline->result.var).var.ptr_ptr;
- EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
+ Z_ADDREF_P(retval_ptr);
+//??? EX_T(opline->result.var).var.ptr = *EX_T(opline->result.var).var.ptr_ptr;
+//??? EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
}
CHECK_EXCEPTION();
@@ -34689,27 +33423,27 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HAND
USE_OPLINE
zend_free_op free_op1, free_op2;
zval *property;
- zval **container;
+ zval *container;
SAVE_OPLINE();
property = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- container = _get_zval_ptr_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
+ container = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
if (1) {
MAKE_REAL_ZVAL_PTR(property);
}
- if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(&EX_T(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_RW TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_RW TSRMLS_CC);
if (1) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
zval_dtor(free_op2.var);
}
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
+//??? if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -34729,8 +33463,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HAND
if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
zval_dtor(free_op2.var);
} else {
zval *retval;
@@ -34742,11 +33475,10 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HAND
/* here we are sure we are dealing with an object */
retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_IS, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- PZVAL_LOCK(retval);
- EX_T(opline->result.var).var.ptr = retval;
+ ZVAL_COPY(EX_VAR(opline->result.var), retval);
if (1) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
zval_dtor(free_op2.var);
}
@@ -34759,32 +33491,32 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HAND
static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
+ zval *container;
if (zend_is_by_ref_func_arg_fetch(opline, EX(call) TSRMLS_CC)) {
/* Behave like FETCH_OBJ_W */
zend_free_op free_op1, free_op2;
zval *property;
- zval **container;
SAVE_OPLINE();
property = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- container = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
+ container = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
if (1) {
MAKE_REAL_ZVAL_PTR(property);
}
- if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(&EX_T(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W TSRMLS_CC);
if (1) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
zval_dtor(free_op2.var);
}
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
+//??? if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -34797,39 +33529,37 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_H
{
USE_OPLINE
zend_free_op free_op1, free_op2, free_res;
- zval **container;
+ zval *container;
zval *property;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var TSRMLS_CC);
+ container = _get_zval_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var TSRMLS_CC);
property = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
if (IS_CV == IS_CV) {
- if (container != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(container);
- }
+ SEPARATE_ZVAL_IF_NOT_REF(container);
}
if (1) {
MAKE_REAL_ZVAL_PTR(property);
}
- if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(&EX_T(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_UNSET TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_UNSET TSRMLS_CC);
if (1) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
zval_dtor(free_op2.var);
}
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
+//??? if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
- PZVAL_UNLOCK(*EX_T(opline->result.var).var.ptr_ptr, &free_res);
- if (EX_T(opline->result.var).var.ptr_ptr != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(EX_T(opline->result.var).var.ptr_ptr);
- }
- PZVAL_LOCK(*EX_T(opline->result.var).var.ptr_ptr);
+//??? PZVAL_UNLOCK(EX_VAR(opline->result.var), &free_res);
+//??? if (EX_T(opline->result.var).var.ptr_ptr != &EG(uninitialized_zval_ptr)) {
+//??? SEPARATE_ZVAL_IF_NOT_REF(EX_T(opline->result.var).var.ptr_ptr);
+//??? }
+//??? PZVAL_LOCK(EX_VAR(opline->result.var));
FREE_OP_VAR_PTR(free_res);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -34839,22 +33569,22 @@ static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLE
{
USE_OPLINE
zend_free_op free_op2;
- zval **object_ptr;
+ zval *object;
zval *property_name;
SAVE_OPLINE();
- object_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
+ object = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
property_name = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
if (1) {
MAKE_REAL_ZVAL_PTR(property_name);
}
- if (IS_CV == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_assign_to_object(RETURN_VALUE_USED(opline)?&EX_T(opline->result.var).var.ptr:NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (1) {
- zval_ptr_dtor(&property_name);
+ zval_ptr_dtor(property_name);
} else {
zval_dtor(free_op2.var);
}
@@ -34869,24 +33599,24 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLE
{
USE_OPLINE
- zval **object_ptr;
+ zval *object_ptr;
SAVE_OPLINE();
- object_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
+ object_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(object_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- if (Z_TYPE_PP(object_ptr) == IS_OBJECT) {
+ if (Z_TYPE_P(object_ptr) == IS_OBJECT) {
zend_free_op free_op2;
zval *property_name = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
if (1) {
MAKE_REAL_ZVAL_PTR(property_name);
}
- zend_assign_to_object(RETURN_VALUE_USED(opline)?&EX_T(opline->result.var).var.ptr:NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (1) {
- zval_ptr_dtor(&property_name);
+ zval_ptr_dtor(property_name);
} else {
zval_dtor(free_op2.var);
}
@@ -34894,46 +33624,38 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLE
zend_free_op free_op2, free_op_data1, free_op_data2;
zval *value;
zval *dim = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- zval **variable_ptr_ptr;
+ zval *variable_ptr;
- zend_fetch_dimension_address(&EX_T((opline+1)->op2.var), object_ptr, dim, IS_TMP_VAR, BP_VAR_W TSRMLS_CC);
+ zend_fetch_dimension_address(EX_VAR((opline+1)->op2.var), object_ptr, dim, IS_TMP_VAR, BP_VAR_W TSRMLS_CC);
zval_dtor(free_op2.var);
value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
- variable_ptr_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
- if (UNEXPECTED(variable_ptr_ptr == NULL)) {
- if (zend_assign_to_string_offset(&EX_T((opline+1)->op2.var), value, (opline+1)->op1_type TSRMLS_CC)) {
+ variable_ptr = _get_zval_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
+ if (UNEXPECTED(Z_TYPE_P(variable_ptr) == IS_STR_OFFSET)) {
+ if (zend_assign_to_string_offset(EX_VAR((opline+1)->op2.var), value, (opline+1)->op1_type TSRMLS_CC)) {
if (RETURN_VALUE_USED(opline)) {
- zval *retval;
-
- ALLOC_ZVAL(retval);
- ZVAL_STRINGL(retval, Z_STRVAL_P(EX_T((opline+1)->op2.var).str_offset.str)+EX_T((opline+1)->op2.var).str_offset.offset, 1, 1);
- INIT_PZVAL(retval);
- EX_T(opline->result.var).var.ptr = retval;
+ ZVAL_STRINGL(EX_VAR(opline->result.var), Z_STR_OFFSET_P(EX_VAR((opline+1)->op2.var))->str + Z_STR_OFFSET_P(EX_VAR((opline+1)->op2.var))->offset, 1);
}
} else if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
- } else if (UNEXPECTED(*variable_ptr_ptr == &EG(error_zval))) {
+ } else if (UNEXPECTED(variable_ptr == &EG(error_zval))) {
if (IS_TMP_FREE(free_op_data1)) {
zval_dtor(value);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
} else {
if ((opline+1)->op1_type == IS_TMP_VAR) {
- value = zend_assign_tmp_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_tmp_to_variable(variable_ptr, value TSRMLS_CC);
} else if ((opline+1)->op1_type == IS_CONST) {
- value = zend_assign_const_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_const_to_variable(variable_ptr, value TSRMLS_CC);
} else {
- value = zend_assign_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_to_variable(variable_ptr, value TSRMLS_CC);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(value);
- EX_T(opline->result.var).var.ptr = value;
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
}
}
FREE_OP_VAR_PTR(free_op_data2);
@@ -34951,45 +33673,37 @@ static int ZEND_FASTCALL ZEND_ASSIGN_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR
USE_OPLINE
zend_free_op free_op2;
zval *value;
- zval **variable_ptr_ptr;
+ zval *variable_ptr;
SAVE_OPLINE();
value = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- variable_ptr_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
+ variable_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(variable_ptr_ptr == NULL)) {
- if (zend_assign_to_string_offset(&EX_T(opline->op1.var), value, IS_TMP_VAR TSRMLS_CC)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(variable_ptr) == IS_STR_OFFSET)) {
+ if (zend_assign_to_string_offset(EX_VAR(opline->op1.var), value, IS_TMP_VAR TSRMLS_CC)) {
if (RETURN_VALUE_USED(opline)) {
- zval *retval;
-
- ALLOC_ZVAL(retval);
- ZVAL_STRINGL(retval, Z_STRVAL_P(EX_T(opline->op1.var).str_offset.str)+EX_T(opline->op1.var).str_offset.offset, 1, 1);
- INIT_PZVAL(retval);
- EX_T(opline->result.var).var.ptr = retval;
+ ZVAL_STRINGL(EX_VAR(opline->result.var), Z_STR_OFFSET_P(EX_VAR(opline->op1.var))->str + Z_STR_OFFSET_P(EX_VAR(opline->op1.var))->offset, 1);
}
} else if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
- } else if (IS_CV == IS_VAR && UNEXPECTED(*variable_ptr_ptr == &EG(error_zval))) {
+ } else if (IS_CV == IS_VAR && UNEXPECTED(variable_ptr == &EG(error_zval))) {
if (1) {
zval_dtor(value);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
} else {
if (IS_TMP_VAR == IS_TMP_VAR) {
- value = zend_assign_tmp_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_tmp_to_variable(variable_ptr, value TSRMLS_CC);
} else if (IS_TMP_VAR == IS_CONST) {
- value = zend_assign_const_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_const_to_variable(variable_ptr, value TSRMLS_CC);
} else {
- value = zend_assign_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_to_variable(variable_ptr, value TSRMLS_CC);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(value);
- EX_T(opline->result.var).var.ptr = value;
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
}
}
@@ -35003,8 +33717,6 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_
{
USE_OPLINE
zval *function_name;
- char *function_name_strval;
- int function_name_strlen;
zend_free_op free_op2;
call_slot *call = EX(call_slots) + opline->result.num;
@@ -35020,32 +33732,29 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_
zend_error_noreturn(E_ERROR, "Method name must be a string");
}
- function_name_strval = Z_STRVAL_P(function_name);
- function_name_strlen = Z_STRLEN_P(function_name);
-
- call->object = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
+ ZVAL_COPY_VALUE(&call->object, _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC));
- if (EXPECTED(call->object != NULL) &&
- EXPECTED(Z_TYPE_P(call->object) == IS_OBJECT)) {
- call->called_scope = Z_OBJCE_P(call->object);
+ if (EXPECTED(Z_TYPE(call->object) != IS_UNDEF) &&
+ EXPECTED(Z_TYPE(call->object) == IS_OBJECT)) {
+ call->called_scope = Z_OBJCE(call->object);
if (IS_TMP_VAR != IS_CONST ||
(call->fbc = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope)) == NULL) {
- zval *object = call->object;
+ zend_object *object = Z_OBJ(call->object);
- if (UNEXPECTED(Z_OBJ_HT_P(call->object)->get_method == NULL)) {
+ if (UNEXPECTED(Z_OBJ_HT(call->object)->get_method == NULL)) {
zend_error_noreturn(E_ERROR, "Object does not support method calls");
}
/* First, locate the function. */
- call->fbc = Z_OBJ_HT_P(call->object)->get_method(&call->object, function_name_strval, function_name_strlen, ((IS_TMP_VAR == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
+ call->fbc = Z_OBJ_HT(call->object)->get_method(&call->object, Z_STR_P(function_name), ((IS_TMP_VAR == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
if (UNEXPECTED(call->fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(call->object), function_name_strval);
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(&call->object), Z_STRVAL_P(function_name));
}
if (IS_TMP_VAR == IS_CONST &&
EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0) &&
- EXPECTED(call->object == object)) {
+ EXPECTED(Z_OBJ(call->object) == object)) {
CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope, call->fbc);
}
}
@@ -35054,20 +33763,16 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_
zval_dtor(free_op2.var);
HANDLE_EXCEPTION();
}
- zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval);
+ zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", Z_STRVAL_P(function_name));
}
if ((call->fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) {
- call->object = NULL;
+ ZVAL_UNDEF(&call->object);
} else {
- if (!PZVAL_IS_REF(call->object)) {
- Z_ADDREF_P(call->object); /* For $this pointer */
+ if (!Z_ISREF(call->object)) {
+ Z_ADDREF(call->object); /* For $this pointer */
} else {
- zval *this_ptr;
- ALLOC_ZVAL(this_ptr);
- INIT_PZVAL_COPY(this_ptr, call->object);
- zval_copy_ctor(this_ptr);
- call->object = this_ptr;
+ ZVAL_DUP(&call->object, Z_REFVAL(call->object));
}
}
@@ -35087,7 +33792,7 @@ static int ZEND_FASTCALL ZEND_CASE_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS
zend_free_op free_op2;
SAVE_OPLINE();
- is_equal_function(&EX_T(opline->result.var).tmp_var,
+ is_equal_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
@@ -35104,29 +33809,24 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_TMP_HANDLER(ZEND_OPCODE
SAVE_OPLINE();
if ((IS_CV == IS_VAR || IS_CV == IS_CV) && opline->extended_value) {
- zval **expr_ptr_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
-
- if (IS_CV == IS_VAR && UNEXPECTED(expr_ptr_ptr == NULL)) {
+ expr_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets");
}
- SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr_ptr);
- expr_ptr = *expr_ptr_ptr;
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr);
Z_ADDREF_P(expr_ptr);
} else {
expr_ptr=_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
if (0) { /* temporary variable */
- zval *new_expr;
+ zval new_expr;
- ALLOC_ZVAL(new_expr);
- INIT_PZVAL_COPY(new_expr, expr_ptr);
- expr_ptr = new_expr;
- } else if (IS_CV == IS_CONST || PZVAL_IS_REF(expr_ptr)) {
- zval *new_expr;
+ ZVAL_COPY_VALUE(&new_expr, expr_ptr);
+ expr_ptr = &new_expr;
+ } else if (IS_CV == IS_CONST || Z_ISREF_P(expr_ptr)) {
+ zval new_expr;
- ALLOC_ZVAL(new_expr);
- INIT_PZVAL_COPY(new_expr, expr_ptr);
- expr_ptr = new_expr;
- zendi_zval_copy_ctor(*expr_ptr);
+ ZVAL_DUP(&new_expr, expr_ptr);
+ expr_ptr = &new_expr;
} else if (IS_CV == IS_CV) {
Z_ADDREF_P(expr_ptr);
@@ -35146,29 +33846,26 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_TMP_HANDLER(ZEND_OPCODE
case IS_BOOL:
hval = Z_LVAL_P(offset);
num_index:
- zend_hash_index_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), hval, &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr);
break;
case IS_STRING:
- if (IS_TMP_VAR == IS_CONST) {
- hval = Z_HASH_P(offset);
- } else {
+ if (IS_TMP_VAR != IS_CONST) {
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index);
- hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset));
}
- zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), Z_STR_P(offset), expr_ptr);
break;
case IS_NULL:
- zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), STR_EMPTY_ALLOC(), expr_ptr);
break;
default:
zend_error(E_WARNING, "Illegal offset type");
- zval_ptr_dtor(&expr_ptr);
+ zval_ptr_dtor(expr_ptr);
/* do nothing */
break;
}
zval_dtor(free_op2.var);
} else {
- zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr);
}
if ((IS_CV == IS_VAR || IS_CV == IS_CV) && opline->extended_value) {
@@ -35181,7 +33878,7 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLE
{
USE_OPLINE
- array_init(&EX_T(opline->result.var).tmp_var);
+ array_init(EX_VAR(opline->result.var));
if (IS_CV == IS_UNUSED) {
ZEND_VM_NEXT_OPCODE();
#if 0 || IS_CV != IS_UNUSED
@@ -35195,21 +33892,21 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER
{
USE_OPLINE
zend_free_op free_op2;
- zval **container;
+ zval *container;
zval *offset;
ulong hval;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_CV && container != &EG(uninitialized_zval_ptr)) {
+ container = _get_zval_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var TSRMLS_CC);
+ if (IS_CV == IS_CV) {
SEPARATE_ZVAL_IF_NOT_REF(container);
}
offset = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
if (IS_CV != IS_VAR || container) {
- switch (Z_TYPE_PP(container)) {
+ switch (Z_TYPE_P(container)) {
case IS_ARRAY: {
- HashTable *ht = Z_ARRVAL_PP(container);
+ HashTable *ht = Z_ARRVAL_P(container);
switch (Z_TYPE_P(offset)) {
case IS_DOUBLE:
@@ -35226,29 +33923,26 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER
if (IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) {
Z_ADDREF_P(offset);
}
- if (IS_TMP_VAR == IS_CONST) {
- hval = Z_HASH_P(offset);
- } else {
+ if (IS_TMP_VAR != IS_CONST) {
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim);
- hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset));
}
- if (ht == &EG(symbol_table)) {
- zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC);
+ if (ht == &EG(symbol_table).ht) {
+ zend_delete_global_variable(Z_STR_P(offset) TSRMLS_CC);
} else {
- zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval);
+ zend_hash_del(ht, Z_STR_P(offset));
}
if (IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
}
break;
num_index_dim:
zend_hash_index_del(ht, hval);
if (IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
}
break;
case IS_NULL:
- zend_hash_del(ht, "", sizeof(""));
+ zend_hash_del(ht, STR_EMPTY_ALLOC());
break;
default:
zend_error(E_WARNING, "Illegal offset type in unset");
@@ -35258,15 +33952,15 @@ num_index_dim:
break;
}
case IS_OBJECT:
- if (UNEXPECTED(Z_OBJ_HT_P(*container)->unset_dimension == NULL)) {
+ if (UNEXPECTED(Z_OBJ_HT_P(container)->unset_dimension == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use object as array");
}
if (1) {
MAKE_REAL_ZVAL_PTR(offset);
}
- Z_OBJ_HT_P(*container)->unset_dimension(*container, offset TSRMLS_CC);
+ Z_OBJ_HT_P(container)->unset_dimension(container, offset TSRMLS_CC);
if (1) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
zval_dtor(free_op2.var);
}
@@ -35290,28 +33984,28 @@ static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER
{
USE_OPLINE
zend_free_op free_op2;
- zval **container;
+ zval *container;
zval *offset;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var TSRMLS_CC);
+ container = _get_zval_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var TSRMLS_CC);
offset = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
if (IS_CV != IS_VAR || container) {
- if (IS_CV == IS_CV && container != &EG(uninitialized_zval_ptr)) {
+ if (IS_CV == IS_CV) {
SEPARATE_ZVAL_IF_NOT_REF(container);
}
- if (Z_TYPE_PP(container) == IS_OBJECT) {
+ if (Z_TYPE_P(container) == IS_OBJECT) {
if (1) {
MAKE_REAL_ZVAL_PTR(offset);
}
- if (Z_OBJ_HT_P(*container)->unset_property) {
- Z_OBJ_HT_P(*container)->unset_property(*container, offset, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ if (Z_OBJ_HT_P(container)->unset_property) {
+ Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_TMP_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to unset property of non-object");
}
if (1) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
zval_dtor(free_op2.var);
}
@@ -35331,7 +34025,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_TMP(int
USE_OPLINE
zend_free_op free_op2;
zval *container;
- zval **value = NULL;
+ zval *value;
int result = 0;
ulong hval;
zval *offset;
@@ -35355,23 +34049,20 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_TMP(int
case IS_LONG:
hval = Z_LVAL_P(offset);
num_index_prop:
- if (zend_hash_index_find(ht, hval, (void **) &value) == SUCCESS) {
+ if ((value = zend_hash_index_find(ht, hval)) != NULL) {
isset = 1;
}
break;
case IS_STRING:
- if (IS_TMP_VAR == IS_CONST) {
- hval = Z_HASH_P(offset);
- } else {
+ if (IS_TMP_VAR != IS_CONST) {
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop);
- hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset));
}
- if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) {
+ if ((value = zend_hash_find(ht, Z_STR_P(offset))) != NULL) {
isset = 1;
}
break;
case IS_NULL:
- if (zend_hash_find(ht, "", sizeof(""), (void **) &value) == SUCCESS) {
+ if ((value = zend_hash_find(ht, STR_EMPTY_ALLOC())) != NULL) {
isset = 1;
}
break;
@@ -35381,13 +34072,13 @@ num_index_prop:
}
if (opline->extended_value & ZEND_ISSET) {
- if (isset && Z_TYPE_PP(value) == IS_NULL) {
+ if (isset && Z_TYPE_P(value) == IS_NULL) {
result = 0;
} else {
result = isset;
}
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (!isset || !i_zend_is_true(*value TSRMLS_CC)) {
+ if (!isset || !i_zend_is_true(value TSRMLS_CC)) {
result = 0;
} else {
result = 1;
@@ -35414,7 +34105,7 @@ num_index_prop:
}
}
if (1) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
zval_dtor(free_op2.var);
}
@@ -35425,8 +34116,7 @@ num_index_prop:
if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */
|| (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
&& IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) {
- ZVAL_COPY_VALUE(&tmp, offset);
- zval_copy_ctor(&tmp);
+ ZVAL_DUP(&tmp, offset);
convert_to_long(&tmp);
offset = &tmp;
} else {
@@ -35450,11 +34140,10 @@ num_index_prop:
zval_dtor(free_op2.var);
}
- Z_TYPE(EX_T(opline->result.var).tmp_var) = IS_BOOL;
if (opline->extended_value & ZEND_ISSET) {
- Z_LVAL(EX_T(opline->result.var).tmp_var) = result;
+ ZVAL_BOOL(EX_VAR(opline->result.var), result);
} else {
- Z_LVAL(EX_T(opline->result.var).tmp_var) = !result;
+ ZVAL_BOOL(EX_VAR(opline->result.var), !result);
}
CHECK_EXCEPTION();
@@ -35473,6 +34162,9 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CV_TMP_HANDLER(ZEND_O
static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
+//???
+return 0;
+#if 0
USE_OPLINE
/* The generator object is stored in return_value_ptr_ptr */
@@ -35515,7 +34207,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG
generator->value = copy;
} else {
- zval **value_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
+ zval **value_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W);
if (IS_CV == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
@@ -35543,7 +34235,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG
/* Consts, temporary variables and references need copying */
if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR
- || PZVAL_IS_REF(value)
+ || Z_ISREF_P(value)
) {
zval *copy;
@@ -35577,7 +34269,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG
/* Consts, temporary variables and references need copying */
if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR
- || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0)
+ || (Z_ISREF_P(key) && Z_REFCOUNT_P(key) > 0)
) {
zval *copy;
@@ -35628,6 +34320,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG
SAVE_OPLINE();
ZEND_VM_RETURN();
+#endif
}
static int ZEND_FASTCALL ZEND_ADD_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -35636,11 +34329,11 @@ static int ZEND_FASTCALL ZEND_ADD_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_free_op free_op2;
SAVE_OPLINE();
- fast_add_function(&EX_T(opline->result.var).tmp_var,
+ fast_add_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -35651,11 +34344,11 @@ static int ZEND_FASTCALL ZEND_SUB_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_free_op free_op2;
SAVE_OPLINE();
- fast_sub_function(&EX_T(opline->result.var).tmp_var,
+ fast_sub_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -35666,11 +34359,11 @@ static int ZEND_FASTCALL ZEND_MUL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_free_op free_op2;
SAVE_OPLINE();
- fast_mul_function(&EX_T(opline->result.var).tmp_var,
+ fast_mul_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -35681,11 +34374,11 @@ static int ZEND_FASTCALL ZEND_DIV_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_free_op free_op2;
SAVE_OPLINE();
- fast_div_function(&EX_T(opline->result.var).tmp_var,
+ fast_div_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -35696,11 +34389,11 @@ static int ZEND_FASTCALL ZEND_MOD_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_free_op free_op2;
SAVE_OPLINE();
- fast_mod_function(&EX_T(opline->result.var).tmp_var,
+ fast_mod_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -35711,11 +34404,11 @@ static int ZEND_FASTCALL ZEND_SL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_free_op free_op2;
SAVE_OPLINE();
- shift_left_function(&EX_T(opline->result.var).tmp_var,
+ shift_left_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -35726,11 +34419,11 @@ static int ZEND_FASTCALL ZEND_SR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
zend_free_op free_op2;
SAVE_OPLINE();
- shift_right_function(&EX_T(opline->result.var).tmp_var,
+ shift_right_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -35741,11 +34434,11 @@ static int ZEND_FASTCALL ZEND_CONCAT_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR
zend_free_op free_op2;
SAVE_OPLINE();
- concat_function(&EX_T(opline->result.var).tmp_var,
+ concat_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -35756,11 +34449,11 @@ static int ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HAND
zend_free_op free_op2;
SAVE_OPLINE();
- is_identical_function(&EX_T(opline->result.var).tmp_var,
+ is_identical_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -35769,7 +34462,7 @@ static int ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_
{
USE_OPLINE
zend_free_op free_op2;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
is_identical_function(result,
@@ -35777,7 +34470,7 @@ static int ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
Z_LVAL_P(result) = !Z_LVAL_P(result);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -35786,14 +34479,14 @@ static int ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_
{
USE_OPLINE
zend_free_op free_op2;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_equal_function(result,
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC));
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -35802,14 +34495,14 @@ static int ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HAND
{
USE_OPLINE
zend_free_op free_op2;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_not_equal_function(result,
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC));
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -35818,14 +34511,14 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLE
{
USE_OPLINE
zend_free_op free_op2;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_is_smaller_function(result,
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC));
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -35834,14 +34527,14 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_CV_VAR_HANDLER(ZEND_OPCO
{
USE_OPLINE
zend_free_op free_op2;
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_is_smaller_or_equal_function(result,
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC));
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -35852,11 +34545,11 @@ static int ZEND_FASTCALL ZEND_BW_OR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
zend_free_op free_op2;
SAVE_OPLINE();
- bitwise_or_function(&EX_T(opline->result.var).tmp_var,
+ bitwise_or_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -35867,11 +34560,11 @@ static int ZEND_FASTCALL ZEND_BW_AND_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR
zend_free_op free_op2;
SAVE_OPLINE();
- bitwise_and_function(&EX_T(opline->result.var).tmp_var,
+ bitwise_and_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -35882,11 +34575,11 @@ static int ZEND_FASTCALL ZEND_BW_XOR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR
zend_free_op free_op2;
SAVE_OPLINE();
- bitwise_xor_function(&EX_T(opline->result.var).tmp_var,
+ bitwise_xor_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -35897,11 +34590,11 @@ static int ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_
zend_free_op free_op2;
SAVE_OPLINE();
- boolean_xor_function(&EX_T(opline->result.var).tmp_var,
+ boolean_xor_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -35910,27 +34603,24 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_VAR(int (*bina
{
USE_OPLINE
zend_free_op free_op2, free_op_data1;
- zval **object_ptr = _get_zval_ptr_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
- zval *object;
+ zval *object = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
zval *property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
zval *value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
int have_get_ptr = 0;
- if (IS_CV == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- make_real_object(object_ptr TSRMLS_CC);
- object = *object_ptr;
+ make_real_object(object TSRMLS_CC);
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to assign property of non-object");
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
FREE_OP(free_op_data1);
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
} else {
/* here we are sure we are dealing with an object */
@@ -35941,15 +34631,14 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_VAR(int (*bina
/* here property is a string */
if (opline->extended_value == ZEND_ASSIGN_OBJ
&& Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval **zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
have_get_ptr = 1;
- binary_op(*zptr, *zptr, value TSRMLS_CC);
+ binary_op(zptr, zptr, value TSRMLS_CC);
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(*zptr);
- EX_T(opline->result.var).var.ptr = *zptr;
+ ZVAL_COPY(EX_VAR(opline->result.var), zptr);
}
}
}
@@ -35973,12 +34662,11 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_VAR(int (*bina
if (Z_REFCOUNT_P(z) == 0) {
GC_REMOVE_ZVAL_FROM_BUFFER(z);
zval_dtor(z);
- FREE_ZVAL(z);
}
z = value;
}
Z_ADDREF_P(z);
- SEPARATE_ZVAL_IF_NOT_REF(&z);
+ SEPARATE_ZVAL_IF_NOT_REF(z);
binary_op(z, z, value TSRMLS_CC);
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
@@ -35986,23 +34674,21 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_VAR(int (*bina
Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(z);
- EX_T(opline->result.var).var.ptr = z;
+ ZVAL_COPY(EX_VAR(opline->result.var), z);
}
- zval_ptr_dtor(&z);
+ zval_ptr_dtor(z);
} else {
zend_error(E_WARNING, "Attempt to assign property of non-object");
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
}
}
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
}
FREE_OP(free_op_data1);
}
@@ -36017,7 +34703,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_CV_VAR(int (*binary_o
{
USE_OPLINE
zend_free_op free_op2, free_op_data2, free_op_data1;
- zval **var_ptr;
+ zval *var_ptr;
zval *value;
SAVE_OPLINE();
@@ -36026,41 +34712,40 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_CV_VAR(int (*binary_o
return zend_binary_assign_op_obj_helper_SPEC_CV_VAR(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
break;
case ZEND_ASSIGN_DIM: {
- zval **container = _get_zval_ptr_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
+ zval *container = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- } else if (UNEXPECTED(Z_TYPE_PP(container) == IS_OBJECT)) {
+ } else if (UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
if (IS_CV == IS_VAR && !0) {
- Z_ADDREF_PP(container); /* undo the effect of get_obj_zval_ptr_ptr() */
+ Z_ADDREF_P(container); /* undo the effect of get_obj_zval_ptr_ptr() */
}
return zend_binary_assign_op_obj_helper_SPEC_CV_VAR(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
} else {
zval *dim = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- zend_fetch_dimension_address(&EX_T((opline+1)->op2.var), container, dim, IS_VAR, BP_VAR_RW TSRMLS_CC);
+ zend_fetch_dimension_address(EX_VAR((opline+1)->op2.var), container, dim, IS_VAR, BP_VAR_RW TSRMLS_CC);
value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
- var_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
+ var_ptr = _get_zval_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
}
}
break;
default:
value = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- var_ptr = _get_zval_ptr_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
+ var_ptr = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
/* do nothing */
break;
}
- if (UNEXPECTED(var_ptr == NULL)) {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
}
- if (UNEXPECTED(*var_ptr == &EG(error_zval))) {
+ if (UNEXPECTED(var_ptr == &EG(error_zval))) {
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
if (opline->extended_value == ZEND_ASSIGN_DIM) {
@@ -36071,24 +34756,23 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_CV_VAR(int (*binary_o
SEPARATE_ZVAL_IF_NOT_REF(var_ptr);
- if (UNEXPECTED(Z_TYPE_PP(var_ptr) == IS_OBJECT)
- && Z_OBJ_HANDLER_PP(var_ptr, get)
- && Z_OBJ_HANDLER_PP(var_ptr, set)) {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_OBJECT)
+ && Z_OBJ_HANDLER_P(var_ptr, get)
+ && Z_OBJ_HANDLER_P(var_ptr, set)) {
/* proxy object */
- zval *objval = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC);
+ zval *objval = Z_OBJ_HANDLER_P(var_ptr, get)(var_ptr TSRMLS_CC);
Z_ADDREF_P(objval);
binary_op(objval, objval, value TSRMLS_CC);
- Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, objval TSRMLS_CC);
- zval_ptr_dtor(&objval);
+ Z_OBJ_HANDLER_P(var_ptr, set)(var_ptr, objval TSRMLS_CC);
+ zval_ptr_dtor(objval);
} else {
- binary_op(*var_ptr, *var_ptr, value TSRMLS_CC);
+ binary_op(var_ptr, var_ptr, value TSRMLS_CC);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(*var_ptr);
- EX_T(opline->result.var).var.ptr = *var_ptr;
+ ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
if (opline->extended_value == ZEND_ASSIGN_DIM) {
FREE_OP(free_op_data1);
@@ -36162,30 +34846,27 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_CV_VAR(incdec_t in
{
USE_OPLINE
zend_free_op free_op2;
- zval **object_ptr;
zval *object;
zval *property;
- zval **retval;
+ zval *retval;
int have_get_ptr = 0;
SAVE_OPLINE();
- object_ptr = _get_zval_ptr_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
+ object = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- retval = &EX_T(opline->result.var).var.ptr;
+ retval = EX_VAR(opline->result.var);
- if (IS_CV == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
- object = *object_ptr;
+ make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- *retval = &EG(uninitialized_zval);
+ ZVAL_NULL(retval);
}
CHECK_EXCEPTION();
@@ -36199,15 +34880,14 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_CV_VAR(incdec_t in
}
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval **zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
have_get_ptr = 1;
- incdec_op(*zptr);
+ incdec_op(zptr);
if (RETURN_VALUE_USED(opline)) {
- *retval = *zptr;
- PZVAL_LOCK(*retval);
+ ZVAL_COPY(retval, zptr);
}
}
}
@@ -36222,30 +34902,28 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_CV_VAR(incdec_t in
if (Z_REFCOUNT_P(z) == 0) {
GC_REMOVE_ZVAL_FROM_BUFFER(z);
zval_dtor(z);
- FREE_ZVAL(z);
}
z = value;
}
Z_ADDREF_P(z);
- SEPARATE_ZVAL_IF_NOT_REF(&z);
+ SEPARATE_ZVAL_IF_NOT_REF(z);
incdec_op(z);
- *retval = z;
+ ZVAL_COPY_VALUE(retval, z);
Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- SELECTIVE_PZVAL_LOCK(*retval, opline);
- zval_ptr_dtor(&z);
+ SELECTIVE_PZVAL_LOCK(retval, opline);
+ zval_ptr_dtor(z);
} else {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- *retval = &EG(uninitialized_zval);
+ ZVAL_NULL(retval);
}
}
}
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
}
CHECK_EXCEPTION();
@@ -36266,27 +34944,25 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_VAR(incdec_t i
{
USE_OPLINE
zend_free_op free_op2;
- zval **object_ptr;
zval *object;
zval *property;
zval *retval;
int have_get_ptr = 0;
SAVE_OPLINE();
- object_ptr = _get_zval_ptr_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
+ object = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- retval = &EX_T(opline->result.var).tmp_var;
+ retval = EX_VAR(opline->result.var);
- if (IS_CV == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
- object = *object_ptr;
+ make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
ZVAL_NULL(retval);
CHECK_EXCEPTION();
@@ -36300,15 +34976,14 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_VAR(incdec_t i
}
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval **zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
have_get_ptr = 1;
SEPARATE_ZVAL_IF_NOT_REF(zptr);
- ZVAL_COPY_VALUE(retval, *zptr);
- zendi_zval_copy_ctor(*retval);
+ ZVAL_DUP(retval, zptr);
- incdec_op(*zptr);
+ incdec_op(zptr);
}
}
@@ -36316,7 +34991,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_VAR(incdec_t i
if (!have_get_ptr) {
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- zval *z_copy;
+ zval z_copy;
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC);
@@ -36324,20 +34999,16 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_VAR(incdec_t i
if (Z_REFCOUNT_P(z) == 0) {
GC_REMOVE_ZVAL_FROM_BUFFER(z);
zval_dtor(z);
- FREE_ZVAL(z);
}
z = value;
}
- ZVAL_COPY_VALUE(retval, z);
- zendi_zval_copy_ctor(*retval);
- ALLOC_ZVAL(z_copy);
- INIT_PZVAL_COPY(z_copy, z);
- zendi_zval_copy_ctor(*z_copy);
- incdec_op(z_copy);
+ ZVAL_DUP(retval, z);
+ ZVAL_DUP(&z_copy, z);
+ incdec_op(&z_copy);
Z_ADDREF_P(z);
- Z_OBJ_HT_P(object)->write_property(object, property, z_copy, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(object)->write_property(object, property, &z_copy, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval_ptr_dtor(&z_copy);
- zval_ptr_dtor(&z);
+ zval_ptr_dtor(z);
} else {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
ZVAL_NULL(retval);
@@ -36345,9 +35016,9 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_VAR(incdec_t i
}
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
}
CHECK_EXCEPTION();
@@ -36369,19 +35040,17 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_VAR(int type, ZEN
USE_OPLINE
zend_free_op free_op1;
zval *varname;
- zval **retval;
+ zval *retval;
zval tmp_varname;
HashTable *target_symbol_table;
- ulong hash_value;
SAVE_OPLINE();
varname = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
if (IS_CV != IS_CONST && UNEXPECTED(Z_TYPE_P(varname) != IS_STRING)) {
- ZVAL_COPY_VALUE(&tmp_varname, varname);
- zval_copy_ctor(&tmp_varname);
- Z_SET_REFCOUNT(tmp_varname, 1);
- Z_UNSET_ISREF(tmp_varname);
+ ZVAL_DUP(&tmp_varname, varname);
+//??? Z_SET_REFCOUNT(tmp_varname, 1);
+//??? Z_UNSET_ISREF(tmp_varname);
convert_to_string(&tmp_varname);
varname = &tmp_varname;
}
@@ -36393,7 +35062,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_VAR(int type, ZEN
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
ce = CACHED_PTR(opline->op2.literal->cache_slot);
} else {
- ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
if (IS_CV != IS_CONST && varname == &tmp_varname) {
zval_dtor(&tmp_varname);
@@ -36405,9 +35074,9 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_VAR(int type, ZEN
CACHE_PTR(opline->op2.literal->cache_slot, ce);
}
} else {
- ce = EX_T(opline->op2.var).class_entry;
+ ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0, ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ retval = zend_std_get_static_property(ce, Z_STR_P(varname), 0, ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
} else {
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
@@ -36417,27 +35086,21 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_VAR(int type, ZEN
ZEND_VM_NEXT_OPCODE();
}
*/
- if (IS_CV == IS_CONST) {
- hash_value = Z_HASH_P(varname);
- } else {
- hash_value = str_hash(Z_STRVAL_P(varname), Z_STRLEN_P(varname));
- }
-
- if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) {
+ if ((retval = zend_hash_find(target_symbol_table, Z_STR_P(varname))) == NULL) {
switch (type) {
case BP_VAR_R:
case BP_VAR_UNSET:
zend_error(E_NOTICE,"Undefined variable: %s", Z_STRVAL_P(varname));
/* break missing intentionally */
case BP_VAR_IS:
- retval = &EG(uninitialized_zval_ptr);
+ ZVAL_NULL(retval);
break;
case BP_VAR_RW:
zend_error(E_NOTICE,"Undefined variable: %s", Z_STRVAL_P(varname));
/* break missing intentionally */
case BP_VAR_W:
Z_ADDREF_P(&EG(uninitialized_zval));
- zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval);
+ retval = zend_hash_update(target_symbol_table, Z_STR_P(varname), &EG(uninitialized_zval));
break;
EMPTY_SWITCH_DEFAULT_CASE()
}
@@ -36456,7 +35119,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_VAR(int type, ZEN
break;
case ZEND_FETCH_GLOBAL_LOCK:
if (IS_CV == IS_VAR && !free_op1.var) {
- PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
+ Z_ADDREF_P(EX_VAR(opline->op1.var));
}
break;
}
@@ -36469,27 +35132,26 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_VAR(int type, ZEN
if (opline->extended_value & ZEND_FETCH_MAKE_REF) {
SEPARATE_ZVAL_TO_MAKE_IS_REF(retval);
}
- PZVAL_LOCK(*retval);
- switch (type) {
- case BP_VAR_R:
- case BP_VAR_IS:
- EX_T(opline->result.var).var.ptr = *retval;
- break;
- case BP_VAR_UNSET: {
- zend_free_op free_res;
-
- PZVAL_UNLOCK(*retval, &free_res);
- if (retval != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(retval);
- }
- PZVAL_LOCK(*retval);
- FREE_OP_VAR_PTR(free_res);
- }
- /* break missing intentionally */
- default:
- EX_T(opline->result.var).var.ptr_ptr = retval;
- break;
- }
+ ZVAL_COPY(EX_VAR(opline->result.var), retval);
+//??? switch (type) {
+//??? case BP_VAR_R:
+//??? case BP_VAR_IS:
+//??? break;
+//??? case BP_VAR_UNSET: {
+//??? zend_free_op free_res;
+//???
+//??? PZVAL_UNLOCK(*retval, &free_res);
+//??? if (retval != &EG(uninitialized_zval_ptr)) {
+//??? SEPARATE_ZVAL_IF_NOT_REF(retval);
+//??? }
+//??? PZVAL_LOCK(*retval);
+//??? FREE_OP_VAR_PTR(free_res);
+//??? }
+//??? /* break missing intentionally */
+//??? default:
+//??? EX_T(opline->result.var).var.ptr_ptr = retval;
+//??? break;
+//??? }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -36534,8 +35196,8 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDL
SAVE_OPLINE();
container = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zend_fetch_dimension_address_read(EX_VAR(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC);
+ zval_ptr_dtor_nogc(free_op2.var);
if (IS_CV != IS_VAR || !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
}
@@ -36547,29 +35209,27 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDL
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval **container;
+ zval *container;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
+ container = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_fetch_dimension_address(&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_W TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op2.var);
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
+ zend_fetch_dimension_address(EX_VAR(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_W TSRMLS_CC);
+ zval_ptr_dtor_nogc(free_op2.var);
+//??? if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
+//??? }
/* We are going to assign the result by reference */
if (UNEXPECTED(opline->extended_value != 0)) {
- zval **retval_ptr = EX_T(opline->result.var).var.ptr_ptr;
+ zval *retval_ptr = EX_VAR(opline->result.var);
- if (retval_ptr) {
- Z_DELREF_PP(retval_ptr);
- SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
- Z_ADDREF_PP(retval_ptr);
- }
+ Z_DELREF_P(retval_ptr);
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
+ Z_ADDREF_P(retval_ptr);
}
CHECK_EXCEPTION();
@@ -36580,19 +35240,19 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HAND
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval **container;
+ zval *container;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
+ container = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_fetch_dimension_address(&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_RW TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op2.var);
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
+ zend_fetch_dimension_address(EX_VAR(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_RW TSRMLS_CC);
+ zval_ptr_dtor_nogc(free_op2.var);
+//??? if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -36606,8 +35266,8 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HAND
SAVE_OPLINE();
container = _get_zval_ptr_cv_BP_VAR_IS(execute_data, opline->op1.var TSRMLS_CC);
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_IS TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zend_fetch_dimension_address_read(EX_VAR(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_IS TSRMLS_CC);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -36616,30 +35276,29 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HAND
static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
+ zval *container;
zend_free_op free_op1, free_op2;
SAVE_OPLINE();
if (zend_is_by_ref_func_arg_fetch(opline, EX(call) TSRMLS_CC)) {
- zval **container = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
+ container = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_fetch_dimension_address(&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_W TSRMLS_CC);
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
- zval_ptr_dtor_nogc(&free_op2.var);
+ zend_fetch_dimension_address(EX_VAR(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_W TSRMLS_CC);
+//??? if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
+ zval_ptr_dtor_nogc(free_op2.var);
} else {
- zval *container;
-
if (IS_VAR == IS_UNUSED) {
zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
}
container = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zend_fetch_dimension_address_read(EX_VAR(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_R TSRMLS_CC);
+ zval_ptr_dtor_nogc(free_op2.var);
}
CHECK_EXCEPTION();
@@ -36650,37 +35309,33 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_H
{
USE_OPLINE
zend_free_op free_op1, free_op2;
- zval **container;
+ zval *container;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var TSRMLS_CC);
+ container = _get_zval_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var TSRMLS_CC);
if (IS_CV == IS_CV) {
- if (container != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(container);
- }
+ SEPARATE_ZVAL_IF_NOT_REF(container);
}
- if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_fetch_dimension_address(&EX_T(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_UNSET TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op2.var);
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
+ zend_fetch_dimension_address(EX_VAR(opline->result.var), container, _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR, BP_VAR_UNSET TSRMLS_CC);
+ zval_ptr_dtor_nogc(free_op2.var);
+//??? if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
- if (UNEXPECTED(EX_T(opline->result.var).var.ptr_ptr == NULL)) {
+ if (UNEXPECTED(Z_TYPE_P(EX_VAR(opline->result.var)) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
ZEND_VM_NEXT_OPCODE();
} else {
zend_free_op free_res;
- zval **retval_ptr = EX_T(opline->result.var).var.ptr_ptr;
+ zval *retval_ptr = EX_VAR(opline->result.var);
- PZVAL_UNLOCK(*retval_ptr, &free_res);
- if (retval_ptr != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(retval_ptr);
- }
- PZVAL_LOCK(*retval_ptr);
+ PZVAL_UNLOCK(retval_ptr, &free_res);
+ SEPARATE_ZVAL_IF_NOT_REF(retval_ptr);
+ PZVAL_LOCK(retval_ptr);
FREE_OP_VAR_PTR(free_res);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -36702,9 +35357,8 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_CV_VAR(ZEN
if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
zend_error(E_NOTICE, "Trying to get property of non-object");
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
- zval_ptr_dtor_nogc(&free_op2.var);
+ ZVAL_NULL(EX_VAR(opline->result.var));
+ zval_ptr_dtor_nogc(free_op2.var);
} else {
zval *retval;
@@ -36715,13 +35369,12 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_CV_VAR(ZEN
/* here we are sure we are dealing with an object */
retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_R, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- PZVAL_LOCK(retval);
- EX_T(opline->result.var).var.ptr = retval;
+ ZVAL_COPY(EX_VAR(opline->result.var), retval);
if (0) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
}
}
@@ -36739,7 +35392,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDL
USE_OPLINE
zend_free_op free_op1, free_op2;
zval *property;
- zval **container;
+ zval *container;
SAVE_OPLINE();
property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
@@ -36747,30 +35400,30 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDL
if (0) {
MAKE_REAL_ZVAL_PTR(property);
}
- container = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
+ container = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(&EX_T(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
- zval_ptr_dtor_nogc(&free_op2.var);
- }
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+ zval_ptr_dtor_nogc(free_op2.var);
}
+//??? if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
/* We are going to assign the result by reference */
if (opline->extended_value & ZEND_FETCH_MAKE_REF) {
- zval **retval_ptr = EX_T(opline->result.var).var.ptr_ptr;
+ zval *retval_ptr = EX_VAR(opline->result.var);
- Z_DELREF_PP(retval_ptr);
+ Z_DELREF_P(retval_ptr);
SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
- Z_ADDREF_PP(retval_ptr);
- EX_T(opline->result.var).var.ptr = *EX_T(opline->result.var).var.ptr_ptr;
- EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
+ Z_ADDREF_P(retval_ptr);
+//??? EX_T(opline->result.var).var.ptr = *EX_T(opline->result.var).var.ptr_ptr;
+//??? EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
}
CHECK_EXCEPTION();
@@ -36782,27 +35435,27 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HAND
USE_OPLINE
zend_free_op free_op1, free_op2;
zval *property;
- zval **container;
+ zval *container;
SAVE_OPLINE();
property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- container = _get_zval_ptr_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
+ container = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
if (0) {
MAKE_REAL_ZVAL_PTR(property);
}
- if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(&EX_T(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_RW TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_RW TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
- zval_ptr_dtor_nogc(&free_op2.var);
- }
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+ zval_ptr_dtor_nogc(free_op2.var);
}
+//??? if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -36822,9 +35475,8 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HAND
if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
- zval_ptr_dtor_nogc(&free_op2.var);
+ ZVAL_NULL(EX_VAR(opline->result.var));
+ zval_ptr_dtor_nogc(free_op2.var);
} else {
zval *retval;
@@ -36835,13 +35487,12 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HAND
/* here we are sure we are dealing with an object */
retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_IS, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- PZVAL_LOCK(retval);
- EX_T(opline->result.var).var.ptr = retval;
+ ZVAL_COPY(EX_VAR(opline->result.var), retval);
if (0) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
}
}
@@ -36852,32 +35503,32 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HAND
static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
+ zval *container;
if (zend_is_by_ref_func_arg_fetch(opline, EX(call) TSRMLS_CC)) {
/* Behave like FETCH_OBJ_W */
zend_free_op free_op1, free_op2;
zval *property;
- zval **container;
SAVE_OPLINE();
property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- container = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
+ container = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
if (0) {
MAKE_REAL_ZVAL_PTR(property);
}
- if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(&EX_T(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
- zval_ptr_dtor_nogc(&free_op2.var);
- }
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+ zval_ptr_dtor_nogc(free_op2.var);
}
+//??? if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -36890,39 +35541,37 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_H
{
USE_OPLINE
zend_free_op free_op1, free_op2, free_res;
- zval **container;
+ zval *container;
zval *property;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var TSRMLS_CC);
+ container = _get_zval_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var TSRMLS_CC);
property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
if (IS_CV == IS_CV) {
- if (container != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(container);
- }
+ SEPARATE_ZVAL_IF_NOT_REF(container);
}
if (0) {
MAKE_REAL_ZVAL_PTR(property);
}
- if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(&EX_T(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_UNSET TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_UNSET TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
- zval_ptr_dtor_nogc(&free_op2.var);
- }
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+ zval_ptr_dtor_nogc(free_op2.var);
}
+//??? if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
- PZVAL_UNLOCK(*EX_T(opline->result.var).var.ptr_ptr, &free_res);
- if (EX_T(opline->result.var).var.ptr_ptr != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(EX_T(opline->result.var).var.ptr_ptr);
- }
- PZVAL_LOCK(*EX_T(opline->result.var).var.ptr_ptr);
+//??? PZVAL_UNLOCK(EX_VAR(opline->result.var), &free_res);
+//??? if (EX_T(opline->result.var).var.ptr_ptr != &EG(uninitialized_zval_ptr)) {
+//??? SEPARATE_ZVAL_IF_NOT_REF(EX_T(opline->result.var).var.ptr_ptr);
+//??? }
+//??? PZVAL_LOCK(EX_VAR(opline->result.var));
FREE_OP_VAR_PTR(free_res);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -36932,24 +35581,24 @@ static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLE
{
USE_OPLINE
zend_free_op free_op2;
- zval **object_ptr;
+ zval *object;
zval *property_name;
SAVE_OPLINE();
- object_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
+ object = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
property_name = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
if (0) {
MAKE_REAL_ZVAL_PTR(property_name);
}
- if (IS_CV == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_assign_to_object(RETURN_VALUE_USED(opline)?&EX_T(opline->result.var).var.ptr:NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&property_name);
+ zval_ptr_dtor(property_name);
} else {
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
}
/* assign_obj has two opcodes! */
@@ -36962,71 +35611,63 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLE
{
USE_OPLINE
- zval **object_ptr;
+ zval *object_ptr;
SAVE_OPLINE();
- object_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
+ object_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(object_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- if (Z_TYPE_PP(object_ptr) == IS_OBJECT) {
+ if (Z_TYPE_P(object_ptr) == IS_OBJECT) {
zend_free_op free_op2;
zval *property_name = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
if (0) {
MAKE_REAL_ZVAL_PTR(property_name);
}
- zend_assign_to_object(RETURN_VALUE_USED(opline)?&EX_T(opline->result.var).var.ptr:NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&property_name);
+ zval_ptr_dtor(property_name);
} else {
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
}
} else {
zend_free_op free_op2, free_op_data1, free_op_data2;
zval *value;
zval *dim = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- zval **variable_ptr_ptr;
+ zval *variable_ptr;
- zend_fetch_dimension_address(&EX_T((opline+1)->op2.var), object_ptr, dim, IS_VAR, BP_VAR_W TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zend_fetch_dimension_address(EX_VAR((opline+1)->op2.var), object_ptr, dim, IS_VAR, BP_VAR_W TSRMLS_CC);
+ zval_ptr_dtor_nogc(free_op2.var);
value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
- variable_ptr_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
- if (UNEXPECTED(variable_ptr_ptr == NULL)) {
- if (zend_assign_to_string_offset(&EX_T((opline+1)->op2.var), value, (opline+1)->op1_type TSRMLS_CC)) {
+ variable_ptr = _get_zval_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
+ if (UNEXPECTED(Z_TYPE_P(variable_ptr) == IS_STR_OFFSET)) {
+ if (zend_assign_to_string_offset(EX_VAR((opline+1)->op2.var), value, (opline+1)->op1_type TSRMLS_CC)) {
if (RETURN_VALUE_USED(opline)) {
- zval *retval;
-
- ALLOC_ZVAL(retval);
- ZVAL_STRINGL(retval, Z_STRVAL_P(EX_T((opline+1)->op2.var).str_offset.str)+EX_T((opline+1)->op2.var).str_offset.offset, 1, 1);
- INIT_PZVAL(retval);
- EX_T(opline->result.var).var.ptr = retval;
+ ZVAL_STRINGL(EX_VAR(opline->result.var), Z_STR_OFFSET_P(EX_VAR((opline+1)->op2.var))->str + Z_STR_OFFSET_P(EX_VAR((opline+1)->op2.var))->offset, 1);
}
} else if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
- } else if (UNEXPECTED(*variable_ptr_ptr == &EG(error_zval))) {
+ } else if (UNEXPECTED(variable_ptr == &EG(error_zval))) {
if (IS_TMP_FREE(free_op_data1)) {
zval_dtor(value);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
} else {
if ((opline+1)->op1_type == IS_TMP_VAR) {
- value = zend_assign_tmp_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_tmp_to_variable(variable_ptr, value TSRMLS_CC);
} else if ((opline+1)->op1_type == IS_CONST) {
- value = zend_assign_const_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_const_to_variable(variable_ptr, value TSRMLS_CC);
} else {
- value = zend_assign_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_to_variable(variable_ptr, value TSRMLS_CC);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(value);
- EX_T(opline->result.var).var.ptr = value;
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
}
}
FREE_OP_VAR_PTR(free_op_data2);
@@ -37044,50 +35685,42 @@ static int ZEND_FASTCALL ZEND_ASSIGN_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR
USE_OPLINE
zend_free_op free_op2;
zval *value;
- zval **variable_ptr_ptr;
+ zval *variable_ptr;
SAVE_OPLINE();
value = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- variable_ptr_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
+ variable_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(variable_ptr_ptr == NULL)) {
- if (zend_assign_to_string_offset(&EX_T(opline->op1.var), value, IS_VAR TSRMLS_CC)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(variable_ptr) == IS_STR_OFFSET)) {
+ if (zend_assign_to_string_offset(EX_VAR(opline->op1.var), value, IS_VAR TSRMLS_CC)) {
if (RETURN_VALUE_USED(opline)) {
- zval *retval;
-
- ALLOC_ZVAL(retval);
- ZVAL_STRINGL(retval, Z_STRVAL_P(EX_T(opline->op1.var).str_offset.str)+EX_T(opline->op1.var).str_offset.offset, 1, 1);
- INIT_PZVAL(retval);
- EX_T(opline->result.var).var.ptr = retval;
+ ZVAL_STRINGL(EX_VAR(opline->result.var), Z_STR_OFFSET_P(EX_VAR(opline->op1.var))->str + Z_STR_OFFSET_P(EX_VAR(opline->op1.var))->offset, 1);
}
} else if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
- } else if (IS_CV == IS_VAR && UNEXPECTED(*variable_ptr_ptr == &EG(error_zval))) {
+ } else if (IS_CV == IS_VAR && UNEXPECTED(variable_ptr == &EG(error_zval))) {
if (0) {
zval_dtor(value);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
} else {
if (IS_VAR == IS_TMP_VAR) {
- value = zend_assign_tmp_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_tmp_to_variable(variable_ptr, value TSRMLS_CC);
} else if (IS_VAR == IS_CONST) {
- value = zend_assign_const_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_const_to_variable(variable_ptr, value TSRMLS_CC);
} else {
- value = zend_assign_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_to_variable(variable_ptr, value TSRMLS_CC);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(value);
- EX_T(opline->result.var).var.ptr = value;
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
}
}
/* zend_assign_to_variable() always takes care of op2, never free it! */
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -37097,50 +35730,49 @@ static int ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLE
{
USE_OPLINE
zend_free_op free_op2;
- zval **variable_ptr_ptr;
- zval **value_ptr_ptr;
+ zval *variable_ptr;
+ zval *value_ptr;
SAVE_OPLINE();
- value_ptr_ptr = _get_zval_ptr_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
+ value_ptr = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
if (IS_VAR == IS_VAR &&
- value_ptr_ptr &&
- !Z_ISREF_PP(value_ptr_ptr) &&
- opline->extended_value == ZEND_RETURNS_FUNCTION &&
- !EX_T(opline->op2.var).var.fcall_returned_reference) {
+ value_ptr &&
+ !Z_ISREF_P(value_ptr) &&
+ opline->extended_value == ZEND_RETURNS_FUNCTION /*???&&
+ !EX_T(opline->op2.var).var.fcall_returned_reference*/) {
if (free_op2.var == NULL) {
- PZVAL_LOCK(*value_ptr_ptr); /* undo the effect of get_zval_ptr_ptr() */
+ PZVAL_LOCK(value_ptr); /* undo the effect of get_zval_ptr_ptr() */
}
zend_error(E_STRICT, "Only variables should be assigned by reference");
if (UNEXPECTED(EG(exception) != NULL)) {
- if (free_op2.var) {zval_ptr_dtor_nogc(&free_op2.var);};
+ if (free_op2.var) {zval_ptr_dtor_nogc(free_op2.var);};
HANDLE_EXCEPTION();
}
return ZEND_ASSIGN_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
} else if (IS_VAR == IS_VAR && opline->extended_value == ZEND_RETURNS_NEW) {
- PZVAL_LOCK(*value_ptr_ptr);
- }
- if (IS_CV == IS_VAR && UNEXPECTED(EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr)) {
- zend_error_noreturn(E_ERROR, "Cannot assign by reference to overloaded object");
+ PZVAL_LOCK(value_ptr);
}
+//??? if (IS_CV == IS_VAR && UNEXPECTED(EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr)) {
+//??? zend_error_noreturn(E_ERROR, "Cannot assign by reference to overloaded object");
+//??? }
- variable_ptr_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
- if ((IS_VAR == IS_VAR && UNEXPECTED(value_ptr_ptr == NULL)) ||
- (IS_CV == IS_VAR && UNEXPECTED(variable_ptr_ptr == NULL))) {
+ variable_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
+ if ((IS_VAR == IS_VAR && UNEXPECTED(Z_TYPE_P(value_ptr) == IS_STR_OFFSET)) ||
+ (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(variable_ptr) == IS_STR_OFFSET))) {
zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets nor overloaded objects");
}
- zend_assign_to_variable_reference(variable_ptr_ptr, value_ptr_ptr TSRMLS_CC);
+ zend_assign_to_variable_reference(variable_ptr, value_ptr TSRMLS_CC);
if (IS_VAR == IS_VAR && opline->extended_value == ZEND_RETURNS_NEW) {
- Z_DELREF_PP(variable_ptr_ptr);
+ Z_DELREF_P(variable_ptr);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(*variable_ptr_ptr);
- EX_T(opline->result.var).var.ptr = *variable_ptr_ptr;
+ ZVAL_COPY(EX_VAR(opline->result.var), variable_ptr);
}
- if (free_op2.var) {zval_ptr_dtor_nogc(&free_op2.var);};
+ if (free_op2.var) {zval_ptr_dtor_nogc(free_op2.var);};
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -37150,8 +35782,6 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_
{
USE_OPLINE
zval *function_name;
- char *function_name_strval;
- int function_name_strlen;
zend_free_op free_op2;
call_slot *call = EX(call_slots) + opline->result.num;
@@ -37167,54 +35797,47 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_
zend_error_noreturn(E_ERROR, "Method name must be a string");
}
- function_name_strval = Z_STRVAL_P(function_name);
- function_name_strlen = Z_STRLEN_P(function_name);
+ ZVAL_COPY_VALUE(&call->object, _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC));
- call->object = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
-
- if (EXPECTED(call->object != NULL) &&
- EXPECTED(Z_TYPE_P(call->object) == IS_OBJECT)) {
- call->called_scope = Z_OBJCE_P(call->object);
+ if (EXPECTED(Z_TYPE(call->object) != IS_UNDEF) &&
+ EXPECTED(Z_TYPE(call->object) == IS_OBJECT)) {
+ call->called_scope = Z_OBJCE(call->object);
if (IS_VAR != IS_CONST ||
(call->fbc = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope)) == NULL) {
- zval *object = call->object;
+ zend_object *object = Z_OBJ(call->object);
- if (UNEXPECTED(Z_OBJ_HT_P(call->object)->get_method == NULL)) {
+ if (UNEXPECTED(Z_OBJ_HT(call->object)->get_method == NULL)) {
zend_error_noreturn(E_ERROR, "Object does not support method calls");
}
/* First, locate the function. */
- call->fbc = Z_OBJ_HT_P(call->object)->get_method(&call->object, function_name_strval, function_name_strlen, ((IS_VAR == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
+ call->fbc = Z_OBJ_HT(call->object)->get_method(&call->object, Z_STR_P(function_name), ((IS_VAR == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
if (UNEXPECTED(call->fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(call->object), function_name_strval);
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(&call->object), Z_STRVAL_P(function_name));
}
if (IS_VAR == IS_CONST &&
EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0) &&
- EXPECTED(call->object == object)) {
+ EXPECTED(Z_OBJ(call->object) == object)) {
CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope, call->fbc);
}
}
} else {
if (UNEXPECTED(EG(exception) != NULL)) {
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
HANDLE_EXCEPTION();
}
- zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval);
+ zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", Z_STRVAL_P(function_name));
}
if ((call->fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) {
- call->object = NULL;
+ ZVAL_UNDEF(&call->object);
} else {
- if (!PZVAL_IS_REF(call->object)) {
- Z_ADDREF_P(call->object); /* For $this pointer */
+ if (!Z_ISREF(call->object)) {
+ Z_ADDREF(call->object); /* For $this pointer */
} else {
- zval *this_ptr;
- ALLOC_ZVAL(this_ptr);
- INIT_PZVAL_COPY(this_ptr, call->object);
- zval_copy_ctor(this_ptr);
- call->object = this_ptr;
+ ZVAL_DUP(&call->object, Z_REFVAL(call->object));
}
}
@@ -37222,7 +35845,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_
call->is_ctor_call = 0;
EX(call) = call;
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -37234,11 +35857,11 @@ static int ZEND_FASTCALL ZEND_CASE_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS
zend_free_op free_op2;
SAVE_OPLINE();
- is_equal_function(&EX_T(opline->result.var).tmp_var,
+ is_equal_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -37251,29 +35874,24 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_VAR_HANDLER(ZEND_OPCODE
SAVE_OPLINE();
if ((IS_CV == IS_VAR || IS_CV == IS_CV) && opline->extended_value) {
- zval **expr_ptr_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
-
- if (IS_CV == IS_VAR && UNEXPECTED(expr_ptr_ptr == NULL)) {
+ expr_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets");
}
- SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr_ptr);
- expr_ptr = *expr_ptr_ptr;
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr);
Z_ADDREF_P(expr_ptr);
} else {
expr_ptr=_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
if (0) { /* temporary variable */
- zval *new_expr;
+ zval new_expr;
- ALLOC_ZVAL(new_expr);
- INIT_PZVAL_COPY(new_expr, expr_ptr);
- expr_ptr = new_expr;
- } else if (IS_CV == IS_CONST || PZVAL_IS_REF(expr_ptr)) {
- zval *new_expr;
+ ZVAL_COPY_VALUE(&new_expr, expr_ptr);
+ expr_ptr = &new_expr;
+ } else if (IS_CV == IS_CONST || Z_ISREF_P(expr_ptr)) {
+ zval new_expr;
- ALLOC_ZVAL(new_expr);
- INIT_PZVAL_COPY(new_expr, expr_ptr);
- expr_ptr = new_expr;
- zendi_zval_copy_ctor(*expr_ptr);
+ ZVAL_DUP(&new_expr, expr_ptr);
+ expr_ptr = &new_expr;
} else if (IS_CV == IS_CV) {
Z_ADDREF_P(expr_ptr);
@@ -37293,29 +35911,26 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_VAR_HANDLER(ZEND_OPCODE
case IS_BOOL:
hval = Z_LVAL_P(offset);
num_index:
- zend_hash_index_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), hval, &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr);
break;
case IS_STRING:
- if (IS_VAR == IS_CONST) {
- hval = Z_HASH_P(offset);
- } else {
+ if (IS_VAR != IS_CONST) {
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index);
- hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset));
}
- zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), Z_STR_P(offset), expr_ptr);
break;
case IS_NULL:
- zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), STR_EMPTY_ALLOC(), expr_ptr);
break;
default:
zend_error(E_WARNING, "Illegal offset type");
- zval_ptr_dtor(&expr_ptr);
+ zval_ptr_dtor(expr_ptr);
/* do nothing */
break;
}
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
} else {
- zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr);
}
if ((IS_CV == IS_VAR || IS_CV == IS_CV) && opline->extended_value) {
@@ -37328,7 +35943,7 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLE
{
USE_OPLINE
- array_init(&EX_T(opline->result.var).tmp_var);
+ array_init(EX_VAR(opline->result.var));
if (IS_CV == IS_UNUSED) {
ZEND_VM_NEXT_OPCODE();
#if 0 || IS_CV != IS_UNUSED
@@ -37350,13 +35965,13 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER
IS_VAR == IS_UNUSED &&
(opline->extended_value & ZEND_QUICK_SET)) {
if (EG(active_symbol_table)) {
- zend_compiled_variable *cv = &CV_DEF_OF(opline->op1.var);
+ zend_string *cv = CV_DEF_OF(opline->op1.var);
- zend_delete_variable(EX(prev_execute_data), EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value TSRMLS_CC);
- EX_CV(opline->op1.var) = NULL;
- } else if (EX_CV(opline->op1.var)) {
- zval_ptr_dtor(EX_CV(opline->op1.var));
- EX_CV(opline->op1.var) = NULL;
+ zend_delete_variable(EX(prev_execute_data), EG(active_symbol_table), cv TSRMLS_CC);
+ ZVAL_UNDEF(EX_VAR_NUM(opline->op1.var));
+ } else if (Z_TYPE_P(EX_VAR_NUM(opline->op1.var)) != IS_UNDEF) {
+ zval_ptr_dtor(EX_VAR_NUM(opline->op1.var));
+ ZVAL_UNDEF(EX_VAR_NUM(opline->op1.var));
}
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -37365,8 +35980,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER
varname = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
if (IS_CV != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
- ZVAL_COPY_VALUE(&tmp, varname);
- zval_copy_ctor(&tmp);
+ ZVAL_DUP(&tmp, varname);
convert_to_string(&tmp);
varname = &tmp;
} else if (IS_CV == IS_VAR || IS_CV == IS_CV) {
@@ -37380,12 +35994,12 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
ce = CACHED_PTR(opline->op2.literal->cache_slot);
} else {
- ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
if (IS_CV != IS_CONST && varname == &tmp) {
zval_dtor(&tmp);
} else if (IS_CV == IS_VAR || IS_CV == IS_CV) {
- zval_ptr_dtor(&varname);
+ zval_ptr_dtor(varname);
}
HANDLE_EXCEPTION();
@@ -37396,20 +36010,18 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER
CACHE_PTR(opline->op2.literal->cache_slot, ce);
}
} else {
- ce = EX_T(opline->op2.var).class_entry;
+ ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ zend_std_unset_static_property(ce, Z_STR_P(varname), ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
} else {
- ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1);
-
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
- zend_delete_variable(execute_data, target_symbol_table, varname->value.str.val, varname->value.str.len+1, hash_value TSRMLS_CC);
+ zend_delete_variable(execute_data, target_symbol_table, Z_STR_P(varname) TSRMLS_CC);
}
if (IS_CV != IS_CONST && varname == &tmp) {
zval_dtor(&tmp);
} else if (IS_CV == IS_VAR || IS_CV == IS_CV) {
- zval_ptr_dtor(&varname);
+ zval_ptr_dtor(varname);
}
CHECK_EXCEPTION();
@@ -37420,21 +36032,21 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER
{
USE_OPLINE
zend_free_op free_op2;
- zval **container;
+ zval *container;
zval *offset;
ulong hval;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_CV && container != &EG(uninitialized_zval_ptr)) {
+ container = _get_zval_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var TSRMLS_CC);
+ if (IS_CV == IS_CV) {
SEPARATE_ZVAL_IF_NOT_REF(container);
}
offset = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
if (IS_CV != IS_VAR || container) {
- switch (Z_TYPE_PP(container)) {
+ switch (Z_TYPE_P(container)) {
case IS_ARRAY: {
- HashTable *ht = Z_ARRVAL_PP(container);
+ HashTable *ht = Z_ARRVAL_P(container);
switch (Z_TYPE_P(offset)) {
case IS_DOUBLE:
@@ -37451,60 +36063,57 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER
if (IS_VAR == IS_CV || IS_VAR == IS_VAR) {
Z_ADDREF_P(offset);
}
- if (IS_VAR == IS_CONST) {
- hval = Z_HASH_P(offset);
- } else {
+ if (IS_VAR != IS_CONST) {
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim);
- hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset));
}
- if (ht == &EG(symbol_table)) {
- zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC);
+ if (ht == &EG(symbol_table).ht) {
+ zend_delete_global_variable(Z_STR_P(offset) TSRMLS_CC);
} else {
- zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval);
+ zend_hash_del(ht, Z_STR_P(offset));
}
if (IS_VAR == IS_CV || IS_VAR == IS_VAR) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
}
break;
num_index_dim:
zend_hash_index_del(ht, hval);
if (IS_VAR == IS_CV || IS_VAR == IS_VAR) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
}
break;
case IS_NULL:
- zend_hash_del(ht, "", sizeof(""));
+ zend_hash_del(ht, STR_EMPTY_ALLOC());
break;
default:
zend_error(E_WARNING, "Illegal offset type in unset");
break;
}
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
break;
}
case IS_OBJECT:
- if (UNEXPECTED(Z_OBJ_HT_P(*container)->unset_dimension == NULL)) {
+ if (UNEXPECTED(Z_OBJ_HT_P(container)->unset_dimension == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use object as array");
}
if (0) {
MAKE_REAL_ZVAL_PTR(offset);
}
- Z_OBJ_HT_P(*container)->unset_dimension(*container, offset TSRMLS_CC);
+ Z_OBJ_HT_P(container)->unset_dimension(container, offset TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
}
break;
case IS_STRING:
zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
ZEND_VM_CONTINUE(); /* bailed out before */
default:
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
break;
}
} else {
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
}
CHECK_EXCEPTION();
@@ -37515,36 +36124,36 @@ static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER
{
USE_OPLINE
zend_free_op free_op2;
- zval **container;
+ zval *container;
zval *offset;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var TSRMLS_CC);
+ container = _get_zval_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var TSRMLS_CC);
offset = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
if (IS_CV != IS_VAR || container) {
- if (IS_CV == IS_CV && container != &EG(uninitialized_zval_ptr)) {
+ if (IS_CV == IS_CV) {
SEPARATE_ZVAL_IF_NOT_REF(container);
}
- if (Z_TYPE_PP(container) == IS_OBJECT) {
+ if (Z_TYPE_P(container) == IS_OBJECT) {
if (0) {
MAKE_REAL_ZVAL_PTR(offset);
}
- if (Z_OBJ_HT_P(*container)->unset_property) {
- Z_OBJ_HT_P(*container)->unset_property(*container, offset, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ if (Z_OBJ_HT_P(container)->unset_property) {
+ Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_VAR == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to unset property of non-object");
}
if (0) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
}
} else {
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
}
} else {
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
}
CHECK_EXCEPTION();
@@ -37554,19 +36163,19 @@ static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER
static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zval **value;
+ zval *value;
zend_bool isset = 1;
SAVE_OPLINE();
if (IS_CV == IS_CV &&
IS_VAR == IS_UNUSED &&
(opline->extended_value & ZEND_QUICK_SET)) {
- if (EX_CV(opline->op1.var)) {
- value = EX_CV(opline->op1.var);
+ if (Z_TYPE_P(EX_VAR_NUM(opline->op1.var)) != IS_UNDEF) {
+ value = EX_VAR_NUM(opline->op1.var);
} else if (EG(active_symbol_table)) {
- zend_compiled_variable *cv = &CV_DEF_OF(opline->op1.var);
+ zend_string *cv = CV_DEF_OF(opline->op1.var);
- if (zend_hash_quick_find(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, (void **) &value) == FAILURE) {
+ if ((value = zend_hash_find(EG(active_symbol_table), cv)) == NULL) {
isset = 0;
}
} else {
@@ -37578,8 +36187,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE
zval tmp, *varname = _get_zval_ptr_cv_BP_VAR_IS(execute_data, opline->op1.var TSRMLS_CC);
if (IS_CV != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
- ZVAL_COPY_VALUE(&tmp, varname);
- zval_copy_ctor(&tmp);
+ ZVAL_DUP(&tmp, varname);
convert_to_string(&tmp);
varname = &tmp;
}
@@ -37591,7 +36199,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
ce = CACHED_PTR(opline->op2.literal->cache_slot);
} else {
- ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -37599,15 +36207,15 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE
CACHE_PTR(opline->op2.literal->cache_slot, ce);
}
} else {
- ce = EX_T(opline->op2.var).class_entry;
+ ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1, ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ value = zend_std_get_static_property(ce, Z_STR_P(varname), 1, ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
if (!value) {
isset = 0;
}
} else {
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
- if (zend_hash_find(target_symbol_table, varname->value.str.val, varname->value.str.len+1, (void **) &value) == FAILURE) {
+ if ((value = zend_hash_find(target_symbol_table, Z_STR_P(varname))) == NULL) {
isset = 0;
}
}
@@ -37619,16 +36227,16 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE
}
if (opline->extended_value & ZEND_ISSET) {
- if (isset && Z_TYPE_PP(value) != IS_NULL) {
- ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, 1);
+ if (isset && Z_TYPE_P(value) != IS_NULL) {
+ ZVAL_BOOL(EX_VAR(opline->result.var), 1);
} else {
- ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, 0);
+ ZVAL_BOOL(EX_VAR(opline->result.var), 0);
}
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (!isset || !i_zend_is_true(*value TSRMLS_CC)) {
- ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, 1);
+ if (!isset || !i_zend_is_true(value TSRMLS_CC)) {
+ ZVAL_BOOL(EX_VAR(opline->result.var), 1);
} else {
- ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, 0);
+ ZVAL_BOOL(EX_VAR(opline->result.var), 0);
}
}
@@ -37641,7 +36249,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_VAR(int
USE_OPLINE
zend_free_op free_op2;
zval *container;
- zval **value = NULL;
+ zval *value;
int result = 0;
ulong hval;
zval *offset;
@@ -37665,23 +36273,20 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_VAR(int
case IS_LONG:
hval = Z_LVAL_P(offset);
num_index_prop:
- if (zend_hash_index_find(ht, hval, (void **) &value) == SUCCESS) {
+ if ((value = zend_hash_index_find(ht, hval)) != NULL) {
isset = 1;
}
break;
case IS_STRING:
- if (IS_VAR == IS_CONST) {
- hval = Z_HASH_P(offset);
- } else {
+ if (IS_VAR != IS_CONST) {
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop);
- hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset));
}
- if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) {
+ if ((value = zend_hash_find(ht, Z_STR_P(offset))) != NULL) {
isset = 1;
}
break;
case IS_NULL:
- if (zend_hash_find(ht, "", sizeof(""), (void **) &value) == SUCCESS) {
+ if ((value = zend_hash_find(ht, STR_EMPTY_ALLOC())) != NULL) {
isset = 1;
}
break;
@@ -37691,19 +36296,19 @@ num_index_prop:
}
if (opline->extended_value & ZEND_ISSET) {
- if (isset && Z_TYPE_PP(value) == IS_NULL) {
+ if (isset && Z_TYPE_P(value) == IS_NULL) {
result = 0;
} else {
result = isset;
}
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (!isset || !i_zend_is_true(*value TSRMLS_CC)) {
+ if (!isset || !i_zend_is_true(value TSRMLS_CC)) {
result = 0;
} else {
result = 1;
}
}
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
} else if (Z_TYPE_P(container) == IS_OBJECT) {
if (0) {
MAKE_REAL_ZVAL_PTR(offset);
@@ -37724,9 +36329,9 @@ num_index_prop:
}
}
if (0) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
}
} else if (Z_TYPE_P(container) == IS_STRING && !prop_dim) { /* string offsets */
zval tmp;
@@ -37735,8 +36340,7 @@ num_index_prop:
if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */
|| (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
&& IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) {
- ZVAL_COPY_VALUE(&tmp, offset);
- zval_copy_ctor(&tmp);
+ ZVAL_DUP(&tmp, offset);
convert_to_long(&tmp);
offset = &tmp;
} else {
@@ -37755,16 +36359,15 @@ num_index_prop:
}
}
}
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
} else {
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
}
- Z_TYPE(EX_T(opline->result.var).tmp_var) = IS_BOOL;
if (opline->extended_value & ZEND_ISSET) {
- Z_LVAL(EX_T(opline->result.var).tmp_var) = result;
+ ZVAL_BOOL(EX_VAR(opline->result.var), result);
} else {
- Z_LVAL(EX_T(opline->result.var).tmp_var) = !result;
+ ZVAL_BOOL(EX_VAR(opline->result.var), !result);
}
CHECK_EXCEPTION();
@@ -37783,6 +36386,9 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CV_VAR_HANDLER(ZEND_O
static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
+//???
+return 0;
+#if 0
USE_OPLINE
/* The generator object is stored in return_value_ptr_ptr */
@@ -37825,7 +36431,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
generator->value = copy;
} else {
- zval **value_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
+ zval **value_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W);
if (IS_CV == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
@@ -37853,7 +36459,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
/* Consts, temporary variables and references need copying */
if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR
- || PZVAL_IS_REF(value)
+ || Z_ISREF_P(value)
) {
zval *copy;
@@ -37887,7 +36493,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
/* Consts, temporary variables and references need copying */
if (IS_VAR == IS_CONST || IS_VAR == IS_TMP_VAR
- || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0)
+ || (Z_ISREF_P(key) && Z_REFCOUNT_P(key) > 0)
) {
zval *copy;
@@ -37911,7 +36517,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
generator->largest_used_integer_key = Z_LVAL_P(generator->key);
}
- zval_ptr_dtor_nogc(&free_op2.var);
+ zval_ptr_dtor_nogc(free_op2.var);
} else {
/* If no key was specified we use auto-increment keys */
generator->largest_used_integer_key++;
@@ -37939,24 +36545,23 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
SAVE_OPLINE();
ZEND_VM_RETURN();
+#endif
}
static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_UNUSED(int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC), ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
zend_free_op free_op_data1;
- zval **object_ptr = _get_zval_ptr_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
- zval *object;
+ zval *object = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
zval *property = NULL;
zval *value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
int have_get_ptr = 0;
- if (IS_CV == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- make_real_object(object_ptr TSRMLS_CC);
- object = *object_ptr;
+ make_real_object(object TSRMLS_CC);
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to assign property of non-object");
@@ -37964,8 +36569,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_UNUSED(int (*b
FREE_OP(free_op_data1);
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
} else {
/* here we are sure we are dealing with an object */
@@ -37976,15 +36580,14 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_UNUSED(int (*b
/* here property is a string */
if (opline->extended_value == ZEND_ASSIGN_OBJ
&& Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval **zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_UNUSED == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_UNUSED == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
have_get_ptr = 1;
- binary_op(*zptr, *zptr, value TSRMLS_CC);
+ binary_op(zptr, zptr, value TSRMLS_CC);
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(*zptr);
- EX_T(opline->result.var).var.ptr = *zptr;
+ ZVAL_COPY(EX_VAR(opline->result.var), zptr);
}
}
}
@@ -38008,12 +36611,11 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_UNUSED(int (*b
if (Z_REFCOUNT_P(z) == 0) {
GC_REMOVE_ZVAL_FROM_BUFFER(z);
zval_dtor(z);
- FREE_ZVAL(z);
}
z = value;
}
Z_ADDREF_P(z);
- SEPARATE_ZVAL_IF_NOT_REF(&z);
+ SEPARATE_ZVAL_IF_NOT_REF(z);
binary_op(z, z, value TSRMLS_CC);
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_UNUSED == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
@@ -38021,21 +36623,19 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_UNUSED(int (*b
Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(z);
- EX_T(opline->result.var).var.ptr = z;
+ ZVAL_COPY(EX_VAR(opline->result.var), z);
}
- zval_ptr_dtor(&z);
+ zval_ptr_dtor(z);
} else {
zend_error(E_WARNING, "Attempt to assign property of non-object");
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
}
}
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
}
@@ -38052,7 +36652,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_CV_UNUSED(int (*binar
{
USE_OPLINE
zend_free_op free_op_data2, free_op_data1;
- zval **var_ptr;
+ zval *var_ptr;
zval *value;
SAVE_OPLINE();
@@ -38061,39 +36661,38 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_CV_UNUSED(int (*binar
return zend_binary_assign_op_obj_helper_SPEC_CV_UNUSED(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
break;
case ZEND_ASSIGN_DIM: {
- zval **container = _get_zval_ptr_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
+ zval *container = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- } else if (UNEXPECTED(Z_TYPE_PP(container) == IS_OBJECT)) {
+ } else if (UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
if (IS_CV == IS_VAR && !0) {
- Z_ADDREF_PP(container); /* undo the effect of get_obj_zval_ptr_ptr() */
+ Z_ADDREF_P(container); /* undo the effect of get_obj_zval_ptr_ptr() */
}
return zend_binary_assign_op_obj_helper_SPEC_CV_UNUSED(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
} else {
zval *dim = NULL;
- zend_fetch_dimension_address(&EX_T((opline+1)->op2.var), container, dim, IS_UNUSED, BP_VAR_RW TSRMLS_CC);
+ zend_fetch_dimension_address(EX_VAR((opline+1)->op2.var), container, dim, IS_UNUSED, BP_VAR_RW TSRMLS_CC);
value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
- var_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
+ var_ptr = _get_zval_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
}
}
break;
default:
value = NULL;
- var_ptr = _get_zval_ptr_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
+ var_ptr = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
/* do nothing */
break;
}
- if (UNEXPECTED(var_ptr == NULL)) {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
}
- if (UNEXPECTED(*var_ptr == &EG(error_zval))) {
+ if (UNEXPECTED(var_ptr == &EG(error_zval))) {
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
@@ -38106,22 +36705,21 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_CV_UNUSED(int (*binar
SEPARATE_ZVAL_IF_NOT_REF(var_ptr);
- if (UNEXPECTED(Z_TYPE_PP(var_ptr) == IS_OBJECT)
- && Z_OBJ_HANDLER_PP(var_ptr, get)
- && Z_OBJ_HANDLER_PP(var_ptr, set)) {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_OBJECT)
+ && Z_OBJ_HANDLER_P(var_ptr, get)
+ && Z_OBJ_HANDLER_P(var_ptr, set)) {
/* proxy object */
- zval *objval = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC);
+ zval *objval = Z_OBJ_HANDLER_P(var_ptr, get)(var_ptr TSRMLS_CC);
Z_ADDREF_P(objval);
binary_op(objval, objval, value TSRMLS_CC);
- Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, objval TSRMLS_CC);
- zval_ptr_dtor(&objval);
+ Z_OBJ_HANDLER_P(var_ptr, set)(var_ptr, objval TSRMLS_CC);
+ zval_ptr_dtor(objval);
} else {
- binary_op(*var_ptr, *var_ptr, value TSRMLS_CC);
+ binary_op(var_ptr, var_ptr, value TSRMLS_CC);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(*var_ptr);
- EX_T(opline->result.var).var.ptr = *var_ptr;
+ ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
if (opline->extended_value == ZEND_ASSIGN_DIM) {
@@ -38197,19 +36795,17 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_UNUSED(int type,
USE_OPLINE
zend_free_op free_op1;
zval *varname;
- zval **retval;
+ zval *retval;
zval tmp_varname;
HashTable *target_symbol_table;
- ulong hash_value;
SAVE_OPLINE();
varname = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
if (IS_CV != IS_CONST && UNEXPECTED(Z_TYPE_P(varname) != IS_STRING)) {
- ZVAL_COPY_VALUE(&tmp_varname, varname);
- zval_copy_ctor(&tmp_varname);
- Z_SET_REFCOUNT(tmp_varname, 1);
- Z_UNSET_ISREF(tmp_varname);
+ ZVAL_DUP(&tmp_varname, varname);
+//??? Z_SET_REFCOUNT(tmp_varname, 1);
+//??? Z_UNSET_ISREF(tmp_varname);
convert_to_string(&tmp_varname);
varname = &tmp_varname;
}
@@ -38221,7 +36817,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_UNUSED(int type,
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
ce = CACHED_PTR(opline->op2.literal->cache_slot);
} else {
- ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
if (IS_CV != IS_CONST && varname == &tmp_varname) {
zval_dtor(&tmp_varname);
@@ -38233,9 +36829,9 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_UNUSED(int type,
CACHE_PTR(opline->op2.literal->cache_slot, ce);
}
} else {
- ce = EX_T(opline->op2.var).class_entry;
+ ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0, ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ retval = zend_std_get_static_property(ce, Z_STR_P(varname), 0, ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
} else {
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
@@ -38245,27 +36841,21 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_UNUSED(int type,
ZEND_VM_NEXT_OPCODE();
}
*/
- if (IS_CV == IS_CONST) {
- hash_value = Z_HASH_P(varname);
- } else {
- hash_value = str_hash(Z_STRVAL_P(varname), Z_STRLEN_P(varname));
- }
-
- if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) {
+ if ((retval = zend_hash_find(target_symbol_table, Z_STR_P(varname))) == NULL) {
switch (type) {
case BP_VAR_R:
case BP_VAR_UNSET:
zend_error(E_NOTICE,"Undefined variable: %s", Z_STRVAL_P(varname));
/* break missing intentionally */
case BP_VAR_IS:
- retval = &EG(uninitialized_zval_ptr);
+ ZVAL_NULL(retval);
break;
case BP_VAR_RW:
zend_error(E_NOTICE,"Undefined variable: %s", Z_STRVAL_P(varname));
/* break missing intentionally */
case BP_VAR_W:
Z_ADDREF_P(&EG(uninitialized_zval));
- zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval);
+ retval = zend_hash_update(target_symbol_table, Z_STR_P(varname), &EG(uninitialized_zval));
break;
EMPTY_SWITCH_DEFAULT_CASE()
}
@@ -38284,7 +36874,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_UNUSED(int type,
break;
case ZEND_FETCH_GLOBAL_LOCK:
if (IS_CV == IS_VAR && !free_op1.var) {
- PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
+ Z_ADDREF_P(EX_VAR(opline->op1.var));
}
break;
}
@@ -38297,27 +36887,26 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_UNUSED(int type,
if (opline->extended_value & ZEND_FETCH_MAKE_REF) {
SEPARATE_ZVAL_TO_MAKE_IS_REF(retval);
}
- PZVAL_LOCK(*retval);
- switch (type) {
- case BP_VAR_R:
- case BP_VAR_IS:
- EX_T(opline->result.var).var.ptr = *retval;
- break;
- case BP_VAR_UNSET: {
- zend_free_op free_res;
-
- PZVAL_UNLOCK(*retval, &free_res);
- if (retval != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(retval);
- }
- PZVAL_LOCK(*retval);
- FREE_OP_VAR_PTR(free_res);
- }
- /* break missing intentionally */
- default:
- EX_T(opline->result.var).var.ptr_ptr = retval;
- break;
- }
+ ZVAL_COPY(EX_VAR(opline->result.var), retval);
+//??? switch (type) {
+//??? case BP_VAR_R:
+//??? case BP_VAR_IS:
+//??? break;
+//??? case BP_VAR_UNSET: {
+//??? zend_free_op free_res;
+//???
+//??? PZVAL_UNLOCK(*retval, &free_res);
+//??? if (retval != &EG(uninitialized_zval_ptr)) {
+//??? SEPARATE_ZVAL_IF_NOT_REF(retval);
+//??? }
+//??? PZVAL_LOCK(*retval);
+//??? FREE_OP_VAR_PTR(free_res);
+//??? }
+//??? /* break missing intentionally */
+//??? default:
+//??? EX_T(opline->result.var).var.ptr_ptr = retval;
+//??? break;
+//??? }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -38358,29 +36947,27 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HA
{
USE_OPLINE
zend_free_op free_op1;
- zval **container;
+ zval *container;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
+ container = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_fetch_dimension_address(&EX_T(opline->result.var), container, NULL, IS_UNUSED, BP_VAR_W TSRMLS_CC);
+ zend_fetch_dimension_address(EX_VAR(opline->result.var), container, NULL, IS_UNUSED, BP_VAR_W TSRMLS_CC);
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
+//??? if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
+//??? }
/* We are going to assign the result by reference */
if (UNEXPECTED(opline->extended_value != 0)) {
- zval **retval_ptr = EX_T(opline->result.var).var.ptr_ptr;
+ zval *retval_ptr = EX_VAR(opline->result.var);
- if (retval_ptr) {
- Z_DELREF_PP(retval_ptr);
- SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
- Z_ADDREF_PP(retval_ptr);
- }
+ Z_DELREF_P(retval_ptr);
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
+ Z_ADDREF_P(retval_ptr);
}
CHECK_EXCEPTION();
@@ -38391,19 +36978,19 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_H
{
USE_OPLINE
zend_free_op free_op1;
- zval **container;
+ zval *container;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
+ container = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_fetch_dimension_address(&EX_T(opline->result.var), container, NULL, IS_UNUSED, BP_VAR_RW TSRMLS_CC);
+ zend_fetch_dimension_address(EX_VAR(opline->result.var), container, NULL, IS_UNUSED, BP_VAR_RW TSRMLS_CC);
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
+//??? if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -38412,29 +36999,28 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_H
static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
+ zval *container;
zend_free_op free_op1;
SAVE_OPLINE();
if (zend_is_by_ref_func_arg_fetch(opline, EX(call) TSRMLS_CC)) {
- zval **container = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
+ container = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_fetch_dimension_address(&EX_T(opline->result.var), container, NULL, IS_UNUSED, BP_VAR_W TSRMLS_CC);
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
+ zend_fetch_dimension_address(EX_VAR(opline->result.var), container, NULL, IS_UNUSED, BP_VAR_W TSRMLS_CC);
+//??? if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
} else {
- zval *container;
-
if (IS_UNUSED == IS_UNUSED) {
zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
}
container = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, NULL, IS_UNUSED, BP_VAR_R TSRMLS_CC);
+ zend_fetch_dimension_address_read(EX_VAR(opline->result.var), container, NULL, IS_UNUSED, BP_VAR_R TSRMLS_CC);
}
@@ -38446,24 +37032,24 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HAN
{
USE_OPLINE
- zval **object_ptr;
+ zval *object_ptr;
SAVE_OPLINE();
- object_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
+ object_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(object_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- if (Z_TYPE_PP(object_ptr) == IS_OBJECT) {
+ if (Z_TYPE_P(object_ptr) == IS_OBJECT) {
zval *property_name = NULL;
if (0) {
MAKE_REAL_ZVAL_PTR(property_name);
}
- zend_assign_to_object(RETURN_VALUE_USED(opline)?&EX_T(opline->result.var).var.ptr:NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_UNUSED == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_UNUSED == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&property_name);
+ zval_ptr_dtor(property_name);
} else {
}
@@ -38471,45 +37057,37 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HAN
zend_free_op free_op_data1, free_op_data2;
zval *value;
zval *dim = NULL;
- zval **variable_ptr_ptr;
+ zval *variable_ptr;
- zend_fetch_dimension_address(&EX_T((opline+1)->op2.var), object_ptr, dim, IS_UNUSED, BP_VAR_W TSRMLS_CC);
+ zend_fetch_dimension_address(EX_VAR((opline+1)->op2.var), object_ptr, dim, IS_UNUSED, BP_VAR_W TSRMLS_CC);
value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
- variable_ptr_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
- if (UNEXPECTED(variable_ptr_ptr == NULL)) {
- if (zend_assign_to_string_offset(&EX_T((opline+1)->op2.var), value, (opline+1)->op1_type TSRMLS_CC)) {
+ variable_ptr = _get_zval_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
+ if (UNEXPECTED(Z_TYPE_P(variable_ptr) == IS_STR_OFFSET)) {
+ if (zend_assign_to_string_offset(EX_VAR((opline+1)->op2.var), value, (opline+1)->op1_type TSRMLS_CC)) {
if (RETURN_VALUE_USED(opline)) {
- zval *retval;
-
- ALLOC_ZVAL(retval);
- ZVAL_STRINGL(retval, Z_STRVAL_P(EX_T((opline+1)->op2.var).str_offset.str)+EX_T((opline+1)->op2.var).str_offset.offset, 1, 1);
- INIT_PZVAL(retval);
- EX_T(opline->result.var).var.ptr = retval;
+ ZVAL_STRINGL(EX_VAR(opline->result.var), Z_STR_OFFSET_P(EX_VAR((opline+1)->op2.var))->str + Z_STR_OFFSET_P(EX_VAR((opline+1)->op2.var))->offset, 1);
}
} else if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
- } else if (UNEXPECTED(*variable_ptr_ptr == &EG(error_zval))) {
+ } else if (UNEXPECTED(variable_ptr == &EG(error_zval))) {
if (IS_TMP_FREE(free_op_data1)) {
zval_dtor(value);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
} else {
if ((opline+1)->op1_type == IS_TMP_VAR) {
- value = zend_assign_tmp_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_tmp_to_variable(variable_ptr, value TSRMLS_CC);
} else if ((opline+1)->op1_type == IS_CONST) {
- value = zend_assign_const_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_const_to_variable(variable_ptr, value TSRMLS_CC);
} else {
- value = zend_assign_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_to_variable(variable_ptr, value TSRMLS_CC);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(value);
- EX_T(opline->result.var).var.ptr = value;
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
}
}
FREE_OP_VAR_PTR(free_op_data2);
@@ -38530,29 +37108,24 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_UNUSED_HANDLER(ZEND_OPC
SAVE_OPLINE();
if ((IS_CV == IS_VAR || IS_CV == IS_CV) && opline->extended_value) {
- zval **expr_ptr_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
-
- if (IS_CV == IS_VAR && UNEXPECTED(expr_ptr_ptr == NULL)) {
+ expr_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets");
}
- SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr_ptr);
- expr_ptr = *expr_ptr_ptr;
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr);
Z_ADDREF_P(expr_ptr);
} else {
expr_ptr=_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
if (0) { /* temporary variable */
- zval *new_expr;
+ zval new_expr;
- ALLOC_ZVAL(new_expr);
- INIT_PZVAL_COPY(new_expr, expr_ptr);
- expr_ptr = new_expr;
- } else if (IS_CV == IS_CONST || PZVAL_IS_REF(expr_ptr)) {
- zval *new_expr;
+ ZVAL_COPY_VALUE(&new_expr, expr_ptr);
+ expr_ptr = &new_expr;
+ } else if (IS_CV == IS_CONST || Z_ISREF_P(expr_ptr)) {
+ zval new_expr;
- ALLOC_ZVAL(new_expr);
- INIT_PZVAL_COPY(new_expr, expr_ptr);
- expr_ptr = new_expr;
- zendi_zval_copy_ctor(*expr_ptr);
+ ZVAL_DUP(&new_expr, expr_ptr);
+ expr_ptr = &new_expr;
} else if (IS_CV == IS_CV) {
Z_ADDREF_P(expr_ptr);
@@ -38572,29 +37145,26 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_UNUSED_HANDLER(ZEND_OPC
case IS_BOOL:
hval = Z_LVAL_P(offset);
num_index:
- zend_hash_index_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), hval, &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr);
break;
case IS_STRING:
- if (IS_UNUSED == IS_CONST) {
- hval = Z_HASH_P(offset);
- } else {
+ if (IS_UNUSED != IS_CONST) {
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index);
- hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset));
}
- zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), Z_STR_P(offset), expr_ptr);
break;
case IS_NULL:
- zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), STR_EMPTY_ALLOC(), expr_ptr);
break;
default:
zend_error(E_WARNING, "Illegal offset type");
- zval_ptr_dtor(&expr_ptr);
+ zval_ptr_dtor(expr_ptr);
/* do nothing */
break;
}
} else {
- zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr);
}
if ((IS_CV == IS_VAR || IS_CV == IS_CV) && opline->extended_value) {
@@ -38607,7 +37177,7 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HAN
{
USE_OPLINE
- array_init(&EX_T(opline->result.var).tmp_var);
+ array_init(EX_VAR(opline->result.var));
if (IS_CV == IS_UNUSED) {
ZEND_VM_NEXT_OPCODE();
#if 0 || IS_CV != IS_UNUSED
@@ -38629,13 +37199,13 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HAND
IS_UNUSED == IS_UNUSED &&
(opline->extended_value & ZEND_QUICK_SET)) {
if (EG(active_symbol_table)) {
- zend_compiled_variable *cv = &CV_DEF_OF(opline->op1.var);
+ zend_string *cv = CV_DEF_OF(opline->op1.var);
- zend_delete_variable(EX(prev_execute_data), EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value TSRMLS_CC);
- EX_CV(opline->op1.var) = NULL;
- } else if (EX_CV(opline->op1.var)) {
- zval_ptr_dtor(EX_CV(opline->op1.var));
- EX_CV(opline->op1.var) = NULL;
+ zend_delete_variable(EX(prev_execute_data), EG(active_symbol_table), cv TSRMLS_CC);
+ ZVAL_UNDEF(EX_VAR_NUM(opline->op1.var));
+ } else if (Z_TYPE_P(EX_VAR_NUM(opline->op1.var)) != IS_UNDEF) {
+ zval_ptr_dtor(EX_VAR_NUM(opline->op1.var));
+ ZVAL_UNDEF(EX_VAR_NUM(opline->op1.var));
}
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -38644,8 +37214,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HAND
varname = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
if (IS_CV != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
- ZVAL_COPY_VALUE(&tmp, varname);
- zval_copy_ctor(&tmp);
+ ZVAL_DUP(&tmp, varname);
convert_to_string(&tmp);
varname = &tmp;
} else if (IS_CV == IS_VAR || IS_CV == IS_CV) {
@@ -38659,12 +37228,12 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HAND
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
ce = CACHED_PTR(opline->op2.literal->cache_slot);
} else {
- ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
if (UNEXPECTED(EG(exception) != NULL)) {
if (IS_CV != IS_CONST && varname == &tmp) {
zval_dtor(&tmp);
} else if (IS_CV == IS_VAR || IS_CV == IS_CV) {
- zval_ptr_dtor(&varname);
+ zval_ptr_dtor(varname);
}
HANDLE_EXCEPTION();
@@ -38675,20 +37244,18 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HAND
CACHE_PTR(opline->op2.literal->cache_slot, ce);
}
} else {
- ce = EX_T(opline->op2.var).class_entry;
+ ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ zend_std_unset_static_property(ce, Z_STR_P(varname), ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
} else {
- ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1);
-
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
- zend_delete_variable(execute_data, target_symbol_table, varname->value.str.val, varname->value.str.len+1, hash_value TSRMLS_CC);
+ zend_delete_variable(execute_data, target_symbol_table, Z_STR_P(varname) TSRMLS_CC);
}
if (IS_CV != IS_CONST && varname == &tmp) {
zval_dtor(&tmp);
} else if (IS_CV == IS_VAR || IS_CV == IS_CV) {
- zval_ptr_dtor(&varname);
+ zval_ptr_dtor(varname);
}
CHECK_EXCEPTION();
@@ -38698,19 +37265,19 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HAND
static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zval **value;
+ zval *value;
zend_bool isset = 1;
SAVE_OPLINE();
if (IS_CV == IS_CV &&
IS_UNUSED == IS_UNUSED &&
(opline->extended_value & ZEND_QUICK_SET)) {
- if (EX_CV(opline->op1.var)) {
- value = EX_CV(opline->op1.var);
+ if (Z_TYPE_P(EX_VAR_NUM(opline->op1.var)) != IS_UNDEF) {
+ value = EX_VAR_NUM(opline->op1.var);
} else if (EG(active_symbol_table)) {
- zend_compiled_variable *cv = &CV_DEF_OF(opline->op1.var);
+ zend_string *cv = CV_DEF_OF(opline->op1.var);
- if (zend_hash_quick_find(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, (void **) &value) == FAILURE) {
+ if ((value = zend_hash_find(EG(active_symbol_table), cv)) == NULL) {
isset = 0;
}
} else {
@@ -38722,8 +37289,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_UNUSED_HANDLER(ZEND_OPC
zval tmp, *varname = _get_zval_ptr_cv_BP_VAR_IS(execute_data, opline->op1.var TSRMLS_CC);
if (IS_CV != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
- ZVAL_COPY_VALUE(&tmp, varname);
- zval_copy_ctor(&tmp);
+ ZVAL_DUP(&tmp, varname);
convert_to_string(&tmp);
varname = &tmp;
}
@@ -38735,7 +37301,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_UNUSED_HANDLER(ZEND_OPC
if (CACHED_PTR(opline->op2.literal->cache_slot)) {
ce = CACHED_PTR(opline->op2.literal->cache_slot);
} else {
- ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
+ ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC);
if (UNEXPECTED(ce == NULL)) {
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -38743,15 +37309,15 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_UNUSED_HANDLER(ZEND_OPC
CACHE_PTR(opline->op2.literal->cache_slot, ce);
}
} else {
- ce = EX_T(opline->op2.var).class_entry;
+ ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1, ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
+ value = zend_std_get_static_property(ce, Z_STR_P(varname), 1, ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC);
if (!value) {
isset = 0;
}
} else {
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
- if (zend_hash_find(target_symbol_table, varname->value.str.val, varname->value.str.len+1, (void **) &value) == FAILURE) {
+ if ((value = zend_hash_find(target_symbol_table, Z_STR_P(varname))) == NULL) {
isset = 0;
}
}
@@ -38763,16 +37329,16 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_UNUSED_HANDLER(ZEND_OPC
}
if (opline->extended_value & ZEND_ISSET) {
- if (isset && Z_TYPE_PP(value) != IS_NULL) {
- ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, 1);
+ if (isset && Z_TYPE_P(value) != IS_NULL) {
+ ZVAL_BOOL(EX_VAR(opline->result.var), 1);
} else {
- ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, 0);
+ ZVAL_BOOL(EX_VAR(opline->result.var), 0);
}
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (!isset || !i_zend_is_true(*value TSRMLS_CC)) {
- ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, 1);
+ if (!isset || !i_zend_is_true(value TSRMLS_CC)) {
+ ZVAL_BOOL(EX_VAR(opline->result.var), 1);
} else {
- ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, 0);
+ ZVAL_BOOL(EX_VAR(opline->result.var), 0);
}
}
@@ -38782,6 +37348,9 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_UNUSED_HANDLER(ZEND_OPC
static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
+//???
+return 0;
+#if 0
USE_OPLINE
/* The generator object is stored in return_value_ptr_ptr */
@@ -38824,7 +37393,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_
generator->value = copy;
} else {
- zval **value_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
+ zval **value_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W);
if (IS_CV == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
@@ -38852,7 +37421,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_
/* Consts, temporary variables and references need copying */
if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR
- || PZVAL_IS_REF(value)
+ || Z_ISREF_P(value)
) {
zval *copy;
@@ -38886,7 +37455,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_
/* Consts, temporary variables and references need copying */
if (IS_UNUSED == IS_CONST || IS_UNUSED == IS_TMP_VAR
- || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0)
+ || (Z_ISREF_P(key) && Z_REFCOUNT_P(key) > 0)
) {
zval *copy;
@@ -38937,6 +37506,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_
SAVE_OPLINE();
ZEND_VM_RETURN();
+#endif
}
static int ZEND_FASTCALL ZEND_ADD_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -38945,7 +37515,7 @@ static int ZEND_FASTCALL ZEND_ADD_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
SAVE_OPLINE();
- fast_add_function(&EX_T(opline->result.var).tmp_var,
+ fast_add_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
@@ -38960,7 +37530,7 @@ static int ZEND_FASTCALL ZEND_SUB_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
SAVE_OPLINE();
- fast_sub_function(&EX_T(opline->result.var).tmp_var,
+ fast_sub_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
@@ -38975,7 +37545,7 @@ static int ZEND_FASTCALL ZEND_MUL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
SAVE_OPLINE();
- fast_mul_function(&EX_T(opline->result.var).tmp_var,
+ fast_mul_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
@@ -38990,7 +37560,7 @@ static int ZEND_FASTCALL ZEND_DIV_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
SAVE_OPLINE();
- fast_div_function(&EX_T(opline->result.var).tmp_var,
+ fast_div_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
@@ -39005,7 +37575,7 @@ static int ZEND_FASTCALL ZEND_MOD_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
SAVE_OPLINE();
- fast_mod_function(&EX_T(opline->result.var).tmp_var,
+ fast_mod_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
@@ -39020,7 +37590,7 @@ static int ZEND_FASTCALL ZEND_SL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
SAVE_OPLINE();
- shift_left_function(&EX_T(opline->result.var).tmp_var,
+ shift_left_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
@@ -39035,7 +37605,7 @@ static int ZEND_FASTCALL ZEND_SR_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
SAVE_OPLINE();
- shift_right_function(&EX_T(opline->result.var).tmp_var,
+ shift_right_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
@@ -39050,7 +37620,7 @@ static int ZEND_FASTCALL ZEND_CONCAT_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG
SAVE_OPLINE();
- concat_function(&EX_T(opline->result.var).tmp_var,
+ concat_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
@@ -39065,7 +37635,7 @@ static int ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDL
SAVE_OPLINE();
- is_identical_function(&EX_T(opline->result.var).tmp_var,
+ is_identical_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
@@ -39078,7 +37648,7 @@ static int ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_H
{
USE_OPLINE
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
is_identical_function(result,
@@ -39095,7 +37665,7 @@ static int ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_A
{
USE_OPLINE
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_equal_function(result,
@@ -39111,7 +37681,7 @@ static int ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDL
{
USE_OPLINE
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_not_equal_function(result,
@@ -39127,7 +37697,7 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER
{
USE_OPLINE
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_is_smaller_function(result,
@@ -39143,7 +37713,7 @@ static int ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_CV_CV_HANDLER(ZEND_OPCOD
{
USE_OPLINE
- zval *result = &EX_T(opline->result.var).tmp_var;
+ zval *result = EX_VAR(opline->result.var);
SAVE_OPLINE();
ZVAL_BOOL(result, fast_is_smaller_or_equal_function(result,
@@ -39161,7 +37731,7 @@ static int ZEND_FASTCALL ZEND_BW_OR_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS
SAVE_OPLINE();
- bitwise_or_function(&EX_T(opline->result.var).tmp_var,
+ bitwise_or_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
@@ -39176,7 +37746,7 @@ static int ZEND_FASTCALL ZEND_BW_AND_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG
SAVE_OPLINE();
- bitwise_and_function(&EX_T(opline->result.var).tmp_var,
+ bitwise_and_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
@@ -39191,7 +37761,7 @@ static int ZEND_FASTCALL ZEND_BW_XOR_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG
SAVE_OPLINE();
- bitwise_xor_function(&EX_T(opline->result.var).tmp_var,
+ bitwise_xor_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
@@ -39206,7 +37776,7 @@ static int ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_A
SAVE_OPLINE();
- boolean_xor_function(&EX_T(opline->result.var).tmp_var,
+ boolean_xor_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
@@ -39219,18 +37789,16 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_CV(int (*binar
{
USE_OPLINE
zend_free_op free_op_data1;
- zval **object_ptr = _get_zval_ptr_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
- zval *object;
+ zval *object = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
zval *property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
zval *value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
int have_get_ptr = 0;
- if (IS_CV == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- make_real_object(object_ptr TSRMLS_CC);
- object = *object_ptr;
+ make_real_object(object TSRMLS_CC);
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to assign property of non-object");
@@ -39238,8 +37806,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_CV(int (*binar
FREE_OP(free_op_data1);
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
} else {
/* here we are sure we are dealing with an object */
@@ -39250,15 +37817,14 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_CV(int (*binar
/* here property is a string */
if (opline->extended_value == ZEND_ASSIGN_OBJ
&& Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval **zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
have_get_ptr = 1;
- binary_op(*zptr, *zptr, value TSRMLS_CC);
+ binary_op(zptr, zptr, value TSRMLS_CC);
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(*zptr);
- EX_T(opline->result.var).var.ptr = *zptr;
+ ZVAL_COPY(EX_VAR(opline->result.var), zptr);
}
}
}
@@ -39282,12 +37848,11 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_CV(int (*binar
if (Z_REFCOUNT_P(z) == 0) {
GC_REMOVE_ZVAL_FROM_BUFFER(z);
zval_dtor(z);
- FREE_ZVAL(z);
}
z = value;
}
Z_ADDREF_P(z);
- SEPARATE_ZVAL_IF_NOT_REF(&z);
+ SEPARATE_ZVAL_IF_NOT_REF(z);
binary_op(z, z, value TSRMLS_CC);
if (opline->extended_value == ZEND_ASSIGN_OBJ) {
Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
@@ -39295,21 +37860,19 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_CV(int (*binar
Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(z);
- EX_T(opline->result.var).var.ptr = z;
+ ZVAL_COPY(EX_VAR(opline->result.var), z);
}
- zval_ptr_dtor(&z);
+ zval_ptr_dtor(z);
} else {
zend_error(E_WARNING, "Attempt to assign property of non-object");
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
}
}
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
}
@@ -39326,7 +37889,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_CV_CV(int (*binary_op
{
USE_OPLINE
zend_free_op free_op_data2, free_op_data1;
- zval **var_ptr;
+ zval *var_ptr;
zval *value;
SAVE_OPLINE();
@@ -39335,39 +37898,38 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_CV_CV(int (*binary_op
return zend_binary_assign_op_obj_helper_SPEC_CV_CV(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
break;
case ZEND_ASSIGN_DIM: {
- zval **container = _get_zval_ptr_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
+ zval *container = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
- } else if (UNEXPECTED(Z_TYPE_PP(container) == IS_OBJECT)) {
+ } else if (UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
if (IS_CV == IS_VAR && !0) {
- Z_ADDREF_PP(container); /* undo the effect of get_obj_zval_ptr_ptr() */
+ Z_ADDREF_P(container); /* undo the effect of get_obj_zval_ptr_ptr() */
}
return zend_binary_assign_op_obj_helper_SPEC_CV_CV(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
} else {
zval *dim = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- zend_fetch_dimension_address(&EX_T((opline+1)->op2.var), container, dim, IS_CV, BP_VAR_RW TSRMLS_CC);
+ zend_fetch_dimension_address(EX_VAR((opline+1)->op2.var), container, dim, IS_CV, BP_VAR_RW TSRMLS_CC);
value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
- var_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
+ var_ptr = _get_zval_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
}
}
break;
default:
value = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- var_ptr = _get_zval_ptr_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
+ var_ptr = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
/* do nothing */
break;
}
- if (UNEXPECTED(var_ptr == NULL)) {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets");
}
- if (UNEXPECTED(*var_ptr == &EG(error_zval))) {
+ if (UNEXPECTED(var_ptr == &EG(error_zval))) {
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
@@ -39380,22 +37942,21 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_CV_CV(int (*binary_op
SEPARATE_ZVAL_IF_NOT_REF(var_ptr);
- if (UNEXPECTED(Z_TYPE_PP(var_ptr) == IS_OBJECT)
- && Z_OBJ_HANDLER_PP(var_ptr, get)
- && Z_OBJ_HANDLER_PP(var_ptr, set)) {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_OBJECT)
+ && Z_OBJ_HANDLER_P(var_ptr, get)
+ && Z_OBJ_HANDLER_P(var_ptr, set)) {
/* proxy object */
- zval *objval = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC);
+ zval *objval = Z_OBJ_HANDLER_P(var_ptr, get)(var_ptr TSRMLS_CC);
Z_ADDREF_P(objval);
binary_op(objval, objval, value TSRMLS_CC);
- Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, objval TSRMLS_CC);
- zval_ptr_dtor(&objval);
+ Z_OBJ_HANDLER_P(var_ptr, set)(var_ptr, objval TSRMLS_CC);
+ zval_ptr_dtor(objval);
} else {
- binary_op(*var_ptr, *var_ptr, value TSRMLS_CC);
+ binary_op(var_ptr, var_ptr, value TSRMLS_CC);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(*var_ptr);
- EX_T(opline->result.var).var.ptr = *var_ptr;
+ ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
if (opline->extended_value == ZEND_ASSIGN_DIM) {
@@ -39470,30 +38031,27 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_CV_CV(incdec_t inc
{
USE_OPLINE
- zval **object_ptr;
zval *object;
zval *property;
- zval **retval;
+ zval *retval;
int have_get_ptr = 0;
SAVE_OPLINE();
- object_ptr = _get_zval_ptr_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
+ object = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- retval = &EX_T(opline->result.var).var.ptr;
+ retval = EX_VAR(opline->result.var);
- if (IS_CV == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
- object = *object_ptr;
+ make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- *retval = &EG(uninitialized_zval);
+ ZVAL_NULL(retval);
}
CHECK_EXCEPTION();
@@ -39507,15 +38065,14 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_CV_CV(incdec_t inc
}
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval **zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
SEPARATE_ZVAL_IF_NOT_REF(zptr);
have_get_ptr = 1;
- incdec_op(*zptr);
+ incdec_op(zptr);
if (RETURN_VALUE_USED(opline)) {
- *retval = *zptr;
- PZVAL_LOCK(*retval);
+ ZVAL_COPY(retval, zptr);
}
}
}
@@ -39530,28 +38087,26 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_CV_CV(incdec_t inc
if (Z_REFCOUNT_P(z) == 0) {
GC_REMOVE_ZVAL_FROM_BUFFER(z);
zval_dtor(z);
- FREE_ZVAL(z);
}
z = value;
}
Z_ADDREF_P(z);
- SEPARATE_ZVAL_IF_NOT_REF(&z);
+ SEPARATE_ZVAL_IF_NOT_REF(z);
incdec_op(z);
- *retval = z;
+ ZVAL_COPY_VALUE(retval, z);
Z_OBJ_HT_P(object)->write_property(object, property, z, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- SELECTIVE_PZVAL_LOCK(*retval, opline);
- zval_ptr_dtor(&z);
+ SELECTIVE_PZVAL_LOCK(retval, opline);
+ zval_ptr_dtor(z);
} else {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- *retval = &EG(uninitialized_zval);
+ ZVAL_NULL(retval);
}
}
}
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
}
@@ -39574,23 +38129,21 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_CV(incdec_t in
{
USE_OPLINE
- zval **object_ptr;
zval *object;
zval *property;
zval *retval;
int have_get_ptr = 0;
SAVE_OPLINE();
- object_ptr = _get_zval_ptr_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
+ object = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- retval = &EX_T(opline->result.var).tmp_var;
+ retval = EX_VAR(opline->result.var);
- if (IS_CV == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets");
}
- make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
- object = *object_ptr;
+ make_real_object(object TSRMLS_CC); /* this should modify object only if it's empty */
if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
@@ -39608,15 +38161,14 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_CV(incdec_t in
}
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
- zval **zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (zptr != NULL) { /* NULL means no success in getting PTR */
have_get_ptr = 1;
SEPARATE_ZVAL_IF_NOT_REF(zptr);
- ZVAL_COPY_VALUE(retval, *zptr);
- zendi_zval_copy_ctor(*retval);
+ ZVAL_DUP(retval, zptr);
- incdec_op(*zptr);
+ incdec_op(zptr);
}
}
@@ -39624,7 +38176,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_CV(incdec_t in
if (!have_get_ptr) {
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- zval *z_copy;
+ zval z_copy;
if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC);
@@ -39632,20 +38184,16 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_CV(incdec_t in
if (Z_REFCOUNT_P(z) == 0) {
GC_REMOVE_ZVAL_FROM_BUFFER(z);
zval_dtor(z);
- FREE_ZVAL(z);
}
z = value;
}
- ZVAL_COPY_VALUE(retval, z);
- zendi_zval_copy_ctor(*retval);
- ALLOC_ZVAL(z_copy);
- INIT_PZVAL_COPY(z_copy, z);
- zendi_zval_copy_ctor(*z_copy);
- incdec_op(z_copy);
+ ZVAL_DUP(retval, z);
+ ZVAL_DUP(&z_copy, z);
+ incdec_op(&z_copy);
Z_ADDREF_P(z);
- Z_OBJ_HT_P(object)->write_property(object, property, z_copy, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ Z_OBJ_HT_P(object)->write_property(object, property, &z_copy, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
zval_ptr_dtor(&z_copy);
- zval_ptr_dtor(&z);
+ zval_ptr_dtor(z);
} else {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
ZVAL_NULL(retval);
@@ -39653,7 +38201,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_CV(incdec_t in
}
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
}
@@ -39680,7 +38228,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLE
SAVE_OPLINE();
container = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_R TSRMLS_CC);
+ zend_fetch_dimension_address_read(EX_VAR(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_R TSRMLS_CC);
if (IS_CV != IS_VAR || !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
@@ -39693,29 +38241,27 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLE
{
USE_OPLINE
zend_free_op free_op1;
- zval **container;
+ zval *container;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
+ container = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_fetch_dimension_address(&EX_T(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_W TSRMLS_CC);
+ zend_fetch_dimension_address(EX_VAR(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_W TSRMLS_CC);
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
+//??? if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
+//??? }
/* We are going to assign the result by reference */
if (UNEXPECTED(opline->extended_value != 0)) {
- zval **retval_ptr = EX_T(opline->result.var).var.ptr_ptr;
+ zval *retval_ptr = EX_VAR(opline->result.var);
- if (retval_ptr) {
- Z_DELREF_PP(retval_ptr);
- SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
- Z_ADDREF_PP(retval_ptr);
- }
+ Z_DELREF_P(retval_ptr);
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
+ Z_ADDREF_P(retval_ptr);
}
CHECK_EXCEPTION();
@@ -39726,19 +38272,19 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDL
{
USE_OPLINE
zend_free_op free_op1;
- zval **container;
+ zval *container;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
+ container = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_fetch_dimension_address(&EX_T(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_RW TSRMLS_CC);
+ zend_fetch_dimension_address(EX_VAR(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_RW TSRMLS_CC);
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
+//??? if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -39752,7 +38298,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDL
SAVE_OPLINE();
container = _get_zval_ptr_cv_BP_VAR_IS(execute_data, opline->op1.var TSRMLS_CC);
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_IS TSRMLS_CC);
+ zend_fetch_dimension_address_read(EX_VAR(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_IS TSRMLS_CC);
CHECK_EXCEPTION();
@@ -39762,29 +38308,28 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDL
static int ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
+ zval *container;
zend_free_op free_op1;
SAVE_OPLINE();
if (zend_is_by_ref_func_arg_fetch(opline, EX(call) TSRMLS_CC)) {
- zval **container = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
+ container = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_fetch_dimension_address(&EX_T(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_W TSRMLS_CC);
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
+ zend_fetch_dimension_address(EX_VAR(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_W TSRMLS_CC);
+//??? if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
} else {
- zval *container;
-
if (IS_CV == IS_UNUSED) {
zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
}
container = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
- zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_R TSRMLS_CC);
+ zend_fetch_dimension_address_read(EX_VAR(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_R TSRMLS_CC);
}
@@ -39796,37 +38341,33 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HA
{
USE_OPLINE
zend_free_op free_op1;
- zval **container;
+ zval *container;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var TSRMLS_CC);
+ container = _get_zval_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var TSRMLS_CC);
if (IS_CV == IS_CV) {
- if (container != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(container);
- }
+ SEPARATE_ZVAL_IF_NOT_REF(container);
}
- if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_fetch_dimension_address(&EX_T(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_UNSET TSRMLS_CC);
+ zend_fetch_dimension_address(EX_VAR(opline->result.var), container, _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV, BP_VAR_UNSET TSRMLS_CC);
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
+//??? if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
- if (UNEXPECTED(EX_T(opline->result.var).var.ptr_ptr == NULL)) {
+ if (UNEXPECTED(Z_TYPE_P(EX_VAR(opline->result.var)) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot unset string offsets");
ZEND_VM_NEXT_OPCODE();
} else {
zend_free_op free_res;
- zval **retval_ptr = EX_T(opline->result.var).var.ptr_ptr;
+ zval *retval_ptr = EX_VAR(opline->result.var);
- PZVAL_UNLOCK(*retval_ptr, &free_res);
- if (retval_ptr != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(retval_ptr);
- }
- PZVAL_LOCK(*retval_ptr);
+ PZVAL_UNLOCK(retval_ptr, &free_res);
+ SEPARATE_ZVAL_IF_NOT_REF(retval_ptr);
+ PZVAL_LOCK(retval_ptr);
FREE_OP_VAR_PTR(free_res);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -39848,8 +38389,7 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_CV_CV(ZEND
if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
zend_error(E_NOTICE, "Trying to get property of non-object");
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
} else {
zval *retval;
@@ -39861,11 +38401,10 @@ static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_CV_CV(ZEND
/* here we are sure we are dealing with an object */
retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_R, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- PZVAL_LOCK(retval);
- EX_T(opline->result.var).var.ptr = retval;
+ ZVAL_COPY(EX_VAR(opline->result.var), retval);
if (0) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
}
@@ -39885,7 +38424,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLE
USE_OPLINE
zend_free_op free_op1;
zval *property;
- zval **container;
+ zval *container;
SAVE_OPLINE();
property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
@@ -39893,30 +38432,30 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLE
if (0) {
MAKE_REAL_ZVAL_PTR(property);
}
- container = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
+ container = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(&EX_T(opline->result.var), container, property, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
}
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
+//??? if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
/* We are going to assign the result by reference */
if (opline->extended_value & ZEND_FETCH_MAKE_REF) {
- zval **retval_ptr = EX_T(opline->result.var).var.ptr_ptr;
+ zval *retval_ptr = EX_VAR(opline->result.var);
- Z_DELREF_PP(retval_ptr);
+ Z_DELREF_P(retval_ptr);
SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
- Z_ADDREF_PP(retval_ptr);
- EX_T(opline->result.var).var.ptr = *EX_T(opline->result.var).var.ptr_ptr;
- EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
+ Z_ADDREF_P(retval_ptr);
+//??? EX_T(opline->result.var).var.ptr = *EX_T(opline->result.var).var.ptr_ptr;
+//??? EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
}
CHECK_EXCEPTION();
@@ -39928,27 +38467,27 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDL
USE_OPLINE
zend_free_op free_op1;
zval *property;
- zval **container;
+ zval *container;
SAVE_OPLINE();
property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- container = _get_zval_ptr_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
+ container = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
if (0) {
MAKE_REAL_ZVAL_PTR(property);
}
- if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(&EX_T(opline->result.var), container, property, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_RW TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_RW TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
}
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
+//??? if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -39968,8 +38507,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDL
if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
} else {
zval *retval;
@@ -39981,11 +38519,10 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDL
/* here we are sure we are dealing with an object */
retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_IS, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
- PZVAL_LOCK(retval);
- EX_T(opline->result.var).var.ptr = retval;
+ ZVAL_COPY(EX_VAR(opline->result.var), retval);
if (0) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
}
@@ -39998,32 +38535,32 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDL
static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
+ zval *container;
if (zend_is_by_ref_func_arg_fetch(opline, EX(call) TSRMLS_CC)) {
/* Behave like FETCH_OBJ_W */
zend_free_op free_op1;
zval *property;
- zval **container;
SAVE_OPLINE();
property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- container = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
+ container = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
if (0) {
MAKE_REAL_ZVAL_PTR(property);
}
- if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(&EX_T(opline->result.var), container, property, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
}
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
+//??? if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -40036,39 +38573,37 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HA
{
USE_OPLINE
zend_free_op free_op1, free_res;
- zval **container;
+ zval *container;
zval *property;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var TSRMLS_CC);
+ container = _get_zval_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var TSRMLS_CC);
property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
if (IS_CV == IS_CV) {
- if (container != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(container);
- }
+ SEPARATE_ZVAL_IF_NOT_REF(container);
}
if (0) {
MAKE_REAL_ZVAL_PTR(property);
}
- if (IS_CV == IS_VAR && UNEXPECTED(container == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
- zend_fetch_property_address(&EX_T(opline->result.var), container, property, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_UNSET TSRMLS_CC);
+ zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_UNSET TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&property);
+ zval_ptr_dtor(property);
} else {
}
- if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
- EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
- }
+//??? if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) {
+//??? EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
+//??? }
- PZVAL_UNLOCK(*EX_T(opline->result.var).var.ptr_ptr, &free_res);
- if (EX_T(opline->result.var).var.ptr_ptr != &EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_IF_NOT_REF(EX_T(opline->result.var).var.ptr_ptr);
- }
- PZVAL_LOCK(*EX_T(opline->result.var).var.ptr_ptr);
+//??? PZVAL_UNLOCK(EX_VAR(opline->result.var), &free_res);
+//??? if (EX_T(opline->result.var).var.ptr_ptr != &EG(uninitialized_zval_ptr)) {
+//??? SEPARATE_ZVAL_IF_NOT_REF(EX_T(opline->result.var).var.ptr_ptr);
+//??? }
+//??? PZVAL_LOCK(EX_VAR(opline->result.var));
FREE_OP_VAR_PTR(free_res);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -40078,22 +38613,22 @@ static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER
{
USE_OPLINE
- zval **object_ptr;
+ zval *object;
zval *property_name;
SAVE_OPLINE();
- object_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
+ object = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
property_name = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
if (0) {
MAKE_REAL_ZVAL_PTR(property_name);
}
- if (IS_CV == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(object) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- zend_assign_to_object(RETURN_VALUE_USED(opline)?&EX_T(opline->result.var).var.ptr:NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_OBJ, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&property_name);
+ zval_ptr_dtor(property_name);
} else {
}
@@ -40108,24 +38643,24 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER
{
USE_OPLINE
- zval **object_ptr;
+ zval *object_ptr;
SAVE_OPLINE();
- object_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
+ object_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(object_ptr == NULL)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(object_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
}
- if (Z_TYPE_PP(object_ptr) == IS_OBJECT) {
+ if (Z_TYPE_P(object_ptr) == IS_OBJECT) {
zval *property_name = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
if (0) {
MAKE_REAL_ZVAL_PTR(property_name);
}
- zend_assign_to_object(RETURN_VALUE_USED(opline)?&EX_T(opline->result.var).var.ptr:NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ zend_assign_to_object(RETURN_VALUE_USED(opline)?EX_VAR(opline->result.var):NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, execute_data, ZEND_ASSIGN_DIM, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&property_name);
+ zval_ptr_dtor(property_name);
} else {
}
@@ -40133,45 +38668,37 @@ static int ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER
zend_free_op free_op_data1, free_op_data2;
zval *value;
zval *dim = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- zval **variable_ptr_ptr;
+ zval *variable_ptr;
- zend_fetch_dimension_address(&EX_T((opline+1)->op2.var), object_ptr, dim, IS_CV, BP_VAR_W TSRMLS_CC);
+ zend_fetch_dimension_address(EX_VAR((opline+1)->op2.var), object_ptr, dim, IS_CV, BP_VAR_W TSRMLS_CC);
value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
- variable_ptr_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
- if (UNEXPECTED(variable_ptr_ptr == NULL)) {
- if (zend_assign_to_string_offset(&EX_T((opline+1)->op2.var), value, (opline+1)->op1_type TSRMLS_CC)) {
+ variable_ptr = _get_zval_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
+ if (UNEXPECTED(Z_TYPE_P(variable_ptr) == IS_STR_OFFSET)) {
+ if (zend_assign_to_string_offset(EX_VAR((opline+1)->op2.var), value, (opline+1)->op1_type TSRMLS_CC)) {
if (RETURN_VALUE_USED(opline)) {
- zval *retval;
-
- ALLOC_ZVAL(retval);
- ZVAL_STRINGL(retval, Z_STRVAL_P(EX_T((opline+1)->op2.var).str_offset.str)+EX_T((opline+1)->op2.var).str_offset.offset, 1, 1);
- INIT_PZVAL(retval);
- EX_T(opline->result.var).var.ptr = retval;
+ ZVAL_STRINGL(EX_VAR(opline->result.var), Z_STR_OFFSET_P(EX_VAR((opline+1)->op2.var))->str + Z_STR_OFFSET_P(EX_VAR((opline+1)->op2.var))->offset, 1);
}
} else if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
- } else if (UNEXPECTED(*variable_ptr_ptr == &EG(error_zval))) {
+ } else if (UNEXPECTED(variable_ptr == &EG(error_zval))) {
if (IS_TMP_FREE(free_op_data1)) {
zval_dtor(value);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
} else {
if ((opline+1)->op1_type == IS_TMP_VAR) {
- value = zend_assign_tmp_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_tmp_to_variable(variable_ptr, value TSRMLS_CC);
} else if ((opline+1)->op1_type == IS_CONST) {
- value = zend_assign_const_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_const_to_variable(variable_ptr, value TSRMLS_CC);
} else {
- value = zend_assign_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_to_variable(variable_ptr, value TSRMLS_CC);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(value);
- EX_T(opline->result.var).var.ptr = value;
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
}
}
FREE_OP_VAR_PTR(free_op_data2);
@@ -40189,45 +38716,37 @@ static int ZEND_FASTCALL ZEND_ASSIGN_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG
USE_OPLINE
zval *value;
- zval **variable_ptr_ptr;
+ zval *variable_ptr;
SAVE_OPLINE();
value = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- variable_ptr_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
+ variable_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(variable_ptr_ptr == NULL)) {
- if (zend_assign_to_string_offset(&EX_T(opline->op1.var), value, IS_CV TSRMLS_CC)) {
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(variable_ptr) == IS_STR_OFFSET)) {
+ if (zend_assign_to_string_offset(EX_VAR(opline->op1.var), value, IS_CV TSRMLS_CC)) {
if (RETURN_VALUE_USED(opline)) {
- zval *retval;
-
- ALLOC_ZVAL(retval);
- ZVAL_STRINGL(retval, Z_STRVAL_P(EX_T(opline->op1.var).str_offset.str)+EX_T(opline->op1.var).str_offset.offset, 1, 1);
- INIT_PZVAL(retval);
- EX_T(opline->result.var).var.ptr = retval;
+ ZVAL_STRINGL(EX_VAR(opline->result.var), Z_STR_OFFSET_P(EX_VAR(opline->op1.var))->str + Z_STR_OFFSET_P(EX_VAR(opline->op1.var))->offset, 1);
}
} else if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
- } else if (IS_CV == IS_VAR && UNEXPECTED(*variable_ptr_ptr == &EG(error_zval))) {
+ } else if (IS_CV == IS_VAR && UNEXPECTED(variable_ptr == &EG(error_zval))) {
if (0) {
zval_dtor(value);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(&EG(uninitialized_zval));
- EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval);
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
} else {
if (IS_CV == IS_TMP_VAR) {
- value = zend_assign_tmp_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_tmp_to_variable(variable_ptr, value TSRMLS_CC);
} else if (IS_CV == IS_CONST) {
- value = zend_assign_const_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_const_to_variable(variable_ptr, value TSRMLS_CC);
} else {
- value = zend_assign_to_variable(variable_ptr_ptr, value TSRMLS_CC);
+ value = zend_assign_to_variable(variable_ptr, value TSRMLS_CC);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(value);
- EX_T(opline->result.var).var.ptr = value;
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
}
}
@@ -40241,19 +38760,19 @@ static int ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER
{
USE_OPLINE
zend_free_op free_op2;
- zval **variable_ptr_ptr;
- zval **value_ptr_ptr;
+ zval *variable_ptr;
+ zval *value_ptr;
SAVE_OPLINE();
- value_ptr_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->op2.var TSRMLS_CC);
+ value_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op2.var TSRMLS_CC);
if (IS_CV == IS_VAR &&
- value_ptr_ptr &&
- !Z_ISREF_PP(value_ptr_ptr) &&
- opline->extended_value == ZEND_RETURNS_FUNCTION &&
- !EX_T(opline->op2.var).var.fcall_returned_reference) {
+ value_ptr &&
+ !Z_ISREF_P(value_ptr) &&
+ opline->extended_value == ZEND_RETURNS_FUNCTION /*???&&
+ !EX_T(opline->op2.var).var.fcall_returned_reference*/) {
if (free_op2.var == NULL) {
- PZVAL_LOCK(*value_ptr_ptr); /* undo the effect of get_zval_ptr_ptr() */
+ PZVAL_LOCK(value_ptr); /* undo the effect of get_zval_ptr_ptr() */
}
zend_error(E_STRICT, "Only variables should be assigned by reference");
if (UNEXPECTED(EG(exception) != NULL)) {
@@ -40262,26 +38781,25 @@ static int ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER
}
return ZEND_ASSIGN_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
} else if (IS_CV == IS_VAR && opline->extended_value == ZEND_RETURNS_NEW) {
- PZVAL_LOCK(*value_ptr_ptr);
- }
- if (IS_CV == IS_VAR && UNEXPECTED(EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr)) {
- zend_error_noreturn(E_ERROR, "Cannot assign by reference to overloaded object");
+ PZVAL_LOCK(value_ptr);
}
+//??? if (IS_CV == IS_VAR && UNEXPECTED(EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr)) {
+//??? zend_error_noreturn(E_ERROR, "Cannot assign by reference to overloaded object");
+//??? }
- variable_ptr_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
- if ((IS_CV == IS_VAR && UNEXPECTED(value_ptr_ptr == NULL)) ||
- (IS_CV == IS_VAR && UNEXPECTED(variable_ptr_ptr == NULL))) {
+ variable_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
+ if ((IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(value_ptr) == IS_STR_OFFSET)) ||
+ (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(variable_ptr) == IS_STR_OFFSET))) {
zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets nor overloaded objects");
}
- zend_assign_to_variable_reference(variable_ptr_ptr, value_ptr_ptr TSRMLS_CC);
+ zend_assign_to_variable_reference(variable_ptr, value_ptr TSRMLS_CC);
if (IS_CV == IS_VAR && opline->extended_value == ZEND_RETURNS_NEW) {
- Z_DELREF_PP(variable_ptr_ptr);
+ Z_DELREF_P(variable_ptr);
}
if (RETURN_VALUE_USED(opline)) {
- PZVAL_LOCK(*variable_ptr_ptr);
- EX_T(opline->result.var).var.ptr = *variable_ptr_ptr;
+ ZVAL_COPY(EX_VAR(opline->result.var), variable_ptr);
}
@@ -40293,8 +38811,6 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_H
{
USE_OPLINE
zval *function_name;
- char *function_name_strval;
- int function_name_strlen;
call_slot *call = EX(call_slots) + opline->result.num;
@@ -40310,32 +38826,29 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_H
zend_error_noreturn(E_ERROR, "Method name must be a string");
}
- function_name_strval = Z_STRVAL_P(function_name);
- function_name_strlen = Z_STRLEN_P(function_name);
-
- call->object = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
+ ZVAL_COPY_VALUE(&call->object, _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC));
- if (EXPECTED(call->object != NULL) &&
- EXPECTED(Z_TYPE_P(call->object) == IS_OBJECT)) {
- call->called_scope = Z_OBJCE_P(call->object);
+ if (EXPECTED(Z_TYPE(call->object) != IS_UNDEF) &&
+ EXPECTED(Z_TYPE(call->object) == IS_OBJECT)) {
+ call->called_scope = Z_OBJCE(call->object);
if (IS_CV != IS_CONST ||
(call->fbc = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope)) == NULL) {
- zval *object = call->object;
+ zend_object *object = Z_OBJ(call->object);
- if (UNEXPECTED(Z_OBJ_HT_P(call->object)->get_method == NULL)) {
+ if (UNEXPECTED(Z_OBJ_HT(call->object)->get_method == NULL)) {
zend_error_noreturn(E_ERROR, "Object does not support method calls");
}
/* First, locate the function. */
- call->fbc = Z_OBJ_HT_P(call->object)->get_method(&call->object, function_name_strval, function_name_strlen, ((IS_CV == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
+ call->fbc = Z_OBJ_HT(call->object)->get_method(&call->object, Z_STR_P(function_name), ((IS_CV == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC);
if (UNEXPECTED(call->fbc == NULL)) {
- zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(call->object), function_name_strval);
+ zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(&call->object), Z_STRVAL_P(function_name));
}
if (IS_CV == IS_CONST &&
EXPECTED(call->fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED((call->fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0) &&
- EXPECTED(call->object == object)) {
+ EXPECTED(Z_OBJ(call->object) == object)) {
CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, call->called_scope, call->fbc);
}
}
@@ -40344,20 +38857,16 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_H
HANDLE_EXCEPTION();
}
- zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval);
+ zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", Z_STRVAL_P(function_name));
}
if ((call->fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) {
- call->object = NULL;
+ ZVAL_UNDEF(&call->object);
} else {
- if (!PZVAL_IS_REF(call->object)) {
- Z_ADDREF_P(call->object); /* For $this pointer */
+ if (!Z_ISREF(call->object)) {
+ Z_ADDREF(call->object); /* For $this pointer */
} else {
- zval *this_ptr;
- ALLOC_ZVAL(this_ptr);
- INIT_PZVAL_COPY(this_ptr, call->object);
- zval_copy_ctor(this_ptr);
- call->object = this_ptr;
+ ZVAL_DUP(&call->object, Z_REFVAL(call->object));
}
}
@@ -40376,7 +38885,7 @@ static int ZEND_FASTCALL ZEND_CASE_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
SAVE_OPLINE();
- is_equal_function(&EX_T(opline->result.var).tmp_var,
+ is_equal_function(EX_VAR(opline->result.var),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC),
_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC) TSRMLS_CC);
@@ -40392,29 +38901,24 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_CV_HANDLER(ZEND_OPCODE_
SAVE_OPLINE();
if ((IS_CV == IS_VAR || IS_CV == IS_CV) && opline->extended_value) {
- zval **expr_ptr_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
-
- if (IS_CV == IS_VAR && UNEXPECTED(expr_ptr_ptr == NULL)) {
+ expr_ptr = _get_zval_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
+ if (IS_CV == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) {
zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets");
}
- SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr_ptr);
- expr_ptr = *expr_ptr_ptr;
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr);
Z_ADDREF_P(expr_ptr);
} else {
expr_ptr=_get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
if (0) { /* temporary variable */
- zval *new_expr;
+ zval new_expr;
- ALLOC_ZVAL(new_expr);
- INIT_PZVAL_COPY(new_expr, expr_ptr);
- expr_ptr = new_expr;
- } else if (IS_CV == IS_CONST || PZVAL_IS_REF(expr_ptr)) {
- zval *new_expr;
+ ZVAL_COPY_VALUE(&new_expr, expr_ptr);
+ expr_ptr = &new_expr;
+ } else if (IS_CV == IS_CONST || Z_ISREF_P(expr_ptr)) {
+ zval new_expr;
- ALLOC_ZVAL(new_expr);
- INIT_PZVAL_COPY(new_expr, expr_ptr);
- expr_ptr = new_expr;
- zendi_zval_copy_ctor(*expr_ptr);
+ ZVAL_DUP(&new_expr, expr_ptr);
+ expr_ptr = &new_expr;
} else if (IS_CV == IS_CV) {
Z_ADDREF_P(expr_ptr);
@@ -40434,29 +38938,26 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_CV_HANDLER(ZEND_OPCODE_
case IS_BOOL:
hval = Z_LVAL_P(offset);
num_index:
- zend_hash_index_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), hval, &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr);
break;
case IS_STRING:
- if (IS_CV == IS_CONST) {
- hval = Z_HASH_P(offset);
- } else {
+ if (IS_CV != IS_CONST) {
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index);
- hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset));
}
- zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), Z_STR_P(offset), expr_ptr);
break;
case IS_NULL:
- zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), STR_EMPTY_ALLOC(), expr_ptr);
break;
default:
zend_error(E_WARNING, "Illegal offset type");
- zval_ptr_dtor(&expr_ptr);
+ zval_ptr_dtor(expr_ptr);
/* do nothing */
break;
}
} else {
- zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL);
+ zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr);
}
if ((IS_CV == IS_VAR || IS_CV == IS_CV) && opline->extended_value) {
@@ -40469,7 +38970,7 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER
{
USE_OPLINE
- array_init(&EX_T(opline->result.var).tmp_var);
+ array_init(EX_VAR(opline->result.var));
if (IS_CV == IS_UNUSED) {
ZEND_VM_NEXT_OPCODE();
#if 0 || IS_CV != IS_UNUSED
@@ -40483,21 +38984,21 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_
{
USE_OPLINE
- zval **container;
+ zval *container;
zval *offset;
ulong hval;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var TSRMLS_CC);
- if (IS_CV == IS_CV && container != &EG(uninitialized_zval_ptr)) {
+ container = _get_zval_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var TSRMLS_CC);
+ if (IS_CV == IS_CV) {
SEPARATE_ZVAL_IF_NOT_REF(container);
}
offset = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
if (IS_CV != IS_VAR || container) {
- switch (Z_TYPE_PP(container)) {
+ switch (Z_TYPE_P(container)) {
case IS_ARRAY: {
- HashTable *ht = Z_ARRVAL_PP(container);
+ HashTable *ht = Z_ARRVAL_P(container);
switch (Z_TYPE_P(offset)) {
case IS_DOUBLE:
@@ -40514,29 +39015,26 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_
if (IS_CV == IS_CV || IS_CV == IS_VAR) {
Z_ADDREF_P(offset);
}
- if (IS_CV == IS_CONST) {
- hval = Z_HASH_P(offset);
- } else {
+ if (IS_CV != IS_CONST) {
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim);
- hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset));
}
- if (ht == &EG(symbol_table)) {
- zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC);
+ if (ht == &EG(symbol_table).ht) {
+ zend_delete_global_variable(Z_STR_P(offset) TSRMLS_CC);
} else {
- zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval);
+ zend_hash_del(ht, Z_STR_P(offset));
}
if (IS_CV == IS_CV || IS_CV == IS_VAR) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
}
break;
num_index_dim:
zend_hash_index_del(ht, hval);
if (IS_CV == IS_CV || IS_CV == IS_VAR) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
}
break;
case IS_NULL:
- zend_hash_del(ht, "", sizeof(""));
+ zend_hash_del(ht, STR_EMPTY_ALLOC());
break;
default:
zend_error(E_WARNING, "Illegal offset type in unset");
@@ -40546,15 +39044,15 @@ num_index_dim:
break;
}
case IS_OBJECT:
- if (UNEXPECTED(Z_OBJ_HT_P(*container)->unset_dimension == NULL)) {
+ if (UNEXPECTED(Z_OBJ_HT_P(container)->unset_dimension == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot use object as array");
}
if (0) {
MAKE_REAL_ZVAL_PTR(offset);
}
- Z_OBJ_HT_P(*container)->unset_dimension(*container, offset TSRMLS_CC);
+ Z_OBJ_HT_P(container)->unset_dimension(container, offset TSRMLS_CC);
if (0) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
}
@@ -40578,28 +39076,28 @@ static int ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_
{
USE_OPLINE
- zval **container;
+ zval *container;
zval *offset;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var TSRMLS_CC);
+ container = _get_zval_ptr_cv_BP_VAR_UNSET(execute_data, opline->op1.var TSRMLS_CC);
offset = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
if (IS_CV != IS_VAR || container) {
- if (IS_CV == IS_CV && container != &EG(uninitialized_zval_ptr)) {
+ if (IS_CV == IS_CV) {
SEPARATE_ZVAL_IF_NOT_REF(container);
}
- if (Z_TYPE_PP(container) == IS_OBJECT) {
+ if (Z_TYPE_P(container) == IS_OBJECT) {
if (0) {
MAKE_REAL_ZVAL_PTR(offset);
}
- if (Z_OBJ_HT_P(*container)->unset_property) {
- Z_OBJ_HT_P(*container)->unset_property(*container, offset, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
+ if (Z_OBJ_HT_P(container)->unset_property) {
+ Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_CV == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to unset property of non-object");
}
if (0) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
}
@@ -40619,7 +39117,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CV(int
USE_OPLINE
zval *container;
- zval **value = NULL;
+ zval *value;
int result = 0;
ulong hval;
zval *offset;
@@ -40643,23 +39141,20 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CV(int
case IS_LONG:
hval = Z_LVAL_P(offset);
num_index_prop:
- if (zend_hash_index_find(ht, hval, (void **) &value) == SUCCESS) {
+ if ((value = zend_hash_index_find(ht, hval)) != NULL) {
isset = 1;
}
break;
case IS_STRING:
- if (IS_CV == IS_CONST) {
- hval = Z_HASH_P(offset);
- } else {
+ if (IS_CV != IS_CONST) {
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop);
- hval = str_hash(Z_STRVAL_P(offset), Z_STRLEN_P(offset));
}
- if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) {
+ if ((value = zend_hash_find(ht, Z_STR_P(offset))) != NULL) {
isset = 1;
}
break;
case IS_NULL:
- if (zend_hash_find(ht, "", sizeof(""), (void **) &value) == SUCCESS) {
+ if ((value = zend_hash_find(ht, STR_EMPTY_ALLOC())) != NULL) {
isset = 1;
}
break;
@@ -40669,13 +39164,13 @@ num_index_prop:
}
if (opline->extended_value & ZEND_ISSET) {
- if (isset && Z_TYPE_PP(value) == IS_NULL) {
+ if (isset && Z_TYPE_P(value) == IS_NULL) {
result = 0;
} else {
result = isset;
}
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
- if (!isset || !i_zend_is_true(*value TSRMLS_CC)) {
+ if (!isset || !i_zend_is_true(value TSRMLS_CC)) {
result = 0;
} else {
result = 1;
@@ -40702,7 +39197,7 @@ num_index_prop:
}
}
if (0) {
- zval_ptr_dtor(&offset);
+ zval_ptr_dtor(offset);
} else {
}
@@ -40713,8 +39208,7 @@ num_index_prop:
if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */
|| (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
&& IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) {
- ZVAL_COPY_VALUE(&tmp, offset);
- zval_copy_ctor(&tmp);
+ ZVAL_DUP(&tmp, offset);
convert_to_long(&tmp);
offset = &tmp;
} else {
@@ -40738,11 +39232,10 @@ num_index_prop:
}
- Z_TYPE(EX_T(opline->result.var).tmp_var) = IS_BOOL;
if (opline->extended_value & ZEND_ISSET) {
- Z_LVAL(EX_T(opline->result.var).tmp_var) = result;
+ ZVAL_BOOL(EX_VAR(opline->result.var), result);
} else {
- Z_LVAL(EX_T(opline->result.var).tmp_var) = !result;
+ ZVAL_BOOL(EX_VAR(opline->result.var), !result);
}
CHECK_EXCEPTION();
@@ -40761,6 +39254,9 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CV_CV_HANDLER(ZEND_OP
static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
+//???
+return 0;
+#if 0
USE_OPLINE
/* The generator object is stored in return_value_ptr_ptr */
@@ -40803,7 +39299,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS
generator->value = copy;
} else {
- zval **value_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);
+ zval **value_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W);
if (IS_CV == IS_VAR && UNEXPECTED(value_ptr == NULL)) {
zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
@@ -40831,7 +39327,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS
/* Consts, temporary variables and references need copying */
if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR
- || PZVAL_IS_REF(value)
+ || Z_ISREF_P(value)
) {
zval *copy;
@@ -40865,7 +39361,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS
/* Consts, temporary variables and references need copying */
if (IS_CV == IS_CONST || IS_CV == IS_TMP_VAR
- || (PZVAL_IS_REF(key) && Z_REFCOUNT_P(key) > 0)
+ || (Z_ISREF_P(key) && Z_REFCOUNT_P(key) > 0)
) {
zval *copy;
@@ -40916,6 +39412,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS
SAVE_OPLINE();
ZEND_VM_RETURN();
+#endif
}
static int ZEND_FASTCALL ZEND_NULL_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
diff --git a/Zend/zend_vm_execute.skl b/Zend/zend_vm_execute.skl
index 13fd88e2d8..250e39c9fb 100644
--- a/Zend/zend_vm_execute.skl
+++ b/Zend/zend_vm_execute.skl
@@ -38,7 +38,7 @@ zend_vm_enter:
ZEND_API void zend_{%EXECUTOR_NAME%}(zend_op_array *op_array TSRMLS_DC)
{
- if (EG(exception)) {
+ if (EG(exception) != NULL) {
return;
}
zend_{%EXECUTOR_NAME%}_ex(i_create_execute_data_from_op_array(op_array, 0 TSRMLS_CC) TSRMLS_CC);
diff --git a/Zend/zend_vm_gen.php b/Zend/zend_vm_gen.php
index a25ff9deb5..92c590c5f7 100644
--- a/Zend/zend_vm_gen.php
+++ b/Zend/zend_vm_gen.php
@@ -135,28 +135,6 @@ $op2_get_zval_ptr = array(
"CV" => "_get_zval_ptr_cv_\\1(execute_data, opline->op2.var TSRMLS_CC)",
);
-$op1_get_zval_ptr_ptr = array(
- "ANY" => "get_zval_ptr_ptr(opline->op1_type, &opline->op1, execute_data, &free_op1, \\1)",
- "TMP" => "NULL",
- "VAR" => "_get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC)",
- "CONST" => "NULL",
- "UNUSED" => "NULL",
- "CV" => "_get_zval_ptr_ptr_cv_\\1(execute_data, opline->op1.var TSRMLS_CC)",
-);
-$op1_get_zval_ptr_ptr_fast = $op1_get_zval_ptr_ptr;
-$op1_get_zval_ptr_ptr_fast["VAR"] = "_get_zval_ptr_ptr_var_fast(opline->op1.var, execute_data, &free_op1 TSRMLS_CC)";
-
-$op2_get_zval_ptr_ptr = array(
- "ANY" => "get_zval_ptr_ptr(opline->op2_type, &opline->op2, execute_data, &free_op2, \\1)",
- "TMP" => "NULL",
- "VAR" => "_get_zval_ptr_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC)",
- "CONST" => "NULL",
- "UNUSED" => "NULL",
- "CV" => "_get_zval_ptr_ptr_cv_\\1(execute_data, opline->op2.var TSRMLS_CC)",
-);
-$op2_get_zval_ptr_ptr_fast = $op2_get_zval_ptr_ptr;
-$op2_get_zval_ptr_ptr_fast["VAR"] = "_get_zval_ptr_ptr_var_fast(opline->op2.var, execute_data, &free_op2 TSRMLS_CC)";
-
$op1_get_obj_zval_ptr = array(
"ANY" => "get_obj_zval_ptr(opline->op1_type, &opline->op1, execute_data, &free_op1, \\1)",
"TMP" => "_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC)",
@@ -175,28 +153,6 @@ $op2_get_obj_zval_ptr = array(
"CV" => "_get_zval_ptr_cv_\\1(execute_data, opline->op2.var TSRMLS_CC)",
);
-$op1_get_obj_zval_ptr_ptr = array(
- "ANY" => "get_obj_zval_ptr_ptr(opline->op1_type, &opline->op1, execute_data, &free_op1, \\1)",
- "TMP" => "NULL",
- "VAR" => "_get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC)",
- "CONST" => "NULL",
- "UNUSED" => "_get_obj_zval_ptr_ptr_unused(TSRMLS_C)",
- "CV" => "_get_zval_ptr_ptr_cv_\\1(execute_data, opline->op1.var TSRMLS_CC)",
-);
-$op1_get_obj_zval_ptr_ptr_fast = $op1_get_obj_zval_ptr_ptr;
-$op1_get_obj_zval_ptr_ptr_fast["VAR"] = "_get_zval_ptr_ptr_var_fast(opline->op1.var, execute_data, &free_op1 TSRMLS_CC)";
-
-$op2_get_obj_zval_ptr_ptr = array(
- "ANY" => "get_obj_zval_ptr_ptr(opline->op2_type, &opline->op2, execute_data, &free_op2, \\1)",
- "TMP" => "NULL",
- "VAR" => "_get_zval_ptr_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC)",
- "CONST" => "NULL",
- "UNUSED" => "_get_obj_zval_ptr_ptr_unused(TSRMLS_C)",
- "CV" => "_get_zval_ptr_ptr_cv_\\1(execute_data, opline->op2.var TSRMLS_CC)",
-);
-$op2_get_obj_zval_ptr_ptr_fast = $op2_get_obj_zval_ptr_ptr;
-$op2_get_obj_zval_ptr_ptr_fast["VAR"] = "_get_zval_ptr_ptr_var_fast(opline->op2.var, execute_data, &free_op2 TSRMLS_CC)";
-
$op1_is_tmp_free = array(
"ANY" => "IS_TMP_FREE(free_op1)",
"TMP" => "1",
@@ -218,7 +174,7 @@ $op2_is_tmp_free = array(
$op1_free_op = array(
"ANY" => "FREE_OP(free_op1)",
"TMP" => "zval_dtor(free_op1.var)",
- "VAR" => "zval_ptr_dtor_nogc(&free_op1.var)",
+ "VAR" => "zval_ptr_dtor_nogc(free_op1.var)",
"CONST" => "",
"UNUSED" => "",
"CV" => "",
@@ -227,7 +183,7 @@ $op1_free_op = array(
$op2_free_op = array(
"ANY" => "FREE_OP(free_op2)",
"TMP" => "zval_dtor(free_op2.var)",
- "VAR" => "zval_ptr_dtor_nogc(&free_op2.var)",
+ "VAR" => "zval_ptr_dtor_nogc(free_op2.var)",
"CONST" => "",
"UNUSED" => "",
"CV" => "",
@@ -236,7 +192,7 @@ $op2_free_op = array(
$op1_free_op_if_var = array(
"ANY" => "FREE_OP_IF_VAR(free_op1)",
"TMP" => "",
- "VAR" => "zval_ptr_dtor_nogc(&free_op1.var)",
+ "VAR" => "zval_ptr_dtor_nogc(free_op1.var)",
"CONST" => "",
"UNUSED" => "",
"CV" => "",
@@ -245,33 +201,33 @@ $op1_free_op_if_var = array(
$op2_free_op_if_var = array(
"ANY" => "FREE_OP_IF_VAR(free_op2)",
"TMP" => "",
- "VAR" => "zval_ptr_dtor_nogc(&free_op2.var)",
+ "VAR" => "zval_ptr_dtor_nogc(free_op2.var)",
"CONST" => "",
"UNUSED" => "",
"CV" => "",
);
$op1_free_op_var_ptr = array(
- "ANY" => "if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}",
+ "ANY" => "if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);}",
"TMP" => "",
- "VAR" => "if (free_op1.var) {zval_ptr_dtor_nogc(&free_op1.var);}",
+ "VAR" => "if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);}",
"CONST" => "",
"UNUSED" => "",
"CV" => "",
);
$op1_free_op_var_ptr_fast = $op1_free_op_var_ptr;
-$op1_free_op_var_ptr_fast["VAR"] = "zval_ptr_dtor_nogc(&free_op1.var)";
+$op1_free_op_var_ptr_fast["VAR"] = "zval_ptr_dtor_nogc(free_op1.var)";
$op2_free_op_var_ptr = array(
- "ANY" => "if (free_op2.var) {zval_ptr_dtor_nogc(&free_op2.var);}",
+ "ANY" => "if (free_op2.var) {zval_ptr_dtor_nogc(free_op2.var);}",
"TMP" => "",
- "VAR" => "if (free_op2.var) {zval_ptr_dtor_nogc(&free_op2.var);}",
+ "VAR" => "if (free_op2.var) {zval_ptr_dtor_nogc(free_op2.var);}",
"CONST" => "",
"UNUSED" => "",
"CV" => "",
);
$op2_free_op_var_ptr_fast = $op2_free_op_var_ptr;
-$op2_free_op_var_ptr_fast["VAR"] = "zval_ptr_dtor_nogc(&free_op2.var)";
+$op2_free_op_var_ptr_fast["VAR"] = "zval_ptr_dtor_nogc(free_op2.var)";
$list = array(); // list of opcode handlers and helpers in original order
$opcodes = array(); // opcode handlers by code
@@ -318,14 +274,10 @@ function helper_name($name, $spec, $op1, $op2) {
// Generates code for opcode handler or helper
function gen_code($f, $spec, $kind, $export, $code, $op1, $op2, $name) {
global $op1_type, $op2_type, $op1_get_zval_ptr, $op2_get_zval_ptr,
- $op1_get_zval_ptr_ptr, $op2_get_zval_ptr_ptr,
$op1_get_obj_zval_ptr, $op2_get_obj_zval_ptr,
- $op1_get_obj_zval_ptr_ptr, $op2_get_obj_zval_ptr_ptr,
$op1_is_tmp_free, $op2_is_tmp_free, $op1_free, $op2_free,
$op1_free_op, $op2_free_op, $op1_free_op_if_var, $op2_free_op_if_var,
- $op1_free_op_var_ptr, $op2_free_op_var_ptr, $prefix,
- $op1_get_zval_ptr_ptr_fast, $op2_get_zval_ptr_ptr_fast,
- $op1_get_obj_zval_ptr_ptr_fast, $op2_get_obj_zval_ptr_ptr_fast,
+ $op1_free_op_var_ptr, $op2_free_op_var_ptr, $prefix,
$op1_free_op_var_ptr_fast, $op2_free_op_var_ptr_fast;
// Specializing
@@ -337,12 +289,8 @@ function gen_code($f, $spec, $kind, $export, $code, $op1, $op2, $name) {
"/OP2_FREE/",
"/GET_OP1_ZVAL_PTR\(([^)]*)\)/",
"/GET_OP2_ZVAL_PTR\(([^)]*)\)/",
- "/GET_OP1_ZVAL_PTR_PTR\(([^)]*)\)/",
- "/GET_OP2_ZVAL_PTR_PTR\(([^)]*)\)/",
"/GET_OP1_OBJ_ZVAL_PTR\(([^)]*)\)/",
"/GET_OP2_OBJ_ZVAL_PTR\(([^)]*)\)/",
- "/GET_OP1_OBJ_ZVAL_PTR_PTR\(([^)]*)\)/",
- "/GET_OP2_OBJ_ZVAL_PTR_PTR\(([^)]*)\)/",
"/IS_OP1_TMP_FREE\(\)/",
"/IS_OP2_TMP_FREE\(\)/",
"/FREE_OP1\(\)/",
@@ -351,10 +299,6 @@ function gen_code($f, $spec, $kind, $export, $code, $op1, $op2, $name) {
"/FREE_OP2_IF_VAR\(\)/",
"/FREE_OP1_VAR_PTR\(\)/",
"/FREE_OP2_VAR_PTR\(\)/",
- "/GET_OP1_ZVAL_PTR_PTR_FAST\(([^)]*)\)/",
- "/GET_OP2_ZVAL_PTR_PTR_FAST\(([^)]*)\)/",
- "/GET_OP1_OBJ_ZVAL_PTR_PTR_FAST\(([^)]*)\)/",
- "/GET_OP2_OBJ_ZVAL_PTR_PTR_FAST\(([^)]*)\)/",
"/FREE_OP1_VAR_PTR_FAST\(\)/",
"/FREE_OP2_VAR_PTR_FAST\(\)/",
"/^#ifdef\s+ZEND_VM_SPEC\s*\n/m",
@@ -375,12 +319,8 @@ function gen_code($f, $spec, $kind, $export, $code, $op1, $op2, $name) {
$op2_free[$op2],
$op1_get_zval_ptr[$op1],
$op2_get_zval_ptr[$op2],
- $op1_get_zval_ptr_ptr[$op1],
- $op2_get_zval_ptr_ptr[$op2],
$op1_get_obj_zval_ptr[$op1],
$op2_get_obj_zval_ptr[$op2],
- $op1_get_obj_zval_ptr_ptr[$op1],
- $op2_get_obj_zval_ptr_ptr[$op2],
$op1_is_tmp_free[$op1],
$op2_is_tmp_free[$op2],
$op1_free_op[$op1],
@@ -389,10 +329,6 @@ function gen_code($f, $spec, $kind, $export, $code, $op1, $op2, $name) {
$op2_free_op_if_var[$op2],
$op1_free_op_var_ptr[$op1],
$op2_free_op_var_ptr[$op2],
- $op1_get_zval_ptr_ptr_fast[$op1],
- $op2_get_zval_ptr_ptr_fast[$op2],
- $op1_get_obj_zval_ptr_ptr_fast[$op1],
- $op2_get_obj_zval_ptr_ptr_fast[$op2],
$op1_free_op_var_ptr_fast[$op1],
$op2_free_op_var_ptr_fast[$op2],
($op1!="ANY"||$op2!="ANY")?"#if 1\n":"#if 0\n",
diff --git a/ext/com_dotnet/com_extension.c b/ext/com_dotnet/com_extension.c
index e3b3abfe28..0ba33a9b1a 100644
--- a/ext/com_dotnet/com_extension.c
+++ b/ext/com_dotnet/com_extension.c
@@ -350,7 +350,7 @@ PHP_MINIT_FUNCTION(com_dotnet)
php_com_persist_minit(INIT_FUNC_ARGS_PASSTHRU);
INIT_CLASS_ENTRY(ce, "com_exception", NULL);
- php_com_exception_class_entry = zend_register_internal_class_ex(&ce, zend_exception_get_default(TSRMLS_C), NULL TSRMLS_CC);
+ php_com_exception_class_entry = zend_register_internal_class_ex(&ce, zend_exception_get_default(TSRMLS_C) TSRMLS_CC);
php_com_exception_class_entry->ce_flags |= ZEND_ACC_FINAL;
/* php_com_exception_class_entry->constructor->common.fn_flags |= ZEND_ACC_PROTECTED; */
@@ -367,7 +367,7 @@ PHP_MINIT_FUNCTION(com_dotnet)
INIT_CLASS_ENTRY(ce, "com", NULL);
ce.create_object = php_com_object_new;
- tmp = zend_register_internal_class_ex(&ce, php_com_variant_class_entry, "variant" TSRMLS_CC);
+ tmp = zend_register_internal_class_ex(&ce, php_com_variant_class_entry TSRMLS_CC);
tmp->get_iterator = php_com_iter_get;
zend_ts_hash_init(&php_com_typelibraries, 0, NULL, php_com_typelibrary_dtor, 1);
@@ -375,7 +375,7 @@ PHP_MINIT_FUNCTION(com_dotnet)
#if HAVE_MSCOREE_H
INIT_CLASS_ENTRY(ce, "dotnet", NULL);
ce.create_object = php_com_object_new;
- tmp = zend_register_internal_class_ex(&ce, php_com_variant_class_entry, "variant" TSRMLS_CC);
+ tmp = zend_register_internal_class_ex(&ce, php_com_variant_class_entry TSRMLS_CC);
tmp->get_iterator = php_com_iter_get;
#endif
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index c069e0ccae..105d0ad6d4 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -600,7 +600,7 @@ static zend_object_handlers date_object_handlers_period;
RETURN_FALSE; \
} \
} \
- obj = (php_date_obj *) zend_object_store_get_object(object TSRMLS_CC); \
+ obj = (php_date_obj *) Z_OBJ_P(object); \
#define DATE_CHECK_INITIALIZED(member, class_name) \
if (!(member)) { \
@@ -608,30 +608,30 @@ static zend_object_handlers date_object_handlers_period;
RETURN_FALSE; \
}
-static void date_object_free_storage_date(void *object TSRMLS_DC);
-static void date_object_free_storage_timezone(void *object TSRMLS_DC);
-static void date_object_free_storage_interval(void *object TSRMLS_DC);
-static void date_object_free_storage_period(void *object TSRMLS_DC);
+static void date_object_free_storage_date(zend_object *object TSRMLS_DC);
+static void date_object_free_storage_timezone(zend_object *object TSRMLS_DC);
+static void date_object_free_storage_interval(zend_object *object TSRMLS_DC);
+static void date_object_free_storage_period(zend_object *object TSRMLS_DC);
-static zend_object_value date_object_new_date(zend_class_entry *class_type TSRMLS_DC);
-static zend_object_value date_object_new_timezone(zend_class_entry *class_type TSRMLS_DC);
-static zend_object_value date_object_new_interval(zend_class_entry *class_type TSRMLS_DC);
-static zend_object_value date_object_new_period(zend_class_entry *class_type TSRMLS_DC);
+static zend_object *date_object_new_date(zend_class_entry *class_type TSRMLS_DC);
+static zend_object *date_object_new_timezone(zend_class_entry *class_type TSRMLS_DC);
+static zend_object *date_object_new_interval(zend_class_entry *class_type TSRMLS_DC);
+static zend_object *date_object_new_period(zend_class_entry *class_type TSRMLS_DC);
-static zend_object_value date_object_clone_date(zval *this_ptr TSRMLS_DC);
-static zend_object_value date_object_clone_timezone(zval *this_ptr TSRMLS_DC);
-static zend_object_value date_object_clone_interval(zval *this_ptr TSRMLS_DC);
-static zend_object_value date_object_clone_period(zval *this_ptr TSRMLS_DC);
+static zend_object *date_object_clone_date(zval *this_ptr TSRMLS_DC);
+static zend_object *date_object_clone_timezone(zval *this_ptr TSRMLS_DC);
+static zend_object *date_object_clone_interval(zval *this_ptr TSRMLS_DC);
+static zend_object *date_object_clone_period(zval *this_ptr TSRMLS_DC);
static int date_object_compare_date(zval *d1, zval *d2 TSRMLS_DC);
-static HashTable *date_object_get_gc(zval *object, zval ***table, int *n TSRMLS_DC);
+static HashTable *date_object_get_gc(zval *object, zval **table, int *n TSRMLS_DC);
static HashTable *date_object_get_properties(zval *object TSRMLS_DC);
-static HashTable *date_object_get_gc_interval(zval *object, zval ***table, int *n TSRMLS_DC);
+static HashTable *date_object_get_gc_interval(zval *object, zval **table, int *n TSRMLS_DC);
static HashTable *date_object_get_properties_interval(zval *object TSRMLS_DC);
-static HashTable *date_object_get_gc_period(zval *object, zval ***table, int *n TSRMLS_DC);
+static HashTable *date_object_get_gc_period(zval *object, zval **table, int *n TSRMLS_DC);
static HashTable *date_object_get_properties_period(zval *object TSRMLS_DC);
static HashTable *date_object_get_properties_timezone(zval *object TSRMLS_DC);
-static HashTable *date_object_get_gc_timezone(zval *object, zval ***table, int *n TSRMLS_DC);
+static HashTable *date_object_get_gc_timezone(zval *object, zval **table, int *n TSRMLS_DC);
zval *date_interval_read_property(zval *object, zval *member, int type, const zend_literal *key TSRMLS_DC);
void date_interval_write_property(zval *object, zval *member, zval *value, const zend_literal *key TSRMLS_DC);
@@ -671,11 +671,11 @@ static PHP_GINIT_FUNCTION(date)
/* }}} */
-static void _php_date_tzinfo_dtor(void *tzinfo)
+static void _php_date_tzinfo_dtor(zval *zv)
{
- timelib_tzinfo **tzi = (timelib_tzinfo **)tzinfo;
+ timelib_tzinfo *tzi = (timelib_tzinfo*)Z_PTR_P(zv);
- timelib_tzinfo_dtor(*tzi);
+ timelib_tzinfo_dtor(tzi);
}
/* {{{ PHP_RINIT_FUNCTION */
@@ -894,20 +894,20 @@ PHP_MINFO_FUNCTION(date)
/* {{{ Timezone Cache functions */
static timelib_tzinfo *php_date_parse_tzfile(char *formal_tzname, const timelib_tzdb *tzdb TSRMLS_DC)
{
- timelib_tzinfo *tzi, **ptzi;
+ timelib_tzinfo *tzi;
if(!DATEG(tzcache)) {
ALLOC_HASHTABLE(DATEG(tzcache));
zend_hash_init(DATEG(tzcache), 4, NULL, _php_date_tzinfo_dtor, 0);
}
- if (zend_hash_find(DATEG(tzcache), formal_tzname, strlen(formal_tzname) + 1, (void **) &ptzi) == SUCCESS) {
- return *ptzi;
+ if ((tzi = zend_hash_str_find_ptr(DATEG(tzcache), formal_tzname, strlen(formal_tzname))) != NULL) {
+ return tzi;
}
tzi = timelib_parse_tzfile(formal_tzname, tzdb);
if (tzi) {
- zend_hash_add(DATEG(tzcache), formal_tzname, strlen(formal_tzname) + 1, (void *) &tzi, sizeof(timelib_tzinfo*), NULL);
+ zend_hash_str_add_ptr(DATEG(tzcache), formal_tzname, strlen(formal_tzname), tzi);
}
return tzi;
}
@@ -1220,7 +1220,8 @@ static void php_date(INTERNAL_FUNCTION_PARAMETERS, int localtime)
string = php_format_date(format, format_len, ts, localtime TSRMLS_CC);
- RETVAL_STRING(string, 0);
+//??? RETVAL_STRING(string, 0);
+ RETVAL_STRING(string);
}
/* }}} */
@@ -1702,7 +1703,8 @@ PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gmt)
if (real_len && real_len != buf_len) {
buf = (char *) erealloc(buf, real_len + 1);
- RETURN_STRINGL(buf, real_len, 0);
+//??? RETURN_STRINGL(buf, real_len, 0);
+ RETURN_STRINGL(buf, real_len);
}
efree(buf);
RETURN_FALSE;
@@ -1839,7 +1841,7 @@ PHP_FUNCTION(getdate)
typedef struct {
zend_object_iterator intern;
zval *date_period_zval;
- zval *current;
+ zval current;
php_period_obj *object;
int current_index;
} date_period_it;
@@ -1849,9 +1851,9 @@ static void date_period_it_invalidate_current(zend_object_iterator *iter TSRMLS_
{
date_period_it *iterator = (date_period_it *)iter;
- if (iterator->current) {
+ if (Z_TYPE(iterator->current) != IS_UNDEF) {
zval_ptr_dtor(&iterator->current);
- iterator->current = NULL;
+ ZVAL_UNDEF(&iterator->current);
}
}
/* }}} */
@@ -1864,7 +1866,7 @@ static void date_period_it_dtor(zend_object_iterator *iter TSRMLS_DC)
date_period_it_invalidate_current(iter TSRMLS_CC);
- zval_ptr_dtor(&iterator->date_period_zval);
+ zval_ptr_dtor(iterator->date_period_zval);
efree(iterator);
}
@@ -1897,7 +1899,7 @@ static int date_period_it_has_more(zend_object_iterator *iter TSRMLS_DC)
/* {{{ date_period_it_current_data */
-static void date_period_it_current_data(zend_object_iterator *iter, zval ***data TSRMLS_DC)
+static zval *date_period_it_current_data(zend_object_iterator *iter TSRMLS_DC)
{
date_period_it *iterator = (date_period_it *)iter;
php_period_obj *object = iterator->object;
@@ -1905,9 +1907,8 @@ static void date_period_it_current_data(zend_object_iterator *iter, zval ***data
php_date_obj *newdateobj;
/* Create new object */
- MAKE_STD_ZVAL(iterator->current);
- php_date_instantiate(object->start_ce, iterator->current TSRMLS_CC);
- newdateobj = (php_date_obj *) zend_object_store_get_object(iterator->current TSRMLS_CC);
+ php_date_instantiate(object->start_ce, &iterator->current TSRMLS_CC);
+ newdateobj = (php_date_obj *) Z_OBJ(iterator->current);
newdateobj->time = timelib_time_ctor();
*newdateobj->time = *it_time;
if (it_time->tz_abbr) {
@@ -1917,7 +1918,7 @@ static void date_period_it_current_data(zend_object_iterator *iter, zval ***data
newdateobj->time->tz_info = it_time->tz_info;
}
- *data = &iterator->current;
+ return &iterator->current;
}
/* }}} */
@@ -1973,7 +1974,7 @@ zend_object_iterator_funcs date_period_it_funcs = {
zend_object_iterator *date_object_period_get_iterator(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC)
{
date_period_it *iterator = emalloc(sizeof(date_period_it));
- php_period_obj *dpobj = (php_period_obj *)zend_object_store_get_object(object TSRMLS_CC);
+ php_period_obj *dpobj = (php_period_obj *)Z_OBJ_P(object);
if (by_ref) {
zend_error(E_ERROR, "An iterator cannot be used with foreach by reference");
@@ -1984,7 +1985,7 @@ zend_object_iterator *date_object_period_get_iterator(zend_class_entry *ce, zval
iterator->intern.funcs = &date_period_it_funcs;
iterator->date_period_zval = object;
iterator->object = dpobj;
- iterator->current = NULL;
+ ZVAL_UNDEF(&iterator->current);
return (zend_object_iterator*)iterator;
}
@@ -2011,8 +2012,9 @@ static void date_register_classes(TSRMLS_D)
INIT_CLASS_ENTRY(ce_date, "DateTime", date_funcs_date);
ce_date.create_object = date_object_new_date;
- date_ce_date = zend_register_internal_class_ex(&ce_date, NULL, NULL TSRMLS_CC);
+ date_ce_date = zend_register_internal_class_ex(&ce_date, NULL TSRMLS_CC);
memcpy(&date_object_handlers_date, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
+ date_object_handlers_date.free_obj = date_object_free_storage_date;
date_object_handlers_date.clone_obj = date_object_clone_date;
date_object_handlers_date.compare_objects = date_object_compare_date;
date_object_handlers_date.get_properties = date_object_get_properties;
@@ -2036,7 +2038,7 @@ static void date_register_classes(TSRMLS_D)
INIT_CLASS_ENTRY(ce_immutable, "DateTimeImmutable", date_funcs_immutable);
ce_immutable.create_object = date_object_new_date;
- date_ce_immutable = zend_register_internal_class_ex(&ce_immutable, NULL, NULL TSRMLS_CC);
+ date_ce_immutable = zend_register_internal_class_ex(&ce_immutable, NULL TSRMLS_CC);
memcpy(&date_object_handlers_immutable, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
date_object_handlers_immutable.clone_obj = date_object_clone_date;
date_object_handlers_immutable.compare_objects = date_object_compare_date;
@@ -2045,8 +2047,9 @@ static void date_register_classes(TSRMLS_D)
INIT_CLASS_ENTRY(ce_timezone, "DateTimeZone", date_funcs_timezone);
ce_timezone.create_object = date_object_new_timezone;
- date_ce_timezone = zend_register_internal_class_ex(&ce_timezone, NULL, NULL TSRMLS_CC);
+ date_ce_timezone = zend_register_internal_class_ex(&ce_timezone, NULL TSRMLS_CC);
memcpy(&date_object_handlers_timezone, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
+ date_object_handlers_timezone.free_obj = date_object_free_storage_timezone;
date_object_handlers_timezone.clone_obj = date_object_clone_timezone;
date_object_handlers_timezone.get_properties = date_object_get_properties_timezone;
date_object_handlers_timezone.get_gc = date_object_get_gc_timezone;
@@ -2071,8 +2074,9 @@ static void date_register_classes(TSRMLS_D)
INIT_CLASS_ENTRY(ce_interval, "DateInterval", date_funcs_interval);
ce_interval.create_object = date_object_new_interval;
- date_ce_interval = zend_register_internal_class_ex(&ce_interval, NULL, NULL TSRMLS_CC);
+ date_ce_interval = zend_register_internal_class_ex(&ce_interval, NULL TSRMLS_CC);
memcpy(&date_object_handlers_interval, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
+ date_object_handlers_interval.free_obj = date_object_free_storage_interval;
date_object_handlers_interval.clone_obj = date_object_clone_interval;
date_object_handlers_interval.read_property = date_interval_read_property;
date_object_handlers_interval.write_property = date_interval_write_property;
@@ -2082,11 +2086,12 @@ static void date_register_classes(TSRMLS_D)
INIT_CLASS_ENTRY(ce_period, "DatePeriod", date_funcs_period);
ce_period.create_object = date_object_new_period;
- date_ce_period = zend_register_internal_class_ex(&ce_period, NULL, NULL TSRMLS_CC);
+ date_ce_period = zend_register_internal_class_ex(&ce_period, NULL TSRMLS_CC);
date_ce_period->get_iterator = date_object_period_get_iterator;
date_ce_period->iterator_funcs.funcs = &date_period_it_funcs;
zend_class_implements(date_ce_period TSRMLS_CC, 1, zend_ce_traversable);
memcpy(&date_object_handlers_period, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
+ date_object_handlers_period.free_obj = date_object_free_storage_period;
date_object_handlers_period.clone_obj = date_object_clone_period;
date_object_handlers_period.get_properties = date_object_get_properties_period;
date_object_handlers_period.get_property_ptr_ptr = NULL;
@@ -2100,40 +2105,33 @@ static void date_register_classes(TSRMLS_D)
REGISTER_PERIOD_CLASS_CONST_STRING("EXCLUDE_START_DATE", PHP_DATE_PERIOD_EXCLUDE_START_DATE);
}
-static inline zend_object_value date_object_new_date_ex(zend_class_entry *class_type, php_date_obj **ptr TSRMLS_DC)
+static inline zend_object *date_object_new_date_ex(zend_class_entry *class_type TSRMLS_DC)
{
php_date_obj *intern;
- zend_object_value retval;
intern = emalloc(sizeof(php_date_obj));
memset(intern, 0, sizeof(php_date_obj));
- if (ptr) {
- *ptr = intern;
- }
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
object_properties_init(&intern->std, class_type);
+ intern->std.handlers = &date_object_handlers_date;
- retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) date_object_free_storage_date, NULL TSRMLS_CC);
- retval.handlers = &date_object_handlers_date;
-
- return retval;
+ return (zend_object*)intern;
}
-static zend_object_value date_object_new_date(zend_class_entry *class_type TSRMLS_DC)
+static zend_object *date_object_new_date(zend_class_entry *class_type TSRMLS_DC)
{
- return date_object_new_date_ex(class_type, NULL TSRMLS_CC);
+ return date_object_new_date_ex(class_type TSRMLS_CC);
}
-static zend_object_value date_object_clone_date(zval *this_ptr TSRMLS_DC)
+static zend_object *date_object_clone_date(zval *this_ptr TSRMLS_DC)
{
- php_date_obj *new_obj = NULL;
- php_date_obj *old_obj = (php_date_obj *) zend_object_store_get_object(this_ptr TSRMLS_CC);
- zend_object_value new_ov = date_object_new_date_ex(old_obj->std.ce, &new_obj TSRMLS_CC);
+ php_date_obj *old_obj = (php_date_obj *)Z_OBJ_P(this_ptr);
+ php_date_obj *new_obj = (php_date_obj*)date_object_new_date_ex(old_obj->std.ce TSRMLS_CC);
- zend_objects_clone_members(&new_obj->std, new_ov, &old_obj->std, Z_OBJ_HANDLE_P(this_ptr) TSRMLS_CC);
+ zend_objects_clone_members(&new_obj->std, &old_obj->std TSRMLS_CC);
if (!old_obj->time) {
- return new_ov;
+ return (zend_object*)new_obj;
}
/* this should probably moved to a new `timelib_time *timelime_time_clone(timelib_time *)` */
@@ -2146,26 +2144,20 @@ static zend_object_value date_object_clone_date(zval *this_ptr TSRMLS_DC)
new_obj->time->tz_info = old_obj->time->tz_info;
}
- return new_ov;
+ return (zend_object*)new_obj;
}
-static zval* date_clone_immutable(zval *object TSRMLS_DC)
+static void date_clone_immutable(zval *object, zval *new_object TSRMLS_DC)
{
- zval *new_object;
-
- ALLOC_ZVAL(new_object);
- Z_OBJVAL_P(new_object) = date_object_clone_date(object TSRMLS_CC);
- Z_SET_REFCOUNT_P(new_object, 1);
- Z_SET_ISREF_P(new_object);
- Z_TYPE_P(new_object) = IS_OBJECT;
-
- return new_object;
+ ZVAL_OBJ(new_object, date_object_clone_date(object TSRMLS_CC));
+//??? Z_SET_REFCOUNT_P(new_object, 1);
+//??? Z_SET_ISREF_P(new_object);
}
static int date_object_compare_date(zval *d1, zval *d2 TSRMLS_DC)
{
- php_date_obj *o1 = zend_object_store_get_object(d1 TSRMLS_CC);
- php_date_obj *o2 = zend_object_store_get_object(d2 TSRMLS_CC);
+ php_date_obj *o1 = (php_date_obj *)Z_OBJ_P(d1);
+ php_date_obj *o2 = (php_date_obj *)Z_OBJ_P(d2);
if (!o1->time || !o2->time) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Trying to compare an incomplete DateTime or DateTimeImmutable object");
@@ -2181,14 +2173,14 @@ static int date_object_compare_date(zval *d1, zval *d2 TSRMLS_DC)
return (o1->time->sse == o2->time->sse) ? 0 : ((o1->time->sse < o2->time->sse) ? -1 : 1);
}
-static HashTable *date_object_get_gc(zval *object, zval ***table, int *n TSRMLS_DC)
+static HashTable *date_object_get_gc(zval *object, zval **table, int *n TSRMLS_DC)
{
*table = NULL;
*n = 0;
return zend_std_get_properties(object TSRMLS_CC);
}
-static HashTable *date_object_get_gc_timezone(zval *object, zval ***table, int *n TSRMLS_DC)
+static HashTable *date_object_get_gc_timezone(zval *object, zval **table, int *n TSRMLS_DC)
{
*table = NULL;
@@ -2199,11 +2191,11 @@ static HashTable *date_object_get_gc_timezone(zval *object, zval ***table, int *
static HashTable *date_object_get_properties(zval *object TSRMLS_DC)
{
HashTable *props;
- zval *zv;
+ zval zv;
php_date_obj *dateobj;
- dateobj = (php_date_obj *) zend_object_store_get_object(object TSRMLS_CC);
+ dateobj = (php_date_obj *)Z_OBJ_P(object);
props = zend_std_get_properties(object TSRMLS_CC);
@@ -2212,20 +2204,18 @@ static HashTable *date_object_get_properties(zval *object TSRMLS_DC)
}
/* first we add the date and time in ISO format */
- MAKE_STD_ZVAL(zv);
- ZVAL_STRING(zv, date_format("Y-m-d H:i:s", 12, dateobj->time, 1), 0);
- zend_hash_update(props, "date", 5, &zv, sizeof(zv), NULL);
+//??? ZVAL_STRING(zv, date_format("Y-m-d H:i:s", 12, dateobj->time, 1), 0);
+ ZVAL_STRING(&zv, date_format("Y-m-d H:i:s", 12, dateobj->time, 1));
+ zend_hash_str_update(props, "date", sizeof("date")-1, &zv);
/* then we add the timezone name (or similar) */
if (dateobj->time->is_localtime) {
- MAKE_STD_ZVAL(zv);
- ZVAL_LONG(zv, dateobj->time->zone_type);
- zend_hash_update(props, "timezone_type", 14, &zv, sizeof(zv), NULL);
+ ZVAL_LONG(&zv, dateobj->time->zone_type);
+ zend_hash_str_update(props, "timezone_type", sizeof("timezone_type")-1, &zv);
- MAKE_STD_ZVAL(zv);
switch (dateobj->time->zone_type) {
case TIMELIB_ZONETYPE_ID:
- ZVAL_STRING(zv, dateobj->time->tz_info->name, 1);
+ ZVAL_STRING(&zv, dateobj->time->tz_info->name);
break;
case TIMELIB_ZONETYPE_OFFSET: {
char *tmpstr = emalloc(sizeof("UTC+05:00"));
@@ -2236,53 +2226,47 @@ static HashTable *date_object_get_properties(zval *object TSRMLS_DC)
abs(utc_offset / 60),
abs((utc_offset % 60)));
- ZVAL_STRING(zv, tmpstr, 0);
+//??? ZVAL_STRING(zv, tmpstr, 0);
+ ZVAL_STRING(&zv, tmpstr);
}
break;
case TIMELIB_ZONETYPE_ABBR:
- ZVAL_STRING(zv, dateobj->time->tz_abbr, 1);
+ ZVAL_STRING(&zv, dateobj->time->tz_abbr);
break;
}
- zend_hash_update(props, "timezone", 9, &zv, sizeof(zv), NULL);
+ zend_hash_str_update(props, "timezone", sizeof("timezone")-1, &zv);
}
return props;
}
-static inline zend_object_value date_object_new_timezone_ex(zend_class_entry *class_type, php_timezone_obj **ptr TSRMLS_DC)
+static inline zend_object *date_object_new_timezone_ex(zend_class_entry *class_type TSRMLS_DC)
{
php_timezone_obj *intern;
- zend_object_value retval;
intern = emalloc(sizeof(php_timezone_obj));
memset(intern, 0, sizeof(php_timezone_obj));
- if (ptr) {
- *ptr = intern;
- }
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
object_properties_init(&intern->std, class_type);
+ intern->std.handlers = &date_object_handlers_timezone;
- retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) date_object_free_storage_timezone, NULL TSRMLS_CC);
- retval.handlers = &date_object_handlers_timezone;
-
- return retval;
+ return (zend_object*)intern;
}
-static zend_object_value date_object_new_timezone(zend_class_entry *class_type TSRMLS_DC)
+static zend_object *date_object_new_timezone(zend_class_entry *class_type TSRMLS_DC)
{
- return date_object_new_timezone_ex(class_type, NULL TSRMLS_CC);
+ return date_object_new_timezone_ex(class_type TSRMLS_CC);
}
-static zend_object_value date_object_clone_timezone(zval *this_ptr TSRMLS_DC)
+static zend_object *date_object_clone_timezone(zval *this_ptr TSRMLS_DC)
{
- php_timezone_obj *new_obj = NULL;
- php_timezone_obj *old_obj = (php_timezone_obj *) zend_object_store_get_object(this_ptr TSRMLS_CC);
- zend_object_value new_ov = date_object_new_timezone_ex(old_obj->std.ce, &new_obj TSRMLS_CC);
+ php_timezone_obj *old_obj = (php_timezone_obj *) Z_OBJ_P(this_ptr);
+ php_timezone_obj *new_obj = (php_timezone_obj *) date_object_new_timezone_ex(old_obj->std.ce TSRMLS_CC);
- zend_objects_clone_members(&new_obj->std, new_ov, &old_obj->std, Z_OBJ_HANDLE_P(this_ptr) TSRMLS_CC);
+ zend_objects_clone_members(&new_obj->std, &old_obj->std TSRMLS_CC);
if (!old_obj->initialized) {
- return new_ov;
+ return (zend_object*)new_obj;
}
new_obj->type = old_obj->type;
@@ -2301,17 +2285,17 @@ static zend_object_value date_object_clone_timezone(zval *this_ptr TSRMLS_DC)
break;
}
- return new_ov;
+ return (zend_object*)new_obj;
}
static HashTable *date_object_get_properties_timezone(zval *object TSRMLS_DC)
{
HashTable *props;
- zval *zv;
+ zval zv;
php_timezone_obj *tzobj;
- tzobj = (php_timezone_obj *) zend_object_store_get_object(object TSRMLS_CC);
+ tzobj = (php_timezone_obj *) Z_OBJ_P(object);
props = zend_std_get_properties(object TSRMLS_CC);
@@ -2319,14 +2303,12 @@ static HashTable *date_object_get_properties_timezone(zval *object TSRMLS_DC)
return props;
}
- MAKE_STD_ZVAL(zv);
- ZVAL_LONG(zv, tzobj->type);
- zend_hash_update(props, "timezone_type", 14, &zv, sizeof(zv), NULL);
+ ZVAL_LONG(&zv, tzobj->type);
+ zend_hash_str_update(props, "timezone_type", sizeof("timezone_type")-1, &zv);
- MAKE_STD_ZVAL(zv);
switch (tzobj->type) {
case TIMELIB_ZONETYPE_ID:
- ZVAL_STRING(zv, tzobj->tzi.tz->name, 1);
+ ZVAL_STRING(&zv, tzobj->tzi.tz->name);
break;
case TIMELIB_ZONETYPE_OFFSET: {
char *tmpstr = emalloc(sizeof("UTC+05:00"));
@@ -2336,56 +2318,50 @@ static HashTable *date_object_get_properties_timezone(zval *object TSRMLS_DC)
abs(tzobj->tzi.utc_offset / 60),
abs((tzobj->tzi.utc_offset % 60)));
- ZVAL_STRING(zv, tmpstr, 0);
+//??? ZVAL_STRING(zv, tmpstr, 0);
+ ZVAL_STRING(&zv, tmpstr);
}
break;
case TIMELIB_ZONETYPE_ABBR:
- ZVAL_STRING(zv, tzobj->tzi.z.abbr, 1);
+ ZVAL_STRING(&zv, tzobj->tzi.z.abbr);
break;
}
- zend_hash_update(props, "timezone", 9, &zv, sizeof(zv), NULL);
+ zend_hash_str_update(props, "timezone", sizeof("timezone")-1, &zv);
return props;
}
-static inline zend_object_value date_object_new_interval_ex(zend_class_entry *class_type, php_interval_obj **ptr TSRMLS_DC)
+static inline zend_object *date_object_new_interval_ex(zend_class_entry *class_type TSRMLS_DC)
{
php_interval_obj *intern;
- zend_object_value retval;
intern = emalloc(sizeof(php_interval_obj));
memset(intern, 0, sizeof(php_interval_obj));
- if (ptr) {
- *ptr = intern;
- }
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
object_properties_init(&intern->std, class_type);
+ intern->std.handlers = &date_object_handlers_interval;
- retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) date_object_free_storage_interval, NULL TSRMLS_CC);
- retval.handlers = &date_object_handlers_interval;
-
- return retval;
+ return (zend_object*)intern;
}
-static zend_object_value date_object_new_interval(zend_class_entry *class_type TSRMLS_DC)
+static zend_object *date_object_new_interval(zend_class_entry *class_type TSRMLS_DC)
{
- return date_object_new_interval_ex(class_type, NULL TSRMLS_CC);
+ return date_object_new_interval_ex(class_type TSRMLS_CC);
}
-static zend_object_value date_object_clone_interval(zval *this_ptr TSRMLS_DC)
+static zend_object *date_object_clone_interval(zval *this_ptr TSRMLS_DC)
{
- php_interval_obj *new_obj = NULL;
- php_interval_obj *old_obj = (php_interval_obj *) zend_object_store_get_object(this_ptr TSRMLS_CC);
- zend_object_value new_ov = date_object_new_interval_ex(old_obj->std.ce, &new_obj TSRMLS_CC);
+ php_interval_obj *old_obj = (php_interval_obj *) Z_OBJ_P(this_ptr);
+ php_interval_obj *new_obj = (php_interval_obj *) date_object_new_interval_ex(old_obj->std.ce TSRMLS_CC);
- zend_objects_clone_members(&new_obj->std, new_ov, &old_obj->std, Z_OBJ_HANDLE_P(this_ptr) TSRMLS_CC);
+ zend_objects_clone_members(&new_obj->std, &old_obj->std TSRMLS_CC);
/** FIX ME ADD CLONE STUFF **/
- return new_ov;
+ return (zend_object*)new_obj;
}
-static HashTable *date_object_get_gc_interval(zval *object, zval ***table, int *n TSRMLS_DC)
+static HashTable *date_object_get_gc_interval(zval *object, zval **table, int *n TSRMLS_DC)
{
*table = NULL;
@@ -2396,10 +2372,10 @@ static HashTable *date_object_get_gc_interval(zval *object, zval ***table, int *
static HashTable *date_object_get_properties_interval(zval *object TSRMLS_DC)
{
HashTable *props;
- zval *zv;
+ zval zv;
php_interval_obj *intervalobj;
- intervalobj = (php_interval_obj *) zend_object_store_get_object(object TSRMLS_CC);
+ intervalobj = (php_interval_obj *) Z_OBJ_P(object);
props = zend_std_get_properties(object TSRMLS_CC);
@@ -2408,9 +2384,8 @@ static HashTable *date_object_get_properties_interval(zval *object TSRMLS_DC)
}
#define PHP_DATE_INTERVAL_ADD_PROPERTY(n,f) \
- MAKE_STD_ZVAL(zv); \
- ZVAL_LONG(zv, (long)intervalobj->diff->f); \
- zend_hash_update(props, n, strlen(n) + 1, &zv, sizeof(zv), NULL);
+ ZVAL_LONG(&zv, (long)intervalobj->diff->f); \
+ zend_hash_str_update(props, n, sizeof(n)-1, &zv);
PHP_DATE_INTERVAL_ADD_PROPERTY("y", y);
PHP_DATE_INTERVAL_ADD_PROPERTY("m", m);
@@ -2425,9 +2400,8 @@ static HashTable *date_object_get_properties_interval(zval *object TSRMLS_DC)
if (intervalobj->diff->days != -99999) {
PHP_DATE_INTERVAL_ADD_PROPERTY("days", days);
} else {
- MAKE_STD_ZVAL(zv);
- ZVAL_FALSE(zv);
- zend_hash_update(props, "days", 5, &zv, sizeof(zv), NULL);
+ ZVAL_FALSE(&zv);
+ zend_hash_str_update(props, "days", sizeof("days")-1, &zv);
}
PHP_DATE_INTERVAL_ADD_PROPERTY("special_type", special.type);
PHP_DATE_INTERVAL_ADD_PROPERTY("special_amount", special.amount);
@@ -2437,44 +2411,38 @@ static HashTable *date_object_get_properties_interval(zval *object TSRMLS_DC)
return props;
}
-static inline zend_object_value date_object_new_period_ex(zend_class_entry *class_type, php_period_obj **ptr TSRMLS_DC)
+static inline zend_object *date_object_new_period_ex(zend_class_entry *class_type TSRMLS_DC)
{
php_period_obj *intern;
- zend_object_value retval;
intern = emalloc(sizeof(php_period_obj));
memset(intern, 0, sizeof(php_period_obj));
- if (ptr) {
- *ptr = intern;
- }
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
object_properties_init(&intern->std, class_type);
+//??? date_object_free_storage_period, NULL TSRMLS_CC);
+ intern->std.handlers = &date_object_handlers_period;
- retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) date_object_free_storage_period, NULL TSRMLS_CC);
- retval.handlers = &date_object_handlers_period;
-
- return retval;
+ return (zend_object*)intern;
}
-static zend_object_value date_object_new_period(zend_class_entry *class_type TSRMLS_DC)
+static zend_object *date_object_new_period(zend_class_entry *class_type TSRMLS_DC)
{
- return date_object_new_period_ex(class_type, NULL TSRMLS_CC);
+ return date_object_new_period_ex(class_type TSRMLS_CC);
}
-static zend_object_value date_object_clone_period(zval *this_ptr TSRMLS_DC)
+static zend_object *date_object_clone_period(zval *this_ptr TSRMLS_DC)
{
- php_period_obj *new_obj = NULL;
- php_period_obj *old_obj = (php_period_obj *) zend_object_store_get_object(this_ptr TSRMLS_CC);
- zend_object_value new_ov = date_object_new_period_ex(old_obj->std.ce, &new_obj TSRMLS_CC);
+ php_period_obj *old_obj = (php_period_obj *) Z_OBJ_P(this_ptr);
+ php_period_obj *new_obj = (php_period_obj *) date_object_new_period_ex(old_obj->std.ce TSRMLS_CC);
- zend_objects_clone_members(&new_obj->std, new_ov, &old_obj->std, Z_OBJ_HANDLE_P(this_ptr) TSRMLS_CC);
+ zend_objects_clone_members(&new_obj->std, &old_obj->std TSRMLS_CC);
/** FIX ME ADD CLONE STUFF **/
- return new_ov;
+ return (zend_object*)new_obj;
}
-static void date_object_free_storage_date(void *object TSRMLS_DC)
+static void date_object_free_storage_date(zend_object *object TSRMLS_DC)
{
php_date_obj *intern = (php_date_obj *)object;
@@ -2486,7 +2454,7 @@ static void date_object_free_storage_date(void *object TSRMLS_DC)
efree(object);
}
-static void date_object_free_storage_timezone(void *object TSRMLS_DC)
+static void date_object_free_storage_timezone(zend_object *object TSRMLS_DC)
{
php_timezone_obj *intern = (php_timezone_obj *)object;
@@ -2497,7 +2465,7 @@ static void date_object_free_storage_timezone(void *object TSRMLS_DC)
efree(object);
}
-static void date_object_free_storage_interval(void *object TSRMLS_DC)
+static void date_object_free_storage_interval(zend_object *object TSRMLS_DC)
{
php_interval_obj *intern = (php_interval_obj *)object;
@@ -2506,7 +2474,7 @@ static void date_object_free_storage_interval(void *object TSRMLS_DC)
efree(object);
}
-static void date_object_free_storage_period(void *object TSRMLS_DC)
+static void date_object_free_storage_period(zend_object *object TSRMLS_DC)
{
php_period_obj *intern = (php_period_obj *)object;
@@ -2532,9 +2500,6 @@ PHPAPI zval *php_date_instantiate(zend_class_entry *pce, zval *object TSRMLS_DC)
{
Z_TYPE_P(object) = IS_OBJECT;
object_init_ex(object, pce);
- Z_SET_REFCOUNT_P(object, 1);
- Z_UNSET_ISREF_P(object);
-
return object;
}
@@ -2583,7 +2548,7 @@ PHPAPI int php_date_initialize(php_date_obj *dateobj, /*const*/ char *time_str,
if (timezone_object) {
php_timezone_obj *tzobj;
- tzobj = (php_timezone_obj *) zend_object_store_get_object(timezone_object TSRMLS_CC);
+ tzobj = (php_timezone_obj *) Z_OBJ_P(timezone_object);
switch (tzobj->type) {
case TIMELIB_ZONETYPE_ID:
tzi = tzobj->tzi.tz;
@@ -2646,7 +2611,7 @@ PHP_FUNCTION(date_create)
}
php_date_instantiate(date_ce_date, return_value TSRMLS_CC);
- if (!php_date_initialize(zend_object_store_get_object(return_value TSRMLS_CC), time_str, time_str_len, NULL, timezone_object, 0 TSRMLS_CC)) {
+ if (!php_date_initialize((php_date_obj*)Z_OBJ_P(return_value), time_str, time_str_len, NULL, timezone_object, 0 TSRMLS_CC)) {
RETURN_FALSE;
}
}
@@ -2666,7 +2631,7 @@ PHP_FUNCTION(date_create_immutable)
}
php_date_instantiate(date_ce_immutable, return_value TSRMLS_CC);
- if (!php_date_initialize(zend_object_store_get_object(return_value TSRMLS_CC), time_str, time_str_len, NULL, timezone_object, 0 TSRMLS_CC)) {
+ if (!php_date_initialize((php_date_obj*)Z_OBJ_P(return_value), time_str, time_str_len, NULL, timezone_object, 0 TSRMLS_CC)) {
RETURN_FALSE;
}
}
@@ -2686,7 +2651,7 @@ PHP_FUNCTION(date_create_from_format)
}
php_date_instantiate(date_ce_date, return_value TSRMLS_CC);
- if (!php_date_initialize(zend_object_store_get_object(return_value TSRMLS_CC), time_str, time_str_len, format_str, timezone_object, 0 TSRMLS_CC)) {
+ if (!php_date_initialize((php_date_obj*)Z_OBJ_P(return_value), time_str, time_str_len, format_str, timezone_object, 0 TSRMLS_CC)) {
RETURN_FALSE;
}
}
@@ -2706,7 +2671,7 @@ PHP_FUNCTION(date_create_immutable_from_format)
}
php_date_instantiate(date_ce_immutable, return_value TSRMLS_CC);
- if (!php_date_initialize(zend_object_store_get_object(return_value TSRMLS_CC), time_str, time_str_len, format_str, timezone_object, 0 TSRMLS_CC)) {
+ if (!php_date_initialize((php_date_obj*)Z_OBJ_P(return_value), time_str, time_str_len, format_str, timezone_object, 0 TSRMLS_CC)) {
RETURN_FALSE;
}
}
@@ -2724,7 +2689,7 @@ PHP_METHOD(DateTime, __construct)
zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC);
if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sO!", &time_str, &time_str_len, &timezone_object, date_ce_timezone)) {
- php_date_initialize(zend_object_store_get_object(getThis() TSRMLS_CC), time_str, time_str_len, NULL, timezone_object, 1 TSRMLS_CC);
+ php_date_initialize((php_date_obj*)Z_OBJ_P(getThis()), time_str, time_str_len, NULL, timezone_object, 1 TSRMLS_CC);
}
zend_restore_error_handling(&error_handling TSRMLS_CC);
}
@@ -2742,52 +2707,54 @@ PHP_METHOD(DateTimeImmutable, __construct)
zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC);
if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sO!", &time_str, &time_str_len, &timezone_object, date_ce_timezone)) {
- php_date_initialize(zend_object_store_get_object(getThis() TSRMLS_CC), time_str, time_str_len, NULL, timezone_object, 1 TSRMLS_CC);
+ php_date_initialize((php_date_obj*)Z_OBJ_P(getThis()), time_str, time_str_len, NULL, timezone_object, 1 TSRMLS_CC);
}
zend_restore_error_handling(&error_handling TSRMLS_CC);
}
/* }}} */
-static int php_date_initialize_from_hash(zval **return_value, php_date_obj **dateobj, HashTable *myht TSRMLS_DC)
+static int php_date_initialize_from_hash(zval *return_value, php_date_obj **dateobj, HashTable *myht TSRMLS_DC)
{
- zval **z_date = NULL;
- zval **z_timezone = NULL;
- zval **z_timezone_type = NULL;
- zval *tmp_obj = NULL;
+ zval *z_date;
+ zval *z_timezone;
+ zval *z_timezone_type;
+ zval tmp_obj;
timelib_tzinfo *tzi;
php_timezone_obj *tzobj;
- if (zend_hash_find(myht, "date", 5, (void**) &z_date) == SUCCESS) {
- convert_to_string(*z_date);
- if (zend_hash_find(myht, "timezone_type", 14, (void**) &z_timezone_type) == SUCCESS) {
- convert_to_long(*z_timezone_type);
- if (zend_hash_find(myht, "timezone", 9, (void**) &z_timezone) == SUCCESS) {
- convert_to_string(*z_timezone);
-
- switch (Z_LVAL_PP(z_timezone_type)) {
+ z_date = zend_hash_str_find(myht, "date", sizeof("data")-1);
+ if (z_date) {
+ convert_to_string(z_date);
+ z_timezone_type = zend_hash_str_find(myht, "timezone_type", sizeof("timezone_type")-1);
+ if (z_timezone_type) {
+ convert_to_long(z_timezone_type);
+ z_timezone = zend_hash_str_find(myht, "timezone", sizeof("timezone")-1);
+ if (z_timezone) {
+ convert_to_string(z_timezone);
+
+ switch (Z_LVAL_P(z_timezone_type)) {
case TIMELIB_ZONETYPE_OFFSET:
case TIMELIB_ZONETYPE_ABBR: {
- char *tmp = emalloc(Z_STRLEN_PP(z_date) + Z_STRLEN_PP(z_timezone) + 2);
+ char *tmp = emalloc(Z_STRLEN_P(z_date) + Z_STRLEN_P(z_timezone) + 2);
int ret;
- snprintf(tmp, Z_STRLEN_PP(z_date) + Z_STRLEN_PP(z_timezone) + 2, "%s %s", Z_STRVAL_PP(z_date), Z_STRVAL_PP(z_timezone));
- ret = php_date_initialize(*dateobj, tmp, Z_STRLEN_PP(z_date) + Z_STRLEN_PP(z_timezone) + 1, NULL, NULL, 0 TSRMLS_CC);
+ snprintf(tmp, Z_STRLEN_P(z_date) + Z_STRLEN_P(z_timezone) + 2, "%s %s", Z_STRVAL_P(z_date), Z_STRVAL_P(z_timezone));
+ ret = php_date_initialize(*dateobj, tmp, Z_STRLEN_P(z_date) + Z_STRLEN_P(z_timezone) + 1, NULL, NULL, 0 TSRMLS_CC);
efree(tmp);
return 1 == ret;
}
case TIMELIB_ZONETYPE_ID: {
int ret;
- convert_to_string(*z_timezone);
+ convert_to_string(z_timezone);
- tzi = php_date_parse_tzfile(Z_STRVAL_PP(z_timezone), DATE_TIMEZONEDB TSRMLS_CC);
+ tzi = php_date_parse_tzfile(Z_STRVAL_P(z_timezone), DATE_TIMEZONEDB TSRMLS_CC);
- ALLOC_INIT_ZVAL(tmp_obj);
- tzobj = zend_object_store_get_object(php_date_instantiate(date_ce_timezone, tmp_obj TSRMLS_CC) TSRMLS_CC);
+ tzobj = (php_timezone_obj*)Z_OBJ_P(php_date_instantiate(date_ce_timezone, &tmp_obj TSRMLS_CC));
tzobj->type = TIMELIB_ZONETYPE_ID;
tzobj->tzi.tz = tzi;
tzobj->initialized = 1;
- ret = php_date_initialize(*dateobj, Z_STRVAL_PP(z_date), Z_STRLEN_PP(z_date), NULL, tmp_obj, 0 TSRMLS_CC);
+ ret = php_date_initialize(*dateobj, Z_STRVAL_P(z_date), Z_STRLEN_P(z_date), NULL, &tmp_obj, 0 TSRMLS_CC);
zval_ptr_dtor(&tmp_obj);
return 1 == ret;
}
@@ -2813,8 +2780,8 @@ PHP_METHOD(DateTime, __set_state)
myht = HASH_OF(array);
php_date_instantiate(date_ce_date, return_value TSRMLS_CC);
- dateobj = (php_date_obj *) zend_object_store_get_object(return_value TSRMLS_CC);
- if (!php_date_initialize_from_hash(&return_value, &dateobj, myht TSRMLS_CC)) {
+ dateobj = (php_date_obj *) Z_OBJ_P(return_value);
+ if (!php_date_initialize_from_hash(return_value, &dateobj, myht TSRMLS_CC)) {
php_error(E_ERROR, "Invalid serialization data for DateTime object");
}
}
@@ -2835,8 +2802,8 @@ PHP_METHOD(DateTimeImmutable, __set_state)
myht = HASH_OF(array);
php_date_instantiate(date_ce_immutable, return_value TSRMLS_CC);
- dateobj = (php_date_obj *) zend_object_store_get_object(return_value TSRMLS_CC);
- if (!php_date_initialize_from_hash(&return_value, &dateobj, myht TSRMLS_CC)) {
+ dateobj = (php_date_obj *) Z_OBJ_P(return_value);
+ if (!php_date_initialize_from_hash(return_value, &dateobj, myht TSRMLS_CC)) {
php_error(E_ERROR, "Invalid serialization data for DateTimeImmutable object");
}
}
@@ -2850,11 +2817,11 @@ PHP_METHOD(DateTime, __wakeup)
php_date_obj *dateobj;
HashTable *myht;
- dateobj = (php_date_obj *) zend_object_store_get_object(object TSRMLS_CC);
+ dateobj = (php_date_obj *) Z_OBJ_P(object);
myht = Z_OBJPROP_P(object);
- if (!php_date_initialize_from_hash(&return_value, &dateobj, myht TSRMLS_CC)) {
+ if (!php_date_initialize_from_hash(return_value, &dateobj, myht TSRMLS_CC)) {
php_error(E_ERROR, "Invalid serialization data for DateTime object");
}
}
@@ -2864,23 +2831,21 @@ PHP_METHOD(DateTime, __wakeup)
static void zval_from_error_container(zval *z, timelib_error_container *error)
{
int i;
- zval *element;
+ zval element;
add_assoc_long(z, "warning_count", error->warning_count);
- MAKE_STD_ZVAL(element);
- array_init(element);
+ array_init(&element);
for (i = 0; i < error->warning_count; i++) {
- add_index_string(element, error->warning_messages[i].position, error->warning_messages[i].message, 1);
+ add_index_string(&element, error->warning_messages[i].position, error->warning_messages[i].message, 1);
}
- add_assoc_zval(z, "warnings", element);
+ add_assoc_zval(z, "warnings", &element);
add_assoc_long(z, "error_count", error->error_count);
- MAKE_STD_ZVAL(element);
- array_init(element);
+ array_init(&element);
for (i = 0; i < error->error_count; i++) {
- add_index_string(element, error->error_messages[i].position, error->error_messages[i].message, 1);
+ add_index_string(&element, error->error_messages[i].position, error->error_messages[i].message, 1);
}
- add_assoc_zval(z, "errors", element);
+ add_assoc_zval(z, "errors", &element);
}
/* {{{ proto array date_get_last_errors()
@@ -2899,7 +2864,7 @@ PHP_FUNCTION(date_get_last_errors)
void php_date_do_return_parsed_time(INTERNAL_FUNCTION_PARAMETERS, timelib_time *parsed_time, struct timelib_error_container *error)
{
- zval *element;
+ zval element;
array_init(return_value);
#define PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(name, elem) \
@@ -2950,24 +2915,23 @@ void php_date_do_return_parsed_time(INTERNAL_FUNCTION_PARAMETERS, timelib_time *
}
}
if (parsed_time->have_relative) {
- MAKE_STD_ZVAL(element);
- array_init(element);
- add_assoc_long(element, "year", parsed_time->relative.y);
- add_assoc_long(element, "month", parsed_time->relative.m);
- add_assoc_long(element, "day", parsed_time->relative.d);
- add_assoc_long(element, "hour", parsed_time->relative.h);
- add_assoc_long(element, "minute", parsed_time->relative.i);
- add_assoc_long(element, "second", parsed_time->relative.s);
+ array_init(&element);
+ add_assoc_long(&element, "year", parsed_time->relative.y);
+ add_assoc_long(&element, "month", parsed_time->relative.m);
+ add_assoc_long(&element, "day", parsed_time->relative.d);
+ add_assoc_long(&element, "hour", parsed_time->relative.h);
+ add_assoc_long(&element, "minute", parsed_time->relative.i);
+ add_assoc_long(&element, "second", parsed_time->relative.s);
if (parsed_time->relative.have_weekday_relative) {
- add_assoc_long(element, "weekday", parsed_time->relative.weekday);
+ add_assoc_long(&element, "weekday", parsed_time->relative.weekday);
}
if (parsed_time->relative.have_special_relative && (parsed_time->relative.special.type == TIMELIB_SPECIAL_WEEKDAY)) {
- add_assoc_long(element, "weekdays", parsed_time->relative.special.amount);
+ add_assoc_long(&element, "weekdays", parsed_time->relative.special.amount);
}
if (parsed_time->relative.first_last_day_of) {
- add_assoc_bool(element, parsed_time->relative.first_last_day_of == 1 ? "first_day_of_month" : "last_day_of_month", 1);
+ add_assoc_bool(&element, parsed_time->relative.first_last_day_of == 1 ? "first_day_of_month" : "last_day_of_month", 1);
}
- add_assoc_zval(return_value, "relative", element);
+ add_assoc_zval(return_value, "relative", &element);
}
timelib_time_dtor(parsed_time);
}
@@ -3023,9 +2987,10 @@ PHP_FUNCTION(date_format)
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &object, date_ce_interface, &format, &format_len) == FAILURE) {
RETURN_FALSE;
}
- dateobj = (php_date_obj *) zend_object_store_get_object(object TSRMLS_CC);
+ dateobj = (php_date_obj *) Z_OBJ_P(object);
DATE_CHECK_INITIALIZED(dateobj->time, DateTime);
- RETURN_STRING(date_format(format, format_len, dateobj->time, dateobj->time->is_localtime), 0);
+//??? RETURN_STRING(date_format(format, format_len, dateobj->time, dateobj->time->is_localtime), 0);
+ RETURN_STRING(date_format(format, format_len, dateobj->time, dateobj->time->is_localtime));
}
/* }}} */
@@ -3035,7 +3000,7 @@ static int php_date_modify(zval *object, char *modify, int modify_len TSRMLS_DC)
timelib_time *tmp_time;
timelib_error_container *err = NULL;
- dateobj = (php_date_obj *) zend_object_store_get_object(object TSRMLS_CC);
+ dateobj = (php_date_obj *) Z_OBJ_P(object);
if (!(dateobj->time)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "The DateTime object has not been correctly initialized by its constructor");
@@ -3116,7 +3081,7 @@ PHP_FUNCTION(date_modify)
*/
PHP_METHOD(DateTimeImmutable, modify)
{
- zval *object, *new_object;
+ zval *object, new_object;
char *modify;
int modify_len;
@@ -3124,9 +3089,9 @@ PHP_METHOD(DateTimeImmutable, modify)
RETURN_FALSE;
}
- new_object = date_clone_immutable(object TSRMLS_CC);
- if (php_date_modify(new_object, modify, modify_len TSRMLS_CC)) {
- RETURN_ZVAL(new_object, 0, 1);
+ date_clone_immutable(object, &new_object TSRMLS_CC);
+ if (php_date_modify(&new_object, modify, modify_len TSRMLS_CC)) {
+ RETURN_ZVAL(&new_object, 0, 1);
}
RETURN_FALSE;
@@ -3139,9 +3104,9 @@ static void php_date_add(zval *object, zval *interval, zval *return_value TSRMLS
php_interval_obj *intobj;
timelib_time *new_time;
- dateobj = (php_date_obj *) zend_object_store_get_object(object TSRMLS_CC);
+ dateobj = (php_date_obj *) Z_OBJ_P(object);
DATE_CHECK_INITIALIZED(dateobj->time, DateTime);
- intobj = (php_interval_obj *) zend_object_store_get_object(interval TSRMLS_CC);
+ intobj = (php_interval_obj *) Z_OBJ_P(interval);
DATE_CHECK_INITIALIZED(intobj->initialized, DateInterval);
new_time = timelib_add(dateobj->time, intobj->diff);
@@ -3170,16 +3135,16 @@ PHP_FUNCTION(date_add)
*/
PHP_METHOD(DateTimeImmutable, add)
{
- zval *object, *interval, *new_object;
+ zval *object, *interval, new_object;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO", &object, date_ce_immutable, &interval, date_ce_interval) == FAILURE) {
RETURN_FALSE;
}
- new_object = date_clone_immutable(object TSRMLS_CC);
- php_date_add(new_object, interval, return_value TSRMLS_CC);
+ date_clone_immutable(object, &new_object TSRMLS_CC);
+ php_date_add(&new_object, interval, return_value TSRMLS_CC);
- RETURN_ZVAL(new_object, 0, 1);
+ RETURN_ZVAL(&new_object, 0, 1);
}
/* }}} */
@@ -3189,9 +3154,9 @@ static void php_date_sub(zval *object, zval *interval, zval *return_value TSRMLS
php_interval_obj *intobj;
timelib_time *new_time;
- dateobj = (php_date_obj *) zend_object_store_get_object(object TSRMLS_CC);
+ dateobj = (php_date_obj *) Z_OBJ_P(object);
DATE_CHECK_INITIALIZED(dateobj->time, DateTime);
- intobj = (php_interval_obj *) zend_object_store_get_object(interval TSRMLS_CC);
+ intobj = (php_interval_obj *) Z_OBJ_P(interval);
DATE_CHECK_INITIALIZED(intobj->initialized, DateInterval);
if (intobj->diff->have_special_relative) {
@@ -3225,16 +3190,16 @@ PHP_FUNCTION(date_sub)
*/
PHP_METHOD(DateTimeImmutable, sub)
{
- zval *object, *interval, *new_object;
+ zval *object, *interval, new_object;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO", &object, date_ce_immutable, &interval, date_ce_interval) == FAILURE) {
RETURN_FALSE;
}
- new_object = date_clone_immutable(object TSRMLS_CC);
- php_date_sub(new_object, interval, return_value TSRMLS_CC);
+ date_clone_immutable(object, &new_object TSRMLS_CC);
+ php_date_sub(&new_object, interval, return_value TSRMLS_CC);
- RETURN_ZVAL(new_object, 0, 1);
+ RETURN_ZVAL(&new_object, 0, 1);
}
/* }}} */
@@ -3250,11 +3215,11 @@ PHP_FUNCTION(date_timezone_get)
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &object, date_ce_interface) == FAILURE) {
RETURN_FALSE;
}
- dateobj = (php_date_obj *) zend_object_store_get_object(object TSRMLS_CC);
+ dateobj = (php_date_obj *) Z_OBJ_P(object);
DATE_CHECK_INITIALIZED(dateobj->time, DateTime);
if (dateobj->time->is_localtime/* && dateobj->time->tz_info*/) {
php_date_instantiate(date_ce_timezone, return_value TSRMLS_CC);
- tzobj = (php_timezone_obj *) zend_object_store_get_object(return_value TSRMLS_CC);
+ tzobj = (php_timezone_obj *) Z_OBJ_P(return_value);
tzobj->initialized = 1;
tzobj->type = dateobj->time->zone_type;
switch (dateobj->time->zone_type) {
@@ -3281,9 +3246,9 @@ static void php_date_timezone_set(zval *object, zval *timezone_object, zval *ret
php_date_obj *dateobj;
php_timezone_obj *tzobj;
- dateobj = (php_date_obj *) zend_object_store_get_object(object TSRMLS_CC);
+ dateobj = (php_date_obj *) Z_OBJ_P(object);
DATE_CHECK_INITIALIZED(dateobj->time, DateTime);
- tzobj = (php_timezone_obj *) zend_object_store_get_object(timezone_object TSRMLS_CC);
+ tzobj = (php_timezone_obj *) Z_OBJ_P(timezone_object);
if (tzobj->type != TIMELIB_ZONETYPE_ID) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can only do this for zones with ID for now");
return;
@@ -3314,17 +3279,17 @@ PHP_FUNCTION(date_timezone_set)
*/
PHP_METHOD(DateTimeImmutable, setTimezone)
{
- zval *object, *new_object;
+ zval *object, new_object;
zval *timezone_object;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO", &object, date_ce_immutable, &timezone_object, date_ce_timezone) == FAILURE) {
RETURN_FALSE;
}
- new_object = date_clone_immutable(object TSRMLS_CC);
- php_date_timezone_set(new_object, timezone_object, return_value TSRMLS_CC);
+ date_clone_immutable(object, &new_object TSRMLS_CC);
+ php_date_timezone_set(&new_object, timezone_object, return_value TSRMLS_CC);
- RETURN_ZVAL(new_object, 0, 1);
+ RETURN_ZVAL(&new_object, 0, 1);
}
/* }}} */
@@ -3340,7 +3305,7 @@ PHP_FUNCTION(date_offset_get)
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &object, date_ce_interface) == FAILURE) {
RETURN_FALSE;
}
- dateobj = (php_date_obj *) zend_object_store_get_object(object TSRMLS_CC);
+ dateobj = (php_date_obj *) Z_OBJ_P(object);
DATE_CHECK_INITIALIZED(dateobj->time, DateTime);
if (dateobj->time->is_localtime/* && dateobj->time->tz_info*/) {
switch (dateobj->time->zone_type) {
@@ -3367,7 +3332,7 @@ static void php_date_time_set(zval *object, long h, long i, long s, zval *return
{
php_date_obj *dateobj;
- dateobj = (php_date_obj *) zend_object_store_get_object(object TSRMLS_CC);
+ dateobj = (php_date_obj *) Z_OBJ_P(object);
DATE_CHECK_INITIALIZED(dateobj->time, DateTime);
dateobj->time->h = h;
dateobj->time->i = i;
@@ -3397,17 +3362,17 @@ PHP_FUNCTION(date_time_set)
*/
PHP_METHOD(DateTimeImmutable, setTime)
{
- zval *object, *new_object;
+ zval *object, new_object;
long h, i, s = 0;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oll|l", &object, date_ce_immutable, &h, &i, &s) == FAILURE) {
RETURN_FALSE;
}
- new_object = date_clone_immutable(object TSRMLS_CC);
- php_date_time_set(new_object, h, i, s, return_value TSRMLS_CC);
+ date_clone_immutable(object, &new_object TSRMLS_CC);
+ php_date_time_set(&new_object, h, i, s, return_value TSRMLS_CC);
- RETURN_ZVAL(new_object, 0, 1);
+ RETURN_ZVAL(&new_object, 0, 1);
}
/* }}} */
@@ -3415,7 +3380,7 @@ static void php_date_date_set(zval *object, long y, long m, long d, zval *return
{
php_date_obj *dateobj;
- dateobj = (php_date_obj *) zend_object_store_get_object(object TSRMLS_CC);
+ dateobj = (php_date_obj *) Z_OBJ_P(object);
DATE_CHECK_INITIALIZED(dateobj->time, DateTime);
dateobj->time->y = y;
dateobj->time->m = m;
@@ -3445,17 +3410,17 @@ PHP_FUNCTION(date_date_set)
*/
PHP_METHOD(DateTimeImmutable, setDate)
{
- zval *object, *new_object;
+ zval *object, new_object;
long y, m, d;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Olll", &object, date_ce_immutable, &y, &m, &d) == FAILURE) {
RETURN_FALSE;
}
- new_object = date_clone_immutable(object TSRMLS_CC);
- php_date_date_set(new_object, y, m, d, return_value TSRMLS_CC);
+ date_clone_immutable(object, &new_object TSRMLS_CC);
+ php_date_date_set(&new_object, y, m, d, return_value TSRMLS_CC);
- RETURN_ZVAL(new_object, 0, 1);
+ RETURN_ZVAL(&new_object, 0, 1);
}
/* }}} */
@@ -3463,7 +3428,7 @@ static void php_date_isodate_set(zval *object, long y, long w, long d, zval *ret
{
php_date_obj *dateobj;
- dateobj = (php_date_obj *) zend_object_store_get_object(object TSRMLS_CC);
+ dateobj = (php_date_obj *) Z_OBJ_P(object);
DATE_CHECK_INITIALIZED(dateobj->time, DateTime);
dateobj->time->y = y;
dateobj->time->m = 1;
@@ -3497,17 +3462,17 @@ PHP_FUNCTION(date_isodate_set)
*/
PHP_METHOD(DateTimeImmutable, setISODate)
{
- zval *object, *new_object;
+ zval *object, new_object;
long y, w, d = 1;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oll|l", &object, date_ce_immutable, &y, &w, &d) == FAILURE) {
RETURN_FALSE;
}
- new_object = date_clone_immutable(object TSRMLS_CC);
- php_date_isodate_set(new_object, y, w, d, return_value TSRMLS_CC);
+ date_clone_immutable(object, &new_object TSRMLS_CC);
+ php_date_isodate_set(&new_object, y, w, d, return_value TSRMLS_CC);
- RETURN_ZVAL(new_object, 0, 1);
+ RETURN_ZVAL(&new_object, 0, 1);
}
/* }}} */
@@ -3515,7 +3480,7 @@ static void php_date_timestamp_set(zval *object, long timestamp, zval *return_va
{
php_date_obj *dateobj;
- dateobj = (php_date_obj *) zend_object_store_get_object(object TSRMLS_CC);
+ dateobj = (php_date_obj *) Z_OBJ_P(object);
DATE_CHECK_INITIALIZED(dateobj->time, DateTime);
timelib_unixtime2local(dateobj->time, (timelib_sll)timestamp);
timelib_update_ts(dateobj->time, NULL);
@@ -3543,17 +3508,17 @@ PHP_FUNCTION(date_timestamp_set)
*/
PHP_METHOD(DateTimeImmutable, setTimestamp)
{
- zval *object, *new_object;
+ zval *object, new_object;
long timestamp;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &object, date_ce_immutable, &timestamp) == FAILURE) {
RETURN_FALSE;
}
- new_object = date_clone_immutable(object TSRMLS_CC);
- php_date_timestamp_set(new_object, timestamp, return_value TSRMLS_CC);
+ date_clone_immutable(object, &new_object TSRMLS_CC);
+ php_date_timestamp_set(&new_object, timestamp, return_value TSRMLS_CC);
- RETURN_ZVAL(new_object, 0, 1);
+ RETURN_ZVAL(&new_object, 0, 1);
}
/* }}} */
@@ -3570,7 +3535,7 @@ PHP_FUNCTION(date_timestamp_get)
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &object, date_ce_interface) == FAILURE) {
RETURN_FALSE;
}
- dateobj = (php_date_obj *) zend_object_store_get_object(object TSRMLS_CC);
+ dateobj = (php_date_obj *) Z_OBJ_P(object);
DATE_CHECK_INITIALIZED(dateobj->time, DateTime);
timelib_update_ts(dateobj->time, NULL);
@@ -3596,15 +3561,15 @@ PHP_FUNCTION(date_diff)
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO|l", &object1, date_ce_interface, &object2, date_ce_interface, &absolute) == FAILURE) {
RETURN_FALSE;
}
- dateobj1 = (php_date_obj *) zend_object_store_get_object(object1 TSRMLS_CC);
- dateobj2 = (php_date_obj *) zend_object_store_get_object(object2 TSRMLS_CC);
+ dateobj1 = (php_date_obj *) Z_OBJ_P(object1 TSRMLS_CC);
+ dateobj2 = (php_date_obj *) Z_OBJ_P(object2 TSRMLS_CC);
DATE_CHECK_INITIALIZED(dateobj1->time, DateTimeInterface);
DATE_CHECK_INITIALIZED(dateobj2->time, DateTimeInterface);
timelib_update_ts(dateobj1->time, NULL);
timelib_update_ts(dateobj2->time, NULL);
php_date_instantiate(date_ce_interval, return_value TSRMLS_CC);
- interval = zend_object_store_get_object(return_value TSRMLS_CC);
+ interval = (php_interval_obj*)Z_OBJ_P(return_value TSRMLS_CC);
interval->diff = timelib_diff(dateobj1->time, dateobj2->time);
if (absolute) {
interval->diff->invert = 0;
@@ -3649,7 +3614,7 @@ PHP_FUNCTION(timezone_open)
if (SUCCESS != timezone_initialize(&tzi, tz TSRMLS_CC)) {
RETURN_FALSE;
}
- tzobj = zend_object_store_get_object(php_date_instantiate(date_ce_timezone, return_value TSRMLS_CC) TSRMLS_CC);
+ tzobj = (php_timezone_obj*)Z_OBJ_P(php_date_instantiate(date_ce_timezone, return_value TSRMLS_CC) TSRMLS_CC);
tzobj->type = TIMELIB_ZONETYPE_ID;
tzobj->tzi.tz = tzi;
tzobj->initialized = 1;
@@ -3670,7 +3635,7 @@ PHP_METHOD(DateTimeZone, __construct)
zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC);
if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &tz, &tz_len)) {
if (SUCCESS == timezone_initialize(&tzi, tz TSRMLS_CC)) {
- tzobj = zend_object_store_get_object(getThis() TSRMLS_CC);
+ tzobj = (php_timezone_obj*)Z_OBJ_P(getThis());
tzobj->type = TIMELIB_ZONETYPE_ID;
tzobj->tzi.tz = tzi;
tzobj->initialized = 1;
@@ -3684,19 +3649,21 @@ PHP_METHOD(DateTimeZone, __construct)
static int php_date_timezone_initialize_from_hash(zval **return_value, php_timezone_obj **tzobj, HashTable *myht TSRMLS_DC)
{
- zval **z_timezone = NULL;
- zval **z_timezone_type = NULL;
+ zval *z_timezone;
+ zval *z_timezone_type;
timelib_tzinfo *tzi;
- if (zend_hash_find(myht, "timezone_type", 14, (void**) &z_timezone_type) == SUCCESS) {
- if (zend_hash_find(myht, "timezone", 9, (void**) &z_timezone) == SUCCESS) {
- convert_to_long(*z_timezone_type);
- switch (Z_LVAL_PP(z_timezone_type)) {
+ z_timezone_type = zend_hash_str_find(myht, "timezone_type", sizeof("timezone_type")-1);
+ if (z_timezone_type) {
+ z_timezone = zend_hash_str_find(myht, "timezone", sizeof("timezone")-1);
+ if (z_timezone) {
+ convert_to_long(z_timezone_type);
+ switch (Z_LVAL_P(z_timezone_type)) {
case TIMELIB_ZONETYPE_OFFSET: {
char *offset, *offset_start;
- offset = emalloc(sizeof(char) * (Z_STRLEN_PP(z_timezone) + 1));
- memmove(offset, Z_STRVAL_PP(z_timezone), Z_STRLEN_PP(z_timezone)+1);
+ offset = emalloc(sizeof(char) * (Z_STRLEN_P(z_timezone) + 1));
+ memmove(offset, Z_STRVAL_P(z_timezone), Z_STRLEN_P(z_timezone)+1);
offset_start = offset;
++offset;
@@ -3713,7 +3680,7 @@ static int php_date_timezone_initialize_from_hash(zval **return_value, php_timez
}
case TIMELIB_ZONETYPE_ABBR:
case TIMELIB_ZONETYPE_ID:
- if (SUCCESS == timezone_initialize(&tzi, Z_STRVAL_PP(z_timezone) TSRMLS_CC)) {
+ if (SUCCESS == timezone_initialize(&tzi, Z_STRVAL_P(z_timezone) TSRMLS_CC)) {
(*tzobj)->type = TIMELIB_ZONETYPE_ID;
(*tzobj)->tzi.tz = tzi;
(*tzobj)->initialized = 1;
@@ -3740,7 +3707,7 @@ PHP_METHOD(DateTimeZone, __set_state)
myht = HASH_OF(array);
php_date_instantiate(date_ce_timezone, return_value TSRMLS_CC);
- tzobj = (php_timezone_obj *) zend_object_store_get_object(return_value TSRMLS_CC);
+ tzobj = (php_timezone_obj *) Z_OBJ_P(return_value);
php_date_timezone_initialize_from_hash(&return_value, &tzobj, myht TSRMLS_CC);
}
/* }}} */
@@ -3753,7 +3720,7 @@ PHP_METHOD(DateTimeZone, __wakeup)
php_timezone_obj *tzobj;
HashTable *myht;
- tzobj = (php_timezone_obj *) zend_object_store_get_object(object TSRMLS_CC);
+ tzobj = (php_timezone_obj *) Z_OBJ_P(object);
myht = Z_OBJPROP_P(object);
@@ -3772,12 +3739,12 @@ PHP_FUNCTION(timezone_name_get)
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &object, date_ce_timezone) == FAILURE) {
RETURN_FALSE;
}
- tzobj = (php_timezone_obj *) zend_object_store_get_object(object TSRMLS_CC);
+ tzobj = (php_timezone_obj *) Z_OBJ_P(object);
DATE_CHECK_INITIALIZED(tzobj->initialized, DateTimeZone);
switch (tzobj->type) {
case TIMELIB_ZONETYPE_ID:
- RETURN_STRING(tzobj->tzi.tz->name, 1);
+ RETURN_STRING(tzobj->tzi.tz->name);
break;
case TIMELIB_ZONETYPE_OFFSET: {
char *tmpstr = emalloc(sizeof("UTC+05:00"));
@@ -3788,11 +3755,12 @@ PHP_FUNCTION(timezone_name_get)
abs(utc_offset / 60),
abs((utc_offset % 60)));
- RETURN_STRING(tmpstr, 0);
+//??? RETURN_STRING(tmpstr, 0);
+ RETURN_STRING(tmpstr);
}
break;
case TIMELIB_ZONETYPE_ABBR:
- RETURN_STRING(tzobj->tzi.z.abbr, 1);
+ RETURN_STRING(tzobj->tzi.z.abbr);
break;
}
}
@@ -3815,7 +3783,7 @@ PHP_FUNCTION(timezone_name_from_abbr)
tzid = timelib_timezone_id_from_abbr(abbr, gmtoffset, isdst);
if (tzid) {
- RETURN_STRING(tzid, 1);
+ RETURN_STRING(tzid);
} else {
RETURN_FALSE;
}
@@ -3835,9 +3803,9 @@ PHP_FUNCTION(timezone_offset_get)
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO", &object, date_ce_timezone, &dateobject, date_ce_date) == FAILURE) {
RETURN_FALSE;
}
- tzobj = (php_timezone_obj *) zend_object_store_get_object(object TSRMLS_CC);
+ tzobj = (php_timezone_obj *) Z_OBJ_P(object);
DATE_CHECK_INITIALIZED(tzobj->initialized, DateTimeZone);
- dateobj = (php_date_obj *) zend_object_store_get_object(dateobject TSRMLS_CC);
+ dateobj = (php_date_obj *) Z_OBJ_P(dateobject);
DATE_CHECK_INITIALIZED(dateobj->time, DateTime);
switch (tzobj->type) {
@@ -3861,7 +3829,7 @@ PHP_FUNCTION(timezone_offset_get)
*/
PHP_FUNCTION(timezone_transitions_get)
{
- zval *object, *element;
+ zval *object, element;
php_timezone_obj *tzobj;
unsigned int i, begin = 0, found;
long timestamp_begin = LONG_MIN, timestamp_end = LONG_MAX;
@@ -3869,31 +3837,29 @@ PHP_FUNCTION(timezone_transitions_get)
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|ll", &object, date_ce_timezone, &timestamp_begin, &timestamp_end) == FAILURE) {
RETURN_FALSE;
}
- tzobj = (php_timezone_obj *) zend_object_store_get_object(object TSRMLS_CC);
+ tzobj = (php_timezone_obj *) Z_OBJ_P(object);
DATE_CHECK_INITIALIZED(tzobj->initialized, DateTimeZone);
if (tzobj->type != TIMELIB_ZONETYPE_ID) {
RETURN_FALSE;
}
#define add_nominal() \
- MAKE_STD_ZVAL(element); \
- array_init(element); \
- add_assoc_long(element, "ts", timestamp_begin); \
- add_assoc_string(element, "time", php_format_date(DATE_FORMAT_ISO8601, 13, timestamp_begin, 0 TSRMLS_CC), 0); \
- add_assoc_long(element, "offset", tzobj->tzi.tz->type[0].offset); \
- add_assoc_bool(element, "isdst", tzobj->tzi.tz->type[0].isdst); \
- add_assoc_string(element, "abbr", &tzobj->tzi.tz->timezone_abbr[tzobj->tzi.tz->type[0].abbr_idx], 1); \
- add_next_index_zval(return_value, element);
+ array_init(&element); \
+ add_assoc_long(&element, "ts", timestamp_begin); \
+ add_assoc_string(&element, "time", php_format_date(DATE_FORMAT_ISO8601, 13, timestamp_begin, 0 TSRMLS_CC), 0); \
+ add_assoc_long(&element, "offset", tzobj->tzi.tz->type[0].offset); \
+ add_assoc_bool(&element, "isdst", tzobj->tzi.tz->type[0].isdst); \
+ add_assoc_string(&element, "abbr", &tzobj->tzi.tz->timezone_abbr[tzobj->tzi.tz->type[0].abbr_idx], 1); \
+ add_next_index_zval(return_value, &element);
#define add(i,ts) \
- MAKE_STD_ZVAL(element); \
- array_init(element); \
- add_assoc_long(element, "ts", ts); \
- add_assoc_string(element, "time", php_format_date(DATE_FORMAT_ISO8601, 13, ts, 0 TSRMLS_CC), 0); \
- add_assoc_long(element, "offset", tzobj->tzi.tz->type[tzobj->tzi.tz->trans_idx[i]].offset); \
- add_assoc_bool(element, "isdst", tzobj->tzi.tz->type[tzobj->tzi.tz->trans_idx[i]].isdst); \
- add_assoc_string(element, "abbr", &tzobj->tzi.tz->timezone_abbr[tzobj->tzi.tz->type[tzobj->tzi.tz->trans_idx[i]].abbr_idx], 1); \
- add_next_index_zval(return_value, element);
+ array_init(&element); \
+ add_assoc_long(&element, "ts", ts); \
+ add_assoc_string(&element, "time", php_format_date(DATE_FORMAT_ISO8601, 13, ts, 0 TSRMLS_CC), 0); \
+ add_assoc_long(&element, "offset", tzobj->tzi.tz->type[tzobj->tzi.tz->trans_idx[i]].offset); \
+ add_assoc_bool(&element, "isdst", tzobj->tzi.tz->type[tzobj->tzi.tz->trans_idx[i]].isdst); \
+ add_assoc_string(&element, "abbr", &tzobj->tzi.tz->timezone_abbr[tzobj->tzi.tz->type[tzobj->tzi.tz->trans_idx[i]].abbr_idx], 1); \
+ add_next_index_zval(return_value, &element);
#define add_last() add(tzobj->tzi.tz->timecnt - 1, timestamp_begin)
@@ -3949,7 +3915,7 @@ PHP_FUNCTION(timezone_location_get)
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &object, date_ce_timezone) == FAILURE) {
RETURN_FALSE;
}
- tzobj = (php_timezone_obj *) zend_object_store_get_object(object TSRMLS_CC);
+ tzobj = (php_timezone_obj *) Z_OBJ_P(object);
DATE_CHECK_INITIALIZED(tzobj->initialized, DateTimeZone);
if (tzobj->type != TIMELIB_ZONETYPE_ID) {
RETURN_FALSE;
@@ -4012,7 +3978,7 @@ zval *date_interval_read_property(zval *object, zval *member, int type, const ze
key = NULL;
}
- obj = (php_interval_obj *)zend_objects_get_address(object TSRMLS_CC);
+ obj = (php_interval_obj *)Z_OBJ_P(object);
if (!obj->initialized) {
retval = (zend_get_std_object_handlers())->read_property(object, member, type, key TSRMLS_CC);
@@ -4046,7 +4012,7 @@ zval *date_interval_read_property(zval *object, zval *member, int type, const ze
return retval;
} while(0);
- ALLOC_INIT_ZVAL(retval);
+//??? ALLOC_INIT_ZVAL(retval);
Z_SET_REFCOUNT_P(retval, 0);
if (value != -99999) {
@@ -4077,7 +4043,7 @@ void date_interval_write_property(zval *object, zval *member, zval *value, const
key = NULL;
}
- obj = (php_interval_obj *)zend_objects_get_address(object TSRMLS_CC);
+ obj = (php_interval_obj *)Z_OBJ_P(object);
if (!obj->initialized) {
(zend_get_std_object_handlers())->write_property(object, member, value, key TSRMLS_CC);
@@ -4135,7 +4101,7 @@ PHP_METHOD(DateInterval, __construct)
zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &interval_string, &interval_string_length) == SUCCESS) {
if (date_interval_initialize(&reltime, interval_string, interval_string_length TSRMLS_CC) == SUCCESS) {
- diobj = zend_object_store_get_object(getThis() TSRMLS_CC);
+ diobj = (php_interval_obj *)Z_OBJ_P(getThis());
diobj->diff = reltime;
diobj->initialized = 1;
} else {
@@ -4153,10 +4119,10 @@ static int php_date_interval_initialize_from_hash(zval **return_value, php_inter
#define PHP_DATE_INTERVAL_READ_PROPERTY(element, member, itype, def) \
do { \
- zval **z_arg = NULL; \
- if (zend_hash_find(myht, element, strlen(element) + 1, (void**) &z_arg) == SUCCESS) { \
- convert_to_long(*z_arg); \
- (*intobj)->diff->member = (itype)Z_LVAL_PP(z_arg); \
+ zval *z_arg = zend_hash_str_find(myht, element, sizeof(element) - 1); \
+ if (z_arg) { \
+ convert_to_long(z_arg); \
+ (*intobj)->diff->member = (itype)Z_LVAL_P(z_arg); \
} else { \
(*intobj)->diff->member = (itype)def; \
} \
@@ -4164,10 +4130,10 @@ static int php_date_interval_initialize_from_hash(zval **return_value, php_inter
#define PHP_DATE_INTERVAL_READ_PROPERTY_I64(element, member) \
do { \
- zval **z_arg = NULL; \
- if (zend_hash_find(myht, element, strlen(element) + 1, (void**) &z_arg) == SUCCESS) { \
- convert_to_string(*z_arg); \
- DATE_A64I((*intobj)->diff->member, Z_STRVAL_PP(z_arg)); \
+ zval *z_arg = zend_hash_str_find(myht, element, sizeof(element) - 1); \
+ if (z_arg) { \
+ convert_to_string(z_arg); \
+ DATE_A64I((*intobj)->diff->member, Z_STRVAL_P(z_arg)); \
} else { \
(*intobj)->diff->member = -1LL; \
} \
@@ -4208,7 +4174,7 @@ PHP_METHOD(DateInterval, __set_state)
myht = HASH_OF(array);
php_date_instantiate(date_ce_interval, return_value TSRMLS_CC);
- intobj = (php_interval_obj *) zend_object_store_get_object(return_value TSRMLS_CC);
+ intobj = (php_interval_obj *) Z_OBJ_P(return_value);
php_date_interval_initialize_from_hash(&return_value, &intobj, myht TSRMLS_CC);
}
/* }}} */
@@ -4221,7 +4187,7 @@ PHP_METHOD(DateInterval, __wakeup)
php_interval_obj *intobj;
HashTable *myht;
- intobj = (php_interval_obj *) zend_object_store_get_object(object TSRMLS_CC);
+ intobj = (php_interval_obj *) Z_OBJ_P(object);
myht = Z_OBJPROP_P(object);
@@ -4246,7 +4212,7 @@ PHP_FUNCTION(date_interval_create_from_date_string)
php_date_instantiate(date_ce_interval, return_value TSRMLS_CC);
time = timelib_strtotime(time_str, time_str_len, &err, DATE_TIMEZONEDB, php_date_parse_tzfile_wrapper);
- diobj = (php_interval_obj *) zend_object_store_get_object(return_value TSRMLS_CC);
+ diobj = (php_interval_obj *) Z_OBJ_P(return_value);
diobj->diff = timelib_rel_time_clone(&time->relative);
diobj->initialized = 1;
timelib_time_dtor(time);
@@ -4329,10 +4295,11 @@ PHP_FUNCTION(date_interval_format)
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &object, date_ce_interval, &format, &format_len) == FAILURE) {
RETURN_FALSE;
}
- diobj = (php_interval_obj *) zend_object_store_get_object(object TSRMLS_CC);
+ diobj = (php_interval_obj *) Z_OBJ_P(object);
DATE_CHECK_INITIALIZED(diobj->initialized, DateInterval);
- RETURN_STRING(date_interval_format(format, format_len, diobj->diff), 0);
+//??? RETURN_STRING(date_interval_format(format, format_len, diobj->diff), 0);
+ RETURN_STRING(date_interval_format(format, format_len, diobj->diff));
}
/* }}} */
@@ -4386,7 +4353,7 @@ PHP_METHOD(DatePeriod, __construct)
}
}
- dpobj = zend_object_store_get_object(getThis() TSRMLS_CC);
+ dpobj = (php_period_obj*)Z_OBJ_P(getThis());
dpobj->current = NULL;
if (isostr) {
@@ -4410,10 +4377,10 @@ PHP_METHOD(DatePeriod, __construct)
dpobj->start_ce = date_ce_date;
} else {
/* init */
- intobj = (php_interval_obj *) zend_object_store_get_object(interval TSRMLS_CC);
+ intobj = (php_interval_obj *) Z_OBJ_P(interval);
/* start date */
- dateobj = (php_date_obj *) zend_object_store_get_object(start TSRMLS_CC);
+ dateobj = (php_date_obj *) Z_OBJ_P(start);
clone = timelib_time_ctor();
memcpy(clone, dateobj->time, sizeof(timelib_time));
if (dateobj->time->tz_abbr) {
@@ -4430,7 +4397,7 @@ PHP_METHOD(DatePeriod, __construct)
/* end date */
if (end) {
- dateobj = (php_date_obj *) zend_object_store_get_object(end TSRMLS_CC);
+ dateobj = (php_date_obj *) Z_OBJ_P(end);
clone = timelib_time_clone(dateobj->time);
dpobj->end = clone;
}
@@ -4512,7 +4479,7 @@ PHP_FUNCTION(timezone_version_get)
const timelib_tzdb *tzdb;
tzdb = DATE_TIMEZONEDB;
- RETURN_STRING(tzdb->version, 1);
+ RETURN_STRING(tzdb->version);
}
/* }}} */
@@ -4522,31 +4489,30 @@ PHP_FUNCTION(timezone_version_get)
PHP_FUNCTION(timezone_abbreviations_list)
{
const timelib_tz_lookup_table *table, *entry;
- zval *element, **abbr_array_pp, *abbr_array;
+ zval element, *abbr_array_p, abbr_array;
table = timelib_timezone_abbreviations_list();
array_init(return_value);
entry = table;
do {
- MAKE_STD_ZVAL(element);
- array_init(element);
- add_assoc_bool(element, "dst", entry->type);
- add_assoc_long(element, "offset", entry->gmtoffset);
+ array_init(&element);
+ add_assoc_bool(&element, "dst", entry->type);
+ add_assoc_long(&element, "offset", entry->gmtoffset);
if (entry->full_tz_name) {
- add_assoc_string(element, "timezone_id", entry->full_tz_name, 1);
+ add_assoc_string(&element, "timezone_id", entry->full_tz_name, 1);
} else {
- add_assoc_null(element, "timezone_id");
+ add_assoc_null(&element, "timezone_id");
}
- if (zend_hash_find(HASH_OF(return_value), entry->name, strlen(entry->name) + 1, (void **) &abbr_array_pp) == FAILURE) {
- MAKE_STD_ZVAL(abbr_array);
- array_init(abbr_array);
- add_assoc_zval(return_value, entry->name, abbr_array);
+ abbr_array_p = zend_hash_str_find(HASH_OF(return_value), entry->name, strlen(entry->name));
+ if (!abbr_array_p) {
+ array_init(&abbr_array);
+ add_assoc_zval(return_value, entry->name, &abbr_array);
} else {
- abbr_array = *abbr_array_pp;
+ ZVAL_COPY_VALUE(&abbr_array, abbr_array_p);
}
- add_next_index_zval(abbr_array, element);
+ add_next_index_zval(&abbr_array, &element);
entry++;
} while (entry->name);
}
@@ -4582,7 +4548,7 @@ PHP_FUNCTION(date_default_timezone_get)
timelib_tzinfo *default_tz;
default_tz = get_timezone_info(TSRMLS_C);
- RETVAL_STRING(default_tz->name, 1);
+ RETVAL_STRING(default_tz->name);
}
/* }}} */
@@ -4664,7 +4630,8 @@ static void php_do_date_sunrise_sunset(INTERNAL_FUNCTION_PARAMETERS, int calc_su
switch (retformat) {
case SUNFUNCS_RET_STRING:
spprintf(&retstr, 0, "%02d:%02d", (int) N, (int) (60 * (N - (int) N)));
- RETURN_STRINGL(retstr, 5, 0);
+//??? RETURN_STRINGL(retstr, 5, 0);
+ RETURN_STRINGL(retstr, 5);
break;
case SUNFUNCS_RET_DOUBLE:
RETURN_DOUBLE(N);
@@ -4794,7 +4761,7 @@ PHP_FUNCTION(date_sun_info)
}
/* }}} */
-static HashTable *date_object_get_gc_period(zval *object, zval ***table, int *n TSRMLS_DC)
+static HashTable *date_object_get_gc_period(zval *object, zval **table, int *n TSRMLS_DC)
{
*table = NULL;
*n = 0;
@@ -4804,10 +4771,10 @@ static HashTable *date_object_get_gc_period(zval *object, zval ***table, int *n
static HashTable *date_object_get_properties_period(zval *object TSRMLS_DC)
{
HashTable *props;
- zval *zv;
+ zval zv;
php_period_obj *period_obj;
- period_obj = zend_object_store_get_object(object TSRMLS_CC);
+ period_obj = (php_period_obj*)Z_OBJ_P(object);
props = zend_std_get_properties(object TSRMLS_CC);
@@ -4815,110 +4782,108 @@ static HashTable *date_object_get_properties_period(zval *object TSRMLS_DC)
return props;
}
- MAKE_STD_ZVAL(zv);
if (period_obj->start) {
php_date_obj *date_obj;
- object_init_ex(zv, date_ce_date);
- date_obj = zend_object_store_get_object(zv TSRMLS_CC);
+ object_init_ex(&zv, date_ce_date);
+ date_obj = (php_date_obj*)Z_OBJ(zv);
date_obj->time = timelib_time_clone(period_obj->start);
} else {
- ZVAL_NULL(zv);
+ ZVAL_NULL(&zv);
}
- zend_hash_update(props, "start", sizeof("start"), &zv, sizeof(zv), NULL);
+ zend_hash_str_update(props, "start", sizeof("start")-1, &zv);
- MAKE_STD_ZVAL(zv);
if (period_obj->current) {
php_date_obj *date_obj;
- object_init_ex(zv, date_ce_date);
- date_obj = zend_object_store_get_object(zv TSRMLS_CC);
+ object_init_ex(&zv, date_ce_date);
+ date_obj = (php_date_obj*)Z_OBJ(zv);
date_obj->time = timelib_time_clone(period_obj->current);
} else {
- ZVAL_NULL(zv);
+ ZVAL_NULL(&zv);
}
- zend_hash_update(props, "current", sizeof("current"), &zv, sizeof(zv), NULL);
+ zend_hash_str_update(props, "current", sizeof("current")-1, &zv);
- MAKE_STD_ZVAL(zv);
if (period_obj->end) {
php_date_obj *date_obj;
- object_init_ex(zv, date_ce_date);
- date_obj = zend_object_store_get_object(zv TSRMLS_CC);
+ object_init_ex(&zv, date_ce_date);
+ date_obj = (php_date_obj*)Z_OBJ(zv);
date_obj->time = timelib_time_clone(period_obj->end);
} else {
- ZVAL_NULL(zv);
+ ZVAL_NULL(&zv);
}
- zend_hash_update(props, "end", sizeof("end"), &zv, sizeof(zv), NULL);
+ zend_hash_str_update(props, "end", sizeof("end")-1, &zv);
- MAKE_STD_ZVAL(zv);
if (period_obj->interval) {
php_interval_obj *interval_obj;
- object_init_ex(zv, date_ce_interval);
- interval_obj = zend_object_store_get_object(zv TSRMLS_CC);
+ object_init_ex(&zv, date_ce_interval);
+ interval_obj = (php_interval_obj*)Z_OBJ(zv);
interval_obj->diff = timelib_rel_time_clone(period_obj->interval);
interval_obj->initialized = 1;
} else {
- ZVAL_NULL(zv);
+ ZVAL_NULL(&zv);
}
- zend_hash_update(props, "interval", sizeof("interval"), &zv, sizeof(zv), NULL);
+ zend_hash_str_update(props, "interval", sizeof("interval")-1, &zv);
/* converted to larger type (int->long); must check when unserializing */
- MAKE_STD_ZVAL(zv);
- ZVAL_LONG(zv, (long) period_obj->recurrences);
- zend_hash_update(props, "recurrences", sizeof("recurrences"), &zv, sizeof(zv), NULL);
+ ZVAL_LONG(&zv, (long) period_obj->recurrences);
+ zend_hash_str_update(props, "recurrences", sizeof("recurrences")-1, &zv);
- MAKE_STD_ZVAL(zv);
- ZVAL_BOOL(zv, period_obj->include_start_date);
- zend_hash_update(props, "include_start_date", sizeof("include_start_date"), &zv, sizeof(zv), NULL);
+ ZVAL_BOOL(&zv, period_obj->include_start_date);
+ zend_hash_str_update(props, "include_start_date", sizeof("include_start_date")-1, &zv);
return props;
}
static int php_date_period_initialize_from_hash(php_period_obj *period_obj, HashTable *myht TSRMLS_DC)
{
- zval **ht_entry;
+ zval *ht_entry;
/* this function does no rollback on error */
- if (zend_hash_find(myht, "start", sizeof("start"), (void**) &ht_entry) == SUCCESS) {
- if (Z_TYPE_PP(ht_entry) == IS_OBJECT && Z_OBJCE_PP(ht_entry) == date_ce_date) {
+ ht_entry = zend_hash_str_find(myht, "start", sizeof("start")-1);
+ if (ht_entry) {
+ if (Z_TYPE_P(ht_entry) == IS_OBJECT && Z_OBJCE_P(ht_entry) == date_ce_date) {
php_date_obj *date_obj;
- date_obj = zend_object_store_get_object(*ht_entry TSRMLS_CC);
+ date_obj = (php_date_obj*)Z_OBJ_P(ht_entry);
period_obj->start = timelib_time_clone(date_obj->time);
- period_obj->start_ce = Z_OBJCE_PP(ht_entry);
- } else if (Z_TYPE_PP(ht_entry) != IS_NULL) {
+ period_obj->start_ce = Z_OBJCE_P(ht_entry);
+ } else if (Z_TYPE_P(ht_entry) != IS_NULL) {
return 0;
}
} else {
return 0;
}
- if (zend_hash_find(myht, "end", sizeof("end"), (void**) &ht_entry) == SUCCESS) {
- if (Z_TYPE_PP(ht_entry) == IS_OBJECT && Z_OBJCE_PP(ht_entry) == date_ce_date) {
+ ht_entry = zend_hash_str_find(myht, "end", sizeof("end")-1);
+ if (ht_entry) {
+ if (Z_TYPE_P(ht_entry) == IS_OBJECT && Z_OBJCE_P(ht_entry) == date_ce_date) {
php_date_obj *date_obj;
- date_obj = zend_object_store_get_object(*ht_entry TSRMLS_CC);
+ date_obj = (php_date_obj*)Z_OBJ_P(ht_entry);
period_obj->end = timelib_time_clone(date_obj->time);
- } else if (Z_TYPE_PP(ht_entry) != IS_NULL) {
+ } else if (Z_TYPE_P(ht_entry) != IS_NULL) {
return 0;
}
} else {
return 0;
}
- if (zend_hash_find(myht, "current", sizeof("current"), (void**) &ht_entry) == SUCCESS) {
- if (Z_TYPE_PP(ht_entry) == IS_OBJECT && Z_OBJCE_PP(ht_entry) == date_ce_date) {
+ ht_entry = zend_hash_str_find(myht, "current", sizeof("current")-1);
+ if (ht_entry) {
+ if (Z_TYPE_P(ht_entry) == IS_OBJECT && Z_OBJCE_P(ht_entry) == date_ce_date) {
php_date_obj *date_obj;
- date_obj = zend_object_store_get_object(*ht_entry TSRMLS_CC);
+ date_obj = (php_date_obj*)Z_OBJ_P(ht_entry);
period_obj->current = timelib_time_clone(date_obj->time);
- } else if (Z_TYPE_PP(ht_entry) != IS_NULL) {
+ } else if (Z_TYPE_P(ht_entry) != IS_NULL) {
return 0;
}
} else {
return 0;
}
- if (zend_hash_find(myht, "interval", sizeof("interval"), (void**) &ht_entry) == SUCCESS) {
- if (Z_TYPE_PP(ht_entry) == IS_OBJECT && Z_OBJCE_PP(ht_entry) == date_ce_interval) {
+ ht_entry = zend_hash_str_find(myht, "interval", sizeof("interval")-1);
+ if (ht_entry) {
+ if (Z_TYPE_P(ht_entry) == IS_OBJECT && Z_OBJCE_P(ht_entry) == date_ce_interval) {
php_interval_obj *interval_obj;
- interval_obj = zend_object_store_get_object(*ht_entry TSRMLS_CC);
+ interval_obj = (php_interval_obj*)Z_OBJ_P(ht_entry);
period_obj->interval = timelib_rel_time_clone(interval_obj->diff);
} else { /* interval is required */
return 0;
@@ -4927,16 +4892,18 @@ static int php_date_period_initialize_from_hash(php_period_obj *period_obj, Hash
return 0;
}
- if (zend_hash_find(myht, "recurrences", sizeof("recurrences"), (void**) &ht_entry) == SUCCESS &&
- Z_TYPE_PP(ht_entry) == IS_LONG && Z_LVAL_PP(ht_entry) >= 0 && Z_LVAL_PP(ht_entry) <= INT_MAX) {
- period_obj->recurrences = Z_LVAL_PP(ht_entry);
+ ht_entry = zend_hash_str_find(myht, "recurrences", sizeof("recurrences")-1);
+ if (ht_entry &&
+ Z_TYPE_P(ht_entry) == IS_LONG && Z_LVAL_P(ht_entry) >= 0 && Z_LVAL_P(ht_entry) <= INT_MAX) {
+ period_obj->recurrences = Z_LVAL_P(ht_entry);
} else {
return 0;
}
- if (zend_hash_find(myht, "include_start_date", sizeof("include_start_date"), (void**) &ht_entry) == SUCCESS &&
- Z_TYPE_PP(ht_entry) == IS_BOOL) {
- period_obj->include_start_date = Z_BVAL_PP(ht_entry);
+ ht_entry = zend_hash_str_find(myht, "include_start_date", sizeof("include_start_date")-1);
+ if (ht_entry &&
+ Z_TYPE_P(ht_entry) == IS_BOOL) {
+ period_obj->include_start_date = Z_BVAL_P(ht_entry);
} else {
return 0;
}
@@ -4961,7 +4928,7 @@ PHP_METHOD(DatePeriod, __set_state)
myht = Z_ARRVAL_P(array);
object_init_ex(return_value, date_ce_period);
- period_obj = zend_object_store_get_object(return_value TSRMLS_CC);
+ period_obj = (php_period_obj*)Z_OBJ_P(return_value);
if (!php_date_period_initialize_from_hash(period_obj, myht TSRMLS_CC)) {
php_error(E_ERROR, "Invalid serialization data for DatePeriod object");
}
@@ -4976,7 +4943,7 @@ PHP_METHOD(DatePeriod, __wakeup)
php_period_obj *period_obj;
HashTable *myht;
- period_obj = zend_object_store_get_object(object TSRMLS_CC);
+ period_obj = (php_period_obj*)Z_OBJ_P(object);
myht = Z_OBJPROP_P(object);
@@ -4999,10 +4966,8 @@ static zval *date_period_read_property(zval *object, zval *member, int type, con
zv = std_object_handlers.read_property(object, member, type, key TSRMLS_CC);
if (Z_TYPE_P(zv) == IS_OBJECT && Z_OBJ_HANDLER_P(zv, clone_obj)) {
/* defensive copy */
- zend_object_value zov = Z_OBJ_HANDLER_P(zv, clone_obj)(zv TSRMLS_CC);
- MAKE_STD_ZVAL(zv);
- Z_TYPE_P(zv) = IS_OBJECT;
- Z_OBJVAL_P(zv) = zov;
+//??? MAKE_STD_ZVAL(zv);
+ ZVAL_OBJ(zv, Z_OBJ_HANDLER_P(zv, clone_obj)(zv TSRMLS_CC));
}
return zv;
diff --git a/ext/dom/php_dom.c b/ext/dom/php_dom.c
index bfe966bd82..f2c9afd6b3 100644
--- a/ext/dom/php_dom.c
+++ b/ext/dom/php_dom.c
@@ -671,7 +671,7 @@ PHP_MINIT_FUNCTION(dom)
zend_hash_init(&classes, 0, NULL, NULL, 1);
INIT_CLASS_ENTRY(ce, "DOMException", php_dom_domexception_class_functions);
- dom_domexception_class_entry = zend_register_internal_class_ex(&ce, zend_exception_get_default(TSRMLS_C), NULL TSRMLS_CC);
+ dom_domexception_class_entry = zend_register_internal_class_ex(&ce, zend_exception_get_default(TSRMLS_C) TSRMLS_CC);
dom_domexception_class_entry->ce_flags |= ZEND_ACC_FINAL;
zend_declare_property_long(dom_domexception_class_entry, "code", sizeof("code")-1, 0, ZEND_ACC_PUBLIC TSRMLS_CC);
@@ -760,7 +760,7 @@ PHP_MINIT_FUNCTION(dom)
INIT_CLASS_ENTRY(ce, "DOMNodeList", php_dom_nodelist_class_functions);
ce.create_object = dom_nnodemap_objects_new;
- dom_nodelist_class_entry = zend_register_internal_class_ex(&ce, NULL, NULL TSRMLS_CC);
+ dom_nodelist_class_entry = zend_register_internal_class_ex(&ce, NULL TSRMLS_CC);
dom_nodelist_class_entry->get_iterator = php_dom_get_iterator;
zend_class_implements(dom_nodelist_class_entry TSRMLS_CC, 1, zend_ce_traversable);
@@ -770,7 +770,7 @@ PHP_MINIT_FUNCTION(dom)
INIT_CLASS_ENTRY(ce, "DOMNamedNodeMap", php_dom_namednodemap_class_functions);
ce.create_object = dom_nnodemap_objects_new;
- dom_namednodemap_class_entry = zend_register_internal_class_ex(&ce, NULL, NULL TSRMLS_CC);
+ dom_namednodemap_class_entry = zend_register_internal_class_ex(&ce, NULL TSRMLS_CC);
dom_namednodemap_class_entry->get_iterator = php_dom_get_iterator;
zend_class_implements(dom_namednodemap_class_entry TSRMLS_CC, 1, zend_ce_traversable);
@@ -898,7 +898,7 @@ PHP_MINIT_FUNCTION(dom)
#if defined(LIBXML_XPATH_ENABLED)
INIT_CLASS_ENTRY(ce, "DOMXPath", php_dom_xpath_class_functions);
ce.create_object = dom_xpath_objects_new;
- dom_xpath_class_entry = zend_register_internal_class_ex(&ce, NULL, NULL TSRMLS_CC);
+ dom_xpath_class_entry = zend_register_internal_class_ex(&ce, NULL TSRMLS_CC);
zend_hash_init(&dom_xpath_prop_handlers, 0, NULL, NULL, 1);
dom_register_prop_handler(&dom_xpath_prop_handlers, "document", dom_xpath_document_read, NULL TSRMLS_CC);
diff --git a/ext/dom/php_dom.h b/ext/dom/php_dom.h
index f2bccf7b87..e0de45b0d3 100644
--- a/ext/dom/php_dom.h
+++ b/ext/dom/php_dom.h
@@ -127,7 +127,7 @@ int dom_set_doc_classmap(php_libxml_ref_obj *document, zend_class_entry *basece,
#define REGISTER_DOM_CLASS(ce, name, parent_ce, funcs, entry) \
INIT_CLASS_ENTRY(ce, name, funcs); \
ce.create_object = dom_objects_new; \
-entry = zend_register_internal_class_ex(&ce, parent_ce, NULL TSRMLS_CC);
+entry = zend_register_internal_class_ex(&ce, parent_ce TSRMLS_CC);
#define DOM_GET_OBJ(__ptr, __id, __prtype, __intern) { \
__intern = (dom_object *)zend_object_store_get_object(__id TSRMLS_CC); \
diff --git a/ext/ereg/ereg.c b/ext/ereg/ereg.c
index 20f967feb9..c5ad085bfa 100644
--- a/ext/ereg/ereg.c
+++ b/ext/ereg/ereg.c
@@ -105,14 +105,14 @@ ZEND_GET_MODULE(ereg)
/* {{{ ereg_lru_cmp */
static int ereg_lru_cmp(const void *a, const void *b TSRMLS_DC)
{
- Bucket *f = *((Bucket **) a);
- Bucket *s = *((Bucket **) b);
+ Bucket *f = (Bucket *) a;
+ Bucket *s = (Bucket *) b;
- if (((reg_cache *)f->pData)->lastuse <
- ((reg_cache *)s->pData)->lastuse) {
+ if (((reg_cache *)Z_PTR(f->val))->lastuse <
+ ((reg_cache *)Z_PTR(s->val))->lastuse) {
return -1;
- } else if (((reg_cache *)f->pData)->lastuse ==
- ((reg_cache *)s->pData)->lastuse) {
+ } else if (((reg_cache *)Z_PTR(f->val))->lastuse ==
+ ((reg_cache *)Z_PTR(s->val))->lastuse) {
return 0;
} else {
return 1;
@@ -121,7 +121,7 @@ static int ereg_lru_cmp(const void *a, const void *b TSRMLS_DC)
/* }}} */
/* {{{ static ereg_clean_cache */
-static int ereg_clean_cache(void *data, void *arg TSRMLS_DC)
+static int ereg_clean_cache(zval *data, void *arg TSRMLS_DC)
{
int *num_clean = (int *)arg;
@@ -153,7 +153,8 @@ static int _php_regcomp(regex_t *preg, const char *pattern, int cflags TSRMLS_DC
}
}
- if(zend_hash_find(&EREG(ht_rc), (char *) pattern, patlen+1, (void **) &rc) == SUCCESS
+ rc = zend_hash_str_find_ptr(&EREG(ht_rc), pattern, patlen);
+ if (rc
&& rc->cflags == cflags) {
#ifdef HAVE_REGEX_T_RE_MAGIC
/*
@@ -182,8 +183,8 @@ static int _php_regcomp(regex_t *preg, const char *pattern, int cflags TSRMLS_DC
* it's good.
*/
if (!reg_magic) reg_magic = preg->re_magic;
- zend_hash_update(&EREG(ht_rc), (char *) pattern, patlen+1,
- (void *) &rcp, sizeof(rcp), NULL);
+ zend_hash_str_update_mem(&EREG(ht_rc), pattern, patlen,
+ &rcp, sizeof(rcp));
}
#else
memcpy(preg, &rc->preg, sizeof(*preg));
@@ -195,8 +196,8 @@ static int _php_regcomp(regex_t *preg, const char *pattern, int cflags TSRMLS_DC
rcp.cflags = cflags;
rcp.lastuse = ++(EREG(lru_counter));
memcpy(&rcp.preg, preg, sizeof(*preg));
- zend_hash_update(&EREG(ht_rc), (char *) pattern, patlen+1,
- (void *) &rcp, sizeof(rcp), NULL);
+ zend_hash_str_update_mem(&EREG(ht_rc), pattern, patlen,
+ &rcp, sizeof(rcp));
}
}
#endif
@@ -204,8 +205,9 @@ static int _php_regcomp(regex_t *preg, const char *pattern, int cflags TSRMLS_DC
}
/* }}} */
-static void _free_ereg_cache(reg_cache *rc)
+static void _free_ereg_cache(zval *zv)
{
+ reg_cache *rc = Z_PTR_P(zv);
regfree(&rc->preg);
}
@@ -218,7 +220,7 @@ static void _free_ereg_cache(reg_cache *rc)
*/
static PHP_GINIT_FUNCTION(ereg)
{
- zend_hash_init(&ereg_globals->ht_rc, 0, NULL, (void (*)(void *)) _free_ereg_cache, 1);
+ zend_hash_init(&ereg_globals->ht_rc, 0, NULL, _free_ereg_cache, 1);
ereg_globals->lru_counter = 0;
}
/* }}} */
@@ -279,8 +281,8 @@ static void php_ereg_eprint(int err, regex_t *re TSRMLS_DC) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", message);
}
- STR_FREE(buf);
- STR_FREE(message);
+ if (buf) efree(buf);
+ if (message) efree(message);
}
/* }}} */
@@ -288,8 +290,8 @@ static void php_ereg_eprint(int err, regex_t *re TSRMLS_DC) {
*/
static void php_ereg(INTERNAL_FUNCTION_PARAMETERS, int icase)
{
- zval **regex, /* Regular expression */
- **array = NULL; /* Optional register array */
+ zval *regex, /* Regular expression */
+ *array = NULL; /* Optional register array */
char *findin; /* String to apply expression to */
int findin_len;
regex_t re;
@@ -302,7 +304,7 @@ static void php_ereg(INTERNAL_FUNCTION_PARAMETERS, int icase)
char *string = NULL;
int argc = ZEND_NUM_ARGS();
- if (zend_parse_parameters(argc TSRMLS_CC, "Zs|Z", &regex, &findin, &findin_len, &array) == FAILURE) {
+ if (zend_parse_parameters(argc TSRMLS_CC, "zs|z", &regex, &findin, &findin_len, &array) == FAILURE) {
return;
}
@@ -315,16 +317,16 @@ static void php_ereg(INTERNAL_FUNCTION_PARAMETERS, int icase)
}
/* compile the regular expression from the supplied regex */
- if (Z_TYPE_PP(regex) == IS_STRING) {
- err = regcomp(&re, Z_STRVAL_PP(regex), REG_EXTENDED | copts);
+ if (Z_TYPE_P(regex) == IS_STRING) {
+ err = regcomp(&re, Z_STRVAL_P(regex), REG_EXTENDED | copts);
} else {
/* we convert numbers to integers and treat them as a string */
- if (Z_TYPE_PP(regex) == IS_DOUBLE) {
+ if (Z_TYPE_P(regex) == IS_DOUBLE) {
convert_to_long_ex(regex); /* get rid of decimal places */
}
convert_to_string_ex(regex);
/* don't bother doing an extended regex with just a number */
- err = regcomp(&re, Z_STRVAL_PP(regex), copts);
+ err = regcomp(&re, Z_STRVAL_P(regex), copts);
}
if (err) {
@@ -354,16 +356,16 @@ static void php_ereg(INTERNAL_FUNCTION_PARAMETERS, int icase)
buf = emalloc(string_len);
- zval_dtor(*array); /* start with clean array */
- array_init(*array);
+ zval_dtor(array); /* start with clean array */
+ array_init(array);
for (i = 0; i <= re.re_nsub; i++) {
start = subs[i].rm_so;
end = subs[i].rm_eo;
if (start != -1 && end > 0 && start < string_len && end < string_len && start < end) {
- add_index_stringl(*array, i, string+start, end-start, 1);
+ add_index_stringl(array, i, string+start, end-start, 1);
} else {
- add_index_bool(*array, i, 0);
+ add_index_bool(array, i, 0);
}
}
efree(buf);
@@ -549,62 +551,61 @@ PHP_EREG_API char *php_ereg_replace(const char *pattern, const char *replace, co
*/
static void php_do_ereg_replace(INTERNAL_FUNCTION_PARAMETERS, int icase)
{
- zval **arg_pattern,
- **arg_replace;
- char *pattern, *arg_string;
- char *string;
- char *replace;
+ zval *arg_pattern,
+ *arg_replace;
+ zend_string *pattern, *arg_string;
+ zend_string *string;
+ zend_string *replace;
char *ret;
- int arg_string_len;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ZZs", &arg_pattern, &arg_replace, &arg_string, &arg_string_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zzS", &arg_pattern, &arg_replace, &arg_string) == FAILURE) {
return;
}
- if (Z_TYPE_PP(arg_pattern) == IS_STRING) {
- if (Z_STRVAL_PP(arg_pattern) && Z_STRLEN_PP(arg_pattern)) {
- pattern = estrndup(Z_STRVAL_PP(arg_pattern), Z_STRLEN_PP(arg_pattern));
+ if (Z_TYPE_P(arg_pattern) == IS_STRING) {
+ if (Z_STRVAL_P(arg_pattern) && Z_STRLEN_P(arg_pattern)) {
+ pattern = STR_COPY(Z_STR_P(arg_pattern));
} else {
pattern = STR_EMPTY_ALLOC();
}
} else {
convert_to_long_ex(arg_pattern);
- pattern = emalloc(2);
- pattern[0] = (char) Z_LVAL_PP(arg_pattern);
- pattern[1] = '\0';
+ pattern = STR_ALLOC(1, 0);
+ pattern->val[0] = (char) Z_LVAL_P(arg_pattern);
+ pattern->val[1] = '\0';
}
- if (Z_TYPE_PP(arg_replace) == IS_STRING) {
- if (Z_STRVAL_PP(arg_replace) && Z_STRLEN_PP(arg_replace)) {
- replace = estrndup(Z_STRVAL_PP(arg_replace), Z_STRLEN_PP(arg_replace));
+ if (Z_TYPE_P(arg_replace) == IS_STRING) {
+ if (Z_STRVAL_P(arg_replace) && Z_STRLEN_P(arg_replace)) {
+ replace = STR_COPY(Z_STR_P(arg_replace));
} else {
replace = STR_EMPTY_ALLOC();
}
} else {
convert_to_long_ex(arg_replace);
- replace = emalloc(2);
- replace[0] = (char) Z_LVAL_PP(arg_replace);
- replace[1] = '\0';
+ replace = STR_ALLOC(1, 0);
+ replace->val[0] = (char) Z_LVAL_P(arg_replace);
+ replace->val[1] = '\0';
}
- if (arg_string && arg_string_len) {
- string = estrndup(arg_string, arg_string_len);
+ if (arg_string) {
+ string = STR_COPY(arg_string);
} else {
string = STR_EMPTY_ALLOC();
}
/* do the actual work */
- ret = php_ereg_replace(pattern, replace, string, icase, 1 TSRMLS_CC);
+ ret = php_ereg_replace(pattern->val, replace->val, string->val, icase, 1 TSRMLS_CC);
if (ret == (char *) -1) {
RETVAL_FALSE;
} else {
- RETVAL_STRING(ret, 1);
- STR_FREE(ret);
+ RETVAL_STRING(ret);
+ efree(ret);
}
- STR_FREE(string);
- STR_FREE(replace);
- STR_FREE(pattern);
+ STR_RELEASE(string);
+ STR_RELEASE(replace);
+ STR_RELEASE(pattern);
}
/* }}} */
@@ -754,7 +755,7 @@ PHP_EREG_API PHP_FUNCTION(sql_regcase)
}
tmp[j] = 0;
- RETVAL_STRINGL(tmp, j, 1);
+ RETVAL_STRINGL(tmp, j);
efree(tmp);
}
/* }}} */
diff --git a/ext/intl/breakiterator/breakiterator_class.cpp b/ext/intl/breakiterator/breakiterator_class.cpp
index 7ca7e94c95..b6b47348f0 100644
--- a/ext/intl/breakiterator/breakiterator_class.cpp
+++ b/ext/intl/breakiterator/breakiterator_class.cpp
@@ -386,12 +386,12 @@ U_CFUNC void breakiterator_register_BreakIterator_class(TSRMLS_D)
INIT_CLASS_ENTRY(ce, "IntlRuleBasedBreakIterator",
RuleBasedBreakIterator_class_functions);
RuleBasedBreakIterator_ce_ptr = zend_register_internal_class_ex(&ce,
- BreakIterator_ce_ptr, NULL TSRMLS_CC);
+ BreakIterator_ce_ptr TSRMLS_CC);
/* Create and register 'CodePointBreakIterator' class. */
INIT_CLASS_ENTRY(ce, "IntlCodePointBreakIterator",
CodePointBreakIterator_class_functions);
CodePointBreakIterator_ce_ptr = zend_register_internal_class_ex(&ce,
- BreakIterator_ce_ptr, NULL TSRMLS_CC);
+ BreakIterator_ce_ptr TSRMLS_CC);
}
/* }}} */
diff --git a/ext/intl/breakiterator/breakiterator_iterators.cpp b/ext/intl/breakiterator/breakiterator_iterators.cpp
index 3748991aed..55112c1f5a 100644
--- a/ext/intl/breakiterator/breakiterator_iterators.cpp
+++ b/ext/intl/breakiterator/breakiterator_iterators.cpp
@@ -323,7 +323,7 @@ U_CFUNC void breakiterator_register_IntlPartsIterator_class(TSRMLS_D)
/* Create and register 'BreakIterator' class. */
INIT_CLASS_ENTRY(ce, "IntlPartsIterator", IntlPartsIterator_class_functions);
IntlPartsIterator_ce_ptr = zend_register_internal_class_ex(&ce,
- IntlIterator_ce_ptr, NULL TSRMLS_CC);
+ IntlIterator_ce_ptr TSRMLS_CC);
IntlPartsIterator_ce_ptr->create_object = IntlPartsIterator_object_create;
memcpy(&IntlPartsIterator_handlers, &IntlIterator_handlers,
diff --git a/ext/intl/calendar/calendar_class.cpp b/ext/intl/calendar/calendar_class.cpp
index e13425097d..497279e090 100644
--- a/ext/intl/calendar/calendar_class.cpp
+++ b/ext/intl/calendar/calendar_class.cpp
@@ -490,7 +490,7 @@ void calendar_register_IntlCalendar_class(TSRMLS_D)
/* Create and register 'IntlGregorianCalendar' class. */
INIT_CLASS_ENTRY(ce, "IntlGregorianCalendar", GregorianCalendar_class_functions);
GregorianCalendar_ce_ptr = zend_register_internal_class_ex(&ce,
- Calendar_ce_ptr, NULL TSRMLS_CC);
+ Calendar_ce_ptr TSRMLS_CC);
if (!GregorianCalendar_ce_ptr) {
//can't happen know without bigger problems before
php_error_docref0(NULL TSRMLS_CC, E_ERROR,
diff --git a/ext/intl/collator/collator_sort.c b/ext/intl/collator/collator_sort.c
index 04a24f013e..24c8daf7fe 100644
--- a/ext/intl/collator/collator_sort.c
+++ b/ext/intl/collator/collator_sort.c
@@ -215,8 +215,8 @@ static int collator_compare_func( const void* a, const void* b TSRMLS_DC )
zval *first;
zval *second;
- f = *((Bucket **) a);
- s = *((Bucket **) b);
+ f = (Bucket *) a;
+ s = (Bucket *) b;
first = *((zval **) f->pData);
second = *((zval **) s->pData);
diff --git a/ext/intl/intl_error.c b/ext/intl/intl_error.c
index 99b1c6001c..c76591ba56 100644
--- a/ext/intl/intl_error.c
+++ b/ext/intl/intl_error.c
@@ -240,7 +240,7 @@ void intl_register_IntlException_class( TSRMLS_D )
/* Create and register 'IntlException' class. */
INIT_CLASS_ENTRY_EX( ce, "IntlException", sizeof( "IntlException" ) - 1, NULL );
IntlException_ce_ptr = zend_register_internal_class_ex( &ce,
- default_exception_ce, NULL TSRMLS_CC );
+ default_exception_ce TSRMLS_CC );
IntlException_ce_ptr->create_object = default_exception_ce->create_object;
}
diff --git a/ext/mysql/php_mysql.c b/ext/mysql/php_mysql.c
index 3d092b2d6a..a00e98fbbc 100644
--- a/ext/mysql/php_mysql.c
+++ b/ext/mysql/php_mysql.c
@@ -2176,14 +2176,15 @@ static void php_mysql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, long result_type,
if (ctor_params && Z_TYPE_P(ctor_params) != IS_NULL) {
if (Z_TYPE_P(ctor_params) == IS_ARRAY) {
HashTable *htl = Z_ARRVAL_P(ctor_params);
+ uint idx;
Bucket *p;
fci.param_count = 0;
fci.params = safe_emalloc(sizeof(zval*), htl->nNumOfElements, 0);
- p = htl->pListHead;
- while (p != NULL) {
- fci.params[fci.param_count++] = (zval**)p->pData;
- p = p->pListNext;
+ for (idx = 0; idx < htl->nNumUsed; idx++) {
+ p = htl->arData + idx;
+ if (!p->xData) continue;
+ fci.params[fci.param_count++] = (zval**)&p->xData;
}
} else {
/* Two problems why we throw exceptions here: PHP is typeless
diff --git a/ext/mysqli/mysqli.c b/ext/mysqli/mysqli.c
index 929f776a43..7785fff58a 100644
--- a/ext/mysqli/mysqli.c
+++ b/ext/mysqli/mysqli.c
@@ -634,9 +634,9 @@ PHP_MINIT_FUNCTION(mysqli)
INIT_CLASS_ENTRY(cex, "mysqli_sql_exception", mysqli_exception_methods);
#ifdef HAVE_SPL
- mysqli_exception_class_entry = zend_register_internal_class_ex(&cex, spl_ce_RuntimeException, NULL TSRMLS_CC);
+ mysqli_exception_class_entry = zend_register_internal_class_ex(&cex, spl_ce_RuntimeException TSRMLS_CC);
#else
- mysqli_exception_class_entry = zend_register_internal_class_ex(&cex, zend_exception_get_default(TSRMLS_C), NULL TSRMLS_CC);
+ mysqli_exception_class_entry = zend_register_internal_class_ex(&cex, zend_exception_get_default(TSRMLS_C) TSRMLS_CC);
#endif
mysqli_exception_class_entry->ce_flags |= ZEND_ACC_FINAL;
zend_declare_property_long(mysqli_exception_class_entry, "code", sizeof("code")-1, 0, ZEND_ACC_PROTECTED TSRMLS_CC);
@@ -1290,14 +1290,15 @@ void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int override_flags
if (ctor_params && Z_TYPE_P(ctor_params) != IS_NULL) {
if (Z_TYPE_P(ctor_params) == IS_ARRAY) {
HashTable *params_ht = Z_ARRVAL_P(ctor_params);
+ uint idx;
Bucket *p;
fci.param_count = 0;
fci.params = safe_emalloc(sizeof(zval*), params_ht->nNumOfElements, 0);
- p = params_ht->pListHead;
- while (p != NULL) {
- fci.params[fci.param_count++] = (zval**)p->pData;
- p = p->pListNext;
+ for (idx = 0; idx < params_ht->nNumUsed; idx++) {
+ p = params_ht->arData + idx;
+ if (!p->xData) continue;
+ fci.params[fci.param_count++] = (zval**)&p->xData;
}
} else {
/* Two problems why we throw exceptions here: PHP is typeless
diff --git a/ext/mysqlnd/mysqlnd_plugin.c b/ext/mysqlnd/mysqlnd_plugin.c
index 86543a05c2..702d591c3e 100644
--- a/ext/mysqlnd/mysqlnd_plugin.c
+++ b/ext/mysqlnd/mysqlnd_plugin.c
@@ -173,16 +173,18 @@ PHPAPI void _mysqlnd_plugin_apply_with_argument(apply_func_arg_t apply_func, voi
* zend_hash_apply_with_argument nor zend_hash_internal_pointer_reset and
* friends
*/
+ uint idx;
Bucket *p;
+ int result;
- p = mysqlnd_registered_plugins.pListHead;
- while (p != NULL) {
- int result = apply_func(p->pData, argument TSRMLS_CC);
+ for (idx = 0; idx < mysqlnd_registered_plugins.nNumUsed; idx++) {
+ p = mysqlnd_registered_plugins.arData + idx;
+ if (!p->xData) continue;
+ result = apply_func(HASH_DATA(&mysqlnd_registered_plugins, p), argument TSRMLS_CC);
if (result & ZEND_HASH_APPLY_REMOVE) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "mysqlnd_plugin_apply_with_argument must not remove table entries");
}
- p = p->pListNext;
if (result & ZEND_HASH_APPLY_STOP) {
break;
}
diff --git a/ext/mysqlnd/mysqlnd_reverse_api.c b/ext/mysqlnd/mysqlnd_reverse_api.c
index cd490fa62c..18a2634f25 100644
--- a/ext/mysqlnd/mysqlnd_reverse_api.c
+++ b/ext/mysqlnd/mysqlnd_reverse_api.c
@@ -60,7 +60,7 @@ mysqlnd_reverse_api_get_api_list(TSRMLS_D)
PHPAPI void
mysqlnd_reverse_api_register_api(MYSQLND_REVERSE_API * apiext TSRMLS_DC)
{
- zend_hash_add(&mysqlnd_api_ext_ht, apiext->module->name, strlen(apiext->module->name) + 1, &apiext,
+ zend_hash_add(&mysqlnd_api_ext_ht, apiext->module->name, strlen(apiext->module->name) + 1, apiext,
sizeof(MYSQLND_REVERSE_API), NULL);
}
/* }}} */
diff --git a/ext/mysqlnd/php_mysqlnd.c b/ext/mysqlnd/php_mysqlnd.c
index 7712f1ecb8..cfa2b1f8fc 100644
--- a/ext/mysqlnd/php_mysqlnd.c
+++ b/ext/mysqlnd/php_mysqlnd.c
@@ -107,17 +107,17 @@ static void
mysqlnd_minfo_dump_api_plugins(smart_str * buffer TSRMLS_DC)
{
HashTable *ht = mysqlnd_reverse_api_get_api_list(TSRMLS_C);
+ uint idx;
Bucket *p;
- p = ht->pListHead;
- while(p != NULL) {
- MYSQLND_REVERSE_API * ext = *(MYSQLND_REVERSE_API **) p->pData;
+ for (idx = 0; idx < ht->nNumUsed; idx++) {
+ p = ht->arData + idx;
+ if (!p->xData) continue;
+ MYSQLND_REVERSE_API * ext = (MYSQLND_REVERSE_API *) p->xData;
if (buffer->len) {
smart_str_appendc(buffer, ',');
}
smart_str_appends(buffer, ext->module->name);
-
- p = p->pListNext;
}
}
/* }}} */
diff --git a/ext/opcache/Optimizer/compact_literals.c b/ext/opcache/Optimizer/compact_literals.c
index b29241344c..1604107f2c 100644
--- a/ext/opcache/Optimizer/compact_literals.c
+++ b/ext/opcache/Optimizer/compact_literals.c
@@ -283,6 +283,7 @@ static void optimizer_compact_literals(zend_op_array *op_array TSRMLS_DC)
/* Merge equal constants */
j = 0; cache_slots = 0;
zend_hash_init(&hash, 16, NULL, NULL, 0);
+ hash.flags |= HASH_FLAG_BIG_DATA;
map = (int*)ecalloc(op_array->last_literal, sizeof(int));
for (i = 0; i < op_array->last_literal; i++) {
if (!info[i].flags) {
diff --git a/ext/opcache/Optimizer/zend_optimizer.c b/ext/opcache/Optimizer/zend_optimizer.c
index 973ba3aaac..ce928f8db1 100644
--- a/ext/opcache/Optimizer/zend_optimizer.c
+++ b/ext/opcache/Optimizer/zend_optimizer.c
@@ -544,24 +544,29 @@ static void zend_accel_optimize(zend_op_array *op_array,
int zend_accel_script_optimize(zend_persistent_script *script TSRMLS_DC)
{
+ uint idx, j;
Bucket *p, *q;
HashTable *constants = NULL;
+ zend_class_entry *ce;
+ zend_op_array *op_array;
zend_accel_optimize(&script->main_op_array, script, &constants TSRMLS_CC);
- p = script->function_table.pListHead;
- while (p) {
- zend_op_array *op_array = (zend_op_array*)p->pData;
+ for (idx = 0; idx < script->function_table.nNumUsed; idx++) {
+ p = script->function_table.arData + idx;
+ if (!p->xData) continue;
+ op_array = (zend_op_array*)p->xData;
zend_accel_optimize(op_array, script, &constants TSRMLS_CC);
- p = p->pListNext;
}
- p = script->class_table.pListHead;
- while (p) {
- zend_class_entry *ce = (zend_class_entry*)p->pDataPtr;
- q = ce->function_table.pListHead;
- while (q) {
- zend_op_array *op_array = (zend_op_array*)q->pData;
+ for (idx = 0; idx < script->class_table.nNumUsed; idx++) {
+ p = script->class_table.arData + idx;
+ if (!p->xData) continue;
+ ce = (zend_class_entry*)p->xData;
+ for (j = 0; j < ce->function_table.nNumUsed; j++) {
+ q = ce->function_table.arData + j;
+ if (!q->xData) continue;
+ op_array = (zend_op_array*)q->xData;
if (op_array->scope == ce) {
zend_accel_optimize(op_array, script, &constants TSRMLS_CC);
} else if (op_array->type == ZEND_USER_FUNCTION) {
@@ -572,9 +577,7 @@ int zend_accel_script_optimize(zend_persistent_script *script TSRMLS_DC)
op_array->static_variables = ht;
}
}
- q = q->pListNext;
}
- p = p->pListNext;
}
if (constants) {
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
index d1c9dfcd35..f28972461f 100644
--- a/ext/opcache/ZendAccelerator.c
+++ b/ext/opcache/ZendAccelerator.c
@@ -277,35 +277,34 @@ static void accel_interned_strings_restore_for_php(TSRMLS_D)
#ifndef ZTS
static void accel_interned_strings_restore_state(TSRMLS_D)
{
- unsigned int i;
-
- for (i = 0; i < ZCSG(interned_strings).nTableSize; i++) {
- ZCSG(interned_strings).arBuckets[i] = ZCSG(interned_strings_saved_state).arBuckets[i];
- if (ZCSG(interned_strings).arBuckets[i]) {
- ZCSG(interned_strings).arBuckets[i]->pLast = NULL;
- }
- }
- ZCSG(interned_strings).pListHead = ZCSG(interned_strings_saved_state).pListHead;
- ZCSG(interned_strings).pListTail = ZCSG(interned_strings_saved_state).pListTail;
- if (ZCSG(interned_strings).pListHead) {
- ZCSG(interned_strings).pListHead->pListLast = NULL;
- }
- if (ZCSG(interned_strings).pListTail) {
- ZCSG(interned_strings).pListTail->pListNext = NULL;
+ uint idx = ZCSG(interned_strings).nNumUsed;
+ uint nIndex;
+ Bucket *p;
+
+ ZCSG(interned_strings_top) = ZCSG(interned_strings_saved_top);
+ while (idx > 0) {
+ idx--;
+ p = ZCSG(interned_strings).arData + idx;
+ if ((char*)p->xData < ZCSG(interned_strings_top)) break;
+ ZCSG(interned_strings).nNumUsed--;
+ ZCSG(interned_strings).nNumOfElements--;
+
+ nIndex = p->h & ZCSG(interned_strings).nTableMask;
+ if (ZCSG(interned_strings).arHash[nIndex].idx == idx) {
+ ZCSG(interned_strings).arHash[nIndex].idx = p->next;
+ } else {
+ uint prev = ZCSG(interned_strings).arHash[nIndex].idx;
+ while (ZCSG(interned_strings).arData[prev].next != idx) {
+ prev = ZCSG(interned_strings).arData[prev].next;
+ }
+ ZCSG(interned_strings).arData[prev].next = p->next;
+ }
}
- ZCSG(interned_strings_top) = ZCSG(interned_strings_saved_state).top;
}
static void accel_interned_strings_save_state(TSRMLS_D)
{
- ZCSG(interned_strings_saved_state).arBuckets = (Bucket**)zend_shared_alloc(ZCSG(interned_strings).nTableSize * sizeof(Bucket *));
- if (!ZCSG(interned_strings_saved_state).arBuckets) {
- zend_accel_error(ACCEL_LOG_FATAL, "Insufficient shared memory!");
- }
- memcpy(ZCSG(interned_strings_saved_state).arBuckets, ZCSG(interned_strings).arBuckets, ZCSG(interned_strings).nTableSize * sizeof(Bucket *));
- ZCSG(interned_strings_saved_state).pListHead = ZCSG(interned_strings).pListHead;
- ZCSG(interned_strings_saved_state).pListTail = ZCSG(interned_strings).pListTail;
- ZCSG(interned_strings_saved_state).top = ZCSG(interned_strings_top);
+ ZCSG(interned_strings_saved_top) = ZCSG(interned_strings_top);
}
#endif
@@ -315,7 +314,9 @@ const char *accel_new_interned_string(const char *arKey, int nKeyLength, int fre
#ifndef ZTS
ulong h;
uint nIndex;
+ uint idx;
Bucket *p;
+ zend_string_info *info;
if (arKey >= ZCSG(interned_strings_start) && arKey < ZCSG(interned_strings_end)) {
/* this is already an interned string */
@@ -326,8 +327,9 @@ const char *accel_new_interned_string(const char *arKey, int nKeyLength, int fre
nIndex = h & ZCSG(interned_strings).nTableMask;
/* check for existing interned string */
- p = ZCSG(interned_strings).arBuckets[nIndex];
- while (p != NULL) {
+ idx = ZCSG(interned_strings).arHash[nIndex].idx;
+ while (idx != INVALID_IDX) {
+ p = ZCSG(interned_strings).arData + idx;
if ((p->h == h) && (p->nKeyLength == (uint)nKeyLength)) {
if (!memcmp(p->arKey, arKey, nKeyLength)) {
if (free_src) {
@@ -336,7 +338,7 @@ const char *accel_new_interned_string(const char *arKey, int nKeyLength, int fre
return p->arKey;
}
}
- p = p->pNext;
+ idx = p->next;
}
if (ZCSG(interned_strings_top) + ZEND_MM_ALIGNED_SIZE(sizeof(Bucket) + nKeyLength) >=
@@ -346,34 +348,19 @@ const char *accel_new_interned_string(const char *arKey, int nKeyLength, int fre
}
/* create new interning string in shared interned strings buffer */
- p = (Bucket *) ZCSG(interned_strings_top);
- ZCSG(interned_strings_top) += ZEND_MM_ALIGNED_SIZE(sizeof(Bucket) + nKeyLength);
-
- p->arKey = (char*)(p + 1);
- memcpy((char*)p->arKey, arKey, nKeyLength);
- p->nKeyLength = nKeyLength;
- p->h = h;
- p->pData = &p->pDataPtr;
- p->pDataPtr = p;
-
- p->pNext = ZCSG(interned_strings).arBuckets[nIndex];
- p->pLast = NULL;
- if (p->pNext) {
- p->pNext->pLast = p;
- }
- ZCSG(interned_strings).arBuckets[nIndex] = p;
-
- p->pListLast = ZCSG(interned_strings).pListTail;
- ZCSG(interned_strings).pListTail = p;
- p->pListNext = NULL;
- if (p->pListLast != NULL) {
- p->pListLast->pListNext = p;
- }
- if (!ZCSG(interned_strings).pListHead) {
- ZCSG(interned_strings).pListHead = p;
- }
+ info = (zend_string_info *) ZCSG(interned_strings_top);
+ ZCSG(interned_strings_top) += ZEND_MM_ALIGNED_SIZE(sizeof(zend_string_info) + nKeyLength);
+ memcpy((char*)(info + 1), arKey, nKeyLength);
+ idx = ZCSG(interned_strings).nNumUsed++;
ZCSG(interned_strings).nNumOfElements++;
+ p = ZCSG(interned_strings).arData + idx;
+ p->xData = info + 1;
+ p->h = h;
+ p->nKeyLength = nKeyLength;
+ p->next = ZCSG(interned_strings).arHash[nIndex].idx;
+ ZCSG(interned_strings).arHash[nIndex].idx = idx;
+ p->arKey = (const char*)(info + 1);
if (free_src) {
efree((char*)arKey);
@@ -389,6 +376,7 @@ const char *accel_new_interned_string(const char *arKey, int nKeyLength, int fre
/* Copy PHP interned strings from PHP process memory into the shared memory */
static void accel_use_shm_interned_strings(TSRMLS_D)
{
+ uint idx, j;
Bucket *p, *q;
#if ZEND_EXTENSION_API_NO > PHP_5_5_X_API_NO
@@ -397,18 +385,19 @@ static void accel_use_shm_interned_strings(TSRMLS_D)
#endif
/* function table hash keys */
- p = CG(function_table)->pListHead;
- while (p) {
+ for (idx = 0; idx < CG(function_table)->nNumUsed; idx++) {
+ p = CG(function_table)->arData + idx;
+ if (!p->xData) continue;
if (p->nKeyLength) {
p->arKey = accel_new_interned_string(p->arKey, p->nKeyLength, 0 TSRMLS_CC);
}
- p = p->pListNext;
}
/* class table hash keys, class names, properties, methods, constants, etc */
- p = CG(class_table)->pListHead;
- while (p) {
- zend_class_entry *ce = (zend_class_entry*)(p->pDataPtr);
+ for (idx = 0; idx < CG(class_table)->nNumUsed; idx++) {
+ p = CG(class_table)->arData + idx;
+ if (!p->xData) continue;
+ zend_class_entry *ce = (zend_class_entry*)(p->xData);
if (p->nKeyLength) {
p->arKey = accel_new_interned_string(p->arKey, p->nKeyLength, 0 TSRMLS_CC);
@@ -418,59 +407,62 @@ static void accel_use_shm_interned_strings(TSRMLS_D)
ce->name = accel_new_interned_string(ce->name, ce->name_length + 1, 0 TSRMLS_CC);
}
- q = ce->properties_info.pListHead;
- while (q) {
- zend_property_info *info = (zend_property_info*)(q->pData);
+ for (j = 0; j < ce->properties_info.nNumUsed; j++) {
+ zend_property_info *info;
- if (q->nKeyLength) {
+ q = ce->properties_info.arData + j;
+ if (!q->xData) continue;
+
+ info = (zend_property_info*)(q->xData);
+
+ if (q->nKeyLength) {
q->arKey = accel_new_interned_string(q->arKey, q->nKeyLength, 0 TSRMLS_CC);
}
if (info->name) {
info->name = accel_new_interned_string(info->name, info->name_length + 1, 0 TSRMLS_CC);
}
-
- q = q->pListNext;
}
- q = ce->function_table.pListHead;
- while (q) {
+ for (j = 0; j < ce->function_table.nNumUsed; j++) {
+ q = ce->function_table.arData + j;
+ if (!q->xData) continue;
if (q->nKeyLength) {
q->arKey = accel_new_interned_string(q->arKey, q->nKeyLength, 0 TSRMLS_CC);
}
- q = q->pListNext;
}
- q = ce->constants_table.pListHead;
- while (q) {
+ for (j = 0; j < ce->constants_table.nNumUsed; j++) {
+ q = ce->constants_table.arData + j;
+ if (!q->xData) continue;
if (q->nKeyLength) {
q->arKey = accel_new_interned_string(q->arKey, q->nKeyLength, 0 TSRMLS_CC);
}
- q = q->pListNext;
}
-
- p = p->pListNext;
}
/* constant hash keys */
- p = EG(zend_constants)->pListHead;
- while (p) {
+ for (idx = 0; idx < EG(zend_constants)->nNumUsed; idx++) {
+ p = EG(zend_constants)->arData + idx;
+ if (!p->xData) continue;
if (p->nKeyLength) {
p->arKey = accel_new_interned_string(p->arKey, p->nKeyLength, 0 TSRMLS_CC);
}
- p = p->pListNext;
}
/* auto globals hash keys and names */
- p = CG(auto_globals)->pListHead;
- while (p) {
- zend_auto_global *auto_global = (zend_auto_global*)p->pData;
+ for (idx = 0; idx < CG(auto_globals)->nNumUsed; idx++) {
+ zend_auto_global *auto_global;
+
+ p = CG(auto_globals)->arData + idx;
+ if (!p->xData) continue;
+
+ auto_global = (zend_auto_global*)p->xData;
auto_global->name = accel_new_interned_string(auto_global->name, auto_global->name_len + 1, 0 TSRMLS_CC);
if (p->nKeyLength) {
p->arKey = accel_new_interned_string(p->arKey, p->nKeyLength, 0 TSRMLS_CC);
}
- p = p->pListNext;
}
}
#endif
@@ -2190,11 +2182,13 @@ static void accel_activate(void)
static void accel_fast_hash_destroy(HashTable *ht)
{
- Bucket *p = ht->pListHead;
-
- while (p != NULL) {
- ht->pDestructor(p->pData);
- p = p->pListNext;
+ uint idx;
+ Bucket *p;
+
+ for (idx = 0; idx < ht->nNumUsed; idx++) {
+ p = ht->arData + idx;
+ if (!p->xData) continue;
+ ht->pDestructor(&p->xData);
}
}
@@ -2473,12 +2467,14 @@ static int zend_accel_init_shm(TSRMLS_D)
zend_hash_init(&ZCSG(interned_strings), (ZCG(accel_directives).interned_strings_buffer * 1024 * 1024) / (sizeof(Bucket) + sizeof(Bucket*) + 8 /* average string length */), NULL, NULL, 1);
if (ZCG(accel_directives).interned_strings_buffer) {
ZCSG(interned_strings).nTableMask = ZCSG(interned_strings).nTableSize - 1;
- ZCSG(interned_strings).arBuckets = zend_shared_alloc(ZCSG(interned_strings).nTableSize * sizeof(Bucket *));
+ ZCSG(interned_strings).arData = zend_shared_alloc(ZCSG(interned_strings).nTableSize * sizeof(Bucket));
+ ZCSG(interned_strings).arHash = (HashBucket*)zend_shared_alloc(ZCSG(interned_strings).nTableSize * sizeof(HashBucket));
ZCSG(interned_strings_start) = zend_shared_alloc((ZCG(accel_directives).interned_strings_buffer * 1024 * 1024));
- if (!ZCSG(interned_strings).arBuckets || !ZCSG(interned_strings_start)) {
+ if (!ZCSG(interned_strings).arData || !ZCSG(interned_strings_start)) {
zend_accel_error(ACCEL_LOG_FATAL, ACCELERATOR_PRODUCT_NAME " cannot allocate buffer for interned strings");
return FAILURE;
}
+ memset(ZCSG(interned_strings).arHash, INVALID_IDX, ZCSG(interned_strings).nTableSize * sizeof(HashBucket));
ZCSG(interned_strings_end) = ZCSG(interned_strings_start) + (ZCG(accel_directives).interned_strings_buffer * 1024 * 1024);
ZCSG(interned_strings_top) = ZCSG(interned_strings_start);
diff --git a/ext/opcache/ZendAccelerator.h b/ext/opcache/ZendAccelerator.h
index 169a751dc3..3b7c4a9cda 100644
--- a/ext/opcache/ZendAccelerator.h
+++ b/ext/opcache/ZendAccelerator.h
@@ -303,13 +303,8 @@ typedef struct _zend_accel_shared_globals {
char *interned_strings_start;
char *interned_strings_top;
char *interned_strings_end;
+ char *interned_strings_saved_top;
HashTable interned_strings;
- struct {
- Bucket **arBuckets;
- Bucket *pListHead;
- Bucket *pListTail;
- char *top;
- } interned_strings_saved_state;
#endif
} zend_accel_shared_globals;
diff --git a/ext/opcache/zend_accelerator_util_funcs.c b/ext/opcache/zend_accelerator_util_funcs.c
index 6204290efe..d3ab3d44f1 100644
--- a/ext/opcache/zend_accelerator_util_funcs.c
+++ b/ext/opcache/zend_accelerator_util_funcs.c
@@ -42,7 +42,7 @@ typedef int (*id_function_t)(void *, void *);
typedef void (*unique_copy_ctor_func_t)(void *pElement);
#if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
-static const Bucket *uninitialized_bucket = NULL;
+static const HashBucket uninitialized_bucket = {INVALID_IDX};
#endif
static int zend_prepare_function_for_execution(zend_op_array *op_array);
@@ -89,10 +89,13 @@ zend_persistent_script* create_persistent_script(void)
static int compact_hash_table(HashTable *ht)
{
uint i = 3;
+ uint j;
uint nSize;
- Bucket **t;
+ Bucket *d;
+ HashBucket *h;
+ Bucket *p;
- if (!ht->nNumOfElements) {
+ if (!ht->nNumOfElements || (ht->flags & HASH_FLAG_PACKED)) {
/* Empty tables don't allocate space for Buckets */
return 1;
}
@@ -112,14 +115,25 @@ static int compact_hash_table(HashTable *ht)
return 1;
}
- t = (Bucket **)pemalloc(nSize * sizeof(Bucket *), ht->persistent);
- if (!t) {
+ d = (Bucket *)pemalloc(nSize * sizeof(Bucket), ht->flags & HASH_FLAG_PERSISTENT);
+ h = (HashBucket *)pemalloc(nSize * sizeof(HashBucket), ht->flags & HASH_FLAG_PERSISTENT);
+ if (!d || !h) {
return 0;
}
- pefree(ht->arBuckets, ht->persistent);
+ for (i = 0, j = 0; i < ht->nNumUsed; i++) {
+ p = ht->arData + i;
+ if (p->xData) {
+ d[j++] = *p;
+ }
+ }
+ ht->nNumUsed = j;
+
+ pefree(ht->arData, ht->flags & HASH_FLAG_PERSISTENT);
+ pefree(ht->arHash, ht->flags & HASH_FLAG_PERSISTENT);
- ht->arBuckets = t;
+ ht->arData = d;
+ ht->arHash = h;
ht->nTableSize = nSize;
ht->nTableMask = ht->nTableSize - 1;
zend_hash_rehash(ht);
@@ -317,114 +331,104 @@ static inline zval* zend_clone_zval(zval *src, int bind TSRMLS_DC)
static void zend_hash_clone_zval(HashTable *ht, HashTable *source, int bind)
{
- Bucket *p, *q, **prev;
+ uint idx;
+ Bucket *p, *q;
ulong nIndex;
zval *ppz;
TSRMLS_FETCH();
ht->nTableSize = source->nTableSize;
ht->nTableMask = source->nTableMask;
+ ht->nNumUsed = 0;
ht->nNumOfElements = source->nNumOfElements;
ht->nNextFreeElement = source->nNextFreeElement;
ht->pDestructor = ZVAL_PTR_DTOR;
#if ZEND_DEBUG
ht->inconsistent = 0;
#endif
- ht->persistent = 0;
- ht->arBuckets = NULL;
- ht->pListHead = NULL;
- ht->pListTail = NULL;
- ht->pInternalPointer = NULL;
+ ht->flags = HASH_FLAG_APPLY_PROTECTION | HASH_FLAG_PTR_DATA;
+ ht->arData = NULL;
+ ht->arHash = NULL;
+ ht->nInternalPointer = source->nNumOfElements ? 0 : INVALID_IDX;
ht->nApplyCount = 0;
- ht->bApplyProtection = 1;
#if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
if (!ht->nTableMask) {
- ht->arBuckets = (Bucket**)&uninitialized_bucket;
+ ht->arHash = (HashBucket*)&uninitialized_bucket;
return;
}
#endif
- ht->arBuckets = (Bucket **) ecalloc(ht->nTableSize, sizeof(Bucket *));
+ ht->arData = (Bucket *) ecalloc(ht->nTableSize, sizeof(Bucket));
+ if (source->flags & HASH_FLAG_PACKED) {
+ ht->flags |= HASH_FLAG_PACKED;
+ ht->arHash = (HashBucket*)&uninitialized_bucket;
+ } else {
+ ht->arHash = (HashBucket *) ecalloc(ht->nTableSize, sizeof(HashBucket));
+ memset(ht->arHash, INVALID_IDX, sizeof(HashBucket) * ht->nTableSize);
+ }
- prev = &ht->pListHead;
- p = source->pListHead;
- while (p) {
+ for (idx = 0; idx < source->nNumUsed; idx++) {
+ p = source->arData + idx;
+ if (!p->xData) continue;
nIndex = p->h & ht->nTableMask;
- /* Create bucket and initialize key */
-#if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
+ /* Insert into hash collision list */
+ if (source->flags & HASH_FLAG_PACKED) {
+ q = ht->arData + p->h;
+ ht->nNumUsed = p->h + 1;
+ } else {
+ q = ht->arData + ht->nNumUsed;
+ q->next = ht->arHash[nIndex].idx;
+ ht->arHash[nIndex].idx = ht->nNumUsed++;
+ }
+
+ /* Initialize key */
+ q->h = p->h;
+ q->nKeyLength = p->nKeyLength;
if (!p->nKeyLength) {
- q = (Bucket *) emalloc(sizeof(Bucket));
q->arKey = NULL;
} else if (IS_INTERNED(p->arKey)) {
- q = (Bucket *) emalloc(sizeof(Bucket));
q->arKey = p->arKey;
} else {
- q = (Bucket *) emalloc(sizeof(Bucket) + p->nKeyLength);
- q->arKey = ((char*)q) + sizeof(Bucket);
+ q->arKey = (const char *) emalloc(p->nKeyLength);
memcpy((char*)q->arKey, p->arKey, p->nKeyLength);
}
-#else
- q = (Bucket *) emalloc(sizeof(Bucket) - 1 + p->nKeyLength);
- if (p->nKeyLength) {
- memcpy(q->arKey, p->arKey, p->nKeyLength);
- }
-#endif
- q->h = p->h;
- q->nKeyLength = p->nKeyLength;
-
- /* Insert into hash collision list */
- q->pNext = ht->arBuckets[nIndex];
- q->pLast = NULL;
- if (q->pNext) {
- q->pNext->pLast = q;
- }
- ht->arBuckets[nIndex] = q;
-
- /* Insert into global list */
- q->pListLast = ht->pListTail;
- ht->pListTail = q;
- q->pListNext = NULL;
- *prev = q;
- prev = &q->pListNext;
/* Copy data */
- q->pData = &q->pDataPtr;
if (!bind) {
ALLOC_ZVAL(ppz);
- *ppz = *((zval*)p->pDataPtr);
+ *ppz = *((zval*)p->xData);
INIT_PZVAL(ppz);
- } else if (Z_REFCOUNT_P((zval*)p->pDataPtr) == 1) {
+ } else if (Z_REFCOUNT_P((zval*)p->xData) == 1) {
ALLOC_ZVAL(ppz);
- *ppz = *((zval*)p->pDataPtr);
- } else if (accel_xlat_get(p->pDataPtr, ppz) != SUCCESS) {
+ *ppz = *((zval*)p->xData);
+ } else if (accel_xlat_get(p->xData, ppz) != SUCCESS) {
ALLOC_ZVAL(ppz);
- *ppz = *((zval*)p->pDataPtr);
- accel_xlat_set(p->pDataPtr, ppz);
+ *ppz = *((zval*)p->xData);
+ accel_xlat_set(p->xData, ppz);
} else {
- q->pDataPtr = *(void**)ppz;
- p = p->pListNext;
+ q->xData = *(void**)ppz;
continue;
}
- q->pDataPtr = (void*)ppz;
+ q->xData = (void*)ppz;
#if ZEND_EXTENSION_API_NO >= PHP_5_3_X_API_NO
- if ((Z_TYPE_P((zval*)p->pDataPtr) & IS_CONSTANT_TYPE_MASK) >= IS_ARRAY) {
- switch ((Z_TYPE_P((zval*)p->pDataPtr) & IS_CONSTANT_TYPE_MASK)) {
+ if ((Z_TYPE_P((zval*)p->xData) & IS_CONSTANT_TYPE_MASK) >= IS_ARRAY) {
+ switch ((Z_TYPE_P((zval*)p->xData) & IS_CONSTANT_TYPE_MASK)) {
#else
- if ((Z_TYPE_P((zval*)p->pDataPtr) & ~IS_CONSTANT_INDEX) >= IS_ARRAY) {
- switch ((Z_TYPE_P((zval*)p->pDataPtr) & ~IS_CONSTANT_INDEX)) {
+ if ((Z_TYPE_P((zval*)p->xData) & ~IS_CONSTANT_INDEX) >= IS_ARRAY) {
+ switch ((Z_TYPE_P((zval*)p->xData) & ~IS_CONSTANT_INDEX)) {
#endif
case IS_STRING:
case IS_CONSTANT:
- Z_STRVAL_P(ppz) = (char *) interned_estrndup(Z_STRVAL_P((zval*)p->pDataPtr), Z_STRLEN_P((zval*)p->pDataPtr));
+ Z_STRVAL_P(ppz) = (char *) interned_estrndup(Z_STRVAL_P((zval*)p->xData), Z_STRLEN_P((zval*)p->xData));
break;
case IS_ARRAY:
case IS_CONSTANT_ARRAY:
- if (((zval*)p->pDataPtr)->value.ht && ((zval*)p->pDataPtr)->value.ht != &EG(symbol_table)) {
+ if (((zval*)p->xData)->value.ht && ((zval*)p->xData)->value.ht != &EG(symbol_table)) {
ALLOC_HASHTABLE(ppz->value.ht);
- zend_hash_clone_zval(ppz->value.ht, ((zval*)p->pDataPtr)->value.ht, 0);
+ zend_hash_clone_zval(ppz->value.ht, ((zval*)p->xData)->value.ht, 0);
}
break;
#if ZEND_EXTENSION_API_NO > PHP_5_5_X_API_NO
@@ -434,15 +438,13 @@ static void zend_hash_clone_zval(HashTable *ht, HashTable *source, int bind)
#endif
}
}
-
- p = p->pListNext;
}
- ht->pInternalPointer = ht->pListHead;
}
static void zend_hash_clone_methods(HashTable *ht, HashTable *source, zend_class_entry *old_ce, zend_class_entry *ce TSRMLS_DC)
{
- Bucket *p, *q, **prev;
+ uint idx;
+ Bucket *p, *q;
ulong nIndex;
zend_class_entry **new_ce;
zend_function** new_prototype;
@@ -450,80 +452,70 @@ static void zend_hash_clone_methods(HashTable *ht, HashTable *source, zend_class
ht->nTableSize = source->nTableSize;
ht->nTableMask = source->nTableMask;
+ ht->nNumUsed = 0;
ht->nNumOfElements = source->nNumOfElements;
ht->nNextFreeElement = source->nNextFreeElement;
ht->pDestructor = ZEND_FUNCTION_DTOR;
#if ZEND_DEBUG
ht->inconsistent = 0;
#endif
- ht->persistent = 0;
- ht->pListHead = NULL;
- ht->pListTail = NULL;
- ht->pInternalPointer = NULL;
+ ht->flags = HASH_FLAG_APPLY_PROTECTION | HASH_FLAG_BIG_DATA;
+ ht->nInternalPointer = source->nNumOfElements ? 0 : INVALID_IDX;
ht->nApplyCount = 0;
- ht->bApplyProtection = 1;
#if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
if (!ht->nTableMask) {
- ht->arBuckets = (Bucket**)&uninitialized_bucket;
+ ht->arHash = (HashBucket*)&uninitialized_bucket;
return;
}
#endif
- ht->arBuckets = (Bucket **) ecalloc(ht->nTableSize, sizeof(Bucket *));
+ ht->arData = (Bucket *) ecalloc(ht->nTableSize, sizeof(Bucket));
+ if (source->flags & HASH_FLAG_PACKED) {
+ ht->flags |= HASH_FLAG_PACKED;
+ ht->arHash = (HashBucket*)&uninitialized_bucket;
+ } else {
+ ht->arHash = (HashBucket *) ecalloc(ht->nTableSize, sizeof(HashBucket));
+ memset(ht->arHash, INVALID_IDX, sizeof(HashBucket) * ht->nTableSize);
+ }
+
+ for (idx = 0; idx < source->nNumUsed; idx++) {
+ p = source->arData + idx;
+ if (!p->xData) continue;
- prev = &ht->pListHead;
- p = source->pListHead;
- while (p) {
nIndex = p->h & ht->nTableMask;
- /* Create bucket and initialize key */
-#if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
+ /* Insert into hash collision list */
+ if (source->flags & HASH_FLAG_PACKED) {
+ q = ht->arData + p->h;
+ ht->nNumUsed = p->h + 1;
+ } else {
+ q = ht->arData + ht->nNumUsed;
+ q->next = ht->arHash[nIndex].idx;
+ ht->arHash[nIndex].idx = ht->nNumUsed++;
+ }
+
+ /* Initialize key */
+ q->h = p->h;
+ q->nKeyLength = p->nKeyLength;
if (!p->nKeyLength) {
- q = (Bucket *) emalloc(sizeof(Bucket));
q->arKey = NULL;
} else if (IS_INTERNED(p->arKey)) {
- q = (Bucket *) emalloc(sizeof(Bucket));
q->arKey = p->arKey;
} else {
- q = (Bucket *) emalloc(sizeof(Bucket) + p->nKeyLength);
- q->arKey = ((char*)q) + sizeof(Bucket);
+ q->arKey = (const char *) emalloc(p->nKeyLength);
memcpy((char*)q->arKey, p->arKey, p->nKeyLength);
}
-#else
- q = (Bucket *) emalloc(sizeof(Bucket) - 1 + p->nKeyLength);
- if (p->nKeyLength) {
- memcpy(q->arKey, p->arKey, p->nKeyLength);
- }
-#endif
- q->h = p->h;
- q->nKeyLength = p->nKeyLength;
-
- /* Insert into hash collision list */
- q->pNext = ht->arBuckets[nIndex];
- q->pLast = NULL;
- if (q->pNext) {
- q->pNext->pLast = q;
- }
- ht->arBuckets[nIndex] = q;
-
- /* Insert into global list */
- q->pListLast = ht->pListTail;
- ht->pListTail = q;
- q->pListNext = NULL;
- *prev = q;
- prev = &q->pListNext;
/* Copy data */
- q->pData = (void *) emalloc(sizeof(zend_function));
- new_entry = (zend_op_array*)q->pData;
- *new_entry = *(zend_op_array*)p->pData;
- q->pDataPtr = NULL;
+ q->xData = (void *) emalloc(sizeof(zend_function));
+ new_entry = (zend_op_array*)q->xData;
+ *new_entry = *(zend_op_array*)p->xData;
/* Copy constructor */
/* we use refcount to show that op_array is referenced from several places */
if (new_entry->refcount != NULL) {
- accel_xlat_set(p->pData, new_entry);
+ accel_xlat_set(p->xData, new_entry);
}
zend_prepare_function_for_execution(new_entry);
@@ -546,90 +538,78 @@ static void zend_hash_clone_methods(HashTable *ht, HashTable *source, zend_class
zend_error(E_ERROR, ACCELERATOR_PRODUCT_NAME " class loading error, class %s, function %s", ce->name, new_entry->function_name);
}
}
-
- p = p->pListNext;
}
- ht->pInternalPointer = ht->pListHead;
}
static void zend_hash_clone_prop_info(HashTable *ht, HashTable *source, zend_class_entry *old_ce, zend_class_entry *ce TSRMLS_DC)
{
- Bucket *p, *q, **prev;
+ uint idx;
+ Bucket *p, *q;
ulong nIndex;
zend_class_entry **new_ce;
zend_property_info *prop_info;
ht->nTableSize = source->nTableSize;
ht->nTableMask = source->nTableMask;
+ ht->nNumUsed = 0;
ht->nNumOfElements = source->nNumOfElements;
ht->nNextFreeElement = source->nNextFreeElement;
ht->pDestructor = (dtor_func_t) zend_destroy_property_info;
#if ZEND_DEBUG
ht->inconsistent = 0;
#endif
- ht->persistent = 0;
- ht->pListHead = NULL;
- ht->pListTail = NULL;
- ht->pInternalPointer = NULL;
+ ht->flags = HASH_FLAG_APPLY_PROTECTION | HASH_FLAG_BIG_DATA;
+ ht->nInternalPointer = source->nNumOfElements ? 0 : INVALID_IDX;
ht->nApplyCount = 0;
- ht->bApplyProtection = 1;
#if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
if (!ht->nTableMask) {
- ht->arBuckets = (Bucket**)&uninitialized_bucket;
+ ht->arHash = (HashBucket*)&uninitialized_bucket;
return;
}
#endif
- ht->arBuckets = (Bucket **) ecalloc(ht->nTableSize, sizeof(Bucket *));
+ ht->arData = (Bucket *) ecalloc(ht->nTableSize, sizeof(Bucket));
+ if (source->flags & HASH_FLAG_PACKED) {
+ ht->flags |= HASH_FLAG_PACKED;
+ ht->arHash = (HashBucket*)&uninitialized_bucket;
+ } else {
+ ht->arHash = (HashBucket *) ecalloc(ht->nTableSize, sizeof(HashBucket));
+ memset(ht->arHash, INVALID_IDX, sizeof(HashBucket) * ht->nTableSize);
+ }
+
+ for (idx = 0; idx < source->nNumUsed; idx++) {
+ p = source->arData + idx;
+ if (!p->xData) continue;
- prev = &ht->pListHead;
- p = source->pListHead;
- while (p) {
nIndex = p->h & ht->nTableMask;
- /* Create bucket and initialize key */
-#if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
+ /* Insert into hash collision list */
+ if (source->flags & HASH_FLAG_PACKED) {
+ q = ht->arData + p->h;
+ ht->nNumUsed = p->h + 1;
+ } else {
+ q = ht->arData + ht->nNumUsed;
+ q->next = ht->arHash[nIndex].idx;
+ ht->arHash[nIndex].idx = ht->nNumUsed++;
+ }
+
+ /* Initialize key */
+ q->h = p->h;
+ q->nKeyLength = p->nKeyLength;
if (!p->nKeyLength) {
- q = (Bucket *) emalloc(sizeof(Bucket));
q->arKey = NULL;
} else if (IS_INTERNED(p->arKey)) {
- q = (Bucket *) emalloc(sizeof(Bucket));
q->arKey = p->arKey;
} else {
- q = (Bucket *) emalloc(sizeof(Bucket) + p->nKeyLength);
- q->arKey = ((char*)q) + sizeof(Bucket);
+ q->arKey = (const char *) emalloc(p->nKeyLength);
memcpy((char*)q->arKey, p->arKey, p->nKeyLength);
}
-#else
- q = (Bucket *) emalloc(sizeof(Bucket) - 1 + p->nKeyLength);
- if (p->nKeyLength) {
- memcpy(q->arKey, p->arKey, p->nKeyLength);
- }
-#endif
- q->h = p->h;
- q->nKeyLength = p->nKeyLength;
-
- /* Insert into hash collision list */
- q->pNext = ht->arBuckets[nIndex];
- q->pLast = NULL;
- if (q->pNext) {
- q->pNext->pLast = q;
- }
- ht->arBuckets[nIndex] = q;
-
- /* Insert into global list */
- q->pListLast = ht->pListTail;
- ht->pListTail = q;
- q->pListNext = NULL;
- *prev = q;
- prev = &q->pListNext;
/* Copy data */
- q->pData = (void *) emalloc(sizeof(zend_property_info));
- prop_info = q->pData;
- *prop_info = *(zend_property_info*)p->pData;
- q->pDataPtr = NULL;
+ q->xData = (void *) emalloc(sizeof(zend_property_info));
+ prop_info = q->xData;
+ *prop_info = *(zend_property_info*)p->xData;
/* Copy constructor */
prop_info->name = interned_estrndup(prop_info->name, prop_info->name_length);
@@ -647,10 +627,7 @@ static void zend_hash_clone_prop_info(HashTable *ht, HashTable *source, zend_cla
} else {
zend_error(E_ERROR, ACCELERATOR_PRODUCT_NAME" class loading error, class %s, property %s", ce->name, prop_info->name);
}
-
- p = p->pListNext;
}
- ht->pInternalPointer = ht->pListHead;
}
/* protects reference count, creates copy of statics */
@@ -879,13 +856,15 @@ static void zend_class_copy_ctor(zend_class_entry **pce)
static int zend_hash_unique_copy(HashTable *target, HashTable *source, unique_copy_ctor_func_t pCopyConstructor, uint size, int ignore_dups, void **fail_data, void **conflict_data)
{
+ uint idx;
Bucket *p;
void *t;
- p = source->pListHead;
- while (p) {
+ for (idx = 0; idx < source->nNumUsed; idx++) {
+ p = source->arData + idx;
+ if (!p->xData) continue;
if (p->nKeyLength > 0) {
- if (zend_hash_quick_add(target, p->arKey, p->nKeyLength, p->h, p->pData, size, &t) == SUCCESS) {
+ if (zend_hash_quick_add(target, p->arKey, p->nKeyLength, p->h, HASH_DATA(source, p), size, &t) == SUCCESS) {
if (pCopyConstructor) {
pCopyConstructor(t);
}
@@ -893,9 +872,9 @@ static int zend_hash_unique_copy(HashTable *target, HashTable *source, unique_co
if (p->nKeyLength > 0 && p->arKey[0] == 0) {
/* Mangled key */
#if ZEND_EXTENSION_API_NO >= PHP_5_3_X_API_NO
- if (((zend_function*)p->pData)->common.fn_flags & ZEND_ACC_CLOSURE) {
+ if (((zend_function*)p->xData)->common.fn_flags & ZEND_ACC_CLOSURE) {
/* update closure */
- if (zend_hash_quick_update(target, p->arKey, p->nKeyLength, p->h, p->pData, size, &t) == SUCCESS) {
+ if (zend_hash_quick_update(target, p->arKey, p->nKeyLength, p->h, HASH_DATA(source, p), size, &t) == SUCCESS) {
if (pCopyConstructor) {
pCopyConstructor(t);
}
@@ -905,25 +884,24 @@ static int zend_hash_unique_copy(HashTable *target, HashTable *source, unique_co
}
#endif
} else if (!ignore_dups && zend_hash_quick_find(target, p->arKey, p->nKeyLength, p->h, &t) == SUCCESS) {
- *fail_data = p->pData;
+ *fail_data = HASH_DATA(source, p);
*conflict_data = t;
return FAILURE;
}
}
} else {
- if (!zend_hash_index_exists(target, p->h) && zend_hash_index_update(target, p->h, p->pData, size, &t) == SUCCESS) {
+ if (!zend_hash_index_exists(target, p->h) && zend_hash_index_update(target, p->h, HASH_DATA(source, p), size, &t) == SUCCESS) {
if (pCopyConstructor) {
pCopyConstructor(t);
}
} else if (!ignore_dups && zend_hash_index_find(target,p->h, &t) == SUCCESS) {
- *fail_data = p->pData;
+ *fail_data = HASH_DATA(source, p);
*conflict_data = t;
return FAILURE;
}
}
- p = p->pListNext;
}
- target->pInternalPointer = target->pListHead;
+ target->nInternalPointer = target->nNumOfElements ? 0 : INVALID_IDX;
return SUCCESS;
}
diff --git a/ext/opcache/zend_persist.c b/ext/opcache/zend_persist.c
index 47f8f88312..01d4ce69ab 100644
--- a/ext/opcache/zend_persist.c
+++ b/ext/opcache/zend_persist.c
@@ -54,89 +54,43 @@ static void zend_persist_zval_ptr(zval **zp TSRMLS_DC);
static void zend_persist_zval(zval *z TSRMLS_DC);
#if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
-static const Bucket *uninitialized_bucket = NULL;
+static const HashBucket uninitialized_bucket = {INVALID_IDX};
#endif
static void zend_hash_persist(HashTable *ht, void (*pPersistElement)(void *pElement TSRMLS_DC), size_t el_size TSRMLS_DC)
{
- Bucket *p = ht->pListHead;
- uint i;
+ uint idx;
+ Bucket *p;
- while (p) {
- Bucket *q = p;
+ if (!ht->nTableMask) {
+ ht->arHash = (HashBucket*)&uninitialized_bucket;
+ return;
+ }
+ zend_accel_store(ht->arData, sizeof(Bucket) * ht->nTableSize);
+ if (!(ht->flags & HASH_FLAG_PACKED)) {
+ zend_accel_store(ht->arHash, sizeof(HashBucket) * ht->nTableSize);
+ } else {
+ ht->arHash = (HashBucket*)&uninitialized_bucket;
+ }
+ for (idx = 0; idx < ht->nNumUsed; idx++) {
+ p = ht->arData + idx;
+ if (!p->xData) continue;
/* persist bucket and key */
-#if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
- p = zend_accel_memdup(p, sizeof(Bucket));
if (p->nKeyLength) {
- p->arKey = zend_accel_memdup_interned_string(p->arKey, p->nKeyLength);
+ zend_accel_store_interned_string(p->arKey, p->nKeyLength);
}
-#else
- p = zend_accel_memdup(p, sizeof(Bucket) - 1 + p->nKeyLength);
-#endif
/* persist data pointer in bucket */
- if (!p->pDataPtr) {
- zend_accel_store(p->pData, el_size);
- } else {
- /* Update p->pData to point to the new p->pDataPtr address, after the bucket relocation */
- p->pData = &p->pDataPtr;
+ if (ht->flags & HASH_FLAG_BIG_DATA) {
+ zend_accel_store(p->xData, el_size);
}
/* persist the data itself */
if (pPersistElement) {
- pPersistElement(p->pData TSRMLS_CC);
+ pPersistElement(HASH_DATA(ht, p) TSRMLS_CC);
}
-
- /* update linked lists */
- if (p->pLast) {
- p->pLast->pNext = p;
- }
- if (p->pNext) {
- p->pNext->pLast = p;
- }
- if (p->pListLast) {
- p->pListLast->pListNext = p;
- }
- if (p->pListNext) {
- p->pListNext->pListLast = p;
- }
-
- p = p->pListNext;
-
- /* delete the old non-persistent bucket */
- efree(q);
}
-
- /* update linked lists */
- if (ht->pListHead) {
- ht->pListHead = zend_shared_alloc_get_xlat_entry(ht->pListHead);
- }
- if (ht->pListTail) {
- ht->pListTail = zend_shared_alloc_get_xlat_entry(ht->pListTail);
- }
- if (ht->pInternalPointer) {
- ht->pInternalPointer = zend_shared_alloc_get_xlat_entry(ht->pInternalPointer);
- }
-
-#if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
- /* Check if HastTable is initialized */
- if (ht->nTableMask) {
-#endif
- if (ht->nNumOfElements) {
- /* update hash table */
- for (i = 0; i < ht->nTableSize; i++) {
- if (ht->arBuckets[i]) {
- ht->arBuckets[i] = zend_shared_alloc_get_xlat_entry(ht->arBuckets[i]);
- }
- }
- }
- zend_accel_store(ht->arBuckets, sizeof(Bucket*) * ht->nTableSize);
-#if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
- } else {
- ht->arBuckets = (Bucket**)&uninitialized_bucket;
- }
-#endif
}
#if ZEND_EXTENSION_API_NO > PHP_5_5_X_API_NO
diff --git a/ext/opcache/zend_persist_calc.c b/ext/opcache/zend_persist_calc.c
index c899ec8ac9..47abb908bc 100644
--- a/ext/opcache/zend_persist_calc.c
+++ b/ext/opcache/zend_persist_calc.c
@@ -51,45 +51,43 @@ static uint zend_persist_zval_calc(zval *z TSRMLS_DC);
static uint zend_hash_persist_calc(HashTable *ht, int (*pPersistElement)(void *pElement TSRMLS_DC), size_t el_size TSRMLS_DC)
{
- Bucket *p = ht->pListHead;
+ uint idx;
+ Bucket *p;
START_SIZE();
- while (p) {
+ if (!ht->nTableMask) {
+ RETURN_SIZE();
+ }
+ ADD_DUP_SIZE(ht->arData, sizeof(Bucket) * ht->nTableSize);
+ if (!(ht->flags & HASH_FLAG_PACKED)) {
+ ADD_DUP_SIZE(ht->arHash, sizeof(HashBucket) * ht->nTableSize);
+ }
+
+ for (idx = 0; idx < ht->nNumUsed; idx++) {
+ p = ht->arData + idx;
+ if (!p->xData) continue;
+
/* persist bucket and key */
-#if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
- ADD_DUP_SIZE(p, sizeof(Bucket));
if (p->nKeyLength) {
const char *tmp = accel_new_interned_string(p->arKey, p->nKeyLength, 0 TSRMLS_CC);
if (tmp != p->arKey) {
+ efree(p->arKey);
p->arKey = tmp;
} else {
ADD_DUP_SIZE(p->arKey, p->nKeyLength);
}
}
-#else
- ADD_DUP_SIZE(p, sizeof(Bucket) - 1 + p->nKeyLength);
-#endif
/* persist data pointer in bucket */
- if (!p->pDataPtr) {
- ADD_DUP_SIZE(p->pData, el_size);
+ if (ht->flags & HASH_FLAG_BIG_DATA) {
+ ADD_DUP_SIZE(p->xData, el_size);
}
/* persist the data itself */
if (pPersistElement) {
- ADD_SIZE(pPersistElement(p->pData TSRMLS_CC));
+ ADD_SIZE(pPersistElement(HASH_DATA(ht, p) TSRMLS_CC));
}
-
- p = p->pListNext;
- }
-
-#if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
- if (ht->nTableMask) {
- ADD_DUP_SIZE(ht->arBuckets, sizeof(Bucket*) * ht->nTableSize);
}
-#else
- ADD_DUP_SIZE(ht->arBuckets, sizeof(Bucket*) * ht->nTableSize);
-#endif
RETURN_SIZE();
}
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c
index 84ad12311d..a8976eeede 100644
--- a/ext/pcre/php_pcre.c
+++ b/ext/pcre/php_pcre.c
@@ -86,9 +86,9 @@ static void pcre_handle_exec_error(int pcre_code TSRMLS_DC) /* {{{ */
}
/* }}} */
-static void php_free_pcre_cache(void *data) /* {{{ */
+static void php_free_pcre_cache(zval *data) /* {{{ */
{
- pcre_cache_entry *pce = (pcre_cache_entry *) data;
+ pcre_cache_entry *pce = (pcre_cache_entry *) Z_PTR_P(data);
if (!pce) return;
pefree(pce->re, 1);
if (pce->extra) pefree(pce->extra, 1);
@@ -167,7 +167,7 @@ static PHP_MSHUTDOWN_FUNCTION(pcre)
/* }}} */
/* {{{ static pcre_clean_cache */
-static int pcre_clean_cache(void *data, void *arg TSRMLS_DC)
+static int pcre_clean_cache(zval *data, void *arg TSRMLS_DC)
{
int *num_clean = (int *)arg;
@@ -226,7 +226,7 @@ static char **make_subpats_table(int num_subpats, pcre_cache_entry *pce TSRMLS_D
/* {{{ pcre_get_compiled_regex_cache
*/
-PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_len TSRMLS_DC)
+PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex TSRMLS_DC)
{
pcre *re = NULL;
pcre_extra *extra;
@@ -248,7 +248,6 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_le
#endif
pcre_cache_entry *pce;
pcre_cache_entry new_entry;
- char *tmp = NULL;
#if HAVE_SETLOCALE
# if defined(PHP_WIN32) && defined(ZTS)
@@ -259,7 +258,8 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_le
/* Try to lookup the cached regex entry, and if successful, just pass
back the compiled pattern, otherwise go on and compile it. */
- if (zend_hash_find(&PCRE_G(pcre_cache), regex, regex_len+1, (void **)&pce) == SUCCESS) {
+ pce = zend_hash_find_ptr(&PCRE_G(pcre_cache), regex);
+ if (pce) {
/*
* We use a quick pcre_fullinfo() check to see whether cache is corrupted, and if it
* is, we flush it and compile the pattern from scratch.
@@ -277,14 +277,14 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_le
}
}
- p = regex;
+ p = regex->val;
/* Parse through the leading whitespace, and display a warning if we
get to the end without encountering a delimiter. */
while (isspace((int)*(unsigned char *)p)) p++;
if (*p == 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING,
- p < regex + regex_len ? "Null byte in regex" : "Empty regular expression");
+ p < regex->val + regex->len ? "Null byte in regex" : "Empty regular expression");
return NULL;
}
@@ -331,7 +331,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_le
}
if (*pp == 0) {
- if (pp < regex + regex_len) {
+ if (pp < regex->val + regex->len) {
php_error_docref(NULL TSRMLS_CC,E_WARNING, "Null byte in regex");
} else if (start_delimiter == end_delimiter) {
php_error_docref(NULL TSRMLS_CC,E_WARNING, "No ending delimiter '%c' found", delimiter);
@@ -349,7 +349,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_le
/* Parse through the options, setting appropriate flags. Display
a warning if we encounter an unknown modifier. */
- while (pp < regex + regex_len) {
+ while (pp < regex->val + regex->len) {
switch (*pp++) {
/* Perl compatible options */
case 'i': coptions |= PCRE_CASELESS; break;
@@ -455,16 +455,12 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_le
* as hash keys especually for this table.
* See bug #63180
*/
- if (IS_INTERNED(regex)) {
- regex = tmp = estrndup(regex, regex_len);
- }
+ STR_ADDREF(regex);
- zend_hash_update(&PCRE_G(pcre_cache), regex, regex_len+1, (void *)&new_entry,
- sizeof(pcre_cache_entry), (void**)&pce);
+ pce = zend_hash_update_mem(&PCRE_G(pcre_cache), regex, (void *)&new_entry,
+ sizeof(pcre_cache_entry));
- if (tmp) {
- efree(tmp);
- }
+ STR_RELEASE(regex);
return pce;
}
@@ -472,9 +468,9 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_le
/* {{{ pcre_get_compiled_regex
*/
-PHPAPI pcre* pcre_get_compiled_regex(char *regex, pcre_extra **extra, int *preg_options TSRMLS_DC)
+PHPAPI pcre* pcre_get_compiled_regex(zend_string *regex, pcre_extra **extra, int *preg_options TSRMLS_DC)
{
- pcre_cache_entry * pce = pcre_get_compiled_regex_cache(regex, strlen(regex) TSRMLS_CC);
+ pcre_cache_entry * pce = pcre_get_compiled_regex_cache(regex TSRMLS_CC);
if (extra) {
*extra = pce ? pce->extra : NULL;
@@ -489,9 +485,9 @@ PHPAPI pcre* pcre_get_compiled_regex(char *regex, pcre_extra **extra, int *preg_
/* {{{ pcre_get_compiled_regex_ex
*/
-PHPAPI pcre* pcre_get_compiled_regex_ex(char *regex, pcre_extra **extra, int *preg_options, int *compile_options TSRMLS_DC)
+PHPAPI pcre* pcre_get_compiled_regex_ex(zend_string *regex, pcre_extra **extra, int *preg_options, int *compile_options TSRMLS_DC)
{
- pcre_cache_entry * pce = pcre_get_compiled_regex_cache(regex, strlen(regex) TSRMLS_CC);
+ pcre_cache_entry * pce = pcre_get_compiled_regex_cache(regex TSRMLS_CC);
if (extra) {
*extra = pce ? pce->extra : NULL;
@@ -510,43 +506,40 @@ PHPAPI pcre* pcre_get_compiled_regex_ex(char *regex, pcre_extra **extra, int *pr
/* {{{ add_offset_pair */
static inline void add_offset_pair(zval *result, char *str, int len, int offset, char *name)
{
- zval *match_pair;
+ zval match_pair;
- ALLOC_ZVAL(match_pair);
- array_init(match_pair);
- INIT_PZVAL(match_pair);
+ array_init(&match_pair);
/* Add (match, offset) to the return value */
- add_next_index_stringl(match_pair, str, len, 1);
- add_next_index_long(match_pair, offset);
+ add_next_index_stringl(&match_pair, str, len, 1);
+ add_next_index_long(&match_pair, offset);
if (name) {
zval_add_ref(&match_pair);
- zend_hash_update(Z_ARRVAL_P(result), name, strlen(name)+1, &match_pair, sizeof(zval *), NULL);
+ zend_hash_str_update(Z_ARRVAL_P(result), name, strlen(name), &match_pair);
}
- zend_hash_next_index_insert(Z_ARRVAL_P(result), &match_pair, sizeof(zval *), NULL);
+ zend_hash_next_index_insert(Z_ARRVAL_P(result), &match_pair);
}
/* }}} */
static void php_do_pcre_match(INTERNAL_FUNCTION_PARAMETERS, int global) /* {{{ */
{
/* parameters */
- char *regex; /* Regular expression */
+ zend_string *regex; /* Regular expression */
char *subject; /* String to match against */
- int regex_len;
int subject_len;
pcre_cache_entry *pce; /* Compiled regular expression */
zval *subpats = NULL; /* Array for subpatterns */
long flags = 0; /* Match control flags */
long start_offset = 0; /* Where the new search starts */
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|zll", &regex, &regex_len,
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ss|zll", &regex,
&subject, &subject_len, &subpats, &flags, &start_offset) == FAILURE) {
RETURN_FALSE;
}
/* Compile regex or get it from cache. */
- if ((pce = pcre_get_compiled_regex_cache(regex, regex_len TSRMLS_CC)) == NULL) {
+ if ((pce = pcre_get_compiled_regex_cache(regex TSRMLS_CC)) == NULL) {
RETURN_FALSE;
}
@@ -559,9 +552,9 @@ static void php_do_pcre_match(INTERNAL_FUNCTION_PARAMETERS, int global) /* {{{ *
PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int subject_len, zval *return_value,
zval *subpats, int global, int use_flags, long flags, long start_offset TSRMLS_DC)
{
- zval *result_set, /* Holds a set of subpatterns after
+ zval result_set, /* Holds a set of subpatterns after
a global match */
- **match_sets = NULL; /* An array of sets of matches for each
+ *match_sets = NULL; /* An array of sets of matches for each
subpattern after a global match */
pcre_extra *extra = pce->extra;/* Holds results of studying */
pcre_extra extra_data; /* Used locally for exec options */
@@ -643,11 +636,9 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int subjec
/* Allocate match sets array and initialize the values. */
if (global && subpats && subpats_order == PREG_PATTERN_ORDER) {
- match_sets = (zval **)safe_emalloc(num_subpats, sizeof(zval *), 0);
+ match_sets = (zval *)safe_emalloc(num_subpats, sizeof(zval), 0);
for (i=0; i<num_subpats; i++) {
- ALLOC_ZVAL(match_sets[i]);
- array_init(match_sets[i]);
- INIT_PZVAL(match_sets[i]);
+ array_init(&match_sets[i]);
}
}
@@ -688,10 +679,10 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int subjec
/* For each subpattern, insert it into the appropriate array. */
for (i = 0; i < count; i++) {
if (offset_capture) {
- add_offset_pair(match_sets[i], (char *)stringlist[i],
+ add_offset_pair(&match_sets[i], (char *)stringlist[i],
offsets[(i<<1)+1] - offsets[i<<1], offsets[i<<1], NULL);
} else {
- add_next_index_stringl(match_sets[i], (char *)stringlist[i],
+ add_next_index_stringl(&match_sets[i], (char *)stringlist[i],
offsets[(i<<1)+1] - offsets[i<<1], 1);
}
}
@@ -702,31 +693,29 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int subjec
*/
if (count < num_subpats) {
for (; i < num_subpats; i++) {
- add_next_index_string(match_sets[i], "", 1);
+ add_next_index_string(&match_sets[i], "", 1);
}
}
} else {
/* Allocate the result set array */
- ALLOC_ZVAL(result_set);
- array_init(result_set);
- INIT_PZVAL(result_set);
+ array_init(&result_set);
/* Add all the subpatterns to it */
for (i = 0; i < count; i++) {
if (offset_capture) {
- add_offset_pair(result_set, (char *)stringlist[i],
+ add_offset_pair(&result_set, (char *)stringlist[i],
offsets[(i<<1)+1] - offsets[i<<1], offsets[i<<1], subpat_names[i]);
} else {
if (subpat_names[i]) {
- add_assoc_stringl(result_set, subpat_names[i], (char *)stringlist[i],
+ add_assoc_stringl(&result_set, subpat_names[i], (char *)stringlist[i],
offsets[(i<<1)+1] - offsets[i<<1], 1);
}
- add_next_index_stringl(result_set, (char *)stringlist[i],
+ add_next_index_stringl(&result_set, (char *)stringlist[i],
offsets[(i<<1)+1] - offsets[i<<1], 1);
}
}
/* And add it to the output array */
- zend_hash_next_index_insert(Z_ARRVAL_P(subpats), &result_set, sizeof(zval *), NULL);
+ zend_hash_next_index_insert(Z_ARRVAL_P(subpats), &result_set);
}
} else { /* single pattern matching */
/* For each subpattern, insert it into the subpatterns array. */
@@ -777,11 +766,11 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int subjec
if (global && subpats && subpats_order == PREG_PATTERN_ORDER) {
for (i = 0; i < num_subpats; i++) {
if (subpat_names[i]) {
- zend_hash_update(Z_ARRVAL_P(subpats), subpat_names[i],
- strlen(subpat_names[i])+1, &match_sets[i], sizeof(zval *), NULL);
- Z_ADDREF_P(match_sets[i]);
+ zend_hash_str_update(Z_ARRVAL_P(subpats), subpat_names[i],
+ strlen(subpat_names[i]), &match_sets[i]);
+ Z_ADDREF(match_sets[i]);
}
- zend_hash_next_index_insert(Z_ARRVAL_P(subpats), &match_sets[i], sizeof(zval *), NULL);
+ zend_hash_next_index_insert(Z_ARRVAL_P(subpats), &match_sets[i]);
}
efree(match_sets);
}
@@ -857,27 +846,24 @@ static int preg_get_backref(char **str, int *backref)
*/
static int preg_do_repl_func(zval *function, char *subject, int *offsets, char **subpat_names, int count, char **result TSRMLS_DC)
{
- zval *retval_ptr; /* Function return value */
- zval **args[1]; /* Argument to pass to function */
- zval *subpats; /* Captured subpatterns */
+ zval retval; /* Function return value */
+ zval args[1]; /* Argument to pass to function */
int result_len; /* Return value length */
int i;
- MAKE_STD_ZVAL(subpats);
- array_init(subpats);
+ array_init(&args[0]);
for (i = 0; i < count; i++) {
if (subpat_names[i]) {
- add_assoc_stringl(subpats, subpat_names[i], &subject[offsets[i<<1]] , offsets[(i<<1)+1] - offsets[i<<1], 1);
+ add_assoc_stringl(&args[0], subpat_names[i], &subject[offsets[i<<1]] , offsets[(i<<1)+1] - offsets[i<<1], 1);
}
- add_next_index_stringl(subpats, &subject[offsets[i<<1]], offsets[(i<<1)+1] - offsets[i<<1], 1);
+ add_next_index_stringl(&args[0], &subject[offsets[i<<1]], offsets[(i<<1)+1] - offsets[i<<1], 1);
}
- args[0] = &subpats;
- if (call_user_function_ex(EG(function_table), NULL, function, &retval_ptr, 1, args, 0, NULL TSRMLS_CC) == SUCCESS && retval_ptr) {
- convert_to_string_ex(&retval_ptr);
- *result = estrndup(Z_STRVAL_P(retval_ptr), Z_STRLEN_P(retval_ptr));
- result_len = Z_STRLEN_P(retval_ptr);
- zval_ptr_dtor(&retval_ptr);
+ if (call_user_function_ex(EG(function_table), NULL, function, &retval, 1, args, 0, NULL TSRMLS_CC) == SUCCESS && Z_TYPE(retval) != IS_UNDEF) {
+ convert_to_string_ex(&retval);
+ *result = estrndup(Z_STRVAL(retval), Z_STRLEN(retval));
+ result_len = Z_STRLEN(retval);
+ zval_ptr_dtor(&retval);
} else {
if (!EG(exception)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call custom replacement function");
@@ -886,7 +872,7 @@ static int preg_do_repl_func(zval *function, char *subject, int *offsets, char *
*result = estrndup(&subject[offsets[0]], result_len);
}
- zval_ptr_dtor(&subpats);
+ zval_ptr_dtor(&args[0]);
return result_len;
}
@@ -982,7 +968,7 @@ static int preg_do_eval(char *eval_str, int eval_str_len, char *subject,
/* {{{ php_pcre_replace
*/
-PHPAPI char *php_pcre_replace(char *regex, int regex_len,
+PHPAPI char *php_pcre_replace(zend_string *regex,
char *subject, int subject_len,
zval *replace_val, int is_callable_replace,
int *result_len, int limit, int *replace_count TSRMLS_DC)
@@ -990,7 +976,7 @@ PHPAPI char *php_pcre_replace(char *regex, int regex_len,
pcre_cache_entry *pce; /* Compiled regular expression */
/* Compile regex or get it from cache. */
- if ((pce = pcre_get_compiled_regex_cache(regex, regex_len TSRMLS_CC)) == NULL) {
+ if ((pce = pcre_get_compiled_regex_cache(regex TSRMLS_CC)) == NULL) {
return NULL;
}
@@ -1161,7 +1147,7 @@ PHPAPI char *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, int sub
if (eval || is_callable_replace) {
memcpy(walkbuf, eval_result, eval_result_len);
*result_len += eval_result_len;
- STR_FREE(eval_result);
+ if (eval_result) efree(eval_result);
} else { /* do regular backreference copying */
walk = replace;
walk_last = 0;
@@ -1243,12 +1229,12 @@ PHPAPI char *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, int sub
/* {{{ php_replace_in_subject
*/
-static char *php_replace_in_subject(zval *regex, zval *replace, zval **subject, int *result_len, int limit, int is_callable_replace, int *replace_count TSRMLS_DC)
+static char *php_replace_in_subject(zval *regex, zval *replace, zval *subject, int *result_len, int limit, int is_callable_replace, int *replace_count TSRMLS_DC)
{
- zval **regex_entry,
- **replace_entry = NULL,
- *replace_value,
- empty_replace;
+ zval *regex_entry,
+ *replace_entry = NULL,
+ *replace_value,
+ empty_replace;
char *subject_value,
*result;
int subject_len;
@@ -1256,13 +1242,14 @@ static char *php_replace_in_subject(zval *regex, zval *replace, zval **subject,
/* Make sure we're dealing with strings. */
convert_to_string_ex(subject);
/* FIXME: This might need to be changed to STR_EMPTY_ALLOC(). Check if this zval could be dtor()'ed somehow */
- ZVAL_STRINGL(&empty_replace, "", 0, 0);
+//??? ZVAL_STRINGL(&empty_replace, "", 0, 0);
+ ZVAL_EMPTY_STRING(&empty_replace);
/* If regex is an array */
if (Z_TYPE_P(regex) == IS_ARRAY) {
/* Duplicate subject string for repeated replacement */
- subject_value = estrndup(Z_STRVAL_PP(subject), Z_STRLEN_PP(subject));
- subject_len = Z_STRLEN_PP(subject);
+ subject_value = estrndup(Z_STRVAL_P(subject), Z_STRLEN_P(subject));
+ subject_len = Z_STRLEN_P(subject);
*result_len = subject_len;
zend_hash_internal_pointer_reset(Z_ARRVAL_P(regex));
@@ -1272,18 +1259,18 @@ static char *php_replace_in_subject(zval *regex, zval *replace, zval **subject,
zend_hash_internal_pointer_reset(Z_ARRVAL_P(replace));
/* For each entry in the regex array, get the entry */
- while (zend_hash_get_current_data(Z_ARRVAL_P(regex), (void **)&regex_entry) == SUCCESS) {
+ while ((regex_entry = zend_hash_get_current_data(Z_ARRVAL_P(regex))) != NULL) {
/* Make sure we're dealing with strings. */
convert_to_string_ex(regex_entry);
/* If replace is an array and not a callable construct */
if (Z_TYPE_P(replace) == IS_ARRAY && !is_callable_replace) {
/* Get current entry */
- if (zend_hash_get_current_data(Z_ARRVAL_P(replace), (void **)&replace_entry) == SUCCESS) {
+ if ((replace_entry = zend_hash_get_current_data(Z_ARRVAL_P(replace))) != NULL) {
if (!is_callable_replace) {
convert_to_string_ex(replace_entry);
}
- replace_value = *replace_entry;
+ replace_value = replace_entry;
zend_hash_move_forward(Z_ARRVAL_P(replace));
} else {
/* We've run out of replacement strings, so use an empty one */
@@ -1293,8 +1280,7 @@ static char *php_replace_in_subject(zval *regex, zval *replace, zval **subject,
/* Do the actual replacement and put the result back into subject_value
for further replacements. */
- if ((result = php_pcre_replace(Z_STRVAL_PP(regex_entry),
- Z_STRLEN_PP(regex_entry),
+ if ((result = php_pcre_replace(Z_STR_P(regex_entry),
subject_value,
subject_len,
replace_value,
@@ -1315,10 +1301,9 @@ static char *php_replace_in_subject(zval *regex, zval *replace, zval **subject,
return subject_value;
} else {
- result = php_pcre_replace(Z_STRVAL_P(regex),
- Z_STRLEN_P(regex),
- Z_STRVAL_PP(subject),
- Z_STRLEN_PP(subject),
+ result = php_pcre_replace(Z_STR_P(regex),
+ Z_STRVAL_P(subject),
+ Z_STRLEN_P(subject),
replace,
is_callable_replace,
result_len,
@@ -1333,40 +1318,39 @@ static char *php_replace_in_subject(zval *regex, zval *replace, zval **subject,
*/
static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, int is_callable_replace, int is_filter)
{
- zval **regex,
- **replace,
- **subject,
- **subject_entry,
- **zcount = NULL;
+ zval *regex,
+ *replace,
+ *subject,
+ *subject_entry,
+ *zcount = NULL;
char *result;
int result_len;
int limit_val = -1;
long limit = -1;
- char *string_key;
- uint string_key_len;
+ zend_string *string_key;
ulong num_key;
char *callback_name;
int replace_count=0, old_replace_count;
/* Get function parameters and do error-checking. */
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ZZZ|lZ", &regex, &replace, &subject, &limit, &zcount) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zzz|lz", &regex, &replace, &subject, &limit, &zcount) == FAILURE) {
return;
}
- if (!is_callable_replace && Z_TYPE_PP(replace) == IS_ARRAY && Z_TYPE_PP(regex) != IS_ARRAY) {
+ if (!is_callable_replace && Z_TYPE_P(replace) == IS_ARRAY && Z_TYPE_P(regex) != IS_ARRAY) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Parameter mismatch, pattern is a string while replacement is an array");
RETURN_FALSE;
}
SEPARATE_ZVAL(replace);
- if (Z_TYPE_PP(replace) != IS_ARRAY && (Z_TYPE_PP(replace) != IS_OBJECT || !is_callable_replace)) {
+ if (Z_TYPE_P(replace) != IS_ARRAY && (Z_TYPE_P(replace) != IS_OBJECT || !is_callable_replace)) {
convert_to_string_ex(replace);
}
if (is_callable_replace) {
- if (!zend_is_callable(*replace, 0, &callback_name TSRMLS_CC)) {
+ if (!zend_is_callable(replace, 0, &callback_name TSRMLS_CC)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Requires argument 2, '%s', to be a valid callback", callback_name);
efree(callback_name);
- MAKE_COPY_ZVAL(subject, return_value);
+ ZVAL_DUP(return_value, subject);
return;
}
efree(callback_name);
@@ -1379,26 +1363,27 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, int is_callable_repl
limit_val = limit;
}
- if (Z_TYPE_PP(regex) != IS_ARRAY)
+ if (Z_TYPE_P(regex) != IS_ARRAY)
convert_to_string_ex(regex);
/* if subject is an array */
- if (Z_TYPE_PP(subject) == IS_ARRAY) {
+ if (Z_TYPE_P(subject) == IS_ARRAY) {
array_init(return_value);
- zend_hash_internal_pointer_reset(Z_ARRVAL_PP(subject));
+ zend_hash_internal_pointer_reset(Z_ARRVAL_P(subject));
/* For each subject entry, convert it to string, then perform replacement
and add the result to the return_value array. */
- while (zend_hash_get_current_data(Z_ARRVAL_PP(subject), (void **)&subject_entry) == SUCCESS) {
+ while ((subject_entry = zend_hash_get_current_data(Z_ARRVAL_P(subject))) != NULL) {
SEPARATE_ZVAL(subject_entry);
old_replace_count = replace_count;
- if ((result = php_replace_in_subject(*regex, *replace, subject_entry, &result_len, limit_val, is_callable_replace, &replace_count TSRMLS_CC)) != NULL) {
+ if ((result = php_replace_in_subject(regex, replace, subject_entry, &result_len, limit_val, is_callable_replace, &replace_count TSRMLS_CC)) != NULL) {
if (!is_filter || replace_count > old_replace_count) {
/* Add to return array */
- switch(zend_hash_get_current_key_ex(Z_ARRVAL_PP(subject), &string_key, &string_key_len, &num_key, 0, NULL))
+ switch(zend_hash_get_current_key_ex(Z_ARRVAL_P(subject), &string_key, &num_key, 0, NULL))
{
case HASH_KEY_IS_STRING:
- add_assoc_stringl_ex(return_value, string_key, string_key_len, result, result_len, 0);
+//???
+ add_assoc_stringl_ex(return_value, string_key->val, string_key->len, result, result_len, 0);
break;
case HASH_KEY_IS_LONG:
@@ -1410,21 +1395,22 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, int is_callable_repl
}
}
- zend_hash_move_forward(Z_ARRVAL_PP(subject));
+ zend_hash_move_forward(Z_ARRVAL_P(subject));
}
} else { /* if subject is not an array */
old_replace_count = replace_count;
- if ((result = php_replace_in_subject(*regex, *replace, subject, &result_len, limit_val, is_callable_replace, &replace_count TSRMLS_CC)) != NULL) {
+ if ((result = php_replace_in_subject(regex, replace, subject, &result_len, limit_val, is_callable_replace, &replace_count TSRMLS_CC)) != NULL) {
if (!is_filter || replace_count > old_replace_count) {
- RETVAL_STRINGL(result, result_len, 0);
+//??? RETVAL_STRINGL(result, result_len, 0);
+ RETVAL_STRINGL(result, result_len);
} else {
efree(result);
}
}
}
if (ZEND_NUM_ARGS() > 4) {
- zval_dtor(*zcount);
- ZVAL_LONG(*zcount, replace_count);
+ zval_dtor(zcount);
+ ZVAL_LONG(zcount, replace_count);
}
}
@@ -1458,22 +1444,21 @@ static PHP_FUNCTION(preg_filter)
Split string into an array using a perl-style regular expression as a delimiter */
static PHP_FUNCTION(preg_split)
{
- char *regex; /* Regular expression */
+ zend_string *regex; /* Regular expression */
char *subject; /* String to match against */
- int regex_len;
int subject_len;
long limit_val = -1;/* Integer value of limit */
long flags = 0; /* Match control flags */
pcre_cache_entry *pce; /* Compiled regular expression */
/* Get function parameters and do error checking */
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|ll", &regex, &regex_len,
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ss|ll", &regex,
&subject, &subject_len, &limit_val, &flags) == FAILURE) {
RETURN_FALSE;
}
/* Compile regex or get it from cache. */
- if ((pce = pcre_get_compiled_regex_cache(regex, regex_len TSRMLS_CC)) == NULL) {
+ if ((pce = pcre_get_compiled_regex_cache(regex TSRMLS_CC)) == NULL) {
RETURN_FALSE;
}
@@ -1597,8 +1582,10 @@ PHPAPI void php_pcre_split_impl(pcre_cache_entry *pce, char *subject, int subjec
if (pce->compile_options & PCRE_UTF8) {
if (re_bump == NULL) {
int dummy;
-
- if ((re_bump = pcre_get_compiled_regex("/./us", &extra_bump, &dummy TSRMLS_CC)) == NULL) {
+ zend_string *regex = STR_INIT("/./us", sizeof("/./us")-1, 0);
+ re_bump = pcre_get_compiled_regex(regex, &extra_bump, &dummy TSRMLS_CC);
+ STR_RELEASE(regex);
+ if (re_bump == NULL) {
RETURN_FALSE;
}
}
@@ -1733,7 +1720,8 @@ static PHP_FUNCTION(preg_quote)
*q = '\0';
/* Reallocate string and return it */
- RETVAL_STRINGL(erealloc(out_str, q - out_str + 1), q - out_str, 0);
+//??? RETVAL_STRINGL(erealloc(out_str, q - out_str + 1), q - out_str, 0);
+ RETVAL_STRINGL(erealloc(out_str, q - out_str + 1), q - out_str);
}
/* }}} */
@@ -1741,20 +1729,19 @@ static PHP_FUNCTION(preg_quote)
Searches array and returns entries which match regex */
static PHP_FUNCTION(preg_grep)
{
- char *regex; /* Regular expression */
- int regex_len;
+ zend_string *regex; /* Regular expression */
zval *input; /* Input array */
long flags = 0; /* Match control flags */
pcre_cache_entry *pce; /* Compiled regular expression */
/* Get arguments and do error checking */
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sa|l", &regex, &regex_len,
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sa|l", &regex,
&input, &flags) == FAILURE) {
return;
}
/* Compile regex or get it from cache. */
- if ((pce = pcre_get_compiled_regex_cache(regex, regex_len TSRMLS_CC)) == NULL) {
+ if ((pce = pcre_get_compiled_regex_cache(regex TSRMLS_CC)) == NULL) {
RETURN_FALSE;
}
@@ -1764,14 +1751,13 @@ static PHP_FUNCTION(preg_grep)
PHPAPI void php_pcre_grep_impl(pcre_cache_entry *pce, zval *input, zval *return_value, long flags TSRMLS_DC) /* {{{ */
{
- zval **entry; /* An entry in the input array */
+ zval *entry; /* An entry in the input array */
pcre_extra *extra = pce->extra;/* Holds results of studying */
pcre_extra extra_data; /* Used locally for exec options */
int *offsets; /* Array of subpattern offsets */
int size_offsets; /* Size of the offsets array */
int count = 0; /* Count of matched subpatterns */
- char *string_key;
- uint string_key_len;
+ zend_string *string_key;
ulong num_key;
zend_bool invert; /* Whether to return non-matching
entries */
@@ -1802,10 +1788,12 @@ PHPAPI void php_pcre_grep_impl(pcre_cache_entry *pce, zval *input, zval *return
/* Go through the input array */
zend_hash_internal_pointer_reset(Z_ARRVAL_P(input));
- while (zend_hash_get_current_data(Z_ARRVAL_P(input), (void **)&entry) == SUCCESS) {
- zval subject = **entry;
+ while ((entry = zend_hash_get_current_data(Z_ARRVAL_P(input))) != NULL) {
+ zval subject;
+
+ ZVAL_COPY_VALUE(&subject, entry);
- if (Z_TYPE_PP(entry) != IS_STRING) {
+ if (Z_TYPE_P(entry) != IS_STRING) {
zval_copy_ctor(&subject);
convert_to_string(&subject);
}
@@ -1827,24 +1815,22 @@ PHPAPI void php_pcre_grep_impl(pcre_cache_entry *pce, zval *input, zval *return
/* If the entry fits our requirements */
if ((count > 0 && !invert) || (count == PCRE_ERROR_NOMATCH && invert)) {
- Z_ADDREF_PP(entry);
+ Z_ADDREF_P(entry);
/* Add to return array */
- switch (zend_hash_get_current_key_ex(Z_ARRVAL_P(input), &string_key, &string_key_len, &num_key, 0, NULL))
+ switch (zend_hash_get_current_key_ex(Z_ARRVAL_P(input), &string_key, &num_key, 0, NULL))
{
case HASH_KEY_IS_STRING:
- zend_hash_update(Z_ARRVAL_P(return_value), string_key,
- string_key_len, entry, sizeof(zval *), NULL);
+ zend_hash_update(Z_ARRVAL_P(return_value), string_key, entry);
break;
case HASH_KEY_IS_LONG:
- zend_hash_index_update(Z_ARRVAL_P(return_value), num_key, entry,
- sizeof(zval *), NULL);
+ zend_hash_index_update(Z_ARRVAL_P(return_value), num_key, entry);
break;
}
}
- if (Z_TYPE_PP(entry) != IS_STRING) {
+ if (Z_TYPE_P(entry) != IS_STRING) {
zval_dtor(&subject);
}
diff --git a/ext/pcre/php_pcre.h b/ext/pcre/php_pcre.h
index 4b261871e2..9e6fa6c32f 100644
--- a/ext/pcre/php_pcre.h
+++ b/ext/pcre/php_pcre.h
@@ -33,9 +33,9 @@
#include <locale.h>
#endif
-PHPAPI char *php_pcre_replace(char *regex, int regex_len, char *subject, int subject_len, zval *replace_val, int is_callable_replace, int *result_len, int limit, int *replace_count TSRMLS_DC);
-PHPAPI pcre* pcre_get_compiled_regex(char *regex, pcre_extra **extra, int *options TSRMLS_DC);
-PHPAPI pcre* pcre_get_compiled_regex_ex(char *regex, pcre_extra **extra, int *preg_options, int *coptions TSRMLS_DC);
+PHPAPI char *php_pcre_replace(zend_string *regex, char *subject, int subject_len, zval *replace_val, int is_callable_replace, int *result_len, int limit, int *replace_count TSRMLS_DC);
+PHPAPI pcre* pcre_get_compiled_regex(zend_string *regex, pcre_extra **extra, int *options TSRMLS_DC);
+PHPAPI pcre* pcre_get_compiled_regex_ex(zend_string *regex, pcre_extra **extra, int *preg_options, int *coptions TSRMLS_DC);
extern zend_module_entry pcre_module_entry;
#define pcre_module_ptr &pcre_module_entry
@@ -52,7 +52,7 @@ typedef struct {
int refcount;
} pcre_cache_entry;
-PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_len TSRMLS_DC);
+PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex TSRMLS_DC);
PHPAPI void php_pcre_match_impl( pcre_cache_entry *pce, char *subject, int subject_len, zval *return_value,
zval *subpats, int global, int use_flags, long flags, long start_offset TSRMLS_DC);
diff --git a/ext/pdo/pdo.c b/ext/pdo/pdo.c
index f3c9b65766..85ce2a91d2 100644
--- a/ext/pdo/pdo.c
+++ b/ext/pdo/pdo.c
@@ -372,7 +372,7 @@ PHP_MINIT_FUNCTION(pdo)
INIT_CLASS_ENTRY(ce, "PDOException", NULL);
- pdo_exception_ce = zend_register_internal_class_ex(&ce, php_pdo_get_exception_base(0 TSRMLS_CC), NULL TSRMLS_CC);
+ pdo_exception_ce = zend_register_internal_class_ex(&ce, php_pdo_get_exception_base(0 TSRMLS_CC) TSRMLS_CC);
zend_declare_property_null(pdo_exception_ce, "errorInfo", sizeof("errorInfo")-1, ZEND_ACC_PUBLIC TSRMLS_CC);
diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c
index 3ede0ec20b..2b3e639f33 100644
--- a/ext/pdo/pdo_dbh.c
+++ b/ext/pdo/pdo_dbh.c
@@ -470,14 +470,15 @@ static void pdo_stmt_construct(pdo_stmt_t *stmt, zval *object, zend_class_entry
fci.retval_ptr_ptr = &retval;
if (ctor_args) {
HashTable *ht = Z_ARRVAL_P(ctor_args);
+ uint idx;
Bucket *p;
fci.param_count = 0;
fci.params = safe_emalloc(sizeof(zval*), ht->nNumOfElements, 0);
- p = ht->pListHead;
- while (p != NULL) {
- fci.params[fci.param_count++] = (zval**)p->pData;
- p = p->pListNext;
+ for (idx = 0; idx < ht->nNumUsed; idx++) {
+ p = ht->arData + idx;
+ if (!p->xData) continue;
+ fci.params[fci.param_count++] = (zval**)&p->xData;
}
} else {
fci.param_count = 0;
diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c
index 2735aede41..12bd35ce7d 100644
--- a/ext/pdo/pdo_stmt.c
+++ b/ext/pdo/pdo_stmt.c
@@ -759,14 +759,15 @@ static int do_fetch_class_prepare(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */
fci->retval_ptr_ptr = &stmt->fetch.cls.retval_ptr;
if (stmt->fetch.cls.ctor_args) {
HashTable *ht = Z_ARRVAL_P(stmt->fetch.cls.ctor_args);
+ uint idx;
Bucket *p;
fci->param_count = 0;
fci->params = safe_emalloc(sizeof(zval**), ht->nNumOfElements, 0);
- p = ht->pListHead;
- while (p != NULL) {
- fci->params[fci->param_count++] = (zval**)p->pData;
- p = p->pListNext;
+ for (idx = 0; idx < ht->nNumUsed; idx++) {
+ p = ht->arData + idx;
+ if (!p->xData) continue;
+ fci->params[fci->param_count++] = (zval**)&p->xData;
}
} else {
fci->param_count = 0;
diff --git a/ext/phar/dirstream.c b/ext/phar/dirstream.c
index 2a9f11203b..c2a2b7d7f9 100644
--- a/ext/phar/dirstream.c
+++ b/ext/phar/dirstream.c
@@ -44,9 +44,9 @@ static int phar_dir_close(php_stream *stream, int close_handle TSRMLS_DC) /* {{
{
HashTable *data = (HashTable *)stream->abstract;
- if (data && data->arBuckets) {
+ if (data && data->arHash) {
zend_hash_destroy(data);
- data->arBuckets = 0;
+ data->arHash = 0;
FREE_HASHTABLE(data);
stream->abstract = NULL;
}
@@ -158,8 +158,8 @@ static int phar_compare_dir_name(const void *a, const void *b TSRMLS_DC) /* {{{
Bucket *s;
int result;
- f = *((Bucket **) a);
- s = *((Bucket **) b);
+ f = (Bucket *) a;
+ s = (Bucket *) b;
result = zend_binary_strcmp(f->arKey, f->nKeyLength, s->arKey, s->nKeyLength);
if (result < 0) {
@@ -359,7 +359,7 @@ php_stream *phar_wrapper_open_dir(php_stream_wrapper *wrapper, const char *path,
return ret;
}
- if (!phar->manifest.arBuckets) {
+ if (!phar->manifest.arHash) {
php_url_free(resource);
return NULL;
}
diff --git a/ext/phar/func_interceptors.c b/ext/phar/func_interceptors.c
index 87411fc98d..c0b03e5838 100644
--- a/ext/phar/func_interceptors.c
+++ b/ext/phar/func_interceptors.c
@@ -33,8 +33,8 @@ PHAR_FUNC(phar_opendir) /* {{{ */
goto skip_phar;
}
- if ((PHAR_GLOBALS->phar_fname_map.arBuckets && !zend_hash_num_elements(&(PHAR_GLOBALS->phar_fname_map)))
- && !cached_phars.arBuckets) {
+ if ((PHAR_GLOBALS->phar_fname_map.arHash && !zend_hash_num_elements(&(PHAR_GLOBALS->phar_fname_map)))
+ && !cached_phars.arHash) {
goto skip_phar;
}
@@ -107,8 +107,8 @@ PHAR_FUNC(phar_file_get_contents) /* {{{ */
goto skip_phar;
}
- if ((PHAR_GLOBALS->phar_fname_map.arBuckets && !zend_hash_num_elements(&(PHAR_GLOBALS->phar_fname_map)))
- && !cached_phars.arBuckets) {
+ if ((PHAR_GLOBALS->phar_fname_map.arHash && !zend_hash_num_elements(&(PHAR_GLOBALS->phar_fname_map)))
+ && !cached_phars.arHash) {
goto skip_phar;
}
@@ -240,8 +240,8 @@ PHAR_FUNC(phar_readfile) /* {{{ */
goto skip_phar;
}
- if ((PHAR_GLOBALS->phar_fname_map.arBuckets && !zend_hash_num_elements(&(PHAR_GLOBALS->phar_fname_map)))
- && !cached_phars.arBuckets) {
+ if ((PHAR_GLOBALS->phar_fname_map.arHash && !zend_hash_num_elements(&(PHAR_GLOBALS->phar_fname_map)))
+ && !cached_phars.arHash) {
goto skip_phar;
}
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "p|br!", &filename, &filename_len, &use_include_path, &zcontext) == FAILURE) {
@@ -335,8 +335,8 @@ PHAR_FUNC(phar_fopen) /* {{{ */
goto skip_phar;
}
- if ((PHAR_GLOBALS->phar_fname_map.arBuckets && !zend_hash_num_elements(&(PHAR_GLOBALS->phar_fname_map)))
- && !cached_phars.arBuckets) {
+ if ((PHAR_GLOBALS->phar_fname_map.arHash && !zend_hash_num_elements(&(PHAR_GLOBALS->phar_fname_map)))
+ && !cached_phars.arHash) {
/* no need to check, include_path not even specified in fopen/ no active phars */
goto skip_phar;
}
@@ -901,8 +901,8 @@ PHAR_FUNC(phar_is_file) /* {{{ */
goto skip_phar;
}
- if ((PHAR_GLOBALS->phar_fname_map.arBuckets && !zend_hash_num_elements(&(PHAR_GLOBALS->phar_fname_map)))
- && !cached_phars.arBuckets) {
+ if ((PHAR_GLOBALS->phar_fname_map.arHash && !zend_hash_num_elements(&(PHAR_GLOBALS->phar_fname_map)))
+ && !cached_phars.arHash) {
goto skip_phar;
}
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "p", &filename, &filename_len) == FAILURE) {
@@ -968,8 +968,8 @@ PHAR_FUNC(phar_is_link) /* {{{ */
goto skip_phar;
}
- if ((PHAR_GLOBALS->phar_fname_map.arBuckets && !zend_hash_num_elements(&(PHAR_GLOBALS->phar_fname_map)))
- && !cached_phars.arBuckets) {
+ if ((PHAR_GLOBALS->phar_fname_map.arHash && !zend_hash_num_elements(&(PHAR_GLOBALS->phar_fname_map)))
+ && !cached_phars.arHash) {
goto skip_phar;
}
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "p", &filename, &filename_len) == FAILURE) {
diff --git a/ext/phar/phar.c b/ext/phar/phar.c
index 5bfb278881..867c664171 100644
--- a/ext/phar/phar.c
+++ b/ext/phar/phar.c
@@ -82,7 +82,7 @@ ZEND_INI_MH(phar_ini_modify_handler) /* {{{ */
if (entry->name_length == 14) {
PHAR_G(readonly) = ini;
- if (PHAR_GLOBALS->request_init && PHAR_GLOBALS->phar_fname_map.arBuckets) {
+ if (PHAR_GLOBALS->request_init && PHAR_GLOBALS->phar_fname_map.arHash) {
zend_hash_apply_with_argument(&(PHAR_GLOBALS->phar_fname_map), phar_set_writeable_bit, (void *)&ini TSRMLS_CC);
}
} else {
@@ -147,9 +147,9 @@ finish_error:
PHAR_GLOBALS->manifest_cached = 0;
efree(tmp);
zend_hash_destroy(&(PHAR_G(phar_fname_map)));
- PHAR_GLOBALS->phar_fname_map.arBuckets = 0;
+ PHAR_GLOBALS->phar_fname_map.arHash = 0;
zend_hash_destroy(&(PHAR_G(phar_alias_map)));
- PHAR_GLOBALS->phar_alias_map.arBuckets = 0;
+ PHAR_GLOBALS->phar_alias_map.arHash = 0;
zend_hash_destroy(&cached_phars);
zend_hash_destroy(&cached_alias);
zend_hash_graceful_reverse_destroy(&EG(regular_list));
@@ -174,8 +174,8 @@ finish_error:
zend_hash_destroy(&cached_alias);
cached_phars = PHAR_GLOBALS->phar_fname_map;
cached_alias = PHAR_GLOBALS->phar_alias_map;
- PHAR_GLOBALS->phar_fname_map.arBuckets = 0;
- PHAR_GLOBALS->phar_alias_map.arBuckets = 0;
+ PHAR_GLOBALS->phar_fname_map.arHash = 0;
+ PHAR_GLOBALS->phar_alias_map.arHash = 0;
zend_hash_graceful_reverse_destroy(&EG(regular_list));
memset(&EG(regular_list), 0, sizeof(HashTable));
efree(tmp);
@@ -221,19 +221,19 @@ void phar_destroy_phar_data(phar_archive_data *phar TSRMLS_DC) /* {{{ */
phar->signature = NULL;
}
- if (phar->manifest.arBuckets) {
+ if (phar->manifest.arHash) {
zend_hash_destroy(&phar->manifest);
- phar->manifest.arBuckets = NULL;
+ phar->manifest.arHash = NULL;
}
- if (phar->mounted_dirs.arBuckets) {
+ if (phar->mounted_dirs.arHash) {
zend_hash_destroy(&phar->mounted_dirs);
- phar->mounted_dirs.arBuckets = NULL;
+ phar->mounted_dirs.arHash = NULL;
}
- if (phar->virtual_dirs.arBuckets) {
+ if (phar->virtual_dirs.arHash) {
zend_hash_destroy(&phar->virtual_dirs);
- phar->virtual_dirs.arBuckets = NULL;
+ phar->virtual_dirs.arHash = NULL;
}
if (phar->metadata) {
@@ -3527,11 +3527,11 @@ PHP_RSHUTDOWN_FUNCTION(phar) /* {{{ */
{
phar_release_functions(TSRMLS_C);
zend_hash_destroy(&(PHAR_GLOBALS->phar_alias_map));
- PHAR_GLOBALS->phar_alias_map.arBuckets = NULL;
+ PHAR_GLOBALS->phar_alias_map.arHash = NULL;
zend_hash_destroy(&(PHAR_GLOBALS->phar_fname_map));
- PHAR_GLOBALS->phar_fname_map.arBuckets = NULL;
+ PHAR_GLOBALS->phar_fname_map.arHash = NULL;
zend_hash_destroy(&(PHAR_GLOBALS->phar_persist_map));
- PHAR_GLOBALS->phar_persist_map.arBuckets = NULL;
+ PHAR_GLOBALS->phar_persist_map.arHash = NULL;
PHAR_GLOBALS->phar_SERVER_mung_list = 0;
if (PHAR_GLOBALS->cached_fp) {
diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c
index 99907f86dd..24508440ac 100644
--- a/ext/phar/phar_object.c
+++ b/ext/phar/phar_object.c
@@ -536,7 +536,7 @@ carry_on:
}
return;
- } else if (PHAR_GLOBALS->phar_fname_map.arBuckets && SUCCESS == zend_hash_find(&(PHAR_GLOBALS->phar_fname_map), fname, fname_len, (void **)&pphar)) {
+ } else if (PHAR_GLOBALS->phar_fname_map.arHash && SUCCESS == zend_hash_find(&(PHAR_GLOBALS->phar_fname_map), fname, fname_len, (void **)&pphar)) {
goto carry_on;
} else if (PHAR_G(manifest_cached) && SUCCESS == zend_hash_find(&cached_phars, fname, fname_len, (void **)&pphar)) {
if (SUCCESS == phar_copy_on_write(pphar TSRMLS_CC)) {
@@ -5349,21 +5349,21 @@ void phar_object_init(TSRMLS_D) /* {{{ */
zend_class_entry ce;
INIT_CLASS_ENTRY(ce, "PharException", phar_exception_methods);
- phar_ce_PharException = zend_register_internal_class_ex(&ce, phar_exception_get_default(), NULL TSRMLS_CC);
+ phar_ce_PharException = zend_register_internal_class_ex(&ce, phar_exception_get_default() TSRMLS_CC);
#if HAVE_SPL
INIT_CLASS_ENTRY(ce, "Phar", php_archive_methods);
- phar_ce_archive = zend_register_internal_class_ex(&ce, spl_ce_RecursiveDirectoryIterator, NULL TSRMLS_CC);
+ phar_ce_archive = zend_register_internal_class_ex(&ce, spl_ce_RecursiveDirectoryIterator TSRMLS_CC);
zend_class_implements(phar_ce_archive TSRMLS_CC, 2, spl_ce_Countable, zend_ce_arrayaccess);
INIT_CLASS_ENTRY(ce, "PharData", php_archive_methods);
- phar_ce_data = zend_register_internal_class_ex(&ce, spl_ce_RecursiveDirectoryIterator, NULL TSRMLS_CC);
+ phar_ce_data = zend_register_internal_class_ex(&ce, spl_ce_RecursiveDirectoryIterator TSRMLS_CC);
zend_class_implements(phar_ce_data TSRMLS_CC, 2, spl_ce_Countable, zend_ce_arrayaccess);
INIT_CLASS_ENTRY(ce, "PharFileInfo", php_entry_methods);
- phar_ce_entry = zend_register_internal_class_ex(&ce, spl_ce_SplFileInfo, NULL TSRMLS_CC);
+ phar_ce_entry = zend_register_internal_class_ex(&ce, spl_ce_SplFileInfo TSRMLS_CC);
#else
INIT_CLASS_ENTRY(ce, "Phar", php_archive_methods);
phar_ce_archive = zend_register_internal_class(&ce TSRMLS_CC);
diff --git a/ext/phar/stream.c b/ext/phar/stream.c
index bbd6ed00b6..c38c20d635 100644
--- a/ext/phar/stream.c
+++ b/ext/phar/stream.c
@@ -103,7 +103,7 @@ php_url* phar_parse_url(php_stream_wrapper *wrapper, const char *filename, const
if (mode[0] == 'w' || (mode[0] == 'r' && mode[1] == '+')) {
phar_archive_data **pphar = NULL, *phar;
- if (PHAR_GLOBALS->request_init && PHAR_GLOBALS->phar_fname_map.arBuckets && FAILURE == zend_hash_find(&(PHAR_GLOBALS->phar_fname_map), arch, arch_len, (void **)&pphar)) {
+ if (PHAR_GLOBALS->request_init && PHAR_GLOBALS->phar_fname_map.arHash && FAILURE == zend_hash_find(&(PHAR_GLOBALS->phar_fname_map), arch, arch_len, (void **)&pphar)) {
pphar = NULL;
}
if (PHAR_G(readonly) && (!pphar || !(*pphar)->is_data)) {
@@ -609,7 +609,7 @@ static int phar_wrapper_stat(php_stream_wrapper *wrapper, const char *url, int f
php_url_free(resource);
return SUCCESS;
}
- if (!phar->manifest.arBuckets) {
+ if (!phar->manifest.arHash) {
php_url_free(resource);
return FAILURE;
}
@@ -626,7 +626,7 @@ static int phar_wrapper_stat(php_stream_wrapper *wrapper, const char *url, int f
return SUCCESS;
}
/* check for mounted directories */
- if (phar->mounted_dirs.arBuckets && zend_hash_num_elements(&phar->mounted_dirs)) {
+ if (phar->mounted_dirs.arHash && zend_hash_num_elements(&phar->mounted_dirs)) {
char *str_key;
ulong unused;
uint keylen;
diff --git a/ext/phar/util.c b/ext/phar/util.c
index 7029c6f26b..8aa0cf8ae0 100644
--- a/ext/phar/util.c
+++ b/ext/phar/util.c
@@ -925,7 +925,7 @@ phar_entry_info * phar_open_jit(phar_archive_data *phar, phar_entry_info *entry,
PHP_PHAR_API int phar_resolve_alias(char *alias, int alias_len, char **filename, int *filename_len TSRMLS_DC) /* {{{ */ {
phar_archive_data **fd_ptr;
- if (PHAR_GLOBALS->phar_alias_map.arBuckets
+ if (PHAR_GLOBALS->phar_alias_map.arHash
&& SUCCESS == zend_hash_find(&(PHAR_GLOBALS->phar_alias_map), alias, alias_len, (void**)&fd_ptr)) {
*filename = (*fd_ptr)->fname;
*filename_len = (*fd_ptr)->fname_len;
@@ -1253,7 +1253,7 @@ phar_entry_info *phar_get_entry_info_dir(phar_archive_data *phar, char *path, in
return NULL;
}
- if (!phar->manifest.arBuckets) {
+ if (!phar->manifest.arHash) {
return NULL;
}
@@ -1298,7 +1298,7 @@ phar_entry_info *phar_get_entry_info_dir(phar_archive_data *phar, char *path, in
}
}
- if (phar->mounted_dirs.arBuckets && zend_hash_num_elements(&phar->mounted_dirs)) {
+ if (phar->mounted_dirs.arHash && zend_hash_num_elements(&phar->mounted_dirs)) {
char *str_key;
ulong unused;
uint keylen;
diff --git a/ext/phar/zip.c b/ext/phar/zip.c
index f8f1d5120f..2fc692c33e 100644
--- a/ext/phar/zip.c
+++ b/ext/phar/zip.c
@@ -301,11 +301,11 @@ foundit:
entry.is_persistent = mydata->is_persistent;
#define PHAR_ZIP_FAIL_FREE(errmsg, save) \
zend_hash_destroy(&mydata->manifest); \
- mydata->manifest.arBuckets = 0; \
+ mydata->manifest.arHash = 0; \
zend_hash_destroy(&mydata->mounted_dirs); \
- mydata->mounted_dirs.arBuckets = 0; \
+ mydata->mounted_dirs.arHash = 0; \
zend_hash_destroy(&mydata->virtual_dirs); \
- mydata->virtual_dirs.arBuckets = 0; \
+ mydata->virtual_dirs.arHash = 0; \
php_stream_close(fp); \
if (mydata->metadata) { \
zval_dtor(mydata->metadata); \
@@ -325,11 +325,11 @@ foundit:
return FAILURE;
#define PHAR_ZIP_FAIL(errmsg) \
zend_hash_destroy(&mydata->manifest); \
- mydata->manifest.arBuckets = 0; \
+ mydata->manifest.arHash = 0; \
zend_hash_destroy(&mydata->mounted_dirs); \
- mydata->mounted_dirs.arBuckets = 0; \
+ mydata->mounted_dirs.arHash = 0; \
zend_hash_destroy(&mydata->virtual_dirs); \
- mydata->virtual_dirs.arBuckets = 0; \
+ mydata->virtual_dirs.arHash = 0; \
php_stream_close(fp); \
if (mydata->metadata) { \
zval_dtor(mydata->metadata); \
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index a24153dc20..e566711c1a 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -42,10 +42,9 @@
#include "zend_extensions.h"
#define reflection_update_property(object, name, value) do { \
- zval *member; \
- MAKE_STD_ZVAL(member); \
- ZVAL_STRINGL(member, name, sizeof(name)-1, 1); \
- zend_std_write_property(object, member, value, NULL TSRMLS_CC); \
+ zval member; \
+ ZVAL_STRINGL(&member, name, sizeof(name)-1); \
+ zend_std_write_property(object, &member, value, NULL TSRMLS_CC); \
Z_DELREF_P(value); \
zval_ptr_dtor(&member); \
} while (0)
@@ -95,12 +94,12 @@ ZEND_DECLARE_MODULE_GLOBALS(reflection)
return; \
#define RETURN_ON_EXCEPTION \
- if (EG(exception) && Z_OBJCE_P(EG(exception)) == reflection_exception_ptr) { \
+ if (EG(exception) && EG(exception)->ce == reflection_exception_ptr) { \
return; \
}
#define GET_REFLECTION_OBJECT_PTR(target) \
- intern = (reflection_object *) zend_object_store_get_object(getThis() TSRMLS_CC); \
+ intern = (reflection_object *) Z_OBJ_P(getThis()); \
if (intern == NULL || intern->ptr == NULL) { \
RETURN_ON_EXCEPTION \
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Internal error: Failed to retrieve the reflection object"); \
@@ -207,7 +206,7 @@ typedef struct {
zend_object zo;
void *ptr;
reflection_type_t ref_type;
- zval *obj;
+ zval obj;
zend_class_entry *ce;
unsigned int ignore_visibility:1;
} reflection_object;
@@ -218,13 +217,13 @@ static zend_object_handlers reflection_object_handlers;
static void _default_get_entry(zval *object, char *name, int name_len, zval *return_value TSRMLS_DC) /* {{{ */
{
- zval **value;
+ zval *value;
- if (zend_hash_find(Z_OBJPROP_P(object), name, name_len, (void **) &value) == FAILURE) {
+ if ((value = zend_hash_str_find(Z_OBJPROP_P(object), name, name_len)) == NULL) {
RETURN_FALSE;
}
- MAKE_COPY_ZVAL(value, return_value);
+ ZVAL_DUP(return_value, value);
}
/* }}} */
@@ -260,7 +259,7 @@ static zend_function *_copy_function(zend_function *fptr TSRMLS_DC) /* {{{ */
zend_function *copy_fptr;
copy_fptr = emalloc(sizeof(zend_function));
memcpy(copy_fptr, fptr, sizeof(zend_function));
- copy_fptr->internal_function.function_name = estrdup(fptr->internal_function.function_name);
+ copy_fptr->internal_function.function_name = STR_DUP(fptr->internal_function.function_name, 0);
return copy_fptr;
} else {
/* no copy needed */
@@ -281,7 +280,7 @@ static void _free_function(zend_function *fptr TSRMLS_DC) /* {{{ */
}
/* }}} */
-static void reflection_free_objects_storage(void *object TSRMLS_DC) /* {{{ */
+static void reflection_free_objects_storage(zend_object *object TSRMLS_DC) /* {{{ */
{
reflection_object *intern = (reflection_object *) object;
parameter_reference *reference;
@@ -310,16 +309,13 @@ static void reflection_free_objects_storage(void *object TSRMLS_DC) /* {{{ */
}
}
intern->ptr = NULL;
- if (intern->obj) {
- zval_ptr_dtor(&intern->obj);
- }
- zend_objects_free_object_storage(object TSRMLS_CC);
+ zval_ptr_dtor(&intern->obj);
+//??? zend_objects_free_object_storage(object TSRMLS_CC);
}
/* }}} */
-static zend_object_value reflection_objects_new(zend_class_entry *class_type TSRMLS_DC) /* {{{ */
+static zend_object *reflection_objects_new(zend_class_entry *class_type TSRMLS_DC) /* {{{ */
{
- zend_object_value retval;
reflection_object *intern;
intern = ecalloc(1, sizeof(reflection_object));
@@ -327,21 +323,14 @@ static zend_object_value reflection_objects_new(zend_class_entry *class_type TSR
zend_object_std_init(&intern->zo, class_type TSRMLS_CC);
object_properties_init(&intern->zo, class_type);
- retval.handle = zend_objects_store_put(intern, NULL, reflection_free_objects_storage, NULL TSRMLS_CC);
- retval.handlers = &reflection_object_handlers;
- return retval;
+ intern->zo.handlers = &reflection_object_handlers;
+ return (zend_object*)intern;
}
/* }}} */
static zval * reflection_instantiate(zend_class_entry *pce, zval *object TSRMLS_DC) /* {{{ */
{
- if (!object) {
- ALLOC_ZVAL(object);
- }
- Z_TYPE_P(object) = IS_OBJECT;
object_init_ex(object, pce);
- Z_SET_REFCOUNT_P(object, 1);
- Z_SET_ISREF_P(object);
return object;
}
/* }}} */
@@ -433,17 +422,16 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in
string_printf(str, "%s - Constants [%d] {\n", indent, count);
if (count > 0) {
HashPosition pos;
- zval **value;
- char *key;
- uint key_len;
+ zval *value;
+ zend_string *key;
ulong num_index;
zend_hash_internal_pointer_reset_ex(&ce->constants_table, &pos);
- while (zend_hash_get_current_data_ex(&ce->constants_table, (void **) &value, &pos) == SUCCESS) {
- zend_hash_get_current_key_ex(&ce->constants_table, &key, &key_len, &num_index, 0, &pos);
+ while ((value = zend_hash_get_current_data_ex(&ce->constants_table, &pos)) != NULL) {
+ zend_hash_get_current_key_ex(&ce->constants_table, &key, &num_index, 0, &pos);
- _const_string(str, key, *value, indent TSRMLS_CC);
+ _const_string(str, key->val, value, indent TSRMLS_CC);
zend_hash_move_forward_ex(&ce->constants_table, &pos);
}
}
@@ -460,7 +448,7 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in
zend_hash_internal_pointer_reset_ex(&ce->properties_info, &pos);
- while (zend_hash_get_current_data_ex(&ce->properties_info, (void **) &prop, &pos) == SUCCESS) {
+ while ((prop = zend_hash_get_current_data_ptr_ex(&ce->properties_info, &pos)) != NULL) {
if(prop->flags & ZEND_ACC_SHADOW) {
count_shadow_props++;
} else if (prop->flags & ZEND_ACC_STATIC) {
@@ -478,7 +466,7 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in
zend_hash_internal_pointer_reset_ex(&ce->properties_info, &pos);
- while (zend_hash_get_current_data_ex(&ce->properties_info, (void **) &prop, &pos) == SUCCESS) {
+ while ((prop = zend_hash_get_current_data_ptr_ex(&ce->properties_info, &pos)) != NULL) {
if ((prop->flags & ZEND_ACC_STATIC) && !(prop->flags & ZEND_ACC_SHADOW)) {
_property_string(str, prop, NULL, sub_indent.string TSRMLS_CC);
}
@@ -499,7 +487,7 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in
zend_hash_internal_pointer_reset_ex(&ce->function_table, &pos);
- while (zend_hash_get_current_data_ex(&ce->function_table, (void **) &mptr, &pos) == SUCCESS) {
+ while ((mptr = zend_hash_get_current_data_ptr_ex(&ce->function_table, &pos)) != NULL) {
if (mptr->common.fn_flags & ZEND_ACC_STATIC
&& ((mptr->common.fn_flags & ZEND_ACC_PRIVATE) == 0 || mptr->common.scope == ce))
{
@@ -517,7 +505,7 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in
zend_hash_internal_pointer_reset_ex(&ce->function_table, &pos);
- while (zend_hash_get_current_data_ex(&ce->function_table, (void **) &mptr, &pos) == SUCCESS) {
+ while ((mptr = zend_hash_get_current_data_ptr_ex(&ce->function_table, &pos)) != NULL) {
if (mptr->common.fn_flags & ZEND_ACC_STATIC
&& ((mptr->common.fn_flags & ZEND_ACC_PRIVATE) == 0 || mptr->common.scope == ce))
{
@@ -542,7 +530,7 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in
zend_hash_internal_pointer_reset_ex(&ce->properties_info, &pos);
- while (zend_hash_get_current_data_ex(&ce->properties_info, (void **) &prop, &pos) == SUCCESS) {
+ while ((prop = zend_hash_get_current_data_ptr_ex(&ce->properties_info, &pos)) != NULL) {
if (!(prop->flags & (ZEND_ACC_STATIC|ZEND_ACC_SHADOW))) {
_property_string(str, prop, NULL, sub_indent.string TSRMLS_CC);
}
@@ -564,16 +552,15 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in
if (properties && zend_hash_num_elements(properties)) {
zend_hash_internal_pointer_reset_ex(properties, &pos);
- while (zend_hash_get_current_data_ex(properties, (void **) &prop, &pos) == SUCCESS) {
- char *prop_name;
- uint prop_name_size;
+ while ((prop = zend_hash_get_current_data_ptr_ex(properties, &pos)) != NULL) {
+ zend_string *prop_name;
ulong index;
- if (zend_hash_get_current_key_ex(properties, &prop_name, &prop_name_size, &index, 1, &pos) == HASH_KEY_IS_STRING) {
- if (prop_name_size && prop_name[0]) { /* skip all private and protected properties */
- if (!zend_hash_quick_exists(&ce->properties_info, prop_name, prop_name_size, zend_get_hash_value(prop_name, prop_name_size))) {
+ if (zend_hash_get_current_key_ex(properties, &prop_name, &index, 1, &pos) == HASH_KEY_IS_STRING) {
+ if (prop_name->len && prop_name->val[0]) { /* skip all private and protected properties */
+ if (!zend_hash_exists(&ce->properties_info, prop_name)) {
count++;
- _property_string(&dyn, NULL, prop_name, sub_indent.string TSRMLS_CC);
+ _property_string(&dyn, NULL, prop_name->val, sub_indent.string TSRMLS_CC);
}
}
efree(prop_name);
@@ -600,20 +587,19 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in
string_init(&dyn);
zend_hash_internal_pointer_reset_ex(&ce->function_table, &pos);
- while (zend_hash_get_current_data_ex(&ce->function_table, (void **) &mptr, &pos) == SUCCESS) {
+ while ((mptr = zend_hash_get_current_data_ptr_ex(&ce->function_table, &pos)) != NULL) {
if ((mptr->common.fn_flags & ZEND_ACC_STATIC) == 0
&& ((mptr->common.fn_flags & ZEND_ACC_PRIVATE) == 0 || mptr->common.scope == ce))
{
- char *key;
- uint key_len;
+ zend_string *key;
ulong num_index;
- uint len = strlen(mptr->common.function_name);
+ uint len = mptr->common.function_name->len;
/* Do not display old-style inherited constructors */
if ((mptr->common.fn_flags & ZEND_ACC_CTOR) == 0
|| mptr->common.scope == ce
- || zend_hash_get_current_key_ex(&ce->function_table, &key, &key_len, &num_index, 0, &pos) != HASH_KEY_IS_STRING
- || zend_binary_strcasecmp(key, key_len-1, mptr->common.function_name, len) == 0)
+ || zend_hash_get_current_key_ex(&ce->function_table, &key, &num_index, 0, &pos) != HASH_KEY_IS_STRING
+ || zend_binary_strcasecmp(key->val, key->len-1, mptr->common.function_name->val, len) == 0)
{
zend_function *closure;
/* see if this is a closure */
@@ -726,33 +712,31 @@ static void _parameter_string(string *str, zend_function *fptr, struct _zend_arg
if (fptr->type == ZEND_USER_FUNCTION && offset >= required) {
zend_op *precv = _get_recv_op((zend_op_array*)fptr, offset);
if (precv && precv->opcode == ZEND_RECV_INIT && precv->op2_type != IS_UNUSED) {
- zval *zv, zv_copy;
+ zval zv, zv_copy;
int use_copy;
string_write(str, " = ", sizeof(" = ")-1);
- ALLOC_ZVAL(zv);
- *zv = *precv->op2.zv;
- zval_copy_ctor(zv);
- INIT_PZVAL(zv);
+ ZVAL_DUP(&zv, precv->op2.zv);
+//??? INIT_PZVAL(zv);
zval_update_constant_ex(&zv, (void*)1, fptr->common.scope TSRMLS_CC);
- if (Z_TYPE_P(zv) == IS_BOOL) {
- if (Z_LVAL_P(zv)) {
+ if (Z_TYPE(zv) == IS_BOOL) {
+ if (Z_LVAL(zv)) {
string_write(str, "true", sizeof("true")-1);
} else {
string_write(str, "false", sizeof("false")-1);
}
- } else if (Z_TYPE_P(zv) == IS_NULL) {
+ } else if (Z_TYPE(zv) == IS_NULL) {
string_write(str, "NULL", sizeof("NULL")-1);
- } else if (Z_TYPE_P(zv) == IS_STRING) {
+ } else if (Z_TYPE(zv) == IS_STRING) {
string_write(str, "'", sizeof("'")-1);
- string_write(str, Z_STRVAL_P(zv), MIN(Z_STRLEN_P(zv), 15));
- if (Z_STRLEN_P(zv) > 15) {
+ string_write(str, Z_STRVAL(zv), MIN(Z_STRLEN(zv), 15));
+ if (Z_STRLEN(zv) > 15) {
string_write(str, "...", sizeof("...")-1);
}
string_write(str, "'", sizeof("'")-1);
- } else if (Z_TYPE_P(zv) == IS_ARRAY) {
+ } else if (Z_TYPE(zv) == IS_ARRAY) {
string_write(str, "Array", sizeof("Array")-1);
} else {
- zend_make_printable_zval(zv, &zv_copy, &use_copy);
+ zend_make_printable_zval(&zv, &zv_copy, &use_copy);
string_write(str, Z_STRVAL(zv_copy), Z_STRLEN(zv_copy));
if (use_copy) {
zval_dtor(&zv_copy);
@@ -792,8 +776,7 @@ static void _function_closure_string(string *str, zend_function *fptr, char* ind
{
zend_uint i, count;
ulong num_index;
- char *key;
- uint key_len;
+ zend_string *key;
HashTable *static_variables;
HashPosition pos;
@@ -813,8 +796,8 @@ static void _function_closure_string(string *str, zend_function *fptr, char* ind
zend_hash_internal_pointer_reset_ex(static_variables, &pos);
i = 0;
while (i < count) {
- zend_hash_get_current_key_ex(static_variables, &key, &key_len, &num_index, 0, &pos);
- string_printf(str, "%s Variable #%d [ $%s ]\n", indent, i++, key);
+ zend_hash_get_current_key_ex(static_variables, &key, &num_index, 0, &pos);
+ string_printf(str, "%s Variable #%d [ $%s ]\n", indent, i++, key->val);
zend_hash_move_forward_ex(static_variables, &pos);
}
string_printf(str, "%s}\n", indent);
@@ -826,7 +809,7 @@ static void _function_string(string *str, zend_function *fptr, zend_class_entry
{
string param_indent;
zend_function *overwrites;
- char *lc_name;
+ zend_string *lc_name;
unsigned int lc_name_len;
/* TBD: Repair indenting of doc comment (or is this to be done in the parser?)
@@ -851,9 +834,10 @@ static void _function_string(string *str, zend_function *fptr, zend_class_entry
if (fptr->common.scope != scope) {
string_printf(str, ", inherits %s", fptr->common.scope->name);
} else if (fptr->common.scope->parent) {
- lc_name_len = strlen(fptr->common.function_name);
- lc_name = zend_str_tolower_dup(fptr->common.function_name, lc_name_len);
- if (zend_hash_find(&fptr->common.scope->parent->function_table, lc_name, lc_name_len + 1, (void**) &overwrites) == SUCCESS) {
+ lc_name_len = fptr->common.function_name->len;
+ lc_name = STR_ALLOC(lc_name_len, 0);
+ zend_str_tolower_copy(lc_name->val, fptr->common.function_name->val, lc_name_len);
+ if ((overwrites = zend_hash_find_ptr(&fptr->common.scope->parent->function_table, lc_name)) != NULL) {
if (fptr->common.scope != overwrites->common.scope) {
string_printf(str, ", overwrites %s", overwrites->common.scope->name);
}
@@ -958,7 +942,7 @@ static void _property_string(string *str, zend_property_info *prop, char *prop_n
string_printf(str, "static ");
}
- zend_unmangle_property_name(prop->name, prop->name_length, &class_name, (const char**)&prop_name);
+ zend_unmangle_property_name(prop->name->val, prop->name->len, &class_name, (const char**)&prop_name);
string_printf(str, "$%s", prop_name);
}
@@ -1026,7 +1010,7 @@ static int _extension_const_string(zend_constant *constant TSRMLS_DC, int num_ar
int *num_classes = va_arg(args, int*);
if (constant->module_number == module->module_number) {
- _const_string(str, constant->name, &constant->value, indent TSRMLS_CC);
+ _const_string(str, constant->name->val, &constant->value, indent TSRMLS_CC);
(*num_classes)++;
}
return ZEND_HASH_APPLY_KEEP;
@@ -1114,7 +1098,7 @@ static void _extension_string(string *str, zend_module_entry *module, char *inde
int first = 1;
zend_hash_internal_pointer_reset_ex(CG(function_table), &iterator);
- while (zend_hash_get_current_data_ex(CG(function_table), (void **) &fptr, &iterator) == SUCCESS) {
+ while ((fptr = zend_hash_get_current_data_ptr_ex(CG(function_table), &iterator)) != NULL) {
if (fptr->common.type==ZEND_INTERNAL_FUNCTION
&& fptr->internal_function.module == module) {
if (first) {
@@ -1191,16 +1175,15 @@ static void _function_check_flag(INTERNAL_FUNCTION_PARAMETERS, int mask)
PHPAPI void zend_reflection_class_factory(zend_class_entry *ce, zval *object TSRMLS_DC)
{
reflection_object *intern;
- zval *name;
+ zval name;
- MAKE_STD_ZVAL(name);
- ZVAL_STRINGL(name, ce->name, ce->name_length, 1);
+ ZVAL_STR(&name, STR_COPY(ce->name));
reflection_instantiate(reflection_class_ptr, object TSRMLS_CC);
- intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
+ intern = (reflection_object *) Z_STR_P(object);
intern->ptr = ce;
intern->ref_type = REF_TYPE_OTHER;
intern->ce = ce;
- reflection_update_property(object, "name", name);
+ reflection_update_property(object, "name", &name);
}
/* }}} */
@@ -1208,28 +1191,26 @@ PHPAPI void zend_reflection_class_factory(zend_class_entry *ce, zval *object TSR
static void reflection_extension_factory(zval *object, const char *name_str TSRMLS_DC)
{
reflection_object *intern;
- zval *name;
+ zval name;
int name_len = strlen(name_str);
- char *lcname;
+ zend_string *lcname;
struct _zend_module_entry *module;
- ALLOCA_FLAG(use_heap)
- lcname = do_alloca(name_len + 1, use_heap);
- zend_str_tolower_copy(lcname, name_str, name_len);
- if (zend_hash_find(&module_registry, lcname, name_len + 1, (void **)&module) == FAILURE) {
- free_alloca(lcname, use_heap);
+ lcname = STR_ALLOC(name_len, 0);
+ zend_str_tolower_copy(lcname->val, name_str, name_len);
+ module = zend_hash_find_ptr(&module_registry, lcname);
+ STR_FREE(lcname);
+ if (!module) {
return;
}
- free_alloca(lcname, use_heap);
reflection_instantiate(reflection_extension_ptr, object TSRMLS_CC);
- intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
- MAKE_STD_ZVAL(name);
- ZVAL_STRINGL(name, module->name, name_len, 1);
+ intern = (reflection_object *) Z_OBJ_P(object);
+ ZVAL_STRINGL(&name, module->name, name_len);
intern->ptr = module;
intern->ref_type = REF_TYPE_OTHER;
intern->ce = NULL;
- reflection_update_property(object, "name", name);
+ reflection_update_property(object, "name", &name);
}
/* }}} */
@@ -1238,19 +1219,18 @@ static void reflection_parameter_factory(zend_function *fptr, zval *closure_obje
{
reflection_object *intern;
parameter_reference *reference;
- zval *name;
+ zval name;
if (closure_object) {
Z_ADDREF_P(closure_object);
}
- MAKE_STD_ZVAL(name);
if (arg_info->name) {
- ZVAL_STRINGL(name, arg_info->name, arg_info->name_len, 1);
+ ZVAL_STRINGL(&name, arg_info->name, arg_info->name_len);
} else {
- ZVAL_NULL(name);
+ ZVAL_NULL(&name);
}
reflection_instantiate(reflection_parameter_ptr, object TSRMLS_CC);
- intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
+ intern = (reflection_object *) Z_OBJ_P(object);
reference = (parameter_reference*) emalloc(sizeof(parameter_reference));
reference->arg_info = arg_info;
reference->offset = offset;
@@ -1259,8 +1239,8 @@ static void reflection_parameter_factory(zend_function *fptr, zval *closure_obje
intern->ptr = reference;
intern->ref_type = REF_TYPE_PARAMETER;
intern->ce = fptr->common.scope;
- intern->obj = closure_object;
- reflection_update_property(object, "name", name);
+ ZVAL_COPY_VALUE(&intern->obj, closure_object);
+ reflection_update_property(object, "name", &name);
}
/* }}} */
@@ -1268,21 +1248,20 @@ static void reflection_parameter_factory(zend_function *fptr, zval *closure_obje
static void reflection_function_factory(zend_function *function, zval *closure_object, zval *object TSRMLS_DC)
{
reflection_object *intern;
- zval *name;
+ zval name;
if (closure_object) {
Z_ADDREF_P(closure_object);
}
- MAKE_STD_ZVAL(name);
- ZVAL_STRING(name, function->common.function_name, 1);
+ ZVAL_STR(&name, STR_COPY(function->common.function_name));
reflection_instantiate(reflection_function_ptr, object TSRMLS_CC);
- intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
+ intern = (reflection_object *) Z_OBJ_P(object);
intern->ptr = function;
intern->ref_type = REF_TYPE_FUNCTION;
intern->ce = NULL;
- intern->obj = closure_object;
- reflection_update_property(object, "name", name);
+ ZVAL_COPY_VALUE(&intern->obj, closure_object);
+ reflection_update_property(object, "name", &name);
}
/* }}} */
@@ -1290,25 +1269,23 @@ static void reflection_function_factory(zend_function *function, zval *closure_o
static void reflection_method_factory(zend_class_entry *ce, zend_function *method, zval *closure_object, zval *object TSRMLS_DC)
{
reflection_object *intern;
- zval *name;
- zval *classname;
+ zval name;
+ zval classname;
if (closure_object) {
Z_ADDREF_P(closure_object);
}
- MAKE_STD_ZVAL(name);
- MAKE_STD_ZVAL(classname);
- ZVAL_STRING(name, (method->common.scope && method->common.scope->trait_aliases)?
- zend_resolve_method_name(ce, method) : method->common.function_name, 1);
- ZVAL_STRINGL(classname, method->common.scope->name, method->common.scope->name_length, 1);
+ ZVAL_STR(&name, STR_COPY((method->common.scope && method->common.scope->trait_aliases)?
+ zend_resolve_method_name(ce, method) : method->common.function_name));
+ ZVAL_STR(&classname, STR_COPY(method->common.scope->name));
reflection_instantiate(reflection_method_ptr, object TSRMLS_CC);
- intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
+ intern = (reflection_object *) Z_OBJ_P(object);
intern->ptr = method;
intern->ref_type = REF_TYPE_FUNCTION;
intern->ce = ce;
- intern->obj = closure_object;
- reflection_update_property(object, "name", name);
- reflection_update_property(object, "class", classname);
+ ZVAL_COPY_VALUE(&intern->obj, closure_object);
+ reflection_update_property(object, "name", &name);
+ reflection_update_property(object, "class", &classname);
}
/* }}} */
@@ -1316,19 +1293,19 @@ static void reflection_method_factory(zend_class_entry *ce, zend_function *metho
static void reflection_property_factory(zend_class_entry *ce, zend_property_info *prop, zval *object TSRMLS_DC)
{
reflection_object *intern;
- zval *name;
- zval *classname;
+ zval name;
+ zval classname;
property_reference *reference;
const char *class_name, *prop_name;
- zend_unmangle_property_name(prop->name, prop->name_length, &class_name, &prop_name);
+ zend_unmangle_property_name(prop->name->val, prop->name->len, &class_name, &prop_name);
if (!(prop->flags & ZEND_ACC_PRIVATE)) {
/* we have to search the class hierarchy for this (implicit) public or protected property */
zend_class_entry *tmp_ce = ce, *store_ce = ce;
zend_property_info *tmp_info = NULL;
- while (tmp_ce && zend_hash_find(&tmp_ce->properties_info, prop_name, strlen(prop_name) + 1, (void **) &tmp_info) != SUCCESS) {
+ while (tmp_ce && (tmp_info = zend_hash_str_find_ptr(&tmp_ce->properties_info, prop_name, strlen(prop_name))) == NULL) {
ce = tmp_ce;
tmp_ce = tmp_ce->parent;
}
@@ -1340,13 +1317,11 @@ static void reflection_property_factory(zend_class_entry *ce, zend_property_info
}
}
- MAKE_STD_ZVAL(name);
- MAKE_STD_ZVAL(classname);
- ZVAL_STRING(name, prop_name, 1);
- ZVAL_STRINGL(classname, prop->ce->name, prop->ce->name_length, 1);
+ ZVAL_STRING(&name, prop_name);
+ ZVAL_STR(&classname, STR_COPY(prop->ce->name));
reflection_instantiate(reflection_property_ptr, object TSRMLS_CC);
- intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
+ intern = (reflection_object *) Z_OBJ_P(object);
reference = (property_reference*) emalloc(sizeof(property_reference));
reference->ce = ce;
reference->prop = *prop;
@@ -1354,23 +1329,22 @@ static void reflection_property_factory(zend_class_entry *ce, zend_property_info
intern->ref_type = REF_TYPE_PROPERTY;
intern->ce = ce;
intern->ignore_visibility = 0;
- reflection_update_property(object, "name", name);
- reflection_update_property(object, "class", classname);
+ reflection_update_property(object, "name", &name);
+ reflection_update_property(object, "class", &classname);
}
/* }}} */
/* {{{ _reflection_export */
static void _reflection_export(INTERNAL_FUNCTION_PARAMETERS, zend_class_entry *ce_ptr, int ctor_argc)
{
- zval *reflector_ptr;
+ zval reflector;
zval output, *output_ptr = &output;
zval *argument_ptr, *argument2_ptr;
- zval *retval_ptr, **params[2];
+ zval retval, params[2];
int result;
int return_output = 0;
zend_fcall_info fci;
zend_fcall_info_cache fcc;
- zval fname;
if (ctor_argc == 1) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|b", &argument_ptr, &return_output) == FAILURE) {
@@ -1382,24 +1356,23 @@ static void _reflection_export(INTERNAL_FUNCTION_PARAMETERS, zend_class_entry *c
}
}
- INIT_PZVAL(&output);
+//??? INIT_PZVAL(&output);
/* Create object */
- MAKE_STD_ZVAL(reflector_ptr);
- if (object_and_properties_init(reflector_ptr, ce_ptr, NULL) == FAILURE) {
+ if (object_and_properties_init(&reflector, ce_ptr, NULL) == FAILURE) {
_DO_THROW("Could not create reflector");
}
/* Call __construct() */
- params[0] = &argument_ptr;
- params[1] = &argument2_ptr;
+ ZVAL_COPY_VALUE(&params[0], argument_ptr);
+ ZVAL_COPY_VALUE(&params[1], argument2_ptr);
fci.size = sizeof(fci);
fci.function_table = NULL;
- fci.function_name = NULL;
+ ZVAL_UNDEF(&fci.function_name);
fci.symbol_table = NULL;
- fci.object_ptr = reflector_ptr;
- fci.retval_ptr_ptr = &retval_ptr;
+ fci.object_ptr = &reflector;
+ fci.retval = &retval;
fci.param_count = ctor_argc;
fci.params = params;
fci.no_separation = 1;
@@ -1407,34 +1380,32 @@ static void _reflection_export(INTERNAL_FUNCTION_PARAMETERS, zend_class_entry *c
fcc.initialized = 1;
fcc.function_handler = ce_ptr->constructor;
fcc.calling_scope = ce_ptr;
- fcc.called_scope = Z_OBJCE_P(reflector_ptr);
- fcc.object_ptr = reflector_ptr;
+ fcc.called_scope = Z_OBJCE(reflector);
+ fcc.object_ptr = &reflector;
result = zend_call_function(&fci, &fcc TSRMLS_CC);
- if (retval_ptr) {
- zval_ptr_dtor(&retval_ptr);
- }
+ zval_ptr_dtor(&retval);
if (EG(exception)) {
- zval_ptr_dtor(&reflector_ptr);
+ zval_ptr_dtor(&reflector);
return;
}
if (result == FAILURE) {
- zval_ptr_dtor(&reflector_ptr);
+ zval_ptr_dtor(&reflector);
_DO_THROW("Could not create reflector");
}
/* Call static reflection::export */
ZVAL_BOOL(&output, return_output);
- params[0] = &reflector_ptr;
- params[1] = &output_ptr;
+ ZVAL_COPY_VALUE(&params[0], &reflector);
+ ZVAL_COPY_VALUE(&params[1], output_ptr);
- ZVAL_STRINGL(&fname, "reflection::export", sizeof("reflection::export") - 1, 0);
+//??? ZVAL_STRINGL(&fname, "reflection::export", sizeof("reflection::export") - 1, 0);
+ ZVAL_STRINGL(&fci.function_name, "reflection::export", sizeof("reflection::export") - 1);
fci.function_table = &reflection_ptr->function_table;
- fci.function_name = &fname;
fci.object_ptr = NULL;
- fci.retval_ptr_ptr = &retval_ptr;
+ fci.retval = &retval;
fci.param_count = 2;
fci.params = params;
fci.no_separation = 1;
@@ -1442,19 +1413,19 @@ static void _reflection_export(INTERNAL_FUNCTION_PARAMETERS, zend_class_entry *c
result = zend_call_function(&fci, NULL TSRMLS_CC);
if (result == FAILURE && EG(exception) == NULL) {
- zval_ptr_dtor(&reflector_ptr);
- zval_ptr_dtor(&retval_ptr);
+ zval_ptr_dtor(&reflector);
+ zval_ptr_dtor(&retval);
_DO_THROW("Could not execute reflection::export()");
}
if (return_output) {
- COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr);
+ COPY_PZVAL_TO_ZVAL(*return_value, &retval);
} else {
- zval_ptr_dtor(&retval_ptr);
+ zval_ptr_dtor(&retval);
}
/* Destruct reflector which is no longer needed */
- zval_ptr_dtor(&reflector_ptr);
+ zval_ptr_dtor(&reflector);
}
/* }}} */
@@ -1464,9 +1435,9 @@ static parameter_reference *_reflection_param_get_default_param(INTERNAL_FUNCTIO
reflection_object *intern;
parameter_reference *param;
- intern = (reflection_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
+ intern = (reflection_object *) Z_OBJ_P(getThis());
if (intern == NULL || intern->ptr == NULL) {
- if (EG(exception) && Z_OBJCE_P(EG(exception)) == reflection_exception_ptr) {
+ if (EG(exception) && EG(exception)->ce == reflection_exception_ptr) {
return NULL;
}
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Internal error: Failed to retrieve the reflection object");
@@ -1513,7 +1484,7 @@ ZEND_METHOD(reflection, __clone)
Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */
ZEND_METHOD(reflection, export)
{
- zval *object, fname, *retval_ptr;
+ zval *object, fname, retval;
int result;
zend_bool return_output = 0;
@@ -1522,8 +1493,8 @@ ZEND_METHOD(reflection, export)
}
/* Invoke the __toString() method */
- ZVAL_STRINGL(&fname, "__tostring", sizeof("__tostring") - 1, 1);
- result= call_user_function_ex(NULL, &object, &fname, &retval_ptr, 0, NULL, 0, NULL TSRMLS_CC);
+ ZVAL_STRINGL(&fname, "__tostring", sizeof("__tostring") - 1);
+ result= call_user_function_ex(NULL, object, &fname, &retval, 0, NULL, 0, NULL TSRMLS_CC);
zval_dtor(&fname);
if (result == FAILURE) {
@@ -1531,18 +1502,18 @@ ZEND_METHOD(reflection, export)
/* Returns from this function */
}
- if (!retval_ptr) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::__toString() did not return anything", Z_OBJCE_P(object)->name);
+ if (Z_TYPE(retval) == IS_UNDEF) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::__toString() did not return anything", Z_OBJCE_P(object)->name->val);
RETURN_FALSE;
}
if (return_output) {
- COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr);
+ COPY_PZVAL_TO_ZVAL(*return_value, &retval);
} else {
/* No need for _r variant, return of __toString should always be a string */
- zend_print_zval(retval_ptr, 0);
+ zend_print_zval(&retval, 0);
zend_printf("\n");
- zval_ptr_dtor(&retval_ptr);
+ zval_ptr_dtor(&retval);
}
}
/* }}} */
@@ -1600,7 +1571,7 @@ ZEND_METHOD(reflection_function, export)
Constructor. Throws an Exception in case the given function does not exist */
ZEND_METHOD(reflection_function, __construct)
{
- zval *name;
+ zval name;
zval *object;
zval *closure = NULL;
char *lcname;
@@ -1610,7 +1581,7 @@ ZEND_METHOD(reflection_function, __construct)
int name_len;
object = getThis();
- intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
+ intern = (reflection_object *) Z_OBJ_P(object);
if (intern == NULL) {
return;
}
@@ -1630,7 +1601,7 @@ ZEND_METHOD(reflection_function, __construct)
name_len--;
}
- if (zend_hash_find(EG(function_table), nsname, name_len + 1, (void **)&fptr) == FAILURE) {
+ if ((fptr = zend_hash_str_find_ptr(EG(function_table), nsname, name_len)) == NULL) {
efree(lcname);
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
"Function %s() does not exist", name_str);
@@ -1641,12 +1612,11 @@ ZEND_METHOD(reflection_function, __construct)
return;
}
- MAKE_STD_ZVAL(name);
- ZVAL_STRING(name, fptr->common.function_name, 1);
- reflection_update_property(object, "name", name);
+ ZVAL_STR(&name, STR_COPY(fptr->common.function_name));
+ reflection_update_property(object, "name", &name);
intern->ptr = fptr;
intern->ref_type = REF_TYPE_FUNCTION;
- intern->obj = closure;
+ ZVAL_COPY_VALUE(&intern->obj, closure);
intern->ce = NULL;
}
/* }}} */
@@ -1665,7 +1635,8 @@ ZEND_METHOD(reflection_function, __toString)
GET_REFLECTION_OBJECT_PTR(fptr);
string_init(&str);
_function_string(&str, fptr, intern->ce, "" TSRMLS_CC);
- RETURN_STRINGL(str.string, str.len - 1, 0);
+//??? RETURN_STRINGL(str.string, str.len - 1, 0);
+ RETURN_STRINGL(str.string, str.len - 1);
}
/* }}} */
@@ -1676,7 +1647,7 @@ ZEND_METHOD(reflection_function, getName)
if (zend_parse_parameters_none() == FAILURE) {
return;
}
- _default_get_entry(getThis(), "name", sizeof("name"), return_value TSRMLS_CC);
+ _default_get_entry(getThis(), "name", sizeof("name")-1, return_value TSRMLS_CC);
}
/* }}} */
@@ -1707,8 +1678,8 @@ ZEND_METHOD(reflection_function, getClosureThis)
return;
}
GET_REFLECTION_OBJECT_PTR(fptr);
- if (intern->obj) {
- closure_this = zend_get_closure_this_ptr(intern->obj TSRMLS_CC);
+ if (Z_TYPE(intern->obj) != IS_UNDEF) {
+ closure_this = zend_get_closure_this_ptr(&intern->obj TSRMLS_CC);
if (closure_this) {
RETURN_ZVAL(closure_this, 1, 0);
}
@@ -1728,8 +1699,8 @@ ZEND_METHOD(reflection_function, getClosureScopeClass)
return;
}
GET_REFLECTION_OBJECT_PTR(fptr);
- if (intern->obj) {
- closure_func = zend_get_closure_method_def(intern->obj TSRMLS_CC);
+ if (Z_TYPE(intern->obj) != IS_UNDEF) {
+ closure_func = zend_get_closure_method_def(&intern->obj TSRMLS_CC);
if (closure_func && closure_func->common.scope) {
zend_reflection_class_factory(closure_func->common.scope, return_value TSRMLS_CC);
}
@@ -1809,7 +1780,7 @@ ZEND_METHOD(reflection_function, getFileName)
}
GET_REFLECTION_OBJECT_PTR(fptr);
if (fptr->type == ZEND_USER_FUNCTION) {
- RETURN_STRING(fptr->op_array.filename, 1);
+ RETURN_STR(STR_COPY(fptr->op_array.filename));
}
RETURN_FALSE;
}
@@ -1863,7 +1834,7 @@ ZEND_METHOD(reflection_function, getDocComment)
}
GET_REFLECTION_OBJECT_PTR(fptr);
if (fptr->type == ZEND_USER_FUNCTION && fptr->op_array.doc_comment) {
- RETURN_STRINGL(fptr->op_array.doc_comment, fptr->op_array.doc_comment_len, 1);
+ RETURN_STR(STR_COPY(fptr->op_array.doc_comment));
}
RETURN_FALSE;
}
@@ -1873,7 +1844,6 @@ ZEND_METHOD(reflection_function, getDocComment)
Returns an associative array containing this function's static variables and their values */
ZEND_METHOD(reflection_function, getStaticVariables)
{
- zval *tmp_copy;
reflection_object *intern;
zend_function *fptr;
@@ -1886,7 +1856,7 @@ ZEND_METHOD(reflection_function, getStaticVariables)
array_init(return_value);
if (fptr->type == ZEND_USER_FUNCTION && fptr->op_array.static_variables != NULL) {
zend_hash_apply_with_argument(fptr->op_array.static_variables, (apply_func_arg_t) zval_update_constant_inline_change, fptr->common.scope TSRMLS_CC);
- zend_hash_copy(Z_ARRVAL_P(return_value), fptr->op_array.static_variables, (copy_ctor_func_t) zval_add_ref, (void *) &tmp_copy, sizeof(zval *));
+ zend_hash_copy(Z_ARRVAL_P(return_value), fptr->op_array.static_variables, zval_add_ref);
}
}
/* }}} */
@@ -1895,8 +1865,9 @@ ZEND_METHOD(reflection_function, getStaticVariables)
Invokes the function */
ZEND_METHOD(reflection_function, invoke)
{
- zval *retval_ptr;
- zval ***params = NULL;
+ zval retval;
+//???
+ zval *params = NULL;
int result, num_args = 0;
zend_fcall_info fci;
zend_fcall_info_cache fcc;
@@ -1912,10 +1883,10 @@ ZEND_METHOD(reflection_function, invoke)
fci.size = sizeof(fci);
fci.function_table = NULL;
- fci.function_name = NULL;
+ ZVAL_UNDEF(&fci.function_name);
fci.symbol_table = NULL;
fci.object_ptr = NULL;
- fci.retval_ptr_ptr = &retval_ptr;
+ fci.retval = &retval;
fci.param_count = num_args;
fci.params = params;
fci.no_separation = 1;
@@ -1938,15 +1909,16 @@ ZEND_METHOD(reflection_function, invoke)
return;
}
- if (retval_ptr) {
- COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr);
+ if (Z_TYPE(retval) != IS_UNDEF) {
+ COPY_PZVAL_TO_ZVAL(*return_value, &retval);
}
}
/* }}} */
-static int _zval_array_to_c_array(zval **arg, zval ****params TSRMLS_DC) /* {{{ */
+static int _zval_array_to_c_array(zval *arg, zval **params TSRMLS_DC) /* {{{ */
{
- *(*params)++ = arg;
+ ZVAL_COPY_VALUE((*params), arg);
+ (*params)++;
return ZEND_HASH_APPLY_KEEP;
} /* }}} */
@@ -1954,8 +1926,8 @@ static int _zval_array_to_c_array(zval **arg, zval ****params TSRMLS_DC) /* {{{
Invokes the function and pass its arguments as array. */
ZEND_METHOD(reflection_function, invokeArgs)
{
- zval *retval_ptr;
- zval ***params;
+ zval retval;
+ zval *params;
int result;
int argc;
zend_fcall_info fci;
@@ -1973,16 +1945,16 @@ ZEND_METHOD(reflection_function, invokeArgs)
argc = zend_hash_num_elements(Z_ARRVAL_P(param_array));
- params = safe_emalloc(sizeof(zval **), argc, 0);
+ params = safe_emalloc(sizeof(zval), argc, 0);
zend_hash_apply_with_argument(Z_ARRVAL_P(param_array), (apply_func_arg_t)_zval_array_to_c_array, &params TSRMLS_CC);
params -= argc;
fci.size = sizeof(fci);
fci.function_table = NULL;
- fci.function_name = NULL;
+ ZVAL_UNDEF(&fci.function_name);
fci.symbol_table = NULL;
fci.object_ptr = NULL;
- fci.retval_ptr_ptr = &retval_ptr;
+ fci.retval = &retval;
fci.param_count = argc;
fci.params = params;
fci.no_separation = 1;
@@ -2003,8 +1975,8 @@ ZEND_METHOD(reflection_function, invokeArgs)
return;
}
- if (retval_ptr) {
- COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr);
+ if (Z_TYPE(retval) != IS_UNDEF) {
+ COPY_PZVAL_TO_ZVAL(*return_value, &retval);
}
}
/* }}} */
@@ -2067,11 +2039,10 @@ ZEND_METHOD(reflection_function, getParameters)
array_init(return_value);
for (i = 0; i < fptr->common.num_args; i++) {
- zval *parameter;
+ zval parameter;
- ALLOC_ZVAL(parameter);
- reflection_parameter_factory(_copy_function(fptr TSRMLS_CC), intern->obj, arg_info, i, fptr->common.required_num_args, parameter TSRMLS_CC);
- add_next_index_zval(return_value, parameter);
+ reflection_parameter_factory(_copy_function(fptr TSRMLS_CC), &intern->obj, arg_info, i, fptr->common.required_num_args, &parameter TSRMLS_CC);
+ add_next_index_zval(return_value, &parameter);
arg_info++;
}
@@ -2119,7 +2090,7 @@ ZEND_METHOD(reflection_function, getExtensionName)
internal = (zend_internal_function *)fptr;
if (internal->module) {
- RETURN_STRING(internal->module->name, 1);
+ RETURN_STRING(internal->module->name);
} else {
RETURN_FALSE;
}
@@ -2139,9 +2110,9 @@ ZEND_METHOD(reflection_parameter, export)
ZEND_METHOD(reflection_parameter, __construct)
{
parameter_reference *ref;
- zval *reference, **parameter;
+ zval *reference, *parameter;
zval *object;
- zval *name;
+ zval name;
reflection_object *intern;
zend_function *fptr;
struct _zend_arg_info *arg_info;
@@ -2149,12 +2120,12 @@ ZEND_METHOD(reflection_parameter, __construct)
zend_class_entry *ce = NULL;
zend_bool is_closure = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zZ", &reference, &parameter) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &reference, &parameter) == FAILURE) {
return;
}
object = getThis();
- intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
+ intern = (reflection_object *) Z_OBJ_P(object);
if (intern == NULL) {
return;
}
@@ -2167,7 +2138,7 @@ ZEND_METHOD(reflection_parameter, __construct)
lcname_len = Z_STRLEN_P(reference);
lcname = zend_str_tolower_dup(Z_STRVAL_P(reference), lcname_len);
- if (zend_hash_find(EG(function_table), lcname, lcname_len + 1, (void**) &fptr) == FAILURE) {
+ if ((fptr = zend_hash_str_find_ptr(EG(function_table), lcname, lcname_len)) == NULL) {
efree(lcname);
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
"Function %s() does not exist", Z_STRVAL_P(reference));
@@ -2179,45 +2150,43 @@ ZEND_METHOD(reflection_parameter, __construct)
break;
case IS_ARRAY: {
- zval **classref;
- zval **method;
- zend_class_entry **pce;
+ zval *classref;
+ zval *method;
unsigned int lcname_len;
char *lcname;
- if ((zend_hash_index_find(Z_ARRVAL_P(reference), 0, (void **) &classref) == FAILURE)
- || (zend_hash_index_find(Z_ARRVAL_P(reference), 1, (void **) &method) == FAILURE))
+ if (((classref =zend_hash_index_find(Z_ARRVAL_P(reference), 0)) == NULL)
+ || ((method = zend_hash_index_find(Z_ARRVAL_P(reference), 1)) == NULL))
{
_DO_THROW("Expected array($object, $method) or array($classname, $method)");
/* returns out of this function */
}
- if (Z_TYPE_PP(classref) == IS_OBJECT) {
- ce = Z_OBJCE_PP(classref);
+ if (Z_TYPE_P(classref) == IS_OBJECT) {
+ ce = Z_OBJCE_P(classref);
} else {
convert_to_string_ex(classref);
- if (zend_lookup_class(Z_STRVAL_PP(classref), Z_STRLEN_PP(classref), &pce TSRMLS_CC) == FAILURE) {
+ if ((ce = zend_lookup_class(Z_STR_P(classref) TSRMLS_CC)) == NULL) {
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
- "Class %s does not exist", Z_STRVAL_PP(classref));
+ "Class %s does not exist", Z_STRVAL_P(classref));
return;
}
- ce = *pce;
}
convert_to_string_ex(method);
- lcname_len = Z_STRLEN_PP(method);
- lcname = zend_str_tolower_dup(Z_STRVAL_PP(method), lcname_len);
- if (ce == zend_ce_closure && Z_TYPE_PP(classref) == IS_OBJECT
+ lcname_len = Z_STRLEN_P(method);
+ lcname = zend_str_tolower_dup(Z_STRVAL_P(method), lcname_len);
+ if (ce == zend_ce_closure && Z_TYPE_P(classref) == IS_OBJECT
&& (lcname_len == sizeof(ZEND_INVOKE_FUNC_NAME)-1)
&& memcmp(lcname, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) == 0
- && (fptr = zend_get_closure_invoke_method(*classref TSRMLS_CC)) != NULL)
+ && (fptr = zend_get_closure_invoke_method(classref TSRMLS_CC)) != NULL)
{
/* nothing to do. don't set is_closure since is the invoke handler,
- not the closure itself */
- } else if (zend_hash_find(&ce->function_table, lcname, lcname_len + 1, (void **) &fptr) == FAILURE) {
+ } else if ((fptr = zend_hash_str_find_ptr(&ce->function_table, lcname, lcname_len)) == NULL) {
efree(lcname);
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
- "Method %s::%s() does not exist", ce->name, Z_STRVAL_PP(method));
+ "Method %s::%s() does not exist", ce->name->val, Z_STRVAL_P(method));
return;
}
efree(lcname);
@@ -2231,7 +2200,7 @@ ZEND_METHOD(reflection_parameter, __construct)
fptr = (zend_function *)zend_get_closure_method_def(reference TSRMLS_CC);
Z_ADDREF_P(reference);
is_closure = 1;
- } else if (zend_hash_find(&ce->function_table, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME), (void **)&fptr) == FAILURE) {
+ } else if ((fptr = zend_hash_str_find_ptr(&ce->function_table, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME))) == NULL) {
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
"Method %s::%s() does not exist", ce->name, ZEND_INVOKE_FUNC_NAME);
return;
@@ -2246,17 +2215,17 @@ ZEND_METHOD(reflection_parameter, __construct)
/* Now, search for the parameter */
arg_info = fptr->common.arg_info;
- if (Z_TYPE_PP(parameter) == IS_LONG) {
- position= Z_LVAL_PP(parameter);
+ if (Z_TYPE_P(parameter) == IS_LONG) {
+ position= Z_LVAL_P(parameter);
if (position < 0 || (zend_uint)position >= fptr->common.num_args) {
if (fptr->common.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) {
if (fptr->type != ZEND_OVERLOADED_FUNCTION) {
- efree((char*)fptr->common.function_name);
+ STR_RELEASE(fptr->common.function_name);
}
efree(fptr);
}
if (is_closure) {
- zval_ptr_dtor(&reference);
+ zval_ptr_dtor(reference);
}
_DO_THROW("The parameter specified by its offset could not be found");
/* returns out of this function */
@@ -2267,7 +2236,7 @@ ZEND_METHOD(reflection_parameter, __construct)
position= -1;
convert_to_string_ex(parameter);
for (i = 0; i < fptr->common.num_args; i++) {
- if (arg_info[i].name && strcmp(arg_info[i].name, Z_STRVAL_PP(parameter)) == 0) {
+ if (arg_info[i].name && strcmp(arg_info[i].name, Z_STRVAL_P(parameter)) == 0) {
position= i;
break;
}
@@ -2275,25 +2244,24 @@ ZEND_METHOD(reflection_parameter, __construct)
if (position == -1) {
if (fptr->common.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) {
if (fptr->type != ZEND_OVERLOADED_FUNCTION) {
- efree((char*)fptr->common.function_name);
+ STR_RELEASE(fptr->common.function_name);
}
efree(fptr);
}
if (is_closure) {
- zval_ptr_dtor(&reference);
+ zval_ptr_dtor(reference);
}
_DO_THROW("The parameter specified by its name could not be found");
/* returns out of this function */
}
}
- MAKE_STD_ZVAL(name);
if (arg_info[position].name) {
- ZVAL_STRINGL(name, arg_info[position].name, arg_info[position].name_len, 1);
+ ZVAL_STRINGL(&name, arg_info[position].name, arg_info[position].name_len);
} else {
- ZVAL_NULL(name);
+ ZVAL_NULL(&name);
}
- reflection_update_property(object, "name", name);
+ reflection_update_property(object, "name", &name);
ref = (parameter_reference*) emalloc(sizeof(parameter_reference));
ref->arg_info = &arg_info[position];
@@ -2305,7 +2273,7 @@ ZEND_METHOD(reflection_parameter, __construct)
intern->ref_type = REF_TYPE_PARAMETER;
intern->ce = ce;
if (reference && is_closure) {
- intern->obj = reference;
+ ZVAL_COPY_VALUE(&intern->obj, reference);
}
}
/* }}} */
@@ -2324,7 +2292,8 @@ ZEND_METHOD(reflection_parameter, __toString)
GET_REFLECTION_OBJECT_PTR(param);
string_init(&str);
_parameter_string(&str, param->fptr, param->arg_info, param->offset, param->required, "" TSRMLS_CC);
- RETURN_STRINGL(str.string, str.len - 1, 0);
+///??? RETURN_STRINGL(str.string, str.len - 1, 0);
+ RETURN_STRINGL(str.string, str.len - 1);
}
/* }}} */
@@ -2335,7 +2304,7 @@ ZEND_METHOD(reflection_parameter, getName)
if (zend_parse_parameters_none() == FAILURE) {
return;
}
- _default_get_entry(getThis(), "name", sizeof("name"), return_value TSRMLS_CC);
+ _default_get_entry(getThis(), "name", sizeof("name")-1, return_value TSRMLS_CC);
}
/* }}} */
@@ -2352,9 +2321,9 @@ ZEND_METHOD(reflection_parameter, getDeclaringFunction)
GET_REFLECTION_OBJECT_PTR(param);
if (!param->fptr->common.scope) {
- reflection_function_factory(_copy_function(param->fptr TSRMLS_CC), intern->obj, return_value TSRMLS_CC);
+ reflection_function_factory(_copy_function(param->fptr TSRMLS_CC), &intern->obj, return_value TSRMLS_CC);
} else {
- reflection_method_factory(param->fptr->common.scope, _copy_function(param->fptr TSRMLS_CC), intern->obj, return_value TSRMLS_CC);
+ reflection_method_factory(param->fptr->common.scope, _copy_function(param->fptr TSRMLS_CC), &intern->obj, return_value TSRMLS_CC);
}
}
/* }}} */
@@ -2383,7 +2352,7 @@ ZEND_METHOD(reflection_parameter, getClass)
{
reflection_object *intern;
parameter_reference *param;
- zend_class_entry **pce, *ce;
+ zend_class_entry *ce;
if (zend_parse_parameters_none() == FAILURE) {
return;
@@ -2410,7 +2379,6 @@ ZEND_METHOD(reflection_parameter, getClass)
"Parameter uses 'self' as type hint but function is not a class member!");
return;
}
- pce= &ce;
} else if (0 == zend_binary_strcasecmp(param->arg_info->class_name, param->arg_info->class_name_len, "parent", sizeof("parent")- 1)) {
ce = param->fptr->common.scope;
if (!ce) {
@@ -2423,13 +2391,18 @@ ZEND_METHOD(reflection_parameter, getClass)
"Parameter uses 'parent' as type hint although class does not have a parent!");
return;
}
- pce= &ce->parent;
- } else if (zend_lookup_class(param->arg_info->class_name, param->arg_info->class_name_len, &pce TSRMLS_CC) == FAILURE) {
- zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
- "Class %s does not exist", param->arg_info->class_name);
- return;
+ ce = ce->parent;
+ } else {
+ zend_string *name = STR_INIT(param->arg_info->class_name, param->arg_info->class_name_len, 0);
+ ce = zend_lookup_class(name TSRMLS_CC);
+ STR_FREE(name);
+ if (!ce) {
+ zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
+ "Class %s does not exist", param->arg_info->class_name);
+ return;
+ }
}
- zend_reflection_class_factory(*pce, return_value TSRMLS_CC);
+ zend_reflection_class_factory(ce, return_value TSRMLS_CC);
}
}
/* }}} */
@@ -2594,12 +2567,12 @@ ZEND_METHOD(reflection_parameter, getDefaultValue)
return;
}
- *return_value = *precv->op2.zv;
- INIT_PZVAL(return_value);
+ ZVAL_COPY_VALUE(return_value, precv->op2.zv);
+//??? INIT_PZVAL(return_value);
if (!IS_CONSTANT_TYPE(Z_TYPE_P(return_value))) {
zval_copy_ctor(return_value);
}
- zval_update_constant_ex(&return_value, (void*)0, param->fptr->common.scope TSRMLS_CC);
+ zval_update_constant_ex(return_value, (void*)0, param->fptr->common.scope TSRMLS_CC);
}
/* }}} */
@@ -2646,7 +2619,7 @@ ZEND_METHOD(reflection_parameter, getDefaultValueConstantName)
precv = _reflection_param_get_default_precv(INTERNAL_FUNCTION_PARAM_PASSTHRU, param);
if (precv && (Z_TYPE_P(precv->op2.zv) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT) {
- RETURN_STRINGL(Z_STRVAL_P(precv->op2.zv), Z_STRLEN_P(precv->op2.zv), 1);
+ RETURN_STR(STR_COPY(Z_STR_P(precv->op2.zv)));
}
}
/* }}} */
@@ -2679,11 +2652,10 @@ ZEND_METHOD(reflection_method, export)
Constructor. Throws an Exception in case the given method does not exist */
ZEND_METHOD(reflection_method, __construct)
{
- zval *name, *classname;
+ zval name, *classname;
zval *object, *orig_obj;
reflection_object *intern;
char *lcname;
- zend_class_entry **pce;
zend_class_entry *ce;
zend_function *mptr;
char *name_str, *tmp;
@@ -2700,7 +2672,7 @@ ZEND_METHOD(reflection_method, __construct)
}
classname = &ztmp;
tmp_len = tmp - name_str;
- ZVAL_STRINGL(classname, name_str, tmp_len, 1);
+ ZVAL_STRINGL(classname, name_str, tmp_len);
name_len = name_len - (tmp_len + 2);
name_str = tmp + 2;
orig_obj = NULL;
@@ -2711,7 +2683,7 @@ ZEND_METHOD(reflection_method, __construct)
}
object = getThis();
- intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
+ intern = (reflection_object *) Z_OBJ_P(object);
if (intern == NULL) {
return;
}
@@ -2719,7 +2691,7 @@ ZEND_METHOD(reflection_method, __construct)
/* Find the class entry */
switch (Z_TYPE_P(classname)) {
case IS_STRING:
- if (zend_lookup_class(Z_STRVAL_P(classname), Z_STRLEN_P(classname), &pce TSRMLS_CC) == FAILURE) {
+ if ((ce = zend_lookup_class(Z_STR_P(classname) TSRMLS_CC)) == NULL) {
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
"Class %s does not exist", Z_STRVAL_P(classname));
if (classname == &ztmp) {
@@ -2727,7 +2699,6 @@ ZEND_METHOD(reflection_method, __construct)
}
return;
}
- ce = *pce;
break;
case IS_OBJECT:
@@ -2753,22 +2724,18 @@ ZEND_METHOD(reflection_method, __construct)
&& (mptr = zend_get_closure_invoke_method(orig_obj TSRMLS_CC)) != NULL)
{
/* do nothing, mptr already set */
- } else if (zend_hash_find(&ce->function_table, lcname, name_len + 1, (void **) &mptr) == FAILURE) {
+ } else if ((mptr = zend_hash_str_find_ptr(&ce->function_table, lcname, name_len)) == NULL) {
efree(lcname);
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
- "Method %s::%s() does not exist", ce->name, name_str);
+ "Method %s::%s() does not exist", ce->name->val, name_str);
return;
}
efree(lcname);
- MAKE_STD_ZVAL(classname);
- ZVAL_STRINGL(classname, mptr->common.scope->name, mptr->common.scope->name_length, 1);
-
- reflection_update_property(object, "class", classname);
-
- MAKE_STD_ZVAL(name);
- ZVAL_STRING(name, mptr->common.function_name, 1);
- reflection_update_property(object, "name", name);
+ ZVAL_STR(&name, STR_COPY(mptr->common.scope->name));
+ reflection_update_property(object, "class", &name);
+ ZVAL_STR(&name, STR_COPY(mptr->common.function_name));
+ reflection_update_property(object, "name", &name);
intern->ptr = mptr;
intern->ref_type = REF_TYPE_FUNCTION;
intern->ce = ce;
@@ -2789,7 +2756,8 @@ ZEND_METHOD(reflection_method, __toString)
GET_REFLECTION_OBJECT_PTR(mptr);
string_init(&str);
_function_string(&str, mptr, intern->ce, "" TSRMLS_CC);
- RETURN_STRINGL(str.string, str.len - 1, 0);
+//??? RETURN_STRINGL(str.string, str.len - 1, 0);
+ RETURN_STRINGL(str.string, str.len - 1);
}
/* }}} */
@@ -2832,9 +2800,10 @@ ZEND_METHOD(reflection_method, getClosure)
Invokes the method. */
ZEND_METHOD(reflection_method, invoke)
{
- zval *retval_ptr;
- zval ***params = NULL;
- zval *object_ptr;
+ zval retval;
+//???
+ zval *params = NULL;
+ zval object;
reflection_object *intern;
zend_function *mptr;
int result, num_args = 0;
@@ -2875,16 +2844,16 @@ ZEND_METHOD(reflection_method, invoke)
* Else, we verify that the given object is an instance of the class.
*/
if (mptr->common.fn_flags & ZEND_ACC_STATIC) {
- object_ptr = NULL;
+ ZVAL_UNDEF(&object);
obj_ce = mptr->common.scope;
} else {
- if (Z_TYPE_PP(params[0]) != IS_OBJECT) {
+ if (Z_TYPE(params[0]) != IS_OBJECT) {
efree(params);
_DO_THROW("Non-object passed to Invoke()");
/* Returns from this function */
}
- obj_ce = Z_OBJCE_PP(params[0]);
+ obj_ce = Z_OBJCE(params[0]);
if (!instanceof_function(obj_ce, mptr->common.scope TSRMLS_CC)) {
if (params) {
@@ -2894,15 +2863,15 @@ ZEND_METHOD(reflection_method, invoke)
/* Returns from this function */
}
- object_ptr = *params[0];
+ ZVAL_COPY_VALUE(&object, &params[0]);
}
fci.size = sizeof(fci);
fci.function_table = NULL;
- fci.function_name = NULL;
+ ZVAL_UNDEF(&fci.function_name);
fci.symbol_table = NULL;
- fci.object_ptr = object_ptr;
- fci.retval_ptr_ptr = &retval_ptr;
+ fci.object_ptr = &object;
+ fci.retval = &retval;
fci.param_count = num_args - 1;
fci.params = params + 1;
fci.no_separation = 1;
@@ -2911,7 +2880,7 @@ ZEND_METHOD(reflection_method, invoke)
fcc.function_handler = mptr;
fcc.calling_scope = obj_ce;
fcc.called_scope = intern->ce;
- fcc.object_ptr = object_ptr;
+ fcc.object_ptr = &object;
result = zend_call_function(&fci, &fcc TSRMLS_CC);
@@ -2925,8 +2894,8 @@ ZEND_METHOD(reflection_method, invoke)
return;
}
- if (retval_ptr) {
- COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr);
+ if (Z_TYPE(retval) != IS_UNDEF) {
+ COPY_PZVAL_TO_ZVAL(*return_value, &retval);
}
}
/* }}} */
@@ -2935,8 +2904,8 @@ ZEND_METHOD(reflection_method, invoke)
Invokes the function and pass its arguments as array. */
ZEND_METHOD(reflection_method, invokeArgs)
{
- zval *retval_ptr;
- zval ***params;
+ zval retval;
+ zval *params;
zval *object;
reflection_object *intern;
zend_function *mptr;
@@ -2975,7 +2944,7 @@ ZEND_METHOD(reflection_method, invokeArgs)
argc = zend_hash_num_elements(Z_ARRVAL_P(param_array));
- params = safe_emalloc(sizeof(zval **), argc, 0);
+ params = safe_emalloc(sizeof(zval), argc, 0);
zend_hash_apply_with_argument(Z_ARRVAL_P(param_array), (apply_func_arg_t)_zval_array_to_c_array, &params TSRMLS_CC);
params -= argc;
@@ -3008,10 +2977,10 @@ ZEND_METHOD(reflection_method, invokeArgs)
fci.size = sizeof(fci);
fci.function_table = NULL;
- fci.function_name = NULL;
+ ZVAL_UNDEF(&fci.function_name);
fci.symbol_table = NULL;
fci.object_ptr = object;
- fci.retval_ptr_ptr = &retval_ptr;
+ fci.retval = &retval;
fci.param_count = argc;
fci.params = params;
fci.no_separation = 1;
@@ -3040,8 +3009,8 @@ ZEND_METHOD(reflection_method, invokeArgs)
return;
}
- if (retval_ptr) {
- COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr);
+ if (Z_TYPE(retval) != IS_UNDEF) {
+ COPY_PZVAL_TO_ZVAL(*return_value, &retval);
}
}
/* }}} */
@@ -3122,18 +3091,18 @@ ZEND_METHOD(reflection_function, isVariadic)
Returns whether this function is defined in namespace */
ZEND_METHOD(reflection_function, inNamespace)
{
- zval **name;
+ zval *name;
const char *backslash;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
- if (zend_hash_find(Z_OBJPROP_P(getThis()), "name", sizeof("name"), (void **) &name) == FAILURE) {
+ if ((name = zend_hash_str_find(Z_OBJPROP_P(getThis()), "name", sizeof("name")-1)) == NULL) {
RETURN_FALSE;
}
- if (Z_TYPE_PP(name) == IS_STRING
- && (backslash = zend_memrchr(Z_STRVAL_PP(name), '\\', Z_STRLEN_PP(name)))
- && backslash > Z_STRVAL_PP(name))
+ if (Z_TYPE_P(name) == IS_STRING
+ && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRLEN_P(name)))
+ && backslash > Z_STRVAL_P(name))
{
RETURN_TRUE;
}
@@ -3145,20 +3114,20 @@ ZEND_METHOD(reflection_function, inNamespace)
Returns the name of namespace where this function is defined */
ZEND_METHOD(reflection_function, getNamespaceName)
{
- zval **name;
+ zval *name;
const char *backslash;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
- if (zend_hash_find(Z_OBJPROP_P(getThis()), "name", sizeof("name"), (void **) &name) == FAILURE) {
+ if ((name = zend_hash_str_find(Z_OBJPROP_P(getThis()), "name", sizeof("name")-1)) == NULL) {
RETURN_FALSE;
}
- if (Z_TYPE_PP(name) == IS_STRING
- && (backslash = zend_memrchr(Z_STRVAL_PP(name), '\\', Z_STRLEN_PP(name)))
- && backslash > Z_STRVAL_PP(name))
+ if (Z_TYPE_P(name) == IS_STRING
+ && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRLEN_P(name)))
+ && backslash > Z_STRVAL_P(name))
{
- RETURN_STRINGL(Z_STRVAL_PP(name), backslash - Z_STRVAL_PP(name), 1);
+ RETURN_STRINGL(Z_STRVAL_P(name), backslash - Z_STRVAL_P(name));
}
RETURN_EMPTY_STRING();
}
@@ -3168,22 +3137,22 @@ ZEND_METHOD(reflection_function, getNamespaceName)
Returns the short name of the function (without namespace part) */
ZEND_METHOD(reflection_function, getShortName)
{
- zval **name;
+ zval *name;
const char *backslash;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
- if (zend_hash_find(Z_OBJPROP_P(getThis()), "name", sizeof("name"), (void **) &name) == FAILURE) {
+ if ((name = zend_hash_str_find(Z_OBJPROP_P(getThis()), "name", sizeof("name")-1)) == NULL) {
RETURN_FALSE;
}
- if (Z_TYPE_PP(name) == IS_STRING
- && (backslash = zend_memrchr(Z_STRVAL_PP(name), '\\', Z_STRLEN_PP(name)))
- && backslash > Z_STRVAL_PP(name))
+ if (Z_TYPE_P(name) == IS_STRING
+ && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRLEN_P(name)))
+ && backslash > Z_STRVAL_P(name))
{
- RETURN_STRINGL(backslash + 1, Z_STRLEN_PP(name) - (backslash - Z_STRVAL_PP(name) + 1), 1);
+ RETURN_STRINGL(backslash + 1, Z_STRLEN_P(name) - (backslash - Z_STRVAL_P(name) + 1));
}
- RETURN_ZVAL(*name, 1, 0);
+ RETURN_ZVAL(name, 1, 0);
}
/* }}} */
@@ -3289,7 +3258,7 @@ ZEND_METHOD(reflection_method, setAccessible)
return;
}
- intern = (reflection_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
+ intern = (reflection_object *) Z_OBJ_P(getThis());
if (intern == NULL) {
return;
@@ -3312,9 +3281,9 @@ static void reflection_class_object_ctor(INTERNAL_FUNCTION_PARAMETERS, int is_ob
{
zval *argument;
zval *object;
- zval *classname;
+ zval classname;
reflection_object *intern;
- zend_class_entry **ce;
+ zend_class_entry *ce;
if (is_object) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &argument) == FAILURE) {
@@ -3327,34 +3296,32 @@ static void reflection_class_object_ctor(INTERNAL_FUNCTION_PARAMETERS, int is_ob
}
object = getThis();
- intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
+ intern = (reflection_object *) Z_OBJ_P(object);
if (intern == NULL) {
return;
}
if (Z_TYPE_P(argument) == IS_OBJECT) {
- MAKE_STD_ZVAL(classname);
- ZVAL_STRINGL(classname, Z_OBJCE_P(argument)->name, Z_OBJCE_P(argument)->name_length, 1);
- reflection_update_property(object, "name", classname);
+ ZVAL_STR(&classname, STR_COPY(Z_OBJCE_P(argument)->name));
+ reflection_update_property(object, "name", &classname);
intern->ptr = Z_OBJCE_P(argument);
if (is_object) {
- intern->obj = argument;
- zval_add_ref(&argument);
+ ZVAL_COPY_VALUE(&intern->obj, argument);
+ zval_add_ref(argument);
}
} else {
- convert_to_string_ex(&argument);
- if (zend_lookup_class(Z_STRVAL_P(argument), Z_STRLEN_P(argument), &ce TSRMLS_CC) == FAILURE) {
+ convert_to_string_ex(argument);
+ if ((ce = zend_lookup_class(Z_STR_P(argument) TSRMLS_CC)) == NULL) {
if (!EG(exception)) {
zend_throw_exception_ex(reflection_exception_ptr, -1 TSRMLS_CC, "Class %s does not exist", Z_STRVAL_P(argument));
}
return;
}
- MAKE_STD_ZVAL(classname);
- ZVAL_STRINGL(classname, (*ce)->name, (*ce)->name_length, 1);
- reflection_update_property(object, "name", classname);
+ ZVAL_STR(&classname, STR_COPY(ce->name));
+ reflection_update_property(object, "name", &classname);
- intern->ptr = *ce;
+ intern->ptr = ce;
}
intern->ref_type = REF_TYPE_OTHER;
}
@@ -3373,14 +3340,13 @@ static void add_class_vars(zend_class_entry *ce, int statics, zval *return_value
{
HashPosition pos;
zend_property_info *prop_info;
- zval *prop, *prop_copy;
- char *key;
- uint key_len;
+ zval *prop, prop_copy;
+ zend_string *key;
ulong num_index;
zend_hash_internal_pointer_reset_ex(&ce->properties_info, &pos);
- while (zend_hash_get_current_data_ex(&ce->properties_info, (void **) &prop_info, &pos) == SUCCESS) {
- zend_hash_get_current_key_ex(&ce->properties_info, &key, &key_len, &num_index, 0, &pos);
+ while ((prop_info = zend_hash_get_current_data_ptr_ex(&ce->properties_info, &pos)) != NULL) {
+ zend_hash_get_current_key_ex(&ce->properties_info, &key, &num_index, 0, &pos);
zend_hash_move_forward_ex(&ce->properties_info, &pos);
if (((prop_info->flags & ZEND_ACC_SHADOW) &&
prop_info->ce != ce) ||
@@ -3393,9 +3359,9 @@ static void add_class_vars(zend_class_entry *ce, int statics, zval *return_value
prop = NULL;
if (prop_info->offset >= 0) {
if (statics && (prop_info->flags & ZEND_ACC_STATIC) != 0) {
- prop = ce->default_static_members_table[prop_info->offset];
+ prop = &ce->default_static_members_table[prop_info->offset];
} else if (!statics && (prop_info->flags & ZEND_ACC_STATIC) == 0) {
- prop = ce->default_properties_table[prop_info->offset];
+ prop = &ce->default_properties_table[prop_info->offset];
}
}
if (!prop) {
@@ -3403,18 +3369,17 @@ static void add_class_vars(zend_class_entry *ce, int statics, zval *return_value
}
/* copy: enforce read only access */
- ALLOC_ZVAL(prop_copy);
- *prop_copy = *prop;
- zval_copy_ctor(prop_copy);
- INIT_PZVAL(prop_copy);
+ ZVAL_DUP(&prop_copy, prop);
+//??? INIT_PZVAL(prop_copy);
/* this is necessary to make it able to work with default array
* properties, returned to user */
- if (IS_CONSTANT_TYPE(Z_TYPE_P(prop_copy))) {
+ if (IS_CONSTANT_TYPE(Z_TYPE(prop_copy))) {
zval_update_constant(&prop_copy, (void *) 1 TSRMLS_CC);
}
- add_assoc_zval(return_value, key, prop_copy);
+//??? add_assoc_zval(return_value, key, &prop_copy);
+ add_assoc_zval(return_value, key->val, &prop_copy);
}
}
/* }}} */
@@ -3445,28 +3410,27 @@ ZEND_METHOD(reflection_class, getStaticPropertyValue)
{
reflection_object *intern;
zend_class_entry *ce;
- char *name;
- int name_len;
- zval **prop, *def_value = NULL;
+ zend_string *name;
+ zval *prop, *def_value = NULL;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z", &name, &name_len, &def_value) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|z", &name, &def_value) == FAILURE) {
return;
}
GET_REFLECTION_OBJECT_PTR(ce);
zend_update_class_constants(ce TSRMLS_CC);
- prop = zend_std_get_static_property(ce, name, name_len, 1, NULL TSRMLS_CC);
+ prop = zend_std_get_static_property(ce, name, 1, NULL TSRMLS_CC);
if (!prop) {
if (def_value) {
RETURN_ZVAL(def_value, 1, 0);
} else {
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
- "Class %s does not have a property named %s", ce->name, name);
+ "Class %s does not have a property named %s", ce->name->val, name);
}
return;
} else {
- RETURN_ZVAL(*prop, 1, 0);
+ RETURN_ZVAL(prop, 1, 0);
}
}
/* }}} */
@@ -3477,32 +3441,30 @@ ZEND_METHOD(reflection_class, setStaticPropertyValue)
{
reflection_object *intern;
zend_class_entry *ce;
- char *name;
- int name_len;
- zval **variable_ptr, *value;
- int refcount;
- zend_uchar is_ref;
+ zend_string *name;
+ zval *variable_ptr, *value;
+//??? int refcount;
+//??? zend_uchar is_ref;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz", &name, &name_len, &value) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz", &name, &value) == FAILURE) {
return;
}
GET_REFLECTION_OBJECT_PTR(ce);
zend_update_class_constants(ce TSRMLS_CC);
- variable_ptr = zend_std_get_static_property(ce, name, name_len, 1, NULL TSRMLS_CC);
+ variable_ptr = zend_std_get_static_property(ce, name, 1, NULL TSRMLS_CC);
if (!variable_ptr) {
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
- "Class %s does not have a property named %s", ce->name, name);
+ "Class %s does not have a property named %s", ce->name->val, name);
return;
}
- refcount = Z_REFCOUNT_PP(variable_ptr);
- is_ref = Z_ISREF_PP(variable_ptr);
- zval_dtor(*variable_ptr);
- **variable_ptr = *value;
- zval_copy_ctor(*variable_ptr);
- Z_SET_REFCOUNT_PP(variable_ptr, refcount);
- Z_SET_ISREF_TO_PP(variable_ptr, is_ref);
+//??? refcount = Z_REFCOUNT_PP(variable_ptr);
+//??? is_ref = Z_ISREF_PP(variable_ptr);
+ zval_dtor(variable_ptr);
+ ZVAL_DUP(variable_ptr, value);
+//??? Z_SET_REFCOUNT_PP(variable_ptr, refcount);
+//??? Z_SET_ISREF_TO_PP(variable_ptr, is_ref);
}
/* }}} */
@@ -3538,8 +3500,9 @@ ZEND_METHOD(reflection_class, __toString)
}
GET_REFLECTION_OBJECT_PTR(ce);
string_init(&str);
- _class_string(&str, ce, intern->obj, "" TSRMLS_CC);
- RETURN_STRINGL(str.string, str.len - 1, 0);
+ _class_string(&str, ce, &intern->obj, "" TSRMLS_CC);
+//??? RETURN_STRINGL(str.string, str.len - 1, 0);
+ RETURN_STRINGL(str.string, str.len - 1);
}
/* }}} */
@@ -3550,7 +3513,7 @@ ZEND_METHOD(reflection_class, getName)
if (zend_parse_parameters_none() == FAILURE) {
return;
}
- _default_get_entry(getThis(), "name", sizeof("name"), return_value TSRMLS_CC);
+ _default_get_entry(getThis(), "name", sizeof("name")-1, return_value TSRMLS_CC);
}
/* }}} */
@@ -3596,7 +3559,7 @@ ZEND_METHOD(reflection_class, getFileName)
}
GET_REFLECTION_OBJECT_PTR(ce);
if (ce->type == ZEND_USER_CLASS) {
- RETURN_STRING(ce->info.user.filename, 1);
+ RETURN_STR(STR_COPY(ce->info.user.filename));
}
RETURN_FALSE;
}
@@ -3650,7 +3613,7 @@ ZEND_METHOD(reflection_class, getDocComment)
}
GET_REFLECTION_OBJECT_PTR(ce);
if (ce->type == ZEND_USER_CLASS && ce->info.user.doc_comment) {
- RETURN_STRINGL(ce->info.user.doc_comment, ce->info.user.doc_comment_len, 1);
+ RETURN_STR(STR_COPY(ce->info.user.doc_comment));
}
RETURN_FALSE;
}
@@ -3694,7 +3657,7 @@ ZEND_METHOD(reflection_class, hasMethod)
lc_name = zend_str_tolower_dup(name, name_len);
if ((ce == zend_ce_closure && (name_len == sizeof(ZEND_INVOKE_FUNC_NAME)-1)
&& memcmp(lc_name, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) == 0)
- || zend_hash_exists(&ce->function_table, lc_name, name_len + 1)) {
+ || zend_hash_str_exists(&ce->function_table, lc_name, name_len)) {
efree(lc_name);
RETURN_TRUE;
} else {
@@ -3722,15 +3685,15 @@ ZEND_METHOD(reflection_class, getMethod)
GET_REFLECTION_OBJECT_PTR(ce);
lc_name = zend_str_tolower_dup(name, name_len);
- if (ce == zend_ce_closure && intern->obj && (name_len == sizeof(ZEND_INVOKE_FUNC_NAME)-1)
+ if (ce == zend_ce_closure && Z_TYPE(intern->obj) != IS_UNDEF && (name_len == sizeof(ZEND_INVOKE_FUNC_NAME)-1)
&& memcmp(lc_name, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) == 0
- && (mptr = zend_get_closure_invoke_method(intern->obj TSRMLS_CC)) != NULL)
+ && (mptr = zend_get_closure_invoke_method(&intern->obj TSRMLS_CC)) != NULL)
{
/* don't assign closure_object since we only reflect the invoke handler
method and not the closure definition itself */
reflection_method_factory(ce, mptr, NULL, return_value TSRMLS_CC);
efree(lc_name);
- } else if (ce == zend_ce_closure && !intern->obj && (name_len == sizeof(ZEND_INVOKE_FUNC_NAME)-1)
+ } else if (ce == zend_ce_closure && Z_TYPE(intern->obj) == IS_UNDEF && (name_len == sizeof(ZEND_INVOKE_FUNC_NAME)-1)
&& memcmp(lc_name, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) == 0
&& object_init_ex(&obj_tmp, ce) == SUCCESS && (mptr = zend_get_closure_invoke_method(&obj_tmp TSRMLS_CC)) != NULL) {
/* don't assign closure_object since we only reflect the invoke handler
@@ -3738,7 +3701,7 @@ ZEND_METHOD(reflection_class, getMethod)
reflection_method_factory(ce, mptr, NULL, return_value TSRMLS_CC);
zval_dtor(&obj_tmp);
efree(lc_name);
- } else if (zend_hash_find(&ce->function_table, lc_name, name_len + 1, (void**) &mptr) == SUCCESS) {
+ } else if ((mptr = zend_hash_str_find_ptr(&ce->function_table, lc_name, name_len)) != NULL) {
reflection_method_factory(ce, mptr, NULL, return_value TSRMLS_CC);
efree(lc_name);
} else {
@@ -3753,14 +3716,13 @@ ZEND_METHOD(reflection_class, getMethod)
/* {{{ _addmethod */
static void _addmethod(zend_function *mptr, zend_class_entry *ce, zval *retval, long filter, zval *obj TSRMLS_DC)
{
- zval *method;
- uint len = strlen(mptr->common.function_name);
+ zval method;
+ uint len = mptr->common.function_name->len;
zend_function *closure;
if (mptr->common.fn_flags & filter) {
- ALLOC_ZVAL(method);
if (ce == zend_ce_closure && obj && (len == sizeof(ZEND_INVOKE_FUNC_NAME)-1)
- && memcmp(mptr->common.function_name, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) == 0
+ && memcmp(mptr->common.function_name->val, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) == 0
&& (closure = zend_get_closure_invoke_method(obj TSRMLS_CC)) != NULL)
{
mptr = closure;
@@ -3768,8 +3730,8 @@ static void _addmethod(zend_function *mptr, zend_class_entry *ce, zval *retval,
/* don't assign closure_object since we only reflect the invoke handler
method and not the closure definition itself, even if we have a
closure */
- reflection_method_factory(ce, mptr, NULL, method TSRMLS_CC);
- add_next_index_zval(retval, method);
+ reflection_method_factory(ce, mptr, NULL, &method TSRMLS_CC);
+ add_next_index_zval(retval, &method);
}
}
/* }}} */
@@ -3810,10 +3772,10 @@ ZEND_METHOD(reflection_class, getMethods)
array_init(return_value);
zend_hash_apply_with_arguments(&ce->function_table TSRMLS_CC, (apply_func_args_t) _addmethod_va, 4, &ce, return_value, filter, intern->obj);
- if (intern->obj && instanceof_function(ce, zend_ce_closure TSRMLS_CC)) {
- zend_function *closure = zend_get_closure_invoke_method(intern->obj TSRMLS_CC);
+ if (Z_TYPE(intern->obj) != IS_UNDEF && instanceof_function(ce, zend_ce_closure TSRMLS_CC)) {
+ zend_function *closure = zend_get_closure_invoke_method(&intern->obj TSRMLS_CC);
if (closure) {
- _addmethod(closure, ce, return_value, filter, intern->obj TSRMLS_CC);
+ _addmethod(closure, ce, return_value, filter, &intern->obj TSRMLS_CC);
_free_function(closure TSRMLS_CC);
}
}
@@ -3827,26 +3789,24 @@ ZEND_METHOD(reflection_class, hasProperty)
reflection_object *intern;
zend_property_info *property_info;
zend_class_entry *ce;
- char *name;
- int name_len;
- zval *property;
+ zend_string *name;
+ zval property;
METHOD_NOTSTATIC(reflection_class_ptr);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &name) == FAILURE) {
return;
}
GET_REFLECTION_OBJECT_PTR(ce);
- if (zend_hash_find(&ce->properties_info, name, name_len+1, (void **) &property_info) == SUCCESS) {
+ if ((property_info = zend_hash_find_ptr(&ce->properties_info, name)) != NULL) {
if (property_info->flags & ZEND_ACC_SHADOW) {
RETURN_FALSE;
}
RETURN_TRUE;
} else {
- if (intern->obj && Z_OBJ_HANDLER_P(intern->obj, has_property)) {
- MAKE_STD_ZVAL(property);
- ZVAL_STRINGL(property, name, name_len, 1);
- if (Z_OBJ_HANDLER_P(intern->obj, has_property)(intern->obj, property, 2, 0 TSRMLS_CC)) {
+ if (Z_TYPE(intern->obj) != IS_UNDEF && Z_OBJ_HANDLER(intern->obj, has_property)) {
+ ZVAL_STR(&property, STR_COPY(name));
+ if (Z_OBJ_HANDLER(intern->obj, has_property)(&intern->obj, &property, 2, 0 TSRMLS_CC)) {
zval_ptr_dtor(&property);
RETURN_TRUE;
}
@@ -3862,75 +3822,77 @@ ZEND_METHOD(reflection_class, hasProperty)
ZEND_METHOD(reflection_class, getProperty)
{
reflection_object *intern;
- zend_class_entry *ce, **pce;
+ zend_class_entry *ce, *ce2;
zend_property_info *property_info;
- char *name, *tmp, *classname;
- int name_len, classname_len;
+ zend_string *name, *classname;
+ char *tmp, *str_name;
+ int classname_len, str_name_len;
METHOD_NOTSTATIC(reflection_class_ptr);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &name) == FAILURE) {
return;
}
GET_REFLECTION_OBJECT_PTR(ce);
- if (zend_hash_find(&ce->properties_info, name, name_len + 1, (void**) &property_info) == SUCCESS) {
+ if ((property_info = zend_hash_find_ptr(&ce->properties_info, name)) != NULL) {
if ((property_info->flags & ZEND_ACC_SHADOW) == 0) {
reflection_property_factory(ce, property_info, return_value TSRMLS_CC);
return;
}
- } else if (intern->obj) {
+ } else if (Z_TYPE(intern->obj) != IS_UNDEF) {
/* Check for dynamic properties */
- if (zend_hash_exists(Z_OBJ_HT_P(intern->obj)->get_properties(intern->obj TSRMLS_CC), name, name_len+1)) {
+ if (zend_hash_exists(Z_OBJ_HT(intern->obj)->get_properties(&intern->obj TSRMLS_CC), name)) {
zend_property_info property_info_tmp;
property_info_tmp.flags = ZEND_ACC_IMPLICIT_PUBLIC;
- property_info_tmp.name = estrndup(name, name_len);
- property_info_tmp.name_length = name_len;
- property_info_tmp.h = zend_get_hash_value(name, name_len+1);
+ property_info_tmp.name = STR_COPY(name);
property_info_tmp.doc_comment = NULL;
property_info_tmp.ce = ce;
reflection_property_factory(ce, &property_info_tmp, return_value TSRMLS_CC);
- intern = (reflection_object *) zend_object_store_get_object(return_value TSRMLS_CC);
+ intern = (reflection_object *) Z_OBJ_P(return_value);
intern->ref_type = REF_TYPE_DYNAMIC_PROPERTY;
return;
}
}
- if ((tmp = strstr(name, "::")) != NULL) {
- classname_len = tmp - name;
- classname = zend_str_tolower_dup(name, classname_len);
- classname[classname_len] = '\0';
- name_len = name_len - (classname_len + 2);
- name = tmp + 2;
-
- if (zend_lookup_class(classname, classname_len, &pce TSRMLS_CC) == FAILURE) {
+ str_name = name->val;
+ str_name_len = name->len;
+ if ((tmp = strstr(name->val, "::")) != NULL) {
+ classname_len = tmp - name->val;
+ classname = STR_ALLOC(classname_len, 0);
+ zend_str_tolower_copy(classname->val, name->val, classname_len);
+ classname->val[classname_len] = '\0';
+ str_name_len = name->len - (classname_len + 2);
+ str_name = tmp + 2;
+
+ ce2 = zend_lookup_class(classname TSRMLS_CC);
+ STR_FREE(classname);
+ if (!ce2) {
if (!EG(exception)) {
zend_throw_exception_ex(reflection_exception_ptr, -1 TSRMLS_CC, "Class %s does not exist", classname);
}
- efree(classname);
return;
}
- efree(classname);
- if (!instanceof_function(ce, *pce TSRMLS_CC)) {
- zend_throw_exception_ex(reflection_exception_ptr, -1 TSRMLS_CC, "Fully qualified property name %s::%s does not specify a base class of %s", (*pce)->name, name, ce->name);
+ if (!instanceof_function(ce, ce2 TSRMLS_CC)) {
+ zend_throw_exception_ex(reflection_exception_ptr, -1 TSRMLS_CC, "Fully qualified property name %s::%s does not specify a base class of %s", ce2->name, str_name, ce->name->val);
return;
}
- ce = *pce;
+ ce = ce2;
- if (zend_hash_find(&ce->properties_info, name, name_len + 1, (void**) &property_info) == SUCCESS && (property_info->flags & ZEND_ACC_SHADOW) == 0) {
+ if ((property_info = zend_hash_str_find_ptr(&ce->properties_info, str_name, str_name_len)) != NULL && (property_info->flags & ZEND_ACC_SHADOW) == 0) {
reflection_property_factory(ce, property_info, return_value TSRMLS_CC);
return;
}
}
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
- "Property %s does not exist", name);
+ "Property %s does not exist", str_name);
}
/* }}} */
/* {{{ _addproperty */
static int _addproperty(zend_property_info *pptr TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key)
{
- zval *property;
+ zval property;
zend_class_entry *ce = *va_arg(args, zend_class_entry**);
zval *retval = va_arg(args, zval*);
long filter = va_arg(args, long);
@@ -3940,38 +3902,36 @@ static int _addproperty(zend_property_info *pptr TSRMLS_DC, int num_args, va_lis
}
if (pptr->flags & filter) {
- ALLOC_ZVAL(property);
- reflection_property_factory(ce, pptr, property TSRMLS_CC);
- add_next_index_zval(retval, property);
+ reflection_property_factory(ce, pptr, &property TSRMLS_CC);
+ add_next_index_zval(retval, &property);
}
return 0;
}
/* }}} */
/* {{{ _adddynproperty */
-static int _adddynproperty(zval **pptr TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key)
+static int _adddynproperty(zval *ptr TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key)
{
- zval *property;
+ zval property;
zend_class_entry *ce = *va_arg(args, zend_class_entry**);
zval *retval = va_arg(args, zval*), member;
/* under some circumstances, the properties hash table may contain numeric
* properties (e.g. when casting from array). This is a WONT FIX bug, at
* least for the moment. Ignore these */
- if (hash_key->nKeyLength == 0) {
+ if (hash_key->key == NULL) {
return 0;
}
- if (hash_key->arKey[0] == '\0') {
+ if (hash_key->key->val[0] == '\0') {
return 0; /* non public cannot be dynamic */
}
- ZVAL_STRINGL(&member, hash_key->arKey, hash_key->nKeyLength-1, 0);
+ ZVAL_STR(&member, hash_key->key);
if (zend_get_property_info(ce, &member, 1 TSRMLS_CC) == &EG(std_property_info)) {
- MAKE_STD_ZVAL(property);
EG(std_property_info).flags = ZEND_ACC_IMPLICIT_PUBLIC;
- reflection_property_factory(ce, &EG(std_property_info), property TSRMLS_CC);
- add_next_index_zval(retval, property);
+ reflection_property_factory(ce, &EG(std_property_info), &property TSRMLS_CC);
+ add_next_index_zval(retval, &property);
}
return 0;
}
@@ -4001,8 +3961,8 @@ ZEND_METHOD(reflection_class, getProperties)
array_init(return_value);
zend_hash_apply_with_arguments(&ce->properties_info TSRMLS_CC, (apply_func_args_t) _addproperty, 3, &ce, return_value, filter);
- if (intern->obj && (filter & ZEND_ACC_PUBLIC) != 0 && Z_OBJ_HT_P(intern->obj)->get_properties) {
- HashTable *properties = Z_OBJ_HT_P(intern->obj)->get_properties(intern->obj TSRMLS_CC);
+ if (Z_TYPE(intern->obj) != IS_UNDEF && (filter & ZEND_ACC_PUBLIC) != 0 && Z_OBJ_HT(intern->obj)->get_properties) {
+ HashTable *properties = Z_OBJ_HT(intern->obj)->get_properties(&intern->obj TSRMLS_CC);
zend_hash_apply_with_arguments(properties TSRMLS_CC, (apply_func_args_t) _adddynproperty, 2, &ce, return_value);
}
}
@@ -4014,16 +3974,15 @@ ZEND_METHOD(reflection_class, hasConstant)
{
reflection_object *intern;
zend_class_entry *ce;
- char *name;
- int name_len;
+ zend_string *name;
METHOD_NOTSTATIC(reflection_class_ptr);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &name) == FAILURE) {
return;
}
GET_REFLECTION_OBJECT_PTR(ce);
- if (zend_hash_exists(&ce->constants_table, name, name_len + 1)) {
+ if (zend_hash_exists(&ce->constants_table, name)) {
RETURN_TRUE;
} else {
RETURN_FALSE;
@@ -4035,7 +3994,6 @@ ZEND_METHOD(reflection_class, hasConstant)
Returns an associative array containing this class' constants and their values */
ZEND_METHOD(reflection_class, getConstants)
{
- zval *tmp_copy;
reflection_object *intern;
zend_class_entry *ce;
@@ -4045,7 +4003,7 @@ ZEND_METHOD(reflection_class, getConstants)
GET_REFLECTION_OBJECT_PTR(ce);
array_init(return_value);
zend_hash_apply_with_argument(&ce->constants_table, (apply_func_arg_t)zval_update_constant_inline_change, ce TSRMLS_CC);
- zend_hash_copy(Z_ARRVAL_P(return_value), &ce->constants_table, (copy_ctor_func_t) zval_add_ref, (void *) &tmp_copy, sizeof(zval *));
+ zend_hash_copy(Z_ARRVAL_P(return_value), &ce->constants_table, zval_add_ref);
}
/* }}} */
@@ -4055,21 +4013,20 @@ ZEND_METHOD(reflection_class, getConstant)
{
reflection_object *intern;
zend_class_entry *ce;
- zval **value;
- char *name;
- int name_len;
+ zval *value;
+ zend_string *name;
METHOD_NOTSTATIC(reflection_class_ptr);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &name) == FAILURE) {
return;
}
GET_REFLECTION_OBJECT_PTR(ce);
zend_hash_apply_with_argument(&ce->constants_table, (apply_func_arg_t)zval_update_constant_inline_change, ce TSRMLS_CC);
- if (zend_hash_find(&ce->constants_table, name, name_len + 1, (void **) &value) == FAILURE) {
+ if ((value = zend_hash_find(&ce->constants_table, name)) == NULL) {
RETURN_FALSE;
}
- MAKE_COPY_ZVAL(value, return_value);
+ ZVAL_DUP(return_value, value);
}
/* }}} */
@@ -4127,11 +4084,11 @@ ZEND_METHOD(reflection_class, isCloneable)
if (ce->ce_flags & (ZEND_ACC_INTERFACE | ZEND_ACC_TRAIT | ZEND_ACC_EXPLICIT_ABSTRACT_CLASS | ZEND_ACC_IMPLICIT_ABSTRACT_CLASS)) {
RETURN_FALSE;
}
- if (intern->obj) {
+ if (Z_TYPE(intern->obj) != IS_UNDEF) {
if (ce->clone) {
RETURN_BOOL(ce->clone->common.fn_flags & ZEND_ACC_PUBLIC);
} else {
- RETURN_BOOL(Z_OBJ_HANDLER_P(intern->obj, clone_obj) != NULL);
+ RETURN_BOOL(Z_OBJ_HANDLER(intern->obj, clone_obj) != NULL);
}
} else {
if (ce->clone) {
@@ -4231,7 +4188,8 @@ ZEND_METHOD(reflection_class, newInstance)
/* Run the constructor if there is one */
if (constructor) {
- zval ***params = NULL;
+//???
+ zval *params = NULL;
int num_args = 0;
zend_fcall_info fci;
zend_fcall_info_cache fcc;
@@ -4252,10 +4210,10 @@ ZEND_METHOD(reflection_class, newInstance)
fci.size = sizeof(fci);
fci.function_table = EG(function_table);
- fci.function_name = NULL;
+ ZVAL_UNDEF(&fci.function_name);
fci.symbol_table = NULL;
fci.object_ptr = return_value;
- fci.retval_ptr_ptr = &retval_ptr;
+ fci.retval = retval_ptr;
fci.param_count = num_args;
fci.params = params;
fci.no_separation = 1;
@@ -4271,14 +4229,14 @@ ZEND_METHOD(reflection_class, newInstance)
efree(params);
}
if (retval_ptr) {
- zval_ptr_dtor(&retval_ptr);
+ zval_ptr_dtor(retval_ptr);
}
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invocation of %s's constructor failed", ce->name);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invocation of %s's constructor failed", ce->name->val);
zval_dtor(return_value);
RETURN_NULL();
}
if (retval_ptr) {
- zval_ptr_dtor(&retval_ptr);
+ zval_ptr_dtor(retval_ptr);
}
if (params) {
efree(params);
@@ -4339,7 +4297,8 @@ ZEND_METHOD(reflection_class, newInstanceArgs)
/* Run the constructor if there is one */
if (constructor) {
- zval ***params = NULL;
+//???
+ zval *params = NULL;
zend_fcall_info fci;
zend_fcall_info_cache fcc;
@@ -4350,17 +4309,17 @@ ZEND_METHOD(reflection_class, newInstanceArgs)
}
if (argc) {
- params = safe_emalloc(sizeof(zval **), argc, 0);
+ params = safe_emalloc(sizeof(zval), argc, 0);
zend_hash_apply_with_argument(args, (apply_func_arg_t)_zval_array_to_c_array, &params TSRMLS_CC);
params -= argc;
}
fci.size = sizeof(fci);
fci.function_table = EG(function_table);
- fci.function_name = NULL;
+ ZVAL_UNDEF(&fci.function_name);
fci.symbol_table = NULL;
fci.object_ptr = return_value;
- fci.retval_ptr_ptr = &retval_ptr;
+ fci.retval = retval_ptr;
fci.param_count = argc;
fci.params = params;
fci.no_separation = 1;
@@ -4376,20 +4335,20 @@ ZEND_METHOD(reflection_class, newInstanceArgs)
efree(params);
}
if (retval_ptr) {
- zval_ptr_dtor(&retval_ptr);
+ zval_ptr_dtor(retval_ptr);
}
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invocation of %s's constructor failed", ce->name);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invocation of %s's constructor failed", ce->name->val);
zval_dtor(return_value);
RETURN_NULL();
}
if (retval_ptr) {
- zval_ptr_dtor(&retval_ptr);
+ zval_ptr_dtor(retval_ptr);
}
if (params) {
efree(params);
}
} else if (argc) {
- zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Class %s does not have a constructor, so you cannot pass any constructor arguments", ce->name);
+ zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Class %s does not have a constructor, so you cannot pass any constructor arguments", ce->name->val);
}
}
/* }}} */
@@ -4413,10 +4372,10 @@ ZEND_METHOD(reflection_class, getInterfaces)
zend_uint i;
for (i=0; i < ce->num_interfaces; i++) {
- zval *interface;
- ALLOC_ZVAL(interface);
- zend_reflection_class_factory(ce->interfaces[i], interface TSRMLS_CC);
- add_assoc_zval_ex(return_value, ce->interfaces[i]->name, ce->interfaces[i]->name_length + 1, interface);
+ zval interface;
+ zend_reflection_class_factory(ce->interfaces[i], &interface TSRMLS_CC);
+//???
+ add_assoc_zval_ex(return_value, ce->interfaces[i]->name->val, ce->interfaces[i]->name->len, &interface);
}
}
}
@@ -4439,7 +4398,7 @@ ZEND_METHOD(reflection_class, getInterfaceNames)
array_init(return_value);
for (i=0; i < ce->num_interfaces; i++) {
- add_next_index_stringl(return_value, ce->interfaces[i]->name, ce->interfaces[i]->name_length, 1);
+ add_next_index_str(return_value, STR_COPY(ce->interfaces[i]->name));
}
}
/* }}} */
@@ -4460,10 +4419,10 @@ ZEND_METHOD(reflection_class, getTraits)
array_init(return_value);
for (i=0; i < ce->num_traits; i++) {
- zval *trait;
- ALLOC_ZVAL(trait);
- zend_reflection_class_factory(ce->traits[i], trait TSRMLS_CC);
- add_assoc_zval_ex(return_value, ce->traits[i]->name, ce->traits[i]->name_length + 1, trait);
+ zval trait;
+ zend_reflection_class_factory(ce->traits[i], &trait TSRMLS_CC);
+//???
+ add_assoc_zval_ex(return_value, ce->traits[i]->name->val, ce->traits[i]->name->len, &trait);
}
}
/* }}} */
@@ -4484,7 +4443,7 @@ ZEND_METHOD(reflection_class, getTraitNames)
array_init(return_value);
for (i=0; i < ce->num_traits; i++) {
- add_next_index_stringl(return_value, ce->traits[i]->name, ce->traits[i]->name_length, 1);
+ add_next_index_str(return_value, STR_COPY(ce->traits[i]->name));
}
}
/* }}} */
@@ -4511,8 +4470,9 @@ ZEND_METHOD(reflection_class, getTraitAliases)
zend_trait_method_reference *cur_ref = ce->trait_aliases[i]->trait_method;
if (ce->trait_aliases[i]->alias) {
- method_name_len = spprintf(&method_name, 0, "%s::%s", cur_ref->ce->name, cur_ref->method_name);
- add_assoc_stringl_ex(return_value, ce->trait_aliases[i]->alias, ce->trait_aliases[i]->alias_len + 1, method_name, method_name_len, 0);
+ method_name_len = spprintf(&method_name, 0, "%s::%s", cur_ref->ce->name->val, cur_ref->method_name->val);
+//???
+ add_assoc_stringl_ex(return_value, ce->trait_aliases[i]->alias->val, ce->trait_aliases[i]->alias->len, method_name, method_name_len, 0);
}
i++;
}
@@ -4545,7 +4505,7 @@ ZEND_METHOD(reflection_class, getParentClass)
ZEND_METHOD(reflection_class, isSubclassOf)
{
reflection_object *intern, *argument;
- zend_class_entry *ce, **pce, *class_ce;
+ zend_class_entry *ce, *class_ce;
zval *class_name;
METHOD_NOTSTATIC(reflection_class_ptr);
@@ -4557,16 +4517,15 @@ ZEND_METHOD(reflection_class, isSubclassOf)
switch(class_name->type) {
case IS_STRING:
- if (zend_lookup_class(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), &pce TSRMLS_CC) == FAILURE) {
+ if ((class_ce = zend_lookup_class(Z_STR_P(class_name) TSRMLS_CC)) == NULL) {
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
"Class %s does not exist", Z_STRVAL_P(class_name));
return;
}
- class_ce = *pce;
break;
case IS_OBJECT:
if (instanceof_function(Z_OBJCE_P(class_name), reflection_class_ptr TSRMLS_CC)) {
- argument = (reflection_object *) zend_object_store_get_object(class_name TSRMLS_CC);
+ argument = (reflection_object *) Z_OBJ_P(class_name);
if (argument == NULL || argument->ptr == NULL) {
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Internal error: Failed to retrieve the argument's reflection object");
/* Bails out */
@@ -4590,7 +4549,7 @@ ZEND_METHOD(reflection_class, isSubclassOf)
ZEND_METHOD(reflection_class, implementsInterface)
{
reflection_object *intern, *argument;
- zend_class_entry *ce, *interface_ce, **pce;
+ zend_class_entry *ce, *interface_ce;
zval *interface;
METHOD_NOTSTATIC(reflection_class_ptr);
@@ -4602,16 +4561,15 @@ ZEND_METHOD(reflection_class, implementsInterface)
switch(interface->type) {
case IS_STRING:
- if (zend_lookup_class(Z_STRVAL_P(interface), Z_STRLEN_P(interface), &pce TSRMLS_CC) == FAILURE) {
+ if ((interface_ce = zend_lookup_class(Z_STR_P(interface) TSRMLS_CC)) == NULL) {
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
"Interface %s does not exist", Z_STRVAL_P(interface));
return;
}
- interface_ce = *pce;
break;
case IS_OBJECT:
if (instanceof_function(Z_OBJCE_P(interface), reflection_class_ptr TSRMLS_CC)) {
- argument = (reflection_object *) zend_object_store_get_object(interface TSRMLS_CC);
+ argument = (reflection_object *) Z_OBJ_P(interface);
if (argument == NULL || argument->ptr == NULL) {
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Internal error: Failed to retrieve the argument's reflection object");
/* Bails out */
@@ -4688,7 +4646,7 @@ ZEND_METHOD(reflection_class, getExtensionName)
GET_REFLECTION_OBJECT_PTR(ce);
if ((ce->type == ZEND_INTERNAL_CLASS) && ce->info.internal.module) {
- RETURN_STRING(ce->info.internal.module->name, 1);
+ RETURN_STRING(ce->info.internal.module->name);
} else {
RETURN_FALSE;
}
@@ -4699,18 +4657,18 @@ ZEND_METHOD(reflection_class, getExtensionName)
Returns whether this class is defined in namespace */
ZEND_METHOD(reflection_class, inNamespace)
{
- zval **name;
+ zval *name;
const char *backslash;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
- if (zend_hash_find(Z_OBJPROP_P(getThis()), "name", sizeof("name"), (void **) &name) == FAILURE) {
+ if ((name = zend_hash_str_find(Z_OBJPROP_P(getThis()), "name", sizeof("name")-1)) == NULL) {
RETURN_FALSE;
}
- if (Z_TYPE_PP(name) == IS_STRING
- && (backslash = zend_memrchr(Z_STRVAL_PP(name), '\\', Z_STRLEN_PP(name)))
- && backslash > Z_STRVAL_PP(name))
+ if (Z_TYPE_P(name) == IS_STRING
+ && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRLEN_P(name)))
+ && backslash > Z_STRVAL_P(name))
{
RETURN_TRUE;
}
@@ -4722,20 +4680,20 @@ ZEND_METHOD(reflection_class, inNamespace)
Returns the name of namespace where this class is defined */
ZEND_METHOD(reflection_class, getNamespaceName)
{
- zval **name;
+ zval *name;
const char *backslash;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
- if (zend_hash_find(Z_OBJPROP_P(getThis()), "name", sizeof("name"), (void **) &name) == FAILURE) {
+ if ((name = zend_hash_str_find(Z_OBJPROP_P(getThis()), "name", sizeof("name")-1)) == NULL) {
RETURN_FALSE;
}
- if (Z_TYPE_PP(name) == IS_STRING
- && (backslash = zend_memrchr(Z_STRVAL_PP(name), '\\', Z_STRLEN_PP(name)))
- && backslash > Z_STRVAL_PP(name))
+ if (Z_TYPE_P(name) == IS_STRING
+ && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRLEN_P(name)))
+ && backslash > Z_STRVAL_P(name))
{
- RETURN_STRINGL(Z_STRVAL_PP(name), backslash - Z_STRVAL_PP(name), 1);
+ RETURN_STRINGL(Z_STRVAL_P(name), backslash - Z_STRVAL_P(name));
}
RETURN_EMPTY_STRING();
}
@@ -4745,22 +4703,22 @@ ZEND_METHOD(reflection_class, getNamespaceName)
Returns the short name of the class (without namespace part) */
ZEND_METHOD(reflection_class, getShortName)
{
- zval **name;
+ zval *name;
const char *backslash;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
- if (zend_hash_find(Z_OBJPROP_P(getThis()), "name", sizeof("name"), (void **) &name) == FAILURE) {
+ if ((name = zend_hash_str_find(Z_OBJPROP_P(getThis()), "name", sizeof("name")-1)) == NULL) {
RETURN_FALSE;
}
- if (Z_TYPE_PP(name) == IS_STRING
- && (backslash = zend_memrchr(Z_STRVAL_PP(name), '\\', Z_STRLEN_PP(name)))
- && backslash > Z_STRVAL_PP(name))
+ if (Z_TYPE_P(name) == IS_STRING
+ && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRLEN_P(name)))
+ && backslash > Z_STRVAL_P(name))
{
- RETURN_STRINGL(backslash + 1, Z_STRLEN_PP(name) - (backslash - Z_STRVAL_PP(name) + 1), 1);
+ RETURN_STRINGL(backslash + 1, Z_STRLEN_P(name) - (backslash - Z_STRVAL_P(name) + 1));
}
- RETURN_ZVAL(*name, 1, 0);
+ RETURN_ZVAL(name, 1, 0);
}
/* }}} */
@@ -4792,13 +4750,12 @@ ZEND_METHOD(reflection_property, export)
Constructor. Throws an Exception in case the given property does not exist */
ZEND_METHOD(reflection_property, __construct)
{
- zval *propname, *classname;
+ zval propname, cname, *classname;
char *name_str;
const char *class_name, *prop_name;
int name_len, dynam_prop = 0;
zval *object;
reflection_object *intern;
- zend_class_entry **pce;
zend_class_entry *ce;
zend_property_info *property_info = NULL;
property_reference *reference;
@@ -4808,7 +4765,7 @@ ZEND_METHOD(reflection_property, __construct)
}
object = getThis();
- intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
+ intern = (reflection_object *) Z_OBJ_P(object);
if (intern == NULL) {
return;
}
@@ -4816,12 +4773,11 @@ ZEND_METHOD(reflection_property, __construct)
/* Find the class entry */
switch (Z_TYPE_P(classname)) {
case IS_STRING:
- if (zend_lookup_class(Z_STRVAL_P(classname), Z_STRLEN_P(classname), &pce TSRMLS_CC) == FAILURE) {
+ if ((ce = zend_lookup_class(Z_STR_P(classname) TSRMLS_CC)) == NULL) {
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
"Class %s does not exist", Z_STRVAL_P(classname));
return;
}
- ce = *pce;
break;
case IS_OBJECT:
@@ -4833,10 +4789,10 @@ ZEND_METHOD(reflection_property, __construct)
/* returns out of this function */
}
- if (zend_hash_find(&ce->properties_info, name_str, name_len + 1, (void **) &property_info) == FAILURE || (property_info->flags & ZEND_ACC_SHADOW)) {
+ if ((property_info = zend_hash_str_find_ptr(&ce->properties_info, name_str, name_len)) == NULL || (property_info->flags & ZEND_ACC_SHADOW)) {
/* Check for dynamic properties */
if (property_info == NULL && Z_TYPE_P(classname) == IS_OBJECT && Z_OBJ_HT_P(classname)->get_properties) {
- if (zend_hash_exists(Z_OBJ_HT_P(classname)->get_properties(classname TSRMLS_CC), name_str, name_len+1)) {
+ if (zend_hash_str_exists(Z_OBJ_HT_P(classname)->get_properties(classname TSRMLS_CC), name_str, name_len)) {
dynam_prop = 1;
}
}
@@ -4851,33 +4807,28 @@ ZEND_METHOD(reflection_property, __construct)
zend_class_entry *tmp_ce = ce;
zend_property_info *tmp_info;
- while (tmp_ce && zend_hash_find(&tmp_ce->properties_info, name_str, name_len + 1, (void **) &tmp_info) != SUCCESS) {
+ while (tmp_ce && (tmp_info = zend_hash_str_find_ptr(&tmp_ce->properties_info, name_str, name_len)) == NULL) {
ce = tmp_ce;
property_info = tmp_info;
tmp_ce = tmp_ce->parent;
}
}
- MAKE_STD_ZVAL(classname);
- MAKE_STD_ZVAL(propname);
-
if (dynam_prop == 0) {
- zend_unmangle_property_name(property_info->name, property_info->name_length, &class_name, &prop_name);
- ZVAL_STRINGL(classname, property_info->ce->name, property_info->ce->name_length, 1);
- ZVAL_STRING(propname, prop_name, 1);
+ zend_unmangle_property_name(property_info->name->val, property_info->name->len, &class_name, &prop_name);
+ ZVAL_STR(&cname, STR_COPY(property_info->ce->name));
+ ZVAL_STRING(&propname, prop_name);
} else {
- ZVAL_STRINGL(classname, ce->name, ce->name_length, 1);
- ZVAL_STRINGL(propname, name_str, name_len, 1);
+ ZVAL_STR(&cname, STR_COPY(ce->name));
+ ZVAL_STRINGL(&propname, name_str, name_len);
}
- reflection_update_property(object, "class", classname);
- reflection_update_property(object, "name", propname);
+ reflection_update_property(object, "class", &cname);
+ reflection_update_property(object, "name", &propname);
reference = (property_reference*) emalloc(sizeof(property_reference));
if (dynam_prop) {
reference->prop.flags = ZEND_ACC_IMPLICIT_PUBLIC;
- reference->prop.name = Z_STRVAL_P(propname);
- reference->prop.name_length = Z_STRLEN_P(propname);
- reference->prop.h = zend_get_hash_value(name_str, name_len+1);
+ reference->prop.name = Z_STR(propname);
reference->prop.doc_comment = NULL;
reference->prop.ce = ce;
} else {
@@ -4905,7 +4856,8 @@ ZEND_METHOD(reflection_property, __toString)
GET_REFLECTION_OBJECT_PTR(ref);
string_init(&str);
_property_string(&str, &ref->prop, NULL, "" TSRMLS_CC);
- RETURN_STRINGL(str.string, str.len - 1, 0);
+//??? RETURN_STRINGL(str.string, str.len - 1, 0);
+ RETURN_STRINGL(str.string, str.len - 1);
}
/* }}} */
@@ -4916,7 +4868,7 @@ ZEND_METHOD(reflection_property, getName)
if (zend_parse_parameters_none() == FAILURE) {
return;
}
- _default_get_entry(getThis(), "name", sizeof("name"), return_value TSRMLS_CC);
+ _default_get_entry(getThis(), "name", sizeof("name")-1, return_value TSRMLS_CC);
}
/* }}} */
@@ -5002,7 +4954,7 @@ ZEND_METHOD(reflection_property, getValue)
GET_REFLECTION_OBJECT_PTR(ref);
if (!(ref->prop.flags & (ZEND_ACC_PUBLIC | ZEND_ACC_IMPLICIT_PUBLIC)) && intern->ignore_visibility == 0) {
- _default_get_entry(getThis(), "name", sizeof("name"), &name TSRMLS_CC);
+ _default_get_entry(getThis(), "name", sizeof("name")-1, &name TSRMLS_CC);
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
"Cannot access non-public member %s::%s", intern->ce->name, Z_STRVAL(name));
zval_dtor(&name);
@@ -5011,25 +4963,25 @@ ZEND_METHOD(reflection_property, getValue)
if ((ref->prop.flags & ZEND_ACC_STATIC)) {
zend_update_class_constants(intern->ce TSRMLS_CC);
- if (!CE_STATIC_MEMBERS(intern->ce)[ref->prop.offset]) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Internal error: Could not find the property %s::%s", intern->ce->name, ref->prop.name);
+ if (Z_TYPE(CE_STATIC_MEMBERS(intern->ce)[ref->prop.offset]) == IS_UNDEF) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Internal error: Could not find the property %s::%s", intern->ce->name->val, ref->prop.name->val);
/* Bails out */
}
- *return_value= *CE_STATIC_MEMBERS(intern->ce)[ref->prop.offset];
- zval_copy_ctor(return_value);
- INIT_PZVAL(return_value);
+ ZVAL_DUP(return_value, &CE_STATIC_MEMBERS(intern->ce)[ref->prop.offset]);
+//??? INIT_PZVAL(return_value);
} else {
const char *class_name, *prop_name;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &object) == FAILURE) {
return;
}
- zend_unmangle_property_name(ref->prop.name, ref->prop.name_length, &class_name, &prop_name);
+ zend_unmangle_property_name(ref->prop.name->val, ref->prop.name->len, &class_name, &prop_name);
member_p = zend_read_property(ref->ce, object, prop_name, strlen(prop_name), 1 TSRMLS_CC);
- MAKE_COPY_ZVAL(&member_p, return_value);
- if (member_p != EG(uninitialized_zval_ptr)) {
- zval_add_ref(&member_p);
- zval_ptr_dtor(&member_p);
+ ZVAL_DUP(return_value, member_p);
+//???
+ if (member_p != &EG(uninitialized_zval)) {
+ zval_add_ref(member_p);
+ zval_ptr_dtor(member_p);
}
}
}
@@ -5041,7 +4993,7 @@ ZEND_METHOD(reflection_property, setValue)
{
reflection_object *intern;
property_reference *ref;
- zval **variable_ptr;
+ zval *variable_ptr;
zval *object, name;
zval *value;
zval *tmp;
@@ -5050,7 +5002,7 @@ ZEND_METHOD(reflection_property, setValue)
GET_REFLECTION_OBJECT_PTR(ref);
if (!(ref->prop.flags & ZEND_ACC_PUBLIC) && intern->ignore_visibility == 0) {
- _default_get_entry(getThis(), "name", sizeof("name"), &name TSRMLS_CC);
+ _default_get_entry(getThis(), "name", sizeof("name")-1, &name TSRMLS_CC);
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
"Cannot access non-public member %s::%s", intern->ce->name, Z_STRVAL(name));
zval_dtor(&name);
@@ -5065,31 +5017,33 @@ ZEND_METHOD(reflection_property, setValue)
}
zend_update_class_constants(intern->ce TSRMLS_CC);
- if (!CE_STATIC_MEMBERS(intern->ce)[ref->prop.offset]) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Internal error: Could not find the property %s::%s", intern->ce->name, ref->prop.name);
+ if (Z_TYPE(CE_STATIC_MEMBERS(intern->ce)[ref->prop.offset]) == IS_UNDEF) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Internal error: Could not find the property %s::%s", intern->ce->name->val, ref->prop.name->val);
/* Bails out */
}
variable_ptr = &CE_STATIC_MEMBERS(intern->ce)[ref->prop.offset];
- if (*variable_ptr != value) {
- if (PZVAL_IS_REF(*variable_ptr)) {
- zval garbage = **variable_ptr; /* old value should be destroyed */
+ if (variable_ptr != value) {
+ if (Z_ISREF_P(variable_ptr)) {
+ zval garbage;
+
+ ZVAL_COPY_VALUE(&garbage, variable_ptr); /* old value should be destroyed */
/* To check: can't *variable_ptr be some system variable like error_zval here? */
- Z_TYPE_PP(variable_ptr) = Z_TYPE_P(value);
- (*variable_ptr)->value = value->value;
+ ZVAL_COPY_VALUE(variable_ptr, value);
if (Z_REFCOUNT_P(value) > 0) {
- zval_copy_ctor(*variable_ptr);
+ zval_copy_ctor(variable_ptr);
}
zval_dtor(&garbage);
} else {
- zval *garbage = *variable_ptr;
-
+ zval garbage;
+
+ ZVAL_COPY_VALUE(&garbage, variable_ptr);
/* if we assign referenced variable, we should separate it */
Z_ADDREF_P(value);
- if (PZVAL_IS_REF(value)) {
- SEPARATE_ZVAL(&value);
+ if (Z_ISREF_P(value)) {
+ SEPARATE_ZVAL(value);
}
- *variable_ptr = value;
+ ZVAL_COPY_VALUE(variable_ptr, value);
zval_ptr_dtor(&garbage);
}
}
@@ -5099,7 +5053,7 @@ ZEND_METHOD(reflection_property, setValue)
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "oz", &object, &value) == FAILURE) {
return;
}
- zend_unmangle_property_name(ref->prop.name, ref->prop.name_length, &class_name, &prop_name);
+ zend_unmangle_property_name(ref->prop.name->val, ref->prop.name->len, &class_name, &prop_name);
zend_update_property(ref->ce, object, prop_name, strlen(prop_name), value TSRMLS_CC);
}
}
@@ -5121,13 +5075,13 @@ ZEND_METHOD(reflection_property, getDeclaringClass)
}
GET_REFLECTION_OBJECT_PTR(ref);
- if (zend_unmangle_property_name(ref->prop.name, ref->prop.name_length, &class_name, &prop_name) != SUCCESS) {
+ if (zend_unmangle_property_name(ref->prop.name->val, ref->prop.name->len, &class_name, &prop_name) != SUCCESS) {
RETURN_FALSE;
}
prop_name_len = strlen(prop_name);
ce = tmp_ce = ref->ce;
- while (tmp_ce && zend_hash_find(&tmp_ce->properties_info, prop_name, prop_name_len + 1, (void **) &tmp_info) == SUCCESS) {
+ while (tmp_ce && (tmp_info = zend_hash_str_find_ptr(&tmp_ce->properties_info, prop_name, prop_name_len)) != NULL) {
if (tmp_info->flags & ZEND_ACC_PRIVATE || tmp_info->flags & ZEND_ACC_SHADOW) {
/* it's a private property, so it can't be inherited */
break;
@@ -5156,7 +5110,7 @@ ZEND_METHOD(reflection_property, getDocComment)
}
GET_REFLECTION_OBJECT_PTR(ref);
if (ref->prop.doc_comment) {
- RETURN_STRINGL(ref->prop.doc_comment, ref->prop.doc_comment_len, 1);
+ RETURN_STR(STR_COPY(ref->prop.doc_comment));
}
RETURN_FALSE;
}
@@ -5173,7 +5127,7 @@ ZEND_METHOD(reflection_property, setAccessible)
return;
}
- intern = (reflection_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
+ intern = (reflection_object *) Z_OBJ_P(getThis());
if (intern == NULL) {
return;
@@ -5195,7 +5149,7 @@ ZEND_METHOD(reflection_extension, export)
Constructor. Throws an Exception in case the given extension does not exist */
ZEND_METHOD(reflection_extension, __construct)
{
- zval *name;
+ zval name;
zval *object;
char *lcname;
reflection_object *intern;
@@ -5209,22 +5163,21 @@ ZEND_METHOD(reflection_extension, __construct)
}
object = getThis();
- intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
+ intern = (reflection_object *) Z_OBJ_P(object);
if (intern == NULL) {
return;
}
lcname = do_alloca(name_len + 1, use_heap);
zend_str_tolower_copy(lcname, name_str, name_len);
- if (zend_hash_find(&module_registry, lcname, name_len + 1, (void **)&module) == FAILURE) {
+ if ((module = zend_hash_str_find_ptr(&module_registry, lcname, name_len)) == NULL) {
free_alloca(lcname, use_heap);
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
"Extension %s does not exist", name_str);
return;
}
free_alloca(lcname, use_heap);
- MAKE_STD_ZVAL(name);
- ZVAL_STRING(name, module->name, 1);
- reflection_update_property( object, "name", name);
+ ZVAL_STRING(&name, module->name);
+ reflection_update_property(object, "name", &name);
intern->ptr = module;
intern->ref_type = REF_TYPE_OTHER;
intern->ce = NULL;
@@ -5245,7 +5198,8 @@ ZEND_METHOD(reflection_extension, __toString)
GET_REFLECTION_OBJECT_PTR(module);
string_init(&str);
_extension_string(&str, module, "" TSRMLS_CC);
- RETURN_STRINGL(str.string, str.len - 1, 0);
+//??? RETURN_STRINGL(str.string, str.len - 1, 0);
+ RETURN_STRINGL(str.string, str.len - 1);
}
/* }}} */
@@ -5256,7 +5210,7 @@ ZEND_METHOD(reflection_extension, getName)
if (zend_parse_parameters_none() == FAILURE) {
return;
}
- _default_get_entry(getThis(), "name", sizeof("name"), return_value TSRMLS_CC);
+ _default_get_entry(getThis(), "name", sizeof("name")-1, return_value TSRMLS_CC);
}
/* }}} */
@@ -5276,7 +5230,7 @@ ZEND_METHOD(reflection_extension, getVersion)
if (module->version == NO_VERSION_YET) {
RETURN_NULL();
} else {
- RETURN_STRING(module->version, 1);
+ RETURN_STRING(module->version);
}
}
/* }}} */
@@ -5288,7 +5242,7 @@ ZEND_METHOD(reflection_extension, getFunctions)
reflection_object *intern;
zend_module_entry *module;
HashPosition iterator;
- zval *function;
+ zval function;
zend_function *fptr;
if (zend_parse_parameters_none() == FAILURE) {
@@ -5298,12 +5252,12 @@ ZEND_METHOD(reflection_extension, getFunctions)
array_init(return_value);
zend_hash_internal_pointer_reset_ex(CG(function_table), &iterator);
- while (zend_hash_get_current_data_ex(CG(function_table), (void **) &fptr, &iterator) == SUCCESS) {
+ while ((fptr = zend_hash_get_current_data_ptr_ex(CG(function_table), &iterator)) != NULL) {
if (fptr->common.type==ZEND_INTERNAL_FUNCTION
&& fptr->internal_function.module == module) {
- ALLOC_ZVAL(function);
- reflection_function_factory(fptr, NULL, function TSRMLS_CC);
- add_assoc_zval(return_value, fptr->common.function_name, function);
+ reflection_function_factory(fptr, NULL, &function TSRMLS_CC);
+//???
+ add_assoc_zval(return_value, fptr->common.function_name->val, &function);
}
zend_hash_move_forward_ex(CG(function_table), &iterator);
}
@@ -5312,16 +5266,15 @@ ZEND_METHOD(reflection_extension, getFunctions)
static int _addconstant(zend_constant *constant TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */
{
- zval *const_val;
+ zval const_val;
zval *retval = va_arg(args, zval*);
int number = va_arg(args, int);
if (number == constant->module_number) {
- ALLOC_ZVAL(const_val);
- *const_val = constant->value;
- zval_copy_ctor(const_val);
- INIT_PZVAL(const_val);
- add_assoc_zval_ex(retval, constant->name, constant->name_len, const_val);
+ ZVAL_DUP(&const_val, &constant->value);
+//??? INIT_PZVAL(const_val);
+//???
+ add_assoc_zval_ex(retval, constant->name->val, constant->name->len, &const_val);
}
return 0;
}
@@ -5381,17 +5334,17 @@ ZEND_METHOD(reflection_extension, getINIEntries)
/* {{{ add_extension_class */
static int add_extension_class(zend_class_entry **pce TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key)
{
- zval *class_array = va_arg(args, zval*), *zclass;
+ zval *class_array = va_arg(args, zval*), zclass;
struct _zend_module_entry *module = va_arg(args, struct _zend_module_entry*);
int add_reflection_class = va_arg(args, int);
if (((*pce)->type == ZEND_INTERNAL_CLASS) && (*pce)->info.internal.module && !strcasecmp((*pce)->info.internal.module->name, module->name)) {
if (add_reflection_class) {
- ALLOC_ZVAL(zclass);
- zend_reflection_class_factory(*pce, zclass TSRMLS_CC);
- add_assoc_zval_ex(class_array, (*pce)->name, (*pce)->name_length + 1, zclass);
+ zend_reflection_class_factory(*pce, &zclass TSRMLS_CC);
+//???
+ add_assoc_zval_ex(class_array, (*pce)->name->val, (*pce)->name->len, &zclass);
} else {
- add_next_index_stringl(class_array, (*pce)->name, (*pce)->name_length, 1);
+ add_next_index_str(class_array, STR_COPY((*pce)->name));
}
}
return ZEND_HASH_APPLY_KEEP;
@@ -5546,7 +5499,7 @@ ZEND_METHOD(reflection_zend_extension, export)
Constructor. Throws an Exception in case the given Zend extension does not exist */
ZEND_METHOD(reflection_zend_extension, __construct)
{
- zval *name;
+ zval name;
zval *object;
reflection_object *intern;
zend_extension *extension;
@@ -5558,7 +5511,7 @@ ZEND_METHOD(reflection_zend_extension, __construct)
}
object = getThis();
- intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
+ intern = (reflection_object *) Z_OBJ_P(object);
if (intern == NULL) {
return;
}
@@ -5569,9 +5522,8 @@ ZEND_METHOD(reflection_zend_extension, __construct)
"Zend Extension %s does not exist", name_str);
return;
}
- MAKE_STD_ZVAL(name);
- ZVAL_STRING(name, extension->name, 1);
- reflection_update_property(object, "name", name);
+ ZVAL_STRING(&name, extension->name);
+ reflection_update_property(object, "name", &name);
intern->ptr = extension;
intern->ref_type = REF_TYPE_OTHER;
intern->ce = NULL;
@@ -5592,7 +5544,8 @@ ZEND_METHOD(reflection_zend_extension, __toString)
GET_REFLECTION_OBJECT_PTR(extension);
string_init(&str);
_zend_extension_string(&str, extension, "" TSRMLS_CC);
- RETURN_STRINGL(str.string, str.len - 1, 0);
+//??? RETURN_STRINGL(str.string, str.len - 1, 0);
+ RETURN_STRINGL(str.string, str.len - 1);
}
/* }}} */
@@ -5608,7 +5561,7 @@ ZEND_METHOD(reflection_zend_extension, getName)
}
GET_REFLECTION_OBJECT_PTR(extension);
- RETURN_STRING(extension->name, 1);
+ RETURN_STRING(extension->name);
}
/* }}} */
@@ -5624,7 +5577,11 @@ ZEND_METHOD(reflection_zend_extension, getVersion)
}
GET_REFLECTION_OBJECT_PTR(extension);
- RETURN_STRING(extension->version ? extension->version : "", 1);
+ if (extension->version) {
+ RETURN_STRING(extension->version);
+ } else {
+ RETURN_EMPTY_STRING();
+ }
}
/* }}} */
@@ -5640,7 +5597,11 @@ ZEND_METHOD(reflection_zend_extension, getAuthor)
}
GET_REFLECTION_OBJECT_PTR(extension);
- RETURN_STRING(extension->author ? extension->author : "", 1);
+ if (extension->author) {
+ RETURN_STRING(extension->author);
+ } else {
+ RETURN_EMPTY_STRING();
+ }
}
/* }}} */
@@ -5656,7 +5617,11 @@ ZEND_METHOD(reflection_zend_extension, getURL)
}
GET_REFLECTION_OBJECT_PTR(extension);
- RETURN_STRING(extension->URL ? extension->URL : "", 1);
+ if (extension->URL) {
+ RETURN_STRING(extension->URL);
+ } else {
+ RETURN_EMPTY_STRING();
+ }
}
/* }}} */
@@ -5672,7 +5637,11 @@ ZEND_METHOD(reflection_zend_extension, getCopyright)
}
GET_REFLECTION_OBJECT_PTR(extension);
- RETURN_STRING(extension->copyright ? extension->copyright : "", 1);
+ if (extension->copyright) {
+ RETURN_STRING(extension->copyright);
+ } else {
+ RETURN_EMPTY_STRING();
+ }
}
/* }}} */
@@ -6095,7 +6064,7 @@ static zend_object_handlers *zend_std_obj_handlers;
static void _reflection_write_property(zval *object, zval *member, zval *value, const zend_literal *key TSRMLS_DC)
{
if ((Z_TYPE_P(member) == IS_STRING)
- && zend_hash_exists(&Z_OBJCE_P(object)->properties_info, Z_STRVAL_P(member), Z_STRLEN_P(member)+1)
+ && zend_hash_exists(&Z_OBJCE_P(object)->properties_info, Z_STR_P(member))
&& ((Z_STRLEN_P(member) == sizeof("name") - 1 && !memcmp(Z_STRVAL_P(member), "name", sizeof("name")))
|| (Z_STRLEN_P(member) == sizeof("class") - 1 && !memcmp(Z_STRVAL_P(member), "class", sizeof("class")))))
{
@@ -6115,11 +6084,12 @@ PHP_MINIT_FUNCTION(reflection) /* {{{ */
zend_std_obj_handlers = zend_get_std_object_handlers();
memcpy(&reflection_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
+ reflection_object_handlers.free_obj = reflection_free_objects_storage;
reflection_object_handlers.clone_obj = NULL;
reflection_object_handlers.write_property = _reflection_write_property;
INIT_CLASS_ENTRY(_reflection_entry, "ReflectionException", reflection_exception_functions);
- reflection_exception_ptr = zend_register_internal_class_ex(&_reflection_entry, zend_exception_get_default(TSRMLS_C), NULL TSRMLS_CC);
+ reflection_exception_ptr = zend_register_internal_class_ex(&_reflection_entry, zend_exception_get_default(TSRMLS_C) TSRMLS_CC);
INIT_CLASS_ENTRY(_reflection_entry, "Reflection", reflection_functions);
reflection_ptr = zend_register_internal_class(&_reflection_entry TSRMLS_CC);
@@ -6135,7 +6105,7 @@ PHP_MINIT_FUNCTION(reflection) /* {{{ */
INIT_CLASS_ENTRY(_reflection_entry, "ReflectionFunction", reflection_function_functions);
_reflection_entry.create_object = reflection_objects_new;
- reflection_function_ptr = zend_register_internal_class_ex(&_reflection_entry, reflection_function_abstract_ptr, NULL TSRMLS_CC);
+ reflection_function_ptr = zend_register_internal_class_ex(&_reflection_entry, reflection_function_abstract_ptr TSRMLS_CC);
zend_declare_property_string(reflection_function_ptr, "name", sizeof("name")-1, "", ZEND_ACC_PUBLIC TSRMLS_CC);
REGISTER_REFLECTION_CLASS_CONST_LONG(function, "IS_DEPRECATED", ZEND_ACC_DEPRECATED);
@@ -6148,7 +6118,7 @@ PHP_MINIT_FUNCTION(reflection) /* {{{ */
INIT_CLASS_ENTRY(_reflection_entry, "ReflectionMethod", reflection_method_functions);
_reflection_entry.create_object = reflection_objects_new;
- reflection_method_ptr = zend_register_internal_class_ex(&_reflection_entry, reflection_function_abstract_ptr, NULL TSRMLS_CC);
+ reflection_method_ptr = zend_register_internal_class_ex(&_reflection_entry, reflection_function_abstract_ptr TSRMLS_CC);
zend_declare_property_string(reflection_method_ptr, "name", sizeof("name")-1, "", ZEND_ACC_PUBLIC TSRMLS_CC);
zend_declare_property_string(reflection_method_ptr, "class", sizeof("class")-1, "", ZEND_ACC_PUBLIC TSRMLS_CC);
@@ -6171,7 +6141,7 @@ PHP_MINIT_FUNCTION(reflection) /* {{{ */
INIT_CLASS_ENTRY(_reflection_entry, "ReflectionObject", reflection_object_functions);
_reflection_entry.create_object = reflection_objects_new;
- reflection_object_ptr = zend_register_internal_class_ex(&_reflection_entry, reflection_class_ptr, NULL TSRMLS_CC);
+ reflection_object_ptr = zend_register_internal_class_ex(&_reflection_entry, reflection_class_ptr TSRMLS_CC);
INIT_CLASS_ENTRY(_reflection_entry, "ReflectionProperty", reflection_property_functions);
_reflection_entry.create_object = reflection_objects_new;
diff --git a/ext/simplexml/sxe.c b/ext/simplexml/sxe.c
index 9a513e946f..4ecd7539ff 100644
--- a/ext/simplexml/sxe.c
+++ b/ext/simplexml/sxe.c
@@ -199,7 +199,7 @@ PHP_MINIT_FUNCTION(sxe) /* {{{ */
ce_SimpleXMLElement = *pce;
INIT_CLASS_ENTRY_EX(sxi, "SimpleXMLIterator", strlen("SimpleXMLIterator"), funcs_SimpleXMLIterator);
- ce_SimpleXMLIterator = zend_register_internal_class_ex(&sxi, ce_SimpleXMLElement, NULL TSRMLS_CC);
+ ce_SimpleXMLIterator = zend_register_internal_class_ex(&sxi, ce_SimpleXMLElement TSRMLS_CC);
ce_SimpleXMLIterator->create_object = ce_SimpleXMLElement->create_object;
zend_class_implements(ce_SimpleXMLIterator TSRMLS_CC, 1, spl_ce_RecursiveIterator);
diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c
index 4dd4badcd2..8b6afdee3a 100644
--- a/ext/snmp/snmp.c
+++ b/ext/snmp/snmp.c
@@ -2453,9 +2453,9 @@ PHP_MINIT_FUNCTION(snmp)
/* Register SNMPException class */
INIT_CLASS_ENTRY(cex, "SNMPException", NULL);
#ifdef HAVE_SPL
- php_snmp_exception_ce = zend_register_internal_class_ex(&cex, spl_ce_RuntimeException, NULL TSRMLS_CC);
+ php_snmp_exception_ce = zend_register_internal_class_ex(&cex, spl_ce_RuntimeException TSRMLS_CC);
#else
- php_snmp_exception_ce = zend_register_internal_class_ex(&cex, zend_exception_get_default(TSRMLS_C), NULL TSRMLS_CC);
+ php_snmp_exception_ce = zend_register_internal_class_ex(&cex, zend_exception_get_default(TSRMLS_C) TSRMLS_CC);
#endif
return SUCCESS;
diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c
index 12f23bf0e2..36d0f80249 100644
--- a/ext/soap/php_encoding.c
+++ b/ext/soap/php_encoding.c
@@ -2273,8 +2273,11 @@ static void add_xml_array_elements(xmlNodePtr xmlParam,
static inline int array_num_elements(HashTable* ht)
{
- if (ht->pListTail && ht->pListTail->nKeyLength == 0) {
- return ht->pListTail->h-1;
+ if (ht->nNumUsed &&
+ ht->arData[ht->nNumUsed-1].xData &&
+ ht->arData[ht->nNumUsed-1].nKeyLength == 0) {
+
+ return ht->arData[ht->nNumUsed-1].h - 1;
}
return 0;
}
diff --git a/ext/soap/soap.c b/ext/soap/soap.c
index a8c6cb9369..5048bf0b2c 100644
--- a/ext/soap/soap.c
+++ b/ext/soap/soap.c
@@ -532,6 +532,7 @@ static void php_soap_prepare_globals()
zend_hash_init(&defEnc, 0, NULL, NULL, 1);
zend_hash_init(&defEncIndex, 0, NULL, NULL, 1);
zend_hash_init(&defEncNs, 0, NULL, NULL, 1);
+ defEncNs.flags |= HASH_FLAG_BIG_DATA;
i = 0;
do {
@@ -647,7 +648,7 @@ PHP_MINIT_FUNCTION(soap)
/* Register SoapFault class */
INIT_CLASS_ENTRY(ce, PHP_SOAP_FAULT_CLASSNAME, soap_fault_functions);
- soap_fault_class_entry = zend_register_internal_class_ex(&ce, zend_exception_get_default(TSRMLS_C), NULL TSRMLS_CC);
+ soap_fault_class_entry = zend_register_internal_class_ex(&ce, zend_exception_get_default(TSRMLS_C) TSRMLS_CC);
/* Register SoapParam class */
INIT_CLASS_ENTRY(ce, PHP_SOAP_PARAM_CLASSNAME, soap_param_functions);
diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c
index 5927e05562..de787ae7b6 100644
--- a/ext/spl/php_spl.c
+++ b/ext/spl/php_spl.c
@@ -454,12 +454,24 @@ PHP_FUNCTION(spl_autoload_call)
} /* }}} */
#define HT_MOVE_TAIL_TO_HEAD(ht) \
- (ht)->pListTail->pListNext = (ht)->pListHead; \
- (ht)->pListHead = (ht)->pListTail; \
- (ht)->pListTail = (ht)->pListHead->pListLast; \
- (ht)->pListHead->pListNext->pListLast = (ht)->pListHead;\
- (ht)->pListTail->pListNext = NULL; \
- (ht)->pListHead->pListLast = NULL;
+ do { \
+ uint first = 0; \
+ uint last = (ht)->nNumUsed; \
+ while (first < last) { \
+ if ((ht)->arData[first].xData) break; \
+ first++; \
+ } \
+ while (last > first) { \
+ last--; \
+ if ((ht)->arData[last].xData) break; \
+ } \
+ if (first != last) { \
+ Bucket tmp = (ht)->arData[first]; \
+ (ht)->arData[first] = (ht)->arData[last]; \
+ (ht)->arData[last] = tmp; \
+ zend_hash_rehash(ht); \
+ } \
+ } while (0)
/* {{{ proto bool spl_autoload_register([mixed autoload_function = "spl_autoload" [, throw = true [, prepend]]])
Register given function as __autoload() implementation */
diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c
index 9270132ff7..541f7b67a7 100644
--- a/ext/spl/spl_array.c
+++ b/ext/spl/spl_array.c
@@ -101,33 +101,39 @@ static inline HashTable *spl_array_get_hash_table(spl_array_object* intern, int
static void spl_array_rewind(spl_array_object *intern TSRMLS_DC);
-static void spl_array_update_pos(spl_array_object* intern) /* {{{ */
+static void spl_array_update_pos(HashTable *ht, spl_array_object* intern) /* {{{ */
{
- Bucket *pos = intern->pos;
- if (pos != NULL) {
- intern->pos_h = pos->h;
+ uint pos = intern->pos;
+ if (pos != INVALID_IDX) {
+ intern->pos_h = ht->arData[pos].h;
}
} /* }}} */
-static void spl_array_set_pos(spl_array_object* intern, HashPosition pos) /* {{{ */
+static void spl_array_set_pos(spl_array_object* intern, HashTable *ht, HashPosition pos) /* {{{ */
{
intern->pos = pos;
- spl_array_update_pos(intern);
+ spl_array_update_pos(ht, intern);
} /* }}} */
SPL_API int spl_hash_verify_pos_ex(spl_array_object * intern, HashTable * ht TSRMLS_DC) /* {{{ */
{
- Bucket *p;
+ uint idx;
/* IS_CONSISTENT(ht);*/
/* HASH_PROTECT_RECURSION(ht);*/
- p = ht->arBuckets[intern->pos_h & ht->nTableMask];
- while (p != NULL) {
- if (p == intern->pos) {
+ if (ht->flags & HASH_FLAG_PACKED) {
+ if (intern->pos_h == intern->pos && ht->arData[intern->pos_h].xData) {
return SUCCESS;
}
- p = p->pNext;
+ } else {
+ idx = ht->arHash[intern->pos_h & ht->nTableMask].idx;
+ while (idx != INVALID_IDX) {
+ if (idx == intern->pos) {
+ return SUCCESS;
+ }
+ idx = ht->arData[idx].next;
+ }
}
/* HASH_UNPROTECT_RECURSION(ht); */
spl_array_rewind(intern TSRMLS_CC);
@@ -667,7 +673,7 @@ static inline int spl_array_object_verify_pos_ex(spl_array_object *object, HashT
return FAILURE;
}
- if (object->pos && (object->ar_flags & SPL_ARRAY_IS_REF) && spl_hash_verify_pos_ex(object, ht TSRMLS_CC) == FAILURE) {
+ if (object->pos != INVALID_IDX && (object->ar_flags & SPL_ARRAY_IS_REF) && spl_hash_verify_pos_ex(object, ht TSRMLS_CC) == FAILURE) {
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%sArray was modified outside object and internal position is no longer valid", msg_prefix);
return FAILURE;
}
@@ -734,8 +740,10 @@ void spl_array_iterator_append(zval *object, zval *append_value TSRMLS_DC) /* {{
}
spl_array_write_dimension(object, NULL, append_value TSRMLS_CC);
- if (!intern->pos) {
- spl_array_set_pos(intern, aht->pListTail);
+ if (intern->pos == INVALID_IDX) {
+ if (aht->nNumUsed && aht->arData[aht->nNumUsed-1].xData) {
+ spl_array_set_pos(intern, aht, aht->nNumUsed - 1);
+ }
}
} /* }}} */
@@ -932,7 +940,7 @@ static int spl_array_skip_protected(spl_array_object *intern, HashTable *aht TSR
return FAILURE;
}
zend_hash_move_forward_ex(aht, &intern->pos);
- spl_array_update_pos(intern);
+ spl_array_update_pos(aht, intern);
} while (1);
}
return FAILURE;
@@ -941,7 +949,7 @@ static int spl_array_skip_protected(spl_array_object *intern, HashTable *aht TSR
static int spl_array_next_no_verify(spl_array_object *intern, HashTable *aht TSRMLS_DC) /* {{{ */
{
zend_hash_move_forward_ex(aht, &intern->pos);
- spl_array_update_pos(intern);
+ spl_array_update_pos(aht, intern);
if (Z_TYPE_P(intern->array) == IS_OBJECT) {
return spl_array_skip_protected(intern, aht TSRMLS_CC);
} else {
@@ -1064,7 +1072,7 @@ static void spl_array_rewind_ex(spl_array_object *intern, HashTable *aht TSRMLS_
{
zend_hash_internal_pointer_reset_ex(aht, &intern->pos);
- spl_array_update_pos(intern);
+ spl_array_update_pos(aht, intern);
spl_array_skip_protected(intern, aht TSRMLS_CC);
} /* }}} */
@@ -1381,10 +1389,10 @@ int static spl_array_object_count_elements_helper(spl_array_object *intern, long
pos = intern->pos;
*count = 0;
spl_array_rewind(intern TSRMLS_CC);
- while(intern->pos && spl_array_next(intern TSRMLS_CC) == SUCCESS) {
+ while(intern->pos != INVALID_IDX && spl_array_next(intern TSRMLS_CC) == SUCCESS) {
(*count)++;
}
- spl_array_set_pos(intern, pos);
+ spl_array_set_pos(intern, aht, pos);
return SUCCESS;
} else {
*count = zend_hash_num_elements(aht);
diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c
index 4abbdf9df8..6ec094ac3c 100644
--- a/ext/spl/spl_directory.c
+++ b/ext/spl/spl_directory.c
@@ -2232,9 +2232,14 @@ static int spl_filesystem_file_is_empty_line(spl_filesystem_object *intern TSRML
case IS_ARRAY:
if (SPL_HAS_FLAG(intern->flags, SPL_FILE_OBJECT_READ_CSV)
&& zend_hash_num_elements(Z_ARRVAL_P(intern->u.file.current_zval)) == 1) {
- zval ** first = Z_ARRVAL_P(intern->u.file.current_zval)->pListHead->pData;
-
- return Z_TYPE_PP(first) == IS_STRING && Z_STRLEN_PP(first) == 0;
+ uint idx = 0;
+ zval *first;
+
+ while (Z_ARRVAL_P(intern->u.file.current_zval)->arData[idx].xData == NULL) {
+ idx++;
+ }
+ first = Z_ARRVAL_P(intern->u.file.current_zval)->arData[idx].xData;
+ return Z_TYPE_P(first) == IS_STRING && Z_STRLEN_P(first) == 0;
}
return zend_hash_num_elements(Z_ARRVAL_P(intern->u.file.current_zval)) == 0;
case IS_NULL:
diff --git a/ext/spl/spl_functions.c b/ext/spl/spl_functions.c
index f1e59c0234..1a3134f85f 100644
--- a/ext/spl/spl_functions.c
+++ b/ext/spl/spl_functions.c
@@ -58,7 +58,7 @@ PHPAPI void spl_register_sub_class(zend_class_entry ** ppce, zend_class_entry *
zend_class_entry ce;
INIT_CLASS_ENTRY_EX(ce, class_name, strlen(class_name), function_list);
- *ppce = zend_register_internal_class_ex(&ce, parent_ce, NULL TSRMLS_CC);
+ *ppce = zend_register_internal_class_ex(&ce, parent_ce TSRMLS_CC);
/* entries changed by initialize */
if (obj_ctor) {
diff --git a/ext/spl/spl_observer.c b/ext/spl/spl_observer.c
index 1a706f7642..3882deb229 100644
--- a/ext/spl/spl_observer.c
+++ b/ext/spl/spl_observer.c
@@ -258,6 +258,7 @@ static zend_object_value spl_object_storage_new_ex(zend_class_entry *class_type,
intern = emalloc(sizeof(spl_SplObjectStorage));
memset(intern, 0, sizeof(spl_SplObjectStorage));
+ intern->pos = INVALID_IDX;
*obj = intern;
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
diff --git a/ext/standard/array.c b/ext/standard/array.c
index 6642bc2c7b..9892bd49ae 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -181,8 +181,8 @@ static int php_array_key_compare(const void *a, const void *b TSRMLS_DC) /* {{{
zval first;
zval second;
- f = *((Bucket **) a);
- s = *((Bucket **) b);
+ f = (Bucket *) a;
+ s = (Bucket *) b;
if (f->nKeyLength == 0) {
Z_TYPE(first) = IS_LONG;
@@ -333,6 +333,8 @@ PHP_FUNCTION(count)
return;
}
}
+//???
+#if 0
#ifdef HAVE_SPL
/* if not and the object implements Countable we call its count() method */
if (Z_OBJ_HT_P(array)->get_class_entry && instanceof_function(Z_OBJCE_P(array), spl_ce_Countable TSRMLS_CC)) {
@@ -345,6 +347,7 @@ PHP_FUNCTION(count)
return;
}
#endif
+#endif
}
default:
RETURN_LONG(1);
@@ -367,11 +370,11 @@ static int php_array_data_compare(const void *a, const void *b TSRMLS_DC) /* {{{
zval *first;
zval *second;
- f = *((Bucket **) a);
- s = *((Bucket **) b);
+ f = (Bucket *) a;
+ s = (Bucket *) b;
- first = *((zval **) f->pData);
- second = *((zval **) s->pData);
+ first = (zval *) f->xData;
+ second = (zval *) s->xData;
if (ARRAYG(compare_func)(&result, first, second TSRMLS_CC) == FAILURE) {
return 0;
@@ -412,11 +415,11 @@ static int php_array_natural_general_compare(const void *a, const void *b, int f
zval first, second;
int result;
- f = *((Bucket **) a);
- s = *((Bucket **) b);
+ f = (Bucket *) a;
+ s = (Bucket *) b;
- fval = *((zval **) f->pData);
- sval = *((zval **) s->pData);
+ fval = (zval *) f->xData;
+ sval = (zval *) s->xData;
first = *fval;
second = *sval;
@@ -581,11 +584,11 @@ static int php_array_user_compare(const void *a, const void *b TSRMLS_DC) /* {{{
zval **args[2];
zval *retval_ptr = NULL;
- f = *((Bucket **) a);
- s = *((Bucket **) b);
+ f = (Bucket *) a;
+ s = (Bucket *) b;
- args[0] = (zval **) f->pData;
- args[1] = (zval **) s->pData;
+ args[0] = (zval **) &f->xData;
+ args[1] = (zval **) &s->xData;
BG(user_compare_fci).param_count = 2;
BG(user_compare_fci).params = args;
@@ -733,8 +736,8 @@ static int php_array_user_key_compare(const void *a, const void *b TSRMLS_DC) /*
args[0] = &key1;
args[1] = &key2;
- f = *((Bucket **) a);
- s = *((Bucket **) b);
+ f = (Bucket *) a;
+ s = (Bucket *) b;
if (f->nKeyLength == 0) {
Z_LVAL_P(key1) = f->h;
@@ -1745,7 +1748,8 @@ err:
static void php_array_data_shuffle(zval *array TSRMLS_DC) /* {{{ */
{
- Bucket **elems, *temp;
+ uint idx;
+ Bucket *p, temp;
HashTable *hash;
int j, n_elems, rnd_idx, n_left;
@@ -1755,47 +1759,47 @@ static void php_array_data_shuffle(zval *array TSRMLS_DC) /* {{{ */
return;
}
- elems = (Bucket **)safe_emalloc(n_elems, sizeof(Bucket *), 0);
hash = Z_ARRVAL_P(array);
n_left = n_elems;
- for (j = 0, temp = hash->pListHead; temp; temp = temp->pListNext)
- elems[j++] = temp;
+ if (hash->nNumUsed != hash->nNumOfElements) {
+ for (j = 0, idx = 0; idx < hash->nNumUsed; idx++) {
+ p = hash->arData + idx;
+ if (!p->xData) continue;
+ if (j != idx) {
+ hash->arData[j] = *p;
+ }
+ j++;
+ }
+ }
while (--n_left) {
rnd_idx = php_rand(TSRMLS_C);
RAND_RANGE(rnd_idx, 0, n_left, PHP_RAND_MAX);
if (rnd_idx != n_left) {
- temp = elems[n_left];
- elems[n_left] = elems[rnd_idx];
- elems[rnd_idx] = temp;
+ temp = hash->arData[n_left];
+ hash->arData[n_left] = hash->arData[rnd_idx];
+ hash->arData[rnd_idx] = temp;
}
}
HANDLE_BLOCK_INTERRUPTIONS();
- hash->pListHead = elems[0];
- hash->pListTail = NULL;
- hash->pInternalPointer = hash->pListHead;
+ hash->nNumUsed = n_elems;
+ hash->nInternalPointer = 0;
for (j = 0; j < n_elems; j++) {
- if (hash->pListTail) {
- hash->pListTail->pListNext = elems[j];
+ p = hash->arData + j;
+ if (p->nKeyLength && !IS_INTERNED(p->arKey)) {
+ pefree((char*)p->arKey, hash->flags & HASH_FLAG_PERSISTENT);
}
- elems[j]->pListLast = hash->pListTail;
- elems[j]->pListNext = NULL;
- hash->pListTail = elems[j];
- }
- temp = hash->pListHead;
- j = 0;
- while (temp != NULL) {
- temp->nKeyLength = 0;
- temp->h = j++;
- temp = temp->pListNext;
+ p->h = j;
+ p->nKeyLength = 0;
+ p->arKey = NULL;
}
hash->nNextFreeElement = n_elems;
- zend_hash_rehash(hash);
+ if (!(hash->flags & HASH_FLAG_PACKED)) {
+ zend_hash_to_packed(hash);
+ }
HANDLE_UNBLOCK_INTERRUPTIONS();
-
- efree(elems);
}
/* }}} */
@@ -1821,6 +1825,7 @@ PHPAPI HashTable* php_splice(HashTable *in_hash, int offset, int length, zval **
int num_in, /* Number of entries in the input hashtable */
pos, /* Current position in the hashtable */
i; /* Loop counter */
+ uint idx;
Bucket *p; /* Pointer to hash bucket */
zval *entry; /* Hash entry */
@@ -1851,9 +1856,12 @@ PHPAPI HashTable* php_splice(HashTable *in_hash, int offset, int length, zval **
zend_hash_init(out_hash, (length > 0 ? num_in - length : 0) + list_count, NULL, ZVAL_PTR_DTOR, 0);
/* Start at the beginning of the input hash and copy entries to output hash until offset is reached */
- for (pos = 0, p = in_hash->pListHead; pos < offset && p ; pos++, p = p->pListNext) {
+ for (pos = 0, idx = 0; pos < offset && idx < in_hash->nNumUsed; idx++) {
+ p = in_hash->arData + idx;
+ if (!p->xData) continue;
+ pos++;
/* Get entry and increase reference count */
- entry = *((zval **)p->pData);
+ entry = (zval *)p->xData;
Z_ADDREF_P(entry);
/* Update output hash depending on key type */
@@ -1866,8 +1874,11 @@ PHPAPI HashTable* php_splice(HashTable *in_hash, int offset, int length, zval **
/* If hash for removed entries exists, go until offset+length and copy the entries to it */
if (removed != NULL) {
- for ( ; pos < offset + length && p; pos++, p = p->pListNext) {
- entry = *((zval **)p->pData);
+ for ( ; pos < offset + length && idx < in_hash->nNumUsed; idx++) {
+ p = in_hash->arData + idx;
+ if (!p->xData) continue;
+ pos++;
+ entry = (zval *)p->xData;
Z_ADDREF_P(entry);
if (p->nKeyLength == 0) {
zend_hash_next_index_insert(*removed, &entry, sizeof(zval *), NULL);
@@ -1876,7 +1887,7 @@ PHPAPI HashTable* php_splice(HashTable *in_hash, int offset, int length, zval **
}
}
} else { /* otherwise just skip those entries */
- for ( ; pos < offset + length && p; pos++, p = p->pListNext);
+ for ( ; pos < offset + length && idx < in_hash->nNumUsed; pos++, idx++);
}
/* If there are entries to insert.. */
@@ -1890,8 +1901,10 @@ PHPAPI HashTable* php_splice(HashTable *in_hash, int offset, int length, zval **
}
/* Copy the remaining input hash entries to the output hash */
- for ( ; p ; p = p->pListNext) {
- entry = *((zval **)p->pData);
+ for ( ; idx < in_hash->nNumUsed ; idx++) {
+ p = in_hash->arData + idx;
+ if (!p->xData) continue;
+ entry = (zval *)p->xData;
Z_ADDREF_P(entry);
if (p->nKeyLength == 0) {
zend_hash_next_index_insert(out_hash, &entry, sizeof(zval *), NULL);
@@ -1977,8 +1990,12 @@ static void _phpi_pop(INTERNAL_FUNCTION_PARAMETERS, int off_the_end)
if (!off_the_end) {
unsigned int k = 0;
int should_rehash = 0;
- Bucket *p = Z_ARRVAL_P(stack)->pListHead;
- while (p != NULL) {
+ uint idx;
+ Bucket *p;
+
+ for (idx = 0; idx < Z_ARRVAL_P(stack)->nNumUsed; idx++) {
+ p = Z_ARRVAL_P(stack)->arData + idx;
+ if (!p->xData) continue;
if (p->nKeyLength == 0) {
if (p->h != k) {
p->h = k++;
@@ -1987,11 +2004,14 @@ static void _phpi_pop(INTERNAL_FUNCTION_PARAMETERS, int off_the_end)
k++;
}
}
- p = p->pListNext;
}
Z_ARRVAL_P(stack)->nNextFreeElement = k;
if (should_rehash) {
- zend_hash_rehash(Z_ARRVAL_P(stack));
+ if (Z_ARRVAL_P(stack)->flags & HASH_FLAG_PACKED) {
+ zend_hash_packed_to_hash(Z_ARRVAL_P(stack));
+ } else {
+ zend_hash_rehash(Z_ARRVAL_P(stack));
+ }
}
} else if (!key_len && index >= Z_ARRVAL_P(stack)->nNextFreeElement - 1) {
Z_ARRVAL_P(stack)->nNextFreeElement = Z_ARRVAL_P(stack)->nNextFreeElement - 1;
@@ -2058,6 +2078,7 @@ PHP_FUNCTION(array_splice)
HashTable *new_hash = NULL, /* Output array's hash */
**rem_hash = NULL; /* Removed elements' hash */
HashTable old_hash;
+ uint idx;
Bucket *p; /* Bucket used for traversing hash */
long i,
offset,
@@ -2082,8 +2103,10 @@ PHP_FUNCTION(array_splice)
/* Create the array of replacement elements */
repl_num = zend_hash_num_elements(Z_ARRVAL_P(repl_array));
repl = (zval ***)safe_emalloc(repl_num, sizeof(zval **), 0);
- for (p = Z_ARRVAL_P(repl_array)->pListHead, i = 0; p; p = p->pListNext, i++) {
- repl[i] = ((zval **)p->pData);
+ for (idx = 0, i = 0; idx < Z_ARRVAL_P(repl_array)->nNumUsed; idx++) {
+ p = Z_ARRVAL_P(repl_array)->arData + idx;
+ if (!p->xData) continue;
+ repl[i++] = (zval **)&p->xData;
}
}
@@ -2830,9 +2853,10 @@ PHP_FUNCTION(array_change_key_case)
PHP_FUNCTION(array_unique)
{
zval *array, *tmp;
+ uint idx;
Bucket *p;
struct bucketindex {
- Bucket *b;
+ Bucket b;
unsigned int i;
};
struct bucketindex *arTmp, *cmpdata, *lastkept;
@@ -2853,29 +2877,32 @@ PHP_FUNCTION(array_unique)
}
/* create and sort array with pointers to the target_hash buckets */
- arTmp = (struct bucketindex *) pemalloc((Z_ARRVAL_P(array)->nNumOfElements + 1) * sizeof(struct bucketindex), Z_ARRVAL_P(array)->persistent);
+ arTmp = (struct bucketindex *) pemalloc((Z_ARRVAL_P(array)->nNumOfElements + 1) * sizeof(struct bucketindex), Z_ARRVAL_P(array)->flags & HASH_FLAG_PERSISTENT);
if (!arTmp) {
zval_dtor(return_value);
RETURN_FALSE;
}
- for (i = 0, p = Z_ARRVAL_P(array)->pListHead; p; i++, p = p->pListNext) {
- arTmp[i].b = p;
+ for (i = 0, idx = 0; idx < Z_ARRVAL_P(array)->nNumUsed; idx++) {
+ p = Z_ARRVAL_P(array)->arData + idx;
+ if (!p->xData) continue;
+ arTmp[i].b = *p;
arTmp[i].i = i;
+ i++;
}
- arTmp[i].b = NULL;
+ arTmp[i].b.xData = NULL;
zend_qsort((void *) arTmp, i, sizeof(struct bucketindex), php_array_data_compare TSRMLS_CC);
/* go through the sorted array and delete duplicates from the copy */
lastkept = arTmp;
- for (cmpdata = arTmp + 1; cmpdata->b; cmpdata++) {
+ for (cmpdata = arTmp + 1; cmpdata->b.xData; cmpdata++) {
if (php_array_data_compare(lastkept, cmpdata TSRMLS_CC)) {
lastkept = cmpdata;
} else {
if (lastkept->i > cmpdata->i) {
- p = lastkept->b;
+ p = &lastkept->b;
lastkept = cmpdata;
} else {
- p = cmpdata->b;
+ p = &cmpdata->b;
}
if (p->nKeyLength == 0) {
zend_hash_index_del(Z_ARRVAL_P(return_value), p->h);
@@ -2888,7 +2915,7 @@ PHP_FUNCTION(array_unique)
}
}
}
- pefree(arTmp, Z_ARRVAL_P(array)->persistent);
+ pefree(arTmp, Z_ARRVAL_P(array)->flags & HASH_FLAG_PERSISTENT);
}
/* }}} */
@@ -2955,6 +2982,7 @@ static int zval_user_compare(zval **a, zval **b TSRMLS_DC) /* {{{ */
static void php_array_intersect_key(INTERNAL_FUNCTION_PARAMETERS, int data_compare_type) /* {{{ */
{
+ uint idx;
Bucket *p;
int argc, i;
zval ***args;
@@ -3001,36 +3029,38 @@ static void php_array_intersect_key(INTERNAL_FUNCTION_PARAMETERS, int data_compa
array_init(return_value);
- for (p = Z_ARRVAL_PP(args[0])->pListHead; p != NULL; p = p->pListNext) {
+ for (idx = 0; idx < Z_ARRVAL_PP(args[0])->nNumUsed; idx++) {
+ p = Z_ARRVAL_PP(args[0])->arData + idx;
+ if (!p->xData) continue;
if (p->nKeyLength == 0) {
ok = 1;
for (i = 1; i < argc; i++) {
if (zend_hash_index_find(Z_ARRVAL_PP(args[i]), p->h, (void**)&data) == FAILURE ||
(intersect_data_compare_func &&
- intersect_data_compare_func((zval**)p->pData, data TSRMLS_CC) != 0)
+ intersect_data_compare_func((zval**)&p->xData, data TSRMLS_CC) != 0)
) {
ok = 0;
break;
}
}
if (ok) {
- Z_ADDREF_PP((zval**)p->pData);
- zend_hash_index_update(Z_ARRVAL_P(return_value), p->h, p->pData, sizeof(zval*), NULL);
+ Z_ADDREF_P((zval*)p->xData);
+ zend_hash_index_update(Z_ARRVAL_P(return_value), p->h, &p->xData, sizeof(zval*), NULL);
}
} else {
ok = 1;
for (i = 1; i < argc; i++) {
if (zend_hash_quick_find(Z_ARRVAL_PP(args[i]), p->arKey, p->nKeyLength, p->h, (void**)&data) == FAILURE ||
(intersect_data_compare_func &&
- intersect_data_compare_func((zval**)p->pData, data TSRMLS_CC) != 0)
+ intersect_data_compare_func((zval**)&p->xData, data TSRMLS_CC) != 0)
) {
ok = 0;
break;
}
}
if (ok) {
- Z_ADDREF_PP((zval**)p->pData);
- zend_hash_quick_update(Z_ARRVAL_P(return_value), p->arKey, p->nKeyLength, p->h, p->pData, sizeof(zval*), NULL);
+ Z_ADDREF_P((zval*)p->xData);
+ zend_hash_quick_update(Z_ARRVAL_P(return_value), p->arKey, p->nKeyLength, p->h, &p->xData, sizeof(zval*), NULL);
}
}
}
@@ -3044,7 +3074,8 @@ static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior, int
zval ***args = NULL;
HashTable *hash;
int arr_argc, i, c = 0;
- Bucket ***lists, **list, ***ptrs, *p;
+ uint idx;
+ Bucket **lists, *list, **ptrs, *p;
int req_args;
char *param_spec;
zend_fcall_info fci1, fci2;
@@ -3144,8 +3175,8 @@ static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior, int
PHP_ARRAY_CMP_FUNC_BACKUP();
/* for each argument, create and sort list with pointers to the hash buckets */
- lists = (Bucket ***)safe_emalloc(arr_argc, sizeof(Bucket **), 0);
- ptrs = (Bucket ***)safe_emalloc(arr_argc, sizeof(Bucket **), 0);
+ lists = (Bucket **)safe_emalloc(arr_argc, sizeof(Bucket *), 0);
+ ptrs = (Bucket **)safe_emalloc(arr_argc, sizeof(Bucket *), 0);
php_set_compare_func(PHP_SORT_STRING TSRMLS_CC);
if (behavior == INTERSECT_NORMAL && data_compare_type == INTERSECT_COMP_DATA_USER) {
@@ -3163,7 +3194,7 @@ static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior, int
goto out;
}
hash = Z_ARRVAL_PP(args[i]);
- list = (Bucket **) pemalloc((hash->nNumOfElements + 1) * sizeof(Bucket *), hash->persistent);
+ list = (Bucket *) pemalloc((hash->nNumOfElements + 1) * sizeof(Bucket), hash->flags & HASH_FLAG_PERSISTENT);
if (!list) {
PHP_ARRAY_CMP_FUNC_RESTORE();
@@ -3174,14 +3205,16 @@ static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior, int
}
lists[i] = list;
ptrs[i] = list;
- for (p = hash->pListHead; p; p = p->pListNext) {
- *list++ = p;
+ for (idx = 0; idx < hash->nNumUsed; idx++) {
+ p = hash->arData + idx;
+ if (!p->xData) continue;
+ *list++ = *p;
}
- *list = NULL;
+ list->xData = NULL;
if (behavior == INTERSECT_NORMAL) {
- zend_qsort((void *) lists[i], hash->nNumOfElements, sizeof(Bucket *), intersect_data_compare_func TSRMLS_CC);
+ zend_qsort((void *) lists[i], hash->nNumOfElements, sizeof(Bucket), intersect_data_compare_func TSRMLS_CC);
} else if (behavior & INTERSECT_ASSOC) { /* triggered also when INTERSECT_KEY */
- zend_qsort((void *) lists[i], hash->nNumOfElements, sizeof(Bucket *), intersect_key_compare_func TSRMLS_CC);
+ zend_qsort((void *) lists[i], hash->nNumOfElements, sizeof(Bucket), intersect_key_compare_func TSRMLS_CC);
}
}
@@ -3198,7 +3231,7 @@ static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior, int
}
/* go through the lists and look for common values */
- while (*ptrs[0]) {
+ while (ptrs[0]->xData) {
if ((behavior & INTERSECT_ASSOC) /* triggered also when INTERSECT_KEY */
&&
key_compare_type == INTERSECT_COMP_KEY_USER) {
@@ -3209,14 +3242,14 @@ static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior, int
for (i = 1; i < arr_argc; i++) {
if (behavior & INTERSECT_NORMAL) {
- while (*ptrs[i] && (0 < (c = intersect_data_compare_func(ptrs[0], ptrs[i] TSRMLS_CC)))) {
+ while (ptrs[i]->xData && (0 < (c = intersect_data_compare_func(ptrs[0], ptrs[i] TSRMLS_CC)))) {
ptrs[i]++;
}
} else if (behavior & INTERSECT_ASSOC) { /* triggered also when INTERSECT_KEY */
- while (*ptrs[i] && (0 < (c = intersect_key_compare_func(ptrs[0], ptrs[i] TSRMLS_CC)))) {
+ while (ptrs[i]->xData && (0 < (c = intersect_key_compare_func(ptrs[0], ptrs[i] TSRMLS_CC)))) {
ptrs[i]++;
}
- if ((!c && *ptrs[i]) && (behavior == INTERSECT_ASSOC)) { /* only when INTERSECT_ASSOC */
+ if ((!c && ptrs[i]->xData) && (behavior == INTERSECT_ASSOC)) { /* only when INTERSECT_ASSOC */
/* this means that ptrs[i] is not NULL so we can compare
* and "c==0" is from last operation
* in this branch of code we enter only when INTERSECT_ASSOC
@@ -3238,13 +3271,13 @@ static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior, int
}
}
}
- if (!*ptrs[i]) {
+ if (!ptrs[i]->xData) {
/* delete any values corresponding to remains of ptrs[0] */
/* and exit because they do not present in at least one of */
/* the other arguments */
for (;;) {
- p = *ptrs[0]++;
- if (!p) {
+ p = ptrs[0]++;
+ if (!p->xData) {
goto out;
}
if (p->nKeyLength == 0) {
@@ -3262,13 +3295,13 @@ static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior, int
/* Value of ptrs[0] not in all arguments, delete all entries */
/* with value < value of ptrs[i] */
for (;;) {
- p = *ptrs[0];
+ p = ptrs[0];
if (p->nKeyLength == 0) {
zend_hash_index_del(Z_ARRVAL_P(return_value), p->h);
} else {
zend_hash_quick_del(Z_ARRVAL_P(return_value), p->arKey, p->nKeyLength, p->h);
}
- if (!*++ptrs[0]) {
+ if (!(++ptrs[0])->xData) {
goto out;
}
if (behavior == INTERSECT_NORMAL) {
@@ -3284,7 +3317,7 @@ static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior, int
/* ptrs[0] is present in all the arguments */
/* Skip all entries with same value as ptrs[0] */
for (;;) {
- if (!*++ptrs[0]) {
+ if (!(++ptrs[0])->xData) {
goto out;
}
if (behavior == INTERSECT_NORMAL) {
@@ -3301,7 +3334,7 @@ static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior, int
out:
for (i = 0; i < arr_argc; i++) {
hash = Z_ARRVAL_PP(args[i]);
- pefree(lists[i], hash->persistent);
+ pefree(lists[i], hash->flags & HASH_FLAG_PERSISTENT);
}
PHP_ARRAY_CMP_FUNC_RESTORE();
@@ -3378,6 +3411,7 @@ PHP_FUNCTION(array_uintersect_uassoc)
static void php_array_diff_key(INTERNAL_FUNCTION_PARAMETERS, int data_compare_type) /* {{{ */
{
+ uint idx;
Bucket *p;
int argc, i;
zval ***args;
@@ -3419,36 +3453,38 @@ static void php_array_diff_key(INTERNAL_FUNCTION_PARAMETERS, int data_compare_ty
array_init(return_value);
- for (p = Z_ARRVAL_PP(args[0])->pListHead; p != NULL; p = p->pListNext) {
+ for (idx = 0; idx < Z_ARRVAL_PP(args[0])->nNumUsed; idx++) {
+ p = Z_ARRVAL_PP(args[0])->arData + idx;
+ if (!p->xData) continue;
if (p->nKeyLength == 0) {
ok = 1;
for (i = 1; i < argc; i++) {
if (zend_hash_index_find(Z_ARRVAL_PP(args[i]), p->h, (void**)&data) == SUCCESS &&
(!diff_data_compare_func ||
- diff_data_compare_func((zval**)p->pData, data TSRMLS_CC) == 0)
+ diff_data_compare_func((zval**)&p->xData, data TSRMLS_CC) == 0)
) {
ok = 0;
break;
}
}
if (ok) {
- Z_ADDREF_PP((zval**)p->pData);
- zend_hash_index_update(Z_ARRVAL_P(return_value), p->h, p->pData, sizeof(zval*), NULL);
+ Z_ADDREF_P((zval*)p->xData);
+ zend_hash_index_update(Z_ARRVAL_P(return_value), p->h, &p->xData, sizeof(zval*), NULL);
}
} else {
ok = 1;
for (i = 1; i < argc; i++) {
if (zend_hash_quick_find(Z_ARRVAL_PP(args[i]), p->arKey, p->nKeyLength, p->h, (void**)&data) == SUCCESS &&
(!diff_data_compare_func ||
- diff_data_compare_func((zval**)p->pData, data TSRMLS_CC) == 0)
+ diff_data_compare_func((zval**)&p->xData, data TSRMLS_CC) == 0)
) {
ok = 0;
break;
}
}
if (ok) {
- Z_ADDREF_PP((zval**)p->pData);
- zend_hash_quick_update(Z_ARRVAL_P(return_value), p->arKey, p->nKeyLength, p->h, p->pData, sizeof(zval*), NULL);
+ Z_ADDREF_P((zval*)p->xData);
+ zend_hash_quick_update(Z_ARRVAL_P(return_value), p->arKey, p->nKeyLength, p->h, &p->xData, sizeof(zval*), NULL);
}
}
}
@@ -3462,7 +3498,8 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_
zval ***args = NULL;
HashTable *hash;
int arr_argc, i, c;
- Bucket ***lists, **list, ***ptrs, *p;
+ uint idx;
+ Bucket **lists, *list, **ptrs, *p;
int req_args;
char *param_spec;
zend_fcall_info fci1, fci2;
@@ -3561,8 +3598,8 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_
PHP_ARRAY_CMP_FUNC_BACKUP();
/* for each argument, create and sort list with pointers to the hash buckets */
- lists = (Bucket ***)safe_emalloc(arr_argc, sizeof(Bucket **), 0);
- ptrs = (Bucket ***)safe_emalloc(arr_argc, sizeof(Bucket **), 0);
+ lists = (Bucket **)safe_emalloc(arr_argc, sizeof(Bucket *), 0);
+ ptrs = (Bucket **)safe_emalloc(arr_argc, sizeof(Bucket *), 0);
php_set_compare_func(PHP_SORT_STRING TSRMLS_CC);
if (behavior == DIFF_NORMAL && data_compare_type == DIFF_COMP_DATA_USER) {
@@ -3580,7 +3617,7 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_
goto out;
}
hash = Z_ARRVAL_PP(args[i]);
- list = (Bucket **) pemalloc((hash->nNumOfElements + 1) * sizeof(Bucket *), hash->persistent);
+ list = (Bucket *) pemalloc((hash->nNumOfElements + 1) * sizeof(Bucket), hash->flags & HASH_FLAG_PERSISTENT);
if (!list) {
PHP_ARRAY_CMP_FUNC_RESTORE();
@@ -3591,14 +3628,16 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_
}
lists[i] = list;
ptrs[i] = list;
- for (p = hash->pListHead; p; p = p->pListNext) {
- *list++ = p;
+ for (idx = 0; idx < hash->nNumUsed; idx++) {
+ p = hash->arData + idx;
+ if (!p->xData) continue;
+ *list++ = *p;
}
- *list = NULL;
+ list->xData = NULL;
if (behavior == DIFF_NORMAL) {
- zend_qsort((void *) lists[i], hash->nNumOfElements, sizeof(Bucket *), diff_data_compare_func TSRMLS_CC);
+ zend_qsort((void *) lists[i], hash->nNumOfElements, sizeof(Bucket), diff_data_compare_func TSRMLS_CC);
} else if (behavior & DIFF_ASSOC) { /* triggered also when DIFF_KEY */
- zend_qsort((void *) lists[i], hash->nNumOfElements, sizeof(Bucket *), diff_key_compare_func TSRMLS_CC);
+ zend_qsort((void *) lists[i], hash->nNumOfElements, sizeof(Bucket), diff_key_compare_func TSRMLS_CC);
}
}
@@ -3615,7 +3654,7 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_
}
/* go through the lists and look for values of ptr[0] that are not in the others */
- while (*ptrs[0]) {
+ while (ptrs[0]->xData) {
if ((behavior & DIFF_ASSOC) /* triggered also when DIFF_KEY */
&&
key_compare_type == DIFF_COMP_KEY_USER
@@ -3625,26 +3664,26 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_
}
c = 1;
for (i = 1; i < arr_argc; i++) {
- Bucket **ptr = ptrs[i];
+ Bucket *ptr = ptrs[i];
if (behavior == DIFF_NORMAL) {
- while (*ptrs[i] && (0 < (c = diff_data_compare_func(ptrs[0], ptrs[i] TSRMLS_CC)))) {
+ while (ptrs[i]->xData && (0 < (c = diff_data_compare_func(ptrs[0], ptrs[i] TSRMLS_CC)))) {
ptrs[i]++;
}
} else if (behavior & DIFF_ASSOC) { /* triggered also when DIFF_KEY */
- while (*ptr && (0 != (c = diff_key_compare_func(ptrs[0], ptr TSRMLS_CC)))) {
+ while (ptr->xData && (0 != (c = diff_key_compare_func(ptrs[0], ptr TSRMLS_CC)))) {
ptr++;
}
}
if (!c) {
if (behavior == DIFF_NORMAL) {
- if (*ptrs[i]) {
+ if (ptrs[i]->xData) {
ptrs[i]++;
}
break;
} else if (behavior == DIFF_ASSOC) { /* only when DIFF_ASSOC */
/* In this branch is execute only when DIFF_ASSOC. If behavior == DIFF_KEY
* data comparison is not needed - skipped. */
- if (*ptr) {
+ if (ptr->xData) {
if (data_compare_type == DIFF_COMP_DATA_USER) {
BG(user_compare_fci) = *fci_data;
BG(user_compare_fci_cache) = *fci_data_cache;
@@ -3675,13 +3714,13 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_
/* ptrs[0] in one of the other arguments */
/* delete all entries with value as ptrs[0] */
for (;;) {
- p = *ptrs[0];
+ p = ptrs[0];
if (p->nKeyLength == 0) {
zend_hash_index_del(Z_ARRVAL_P(return_value), p->h);
} else {
zend_hash_quick_del(Z_ARRVAL_P(return_value), p->arKey, p->nKeyLength, p->h);
}
- if (!*++ptrs[0]) {
+ if (!(++ptrs[0])->xData) {
goto out;
}
if (behavior == DIFF_NORMAL) {
@@ -3697,7 +3736,7 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_
/* ptrs[0] in none of the other arguments */
/* skip all entries with value as ptrs[0] */
for (;;) {
- if (!*++ptrs[0]) {
+ if (!(++ptrs[0])->xData) {
goto out;
}
if (behavior == DIFF_NORMAL) {
@@ -3714,7 +3753,7 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_
out:
for (i = 0; i < arr_argc; i++) {
hash = Z_ARRVAL_PP(args[i]);
- pefree(lists[i], hash->persistent);
+ pefree(lists[i], hash->flags & HASH_FLAG_PERSISTENT);
}
PHP_ARRAY_CMP_FUNC_RESTORE();
@@ -3795,8 +3834,8 @@ PHP_FUNCTION(array_udiff_uassoc)
PHPAPI int php_multisort_compare(const void *a, const void *b TSRMLS_DC) /* {{{ */
{
- Bucket **ab = *(Bucket ***)a;
- Bucket **bb = *(Bucket ***)b;
+ Bucket *ab = *(Bucket **)a;
+ Bucket *bb = *(Bucket **)b;
int r;
int result = 0;
zval temp;
@@ -3805,13 +3844,13 @@ PHPAPI int php_multisort_compare(const void *a, const void *b TSRMLS_DC) /* {{{
do {
php_set_compare_func(ARRAYG(multisort_flags)[MULTISORT_TYPE][r] TSRMLS_CC);
- ARRAYG(compare_func)(&temp, *((zval **)ab[r]->pData), *((zval **)bb[r]->pData) TSRMLS_CC);
+ ARRAYG(compare_func)(&temp, (zval *)ab[r].xData, (zval *)bb[r].xData TSRMLS_CC);
result = ARRAYG(multisort_flags)[MULTISORT_ORDER][r] * Z_LVAL(temp);
if (result != 0) {
return result;
}
r++;
- } while (ab[r] != NULL);
+ } while (ab[r].xData != NULL);
return result;
}
@@ -3830,7 +3869,8 @@ PHP_FUNCTION(array_multisort)
{
zval*** args;
zval*** arrays;
- Bucket*** indirect;
+ Bucket** indirect;
+ uint idx;
Bucket* p;
HashTable* hash;
int argc;
@@ -3839,7 +3879,7 @@ PHP_FUNCTION(array_multisort)
int parse_state[MULTISORT_LAST]; /* 0 - flag not allowed 1 - flag allowed */
int sort_order = PHP_SORT_ASC;
int sort_type = PHP_SORT_REGULAR;
- int i, k;
+ int i, k, n;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "+", &args, &argc) == FAILURE) {
return;
@@ -3944,49 +3984,43 @@ PHP_FUNCTION(array_multisort)
* M is the number of entries in each input array and N is the number
* of the input arrays + 1. The last column is NULL to indicate the end
* of the row. */
- indirect = (Bucket ***)safe_emalloc(array_size, sizeof(Bucket **), 0);
+ indirect = (Bucket **)safe_emalloc(array_size, sizeof(Bucket *), 0);
for (i = 0; i < array_size; i++) {
- indirect[i] = (Bucket **)safe_emalloc((num_arrays + 1), sizeof(Bucket *), 0);
+ indirect[i] = (Bucket *)safe_emalloc((num_arrays + 1), sizeof(Bucket), 0);
}
for (i = 0; i < num_arrays; i++) {
k = 0;
- for (p = Z_ARRVAL_PP(arrays[i])->pListHead; p; p = p->pListNext, k++) {
- indirect[k][i] = p;
+ for (idx = 0; idx < Z_ARRVAL_PP(arrays[i])->nNumUsed; idx++) {
+ p = Z_ARRVAL_PP(arrays[i])->arData + idx;
+ if (!p->xData) continue;
+ indirect[k][i] = *p;
+ k++;
}
}
for (k = 0; k < array_size; k++) {
- indirect[k][num_arrays] = NULL;
+ indirect[k][num_arrays].xData = NULL;
}
/* Do the actual sort magic - bada-bim, bada-boom. */
- zend_qsort(indirect, array_size, sizeof(Bucket **), php_multisort_compare TSRMLS_CC);
+ zend_qsort(indirect, array_size, sizeof(Bucket *), php_multisort_compare TSRMLS_CC);
/* Restructure the arrays based on sorted indirect - this is mostly taken from zend_hash_sort() function. */
HANDLE_BLOCK_INTERRUPTIONS();
for (i = 0; i < num_arrays; i++) {
hash = Z_ARRVAL_PP(arrays[i]);
- hash->pListHead = indirect[0][i];;
- hash->pListTail = NULL;
- hash->pInternalPointer = hash->pListHead;
+ hash->nNumUsed = array_size;
+ hash->nInternalPointer = 0;
- for (k = 0; k < array_size; k++) {
- if (hash->pListTail) {
- hash->pListTail->pListNext = indirect[k][i];
- }
- indirect[k][i]->pListLast = hash->pListTail;
- indirect[k][i]->pListNext = NULL;
- hash->pListTail = indirect[k][i];
- }
+ for (n = 0, k = 0; k < array_size; k++) {
+ hash->arData[k] = indirect[k][i];
+ if (hash->arData[k].nKeyLength == 0)
+ hash->arData[k].h = n++;
- p = hash->pListHead;
- k = 0;
- while (p != NULL) {
- if (p->nKeyLength == 0)
- p->h = k++;
- p = p->pListNext;
}
hash->nNextFreeElement = array_size;
- zend_hash_rehash(hash);
+ if (!(hash->flags & HASH_FLAG_PACKED)) {
+ zend_hash_to_packed(hash);
+ }
}
HANDLE_UNBLOCK_INTERRUPTIONS();
diff --git a/ext/standard/base64.c b/ext/standard/base64.c
index 0df7826642..bcc2fa6b84 100644
--- a/ext/standard/base64.c
+++ b/ext/standard/base64.c
@@ -228,7 +228,8 @@ PHP_FUNCTION(base64_encode)
}
result = php_base64_encode((unsigned char*)str, str_len, &ret_length);
if (result != NULL) {
- RETVAL_STRINGL((char*)result, ret_length, 0);
+//??? RETVAL_STRINGL((char*)result, ret_length, 0);
+ RETVAL_STRINGL((char*)result, ret_length);
} else {
RETURN_FALSE;
}
@@ -249,7 +250,8 @@ PHP_FUNCTION(base64_decode)
}
result = php_base64_decode_ex((unsigned char*)str, str_len, &ret_length, strict);
if (result != NULL) {
- RETVAL_STRINGL((char*)result, ret_length, 0);
+//??? RETVAL_STRINGL((char*)result, ret_length, 0);
+ RETVAL_STRINGL((char*)result, ret_length);
} else {
RETURN_FALSE;
}
diff --git a/ext/standard/browscap.c b/ext/standard/browscap.c
index a2ff691e8f..241c9a7dc2 100644
--- a/ext/standard/browscap.c
+++ b/ext/standard/browscap.c
@@ -141,7 +141,7 @@ static void convert_browscap_pattern(zval *pattern, int persistent) /* {{{ */
static void php_browscap_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callback_type, void *arg TSRMLS_DC) /* {{{ */
{
browser_data *bdata = arg;
- int persistent = bdata->htab->persistent;
+ int persistent = bdata->htab->flags & HASH_FLAG_PERSISTENT;
if (!arg1) {
return;
@@ -393,6 +393,8 @@ static int browser_reg_compare(zval **browser TSRMLS_DC, int num_args, va_list a
return 0;
}
+//???
+#if 0
re = pcre_get_compiled_regex(Z_STRVAL_PP(browser_regex), &re_extra, &re_options TSRMLS_CC);
if (re == NULL) {
return 0;
@@ -446,6 +448,7 @@ static int browser_reg_compare(zval **browser TSRMLS_DC, int num_args, va_list a
*found_browser_entry = *browser;
}
}
+#endif
return 0;
}
diff --git a/ext/standard/info.c b/ext/standard/info.c
index 03ced35fb3..0acf4c75b8 100644
--- a/ext/standard/info.c
+++ b/ext/standard/info.c
@@ -648,11 +648,11 @@ PHPAPI void php_print_info_htmlhead(TSRMLS_D)
/* {{{ module_name_cmp */
static int module_name_cmp(const void *a, const void *b TSRMLS_DC)
{
- Bucket *f = *((Bucket **) a);
- Bucket *s = *((Bucket **) b);
+ Bucket *f = (Bucket *) a;
+ Bucket *s = (Bucket *) b;
- return strcasecmp(((zend_module_entry *)f->pData)->name,
- ((zend_module_entry *)s->pData)->name);
+ return strcasecmp(((zend_module_entry *)f->xData)->name,
+ ((zend_module_entry *)s->xData)->name);
}
/* }}} */
diff --git a/ext/standard/url_scanner_ex.c b/ext/standard/url_scanner_ex.c
index 8a5409341b..8c9098a182 100644
--- a/ext/standard/url_scanner_ex.c
+++ b/ext/standard/url_scanner_ex.c
@@ -65,6 +65,7 @@ static PHP_INI_MH(OnUpdateTags)
}
zend_hash_init(ctx->tags, 0, NULL, NULL, 1);
+ ctx->tags->flags |= HASH_FLAG_BIG_DATA;
for (key = php_strtok_r(tmp, ",", &lasts);
key;
diff --git a/ext/standard/url_scanner_ex.re b/ext/standard/url_scanner_ex.re
index ecacb76f94..56e74f7957 100644
--- a/ext/standard/url_scanner_ex.re
+++ b/ext/standard/url_scanner_ex.re
@@ -63,6 +63,7 @@ static PHP_INI_MH(OnUpdateTags)
}
zend_hash_init(ctx->tags, 0, NULL, NULL, 1);
+ ctx->tags->flags |= ZEND_FLAG_BIG_DATA;
for (key = php_strtok_r(tmp, ",", &lasts);
key;
diff --git a/ext/tidy/tidy.c b/ext/tidy/tidy.c
index 14aff36094..86415295d7 100644
--- a/ext/tidy/tidy.c
+++ b/ext/tidy/tidy.c
@@ -92,7 +92,7 @@
zend_class_entry ce; \
INIT_CLASS_ENTRY(ce, # classname, tidy_funcs_ ## name); \
ce.create_object = tidy_object_new_ ## name; \
- tidy_ce_ ## name = zend_register_internal_class_ex(&ce, parent, NULL TSRMLS_CC); \
+ tidy_ce_ ## name = zend_register_internal_class_ex(&ce, parent TSRMLS_CC); \
tidy_ce_ ## name->ce_flags |= __flags; \
memcpy(&tidy_object_handlers_ ## name, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); \
tidy_object_handlers_ ## name.clone_obj = NULL; \
diff --git a/ext/xsl/php_xsl.h b/ext/xsl/php_xsl.h
index a457856815..1e054b348d 100644
--- a/ext/xsl/php_xsl.h
+++ b/ext/xsl/php_xsl.h
@@ -79,7 +79,7 @@ void xsl_ext_function_object_php(xmlXPathParserContextPtr ctxt, int nargs);
#define REGISTER_XSL_CLASS(ce, name, parent_ce, funcs, entry) \
INIT_CLASS_ENTRY(ce, name, funcs); \
ce.create_object = xsl_objects_new; \
-entry = zend_register_internal_class_ex(&ce, parent_ce, NULL TSRMLS_CC);
+entry = zend_register_internal_class_ex(&ce, parent_ce TSRMLS_CC);
#define XSL_DOMOBJ_NEW(zval, obj, ret) \
if (NULL == (zval = php_xsl_create_object(obj, ret, zval, return_value TSRMLS_CC))) { \
diff --git a/main/SAPI.c b/main/SAPI.c
index f9e4a9fe7f..bb6dc7c04e 100644
--- a/main/SAPI.c
+++ b/main/SAPI.c
@@ -136,14 +136,12 @@ PHP_FUNCTION(header_register_callback)
efree(callback_name);
- if (SG(callback_func)) {
+ if (Z_TYPE(SG(callback_func)) != IS_UNDEF) {
zval_ptr_dtor(&SG(callback_func));
SG(fci_cache) = empty_fcall_info_cache;
}
- SG(callback_func) = callback_func;
-
- Z_ADDREF_P(SG(callback_func));
+ ZVAL_COPY(&SG(callback_func), callback_func);
RETURN_TRUE;
}
@@ -155,16 +153,16 @@ static void sapi_run_header_callback(TSRMLS_D)
zend_fcall_info fci;
char *callback_name = NULL;
char *callback_error = NULL;
- zval *retval_ptr = NULL;
+ zval retval;
- if (zend_fcall_info_init(SG(callback_func), 0, &fci, &SG(fci_cache), &callback_name, &callback_error TSRMLS_CC) == SUCCESS) {
- fci.retval_ptr_ptr = &retval_ptr;
+ if (zend_fcall_info_init(&SG(callback_func), 0, &fci, &SG(fci_cache), &callback_name, &callback_error TSRMLS_CC) == SUCCESS) {
+ fci.retval = &retval;
error = zend_call_function(&fci, &SG(fci_cache) TSRMLS_CC);
if (error == FAILURE) {
goto callback_failed;
- } else if (retval_ptr) {
- zval_ptr_dtor(&retval_ptr);
+ } else {
+ zval_ptr_dtor(&retval);
}
} else {
callback_failed:
@@ -218,8 +216,8 @@ static void sapi_read_post_data(TSRMLS_D)
}
/* now try to find an appropriate POST content handler */
- if (zend_hash_find(&SG(known_post_content_types), content_type,
- content_type_length+1, (void **) &post_entry) == SUCCESS) {
+ if ((post_entry = zend_hash_str_find_ptr(&SG(known_post_content_types), content_type,
+ content_type_length)) != NULL) {
/* found one, register it for use */
SG(request_info).post_entry = post_entry;
post_reader_func = post_entry->post_reader;
@@ -453,7 +451,7 @@ SAPI_API void sapi_activate(TSRMLS_D)
SG(sapi_headers).mimetype = NULL;
SG(headers_sent) = 0;
SG(callback_run) = 0;
- SG(callback_func) = NULL;
+ ZVAL_UNDEF(&SG(callback_func));
SG(read_post_bytes) = 0;
SG(request_info).request_body = NULL;
SG(request_info).current_user = NULL;
@@ -550,9 +548,7 @@ SAPI_API void sapi_deactivate(TSRMLS_D)
SG(sapi_started) = 0;
SG(headers_sent) = 0;
SG(callback_run) = 0;
- if (SG(callback_func)) {
- zval_ptr_dtor(&SG(callback_func));
- }
+ zval_ptr_dtor(&SG(callback_func));
SG(request_info).headers_read = 0;
SG(global_request_time) = 0;
}
@@ -795,7 +791,9 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC)
/* Disable possible output compression for images */
if (!strncmp(ptr, "image/", sizeof("image/")-1)) {
- zend_alter_ini_entry("zlib.output_compression", sizeof("zlib.output_compression"), "0", sizeof("0") - 1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
+ zend_string *key = STR_INIT("zlib.output_compression", sizeof("zlib.output_compression")-1, 0);
+ zend_alter_ini_entry(key, "0", sizeof("0") - 1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
+ STR_FREE(key);
}
mimetype = estrdup(ptr);
@@ -821,8 +819,10 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC)
* do disable compression altogether. This contributes to making scripts
* portable between setups that have and don't have zlib compression
* enabled globally. See req #44164 */
- zend_alter_ini_entry("zlib.output_compression", sizeof("zlib.output_compression"),
+ zend_string *key = STR_INIT("zlib.output_compression", sizeof("zlib.output_compression")-1, 0);
+ zend_alter_ini_entry(key,
"0", sizeof("0") - 1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
+ STR_FREE(key);
} else if (!STRCASECMP(header_line, "Location")) {
if ((SG(sapi_headers).http_response_code < 300 ||
SG(sapi_headers).http_response_code > 307) &&
@@ -880,7 +880,7 @@ SAPI_API int sapi_send_headers(TSRMLS_D)
SG(sapi_headers).send_default_content_type = 0;
}
- if (SG(callback_func) && !SG(callback_run)) {
+ if (Z_TYPE(SG(callback_func)) != IS_UNDEF && !SG(callback_run)) {
SG(callback_run) = 1;
sapi_run_header_callback(TSRMLS_C);
}
@@ -952,9 +952,9 @@ SAPI_API int sapi_register_post_entry(sapi_post_entry *post_entry TSRMLS_DC)
if (SG(sapi_started) && EG(in_execution)) {
return FAILURE;
}
- return zend_hash_add(&SG(known_post_content_types),
- post_entry->content_type, post_entry->content_type_len+1,
- (void *) post_entry, sizeof(sapi_post_entry), NULL);
+ return zend_hash_str_add_mem(&SG(known_post_content_types),
+ post_entry->content_type, post_entry->content_type_len,
+ (void *) post_entry, sizeof(sapi_post_entry)) ? SUCCESS : FAILURE;
}
SAPI_API void sapi_unregister_post_entry(sapi_post_entry *post_entry TSRMLS_DC)
@@ -962,8 +962,8 @@ SAPI_API void sapi_unregister_post_entry(sapi_post_entry *post_entry TSRMLS_DC)
if (SG(sapi_started) && EG(in_execution)) {
return;
}
- zend_hash_del(&SG(known_post_content_types), post_entry->content_type,
- post_entry->content_type_len+1);
+ zend_hash_str_del(&SG(known_post_content_types), post_entry->content_type,
+ post_entry->content_type_len);
}
diff --git a/main/SAPI.h b/main/SAPI.h
index 71942f5663..c1b30fed74 100644
--- a/main/SAPI.h
+++ b/main/SAPI.h
@@ -132,7 +132,7 @@ typedef struct _sapi_globals_struct {
zend_bool sapi_started;
double global_request_time;
HashTable known_post_content_types;
- zval *callback_func;
+ zval callback_func;
zend_fcall_info_cache fci_cache;
zend_bool callback_run;
} sapi_globals_struct;
diff --git a/main/fopen_wrappers.c b/main/fopen_wrappers.c
index 3be7b5f206..ad2e8a8d14 100644
--- a/main/fopen_wrappers.c
+++ b/main/fopen_wrappers.c
@@ -433,13 +433,15 @@ PHPAPI int php_fopen_primary_script(zend_file_handle *file_handle TSRMLS_DC)
if (!resolved_path) {
if (SG(request_info).path_translated != filename) {
- STR_FREE(filename);
+//??? STR_FREE(filename);
+ if (filename) efree(filename);
}
/* we have to free SG(request_info).path_translated here because
* php_destroy_request_info assumes that it will get
* freed when the include_names hash is emptied, but
* we're not adding it in this case */
- STR_FREE(SG(request_info).path_translated);
+//??? STR_FREE(SG(request_info).path_translated);
+ if (SG(request_info).path_translated) efree(SG(request_info).path_translated);
SG(request_info).path_translated = NULL;
return FAILURE;
}
@@ -450,16 +452,19 @@ PHPAPI int php_fopen_primary_script(zend_file_handle *file_handle TSRMLS_DC)
if (zend_stream_open(filename, file_handle TSRMLS_CC) == FAILURE) {
PG(display_errors) = orig_display_errors;
if (SG(request_info).path_translated != filename) {
- STR_FREE(filename);
+//??? STR_FREE(filename);
+ if (filename) efree(filename);
}
- STR_FREE(SG(request_info).path_translated); /* for same reason as above */
+//??? STR_FREE(SG(request_info).path_translated); /* for same reason as above */
+ if (SG(request_info).path_translated) efree(SG(request_info).path_translated);
SG(request_info).path_translated = NULL;
return FAILURE;
}
PG(display_errors) = orig_display_errors;
if (SG(request_info).path_translated != filename) {
- STR_FREE(SG(request_info).path_translated); /* for same reason as above */
+//??? STR_FREE(SG(request_info).path_translated); /* for same reason as above */
+ if (SG(request_info).path_translated) efree(SG(request_info).path_translated);
SG(request_info).path_translated = filename;
}
diff --git a/main/main.c b/main/main.c
index ebb158ac7c..12587d9162 100644
--- a/main/main.c
+++ b/main/main.c
@@ -853,15 +853,14 @@ PHPAPI void php_verror(const char *docref, const char *params, int type, const c
}
if (PG(track_errors) && module_initialized &&
- (!EG(user_error_handler) || !(EG(user_error_handler_error_reporting) & type))) {
+ (Z_TYPE(EG(user_error_handler)) == IS_UNDEF || !(EG(user_error_handler_error_reporting) & type))) {
if (!EG(active_symbol_table)) {
zend_rebuild_symbol_table(TSRMLS_C);
}
if (EG(active_symbol_table)) {
- zval *tmp;
- ALLOC_INIT_ZVAL(tmp);
- ZVAL_STRINGL(tmp, buffer, buffer_len, 1);
- zend_hash_update(EG(active_symbol_table), "php_errormsg", sizeof("php_errormsg"), (void **) &tmp, sizeof(zval *), NULL);
+ zval tmp;
+ ZVAL_STRINGL(&tmp, buffer, buffer_len);
+ zend_hash_str_update(EG(active_symbol_table), "php_errormsg", sizeof("php_errormsg")-1, &tmp);
}
}
efree(buffer);
@@ -1188,10 +1187,9 @@ static void php_error_cb(int type, const char *error_filename, const uint error_
zend_rebuild_symbol_table(TSRMLS_C);
}
if (EG(active_symbol_table)) {
- zval *tmp;
- ALLOC_INIT_ZVAL(tmp);
- ZVAL_STRINGL(tmp, buffer, buffer_len, 1);
- zend_hash_update(EG(active_symbol_table), "php_errormsg", sizeof("php_errormsg"), (void **) & tmp, sizeof(zval *), NULL);
+ zval tmp;
+ ZVAL_STRINGL(&tmp, buffer, buffer_len);
+ zend_hash_str_update(EG(active_symbol_table), "php_errormsg", sizeof("php_errormsg")-1, &tmp);
}
}
@@ -1269,6 +1267,7 @@ PHP_FUNCTION(set_time_limit)
long new_timeout;
char *new_timeout_str;
int new_timeout_strlen;
+ zend_string *key;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &new_timeout) == FAILURE) {
return;
@@ -1276,11 +1275,13 @@ PHP_FUNCTION(set_time_limit)
new_timeout_strlen = zend_spprintf(&new_timeout_str, 0, "%ld", new_timeout);
- if (zend_alter_ini_entry_ex("max_execution_time", sizeof("max_execution_time"), new_timeout_str, new_timeout_strlen, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC) == SUCCESS) {
+ key = STR_INIT("max_execution_time", sizeof("max_execution_time")-1, 0);
+ if (zend_alter_ini_entry_ex(key, new_timeout_str, new_timeout_strlen, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC) == SUCCESS) {
RETVAL_TRUE;
} else {
RETVAL_FALSE;
}
+ STR_FREE(key);
efree(new_timeout_str);
}
/* }}} */
@@ -1576,11 +1577,10 @@ int php_request_startup(TSRMLS_D)
}
if (PG(output_handler) && PG(output_handler)[0]) {
- zval *oh;
+ zval oh;
- MAKE_STD_ZVAL(oh);
- ZVAL_STRING(oh, PG(output_handler), 1);
- php_output_start_user(oh, 0, PHP_OUTPUT_HANDLER_STDFLAGS TSRMLS_CC);
+ ZVAL_STRING(&oh, PG(output_handler));
+ php_output_start_user(&oh, 0, PHP_OUTPUT_HANDLER_STDFLAGS TSRMLS_CC);
zval_ptr_dtor(&oh);
} else if (PG(output_buffering)) {
php_output_start_user(NULL, PG(output_buffering) > 1 ? PG(output_buffering) : 0, PHP_OUTPUT_HANDLER_STDFLAGS TSRMLS_CC);
@@ -1691,9 +1691,7 @@ void php_request_shutdown_for_hook(void *dummy)
int i;
for (i = 0; i < NUM_TRACK_VARS; i++) {
- if (PG(http_globals)[i]) {
- zval_ptr_dtor(&PG(http_globals)[i]);
- }
+ zval_ptr_dtor(&PG(http_globals)[i]);
}
} zend_end_try();
@@ -1787,9 +1785,7 @@ void php_request_shutdown(void *dummy)
int i;
for (i=0; i<NUM_TRACK_VARS; i++) {
- if (PG(http_globals)[i]) {
- zval_ptr_dtor(&PG(http_globals)[i]);
- }
+ zval_ptr_dtor(&PG(http_globals)[i]);
}
} zend_end_try();
@@ -2237,7 +2233,7 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
/* register additional functions */
if (sapi_module.additional_functions) {
- if (zend_hash_find(&module_registry, "standard", sizeof("standard"), (void**)&module)==SUCCESS) {
+ if ((module = zend_hash_str_find_ptr(&module_registry, "standard", sizeof("standard")-1)) != NULL) {
EG(current_module) = module;
zend_register_functions(NULL, sapi_module.additional_functions, NULL, MODULE_PERSISTENT TSRMLS_CC);
EG(current_module) = NULL;
@@ -2249,7 +2245,7 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
php_disable_classes(TSRMLS_C);
/* make core report what it should */
- if (zend_hash_find(&module_registry, "core", sizeof("core"), (void**)&module)==SUCCESS) {
+ if ((module = zend_hash_str_find_ptr(&module_registry, "core", sizeof("core")-1)) != NULL) {
module->version = PHP_VERSION;
module->info_func = PHP_MINFO(php_core);
}
@@ -2470,11 +2466,10 @@ PHPAPI int php_execute_script(zend_file_handle *primary_file TSRMLS_DC)
primary_file->type != ZEND_HANDLE_FILENAME
) {
int realfile_len;
- int dummy = 1;
if (expand_filepath(primary_file->filename, realfile TSRMLS_CC)) {
realfile_len = strlen(realfile);
- zend_hash_add(&EG(included_files), realfile, realfile_len+1, (void *)&dummy, sizeof(int), NULL);
+ zend_hash_str_add_empty_element(&EG(included_files), realfile, realfile_len);
primary_file->opened_path = estrndup(realfile, realfile_len);
}
}
@@ -2525,7 +2520,7 @@ PHPAPI int php_execute_script(zend_file_handle *primary_file TSRMLS_DC)
/* {{{ php_execute_simple_script
*/
-PHPAPI int php_execute_simple_script(zend_file_handle *primary_file, zval **ret TSRMLS_DC)
+PHPAPI int php_execute_simple_script(zend_file_handle *primary_file, zval *ret TSRMLS_DC)
{
char *old_cwd;
ALLOCA_FLAG(use_heap)
diff --git a/main/network.c b/main/network.c
index fc2a94badd..13ed727923 100644
--- a/main/network.c
+++ b/main/network.c
@@ -555,7 +555,8 @@ PHPAPI int php_network_parse_network_address_with_port(const char *addr, long ad
if (n == 0) {
if (errstr) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to resolve `%s': %s", tmp, errstr);
- STR_FREE(errstr);
+//??? STR_FREE(errstr);
+ efree(errstr);
}
goto out;
}
@@ -581,7 +582,8 @@ PHPAPI int php_network_parse_network_address_with_port(const char *addr, long ad
php_network_freeaddresses(psal);
out:
- STR_FREE(tmp);
+//??? STR_FREE(tmp);
+ efree(tmp);
return ret;
}
diff --git a/main/output.c b/main/output.c
index 72092e9561..24c65f7fdd 100644
--- a/main/output.c
+++ b/main/output.c
@@ -109,7 +109,7 @@ static void php_output_header(TSRMLS_D)
if (!SG(headers_sent)) {
if (!OG(output_start_filename)) {
if (zend_is_compiling(TSRMLS_C)) {
- OG(output_start_filename) = zend_get_compiled_filename(TSRMLS_C);
+ OG(output_start_filename) = zend_get_compiled_filename(TSRMLS_C)->val;
OG(output_start_lineno) = zend_get_compiled_lineno(TSRMLS_C);
} else if (zend_is_executing(TSRMLS_C)) {
OG(output_start_filename) = zend_get_executed_filename(TSRMLS_C);
@@ -126,6 +126,12 @@ static void php_output_header(TSRMLS_D)
}
/* }}} */
+static void reverse_conflict_dtor(zval *zv)
+{
+ HashTable *ht = Z_PTR_P(zv);
+ zend_hash_destroy(ht);
+}
+
/* {{{ void php_output_startup(void)
* Set up module globals and initalize the conflict and reverse conflict hash tables */
PHPAPI void php_output_startup(void)
@@ -133,7 +139,7 @@ PHPAPI void php_output_startup(void)
ZEND_INIT_MODULE_GLOBALS(output, php_output_init_globals, NULL);
zend_hash_init(&php_output_handler_aliases, 0, NULL, NULL, 1);
zend_hash_init(&php_output_handler_conflicts, 0, NULL, NULL, 1);
- zend_hash_init(&php_output_handler_reverse_conflicts, 0, NULL, (void (*)(void *)) zend_hash_destroy, 1);
+ zend_hash_init(&php_output_handler_reverse_conflicts, 0, NULL, reverse_conflict_dtor, 1);
php_output_direct = php_output_stdout;
}
/* }}} */
@@ -371,7 +377,7 @@ PHPAPI int php_output_get_level(TSRMLS_D)
PHPAPI int php_output_get_contents(zval *p TSRMLS_DC)
{
if (OG(active)) {
- ZVAL_STRINGL(p, OG(active)->buffer.data, OG(active)->buffer.used, 1);
+ ZVAL_STRINGL(p, OG(active)->buffer.data, OG(active)->buffer.used);
return SUCCESS;
} else {
ZVAL_NULL(p);
@@ -472,7 +478,7 @@ PHPAPI php_output_handler *php_output_handler_create_user(zval *output_handler,
{
char *handler_name = NULL, *error = NULL;
php_output_handler *handler = NULL;
- php_output_handler_alias_ctor_t *alias = NULL;
+ php_output_handler_alias_ctor_t alias = NULL;
php_output_handler_user_func_t *user = NULL;
switch (Z_TYPE_P(output_handler)) {
@@ -481,7 +487,7 @@ PHPAPI php_output_handler *php_output_handler_create_user(zval *output_handler,
break;
case IS_STRING:
if (Z_STRLEN_P(output_handler) && (alias = php_output_handler_alias(Z_STRVAL_P(output_handler), Z_STRLEN_P(output_handler) TSRMLS_CC))) {
- handler = (*alias)(Z_STRVAL_P(output_handler), Z_STRLEN_P(output_handler), chunk_size, flags TSRMLS_CC);
+ handler = alias(Z_STRVAL_P(output_handler), Z_STRLEN_P(output_handler), chunk_size, flags TSRMLS_CC);
break;
}
default:
@@ -538,22 +544,22 @@ PHPAPI int php_output_handler_start(php_output_handler *handler TSRMLS_DC)
{
HashPosition pos;
HashTable *rconflicts;
- php_output_handler_conflict_check_t *conflict;
+ php_output_handler_conflict_check_t conflict;
if (php_output_lock_error(PHP_OUTPUT_HANDLER_START TSRMLS_CC) || !handler) {
return FAILURE;
}
- if (SUCCESS == zend_hash_find(&php_output_handler_conflicts, handler->name, handler->name_len+1, (void *) &conflict)) {
- if (SUCCESS != (*conflict)(handler->name, handler->name_len TSRMLS_CC)) {
+ if (NULL != (conflict = zend_hash_str_find_ptr(&php_output_handler_conflicts, handler->name, handler->name_len))) {
+ if (SUCCESS != conflict(handler->name, handler->name_len TSRMLS_CC)) {
return FAILURE;
}
}
- if (SUCCESS == zend_hash_find(&php_output_handler_reverse_conflicts, handler->name, handler->name_len+1, (void *) &rconflicts)) {
+ if (NULL != (rconflicts = zend_hash_str_find_ptr(&php_output_handler_reverse_conflicts, handler->name, handler->name_len))) {
for (zend_hash_internal_pointer_reset_ex(rconflicts, &pos);
- zend_hash_get_current_data_ex(rconflicts, (void *) &conflict, &pos) == SUCCESS;
+ (conflict = zend_hash_get_current_data_ptr_ex(rconflicts, &pos)) != NULL;
zend_hash_move_forward_ex(rconflicts, &pos)
) {
- if (SUCCESS != (*conflict)(handler->name, handler->name_len TSRMLS_CC)) {
+ if (SUCCESS != conflict(handler->name, handler->name_len TSRMLS_CC)) {
return FAILURE;
}
}
@@ -612,7 +618,7 @@ PHPAPI int php_output_handler_conflict_register(const char *name, size_t name_le
zend_error(E_ERROR, "Cannot register an output handler conflict outside of MINIT");
return FAILURE;
}
- return zend_hash_update(&php_output_handler_conflicts, name, name_len+1, &check_func, sizeof(php_output_handler_conflict_check_t *), NULL);
+ return zend_hash_str_update_ptr(&php_output_handler_conflicts, name, name_len, check_func) ? SUCCESS : FAILURE;
}
/* }}} */
@@ -627,15 +633,15 @@ PHPAPI int php_output_handler_reverse_conflict_register(const char *name, size_t
return FAILURE;
}
- if (SUCCESS == zend_hash_find(&php_output_handler_reverse_conflicts, name, name_len+1, (void *) &rev_ptr)) {
- return zend_hash_next_index_insert(rev_ptr, &check_func, sizeof(php_output_handler_conflict_check_t *), NULL);
+ if (SUCCESS == (rev_ptr = zend_hash_str_find_ptr(&php_output_handler_reverse_conflicts, name, name_len))) {
+ return zend_hash_next_index_insert_ptr(rev_ptr, check_func) ? SUCCESS : FAILURE;
} else {
zend_hash_init(&rev, 1, NULL, NULL, 1);
- if (SUCCESS != zend_hash_next_index_insert(&rev, &check_func, sizeof(php_output_handler_conflict_check_t *), NULL)) {
+ if (SUCCESS != zend_hash_next_index_insert_ptr(&rev, check_func)) {
zend_hash_destroy(&rev);
return FAILURE;
}
- if (SUCCESS != zend_hash_update(&php_output_handler_reverse_conflicts, name, name_len+1, &rev, sizeof(HashTable), NULL)) {
+ if (SUCCESS != zend_hash_str_update_mem(&php_output_handler_reverse_conflicts, name, name_len+1, &rev, sizeof(HashTable))) {
zend_hash_destroy(&rev);
return FAILURE;
}
@@ -646,12 +652,9 @@ PHPAPI int php_output_handler_reverse_conflict_register(const char *name, size_t
/* {{{ php_output_handler_alias_ctor_t php_output_handler_alias(zval *name TSRMLS_DC)
* Get an internal output handler for a user handler if it exists */
-PHPAPI php_output_handler_alias_ctor_t *php_output_handler_alias(const char *name, size_t name_len TSRMLS_DC)
+PHPAPI php_output_handler_alias_ctor_t php_output_handler_alias(const char *name, size_t name_len TSRMLS_DC)
{
- php_output_handler_alias_ctor_t *func = NULL;
-
- zend_hash_find(&php_output_handler_aliases, name, name_len+1, (void *) &func);
- return func;
+ return zend_hash_str_find_ptr(&php_output_handler_aliases, name, name_len);
}
/* }}} */
@@ -663,7 +666,7 @@ PHPAPI int php_output_handler_alias_register(const char *name, size_t name_len,
zend_error(E_ERROR, "Cannot register an output handler alias outside of MINIT");
return FAILURE;
}
- return zend_hash_update(&php_output_handler_aliases, name, name_len+1, &func, sizeof(php_output_handler_alias_ctor_t *), NULL);
+ return zend_hash_str_update_ptr(&php_output_handler_aliases, name, name_len, func) ? SUCCESS : FAILURE;
}
/* }}} */
@@ -700,10 +703,12 @@ PHPAPI int php_output_handler_hook(php_output_handler_hook_t type, void *arg TSR
* Destroy an output handler */
PHPAPI void php_output_handler_dtor(php_output_handler *handler TSRMLS_DC)
{
- STR_FREE(handler->name);
- STR_FREE(handler->buffer.data);
+//??? STR_FREE(handler->name);
+ if (handler->name) efree(handler->name);
+//??? STR_FREE(handler->buffer.data);
+ if (handler->buffer.data) efree(handler->buffer.data);
if (handler->flags & PHP_OUTPUT_HANDLER_USER) {
- zval_ptr_dtor(&handler->func.user->zoh);
+ zval_ptr_dtor(handler->func.user->zoh);
efree(handler->func.user);
}
if (handler->dtor && handler->opaq) {
@@ -950,23 +955,21 @@ static inline php_output_handler_status_t php_output_handler_op(php_output_handl
OG(running) = handler;
if (handler->flags & PHP_OUTPUT_HANDLER_USER) {
- zval *retval = NULL, *ob_data, *ob_mode;
+ zval retval, ob_data, ob_mode;
- MAKE_STD_ZVAL(ob_data);
- ZVAL_STRINGL(ob_data, handler->buffer.data, handler->buffer.used, 1);
- MAKE_STD_ZVAL(ob_mode);
- ZVAL_LONG(ob_mode, (long) context->op);
+ ZVAL_STRINGL(&ob_data, handler->buffer.data, handler->buffer.used);
+ ZVAL_LONG(&ob_mode, (long) context->op);
zend_fcall_info_argn(&handler->func.user->fci TSRMLS_CC, 2, &ob_data, &ob_mode);
-#define PHP_OUTPUT_USER_SUCCESS(retval) (retval && !(Z_TYPE_P(retval) == IS_BOOL && Z_BVAL_P(retval)==0))
+#define PHP_OUTPUT_USER_SUCCESS(retval) ((Z_TYPE(retval) != IS_UNDEF) && !(Z_TYPE(retval) == IS_BOOL && Z_BVAL(retval)==0))
if (SUCCESS == zend_fcall_info_call(&handler->func.user->fci, &handler->func.user->fcc, &retval, NULL TSRMLS_CC) && PHP_OUTPUT_USER_SUCCESS(retval)) {
/* user handler may have returned TRUE */
status = PHP_OUTPUT_HANDLER_NO_DATA;
- if (Z_TYPE_P(retval) != IS_BOOL) {
+ if (Z_TYPE(retval) != IS_BOOL) {
convert_to_string_ex(&retval);
- if (Z_STRLEN_P(retval)) {
- context->out.data = estrndup(Z_STRVAL_P(retval), Z_STRLEN_P(retval));
- context->out.used = Z_STRLEN_P(retval);
+ if (Z_STRLEN(retval)) {
+ context->out.data = estrndup(Z_STRVAL(retval), Z_STRLEN(retval));
+ context->out.used = Z_STRLEN(retval);
context->out.free = 1;
status = PHP_OUTPUT_HANDLER_SUCCESS;
}
@@ -979,9 +982,7 @@ static inline php_output_handler_status_t php_output_handler_op(php_output_handl
zend_fcall_info_argn(&handler->func.user->fci TSRMLS_CC, 0);
zval_ptr_dtor(&ob_data);
zval_ptr_dtor(&ob_mode);
- if (retval) {
- zval_ptr_dtor(&retval);
- }
+ zval_ptr_dtor(&retval);
} else {
@@ -1179,11 +1180,9 @@ static int php_output_stack_apply_status(void *h, void *z)
* Returns an array with the status of the output handler */
static inline zval *php_output_handler_status(php_output_handler *handler, zval *entry)
{
- if (!entry) {
- MAKE_STD_ZVAL(entry);
- array_init(entry);
- }
+ ZEND_ASSERT(entry != NULL);
+ array_init(entry);
add_assoc_stringl(entry, "name", handler->name, handler->name_len, 1);
add_assoc_long(entry, "type", (long) (handler->flags & 0xf));
add_assoc_long(entry, "flags", (long) handler->flags);
diff --git a/main/php_globals.h b/main/php_globals.h
index b8f64d6d31..4bf80d34d6 100644
--- a/main/php_globals.h
+++ b/main/php_globals.h
@@ -109,7 +109,7 @@ struct _php_core_globals {
zend_llist tick_functions;
- zval *http_globals[6];
+ zval http_globals[6];
zend_bool expose_php;
diff --git a/main/php_ini.c b/main/php_ini.c
index 3bcb249f84..118743fba3 100644
--- a/main/php_ini.c
+++ b/main/php_ini.c
@@ -237,14 +237,14 @@ static void php_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callback_t
/* All other entries are added into either configuration_hash or active ini section array */
} else {
/* Store in active hash */
- zend_hash_update(active_hash, Z_STRVAL_P(arg1), Z_STRLEN_P(arg1) + 1, arg2, sizeof(zval), (void **) &entry);
- Z_STRVAL_P(entry) = zend_strndup(Z_STRVAL_P(entry), Z_STRLEN_P(entry));
+ entry = zend_hash_update(active_hash, Z_STR_P(arg1), arg2);
+ Z_STR_P(entry) = STR_DUP(Z_STR_P(entry), 1);
}
}
break;
case ZEND_INI_PARSER_POP_ENTRY: {
- zval *option_arr;
+ zval option_arr;
zval *find_arr;
if (!arg2) {
@@ -255,23 +255,19 @@ static void php_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callback_t
/* fprintf(stdout, "ZEND_INI_PARSER_POP_ENTRY: %s[%s] = %s\n",Z_STRVAL_P(arg1), Z_STRVAL_P(arg3), Z_STRVAL_P(arg2)); */
/* If option not found in hash or is not an array -> create array, otherwise add to existing array */
- if (zend_hash_find(active_hash, Z_STRVAL_P(arg1), Z_STRLEN_P(arg1) + 1, (void **) &find_arr) == FAILURE || Z_TYPE_P(find_arr) != IS_ARRAY) {
- option_arr = (zval *) pemalloc(sizeof(zval), 1);
- INIT_PZVAL(option_arr);
- Z_TYPE_P(option_arr) = IS_ARRAY;
- Z_ARRVAL_P(option_arr) = (HashTable *) pemalloc(sizeof(HashTable), 1);
- zend_hash_init(Z_ARRVAL_P(option_arr), 0, NULL, (dtor_func_t) config_zval_dtor, 1);
- zend_hash_update(active_hash, Z_STRVAL_P(arg1), Z_STRLEN_P(arg1) + 1, option_arr, sizeof(zval), (void **) &find_arr);
- free(option_arr);
+ if ((find_arr = zend_hash_find(active_hash, Z_STR_P(arg1))) == NULL || Z_TYPE_P(find_arr) != IS_ARRAY) {
+ ZVAL_NEW_PERSISTENT_ARR(&option_arr);
+ zend_hash_init(Z_ARRVAL(option_arr), 0, NULL, (dtor_func_t) config_zval_dtor, 1);
+ find_arr = zend_hash_update(active_hash, Z_STR_P(arg1), &option_arr);
}
/* arg3 is possible option offset name */
if (arg3 && Z_STRLEN_P(arg3) > 0) {
- zend_symtable_update(Z_ARRVAL_P(find_arr), Z_STRVAL_P(arg3), Z_STRLEN_P(arg3) + 1, arg2, sizeof(zval), (void **) &entry);
+ entry = zend_symtable_update(Z_ARRVAL_P(find_arr), Z_STR_P(arg3), arg2);
} else {
- zend_hash_next_index_insert(Z_ARRVAL_P(find_arr), arg2, sizeof(zval), (void **) &entry);
+ entry = zend_hash_next_index_insert(Z_ARRVAL_P(find_arr), arg2);
}
- Z_STRVAL_P(entry) = zend_strndup(Z_STRVAL_P(entry), Z_STRLEN_P(entry));
+ Z_STR_P(entry) = STR_DUP(Z_STR_P(entry), 1);
}
break;
@@ -324,16 +320,12 @@ static void php_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callback_t
}
/* Search for existing entry and if it does not exist create one */
- if (zend_hash_find(target_hash, key, key_len + 1, (void **) &entry) == FAILURE) {
- zval *section_arr;
-
- section_arr = (zval *) pemalloc(sizeof(zval), 1);
- INIT_PZVAL(section_arr);
- Z_TYPE_P(section_arr) = IS_ARRAY;
- Z_ARRVAL_P(section_arr) = (HashTable *) pemalloc(sizeof(HashTable), 1);
- zend_hash_init(Z_ARRVAL_P(section_arr), 0, NULL, (dtor_func_t) config_zval_dtor, 1);
- zend_hash_update(target_hash, key, key_len + 1, section_arr, sizeof(zval), (void **) &entry);
- free(section_arr);
+ if ((entry = zend_hash_str_find(target_hash, key, key_len)) == NULL) {
+ zval section_arr;
+
+ ZVAL_NEW_PERSISTENT_ARR(&section_arr);
+ zend_hash_init(Z_ARRVAL(section_arr), 0, NULL, (dtor_func_t) config_zval_dtor, 1);
+ entry = zend_hash_str_update(target_hash, key, key_len, &section_arr);
}
active_ini_hash = Z_ARRVAL_P(entry);
}
@@ -598,12 +590,10 @@ int php_init_config(TSRMLS_D)
{
zval tmp;
- Z_STRLEN(tmp) = strlen(fh.filename);
- Z_STRVAL(tmp) = zend_strndup(fh.filename, Z_STRLEN(tmp));
- Z_TYPE(tmp) = IS_STRING;
+ ZVAL_STR(&tmp, STR_INIT(fh.filename, strlen(fh.filename), 1));
Z_SET_REFCOUNT(tmp, 0);
- zend_hash_update(&configuration_hash, "cfg_file_path", sizeof("cfg_file_path"), (void *) &tmp, sizeof(zval), NULL);
+ zend_hash_str_update(&configuration_hash, "cfg_file_path", sizeof("cfg_file_path")-1, &tmp);
if (php_ini_opened_path) {
efree(php_ini_opened_path);
}
@@ -767,18 +757,17 @@ PHPAPI int php_parse_user_ini_file(const char *dirname, char *ini_filename, Hash
*/
PHPAPI void php_ini_activate_config(HashTable *source_hash, int modify_type, int stage TSRMLS_DC)
{
- char *str;
+ zend_string *str;
zval *data;
- uint str_len;
ulong num_index;
/* Walk through config hash and alter matching ini entries using the values found in the hash */
for (zend_hash_internal_pointer_reset(source_hash);
- zend_hash_get_current_key_ex(source_hash, &str, &str_len, &num_index, 0, NULL) == HASH_KEY_IS_STRING;
+ zend_hash_get_current_key_ex(source_hash, &str, &num_index, 0, NULL) == HASH_KEY_IS_STRING;
zend_hash_move_forward(source_hash)
) {
- zend_hash_get_current_data(source_hash, (void **) &data);
- zend_alter_ini_entry_ex(str, str_len, Z_STRVAL_P(data), Z_STRLEN_P(data), modify_type, stage, 0 TSRMLS_CC);
+ data = zend_hash_get_current_data(source_hash);
+ zend_alter_ini_entry_ex(str, Z_STRVAL_P(data), Z_STRLEN_P(data), modify_type, stage, 0 TSRMLS_CC);
}
}
/* }}} */
@@ -824,7 +813,7 @@ PHPAPI void php_ini_activate_per_dir_config(char *path, uint path_len TSRMLS_DC)
while ((ptr = strchr(ptr, '/')) != NULL) {
*ptr = 0;
/* Search for source array matching the path from configuration_hash */
- if (zend_hash_find(&configuration_hash, path, strlen(path) + 1, (void **) &tmp2) == SUCCESS) {
+ if ((tmp2 = zend_hash_str_find(&configuration_hash, path, strlen(path))) != NULL) {
php_ini_activate_config(Z_ARRVAL_P(tmp2), PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE TSRMLS_CC);
}
*ptr = '/';
@@ -850,7 +839,8 @@ PHPAPI void php_ini_activate_per_host_config(const char *host, uint host_len TSR
if (has_per_host_config && host && host_len) {
/* Search for source array matching the host from configuration_hash */
- if (zend_hash_find(&configuration_hash, host, host_len, (void **) &tmp) == SUCCESS) {
+//??? remove -1
+ if ((tmp = zend_hash_str_find(&configuration_hash, host, host_len-1)) != NULL) {
php_ini_activate_config(Z_ARRVAL_P(tmp), PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE TSRMLS_CC);
}
}
@@ -861,13 +851,8 @@ PHPAPI void php_ini_activate_per_host_config(const char *host, uint host_len TSR
*/
PHPAPI zval *cfg_get_entry(const char *name, uint name_length)
{
- zval *tmp;
-
- if (zend_hash_find(&configuration_hash, name, name_length, (void **) &tmp) == SUCCESS) {
- return tmp;
- } else {
- return NULL;
- }
+//??? remove -1
+ return zend_hash_str_find(&configuration_hash, name, name_length-1);
}
/* }}} */
@@ -877,12 +862,11 @@ PHPAPI int cfg_get_long(const char *varname, long *result)
{
zval *tmp, var;
- if (zend_hash_find(&configuration_hash, varname, strlen(varname) + 1, (void **) &tmp) == FAILURE) {
+ if ((tmp = zend_hash_str_find(&configuration_hash, varname, strlen(varname))) == NULL) {
*result = 0;
return FAILURE;
}
- var = *tmp;
- zval_copy_ctor(&var);
+ ZVAL_DUP(&var, tmp);
convert_to_long(&var);
*result = Z_LVAL(var);
return SUCCESS;
@@ -895,12 +879,11 @@ PHPAPI int cfg_get_double(const char *varname, double *result)
{
zval *tmp, var;
- if (zend_hash_find(&configuration_hash, varname, strlen(varname) + 1, (void **) &tmp) == FAILURE) {
+ if ((tmp = zend_hash_str_find(&configuration_hash, varname, strlen(varname))) == NULL) {
*result = (double) 0;
return FAILURE;
}
- var = *tmp;
- zval_copy_ctor(&var);
+ ZVAL_DUP(&var, tmp);
convert_to_double(&var);
*result = Z_DVAL(var);
return SUCCESS;
@@ -913,7 +896,7 @@ PHPAPI int cfg_get_string(const char *varname, char **result)
{
zval *tmp;
- if (zend_hash_find(&configuration_hash, varname, strlen(varname)+1, (void **) &tmp) == FAILURE) {
+ if ((tmp = zend_hash_str_find(&configuration_hash, varname, strlen(varname))) == NULL) {
*result = NULL;
return FAILURE;
}
diff --git a/main/php_main.h b/main/php_main.h
index 1325486bd9..92dafde4d8 100644
--- a/main/php_main.h
+++ b/main/php_main.h
@@ -40,7 +40,7 @@ PHPAPI void php_request_shutdown_for_hook(void *dummy);
PHPAPI int php_register_extensions(zend_module_entry **ptr, int count TSRMLS_DC);
PHPAPI int php_execute_script(zend_file_handle *primary_file TSRMLS_DC);
-PHPAPI int php_execute_simple_script(zend_file_handle *primary_file, zval **ret TSRMLS_DC);
+PHPAPI int php_execute_simple_script(zend_file_handle *primary_file, zval *ret TSRMLS_DC);
PHPAPI int php_handle_special_queries(TSRMLS_D);
PHPAPI int php_lint_script(zend_file_handle *file TSRMLS_DC);
diff --git a/main/php_output.h b/main/php_output.h
index 0312e256f8..e61b59b95a 100644
--- a/main/php_output.h
+++ b/main/php_output.h
@@ -244,7 +244,7 @@ PHPAPI int php_output_handler_conflict(const char *handler_new, size_t handler_n
PHPAPI int php_output_handler_conflict_register(const char *handler_name, size_t handler_name_len, php_output_handler_conflict_check_t check_func TSRMLS_DC);
PHPAPI int php_output_handler_reverse_conflict_register(const char *handler_name, size_t handler_name_len, php_output_handler_conflict_check_t check_func TSRMLS_DC);
-PHPAPI php_output_handler_alias_ctor_t *php_output_handler_alias(const char *handler_name, size_t handler_name_len TSRMLS_DC);
+PHPAPI php_output_handler_alias_ctor_t php_output_handler_alias(const char *handler_name, size_t handler_name_len TSRMLS_DC);
PHPAPI int php_output_handler_alias_register(const char *handler_name, size_t handler_name_len, php_output_handler_alias_ctor_t func TSRMLS_DC);
END_EXTERN_C()
diff --git a/main/php_streams.h b/main/php_streams.h
index aa4c05c54f..f3e887fade 100644
--- a/main/php_streams.h
+++ b/main/php_streams.h
@@ -191,12 +191,12 @@ struct _php_stream {
php_stream_wrapper *wrapper; /* which wrapper was used to open the stream */
void *wrapperthis; /* convenience pointer for a instance of a wrapper */
- zval *wrapperdata; /* fgetwrapperdata retrieves this */
+ zval wrapperdata; /* fgetwrapperdata retrieves this */
int fgetss_state; /* for fgetss to handle multiline tags */
int is_persistent;
char mode[16]; /* "rwb" etc. ala stdio */
- int rsrc_id; /* used for auto-cleanup */
+ zend_resource *res; /* used for auto-cleanup */
int in_free; /* to prevent recursion during free */
/* so we know how to clean it up correctly. This should be set to
* PHP_STREAM_FCLOSE_XXX as appropriate */
@@ -242,17 +242,17 @@ PHPAPI php_stream *_php_stream_alloc(php_stream_ops *ops, void *abstract,
END_EXTERN_C()
#define php_stream_alloc(ops, thisptr, persistent_id, mode) _php_stream_alloc((ops), (thisptr), (persistent_id), (mode) STREAMS_CC TSRMLS_CC)
-#define php_stream_get_resource_id(stream) ((php_stream *)(stream))->rsrc_id
+#define php_stream_get_resource_id(stream) ((php_stream *)(stream))->res->handle
#if ZEND_DEBUG
/* use this to tell the stream that it is OK if we don't explicitly close it */
# define php_stream_auto_cleanup(stream) { (stream)->__exposed++; }
/* use this to assign the stream to a zval and tell the stream that is
* has been exported to the engine; it will expect to be closed automatically
* when the resources are auto-destructed */
-# define php_stream_to_zval(stream, zval) { ZVAL_RESOURCE(zval, (stream)->rsrc_id); (stream)->__exposed++; }
+# define php_stream_to_zval(stream, zval) { ZVAL_RESOURCE(zval, (stream)->res); (stream)->__exposed++; }
#else
# define php_stream_auto_cleanup(stream) /* nothing */
-# define php_stream_to_zval(stream, zval) { ZVAL_RESOURCE(zval, (stream)->rsrc_id); }
+# define php_stream_to_zval(stream, zval) { ZVAL_RESOURCE(zval, (stream)->res); }
#endif
#define php_stream_from_zval(xstr, ppzval) ZEND_FETCH_RESOURCE2((xstr), php_stream *, (ppzval), -1, "stream", php_file_le_stream(), php_file_le_pstream())
diff --git a/main/php_variables.c b/main/php_variables.c
index 38cf043839..b3d2b17763 100644
--- a/main/php_variables.c
+++ b/main/php_variables.c
@@ -49,10 +49,7 @@ PHPAPI void php_register_variable_safe(char *var, char *strval, int str_len, zva
assert(strval != NULL);
/* Prepare value */
- Z_STRLEN(new_entry) = str_len;
- Z_STRVAL(new_entry) = estrndup(strval, Z_STRLEN(new_entry));
- Z_TYPE(new_entry) = IS_STRING;
-
+ ZVAL_STR(&new_entry, STR_INIT(strval, str_len, 0));
php_register_variable_ex(var, &new_entry, track_vars_array TSRMLS_CC);
}
@@ -63,7 +60,7 @@ PHPAPI void php_register_variable_ex(char *var_name, zval *val, zval *track_vars
char *index;
char *var, *var_orig;
int var_len, index_len;
- zval *gpc_element, **gpc_element_p;
+ zval gpc_element, *gpc_element_p;
zend_bool is_array = 0;
HashTable *symtable1 = NULL;
ALLOCA_FLAG(use_heap)
@@ -136,7 +133,7 @@ PHPAPI void php_register_variable_ex(char *var_name, zval *val, zval *track_vars
if (track_vars_array) {
ht = Z_ARRVAL_P(track_vars_array);
- zend_symtable_del(ht, var, var_len + 1);
+ zend_symtable_str_del(ht, var, var_len);
}
zval_dtor(val);
@@ -175,23 +172,21 @@ PHPAPI void php_register_variable_ex(char *var_name, zval *val, zval *track_vars
}
if (!index) {
- MAKE_STD_ZVAL(gpc_element);
- array_init(gpc_element);
- if (zend_hash_next_index_insert(symtable1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p) == FAILURE) {
+ array_init(&gpc_element);
+ if ((gpc_element_p = zend_hash_next_index_insert(symtable1, &gpc_element)) == NULL) {
zval_ptr_dtor(&gpc_element);
zval_dtor(val);
free_alloca(var_orig, use_heap);
return;
}
} else {
- if (zend_symtable_find(symtable1, index, index_len + 1, (void **) &gpc_element_p) == FAILURE
- || Z_TYPE_PP(gpc_element_p) != IS_ARRAY) {
- MAKE_STD_ZVAL(gpc_element);
- array_init(gpc_element);
- zend_symtable_update(symtable1, index, index_len + 1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p);
+ if ((gpc_element_p = zend_symtable_str_find(symtable1, index, index_len)) == NULL
+ || Z_TYPE_P(gpc_element_p) != IS_ARRAY) {
+ array_init(&gpc_element);
+ gpc_element_p = zend_symtable_str_update(symtable1, index, index_len + 1, &gpc_element);
}
}
- symtable1 = Z_ARRVAL_PP(gpc_element_p);
+ symtable1 = Z_ARRVAL_P(gpc_element_p);
/* ip pointed to the '[' character, now obtain the key */
index = index_s;
index_len = new_idx_len;
@@ -206,11 +201,9 @@ PHPAPI void php_register_variable_ex(char *var_name, zval *val, zval *track_vars
}
} else {
plain_var:
- MAKE_STD_ZVAL(gpc_element);
- gpc_element->value = val->value;
- Z_TYPE_P(gpc_element) = Z_TYPE_P(val);
+ ZVAL_COPY_VALUE(&gpc_element, val);
if (!index) {
- if (zend_hash_next_index_insert(symtable1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p) == FAILURE) {
+ if ((gpc_element_p = zend_hash_next_index_insert(symtable1, &gpc_element)) == NULL) {
zval_ptr_dtor(&gpc_element);
}
} else {
@@ -220,12 +213,12 @@ plain_var:
* to have the same (plain text) cookie name for the same path and we should not overwrite
* more specific cookies with the less specific ones.
*/
- if (PG(http_globals)[TRACK_VARS_COOKIE] &&
- symtable1 == Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_COOKIE]) &&
- zend_symtable_exists(symtable1, index, index_len + 1)) {
+ if (Z_TYPE(PG(http_globals)[TRACK_VARS_COOKIE]) != IS_UNDEF &&
+ symtable1 == Z_ARRVAL(PG(http_globals)[TRACK_VARS_COOKIE]) &&
+ zend_symtable_str_exists(symtable1, index, index_len)) {
zval_ptr_dtor(&gpc_element);
} else {
- zend_symtable_update(symtable1, index, index_len + 1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p);
+ gpc_element_p = zend_symtable_str_update(symtable1, index, index_len, &gpc_element);
}
}
}
@@ -355,7 +348,7 @@ SAPI_API SAPI_TREAT_DATA_FUNC(php_default_treat_data)
{
char *res = NULL, *var, *val, *separator = NULL;
const char *c_var;
- zval *array_ptr;
+ zval array;
int free_buffer = 0;
char *strtok_buf = NULL;
long count = 0;
@@ -364,37 +357,29 @@ SAPI_API SAPI_TREAT_DATA_FUNC(php_default_treat_data)
case PARSE_POST:
case PARSE_GET:
case PARSE_COOKIE:
- ALLOC_ZVAL(array_ptr);
- array_init(array_ptr);
- INIT_PZVAL(array_ptr);
+ array_init(&array);
switch (arg) {
case PARSE_POST:
- if (PG(http_globals)[TRACK_VARS_POST]) {
- zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_POST]);
- }
- PG(http_globals)[TRACK_VARS_POST] = array_ptr;
+ zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_POST]);
+ ZVAL_COPY_VALUE(&PG(http_globals)[TRACK_VARS_POST], &array);
break;
case PARSE_GET:
- if (PG(http_globals)[TRACK_VARS_GET]) {
- zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_GET]);
- }
- PG(http_globals)[TRACK_VARS_GET] = array_ptr;
+ zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_GET]);
+ ZVAL_COPY_VALUE(&PG(http_globals)[TRACK_VARS_GET], &array);
break;
case PARSE_COOKIE:
- if (PG(http_globals)[TRACK_VARS_COOKIE]) {
- zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_COOKIE]);
- }
- PG(http_globals)[TRACK_VARS_COOKIE] = array_ptr;
+ zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_COOKIE]);
+ ZVAL_COPY_VALUE(&PG(http_globals)[TRACK_VARS_COOKIE], &array);
break;
}
break;
default:
- array_ptr = destArray;
+ ZVAL_COPY_VALUE(&array, destArray);
break;
}
if (arg == PARSE_POST) {
- sapi_handle_post(array_ptr TSRMLS_CC);
+ sapi_handle_post(&array TSRMLS_CC);
return;
}
@@ -462,7 +447,7 @@ SAPI_API SAPI_TREAT_DATA_FUNC(php_default_treat_data)
val_len = php_url_decode(val, strlen(val));
val = estrndup(val, val_len);
if (sapi_module.input_filter(arg, var, &val, val_len, &new_val_len TSRMLS_CC)) {
- php_register_variable_safe(var, val, new_val_len, array_ptr TSRMLS_CC);
+ php_register_variable_safe(var, val, new_val_len, &array TSRMLS_CC);
}
efree(val);
} else {
@@ -473,7 +458,7 @@ SAPI_API SAPI_TREAT_DATA_FUNC(php_default_treat_data)
val_len = 0;
val = estrndup("", val_len);
if (sapi_module.input_filter(arg, var, &val, val_len, &new_val_len TSRMLS_CC)) {
- php_register_variable_safe(var, val, new_val_len, array_ptr TSRMLS_CC);
+ php_register_variable_safe(var, val, new_val_len, &array TSRMLS_CC);
}
efree(val);
}
@@ -526,7 +511,7 @@ zend_bool php_std_auto_global_callback(char *name, uint name_len TSRMLS_DC)
*/
static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC)
{
- zval *arr, *argc, *tmp;
+ zval arr, argc, tmp;
int count = 0;
char *ss, *space;
@@ -534,22 +519,15 @@ static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC)
return;
}
- ALLOC_INIT_ZVAL(arr);
- array_init(arr);
+ array_init(&arr);
/* Prepare argv */
if (SG(request_info).argc) { /* are we in cli sapi? */
int i;
for (i = 0; i < SG(request_info).argc; i++) {
- ALLOC_ZVAL(tmp);
- Z_TYPE_P(tmp) = IS_STRING;
- Z_STRLEN_P(tmp) = strlen(SG(request_info).argv[i]);
- Z_STRVAL_P(tmp) = estrndup(SG(request_info).argv[i], Z_STRLEN_P(tmp));
- INIT_PZVAL(tmp);
- if (zend_hash_next_index_insert(Z_ARRVAL_P(arr), &tmp, sizeof(zval *), NULL) == FAILURE) {
- if (Z_TYPE_P(tmp) == IS_STRING) {
- efree(Z_STRVAL_P(tmp));
- }
+ ZVAL_STRING(&tmp, SG(request_info).argv[i]);
+ if (zend_hash_next_index_insert(Z_ARRVAL(arr), &tmp) == NULL) {
+ STR_FREE(Z_STR(tmp));
}
}
} else if (s && *s) {
@@ -560,16 +538,10 @@ static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC)
*space = '\0';
}
/* auto-type */
- ALLOC_ZVAL(tmp);
- Z_TYPE_P(tmp) = IS_STRING;
- Z_STRLEN_P(tmp) = strlen(ss);
- Z_STRVAL_P(tmp) = estrndup(ss, Z_STRLEN_P(tmp));
- INIT_PZVAL(tmp);
+ ZVAL_STRING(&tmp, ss);
count++;
- if (zend_hash_next_index_insert(Z_ARRVAL_P(arr), &tmp, sizeof(zval *), NULL) == FAILURE) {
- if (Z_TYPE_P(tmp) == IS_STRING) {
- efree(Z_STRVAL_P(tmp));
- }
+ if (zend_hash_next_index_insert(Z_ARRVAL(arr), &tmp) == NULL) {
+ STR_FREE(Z_STR(tmp));
}
if (space) {
*space = '+';
@@ -581,25 +553,23 @@ static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC)
}
/* prepare argc */
- ALLOC_INIT_ZVAL(argc);
if (SG(request_info).argc) {
- Z_LVAL_P(argc) = SG(request_info).argc;
+ ZVAL_LONG(&argc, SG(request_info).argc);
} else {
- Z_LVAL_P(argc) = count;
+ ZVAL_LONG(&argc, count);
}
- Z_TYPE_P(argc) = IS_LONG;
if (SG(request_info).argc) {
- Z_ADDREF_P(arr);
- Z_ADDREF_P(argc);
- zend_hash_update(&EG(symbol_table), "argv", sizeof("argv"), &arr, sizeof(zval *), NULL);
- zend_hash_add(&EG(symbol_table), "argc", sizeof("argc"), &argc, sizeof(zval *), NULL);
+ Z_ADDREF(arr);
+ Z_ADDREF(argc);
+ zend_hash_str_update(&EG(symbol_table).ht, "argv", sizeof("argv"), &arr);
+ zend_hash_str_add(&EG(symbol_table).ht, "argc", sizeof("argc"), &argc);
}
if (track_vars_array) {
- Z_ADDREF_P(arr);
- Z_ADDREF_P(argc);
- zend_hash_update(Z_ARRVAL_P(track_vars_array), "argv", sizeof("argv"), &arr, sizeof(zval *), NULL);
- zend_hash_update(Z_ARRVAL_P(track_vars_array), "argc", sizeof("argc"), &argc, sizeof(zval *), NULL);
+ Z_ADDREF(arr);
+ Z_ADDREF(argc);
+ zend_hash_str_update(Z_ARRVAL_P(track_vars_array), "argv", sizeof("argv"), &arr);
+ zend_hash_str_update(Z_ARRVAL_P(track_vars_array), "argc", sizeof("argc"), &argc);
}
zval_ptr_dtor(&arr);
zval_ptr_dtor(&argc);
@@ -610,40 +580,33 @@ static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC)
*/
static inline void php_register_server_variables(TSRMLS_D)
{
- zval *array_ptr = NULL;
-
- ALLOC_ZVAL(array_ptr);
- array_init(array_ptr);
- INIT_PZVAL(array_ptr);
- if (PG(http_globals)[TRACK_VARS_SERVER]) {
- zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_SERVER]);
- }
- PG(http_globals)[TRACK_VARS_SERVER] = array_ptr;
+ zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_SERVER]);
+ array_init(&PG(http_globals)[TRACK_VARS_SERVER]);
/* Server variables */
if (sapi_module.register_server_variables) {
- sapi_module.register_server_variables(array_ptr TSRMLS_CC);
+ sapi_module.register_server_variables(&PG(http_globals)[TRACK_VARS_SERVER] TSRMLS_CC);
}
/* PHP Authentication support */
if (SG(request_info).auth_user) {
- php_register_variable("PHP_AUTH_USER", SG(request_info).auth_user, array_ptr TSRMLS_CC);
+ php_register_variable("PHP_AUTH_USER", SG(request_info).auth_user, &PG(http_globals)[TRACK_VARS_SERVER] TSRMLS_CC);
}
if (SG(request_info).auth_password) {
- php_register_variable("PHP_AUTH_PW", SG(request_info).auth_password, array_ptr TSRMLS_CC);
+ php_register_variable("PHP_AUTH_PW", SG(request_info).auth_password, &PG(http_globals)[TRACK_VARS_SERVER] TSRMLS_CC);
}
if (SG(request_info).auth_digest) {
- php_register_variable("PHP_AUTH_DIGEST", SG(request_info).auth_digest, array_ptr TSRMLS_CC);
+ php_register_variable("PHP_AUTH_DIGEST", SG(request_info).auth_digest, &PG(http_globals)[TRACK_VARS_SERVER] TSRMLS_CC);
}
/* store request init time */
{
zval request_time_float, request_time_long;
Z_TYPE(request_time_float) = IS_DOUBLE;
Z_DVAL(request_time_float) = sapi_get_request_time(TSRMLS_C);
- php_register_variable_ex("REQUEST_TIME_FLOAT", &request_time_float, array_ptr TSRMLS_CC);
+ php_register_variable_ex("REQUEST_TIME_FLOAT", &request_time_float, &PG(http_globals)[TRACK_VARS_SERVER] TSRMLS_CC);
Z_TYPE(request_time_long) = IS_LONG;
Z_LVAL(request_time_long) = zend_dval_to_lval(Z_DVAL(request_time_float));
- php_register_variable_ex("REQUEST_TIME", &request_time_long, array_ptr TSRMLS_CC);
+ php_register_variable_ex("REQUEST_TIME", &request_time_long, &PG(http_globals)[TRACK_VARS_SERVER] TSRMLS_CC);
}
}
@@ -653,45 +616,40 @@ static inline void php_register_server_variables(TSRMLS_D)
*/
static void php_autoglobal_merge(HashTable *dest, HashTable *src TSRMLS_DC)
{
- zval **src_entry, **dest_entry;
- char *string_key;
- uint string_key_len;
+ zval *src_entry, *dest_entry;
+ zend_string *string_key;
ulong num_key;
HashPosition pos;
int key_type;
- int globals_check = (dest == (&EG(symbol_table)));
+ int globals_check = (dest == (&EG(symbol_table).ht));
zend_hash_internal_pointer_reset_ex(src, &pos);
- while (zend_hash_get_current_data_ex(src, (void **)&src_entry, &pos) == SUCCESS) {
- key_type = zend_hash_get_current_key_ex(src, &string_key, &string_key_len, &num_key, 0, &pos);
- if (Z_TYPE_PP(src_entry) != IS_ARRAY
- || (key_type == HASH_KEY_IS_STRING && zend_hash_find(dest, string_key, string_key_len, (void **) &dest_entry) != SUCCESS)
- || (key_type == HASH_KEY_IS_LONG && zend_hash_index_find(dest, num_key, (void **)&dest_entry) != SUCCESS)
- || Z_TYPE_PP(dest_entry) != IS_ARRAY
+ while ((src_entry = zend_hash_get_current_data_ex(src, &pos)) != NULL) {
+ key_type = zend_hash_get_current_key_ex(src, &string_key, &num_key, 0, &pos);
+ if (Z_TYPE_P(src_entry) != IS_ARRAY
+ || (key_type == HASH_KEY_IS_STRING && (dest_entry = zend_hash_find(dest, string_key)) == NULL)
+ || (key_type == HASH_KEY_IS_LONG && (dest_entry = zend_hash_index_find(dest, num_key)) == NULL)
+ || Z_TYPE_P(dest_entry) != IS_ARRAY
) {
- Z_ADDREF_PP(src_entry);
+ Z_ADDREF_P(src_entry);
if (key_type == HASH_KEY_IS_STRING) {
- if (!globals_check || string_key_len != sizeof("GLOBALS") || memcmp(string_key, "GLOBALS", sizeof("GLOBALS") - 1)) {
- zend_hash_update(dest, string_key, string_key_len, src_entry, sizeof(zval *), NULL);
+ if (!globals_check || string_key->len != sizeof("GLOBALS") || memcmp(string_key->val, "GLOBALS", sizeof("GLOBALS") - 1)) {
+ zend_hash_update(dest, string_key, src_entry);
} else {
- Z_DELREF_PP(src_entry);
+ Z_DELREF_P(src_entry);
}
} else {
- zend_hash_index_update(dest, num_key, src_entry, sizeof(zval *), NULL);
+ zend_hash_index_update(dest, num_key, src_entry);
}
} else {
SEPARATE_ZVAL(dest_entry);
- php_autoglobal_merge(Z_ARRVAL_PP(dest_entry), Z_ARRVAL_PP(src_entry) TSRMLS_CC);
+ php_autoglobal_merge(Z_ARRVAL_P(dest_entry), Z_ARRVAL_P(src_entry) TSRMLS_CC);
}
zend_hash_move_forward_ex(src, &pos);
}
}
/* }}} */
-static zend_bool php_auto_globals_create_server(const char *name, uint name_len TSRMLS_DC);
-static zend_bool php_auto_globals_create_env(const char *name, uint name_len TSRMLS_DC);
-static zend_bool php_auto_globals_create_request(const char *name, uint name_len TSRMLS_DC);
-
/* {{{ php_hash_environment
*/
int php_hash_environment(TSRMLS_D)
@@ -699,172 +657,127 @@ int php_hash_environment(TSRMLS_D)
memset(PG(http_globals), 0, sizeof(PG(http_globals)));
zend_activate_auto_globals(TSRMLS_C);
if (PG(register_argc_argv)) {
- php_build_argv(SG(request_info).query_string, PG(http_globals)[TRACK_VARS_SERVER] TSRMLS_CC);
+ php_build_argv(SG(request_info).query_string, &PG(http_globals)[TRACK_VARS_SERVER] TSRMLS_CC);
}
return SUCCESS;
}
/* }}} */
-static zend_bool php_auto_globals_create_get(const char *name, uint name_len TSRMLS_DC)
+static zend_bool php_auto_globals_create_get(zend_string *name TSRMLS_DC)
{
- zval *vars;
-
if (PG(variables_order) && (strchr(PG(variables_order),'G') || strchr(PG(variables_order),'g'))) {
sapi_module.treat_data(PARSE_GET, NULL, NULL TSRMLS_CC);
- vars = PG(http_globals)[TRACK_VARS_GET];
} else {
- ALLOC_ZVAL(vars);
- array_init(vars);
- INIT_PZVAL(vars);
- if (PG(http_globals)[TRACK_VARS_GET]) {
- zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_GET]);
- }
- PG(http_globals)[TRACK_VARS_GET] = vars;
+ zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_GET]);
+ array_init(&PG(http_globals)[TRACK_VARS_GET]);
}
- zend_hash_update(&EG(symbol_table), name, name_len + 1, &vars, sizeof(zval *), NULL);
- Z_ADDREF_P(vars);
+ zend_hash_update(&EG(symbol_table).ht, name, &PG(http_globals)[TRACK_VARS_GET]);
+ Z_ADDREF(PG(http_globals)[TRACK_VARS_GET]);
return 0; /* don't rearm */
}
-static zend_bool php_auto_globals_create_post(const char *name, uint name_len TSRMLS_DC)
+static zend_bool php_auto_globals_create_post(zend_string *name TSRMLS_DC)
{
- zval *vars;
-
if (PG(variables_order) &&
(strchr(PG(variables_order),'P') || strchr(PG(variables_order),'p')) &&
!SG(headers_sent) &&
SG(request_info).request_method &&
!strcasecmp(SG(request_info).request_method, "POST")) {
sapi_module.treat_data(PARSE_POST, NULL, NULL TSRMLS_CC);
- vars = PG(http_globals)[TRACK_VARS_POST];
} else {
- ALLOC_ZVAL(vars);
- array_init(vars);
- INIT_PZVAL(vars);
- if (PG(http_globals)[TRACK_VARS_POST]) {
- zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_POST]);
- }
- PG(http_globals)[TRACK_VARS_POST] = vars;
+ zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_POST]);
+ array_init(&PG(http_globals)[TRACK_VARS_POST]);
}
- zend_hash_update(&EG(symbol_table), name, name_len + 1, &vars, sizeof(zval *), NULL);
- Z_ADDREF_P(vars);
+ zend_hash_update(&EG(symbol_table).ht, name, &PG(http_globals)[TRACK_VARS_POST]);
+ Z_ADDREF(PG(http_globals)[TRACK_VARS_POST]);
return 0; /* don't rearm */
}
-static zend_bool php_auto_globals_create_cookie(const char *name, uint name_len TSRMLS_DC)
+static zend_bool php_auto_globals_create_cookie(zend_string *name TSRMLS_DC)
{
- zval *vars;
-
if (PG(variables_order) && (strchr(PG(variables_order),'C') || strchr(PG(variables_order),'c'))) {
sapi_module.treat_data(PARSE_COOKIE, NULL, NULL TSRMLS_CC);
- vars = PG(http_globals)[TRACK_VARS_COOKIE];
} else {
- ALLOC_ZVAL(vars);
- array_init(vars);
- INIT_PZVAL(vars);
- if (PG(http_globals)[TRACK_VARS_COOKIE]) {
- zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_COOKIE]);
- }
- PG(http_globals)[TRACK_VARS_COOKIE] = vars;
+ zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_COOKIE]);
+ array_init(&PG(http_globals)[TRACK_VARS_COOKIE]);
}
- zend_hash_update(&EG(symbol_table), name, name_len + 1, &vars, sizeof(zval *), NULL);
- Z_ADDREF_P(vars);
+ zend_hash_update(&EG(symbol_table).ht, name, &PG(http_globals)[TRACK_VARS_COOKIE]);
+ Z_ADDREF(PG(http_globals)[TRACK_VARS_COOKIE]);
return 0; /* don't rearm */
}
-static zend_bool php_auto_globals_create_files(const char *name, uint name_len TSRMLS_DC)
+static zend_bool php_auto_globals_create_files(zend_string *name TSRMLS_DC)
{
- zval *vars;
-
- if (PG(http_globals)[TRACK_VARS_FILES]) {
- vars = PG(http_globals)[TRACK_VARS_FILES];
- } else {
- ALLOC_ZVAL(vars);
- array_init(vars);
- INIT_PZVAL(vars);
- PG(http_globals)[TRACK_VARS_FILES] = vars;
+ if (Z_TYPE(PG(http_globals)[TRACK_VARS_FILES]) == IS_UNDEF) {
+ array_init(&PG(http_globals)[TRACK_VARS_FILES]);
}
- zend_hash_update(&EG(symbol_table), name, name_len + 1, &vars, sizeof(zval *), NULL);
- Z_ADDREF_P(vars);
+ zend_hash_update(&EG(symbol_table).ht, name, &PG(http_globals)[TRACK_VARS_FILES]);
+ Z_ADDREF(PG(http_globals)[TRACK_VARS_FILES]);
return 0; /* don't rearm */
}
-static zend_bool php_auto_globals_create_server(const char *name, uint name_len TSRMLS_DC)
+static zend_bool php_auto_globals_create_server(zend_string *name TSRMLS_DC)
{
if (PG(variables_order) && (strchr(PG(variables_order),'S') || strchr(PG(variables_order),'s'))) {
php_register_server_variables(TSRMLS_C);
if (PG(register_argc_argv)) {
if (SG(request_info).argc) {
- zval **argc, **argv;
+ zval *argc, *argv;
- if (zend_hash_find(&EG(symbol_table), "argc", sizeof("argc"), (void**)&argc) == SUCCESS &&
- zend_hash_find(&EG(symbol_table), "argv", sizeof("argv"), (void**)&argv) == SUCCESS) {
- Z_ADDREF_PP(argc);
- Z_ADDREF_PP(argv);
- zend_hash_update(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER]), "argv", sizeof("argv"), argv, sizeof(zval *), NULL);
- zend_hash_update(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER]), "argc", sizeof("argc"), argc, sizeof(zval *), NULL);
+ if ((argc = zend_hash_str_find(&EG(symbol_table).ht, "argc", sizeof("argc")-1)) != NULL &&
+ (argv = zend_hash_str_find(&EG(symbol_table).ht, "argv", sizeof("argv")-1)) != NULL) {
+ Z_ADDREF_P(argc);
+ Z_ADDREF_P(argv);
+ zend_hash_str_update(Z_ARRVAL(PG(http_globals)[TRACK_VARS_SERVER]), "argv", sizeof("argv")-1, argv);
+ zend_hash_str_update(Z_ARRVAL(PG(http_globals)[TRACK_VARS_SERVER]), "argc", sizeof("argc")-1, argc);
}
} else {
- php_build_argv(SG(request_info).query_string, PG(http_globals)[TRACK_VARS_SERVER] TSRMLS_CC);
+ php_build_argv(SG(request_info).query_string, &PG(http_globals)[TRACK_VARS_SERVER] TSRMLS_CC);
}
}
} else {
- zval *server_vars=NULL;
- ALLOC_ZVAL(server_vars);
- array_init(server_vars);
- INIT_PZVAL(server_vars);
- if (PG(http_globals)[TRACK_VARS_SERVER]) {
- zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_SERVER]);
- }
- PG(http_globals)[TRACK_VARS_SERVER] = server_vars;
+ zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_SERVER]);
+ array_init(&PG(http_globals)[TRACK_VARS_SERVER]);
}
- zend_hash_update(&EG(symbol_table), name, name_len + 1, &PG(http_globals)[TRACK_VARS_SERVER], sizeof(zval *), NULL);
- Z_ADDREF_P(PG(http_globals)[TRACK_VARS_SERVER]);
+ zend_hash_update(&EG(symbol_table).ht, name, &PG(http_globals)[TRACK_VARS_SERVER]);
+ Z_ADDREF(PG(http_globals)[TRACK_VARS_SERVER]);
return 0; /* don't rearm */
}
-static zend_bool php_auto_globals_create_env(const char *name, uint name_len TSRMLS_DC)
+static zend_bool php_auto_globals_create_env(zend_string *name TSRMLS_DC)
{
- zval *env_vars = NULL;
- ALLOC_ZVAL(env_vars);
- array_init(env_vars);
- INIT_PZVAL(env_vars);
- if (PG(http_globals)[TRACK_VARS_ENV]) {
- zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_ENV]);
- }
- PG(http_globals)[TRACK_VARS_ENV] = env_vars;
+ zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_ENV]);
+ array_init(&PG(http_globals)[TRACK_VARS_ENV]);
if (PG(variables_order) && (strchr(PG(variables_order),'E') || strchr(PG(variables_order),'e'))) {
- php_import_environment_variables(PG(http_globals)[TRACK_VARS_ENV] TSRMLS_CC);
+ php_import_environment_variables(&PG(http_globals)[TRACK_VARS_ENV] TSRMLS_CC);
}
- zend_hash_update(&EG(symbol_table), name, name_len + 1, &PG(http_globals)[TRACK_VARS_ENV], sizeof(zval *), NULL);
- Z_ADDREF_P(PG(http_globals)[TRACK_VARS_ENV]);
+ zend_hash_update(&EG(symbol_table).ht, name, &PG(http_globals)[TRACK_VARS_ENV]);
+ Z_ADDREF(PG(http_globals)[TRACK_VARS_ENV]);
return 0; /* don't rearm */
}
-static zend_bool php_auto_globals_create_request(const char *name, uint name_len TSRMLS_DC)
+static zend_bool php_auto_globals_create_request(zend_string *name TSRMLS_DC)
{
- zval *form_variables;
+ zval form_variables;
unsigned char _gpc_flags[3] = {0, 0, 0};
char *p;
- ALLOC_ZVAL(form_variables);
- array_init(form_variables);
- INIT_PZVAL(form_variables);
+ array_init(&form_variables);
if (PG(request_order) != NULL) {
p = PG(request_order);
@@ -877,40 +790,40 @@ static zend_bool php_auto_globals_create_request(const char *name, uint name_len
case 'g':
case 'G':
if (!_gpc_flags[0]) {
- php_autoglobal_merge(Z_ARRVAL_P(form_variables), Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_GET]) TSRMLS_CC);
+ php_autoglobal_merge(Z_ARRVAL(form_variables), Z_ARRVAL(PG(http_globals)[TRACK_VARS_GET]) TSRMLS_CC);
_gpc_flags[0] = 1;
}
break;
case 'p':
case 'P':
if (!_gpc_flags[1]) {
- php_autoglobal_merge(Z_ARRVAL_P(form_variables), Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_POST]) TSRMLS_CC);
+ php_autoglobal_merge(Z_ARRVAL(form_variables), Z_ARRVAL(PG(http_globals)[TRACK_VARS_POST]) TSRMLS_CC);
_gpc_flags[1] = 1;
}
break;
case 'c':
case 'C':
if (!_gpc_flags[2]) {
- php_autoglobal_merge(Z_ARRVAL_P(form_variables), Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_COOKIE]) TSRMLS_CC);
+ php_autoglobal_merge(Z_ARRVAL(form_variables), Z_ARRVAL(PG(http_globals)[TRACK_VARS_COOKIE]) TSRMLS_CC);
_gpc_flags[2] = 1;
}
break;
}
}
- zend_hash_update(&EG(symbol_table), name, name_len + 1, &form_variables, sizeof(zval *), NULL);
+ zend_hash_update(&EG(symbol_table).ht, name, &form_variables);
return 0;
}
void php_startup_auto_globals(TSRMLS_D)
{
- zend_register_auto_global(ZEND_STRL("_GET"), 0, php_auto_globals_create_get TSRMLS_CC);
- zend_register_auto_global(ZEND_STRL("_POST"), 0, php_auto_globals_create_post TSRMLS_CC);
- zend_register_auto_global(ZEND_STRL("_COOKIE"), 0, php_auto_globals_create_cookie TSRMLS_CC);
- zend_register_auto_global(ZEND_STRL("_SERVER"), PG(auto_globals_jit), php_auto_globals_create_server TSRMLS_CC);
- zend_register_auto_global(ZEND_STRL("_ENV"), PG(auto_globals_jit), php_auto_globals_create_env TSRMLS_CC);
- zend_register_auto_global(ZEND_STRL("_REQUEST"), PG(auto_globals_jit), php_auto_globals_create_request TSRMLS_CC);
- zend_register_auto_global(ZEND_STRL("_FILES"), 0, php_auto_globals_create_files TSRMLS_CC);
+ zend_register_auto_global(STR_INIT("_GET", sizeof("_GET")-1, 0), 0, php_auto_globals_create_get TSRMLS_CC);
+ zend_register_auto_global(STR_INIT("_POST", sizeof("_POST")-1, 0), 0, php_auto_globals_create_post TSRMLS_CC);
+ zend_register_auto_global(STR_INIT("_COOKIE", sizeof("_COOKIE")-1, 0), 0, php_auto_globals_create_cookie TSRMLS_CC);
+ zend_register_auto_global(STR_INIT("_SERVER", sizeof("_SERVER")-1, 0), PG(auto_globals_jit), php_auto_globals_create_server TSRMLS_CC);
+ zend_register_auto_global(STR_INIT("_ENV", sizeof("_ENV")-1, 0), PG(auto_globals_jit), php_auto_globals_create_env TSRMLS_CC);
+ zend_register_auto_global(STR_INIT("_REQUEST", sizeof("_REQUEST")-1, 0), PG(auto_globals_jit), php_auto_globals_create_request TSRMLS_CC);
+ zend_register_auto_global(STR_INIT("_FILES", sizeof("_FILES")-1, 0), 0, php_auto_globals_create_files TSRMLS_CC);
}
/*
diff --git a/main/rfc1867.c b/main/rfc1867.c
index b1011e21cb..ed4e275cbb 100644
--- a/main/rfc1867.c
+++ b/main/rfc1867.c
@@ -148,17 +148,15 @@ static void normalize_protected_variable(char *varname TSRMLS_DC) /* {{{ */
static void add_protected_variable(char *varname TSRMLS_DC) /* {{{ */
{
- int dummy = 1;
-
normalize_protected_variable(varname TSRMLS_CC);
- zend_hash_add(&PG(rfc1867_protected_variables), varname, strlen(varname)+1, &dummy, sizeof(int), NULL);
+ zend_hash_str_add_empty_element(&PG(rfc1867_protected_variables), varname, strlen(varname));
}
/* }}} */
static zend_bool is_protected_variable(char *varname TSRMLS_DC) /* {{{ */
{
normalize_protected_variable(varname TSRMLS_CC);
- return zend_hash_exists(&PG(rfc1867_protected_variables), varname, strlen(varname)+1);
+ return zend_hash_str_exists(&PG(rfc1867_protected_variables), varname, strlen(varname));
}
/* }}} */
@@ -683,7 +681,6 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
int boundary_len = 0, cancel_upload = 0, is_arr_upload = 0, array_len = 0;
int64_t total_bytes = 0, max_file_size = 0;
int skip_upload = 0, anonindex = 0, is_anonymous;
- zval *http_post_files = NULL;
HashTable *uploaded_files = NULL;
multipart_buffer *mbuff;
zval *array_ptr = (zval *) arg;
@@ -764,10 +761,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
zend_hash_init(uploaded_files, 5, NULL, (dtor_func_t) free_estring, 0);
SG(rfc1867_uploaded_files) = uploaded_files;
- ALLOC_ZVAL(http_post_files);
- array_init(http_post_files);
- INIT_PZVAL(http_post_files);
- PG(http_globals)[TRACK_VARS_FILES] = http_post_files;
+ array_init(&PG(http_globals)[TRACK_VARS_FILES]);
zend_llist_init(&header, sizeof(mime_header_entry), (llist_dtor_func_t) php_free_hdr_entry, 0);
@@ -1098,7 +1092,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
}
temp_filename = "";
} else {
- zend_hash_add(SG(rfc1867_uploaded_files), temp_filename, strlen(temp_filename) + 1, &temp_filename, sizeof(char *), NULL);
+ zend_hash_str_add_ptr(SG(rfc1867_uploaded_files), temp_filename, strlen(temp_filename), temp_filename);
}
/* is_arr_upload is true when name of file upload field
@@ -1149,7 +1143,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
} else {
snprintf(lbuf, llen, "%s[name]", param);
}
- register_http_post_files_variable(lbuf, s, http_post_files, 0 TSRMLS_CC);
+ register_http_post_files_variable(lbuf, s, &PG(http_globals)[TRACK_VARS_FILES], 0 TSRMLS_CC);
efree(filename);
s = NULL;
@@ -1180,7 +1174,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
} else {
snprintf(lbuf, llen, "%s[type]", param);
}
- register_http_post_files_variable(lbuf, cd, http_post_files, 0 TSRMLS_CC);
+ register_http_post_files_variable(lbuf, cd, &PG(http_globals)[TRACK_VARS_FILES], 0 TSRMLS_CC);
/* Restore Content-Type Header */
if (s != NULL) {
@@ -1198,7 +1192,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
/* if param is of form xxx[.*] this will cut it to xxx */
if (!is_anonymous) {
- ZVAL_STRING(&zfilename, temp_filename, 1);
+ ZVAL_STRING(&zfilename, temp_filename);
safe_php_register_variable_ex(param, &zfilename, NULL, 1 TSRMLS_CC);
}
@@ -1209,8 +1203,8 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
snprintf(lbuf, llen, "%s[tmp_name]", param);
}
add_protected_variable(lbuf TSRMLS_CC);
- ZVAL_STRING(&zfilename, temp_filename, 1);
- register_http_post_files_variable_ex(lbuf, &zfilename, http_post_files, 1 TSRMLS_CC);
+ ZVAL_STRING(&zfilename, temp_filename);
+ register_http_post_files_variable_ex(lbuf, &zfilename, &PG(http_globals)[TRACK_VARS_FILES], 1 TSRMLS_CC);
}
{
@@ -1248,7 +1242,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
} else {
snprintf(lbuf, llen, "%s[error]", param);
}
- register_http_post_files_variable_ex(lbuf, &error_type, http_post_files, 0 TSRMLS_CC);
+ register_http_post_files_variable_ex(lbuf, &error_type, &PG(http_globals)[TRACK_VARS_FILES], 0 TSRMLS_CC);
/* Add $foo_size */
if (is_arr_upload) {
@@ -1258,7 +1252,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
}
if (!is_anonymous) {
if (size_overflow) {
- ZVAL_STRING(&file_size, file_size_buf, 1);
+ ZVAL_STRING(&file_size, file_size_buf);
}
safe_php_register_variable_ex(lbuf, &file_size, NULL, size_overflow TSRMLS_CC);
}
@@ -1270,9 +1264,9 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
snprintf(lbuf, llen, "%s[size]", param);
}
if (size_overflow) {
- ZVAL_STRING(&file_size, file_size_buf, 1);
+ ZVAL_STRING(&file_size, file_size_buf);
}
- register_http_post_files_variable_ex(lbuf, &file_size, http_post_files, size_overflow TSRMLS_CC);
+ register_http_post_files_variable_ex(lbuf, &file_size, &PG(http_globals)[TRACK_VARS_FILES], size_overflow TSRMLS_CC);
}
efree(param);
}
diff --git a/main/streams/filter.c b/main/streams/filter.c
index 71599f0d12..7a38c4fa3c 100644
--- a/main/streams/filter.c
+++ b/main/streams/filter.c
@@ -46,26 +46,25 @@ PHPAPI HashTable *_php_get_stream_filters_hash(TSRMLS_D)
/* API for registering GLOBAL filters */
PHPAPI int php_stream_filter_register_factory(const char *filterpattern, php_stream_filter_factory *factory TSRMLS_DC)
{
- return zend_hash_add(&stream_filters_hash, (char*)filterpattern, strlen(filterpattern) + 1, factory, sizeof(*factory), NULL);
+ return zend_hash_str_add_ptr(&stream_filters_hash, filterpattern, strlen(filterpattern), factory) ? SUCCESS : FAILURE;
}
PHPAPI int php_stream_filter_unregister_factory(const char *filterpattern TSRMLS_DC)
{
- return zend_hash_del(&stream_filters_hash, (char*)filterpattern, strlen(filterpattern) + 1);
+ return zend_hash_str_del(&stream_filters_hash, filterpattern, strlen(filterpattern));
}
/* API for registering VOLATILE wrappers */
PHPAPI int php_stream_filter_register_factory_volatile(const char *filterpattern, php_stream_filter_factory *factory TSRMLS_DC)
{
if (!FG(stream_filters)) {
- php_stream_filter_factory tmpfactory;
-
ALLOC_HASHTABLE(FG(stream_filters));
zend_hash_init(FG(stream_filters), zend_hash_num_elements(&stream_filters_hash), NULL, NULL, 1);
- zend_hash_copy(FG(stream_filters), &stream_filters_hash, NULL, &tmpfactory, sizeof(php_stream_filter_factory));
+//??? zend_hash_copy(FG(stream_filters), &stream_filters_hash, NULL, &tmpfactory, sizeof(php_stream_filter_factory));
+ zend_hash_copy(FG(stream_filters), &stream_filters_hash, NULL);
}
- return zend_hash_add(FG(stream_filters), (char*)filterpattern, strlen(filterpattern) + 1, factory, sizeof(*factory), NULL);
+ return zend_hash_str_add_ptr(FG(stream_filters), (char*)filterpattern, strlen(filterpattern), factory) ? SUCCESS : FAILURE;
}
/* Buckets */
@@ -259,7 +258,7 @@ PHPAPI php_stream_filter *php_stream_filter_create(const char *filtername, zval
n = strlen(filtername);
- if (SUCCESS == zend_hash_find(filter_hash, (char*)filtername, n + 1, (void**)&factory)) {
+ if (NULL != (factory = zend_hash_str_find_ptr(filter_hash, filtername, n))) {
filter = factory->create_filter(filtername, filterparams, persistent TSRMLS_CC);
} else if ((period = strrchr(filtername, '.'))) {
/* try a wildcard */
@@ -271,7 +270,7 @@ PHPAPI php_stream_filter *php_stream_filter_create(const char *filtername, zval
while (period && !filter) {
*period = '\0';
strncat(wildname, ".*", 2);
- if (SUCCESS == zend_hash_find(filter_hash, wildname, strlen(wildname) + 1, (void**)&factory)) {
+ if (NULL != (factory = zend_hash_str_find_ptr(filter_hash, wildname, strlen(wildname)))) {
filter = factory->create_filter(filtername, filterparams, persistent TSRMLS_CC);
}
@@ -523,8 +522,8 @@ PHPAPI php_stream_filter *php_stream_filter_remove(php_stream_filter *filter, in
filter->chain->tail = filter->prev;
}
- if (filter->rsrc_id > 0) {
- zend_list_delete(filter->rsrc_id);
+ if (filter->res) {
+ zend_list_delete(filter->res);
}
if (call_dtor) {
diff --git a/main/streams/memory.c b/main/streams/memory.c
index 854b9e2720..b13d8b62ac 100644
--- a/main/streams/memory.c
+++ b/main/streams/memory.c
@@ -351,7 +351,7 @@ typedef struct {
php_stream *innerstream;
size_t smax;
int mode;
- zval* meta;
+ zval meta;
} php_stream_temp_data;
@@ -416,9 +416,7 @@ static int php_stream_temp_close(php_stream *stream, int close_handle TSRMLS_DC)
ret = 0;
}
- if (ts->meta) {
- zval_ptr_dtor(&ts->meta);
- }
+ zval_ptr_dtor(&ts->meta);
efree(ts);
@@ -522,8 +520,8 @@ static int php_stream_temp_set_option(php_stream *stream, int option, int value,
switch(option) {
case PHP_STREAM_OPTION_META_DATA_API:
- if (ts->meta) {
- zend_hash_copy(Z_ARRVAL_P((zval*)ptrparam), Z_ARRVAL_P(ts->meta), (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval*));
+ if (Z_TYPE(ts->meta) != IS_UNDEF) {
+ zend_hash_copy(Z_ARRVAL_P((zval*)ptrparam), Z_ARRVAL(ts->meta), zval_add_ref);
}
return PHP_STREAM_OPTION_RETURN_OK;
default:
@@ -556,7 +554,7 @@ PHPAPI php_stream *_php_stream_temp_create(int mode, size_t max_memory_usage STR
self = ecalloc(1, sizeof(*self));
self->smax = max_memory_usage;
self->mode = mode;
- self->meta = NULL;
+ ZVAL_UNDEF(&self->meta);
stream = php_stream_alloc_rel(&php_stream_temp_ops, self, 0, mode & TEMP_STREAM_READONLY ? "rb" : "w+b");
stream->flags |= PHP_STREAM_FLAG_NO_BUFFER;
self->innerstream = php_stream_memory_create_rel(mode);
@@ -607,9 +605,10 @@ static php_stream * php_stream_url_wrap_rfc2397(php_stream_wrapper *wrapper, con
char *comma, *semi, *sep, *key;
size_t mlen, dlen, plen, vlen;
off_t newoffs;
- zval *meta = NULL;
+ zval meta;
int base64 = 0, ilen;
+ ZVAL_NULL(&meta);
if (memcmp(path, "data:", 5)) {
return NULL;
}
@@ -639,14 +638,13 @@ static php_stream * php_stream_url_wrap_rfc2397(php_stream_wrapper *wrapper, con
return NULL;
}
- MAKE_STD_ZVAL(meta);
- array_init(meta);
+ array_init(&meta);
if (!semi) { /* there is only a mime type */
- add_assoc_stringl(meta, "mediatype", (char *) path, mlen, 1);
+ add_assoc_stringl(&meta, "mediatype", (char *) path, mlen, 1);
mlen = 0;
} else if (sep && sep < semi) { /* there is a mime type */
plen = semi - path;
- add_assoc_stringl(meta, "mediatype", (char *) path, plen, 1);
+ add_assoc_stringl(&meta, "mediatype", (char *) path, plen, 1);
mlen -= plen;
path += plen;
} else if (semi != path || mlen != sizeof(";base64")-1 || memcmp(path, ";base64", sizeof(";base64")-1)) { /* must be error since parameters are only allowed after mediatype */
@@ -676,7 +674,7 @@ static php_stream * php_stream_url_wrap_rfc2397(php_stream_wrapper *wrapper, con
plen = sep - path;
vlen = (semi ? semi - sep : mlen - plen) - 1 /* '=' */;
key = estrndup(path, plen);
- add_assoc_stringl_ex(meta, key, plen + 1, sep + 1, vlen, 1);
+ add_assoc_stringl_ex(&meta, key, plen + 1, sep + 1, vlen, 1);
efree(key);
plen += vlen + 1;
mlen -= plen;
@@ -688,10 +686,9 @@ static php_stream * php_stream_url_wrap_rfc2397(php_stream_wrapper *wrapper, con
return NULL;
}
} else {
- MAKE_STD_ZVAL(meta);
- array_init(meta);
+ array_init(&meta);
}
- add_assoc_bool(meta, "base64", base64);
+ add_assoc_bool(&meta, "base64", base64);
/* skip ',' */
comma++;
@@ -724,7 +721,7 @@ static php_stream * php_stream_url_wrap_rfc2397(php_stream_wrapper *wrapper, con
ts = (php_stream_temp_data*)stream->abstract;
assert(ts != NULL);
ts->mode = mode && mode[0] == 'r' && mode[1] != '+' ? TEMP_STREAM_READONLY : 0;
- ts->meta = meta;
+ ZVAL_COPY_VALUE(&ts->meta, &meta);
}
efree(comma);
diff --git a/main/streams/php_stream_context.h b/main/streams/php_stream_context.h
index 5c6925a856..2c0a33aab7 100644
--- a/main/streams/php_stream_context.h
+++ b/main/streams/php_stream_context.h
@@ -38,7 +38,7 @@ typedef void (*php_stream_notification_func)(php_stream_context *context,
FG(default_context) ? FG(default_context) : \
(FG(default_context) = php_stream_context_alloc(TSRMLS_C)) )
-#define php_stream_context_to_zval(context, zval) { ZVAL_RESOURCE(zval, (context)->rsrc_id); zend_list_addref((context)->rsrc_id); }
+#define php_stream_context_to_zval(context, zval) { ZVAL_RESOURCE(zval, (context)->res); zend_list_addref((context)->res); }
typedef struct _php_stream_notifier php_stream_notifier;
@@ -52,15 +52,15 @@ struct _php_stream_notifier {
struct _php_stream_context {
php_stream_notifier *notifier;
- zval *options; /* hash keyed by wrapper family or specific wrapper */
- int rsrc_id; /* used for auto-cleanup */
+ zval options; /* hash keyed by wrapper family or specific wrapper */
+ zend_resource *res; /* used for auto-cleanup */
};
BEGIN_EXTERN_C()
PHPAPI void php_stream_context_free(php_stream_context *context);
PHPAPI php_stream_context *php_stream_context_alloc(TSRMLS_D);
-PHPAPI int php_stream_context_get_option(php_stream_context *context,
- const char *wrappername, const char *optionname, zval ***optionvalue);
+PHPAPI zval *php_stream_context_get_option(php_stream_context *context,
+ const char *wrappername, const char *optionname);
PHPAPI int php_stream_context_set_option(php_stream_context *context,
const char *wrappername, const char *optionname, zval *optionvalue);
diff --git a/main/streams/php_stream_filter_api.h b/main/streams/php_stream_filter_api.h
index 9d9894c1c5..fe58a7d709 100644
--- a/main/streams/php_stream_filter_api.h
+++ b/main/streams/php_stream_filter_api.h
@@ -119,7 +119,7 @@ struct _php_stream_filter {
php_stream_bucket_brigade buffer;
/* filters are auto_registered when they're applied */
- int rsrc_id;
+ zend_resource *res;
};
/* stack filter onto a stream */
diff --git a/main/streams/streams.c b/main/streams/streams.c
index 4c4764c1ea..de24aaf475 100644
--- a/main/streams/streams.c
+++ b/main/streams/streams.c
@@ -65,19 +65,20 @@ PHPAPI HashTable *php_stream_get_url_stream_wrappers_hash_global(void)
return &url_stream_wrappers_hash;
}
-static int _php_stream_release_context(zend_rsrc_list_entry *le, void *pContext TSRMLS_DC)
+static int _php_stream_release_context(zval *zv, void *pContext TSRMLS_DC)
{
+ zend_resource *le = Z_RES_P(zv);
if (le->ptr == pContext) {
- return --le->refcount == 0;
+ return --le->gc.refcount == 0;
}
return 0;
}
-static int forget_persistent_resource_id_numbers(zend_rsrc_list_entry *rsrc TSRMLS_DC)
+static int forget_persistent_resource_id_numbers(zend_resource *rsrc TSRMLS_DC)
{
php_stream *stream;
- if (Z_TYPE_P(rsrc) != le_pstream) {
+ if (rsrc->type != le_pstream) {
return 0;
}
@@ -87,11 +88,11 @@ static int forget_persistent_resource_id_numbers(zend_rsrc_list_entry *rsrc TSRM
fprintf(stderr, "forget_persistent: %s:%p\n", stream->ops->label, stream);
#endif
- stream->rsrc_id = FAILURE;
+ stream->res = NULL;
if (stream->context) {
zend_hash_apply_with_argument(&EG(regular_list),
- (apply_func_arg_t) _php_stream_release_context,
+ _php_stream_release_context,
stream->context TSRMLS_CC);
stream->context = NULL;
}
@@ -116,36 +117,32 @@ PHPAPI php_stream *php_stream_encloses(php_stream *enclosing, php_stream *enclos
PHPAPI int php_stream_from_persistent_id(const char *persistent_id, php_stream **stream TSRMLS_DC)
{
- zend_rsrc_list_entry *le;
+ zend_resource *le;
- if (zend_hash_find(&EG(persistent_list), (char*)persistent_id, strlen(persistent_id)+1, (void*) &le) == SUCCESS) {
- if (Z_TYPE_P(le) == le_pstream) {
+ if ((le = zend_hash_str_find_ptr(&EG(persistent_list), persistent_id, strlen(persistent_id))) != NULL) {
+ if (le->type == le_pstream) {
if (stream) {
HashPosition pos;
- zend_rsrc_list_entry *regentry;
- ulong index = -1; /* intentional */
+ zend_resource *regentry;
/* see if this persistent resource already has been loaded to the
* regular list; allowing the same resource in several entries in the
* regular list causes trouble (see bug #54623) */
zend_hash_internal_pointer_reset_ex(&EG(regular_list), &pos);
- while (zend_hash_get_current_data_ex(&EG(regular_list),
- (void **)&regentry, &pos) == SUCCESS) {
+ while ((regentry = zend_hash_get_current_data_ptr_ex(&EG(regular_list), &pos)) != NULL) {
if (regentry->ptr == le->ptr) {
- zend_hash_get_current_key_ex(&EG(regular_list), NULL, NULL,
- &index, 0, &pos);
break;
}
zend_hash_move_forward_ex(&EG(regular_list), &pos);
}
*stream = (php_stream*)le->ptr;
- if (index == -1) { /* not found in regular list */
- le->refcount++;
- (*stream)->rsrc_id = ZEND_REGISTER_RESOURCE(NULL, *stream, le_pstream);
+ if (!regentry) { /* not found in regular list */
+ le->gc.refcount++;
+ (*stream)->res = ZEND_REGISTER_RESOURCE(NULL, *stream, le_pstream);
} else {
- regentry->refcount++;
- (*stream)->rsrc_id = index;
+ regentry->gc.refcount++;
+ (*stream)->res = regentry;
}
}
return PHP_STREAM_PERSISTENT_SUCCESS;
@@ -159,13 +156,11 @@ PHPAPI int php_stream_from_persistent_id(const char *persistent_id, php_stream *
static zend_llist *php_get_wrapper_errors_list(php_stream_wrapper *wrapper TSRMLS_DC)
{
- zend_llist *list = NULL;
if (!FG(wrapper_errors)) {
return NULL;
} else {
- zend_hash_find(FG(wrapper_errors), (const char*)&wrapper,
- sizeof wrapper, (void**)&list);
- return list;
+ return (zend_llist*) zend_hash_str_find_ptr(FG(wrapper_errors), (const char*)&wrapper,
+ sizeof wrapper);
}
}
@@ -237,7 +232,7 @@ void php_stream_display_wrapper_errors(php_stream_wrapper *wrapper, const char *
void php_stream_tidy_wrapper_error_log(php_stream_wrapper *wrapper TSRMLS_DC)
{
if (wrapper && FG(wrapper_errors)) {
- zend_hash_del(FG(wrapper_errors), (const char*)&wrapper, sizeof wrapper);
+ zend_hash_str_del(FG(wrapper_errors), (const char*)&wrapper, sizeof wrapper);
}
}
@@ -265,15 +260,15 @@ PHPAPI void php_stream_wrapper_log_error(php_stream_wrapper *wrapper, int option
zend_hash_init(FG(wrapper_errors), 8, NULL,
(dtor_func_t)zend_llist_destroy, 0);
} else {
- zend_hash_find(FG(wrapper_errors), (const char*)&wrapper,
- sizeof wrapper, (void**)&list);
+ list = zend_hash_str_find_ptr(FG(wrapper_errors), (const char*)&wrapper,
+ sizeof wrapper);
}
if (!list) {
zend_llist new_list;
zend_llist_init(&new_list, sizeof buffer, wrapper_error_dtor, 0);
- zend_hash_update(FG(wrapper_errors), (const char*)&wrapper,
- sizeof wrapper, &new_list, sizeof new_list, (void**)&list);
+ zend_hash_str_update_mem(FG(wrapper_errors), (const char*)&wrapper,
+ sizeof wrapper, &new_list, sizeof new_list);
}
/* append to linked list */
@@ -315,27 +310,23 @@ fprintf(stderr, "stream_alloc: %s:%p persistent=%s\n", ops->label, ret, persiste
}
if (persistent_id) {
- zend_rsrc_list_entry le;
+ zval tmp;
- Z_TYPE(le) = le_pstream;
- le.ptr = ret;
- le.refcount = 0;
-
- if (FAILURE == zend_hash_update(&EG(persistent_list), (char *)persistent_id,
- strlen(persistent_id) + 1,
- (void *)&le, sizeof(le), NULL)) {
+ ZVAL_NEW_PERSISTENT_RES(&tmp, -1, ret, le_pstream);
+ if (NULL == zend_hash_str_update(&EG(persistent_list), persistent_id,
+ strlen(persistent_id), &tmp)) {
pefree(ret, 1);
return NULL;
}
}
- ret->rsrc_id = ZEND_REGISTER_RESOURCE(NULL, ret, persistent_id ? le_pstream : le_stream);
+ ret->res = ZEND_REGISTER_RESOURCE(NULL, ret, persistent_id ? le_pstream : le_stream);
strlcpy(ret->mode, mode, sizeof(ret->mode));
ret->wrapper = NULL;
ret->wrapperthis = NULL;
- ret->wrapperdata = NULL;
+ ZVAL_UNDEF(&ret->wrapperdata);
ret->stdiocast = NULL;
ret->orig_path = NULL;
ret->context = NULL;
@@ -374,8 +365,9 @@ static const char *_php_stream_pretty_free_options(int close_options, char *out)
}
#endif
-static int _php_stream_free_persistent(zend_rsrc_list_entry *le, void *pStream TSRMLS_DC)
+static int _php_stream_free_persistent(zval *zv, void *pStream TSRMLS_DC)
{
+ zend_resource *le = Z_RES_P(zv);
return le->ptr == pStream;
}
@@ -467,7 +459,7 @@ fprintf(stderr, "stream_free: %s:%p[%s] preserve_handle=%d release_cast=%d remov
* the resource list, otherwise the resource will point to invalid memory.
* In any case, let's always completely delete it from the resource list,
* not only when PHP_STREAM_FREE_RELEASE_STREAM is set */
- while (zend_list_delete(stream->rsrc_id) == SUCCESS) {}
+ while (zend_list_delete(stream->res) == SUCCESS) {}
}
if (close_options & PHP_STREAM_FREE_CALL_DTOR) {
@@ -507,9 +499,9 @@ fprintf(stderr, "stream_free: %s:%p[%s] preserve_handle=%d release_cast=%d remov
stream->wrapper = NULL;
}
- if (stream->wrapperdata) {
+ if (Z_TYPE(stream->wrapperdata) != IS_UNDEF) {
zval_ptr_dtor(&stream->wrapperdata);
- stream->wrapperdata = NULL;
+ ZVAL_UNDEF(&stream->wrapperdata);
}
if (stream->readbuf) {
@@ -559,7 +551,7 @@ fprintf(stderr, "stream_free: %s:%p[%s] preserve_handle=%d release_cast=%d remov
}
if (context) {
- zend_list_delete(context->rsrc_id);
+ zend_list_delete(context->res);
}
return ret;
@@ -689,7 +681,7 @@ static void php_stream_fill_read_buffer(php_stream *stream, size_t size TSRMLS_D
stream->is_persistent);
}
- justread = stream->ops->read(stream, stream->readbuf + stream->writepos,
+ justread = stream->ops->read(stream, (char*)stream->readbuf + stream->writepos,
stream->readbuflen - stream->writepos
TSRMLS_CC);
@@ -787,7 +779,7 @@ PHPAPI int _php_stream_putc(php_stream *stream, int c TSRMLS_DC)
{
unsigned char buf = c;
- if (php_stream_write(stream, &buf, 1) > 0) {
+ if (php_stream_write(stream, (char*)&buf, 1) > 0) {
return 1;
}
return EOF;
@@ -842,7 +834,7 @@ PHPAPI const char *php_stream_locate_eol(php_stream *stream, const char *buf, si
const char *readptr;
if (!buf) {
- readptr = stream->readbuf + stream->readpos;
+ readptr = (char*)stream->readbuf + stream->readpos;
avail = stream->writepos - stream->readpos;
} else {
readptr = buf;
@@ -914,7 +906,7 @@ PHPAPI char *_php_stream_get_line(php_stream *stream, char *buf, size_t maxlen,
const char *eol;
int done = 0;
- readptr = stream->readbuf + stream->readpos;
+ readptr = (char*)stream->readbuf + stream->readpos;
eol = php_stream_locate_eol(stream, NULL, 0 TSRMLS_CC);
if (eol) {
@@ -1604,14 +1596,14 @@ PHPAPI size_t _php_stream_copy_to_stream(php_stream *src, php_stream *dest, size
/* {{{ wrapper init and registration */
-static void stream_resource_regular_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC)
+static void stream_resource_regular_dtor(zend_resource *rsrc TSRMLS_DC)
{
php_stream *stream = (php_stream*)rsrc->ptr;
/* set the return value for pclose */
FG(pclose_ret) = php_stream_free(stream, PHP_STREAM_FREE_CLOSE | PHP_STREAM_FREE_RSRC_DTOR);
}
-static void stream_resource_persistent_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC)
+static void stream_resource_persistent_dtor(zend_resource *rsrc TSRMLS_DC)
{
php_stream *stream = (php_stream*)rsrc->ptr;
FG(pclose_ret) = php_stream_free(stream, PHP_STREAM_FREE_CLOSE | PHP_STREAM_FREE_RSRC_DTOR);
@@ -1701,21 +1693,19 @@ PHPAPI int php_register_url_stream_wrapper(const char *protocol, php_stream_wrap
return FAILURE;
}
- return zend_hash_add(&url_stream_wrappers_hash, protocol, protocol_len + 1, &wrapper, sizeof(wrapper), NULL);
+ return zend_hash_str_add_ptr(&url_stream_wrappers_hash, protocol, protocol_len, wrapper) ? SUCCESS : FAILURE;
}
PHPAPI int php_unregister_url_stream_wrapper(const char *protocol TSRMLS_DC)
{
- return zend_hash_del(&url_stream_wrappers_hash, protocol, strlen(protocol) + 1);
+ return zend_hash_str_del(&url_stream_wrappers_hash, protocol, strlen(protocol));
}
static void clone_wrapper_hash(TSRMLS_D)
{
- php_stream_wrapper *tmp;
-
ALLOC_HASHTABLE(FG(stream_wrappers));
zend_hash_init(FG(stream_wrappers), zend_hash_num_elements(&url_stream_wrappers_hash), NULL, NULL, 1);
- zend_hash_copy(FG(stream_wrappers), &url_stream_wrappers_hash, NULL, &tmp, sizeof(tmp));
+ zend_hash_copy(FG(stream_wrappers), &url_stream_wrappers_hash, NULL);
}
/* API for registering VOLATILE wrappers */
@@ -1731,7 +1721,7 @@ PHPAPI int php_register_url_stream_wrapper_volatile(const char *protocol, php_st
clone_wrapper_hash(TSRMLS_C);
}
- return zend_hash_add(FG(stream_wrappers), protocol, protocol_len + 1, &wrapper, sizeof(wrapper), NULL);
+ return zend_hash_str_add_ptr(FG(stream_wrappers), protocol, protocol_len, wrapper) ? SUCCESS : FAILURE;
}
PHPAPI int php_unregister_url_stream_wrapper_volatile(const char *protocol TSRMLS_DC)
@@ -1740,7 +1730,7 @@ PHPAPI int php_unregister_url_stream_wrapper_volatile(const char *protocol TSRML
clone_wrapper_hash(TSRMLS_C);
}
- return zend_hash_del(FG(stream_wrappers), protocol, strlen(protocol) + 1);
+ return zend_hash_str_del(FG(stream_wrappers), protocol, strlen(protocol));
}
/* }}} */
@@ -1748,7 +1738,7 @@ PHPAPI int php_unregister_url_stream_wrapper_volatile(const char *protocol TSRML
PHPAPI php_stream_wrapper *php_stream_locate_url_wrapper(const char *path, const char **path_for_open, int options TSRMLS_DC)
{
HashTable *wrapper_hash = (FG(stream_wrappers) ? FG(stream_wrappers) : &url_stream_wrappers_hash);
- php_stream_wrapper **wrapperpp = NULL;
+ php_stream_wrapper *wrapper = NULL;
const char *p, *protocol = NULL;
int n = 0;
@@ -1775,9 +1765,9 @@ PHPAPI php_stream_wrapper *php_stream_locate_url_wrapper(const char *path, const
if (protocol) {
char *tmp = estrndup(protocol, n);
- if (FAILURE == zend_hash_find(wrapper_hash, (char*)tmp, n + 1, (void**)&wrapperpp)) {
+ if (NULL == (wrapper = zend_hash_str_find_ptr(wrapper_hash, (char*)tmp, n))) {
php_strtolower(tmp, n);
- if (FAILURE == zend_hash_find(wrapper_hash, (char*)tmp, n + 1, (void**)&wrapperpp)) {
+ if (NULL == (wrapper = zend_hash_str_find_ptr(wrapper_hash, (char*)tmp, n))) {
char wrapper_name[32];
if (n >= sizeof(wrapper_name)) {
@@ -1787,7 +1777,7 @@ PHPAPI php_stream_wrapper *php_stream_locate_url_wrapper(const char *path, const
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find the wrapper \"%s\" - did you forget to enable it when you configured PHP?", wrapper_name);
- wrapperpp = NULL;
+ wrapper = NULL;
protocol = NULL;
}
}
@@ -1837,14 +1827,14 @@ PHPAPI php_stream_wrapper *php_stream_locate_url_wrapper(const char *path, const
if (FG(stream_wrappers)) {
/* The file:// wrapper may have been disabled/overridden */
- if (wrapperpp) {
+ if (wrapper) {
/* It was found so go ahead and provide it */
- return *wrapperpp;
+ return wrapper;
}
/* Check again, the original check might have not known the protocol name */
- if (zend_hash_find(wrapper_hash, "file", sizeof("file"), (void**)&wrapperpp) == SUCCESS) {
- return *wrapperpp;
+ if ((wrapper = zend_hash_str_find_ptr(wrapper_hash, "file", sizeof("file")-1)) != NULL) {
+ return wrapper;
}
if (options & REPORT_ERRORS) {
@@ -1856,7 +1846,7 @@ PHPAPI php_stream_wrapper *php_stream_locate_url_wrapper(const char *path, const
return plain_files_wrapper;
}
- if (wrapperpp && (*wrapperpp)->is_url &&
+ if (wrapper && wrapper->is_url &&
(options & STREAM_DISABLE_URL_PROTECTION) == 0 &&
(!PG(allow_url_fopen) ||
(((options & STREAM_OPEN_FOR_INCLUDE) ||
@@ -1874,7 +1864,7 @@ PHPAPI php_stream_wrapper *php_stream_locate_url_wrapper(const char *path, const
return NULL;
}
- return *wrapperpp;
+ return wrapper;
}
/* }}} */
@@ -2155,10 +2145,10 @@ PHPAPI php_stream_context *php_stream_context_set(php_stream *stream, php_stream
stream->context = context;
if (context) {
- zend_list_addref(context->rsrc_id);
+ context->res->gc.refcount++;
}
if (oldcontext) {
- zend_list_delete(oldcontext->rsrc_id);
+ zend_list_delete(oldcontext->res);
}
return oldcontext;
@@ -2173,9 +2163,9 @@ PHPAPI void php_stream_notification_notify(php_stream_context *context, int noti
PHPAPI void php_stream_context_free(php_stream_context *context)
{
- if (context->options) {
+ if (Z_TYPE(context->options) != IS_UNDEF) {
zval_ptr_dtor(&context->options);
- context->options = NULL;
+ ZVAL_UNDEF(&context->options);
}
if (context->notifier) {
php_stream_notification_free(context->notifier);
@@ -2190,10 +2180,9 @@ PHPAPI php_stream_context *php_stream_context_alloc(TSRMLS_D)
context = ecalloc(1, sizeof(php_stream_context));
context->notifier = NULL;
- MAKE_STD_ZVAL(context->options);
- array_init(context->options);
+ array_init(&context->options);
- context->rsrc_id = ZEND_REGISTER_RESOURCE(NULL, context, php_le_stream_context(TSRMLS_C));
+ context->res = ZEND_REGISTER_RESOURCE(NULL, context, php_le_stream_context(TSRMLS_C));
return context;
}
@@ -2210,38 +2199,34 @@ PHPAPI void php_stream_notification_free(php_stream_notifier *notifier)
efree(notifier);
}
-PHPAPI int php_stream_context_get_option(php_stream_context *context,
- const char *wrappername, const char *optionname, zval ***optionvalue)
+PHPAPI zval *php_stream_context_get_option(php_stream_context *context,
+ const char *wrappername, const char *optionname)
{
- zval **wrapperhash;
+ zval *wrapperhash;
- if (FAILURE == zend_hash_find(Z_ARRVAL_P(context->options), (char*)wrappername, strlen(wrappername)+1, (void**)&wrapperhash)) {
- return FAILURE;
+ if (NULL == (wrapperhash = zend_hash_str_find(Z_ARRVAL(context->options), wrappername, strlen(wrappername)))) {
+ return NULL;
}
- return zend_hash_find(Z_ARRVAL_PP(wrapperhash), (char*)optionname, strlen(optionname)+1, (void**)optionvalue);
+ return zend_hash_str_find(Z_ARRVAL_P(wrapperhash), optionname, strlen(optionname));
}
PHPAPI int php_stream_context_set_option(php_stream_context *context,
const char *wrappername, const char *optionname, zval *optionvalue)
{
- zval **wrapperhash;
- zval *category, *copied_val;
+ zval *wrapperhash;
+ zval category, copied_val;
- ALLOC_INIT_ZVAL(copied_val);
- *copied_val = *optionvalue;
- zval_copy_ctor(copied_val);
- INIT_PZVAL(copied_val);
+ ZVAL_DUP(&copied_val, optionvalue);
- if (FAILURE == zend_hash_find(Z_ARRVAL_P(context->options), (char*)wrappername, strlen(wrappername)+1, (void**)&wrapperhash)) {
- MAKE_STD_ZVAL(category);
- array_init(category);
- if (FAILURE == zend_hash_update(Z_ARRVAL_P(context->options), (char*)wrappername, strlen(wrappername)+1, (void**)&category, sizeof(zval *), NULL)) {
+ if (NULL == (wrapperhash = zend_hash_str_find(Z_ARRVAL(context->options), wrappername, strlen(wrappername)))) {
+ array_init(&category);
+ if (NULL == zend_hash_str_update(Z_ARRVAL(context->options), (char*)wrappername, strlen(wrappername), &category)) {
return FAILURE;
}
wrapperhash = &category;
}
- return zend_hash_update(Z_ARRVAL_PP(wrapperhash), (char*)optionname, strlen(optionname)+1, (void**)&copied_val, sizeof(zval *), NULL);
+ return zend_hash_str_update(Z_ARRVAL_P(wrapperhash), optionname, strlen(optionname), &copied_val) ? SUCCESS : FAILURE;
}
/* }}} */
diff --git a/main/streams/transports.c b/main/streams/transports.c
index f54e8e6cdf..6588cb947e 100644
--- a/main/streams/transports.c
+++ b/main/streams/transports.c
@@ -31,12 +31,12 @@ PHPAPI HashTable *php_stream_xport_get_hash(void)
PHPAPI int php_stream_xport_register(const char *protocol, php_stream_transport_factory factory TSRMLS_DC)
{
- return zend_hash_update(&xport_hash, protocol, strlen(protocol) + 1, &factory, sizeof(factory), NULL);
+ return zend_hash_str_update_ptr(&xport_hash, protocol, strlen(protocol), factory) ? SUCCESS : FAILURE;
}
PHPAPI int php_stream_xport_unregister(const char *protocol TSRMLS_DC)
{
- return zend_hash_del(&xport_hash, protocol, strlen(protocol) + 1);
+ return zend_hash_str_del(&xport_hash, protocol, strlen(protocol));
}
#define ERR_REPORT(out_err, fmt, arg) \
@@ -107,7 +107,7 @@ PHPAPI php_stream *_php_stream_xport_create(const char *name, size_t namelen, in
if (protocol) {
char *tmp = estrndup(protocol, n);
- if (FAILURE == zend_hash_find(&xport_hash, (char*)tmp, n + 1, (void**)&factory)) {
+ if (NULL == (factory = zend_hash_str_find_ptr(&xport_hash, tmp, n))) {
char wrapper_name[32];
if (n >= sizeof(wrapper_name))
@@ -157,16 +157,16 @@ PHPAPI php_stream *_php_stream_xport_create(const char *name, size_t namelen, in
ERR_RETURN(error_string, error_text, "bind() failed: %s");
failed = 1;
} else if (flags & STREAM_XPORT_LISTEN) {
- zval **zbacklog = NULL;
+ zval *zbacklog = NULL;
int backlog = 32;
- if (stream->context && php_stream_context_get_option(stream->context, "socket", "backlog", &zbacklog) == SUCCESS) {
- zval *ztmp = *zbacklog;
+ if (stream->context && (zbacklog = php_stream_context_get_option(stream->context, "socket", "backlog")) != NULL) {
+ zval *ztmp = zbacklog;
- convert_to_long_ex(&ztmp);
+ convert_to_long_ex(ztmp);
backlog = Z_LVAL_P(ztmp);
- if (ztmp != *zbacklog) {
- zval_ptr_dtor(&ztmp);
+ if (ztmp != zbacklog) {
+ zval_ptr_dtor(ztmp);
}
}
diff --git a/main/streams/userspace.c b/main/streams/userspace.c
index 7d958729e5..6629a3fd86 100644
--- a/main/streams/userspace.c
+++ b/main/streams/userspace.c
@@ -70,7 +70,7 @@ static php_stream_wrapper_ops user_stream_wops = {
};
-static void stream_wrapper_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC)
+static void stream_wrapper_dtor(zend_resource *rsrc TSRMLS_DC)
{
struct php_user_stream_wrapper * uwrap = (struct php_user_stream_wrapper*)rsrc->ptr;
@@ -281,18 +281,15 @@ typedef struct _php_userstream_data php_userstream_data_t;
}}} **/
-static zval *user_stream_create_object(struct php_user_stream_wrapper *uwrap, php_stream_context *context TSRMLS_DC)
+static zval *user_stream_create_object(struct php_user_stream_wrapper *uwrap, php_stream_context *context, zval *object TSRMLS_DC)
{
- zval *object;
/* create an instance of our class */
- ALLOC_ZVAL(object);
object_init_ex(object, uwrap->ce);
- Z_SET_REFCOUNT_P(object, 1);
- Z_SET_ISREF_P(object);
+//??? Z_SET_ISREF_P(object);
if (context) {
- add_property_resource(object, "context", context->rsrc_id);
- zend_list_addref(context->rsrc_id);
+ add_property_resource(object, "context", context->res);
+ context->res->gc.refcount++;
} else {
add_property_null(object, "context");
}
@@ -300,14 +297,14 @@ static zval *user_stream_create_object(struct php_user_stream_wrapper *uwrap, ph
if (uwrap->ce->constructor) {
zend_fcall_info fci;
zend_fcall_info_cache fcc;
- zval *retval_ptr;
+ zval retval;
fci.size = sizeof(fci);
fci.function_table = &uwrap->ce->function_table;
- fci.function_name = NULL;
+ ZVAL_UNDEF(&fci.function_name);
fci.symbol_table = NULL;
fci.object_ptr = object;
- fci.retval_ptr_ptr = &retval_ptr;
+ fci.retval = &retval;
fci.param_count = 0;
fci.params = NULL;
fci.no_separation = 1;
@@ -319,14 +316,12 @@ static zval *user_stream_create_object(struct php_user_stream_wrapper *uwrap, ph
fcc.object_ptr = object;
if (zend_call_function(&fci, &fcc TSRMLS_CC) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not execute %s::%s()", uwrap->ce->name, uwrap->ce->constructor->common.function_name);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not execute %s::%s()", uwrap->ce->name->val, uwrap->ce->constructor->common.function_name->val);
zval_dtor(object);
- FREE_ZVAL(object);
+ ZVAL_UNDEF(object);
return NULL;
} else {
- if (retval_ptr) {
- zval_ptr_dtor(&retval_ptr);
- }
+ zval_ptr_dtor(&retval);
}
}
return object;
@@ -335,10 +330,11 @@ static zval *user_stream_create_object(struct php_user_stream_wrapper *uwrap, ph
static php_stream *user_wrapper_opener(php_stream_wrapper *wrapper, const char *filename, const char *mode,
int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC)
{
+ zval object;
struct php_user_stream_wrapper *uwrap = (struct php_user_stream_wrapper*)wrapper->abstract;
php_userstream_data_t *us;
- zval *zfilename, *zmode, *zopened, *zoptions, *zretval = NULL, *zfuncname;
- zval **args[4];
+ zval zretval, zfuncname;
+ zval args[4];
int call_result;
php_stream *stream = NULL;
zend_bool old_in_user_include;
@@ -364,7 +360,7 @@ static php_stream *user_wrapper_opener(php_stream_wrapper *wrapper, const char *
us = emalloc(sizeof(*us));
us->wrapper = uwrap;
- us->object = user_stream_create_object(uwrap, context TSRMLS_CC);
+ us->object = user_stream_create_object(uwrap, context, &object TSRMLS_CC);
if(us->object == NULL) {
FG(user_stream_current_filename) = NULL;
PG(in_user_include) = old_in_user_include;
@@ -373,46 +369,31 @@ static php_stream *user_wrapper_opener(php_stream_wrapper *wrapper, const char *
}
/* call it's stream_open method - set up params first */
- MAKE_STD_ZVAL(zfilename);
- ZVAL_STRING(zfilename, filename, 1);
- args[0] = &zfilename;
-
- MAKE_STD_ZVAL(zmode);
- ZVAL_STRING(zmode, mode, 1);
- args[1] = &zmode;
-
- MAKE_STD_ZVAL(zoptions);
- ZVAL_LONG(zoptions, options);
- args[2] = &zoptions;
+ ZVAL_STRING(&args[0], filename);
+ ZVAL_STRING(&args[1], mode);
+ ZVAL_LONG(&args[2], options);
+ ZVAL_NEW_REF(&args[3], &EG(uninitialized_zval));
- MAKE_STD_ZVAL(zopened);
- Z_SET_REFCOUNT_P(zopened, 1);
- Z_SET_ISREF_P(zopened);
- ZVAL_NULL(zopened);
- args[3] = &zopened;
-
- MAKE_STD_ZVAL(zfuncname);
- ZVAL_STRING(zfuncname, USERSTREAM_OPEN, 1);
+ ZVAL_STRING(&zfuncname, USERSTREAM_OPEN);
call_result = call_user_function_ex(NULL,
- &us->object,
- zfuncname,
+ us->object,
+ &zfuncname,
&zretval,
4, args,
0, NULL TSRMLS_CC);
- if (call_result == SUCCESS && zretval != NULL && zval_is_true(zretval)) {
+ if (call_result == SUCCESS && Z_TYPE(zretval) != IS_UNDEF && zval_is_true(&zretval)) {
/* the stream is now open! */
stream = php_stream_alloc_rel(&php_stream_userspace_ops, us, 0, mode);
/* if the opened path is set, copy it out */
- if (Z_TYPE_P(zopened) == IS_STRING && opened_path) {
- *opened_path = estrndup(Z_STRVAL_P(zopened), Z_STRLEN_P(zopened));
+ if (Z_TYPE(args[4]) == IS_REFERENCE && Z_TYPE_P(Z_REFVAL(args[4])) == IS_STRING && opened_path) {
+ *opened_path = estrndup(Z_STRVAL_P(Z_REFVAL(args[4])), Z_STRLEN_P(Z_REFVAL(args[4])));
}
/* set wrapper data to be a reference to our object */
- stream->wrapperdata = us->object;
- zval_add_ref(&stream->wrapperdata);
+ ZVAL_COPY(&stream->wrapperdata, us->object);
} else {
php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "\"%s::" USERSTREAM_OPEN "\" call failed",
us->wrapper->classname);
@@ -420,17 +401,15 @@ static php_stream *user_wrapper_opener(php_stream_wrapper *wrapper, const char *
/* destroy everything else */
if (stream == NULL) {
- zval_ptr_dtor(&us->object);
+ zval_ptr_dtor(us->object);
efree(us);
}
- if (zretval)
- zval_ptr_dtor(&zretval);
-
+ zval_ptr_dtor(&zretval);
zval_ptr_dtor(&zfuncname);
- zval_ptr_dtor(&zopened);
- zval_ptr_dtor(&zoptions);
- zval_ptr_dtor(&zmode);
- zval_ptr_dtor(&zfilename);
+ zval_ptr_dtor(&args[4]);
+ zval_ptr_dtor(&args[3]);
+ zval_ptr_dtor(&args[2]);
+ zval_ptr_dtor(&args[1]);
FG(user_stream_current_filename) = NULL;
@@ -441,10 +420,11 @@ static php_stream *user_wrapper_opener(php_stream_wrapper *wrapper, const char *
static php_stream *user_wrapper_opendir(php_stream_wrapper *wrapper, const char *filename, const char *mode,
int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC)
{
+ zval object;
struct php_user_stream_wrapper *uwrap = (struct php_user_stream_wrapper*)wrapper->abstract;
php_userstream_data_t *us;
- zval *zfilename, *zoptions, *zretval = NULL, *zfuncname;
- zval **args[2];
+ zval zretval, zfuncname;
+ zval args[2];
int call_result;
php_stream *stream = NULL;
@@ -458,7 +438,7 @@ static php_stream *user_wrapper_opendir(php_stream_wrapper *wrapper, const char
us = emalloc(sizeof(*us));
us->wrapper = uwrap;
- us->object = user_stream_create_object(uwrap, context TSRMLS_CC);
+ us->object = user_stream_create_object(uwrap, context, &object TSRMLS_CC);
if(us->object == NULL) {
FG(user_stream_current_filename) = NULL;
efree(us);
@@ -466,31 +446,24 @@ static php_stream *user_wrapper_opendir(php_stream_wrapper *wrapper, const char
}
/* call it's dir_open method - set up params first */
- MAKE_STD_ZVAL(zfilename);
- ZVAL_STRING(zfilename, filename, 1);
- args[0] = &zfilename;
-
- MAKE_STD_ZVAL(zoptions);
- ZVAL_LONG(zoptions, options);
- args[1] = &zoptions;
+ ZVAL_STRING(&args[0], filename);
+ ZVAL_LONG(&args[1], options);
- MAKE_STD_ZVAL(zfuncname);
- ZVAL_STRING(zfuncname, USERSTREAM_DIR_OPEN, 1);
+ ZVAL_STRING(&zfuncname, USERSTREAM_DIR_OPEN);
call_result = call_user_function_ex(NULL,
- &us->object,
- zfuncname,
+ us->object,
+ &zfuncname,
&zretval,
2, args,
0, NULL TSRMLS_CC);
- if (call_result == SUCCESS && zretval != NULL && zval_is_true(zretval)) {
+ if (call_result == SUCCESS && Z_TYPE(zretval) != IS_UNDEF && zval_is_true(&zretval)) {
/* the stream is now open! */
stream = php_stream_alloc_rel(&php_stream_userspace_dir_ops, us, 0, mode);
/* set wrapper data to be a reference to our object */
- stream->wrapperdata = us->object;
- zval_add_ref(&stream->wrapperdata);
+ ZVAL_COPY(&stream->wrapperdata, us->object);
} else {
php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "\"%s::" USERSTREAM_DIR_OPEN "\" call failed",
us->wrapper->classname);
@@ -498,15 +471,14 @@ static php_stream *user_wrapper_opendir(php_stream_wrapper *wrapper, const char
/* destroy everything else */
if (stream == NULL) {
- zval_ptr_dtor(&us->object);
+ zval_ptr_dtor(us->object);
efree(us);
}
- if (zretval)
- zval_ptr_dtor(&zretval);
+ zval_ptr_dtor(&zretval);
zval_ptr_dtor(&zfuncname);
- zval_ptr_dtor(&zoptions);
- zval_ptr_dtor(&zfilename);
+ zval_ptr_dtor(&args[1]);
+ zval_ptr_dtor(&args[0]);
FG(user_stream_current_filename) = NULL;
@@ -518,43 +490,41 @@ static php_stream *user_wrapper_opendir(php_stream_wrapper *wrapper, const char
Registers a custom URL protocol handler class */
PHP_FUNCTION(stream_wrapper_register)
{
- char *protocol, *classname;
- int protocol_len, classname_len;
+ zend_string *protocol, *classname;
struct php_user_stream_wrapper * uwrap;
- int rsrc_id;
+ zend_resource *rsrc;
long flags = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", &protocol, &protocol_len, &classname, &classname_len, &flags) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|l", &protocol, &classname, &flags) == FAILURE) {
RETURN_FALSE;
}
uwrap = (struct php_user_stream_wrapper *)ecalloc(1, sizeof(*uwrap));
- uwrap->protoname = estrndup(protocol, protocol_len);
- uwrap->classname = estrndup(classname, classname_len);
+ uwrap->protoname = estrndup(protocol->val, protocol->len);
+ uwrap->classname = estrndup(classname->val, classname->len);
uwrap->wrapper.wops = &user_stream_wops;
uwrap->wrapper.abstract = uwrap;
uwrap->wrapper.is_url = ((flags & PHP_STREAM_IS_URL) != 0);
- rsrc_id = ZEND_REGISTER_RESOURCE(NULL, uwrap, le_protocols);
+ rsrc = ZEND_REGISTER_RESOURCE(NULL, uwrap, le_protocols);
- if (zend_lookup_class(uwrap->classname, classname_len, (zend_class_entry***)&uwrap->ce TSRMLS_CC) == SUCCESS) {
- uwrap->ce = *(zend_class_entry**)uwrap->ce;
- if (php_register_url_stream_wrapper_volatile(protocol, &uwrap->wrapper TSRMLS_CC) == SUCCESS) {
+ if ((uwrap->ce = zend_lookup_class(classname TSRMLS_CC)) != NULL) {
+ if (php_register_url_stream_wrapper_volatile(protocol->val, &uwrap->wrapper TSRMLS_CC) == SUCCESS) {
RETURN_TRUE;
} else {
/* We failed. But why? */
- if (zend_hash_exists(php_stream_get_url_stream_wrappers_hash(), protocol, protocol_len + 1)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Protocol %s:// is already defined.", protocol);
+ if (zend_hash_exists(php_stream_get_url_stream_wrappers_hash(), protocol)) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Protocol %s:// is already defined.", protocol->val);
} else {
/* Hash doesn't exist so it must have been an invalid protocol scheme */
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid protocol scheme specified. Unable to register wrapper class %s to %s://", classname, protocol);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid protocol scheme specified. Unable to register wrapper class %s to %s://", classname->val, protocol->val);
}
}
} else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "class '%s' is undefined", classname);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "class '%s' is undefined", classname->val);
}
- zend_list_delete(rsrc_id);
+ zend_list_delete(rsrc);
RETURN_FALSE;
}
/* }}} */
@@ -584,34 +554,30 @@ PHP_FUNCTION(stream_wrapper_unregister)
Restore the original protocol handler, overriding if necessary */
PHP_FUNCTION(stream_wrapper_restore)
{
- char *protocol;
- int protocol_len;
- php_stream_wrapper **wrapperpp = NULL, *wrapper;
+ zend_string *protocol;
+ php_stream_wrapper *wrapper;
HashTable *global_wrapper_hash;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &protocol, &protocol_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &protocol) == FAILURE) {
RETURN_FALSE;
}
global_wrapper_hash = php_stream_get_url_stream_wrappers_hash_global();
if (php_stream_get_url_stream_wrappers_hash() == global_wrapper_hash) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%s:// was never changed, nothing to restore", protocol);
+ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%s:// was never changed, nothing to restore", protocol->val);
RETURN_TRUE;
}
- if ((zend_hash_find(global_wrapper_hash, protocol, protocol_len + 1, (void**)&wrapperpp) == FAILURE) || !wrapperpp) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s:// never existed, nothing to restore", protocol);
+ if ((wrapper = zend_hash_find_ptr(global_wrapper_hash, protocol)) == NULL) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s:// never existed, nothing to restore", protocol->val);
RETURN_FALSE;
}
- /* next line might delete the pointer that wrapperpp points at, so deref it now */
- wrapper = *wrapperpp;
-
/* A failure here could be okay given that the protocol might have been merely unregistered */
- php_unregister_url_stream_wrapper_volatile(protocol TSRMLS_CC);
+ php_unregister_url_stream_wrapper_volatile(protocol->val TSRMLS_CC);
- if (php_register_url_stream_wrapper_volatile(protocol, wrapper TSRMLS_CC) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to restore original %s:// wrapper", protocol);
+ if (php_register_url_stream_wrapper_volatile(protocol->val, wrapper TSRMLS_CC) == FAILURE) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to restore original %s:// wrapper", protocol->val);
RETURN_FALSE;
}
@@ -622,33 +588,31 @@ PHP_FUNCTION(stream_wrapper_restore)
static size_t php_userstreamop_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC)
{
zval func_name;
- zval *retval = NULL;
+ zval retval;
int call_result;
php_userstream_data_t *us = (php_userstream_data_t *)stream->abstract;
- zval **args[1];
- zval *zbufptr;
+ zval args[1];
size_t didwrite = 0;
assert(us != NULL);
- ZVAL_STRINGL(&func_name, USERSTREAM_WRITE, sizeof(USERSTREAM_WRITE)-1, 0);
+//??? ZVAL_STRINGL(&func_name, USERSTREAM_WRITE, sizeof(USERSTREAM_WRITE)-1, 0);
+ ZVAL_STRINGL(&func_name, USERSTREAM_WRITE, sizeof(USERSTREAM_WRITE)-1);
- MAKE_STD_ZVAL(zbufptr);
- ZVAL_STRINGL(zbufptr, (char*)buf, count, 1);;
- args[0] = &zbufptr;
+ ZVAL_STRINGL(&args[0], (char*)buf, count);
call_result = call_user_function_ex(NULL,
- &us->object,
+ us->object,
&func_name,
&retval,
1, args,
0, NULL TSRMLS_CC);
- zval_ptr_dtor(&zbufptr);
+ zval_ptr_dtor(&args[0]);
didwrite = 0;
- if (call_result == SUCCESS && retval != NULL) {
- convert_to_long(retval);
- didwrite = Z_LVAL_P(retval);
+ if (call_result == SUCCESS && Z_TYPE(retval) != IS_UNDEF) {
+ convert_to_long(&retval);
+ didwrite = Z_LVAL(retval);
} else if (call_result == FAILURE) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_WRITE " is not implemented!",
us->wrapper->classname);
@@ -662,8 +626,7 @@ static size_t php_userstreamop_write(php_stream *stream, const char *buf, size_t
didwrite = count;
}
- if (retval)
- zval_ptr_dtor(&retval);
+ zval_ptr_dtor(&retval);
return didwrite;
}
@@ -671,60 +634,57 @@ static size_t php_userstreamop_write(php_stream *stream, const char *buf, size_t
static size_t php_userstreamop_read(php_stream *stream, char *buf, size_t count TSRMLS_DC)
{
zval func_name;
- zval *retval = NULL;
- zval **args[1];
+ zval retval;
+ zval args[1];
int call_result;
size_t didread = 0;
php_userstream_data_t *us = (php_userstream_data_t *)stream->abstract;
- zval *zcount;
assert(us != NULL);
- ZVAL_STRINGL(&func_name, USERSTREAM_READ, sizeof(USERSTREAM_READ)-1, 0);
+//??? ZVAL_STRINGL(&func_name, USERSTREAM_READ, sizeof(USERSTREAM_READ)-1, 0);
+ ZVAL_STRINGL(&func_name, USERSTREAM_READ, sizeof(USERSTREAM_READ)-1);
- MAKE_STD_ZVAL(zcount);
- ZVAL_LONG(zcount, count);
- args[0] = &zcount;
+ ZVAL_LONG(&args[0], count);
call_result = call_user_function_ex(NULL,
- &us->object,
+ us->object,
&func_name,
&retval,
1, args,
0, NULL TSRMLS_CC);
- if (call_result == SUCCESS && retval != NULL) {
- convert_to_string(retval);
- didread = Z_STRLEN_P(retval);
+ if (call_result == SUCCESS && Z_TYPE(retval) != IS_UNDEF) {
+ convert_to_string(&retval);
+ didread = Z_STRLEN(retval);
if (didread > count) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_READ " - read %ld bytes more data than requested (%ld read, %ld max) - excess data will be lost",
us->wrapper->classname, (long)(didread - count), (long)didread, (long)count);
didread = count;
}
if (didread > 0)
- memcpy(buf, Z_STRVAL_P(retval), didread);
+ memcpy(buf, Z_STRVAL(retval), didread);
} else if (call_result == FAILURE) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_READ " is not implemented!",
us->wrapper->classname);
}
- zval_ptr_dtor(&zcount);
+ zval_ptr_dtor(&args[0]);
- if (retval) {
- zval_ptr_dtor(&retval);
- retval = NULL;
- }
+ zval_ptr_dtor(&retval);
+ ZVAL_UNDEF(&retval);
/* since the user stream has no way of setting the eof flag directly, we need to ask it if we hit eof */
- ZVAL_STRINGL(&func_name, USERSTREAM_EOF, sizeof(USERSTREAM_EOF)-1, 0);
+//??? ZVAL_STRINGL(&func_name, USERSTREAM_EOF, sizeof(USERSTREAM_EOF)-1, 0);
+ ZVAL_STRINGL(&func_name, USERSTREAM_EOF, sizeof(USERSTREAM_EOF)-1);
call_result = call_user_function_ex(NULL,
- &us->object,
+ us->object,
&func_name,
&retval,
0, NULL, 0, NULL TSRMLS_CC);
- if (call_result == SUCCESS && retval != NULL && zval_is_true(retval)) {
+ if (call_result == SUCCESS && Z_TYPE(retval) != IS_UNDEF && zval_is_true(&retval)) {
stream->eof = 1;
} else if (call_result == FAILURE) {
php_error_docref(NULL TSRMLS_CC, E_WARNING,
@@ -734,10 +694,7 @@ static size_t php_userstreamop_read(php_stream *stream, char *buf, size_t count
stream->eof = 1;
}
- if (retval) {
- zval_ptr_dtor(&retval);
- retval = NULL;
- }
+ zval_ptr_dtor(&retval);
return didread;
}
@@ -745,23 +702,23 @@ static size_t php_userstreamop_read(php_stream *stream, char *buf, size_t count
static int php_userstreamop_close(php_stream *stream, int close_handle TSRMLS_DC)
{
zval func_name;
- zval *retval = NULL;
+ zval retval;
php_userstream_data_t *us = (php_userstream_data_t *)stream->abstract;
assert(us != NULL);
- ZVAL_STRINGL(&func_name, USERSTREAM_CLOSE, sizeof(USERSTREAM_CLOSE)-1, 0);
+//??? ZVAL_STRINGL(&func_name, USERSTREAM_CLOSE, sizeof(USERSTREAM_CLOSE)-1, 0);
+ ZVAL_STRINGL(&func_name, USERSTREAM_CLOSE, sizeof(USERSTREAM_CLOSE)-1);
call_user_function_ex(NULL,
- &us->object,
+ us->object,
&func_name,
&retval,
0, NULL, 0, NULL TSRMLS_CC);
- if (retval)
- zval_ptr_dtor(&retval);
+ zval_ptr_dtor(&retval);
- zval_ptr_dtor(&us->object);
+ zval_ptr_dtor(us->object);
efree(us);
@@ -771,27 +728,27 @@ static int php_userstreamop_close(php_stream *stream, int close_handle TSRMLS_DC
static int php_userstreamop_flush(php_stream *stream TSRMLS_DC)
{
zval func_name;
- zval *retval = NULL;
+ zval retval;
int call_result;
php_userstream_data_t *us = (php_userstream_data_t *)stream->abstract;
assert(us != NULL);
- ZVAL_STRINGL(&func_name, USERSTREAM_FLUSH, sizeof(USERSTREAM_FLUSH)-1, 0);
+//??? ZVAL_STRINGL(&func_name, USERSTREAM_FLUSH, sizeof(USERSTREAM_FLUSH)-1, 0);
+ ZVAL_STRINGL(&func_name, USERSTREAM_FLUSH, sizeof(USERSTREAM_FLUSH)-1);
call_result = call_user_function_ex(NULL,
- &us->object,
+ us->object,
&func_name,
&retval,
0, NULL, 0, NULL TSRMLS_CC);
- if (call_result == SUCCESS && retval != NULL && zval_is_true(retval))
+ if (call_result == SUCCESS && Z_TYPE(retval) != IS_UNDEF && zval_is_true(&retval))
call_result = 0;
else
call_result = -1;
- if (retval)
- zval_ptr_dtor(&retval);
+ zval_ptr_dtor(&retval);
return call_result;
}
@@ -799,69 +756,62 @@ static int php_userstreamop_flush(php_stream *stream TSRMLS_DC)
static int php_userstreamop_seek(php_stream *stream, off_t offset, int whence, off_t *newoffs TSRMLS_DC)
{
zval func_name;
- zval *retval = NULL;
+ zval retval;
int call_result, ret;
php_userstream_data_t *us = (php_userstream_data_t *)stream->abstract;
- zval **args[2];
- zval *zoffs, *zwhence;
+ zval args[2];
assert(us != NULL);
- ZVAL_STRINGL(&func_name, USERSTREAM_SEEK, sizeof(USERSTREAM_SEEK)-1, 0);
+//??? ZVAL_STRINGL(&func_name, USERSTREAM_SEEK, sizeof(USERSTREAM_SEEK)-1, 0);
+ ZVAL_STRINGL(&func_name, USERSTREAM_SEEK, sizeof(USERSTREAM_SEEK)-1);
- MAKE_STD_ZVAL(zoffs);
- ZVAL_LONG(zoffs, offset);
- args[0] = &zoffs;
-
- MAKE_STD_ZVAL(zwhence);
- ZVAL_LONG(zwhence, whence);
- args[1] = &zwhence;
+ ZVAL_LONG(&args[0], offset);
+ ZVAL_LONG(&args[1], whence);
call_result = call_user_function_ex(NULL,
- &us->object,
+ us->object,
&func_name,
&retval,
2, args,
0, NULL TSRMLS_CC);
- zval_ptr_dtor(&zoffs);
- zval_ptr_dtor(&zwhence);
+ zval_ptr_dtor(&args[0]);
+ zval_ptr_dtor(&args[1]);
if (call_result == FAILURE) {
/* stream_seek is not implemented, so disable seeks for this stream */
stream->flags |= PHP_STREAM_FLAG_NO_SEEK;
/* there should be no retval to clean up */
- if (retval)
- zval_ptr_dtor(&retval);
+ zval_ptr_dtor(&retval);
return -1;
- } else if (call_result == SUCCESS && retval != NULL && zval_is_true(retval)) {
+ } else if (call_result == SUCCESS && Z_TYPE(retval) != IS_UNDEF && zval_is_true(&retval)) {
ret = 0;
} else {
ret = -1;
}
- if (retval) {
- zval_ptr_dtor(&retval);
- retval = NULL;
- }
+ zval_ptr_dtor(&retval);
+ ZVAL_UNDEF(&retval);
if (ret) {
return ret;
}
/* now determine where we are */
- ZVAL_STRINGL(&func_name, USERSTREAM_TELL, sizeof(USERSTREAM_TELL)-1, 0);
+//??? ZVAL_STRINGL(&func_name, USERSTREAM_TELL, sizeof(USERSTREAM_TELL)-1, 0);
+ ZVAL_STRINGL(&func_name, USERSTREAM_TELL, sizeof(USERSTREAM_TELL)-1);
call_result = call_user_function_ex(NULL,
- &us->object,
+ us->object,
&func_name,
&retval,
0, NULL, 0, NULL TSRMLS_CC);
- if (call_result == SUCCESS && retval != NULL && Z_TYPE_P(retval) == IS_LONG) {
- *newoffs = Z_LVAL_P(retval);
+ if (call_result == SUCCESS && Z_TYPE(retval) == IS_LONG) {
+ *newoffs = Z_LVAL(retval);
ret = 0;
} else if (call_result == FAILURE) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_TELL " is not implemented!", us->wrapper->classname);
@@ -870,9 +820,7 @@ static int php_userstreamop_seek(php_stream *stream, off_t offset, int whence, o
ret = -1;
}
- if (retval) {
- zval_ptr_dtor(&retval);
- }
+ zval_ptr_dtor(&retval);
return ret;
}
@@ -880,13 +828,13 @@ static int php_userstreamop_seek(php_stream *stream, off_t offset, int whence, o
* relevant fields into the statbuf provided */
static int statbuf_from_array(zval *array, php_stream_statbuf *ssb TSRMLS_DC)
{
- zval **elem;
+ zval *elem;
#define STAT_PROP_ENTRY_EX(name, name2) \
- if (SUCCESS == zend_hash_find(Z_ARRVAL_P(array), #name, sizeof(#name), (void**)&elem)) { \
+ if (NULL != (elem = zend_hash_str_find(Z_ARRVAL_P(array), #name, sizeof(#name)-1))) { \
SEPARATE_ZVAL(elem); \
- convert_to_long(*elem); \
- ssb->sb.st_##name2 = Z_LVAL_PP(elem); \
+ convert_to_long(elem); \
+ ssb->sb.st_##name2 = Z_LVAL_P(elem); \
}
#define STAT_PROP_ENTRY(name) STAT_PROP_ENTRY_EX(name,name)
@@ -926,21 +874,22 @@ static int statbuf_from_array(zval *array, php_stream_statbuf *ssb TSRMLS_DC)
static int php_userstreamop_stat(php_stream *stream, php_stream_statbuf *ssb TSRMLS_DC)
{
zval func_name;
- zval *retval = NULL;
+ zval retval;
int call_result;
php_userstream_data_t *us = (php_userstream_data_t *)stream->abstract;
int ret = -1;
- ZVAL_STRINGL(&func_name, USERSTREAM_STAT, sizeof(USERSTREAM_STAT)-1, 0);
+//??? ZVAL_STRINGL(&func_name, USERSTREAM_STAT, sizeof(USERSTREAM_STAT)-1, 0);
+ ZVAL_STRINGL(&func_name, USERSTREAM_STAT, sizeof(USERSTREAM_STAT)-1);
call_result = call_user_function_ex(NULL,
- &us->object,
+ us->object,
&func_name,
&retval,
0, NULL, 0, NULL TSRMLS_CC);
- if (call_result == SUCCESS && retval != NULL && Z_TYPE_P(retval) == IS_ARRAY) {
- if (SUCCESS == statbuf_from_array(retval, ssb TSRMLS_CC))
+ if (call_result == SUCCESS && Z_TYPE(retval) == IS_ARRAY) {
+ if (SUCCESS == statbuf_from_array(&retval, ssb TSRMLS_CC))
ret = 0;
} else {
if (call_result == FAILURE) {
@@ -949,8 +898,7 @@ static int php_userstreamop_stat(php_stream *stream, php_stream_statbuf *ssb TSR
}
}
- if (retval)
- zval_ptr_dtor(&retval);
+ zval_ptr_dtor(&retval);
return ret;
}
@@ -958,19 +906,19 @@ static int php_userstreamop_stat(php_stream *stream, php_stream_statbuf *ssb TSR
static int php_userstreamop_set_option(php_stream *stream, int option, int value, void *ptrparam TSRMLS_DC) {
zval func_name;
- zval *retval = NULL;
+ zval retval;
int call_result;
php_userstream_data_t *us = (php_userstream_data_t *)stream->abstract;
int ret = PHP_STREAM_OPTION_RETURN_NOTIMPL;
- zval *zvalue = NULL;
- zval **args[3];
+ zval args[3];
switch (option) {
case PHP_STREAM_OPTION_CHECK_LIVENESS:
- ZVAL_STRINGL(&func_name, USERSTREAM_EOF, sizeof(USERSTREAM_EOF)-1, 0);
- call_result = call_user_function_ex(NULL, &us->object, &func_name, &retval, 0, NULL, 0, NULL TSRMLS_CC);
- if (call_result == SUCCESS && retval != NULL && Z_TYPE_P(retval) == IS_BOOL) {
- ret = zval_is_true(retval) ? PHP_STREAM_OPTION_RETURN_ERR : PHP_STREAM_OPTION_RETURN_OK;
+//??? ZVAL_STRINGL(&func_name, USERSTREAM_EOF, sizeof(USERSTREAM_EOF)-1, 0);
+ ZVAL_STRINGL(&func_name, USERSTREAM_EOF, sizeof(USERSTREAM_EOF)-1);
+ call_result = call_user_function_ex(NULL, us->object, &func_name, &retval, 0, NULL, 0, NULL TSRMLS_CC);
+ if (call_result == SUCCESS && Z_TYPE(retval) == IS_BOOL) {
+ ret = zval_is_true(&retval) ? PHP_STREAM_OPTION_RETURN_ERR : PHP_STREAM_OPTION_RETURN_OK;
} else {
ret = PHP_STREAM_OPTION_RETURN_ERR;
php_error_docref(NULL TSRMLS_CC, E_WARNING,
@@ -980,37 +928,35 @@ static int php_userstreamop_set_option(php_stream *stream, int option, int value
break;
case PHP_STREAM_OPTION_LOCKING:
- MAKE_STD_ZVAL(zvalue);
- ZVAL_LONG(zvalue, 0);
+ ZVAL_LONG(&args[0], 0);
if (value & LOCK_NB) {
- Z_LVAL_P(zvalue) |= PHP_LOCK_NB;
+ Z_LVAL_P(&args[0]) |= PHP_LOCK_NB;
}
switch(value & ~LOCK_NB) {
case LOCK_SH:
- Z_LVAL_P(zvalue) |= PHP_LOCK_SH;
+ Z_LVAL_P(&args[0]) |= PHP_LOCK_SH;
break;
case LOCK_EX:
- Z_LVAL_P(zvalue) |= PHP_LOCK_EX;
+ Z_LVAL_P(&args[0]) |= PHP_LOCK_EX;
break;
case LOCK_UN:
- Z_LVAL_P(zvalue) |= PHP_LOCK_UN;
+ Z_LVAL_P(&args[0]) |= PHP_LOCK_UN;
break;
}
- args[0] = &zvalue;
-
/* TODO wouldblock */
- ZVAL_STRINGL(&func_name, USERSTREAM_LOCK, sizeof(USERSTREAM_LOCK)-1, 0);
+//??? ZVAL_STRINGL(&func_name, USERSTREAM_LOCK, sizeof(USERSTREAM_LOCK)-1, 0);
+ ZVAL_STRINGL(&func_name, USERSTREAM_LOCK, sizeof(USERSTREAM_LOCK)-1);
call_result = call_user_function_ex(NULL,
- &us->object,
+ us->object,
&func_name,
&retval,
1, args, 0, NULL TSRMLS_CC);
- if (call_result == SUCCESS && retval != NULL && Z_TYPE_P(retval) == IS_BOOL) {
- ret = !Z_LVAL_P(retval);
+ if (call_result == SUCCESS && Z_TYPE(retval) == IS_BOOL) {
+ ret = !Z_LVAL(retval);
} else if (call_result == FAILURE) {
if (value == 0) {
/* lock support test (TODO: more check) */
@@ -1025,7 +971,8 @@ static int php_userstreamop_set_option(php_stream *stream, int option, int value
break;
case PHP_STREAM_OPTION_TRUNCATE_API:
- ZVAL_STRINGL(&func_name, USERSTREAM_TRUNCATE, sizeof(USERSTREAM_TRUNCATE)-1, 0);
+//??? ZVAL_STRINGL(&func_name, USERSTREAM_TRUNCATE, sizeof(USERSTREAM_TRUNCATE)-1, 0);
+ ZVAL_STRINGL(&func_name, USERSTREAM_TRUNCATE, sizeof(USERSTREAM_TRUNCATE)-1);
switch (value) {
case PHP_STREAM_TRUNCATE_SUPPORTED:
@@ -1039,18 +986,16 @@ static int php_userstreamop_set_option(php_stream *stream, int option, int value
case PHP_STREAM_TRUNCATE_SET_SIZE: {
ptrdiff_t new_size = *(ptrdiff_t*) ptrparam;
if (new_size >= 0 && new_size <= (ptrdiff_t)LONG_MAX) {
- MAKE_STD_ZVAL(zvalue);
- ZVAL_LONG(zvalue, (long)new_size);
- args[0] = &zvalue;
+ ZVAL_LONG(&args[0], (long)new_size);
call_result = call_user_function_ex(NULL,
- &us->object,
+ us->object,
&func_name,
&retval,
1, args, 0, NULL TSRMLS_CC);
- if (call_result == SUCCESS && retval != NULL) {
- if (Z_TYPE_P(retval) == IS_BOOL) {
- ret = Z_LVAL_P(retval) ? PHP_STREAM_OPTION_RETURN_OK :
- PHP_STREAM_OPTION_RETURN_ERR;
+ if (call_result == SUCCESS && Z_TYPE(retval) != IS_UNDEF) {
+ if (Z_TYPE(retval) == IS_BOOL) {
+ ret = Z_LVAL(retval) ? PHP_STREAM_OPTION_RETURN_OK :
+ PHP_STREAM_OPTION_RETURN_ERR;
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING,
"%s::" USERSTREAM_TRUNCATE " did not return a boolean!",
@@ -1073,46 +1018,39 @@ static int php_userstreamop_set_option(php_stream *stream, int option, int value
case PHP_STREAM_OPTION_WRITE_BUFFER:
case PHP_STREAM_OPTION_READ_TIMEOUT:
case PHP_STREAM_OPTION_BLOCKING: {
- zval *zoption = NULL;
- zval *zptrparam = NULL;
-
- ZVAL_STRINGL(&func_name, USERSTREAM_SET_OPTION, sizeof(USERSTREAM_SET_OPTION)-1, 0);
- ALLOC_INIT_ZVAL(zoption);
- ZVAL_LONG(zoption, option);
+//??? ZVAL_STRINGL(&func_name, USERSTREAM_SET_OPTION, sizeof(USERSTREAM_SET_OPTION)-1, 0);
+ ZVAL_STRINGL(&func_name, USERSTREAM_SET_OPTION, sizeof(USERSTREAM_SET_OPTION)-1);
- ALLOC_INIT_ZVAL(zvalue);
- ALLOC_INIT_ZVAL(zptrparam);
-
- args[0] = &zoption;
- args[1] = &zvalue;
- args[2] = &zptrparam;
+ ZVAL_LONG(&args[0], option);
+ ZVAL_NULL(&args[1]);
+ ZVAL_NULL(&args[2]);
switch(option) {
case PHP_STREAM_OPTION_READ_BUFFER:
case PHP_STREAM_OPTION_WRITE_BUFFER:
- ZVAL_LONG(zvalue, value);
+ ZVAL_LONG(&args[1], value);
if (ptrparam) {
- ZVAL_LONG(zptrparam, *(long *)ptrparam);
+ ZVAL_LONG(&args[2], *(long *)ptrparam);
} else {
- ZVAL_LONG(zptrparam, BUFSIZ);
+ ZVAL_LONG(&args[2], BUFSIZ);
}
break;
case PHP_STREAM_OPTION_READ_TIMEOUT: {
struct timeval tv = *(struct timeval*)ptrparam;
- ZVAL_LONG(zvalue, tv.tv_sec);
- ZVAL_LONG(zptrparam, tv.tv_usec);
+ ZVAL_LONG(&args[1], tv.tv_sec);
+ ZVAL_LONG(&args[2], tv.tv_usec);
break;
}
case PHP_STREAM_OPTION_BLOCKING:
- ZVAL_LONG(zvalue, value);
+ ZVAL_LONG(&args[1], value);
break;
default:
break;
}
call_result = call_user_function_ex(NULL,
- &us->object,
+ us->object,
&func_name,
&retval,
3, args, 0, NULL TSRMLS_CC);
@@ -1121,32 +1059,22 @@ static int php_userstreamop_set_option(php_stream *stream, int option, int value
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_SET_OPTION " is not implemented!",
us->wrapper->classname);
ret = PHP_STREAM_OPTION_RETURN_ERR;
- } else if (retval && zend_is_true(retval TSRMLS_CC)) {
+ } else if (Z_TYPE(retval) != IS_UNDEF && zend_is_true(&retval TSRMLS_CC)) {
ret = PHP_STREAM_OPTION_RETURN_OK;
} else {
ret = PHP_STREAM_OPTION_RETURN_ERR;
}
- if (zoption) {
- zval_ptr_dtor(&zoption);
- }
- if (zptrparam) {
- zval_ptr_dtor(&zptrparam);
- }
+ zval_ptr_dtor(&args[2]);
+ zval_ptr_dtor(&args[1]);
break;
}
}
/* clean up */
- if (retval) {
- zval_ptr_dtor(&retval);
- }
-
-
- if (zvalue) {
- zval_ptr_dtor(&zvalue);
- }
+ zval_ptr_dtor(&retval);
+ zval_ptr_dtor(&args[0]);
return ret;
}
@@ -1155,46 +1083,42 @@ static int php_userstreamop_set_option(php_stream *stream, int option, int value
static int user_wrapper_unlink(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context TSRMLS_DC)
{
struct php_user_stream_wrapper *uwrap = (struct php_user_stream_wrapper*)wrapper->abstract;
- zval *zfilename, *zfuncname, *zretval;
- zval **args[1];
+ zval zfuncname, zretval;
+ zval args[1];
int call_result;
- zval *object;
+ zval *object, tmp_object;
int ret = 0;
/* create an instance of our class */
- object = user_stream_create_object(uwrap, context TSRMLS_CC);
+ object = user_stream_create_object(uwrap, context, &tmp_object TSRMLS_CC);
if(object == NULL) {
return ret;
}
/* call the unlink method */
- MAKE_STD_ZVAL(zfilename);
- ZVAL_STRING(zfilename, url, 1);
- args[0] = &zfilename;
+ ZVAL_STRING(&args[0], url);
- MAKE_STD_ZVAL(zfuncname);
- ZVAL_STRING(zfuncname, USERSTREAM_UNLINK, 1);
+ ZVAL_STRING(&zfuncname, USERSTREAM_UNLINK);
call_result = call_user_function_ex(NULL,
- &object,
- zfuncname,
+ object,
+ &zfuncname,
&zretval,
1, args,
0, NULL TSRMLS_CC);
- if (call_result == SUCCESS && zretval && Z_TYPE_P(zretval) == IS_BOOL) {
- ret = Z_LVAL_P(zretval);
+ if (call_result == SUCCESS && Z_TYPE(zretval) == IS_BOOL) {
+ ret = Z_LVAL(zretval);
} else if (call_result == FAILURE) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_UNLINK " is not implemented!", uwrap->classname);
}
/* clean up */
- zval_ptr_dtor(&object);
- if (zretval)
- zval_ptr_dtor(&zretval);
+ zval_ptr_dtor(object);
+ zval_ptr_dtor(&zretval);
- zval_ptr_dtor(&zfuncname);
- zval_ptr_dtor(&zfilename);
+ zval_ptr_dtor(&args[1]);
+ zval_ptr_dtor(&args[0]);
return ret;
}
@@ -1203,51 +1127,44 @@ static int user_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from
int options, php_stream_context *context TSRMLS_DC)
{
struct php_user_stream_wrapper *uwrap = (struct php_user_stream_wrapper*)wrapper->abstract;
- zval *zold_name, *znew_name, *zfuncname, *zretval;
- zval **args[2];
+ zval zfuncname, zretval;
+ zval args[2];
int call_result;
- zval *object;
+ zval *object, tmp_object;
int ret = 0;
/* create an instance of our class */
- object = user_stream_create_object(uwrap, context TSRMLS_CC);
+ object = user_stream_create_object(uwrap, context, &tmp_object TSRMLS_CC);
if(object == NULL) {
return ret;
}
/* call the rename method */
- MAKE_STD_ZVAL(zold_name);
- ZVAL_STRING(zold_name, url_from, 1);
- args[0] = &zold_name;
+ ZVAL_STRING(&args[0], url_from);
+ ZVAL_STRING(&args[1], url_to);
- MAKE_STD_ZVAL(znew_name);
- ZVAL_STRING(znew_name, url_to, 1);
- args[1] = &znew_name;
-
- MAKE_STD_ZVAL(zfuncname);
- ZVAL_STRING(zfuncname, USERSTREAM_RENAME, 1);
+ ZVAL_STRING(&zfuncname, USERSTREAM_RENAME);
call_result = call_user_function_ex(NULL,
- &object,
- zfuncname,
+ object,
+ &zfuncname,
&zretval,
2, args,
0, NULL TSRMLS_CC);
- if (call_result == SUCCESS && zretval && Z_TYPE_P(zretval) == IS_BOOL) {
- ret = Z_LVAL_P(zretval);
+ if (call_result == SUCCESS && Z_TYPE(zretval) == IS_BOOL) {
+ ret = Z_LVAL(zretval);
} else if (call_result == FAILURE) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_RENAME " is not implemented!", uwrap->classname);
}
/* clean up */
- zval_ptr_dtor(&object);
- if (zretval)
- zval_ptr_dtor(&zretval);
+ zval_ptr_dtor(object);
+ zval_ptr_dtor(&zretval);
zval_ptr_dtor(&zfuncname);
- zval_ptr_dtor(&zold_name);
- zval_ptr_dtor(&znew_name);
+ zval_ptr_dtor(&args[1]);
+ zval_ptr_dtor(&args[0]);
return ret;
}
@@ -1256,57 +1173,46 @@ static int user_wrapper_mkdir(php_stream_wrapper *wrapper, const char *url, int
int options, php_stream_context *context TSRMLS_DC)
{
struct php_user_stream_wrapper *uwrap = (struct php_user_stream_wrapper*)wrapper->abstract;
- zval *zfilename, *zmode, *zoptions, *zfuncname, *zretval;
- zval **args[3];
+ zval zfuncname, zretval;
+ zval args[3];
int call_result;
- zval *object;
+ zval *object, tmp_object;
int ret = 0;
/* create an instance of our class */
- object = user_stream_create_object(uwrap, context TSRMLS_CC);
+ object = user_stream_create_object(uwrap, context, &tmp_object TSRMLS_CC);
if(object == NULL) {
return ret;
}
/* call the mkdir method */
- MAKE_STD_ZVAL(zfilename);
- ZVAL_STRING(zfilename, url, 1);
- args[0] = &zfilename;
-
- MAKE_STD_ZVAL(zmode);
- ZVAL_LONG(zmode, mode);
- args[1] = &zmode;
+ ZVAL_STRING(&args[0], url);
+ ZVAL_LONG(&args[1], mode);
+ ZVAL_LONG(&args[2], options);
- MAKE_STD_ZVAL(zoptions);
- ZVAL_LONG(zoptions, options);
- args[2] = &zoptions;
-
- MAKE_STD_ZVAL(zfuncname);
- ZVAL_STRING(zfuncname, USERSTREAM_MKDIR, 1);
+ ZVAL_STRING(&zfuncname, USERSTREAM_MKDIR);
call_result = call_user_function_ex(NULL,
- &object,
- zfuncname,
+ object,
+ &zfuncname,
&zretval,
3, args,
0, NULL TSRMLS_CC);
- if (call_result == SUCCESS && zretval && Z_TYPE_P(zretval) == IS_BOOL) {
- ret = Z_LVAL_P(zretval);
+ if (call_result == SUCCESS && Z_TYPE(zretval) == IS_BOOL) {
+ ret = Z_LVAL(zretval);
} else if (call_result == FAILURE) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_MKDIR " is not implemented!", uwrap->classname);
}
/* clean up */
- zval_ptr_dtor(&object);
- if (zretval) {
- zval_ptr_dtor(&zretval);
- }
+ zval_ptr_dtor(object);
+ zval_ptr_dtor(&zretval);
zval_ptr_dtor(&zfuncname);
- zval_ptr_dtor(&zfilename);
- zval_ptr_dtor(&zmode);
- zval_ptr_dtor(&zoptions);
+ zval_ptr_dtor(&args[2]);
+ zval_ptr_dtor(&args[1]);
+ zval_ptr_dtor(&args[0]);
return ret;
}
@@ -1315,52 +1221,44 @@ static int user_wrapper_rmdir(php_stream_wrapper *wrapper, const char *url,
int options, php_stream_context *context TSRMLS_DC)
{
struct php_user_stream_wrapper *uwrap = (struct php_user_stream_wrapper*)wrapper->abstract;
- zval *zfilename, *zoptions, *zfuncname, *zretval;
- zval **args[3];
+ zval zfuncname, zretval;
+ zval args[2];
int call_result;
- zval *object;
+ zval *object, tmp_object;
int ret = 0;
/* create an instance of our class */
- object = user_stream_create_object(uwrap, context TSRMLS_CC);
+ object = user_stream_create_object(uwrap, context, &tmp_object TSRMLS_CC);
if(object == NULL) {
return ret;
}
/* call the rmdir method */
- MAKE_STD_ZVAL(zfilename);
- ZVAL_STRING(zfilename, url, 1);
- args[0] = &zfilename;
-
- MAKE_STD_ZVAL(zoptions);
- ZVAL_LONG(zoptions, options);
- args[1] = &zoptions;
+ ZVAL_STRING(&args[0], url);
+ ZVAL_LONG(&args[1], options);
- MAKE_STD_ZVAL(zfuncname);
- ZVAL_STRING(zfuncname, USERSTREAM_RMDIR, 1);
+ ZVAL_STRING(&zfuncname, USERSTREAM_RMDIR);
call_result = call_user_function_ex(NULL,
- &object,
- zfuncname,
+ object,
+ &zfuncname,
&zretval,
2, args,
0, NULL TSRMLS_CC);
- if (call_result == SUCCESS && zretval && Z_TYPE_P(zretval) == IS_BOOL) {
- ret = Z_LVAL_P(zretval);
+ if (call_result == SUCCESS && Z_TYPE(zretval) == IS_BOOL) {
+ ret = Z_LVAL(zretval);
} else if (call_result == FAILURE) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_RMDIR " is not implemented!", uwrap->classname);
}
/* clean up */
- zval_ptr_dtor(&object);
- if (zretval) {
- zval_ptr_dtor(&zretval);
- }
+ zval_ptr_dtor(object);
+ zval_ptr_dtor(&zretval);
zval_ptr_dtor(&zfuncname);
- zval_ptr_dtor(&zfilename);
- zval_ptr_dtor(&zoptions);
+ zval_ptr_dtor(&args[1]);
+ zval_ptr_dtor(&args[0]);
return ret;
}
@@ -1369,81 +1267,70 @@ static int user_wrapper_metadata(php_stream_wrapper *wrapper, const char *url, i
void *value, php_stream_context *context TSRMLS_DC)
{
struct php_user_stream_wrapper *uwrap = (struct php_user_stream_wrapper*)wrapper->abstract;
- zval *zfilename, *zoption, *zvalue, *zfuncname, *zretval;
- zval **args[3];
+ zval zfuncname, zretval;
+ zval args[3];
int call_result;
- zval *object;
+ zval *object, tmp_object;
int ret = 0;
- MAKE_STD_ZVAL(zvalue);
switch(option) {
case PHP_STREAM_META_TOUCH:
- array_init(zvalue);
+ array_init(&args[2]);
if(value) {
struct utimbuf *newtime = (struct utimbuf *)value;
- add_index_long(zvalue, 0, newtime->modtime);
- add_index_long(zvalue, 1, newtime->actime);
+ add_index_long(&args[2], 0, newtime->modtime);
+ add_index_long(&args[2], 1, newtime->actime);
}
break;
case PHP_STREAM_META_GROUP:
case PHP_STREAM_META_OWNER:
case PHP_STREAM_META_ACCESS:
- ZVAL_LONG(zvalue, *(long *)value);
+ ZVAL_LONG(&args[2], *(long *)value);
break;
case PHP_STREAM_META_GROUP_NAME:
case PHP_STREAM_META_OWNER_NAME:
- ZVAL_STRING(zvalue, value, 1);
+ ZVAL_STRING(&args[2], value);
break;
default:
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown option %d for " USERSTREAM_METADATA, option);
- zval_ptr_dtor(&zvalue);
+ zval_ptr_dtor(&args[2]);
return ret;
}
/* create an instance of our class */
- object = user_stream_create_object(uwrap, context TSRMLS_CC);
- if(object == NULL) {
- zval_ptr_dtor(&zvalue);
+ object = user_stream_create_object(uwrap, context, &tmp_object TSRMLS_CC);
+ if (object == NULL) {
+ zval_ptr_dtor(&args[2]);
return ret;
}
/* call the mkdir method */
- MAKE_STD_ZVAL(zfilename);
- ZVAL_STRING(zfilename, url, 1);
- args[0] = &zfilename;
-
- MAKE_STD_ZVAL(zoption);
- ZVAL_LONG(zoption, option);
- args[1] = &zoption;
-
- args[2] = &zvalue;
+ ZVAL_STRING(&args[0], url);
+ ZVAL_LONG(&args[1], option);
- MAKE_STD_ZVAL(zfuncname);
- ZVAL_STRING(zfuncname, USERSTREAM_METADATA, 1);
+ ZVAL_STRING(&zfuncname, USERSTREAM_METADATA);
call_result = call_user_function_ex(NULL,
- &object,
- zfuncname,
+ object,
+ &zfuncname,
&zretval,
3, args,
0, NULL TSRMLS_CC);
- if (call_result == SUCCESS && zretval && Z_TYPE_P(zretval) == IS_BOOL) {
- ret = Z_LVAL_P(zretval);
+ if (call_result == SUCCESS && Z_TYPE(zretval) == IS_BOOL) {
+ ret = Z_LVAL(zretval);
} else if (call_result == FAILURE) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_METADATA " is not implemented!", uwrap->classname);
}
/* clean up */
- zval_ptr_dtor(&object);
- if (zretval) {
- zval_ptr_dtor(&zretval);
- }
+ zval_ptr_dtor(object);
+ zval_ptr_dtor(&zretval);
zval_ptr_dtor(&zfuncname);
- zval_ptr_dtor(&zfilename);
- zval_ptr_dtor(&zoption);
- zval_ptr_dtor(&zvalue);
+ zval_ptr_dtor(&args[0]);
+ zval_ptr_dtor(&args[1]);
+ zval_ptr_dtor(&args[2]);
return ret;
}
@@ -1453,40 +1340,34 @@ static int user_wrapper_stat_url(php_stream_wrapper *wrapper, const char *url, i
php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC)
{
struct php_user_stream_wrapper *uwrap = (struct php_user_stream_wrapper*)wrapper->abstract;
- zval *zfilename, *zfuncname, *zretval, *zflags;
- zval **args[2];
+ zval zfuncname, zretval;
+ zval args[2];
int call_result;
- zval *object;
+ zval *object, tmp_object;
int ret = -1;
/* create an instance of our class */
- object = user_stream_create_object(uwrap, context TSRMLS_CC);
+ object = user_stream_create_object(uwrap, context, &tmp_object TSRMLS_CC);
if(object == NULL) {
return ret;
}
/* call it's stat_url method - set up params first */
- MAKE_STD_ZVAL(zfilename);
- ZVAL_STRING(zfilename, url, 1);
- args[0] = &zfilename;
-
- MAKE_STD_ZVAL(zflags);
- ZVAL_LONG(zflags, flags);
- args[1] = &zflags;
+ ZVAL_STRING(&args[0], url);
+ ZVAL_LONG(&args[1], flags);
- MAKE_STD_ZVAL(zfuncname);
- ZVAL_STRING(zfuncname, USERSTREAM_STATURL, 1);
+ ZVAL_STRING(&zfuncname, USERSTREAM_STATURL);
call_result = call_user_function_ex(NULL,
- &object,
- zfuncname,
+ object,
+ &zfuncname,
&zretval,
2, args,
0, NULL TSRMLS_CC);
- if (call_result == SUCCESS && zretval != NULL && Z_TYPE_P(zretval) == IS_ARRAY) {
+ if (call_result == SUCCESS && Z_TYPE(zretval) == IS_ARRAY) {
/* We got the info we needed */
- if (SUCCESS == statbuf_from_array(zretval, ssb TSRMLS_CC))
+ if (SUCCESS == statbuf_from_array(&zretval, ssb TSRMLS_CC))
ret = 0;
} else {
if (call_result == FAILURE) {
@@ -1496,13 +1377,12 @@ static int user_wrapper_stat_url(php_stream_wrapper *wrapper, const char *url, i
}
/* clean up */
- zval_ptr_dtor(&object);
- if (zretval)
- zval_ptr_dtor(&zretval);
+ zval_ptr_dtor(object);
+ zval_ptr_dtor(&zretval);
zval_ptr_dtor(&zfuncname);
- zval_ptr_dtor(&zfilename);
- zval_ptr_dtor(&zflags);
+ zval_ptr_dtor(&args[1]);
+ zval_ptr_dtor(&args[0]);
return ret;
@@ -1511,7 +1391,7 @@ static int user_wrapper_stat_url(php_stream_wrapper *wrapper, const char *url, i
static size_t php_userstreamop_readdir(php_stream *stream, char *buf, size_t count TSRMLS_DC)
{
zval func_name;
- zval *retval = NULL;
+ zval retval;
int call_result;
size_t didread = 0;
php_userstream_data_t *us = (php_userstream_data_t *)stream->abstract;
@@ -1521,18 +1401,19 @@ static size_t php_userstreamop_readdir(php_stream *stream, char *buf, size_t cou
if (count != sizeof(php_stream_dirent))
return 0;
- ZVAL_STRINGL(&func_name, USERSTREAM_DIR_READ, sizeof(USERSTREAM_DIR_READ)-1, 0);
+//??? ZVAL_STRINGL(&func_name, USERSTREAM_DIR_READ, sizeof(USERSTREAM_DIR_READ)-1, 0);
+ ZVAL_STRINGL(&func_name, USERSTREAM_DIR_READ, sizeof(USERSTREAM_DIR_READ)-1);
call_result = call_user_function_ex(NULL,
- &us->object,
+ us->object,
&func_name,
&retval,
0, NULL,
0, NULL TSRMLS_CC);
- if (call_result == SUCCESS && retval != NULL && Z_TYPE_P(retval) != IS_BOOL) {
- convert_to_string(retval);
- PHP_STRLCPY(ent->d_name, Z_STRVAL_P(retval), sizeof(ent->d_name), Z_STRLEN_P(retval));
+ if (call_result == SUCCESS && Z_TYPE(retval) != IS_BOOL) {
+ convert_to_string(&retval);
+ PHP_STRLCPY(ent->d_name, Z_STRVAL(retval), sizeof(ent->d_name), Z_STRLEN(retval));
didread = sizeof(php_stream_dirent);
} else if (call_result == FAILURE) {
@@ -1540,8 +1421,7 @@ static size_t php_userstreamop_readdir(php_stream *stream, char *buf, size_t cou
us->wrapper->classname);
}
- if (retval)
- zval_ptr_dtor(&retval);
+ zval_ptr_dtor(&retval);
return didread;
}
@@ -1549,23 +1429,21 @@ static size_t php_userstreamop_readdir(php_stream *stream, char *buf, size_t cou
static int php_userstreamop_closedir(php_stream *stream, int close_handle TSRMLS_DC)
{
zval func_name;
- zval *retval = NULL;
+ zval retval;
php_userstream_data_t *us = (php_userstream_data_t *)stream->abstract;
assert(us != NULL);
- ZVAL_STRINGL(&func_name, USERSTREAM_DIR_CLOSE, sizeof(USERSTREAM_DIR_CLOSE)-1, 0);
+//??? ZVAL_STRINGL(&func_name, USERSTREAM_DIR_CLOSE, sizeof(USERSTREAM_DIR_CLOSE)-1, 0);
+ ZVAL_STRINGL(&func_name, USERSTREAM_DIR_CLOSE, sizeof(USERSTREAM_DIR_CLOSE)-1);
call_user_function_ex(NULL,
- &us->object,
+ us->object,
&func_name,
&retval,
0, NULL, 0, NULL TSRMLS_CC);
- if (retval)
- zval_ptr_dtor(&retval);
-
- zval_ptr_dtor(&us->object);
+ zval_ptr_dtor(us->object);
efree(us);
@@ -1575,19 +1453,19 @@ static int php_userstreamop_closedir(php_stream *stream, int close_handle TSRMLS
static int php_userstreamop_rewinddir(php_stream *stream, off_t offset, int whence, off_t *newoffs TSRMLS_DC)
{
zval func_name;
- zval *retval = NULL;
+ zval retval;
php_userstream_data_t *us = (php_userstream_data_t *)stream->abstract;
- ZVAL_STRINGL(&func_name, USERSTREAM_DIR_REWIND, sizeof(USERSTREAM_DIR_REWIND)-1, 0);
+//??? ZVAL_STRINGL(&func_name, USERSTREAM_DIR_REWIND, sizeof(USERSTREAM_DIR_REWIND)-1, 0);
+ ZVAL_STRINGL(&func_name, USERSTREAM_DIR_REWIND, sizeof(USERSTREAM_DIR_REWIND)-1);
call_user_function_ex(NULL,
- &us->object,
+ us->object,
&func_name,
&retval,
0, NULL, 0, NULL TSRMLS_CC);
- if (retval)
- zval_ptr_dtor(&retval);
+ zval_ptr_dtor(&retval);
return 0;
@@ -1597,28 +1475,26 @@ static int php_userstreamop_cast(php_stream *stream, int castas, void **retptr T
{
php_userstream_data_t *us = (php_userstream_data_t *)stream->abstract;
zval func_name;
- zval *retval = NULL;
- zval *zcastas = NULL;
- zval **args[1];
+ zval retval;
+ zval args[1];
php_stream * intstream = NULL;
int call_result;
int ret = FAILURE;
- ZVAL_STRINGL(&func_name, USERSTREAM_CAST, sizeof(USERSTREAM_CAST)-1, 0);
+//??? ZVAL_STRINGL(&func_name, USERSTREAM_CAST, sizeof(USERSTREAM_CAST)-1, 0);
+ ZVAL_STRINGL(&func_name, USERSTREAM_CAST, sizeof(USERSTREAM_CAST)-1);
- ALLOC_INIT_ZVAL(zcastas);
switch(castas) {
case PHP_STREAM_AS_FD_FOR_SELECT:
- ZVAL_LONG(zcastas, PHP_STREAM_AS_FD_FOR_SELECT);
+ ZVAL_LONG(&args[0], PHP_STREAM_AS_FD_FOR_SELECT);
break;
default:
- ZVAL_LONG(zcastas, PHP_STREAM_AS_STDIO);
+ ZVAL_LONG(&args[0], PHP_STREAM_AS_STDIO);
break;
}
- args[0] = &zcastas;
call_result = call_user_function_ex(NULL,
- &us->object,
+ us->object,
&func_name,
&retval,
1, args, 0, NULL TSRMLS_CC);
@@ -1629,7 +1505,7 @@ static int php_userstreamop_cast(php_stream *stream, int castas, void **retptr T
us->wrapper->classname);
break;
}
- if (retval == NULL || !zend_is_true(retval TSRMLS_CC)) {
+ if (Z_TYPE(retval) != IS_UNDEF || !zend_is_true(&retval TSRMLS_CC)) {
break;
}
php_stream_from_zval_no_verify(intstream, &retval);
@@ -1647,12 +1523,8 @@ static int php_userstreamop_cast(php_stream *stream, int castas, void **retptr T
ret = php_stream_cast(intstream, castas, retptr, 1);
} while (0);
- if (retval) {
- zval_ptr_dtor(&retval);
- }
- if (zcastas) {
- zval_ptr_dtor(&zcastas);
- }
+ zval_ptr_dtor(&retval);
+ zval_ptr_dtor(&args[0]);
return ret;
}
diff --git a/main/streams/xp_socket.c b/main/streams/xp_socket.c
index 9cef91cbb4..91b00496c7 100644
--- a/main/streams/xp_socket.c
+++ b/main/streams/xp_socket.c
@@ -618,7 +618,7 @@ static inline int php_tcp_sockop_connect(php_stream *stream, php_netstream_data_
int portno, bindport = 0;
int err = 0;
int ret;
- zval **tmpzval = NULL;
+ zval *tmpzval = NULL;
#ifdef AF_UNIX
if (stream->ops == &php_stream_unix_socket_ops || stream->ops == &php_stream_unixdg_socket_ops) {
@@ -653,15 +653,15 @@ static inline int php_tcp_sockop_connect(php_stream *stream, php_netstream_data_
return -1;
}
- if (stream->context && php_stream_context_get_option(stream->context, "socket", "bindto", &tmpzval) == SUCCESS) {
- if (Z_TYPE_PP(tmpzval) != IS_STRING) {
+ if (stream->context && (tmpzval = php_stream_context_get_option(stream->context, "socket", "bindto")) != NULL) {
+ if (Z_TYPE_P(tmpzval) != IS_STRING) {
if (xparam->want_errortext) {
spprintf(&xparam->outputs.error_text, 0, "local_addr context option is not a string.");
}
efree(host);
return -1;
}
- bindto = parse_ip_address_ex(Z_STRVAL_PP(tmpzval), Z_STRLEN_PP(tmpzval), &bindport, xparam->want_errortext, &xparam->outputs.error_text TSRMLS_CC);
+ bindto = parse_ip_address_ex(Z_STRVAL_P(tmpzval), Z_STRLEN_P(tmpzval), &bindport, xparam->want_errortext, &xparam->outputs.error_text TSRMLS_CC);
}
/* Note: the test here for php_stream_udp_socket_ops is important, because we
@@ -733,7 +733,7 @@ static inline int php_tcp_sockop_accept(php_stream *stream, php_netstream_data_t
if (xparam->outputs.client) {
xparam->outputs.client->context = stream->context;
if (stream->context) {
- zend_list_addref(stream->context->rsrc_id);
+ stream->context->res->gc.refcount++;
}
}
}
diff --git a/sapi/apache_hooks/php_apache.c b/sapi/apache_hooks/php_apache.c
index 76a4219b0a..74a9a65acd 100644
--- a/sapi/apache_hooks/php_apache.c
+++ b/sapi/apache_hooks/php_apache.c
@@ -1401,7 +1401,7 @@ static PHP_MINIT_FUNCTION(apache)
le_apachereq = zend_register_list_destructors_ex(php_apache_request_free, NULL, "ApacheRequest", module_number);
INIT_OVERLOADED_CLASS_ENTRY(ce, "ApacheRequest", php_apache_request_class_functions, NULL, NULL, NULL);
- apacherequest_class_entry = zend_register_internal_class_ex(&ce, NULL, NULL TSRMLS_CC);
+ apacherequest_class_entry = zend_register_internal_class_ex(&ce, NULL TSRMLS_CC);
REGISTER_LONG_CONSTANT("OK", OK, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("DECLINED", DECLINED, CONST_CS | CONST_PERSISTENT);
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c
index 5b22fa580f..1350f3be00 100644
--- a/sapi/cgi/cgi_main.c
+++ b/sapi/cgi/cgi_main.c
@@ -223,11 +223,11 @@ static int print_module_info(zend_module_entry *module, void *arg TSRMLS_DC)
static int module_name_cmp(const void *a, const void *b TSRMLS_DC)
{
- Bucket *f = *((Bucket **) a);
- Bucket *s = *((Bucket **) b);
+ Bucket *f = (Bucket *) a;
+ Bucket *s = (Bucket *) b;
- return strcasecmp( ((zend_module_entry *)f->pData)->name,
- ((zend_module_entry *)s->pData)->name);
+ return strcasecmp( ((zend_module_entry *)f->xData)->name,
+ ((zend_module_entry *)s->xData)->name);
}
static void print_modules(TSRMLS_D)
diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c
index 7c971176b6..fd3881fd06 100644
--- a/sapi/cli/php_cli.c
+++ b/sapi/cli/php_cli.c
@@ -182,11 +182,11 @@ static int print_module_info(zend_module_entry *module TSRMLS_DC) /* {{{ */
static int module_name_cmp(const void *a, const void *b TSRMLS_DC) /* {{{ */
{
- Bucket *f = *((Bucket **) a);
- Bucket *s = *((Bucket **) b);
+ Bucket *f = (Bucket *) a;
+ Bucket *s = (Bucket *) b;
- return strcasecmp(((zend_module_entry *)f->pData)->name,
- ((zend_module_entry *)s->pData)->name);
+ return strcasecmp(((zend_module_entry *)f->xData)->name,
+ ((zend_module_entry *)s->xData)->name);
}
/* }}} */
@@ -1087,6 +1087,8 @@ static int do_cli(int argc, char **argv TSRMLS_DC) /* {{{ */
break;
}
+//???
+#if 0
case PHP_MODE_REFLECTION_FUNCTION:
case PHP_MODE_REFLECTION_CLASS:
case PHP_MODE_REFLECTION_EXTENSION:
@@ -1161,6 +1163,7 @@ static int do_cli(int argc, char **argv TSRMLS_DC) /* {{{ */
efree(lcname);
break;
}
+#endif
case PHP_MODE_SHOW_INI_CONFIG:
{
zend_printf("Configuration File (php.ini) Path: %s\n", PHP_CONFIG_FILE_PATH);
diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c
index 807ea8bb5d..da780e68aa 100644
--- a/sapi/fpm/fpm/fpm_main.c
+++ b/sapi/fpm/fpm/fpm_main.c
@@ -224,11 +224,11 @@ static int print_module_info(zend_module_entry *module, void *arg TSRMLS_DC)
static int module_name_cmp(const void *a, const void *b TSRMLS_DC)
{
- Bucket *f = *((Bucket **) a);
- Bucket *s = *((Bucket **) b);
+ Bucket *f = (Bucket *) a;
+ Bucket *s = (Bucket *) b;
- return strcasecmp( ((zend_module_entry *)f->pData)->name,
- ((zend_module_entry *)s->pData)->name);
+ return strcasecmp( ((zend_module_entry *)f->xData)->name,
+ ((zend_module_entry *)s->xData)->name);
}
static void print_modules(TSRMLS_D)