diff options
| author | Dmitry Stogov <dmitry@zend.com> | 2014-02-24 15:25:24 +0400 |
|---|---|---|
| committer | Dmitry Stogov <dmitry@zend.com> | 2014-02-24 15:25:24 +0400 |
| commit | f4c2810ab45293dea7b176069b73b33bb621fbb5 (patch) | |
| tree | 597f2530c6982cbddac54c19d8cfa2febd08e99d /Zend/zend_compile.c | |
| parent | 73b8e9aef4206fdbd31c7df9da52b96ae78a9a1e (diff) | |
| download | php-git-f4c2810ab45293dea7b176069b73b33bb621fbb5.tar.gz | |
fixed support for constant expressions
Diffstat (limited to 'Zend/zend_compile.c')
| -rw-r--r-- | Zend/zend_compile.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 5c39e6f0b7..d74d0f7844 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -5888,26 +5888,27 @@ void zend_do_add_static_array_element(znode *result, znode *offset, const znode if (offset) { switch (Z_TYPE(offset->u.constant) & IS_CONSTANT_TYPE_MASK) { case IS_CONSTANT: - /* Ugly hack to denote that this value has a constant index */ - Z_TYPE(element) |= IS_CONSTANT_INDEX; +//??? /* Ugly hack to denote that this value has a constant index */ + Z_STR(offset->u.constant)->gc.u.v.flags |= IS_STR_CONSTANT; +//??? Z_TYPE(element) |= IS_CONSTANT_INDEX; //??? Z_STRVAL(offset->u.constant) = erealloc(Z_STRVAL(offset->u.constant), Z_STRLEN(offset->u.constant)+3); //??? Z_STRVAL(offset->u.constant)[Z_STRLEN(offset->u.constant)+1] = Z_TYPE(offset->u.constant); //??? Z_STRVAL(offset->u.constant)[Z_STRLEN(offset->u.constant)+2] = 0; -//??? zend_symtable_update(Z_ARRVAL(result->u.constant), Z_STRVAL(offset->u.constant), Z_STRLEN(offset->u.constant)+3, &element, sizeof(zval *), NULL); + zend_symtable_update(Z_ARRVAL(result->u.constant), Z_STR(offset->u.constant), &element); zval_dtor(&offset->u.constant); break; case IS_CONSTANT_AST: { - /* Another ugly hack to store the data about the AST in the array */ -//??? char* key; +//??? /* Another ugly hack to store the data about the AST in the array */ + zend_string *key; //??? int len = sizeof(zend_ast *); - Z_TYPE(element) |= IS_CONSTANT_INDEX; +//??? Z_TYPE(element) |= IS_CONSTANT_INDEX; + Z_STR(offset->u.constant)->gc.u.v.flags |= IS_STR_AST; -//??? key = emalloc(len + 2); -//??? *(zend_ast **)key = Z_AST(offset->u.constant); + key = STR_INIT((char*)Z_AST(offset->u.constant), sizeof(zend_ast*), 0); //??? key[len] = Z_TYPE(offset->u.constant); //??? key[len + 1] = 0; -//??? zend_symtable_update(Z_ARRVAL(result->u.constant), key, len + 2, &element, sizeof(zval *), NULL); -//??? efree(key); + zend_symtable_update(Z_ARRVAL(result->u.constant), key, &element); + STR_RELEASE(key); break; } case IS_STRING: |
