-
-
Notifications
You must be signed in to change notification settings - Fork 466
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUG: zephir_get_global #1961
Comments
@dreamsxin Could you fix this BUG? I'm afraid I'll make a mistake. |
@chrysanthemum Could you please provide exact PHP version and used Zephir version/commit |
php:
zephir:
operating system:
|
@dreamsxin I got it wrong. There's no bug :) |
@chrysanthemum Should we close this one? |
Oddly enough, this problem occurred when I closed all the zephir compiled extensions, leaving only the test extension. If I open the phaclon extension, the bug does not appear. Do you have this bug? (Close all zephir compiled extensions, leaving only the test extension.) |
This strange bug does exist. |
@sergeyklay Revoke that commit ed65fa7#diff-91d00b5ec72fef64318f760cae59fbda |
Fixed in the |
I'll open this one because changes proposed in #1965 broke our tests. For more see: |
public function f1() -> void
{
echo _SERVER["PHP_SELF"];
this->f2(); // In zephir_get_global use ZVAL_DUP will separation
echo _SERVER["PHP_SELF"];
} generate c code: ZEPHIR_MM_GROW();
zephir_get_global(&_SERVER, SL("_SERVER")); // separation
zephir_array_fetch_string(&_0, &_SERVER, SL("PHP_SELF"), ...);
zend_print_zval(&_0, 0);
ZEPHIR_CALL_METHOD(NULL, this_ptr, "f2", NULL, 0); // separation
zephir_check_call_status();
zephir_array_fetch_string(&_1, &_SERVER, SL("PHP_SELF"), ...); // <-- After separation, the variables here fail. is already destroyed
zend_print_zval(&_1, 0);
ZEPHIR_MM_RESTORE(); |
@sergeyklay So we need to get global every time. ZEPHIR_MM_GROW();
zephir_get_global(&_SERVER, SL("_SERVER"));
zephir_array_fetch_string(&_0, &_SERVER, SL("PHP_SELF"), ...);
zend_print_zval(&_0, 0);
ZEPHIR_CALL_METHOD(NULL, this_ptr, "f2", NULL, 0);
zephir_check_call_status();
zephir_get_global(&_SERVER, SL("_SERVER")); // <-- Get global again
zephir_array_fetch_string(&_1, &_SERVER, SL("PHP_SELF"), ...);
zend_print_zval(&_1, 0);
ZEPHIR_MM_RESTORE(); |
I have similar issue. If I access to the global variable in zephir and then access with if (isset($_POST[$key])) {
unset($_POST[$key]);
} then I'm getting "502 Bad Gateway":
|
@mruz Most likely this is a different issue. Could you please create a new issue with code to reproduce? |
test/globals/server.zep
manual.php
output:
The text was updated successfully, but these errors were encountered: