diff options
author | Xinchen Hui <laruence@php.net> | 2014-07-31 18:16:08 +0800 |
---|---|---|
committer | Xinchen Hui <laruence@php.net> | 2014-07-31 18:16:08 +0800 |
commit | 863a603fada3ce107cb402683bc79dce1359c463 (patch) | |
tree | ae0426fb8fe168d56138464256b09f639d33176f | |
parent | 238a3167e601dd74772182e354298578c1c50021 (diff) | |
parent | 534dfa84a1347f88d92fdfe58d9cd5b3ddc41462 (diff) | |
download | php-git-863a603fada3ce107cb402683bc79dce1359c463.tar.gz |
Merge branch 'phpng' of https://git.php.net/repository/php-src into phpng
-rw-r--r-- | Zend/zend_compile.c | 1 | ||||
-rw-r--r-- | Zend/zend_execute_API.c | 1 | ||||
-rw-r--r-- | ext/reflection/php_reflection.c | 9 | ||||
-rw-r--r-- | main/main.c | 17 | ||||
-rw-r--r-- | main/php_streams.h | 11 | ||||
-rw-r--r-- | main/streams/streams.c | 4 |
6 files changed, 24 insertions, 19 deletions
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index a4a9e8a1c9..dee8bb85c0 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -6406,6 +6406,7 @@ str_index: } else { GET_NODE(result, init_opline->result); } + result->EA = 0; } /* }}} */ diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 308d54b31d..9e9bd841a0 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -859,6 +859,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS EG(scope) = func->common.scope; } call->prev_execute_data = EG(current_execute_data); + call->return_value = NULL; /* this is not a constructor call */ EG(current_execute_data) = call; if (EXPECTED(zend_execute_internal == NULL)) { /* saves one function call if zend_execute_internal is not used */ diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index f2d3059c3d..508ddceacd 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -3351,16 +3351,12 @@ ZEND_METHOD(reflection_class, __construct) /* {{{ add_class_vars */ static void add_class_vars(zend_class_entry *ce, int statics, zval *return_value TSRMLS_DC) { - HashPosition pos; zend_property_info *prop_info; zval *prop, prop_copy; zend_string *key; ulong num_index; - zend_hash_internal_pointer_reset_ex(&ce->properties_info, &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); + ZEND_HASH_FOREACH_KEY_PTR(&ce->properties_info, num_index, key, prop_info) { if (((prop_info->flags & ZEND_ACC_SHADOW) && prop_info->ce != ce) || ((prop_info->flags & ZEND_ACC_PROTECTED) && @@ -3382,6 +3378,7 @@ static void add_class_vars(zend_class_entry *ce, int statics, zval *return_value } /* copy: enforce read only access */ + ZVAL_DEREF(prop); ZVAL_DUP(&prop_copy, prop); /* this is necessary to make it able to work with default array @@ -3391,7 +3388,7 @@ static void add_class_vars(zend_class_entry *ce, int statics, zval *return_value } zend_hash_update(Z_ARRVAL_P(return_value), key, &prop_copy); - } + } ZEND_HASH_FOREACH_END(); } /* }}} */ diff --git a/main/main.c b/main/main.c index f4f88d5360..3b9330e875 100644 --- a/main/main.c +++ b/main/main.c @@ -1192,10 +1192,19 @@ static void php_error_cb(int type, const char *error_filename, const uint error_ case E_USER_ERROR: { /* new block to allow variable definition */ /* eval() errors do not affect exit_status or response code */ - zend_bool during_eval = (type == E_PARSE) && (EG(current_execute_data) && - EG(current_execute_data)->opline && - EG(current_execute_data)->opline->opcode == ZEND_INCLUDE_OR_EVAL && - EG(current_execute_data)->opline->extended_value == ZEND_EVAL); + zend_bool during_eval = 0; + + if (type == E_PARSE) { + zend_execute_data *execute_data = EG(current_execute_data); + + while (execute_data && (!execute_data->func || !ZEND_USER_CODE(execute_data->func->common.type))) { + execute_data = execute_data->prev_execute_data; + } + + during_eval = (execute_data && + execute_data->opline->opcode == ZEND_INCLUDE_OR_EVAL && + execute_data->opline->extended_value == ZEND_EVAL); + } if (!during_eval) { EG(exit_status) = 255; } diff --git a/main/php_streams.h b/main/php_streams.h index 2a142b99c2..fac15ce3e4 100644 --- a/main/php_streams.h +++ b/main/php_streams.h @@ -202,9 +202,7 @@ struct _php_stream { * PHP_STREAM_FCLOSE_XXX as appropriate */ int fclose_stdiocast; FILE *stdiocast; /* cache this, otherwise we might leak! */ -#if ZEND_DEBUG int __exposed; /* non-zero if exposed as a zval somewhere */ -#endif char *orig_path; php_stream_context *context; @@ -243,17 +241,12 @@ 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))->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++; } +#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_RES(zval, (stream)->res); (stream)->__exposed++; } -#else -# define php_stream_auto_cleanup(stream) /* nothing */ -# define php_stream_to_zval(stream, zval) { ZVAL_RES(zval, (stream)->res); } -#endif +#define php_stream_to_zval(stream, zval) { ZVAL_RES(zval, (stream)->res); (stream)->__exposed++; } #define php_stream_from_zval(xstr, pzval) ZEND_FETCH_RESOURCE2((xstr), php_stream *, (pzval), -1, "stream", php_file_le_stream(), php_file_le_pstream()) #define php_stream_from_zval_no_verify(xstr, pzval) (xstr) = (php_stream*)zend_fetch_resource((pzval) TSRMLS_CC, -1, "stream", NULL, 2, php_file_le_stream(), php_file_le_pstream()) diff --git a/main/streams/streams.c b/main/streams/streams.c index f305fe8044..648a0d8c6d 100644 --- a/main/streams/streams.c +++ b/main/streams/streams.c @@ -466,6 +466,10 @@ fprintf(stderr, "stream_free: %s:%p[%s] preserve_handle=%d release_cast=%d remov //??? while (zend_list_delete(stream->res) == SUCCESS) {} //??? stream->res->gc.refcount = 0; zend_list_close(stream->res); + if (!stream->__exposed) { + zend_list_delete(stream->res); + stream->res = NULL; + } } if (close_options & PHP_STREAM_FREE_CALL_DTOR) { |