Skip to content

Commit

Permalink
Merge pull request #1982 from dreamsxin/1961
Browse files Browse the repository at this point in the history
Re fix #1961
  • Loading branch information
sergeyklay authored Oct 19, 2019
2 parents cfa069f + eac2383 commit 1d7233b
Show file tree
Hide file tree
Showing 25 changed files with 226 additions and 72 deletions.
1 change: 1 addition & 0 deletions ext/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ if test "$PHP_TEST" = "yes"; then
test/globals.zep.c
test/globals/env.zep.c
test/globals/post.zep.c
test/globals/server.zep.c
test/globals/serverrequestfactory.zep.c
test/globals/session/child.zep.c
test/instance.zep.c
Expand Down
2 changes: 1 addition & 1 deletion ext/config.w32
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ if (PHP_TEST != "no") {
ADD_SOURCES(configure_module_dirname + "/test/bench", "foo.zep.c", "test");
ADD_SOURCES(configure_module_dirname + "/test/builtin", "arraymethods.zep.c charmethods.zep.c intmethods.zep.c stringmethods.zep.c", "test");
ADD_SOURCES(configure_module_dirname + "/test/flow", "switchflow.zep.c", "test");
ADD_SOURCES(configure_module_dirname + "/test/globals", "env.zep.c post.zep.c serverrequestfactory.zep.c", "test");
ADD_SOURCES(configure_module_dirname + "/test/globals", "env.zep.c post.zep.c server.zep.c serverrequestfactory.zep.c", "test");
ADD_SOURCES(configure_module_dirname + "/test/integration/psr/http/message", "messageinterfaceex.zep.c", "test");
ADD_SOURCES(configure_module_dirname + "/test/mcall", "caller.zep.c", "test");
ADD_SOURCES(configure_module_dirname + "/test/oo/extend/db/query/placeholder", "exception.zep.c", "test");
Expand Down
8 changes: 6 additions & 2 deletions ext/kernel/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,12 @@ int zephir_get_global(zval *arr, const char *global, unsigned int global_length)
if ((gv = zend_hash_find_ind(&EG(symbol_table), str)) != NULL) {
ZVAL_DEREF(gv);
if (Z_TYPE_P(gv) == IS_ARRAY) {
ZVAL_DUP(arr, gv);
zend_hash_update(&EG(symbol_table), str, arr);
if (Z_REFCOUNTED_P(gv) && Z_REFCOUNT_P(gv) <= 1) {
ZVAL_COPY_VALUE(arr, gv);
} else {
ZVAL_DUP(arr, gv);
zend_hash_update(&EG(symbol_table), str, arr);
}

// See: https://github.com/phalcon/zephir/pull/1965#issuecomment-541299003
// ZVAL_COPY_VALUE(arr, gv);
Expand Down
2 changes: 2 additions & 0 deletions ext/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ zend_class_entry *test_geometry_ce;
zend_class_entry *test_globals_ce;
zend_class_entry *test_globals_env_ce;
zend_class_entry *test_globals_post_ce;
zend_class_entry *test_globals_server_ce;
zend_class_entry *test_globals_serverrequestfactory_ce;
zend_class_entry *test_globals_session_child_ce;
zend_class_entry *test_instance_ce;
Expand Down Expand Up @@ -296,6 +297,7 @@ static PHP_MINIT_FUNCTION(test)
ZEPHIR_INIT(Test_Globals);
ZEPHIR_INIT(Test_Globals_Env);
ZEPHIR_INIT(Test_Globals_Post);
ZEPHIR_INIT(Test_Globals_Server);
ZEPHIR_INIT(Test_Globals_ServerRequestFactory);
ZEPHIR_INIT(Test_Globals_Session_Child);
ZEPHIR_INIT(Test_Instance);
Expand Down
1 change: 1 addition & 0 deletions ext/test.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
#include "test/globals.zep.h"
#include "test/globals/env.zep.h"
#include "test/globals/post.zep.h"
#include "test/globals/server.zep.h"
#include "test/globals/serverrequestfactory.zep.h"
#include "test/globals/session/child.zep.h"
#include "test/instance.zep.h"
Expand Down
82 changes: 82 additions & 0 deletions ext/test/globals/server.zep.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 37 additions & 0 deletions ext/test/globals/server.zep.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 17 additions & 15 deletions ext/test/oo/oodestruct.zep.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ext/test/optimizers/strreplace.zep.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions ext/test/properties/propertyarray.zep.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions ext/test/quantum.zep.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions ext/test/range.zep.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions ext/test/regexdna.zep.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ext/test/requires.zep.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1d7233b

Please sign in to comment.