-
-
Notifications
You must be signed in to change notification settings - Fork 468
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
PHP7 create symbol table #1403
Comments
As far as I can tell, symbol tables in ZE3 are linked to the execution context, and it is not trivial to replace the existing symbol table with a newly created one. What I suggest is: because new symbol tables are used mostly to create an isolated scope for int zephir_require_ret(zval *return_value_ptr, const char *require_path, zval * symbol_table) ZEPHIR_ATTR_NONNULL1(2);
The issue is that this would introduce a change to Zephir syntax:
or, as an alternative, we can create an optimizer for a function (say, What do you guys think? |
I like the second option for now |
What does this mean? We would need to create some weird empty array or pass view params with this require? |
$symtable = ['var1' => 1, 'var2' => true, /* ... */];
require_with_symtable('somefile.php', $symtable);
// somefile.php sees only variables passed in the $symtable as local ones |
Oh okay i understand. But then what with calling |
Good question. No idea until I test |
Set the |
just FYI: |
static zend_array* add_symtable(zend_execute_data* ex)
{
zend_array* old_table;
zend_array* symbol_table = (zend_array*)emalloc(sizeof(zend_array));
zend_hash_init(symbol_table, 0, NULL, ZVAL_PTR_DTOR, 0);
zend_hash_real_init(symbol_table, 0);
zend_rebuild_symbol_table();
zend_detach_symbol_table(ex);
old_table = ex->symbol_table;
ex->symbol_table = symbol_table;
return old_table;
}
static void restore_symtable(zend_execute_data* ex, zend_array* tbl)
{
zend_hash_destroy(ex->symbol_table);
efree(ex->symbol_table);
ex->symbol_table = tbl;
zend_attach_symbol_table(ex);
zend_rebuild_symbol_table();
} If |
OK, let us move to #1488 to discuss this further. |
Is there any reason why
create_symbol_table
function is not implementend in ZendEngine3? Like all code there is just commented. For example zephir just uses wrong symbol table for example in this issue - phalcon/cphalcon#12648 on php5 just create_symbol_table() before setting variables is enough but what about php7?The text was updated successfully, but these errors were encountered: