Skip to content

Commit 03d7718

Browse files
author
Nicolas Van Eenaeme
committed
Removed ini setting blitz.enable_magic_scope, it's always enabled
1 parent 6fc8f48 commit 03d7718

File tree

3 files changed

+6
-54
lines changed

3 files changed

+6
-54
lines changed

blitz.c

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,6 @@ PHP_INI_BEGIN()
175175
OnUpdateBool, check_recursion, zend_blitz_globals, blitz_globals)
176176
STD_PHP_INI_ENTRY("blitz.scope_lookup_limit", "0", PHP_INI_ALL,
177177
OnUpdateLongLegacy, scope_lookup_limit, zend_blitz_globals, blitz_globals)
178-
STD_PHP_INI_ENTRY("blitz.enable_magic_scope", "0", PHP_INI_ALL,
179-
OnUpdateBool, enable_magic_scope, zend_blitz_globals, blitz_globals)
180178
STD_PHP_INI_ENTRY("blitz.lower_case_method_names", "1", PHP_INI_ALL,
181179
OnUpdateBool, lower_case_method_names, zend_blitz_globals, blitz_globals)
182180
STD_PHP_INI_ENTRY("blitz.enable_include", "1", PHP_INI_ALL,
@@ -696,7 +694,6 @@ static void php_blitz_init_globals(zend_blitz_globals *blitz_globals) /* {{{ */
696694
blitz_globals->tag_comment_open = BLITZ_TAG_COMMENT_OPEN;
697695
blitz_globals->tag_comment_close = BLITZ_TAG_COMMENT_CLOSE;
698696
blitz_globals->scope_lookup_limit = 0;
699-
blitz_globals->enable_magic_scope = 0;
700697
blitz_globals->auto_escape = 0;
701698
blitz_globals->throw_exceptions = 0;
702699
}
@@ -2340,13 +2337,13 @@ static inline unsigned int blitz_fetch_var_by_path(zval ***zparam, const char *l
23402337
key[key_len] = '\x0';
23412338

23422339
/* try to get data by the key */
2343-
if (BLITZ_G(enable_magic_scope) && BLITZ_IS_PREDEFINED_TOP(key, key_len)) {
2344-
if (BLITZ_DEBUG) php_printf("magic_scope: resetting stack key '%s' in scope::%lu -> 0\n", key, magic_stack);
2340+
if (BLITZ_IS_PREDEFINED_TOP(key, key_len)) {
2341+
if (BLITZ_DEBUG) php_printf("predefined path _top: resetting stack key '%s' in scope::%lu -> 0\n", key, magic_stack);
23452342
magic_stack = 0;
23462343
*zparam = &tpl->scope_stack[magic_stack];
2347-
} else if (BLITZ_G(enable_magic_scope) && BLITZ_IS_PREDEFINED_PARENT(key, key_len)) {
2344+
} else if (BLITZ_IS_PREDEFINED_PARENT(key, key_len)) {
23482345
magic_offset = (tpl->scope_stack_pos == magic_stack ? 2 : 1); /* if we're at the initial stack level, subtract 2 to get to the parent, since we just created a new stack level */
2349-
if (BLITZ_DEBUG) php_printf("magic_scope: resetting stack key '%s' in scope::%lu -> %lu\n", key, magic_stack, (magic_stack > magic_offset ? magic_stack - magic_offset : 0));
2346+
if (BLITZ_DEBUG) php_printf("predefined path _parent: resetting stack key '%s' in scope::%lu -> %lu\n", key, magic_stack, (magic_stack > magic_offset ? magic_stack - magic_offset : 0));
23502347
magic_stack = (magic_stack > magic_offset ? magic_stack - magic_offset : 0); /* keep track of the current magic scope to enable things like _parent._parent */
23512348
*zparam = &tpl->scope_stack[magic_stack];
23522349
} else if (0 == root_found) { /* globals or params? */
@@ -3456,9 +3453,7 @@ static int blitz_exec_nodes(blitz_tpl *tpl, blitz_node *first_child,
34563453
}
34573454
}
34583455

3459-
if (BLITZ_G(scope_lookup_limit) || BLITZ_G(enable_magic_scope)) {
3460-
BLITZ_SCOPE_STACK_PUSH(tpl, parent_params);
3461-
}
3456+
BLITZ_SCOPE_STACK_PUSH(tpl, parent_params);
34623457

34633458
node = first_child;
34643459
while (node) {
@@ -3530,9 +3525,7 @@ static int blitz_exec_nodes(blitz_tpl *tpl, blitz_node *first_child,
35303525
}
35313526
}
35323527

3533-
if (BLITZ_G(scope_lookup_limit) || BLITZ_G(enable_magic_scope)) {
3534-
BLITZ_SCOPE_STACK_SHIFT(tpl);
3535-
}
3528+
BLITZ_SCOPE_STACK_SHIFT(tpl);
35363529

35373530
if (BLITZ_DEBUG)
35383531
php_printf("== D:b3 %ld,%ld,%ld\n",last_close,parent_begin,parent_end);

php_blitz.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ ZEND_BEGIN_MODULE_GLOBALS(blitz)
6262
char warn_context_duplicates;
6363
char check_recursion;
6464
unsigned long scope_lookup_limit;
65-
char enable_magic_scope;
6665
char lower_case_method_names;
6766
char auto_escape;
6867
char throw_exceptions;

tests/scope4.phpt

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -50,51 +50,11 @@ $data = array(
5050
'currentUserName' => 'Thibaut'
5151
);
5252

53-
ini_set('blitz.enable_magic_scope', 0);
54-
$T->display($data);
55-
ini_set('blitz.enable_magic_scope', 1);
5653
$T->display($data);
5754

5855
?>
5956
--EXPECT--
6057
Name: Vincent
61-
Friends:
62-
Name: Maurus
63-
Friends:
64-
Name: Thibaut
65-
Name: Vincent
66-
Name: Nicolas
67-
Name: Thibaut
68-
Friends:
69-
Name: Vincent
70-
Name: Vincent
71-
Friends:
72-
Name: Maurus
73-
Name: Thibaut
74-
Name: Vincent
75-
Name: Maurus
76-
Friends:
77-
Name: Thibaut
78-
Friends:
79-
Name: Vincent
80-
Name: Vincent
81-
Friends:
82-
Name: Maurus
83-
Name: Thibaut
84-
Name: Vincent
85-
Name: Nicolas
86-
Friends:
87-
Name: Thibaut
88-
Friends:
89-
Name: Vincent
90-
Friends:
91-
Name: Maurus
92-
Name: Thibaut
93-
Name: Vincent
94-
Name: Nicolas
95-
Friends:
96-
===================================================================
97-
Name: Vincent
9858
Friends:
9959
Name: Maurus
10060
Friends:

0 commit comments

Comments
 (0)