From 0becb97aca34c39e7c2578ab9142c8e0ca44273c Mon Sep 17 00:00:00 2001 From: phalcon Date: Wed, 13 Aug 2014 18:38:03 -0500 Subject: [PATCH] Fix in parser calling methods with parameters by reference --- ext/php_test.h | 2 +- ext/test/internalclasses.zep.c | 2 +- ext/test/oo.zep.c | 8 ++++++-- ext/test/regexdna.zep.c | 37 +++++++++++++++++----------------- parser/parser.h | 3 +-- parser/parser.lemon | 4 ++-- 6 files changed, 30 insertions(+), 26 deletions(-) diff --git a/ext/php_test.h b/ext/php_test.h index 03bae58506..e2f10097a1 100644 --- a/ext/php_test.h +++ b/ext/php_test.h @@ -12,7 +12,7 @@ #define PHP_TEST_VERSION "1.0.0" #define PHP_TEST_EXTNAME "test" #define PHP_TEST_AUTHOR "Zephir Team and contributors" -#define PHP_TEST_ZEPVERSION "0.4.4a" +#define PHP_TEST_ZEPVERSION "0.4.5a" #define PHP_TEST_DESCRIPTION "Description test for
Test Extension" typedef struct _zephir_struct_test { diff --git a/ext/test/internalclasses.zep.c b/ext/test/internalclasses.zep.c index 1a7196c5c8..d068cd056c 100644 --- a/ext/test/internalclasses.zep.c +++ b/ext/test/internalclasses.zep.c @@ -31,7 +31,7 @@ PHP_METHOD(Test_InternalClasses, testStaticCall) { ZEPHIR_MM_GROW(); - phalcon_phalcon_di = zend_fetch_class(SL("\\Phalcon\\DI"), ZEND_FETCH_CLASS_AUTO TSRMLS_CC); + phalcon_phalcon_di = zend_fetch_class(SL("\\Phalcon\\Di"), ZEND_FETCH_CLASS_AUTO TSRMLS_CC); ZEPHIR_RETURN_CALL_CE_STATIC(phalcon_phalcon_di, "getdefault", NULL); zephir_check_call_status(); RETURN_MM(); diff --git a/ext/test/oo.zep.c b/ext/test/oo.zep.c index b253ff137b..0033704acf 100644 --- a/ext/test/oo.zep.c +++ b/ext/test/oo.zep.c @@ -133,13 +133,17 @@ PHP_METHOD(Test_Oo, testInstance6) { PHP_METHOD(Test_Oo, testInstance7) { int ZEPHIR_LAST_CALL_STATUS; - zval *o; + zval *o, *_0, *_1; ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(o); object_init_ex(o, test_oo_ooconstructparams_ce); - ZEPHIR_CALL_METHOD(NULL, o, "__construct", NULL, ZEPHIR_GLOBAL(global_false), ZEPHIR_GLOBAL(global_true)); + ZEPHIR_INIT_VAR(_0); + ZVAL_BOOL(_0, 0); + ZEPHIR_INIT_VAR(_1); + ZVAL_BOOL(_1, 1); + ZEPHIR_CALL_METHOD(NULL, o, "__construct", NULL, _0, _1); zephir_check_call_status(); RETURN_CCTOR(o); diff --git a/ext/test/regexdna.zep.c b/ext/test/regexdna.zep.c index 66a01d8086..0e7a5ea8c1 100644 --- a/ext/test/regexdna.zep.c +++ b/ext/test/regexdna.zep.c @@ -36,11 +36,11 @@ ZEPHIR_INIT_CLASS(Test_RegexDNA) { PHP_METHOD(Test_RegexDNA, process) { - HashTable *_6; - HashPosition _5; + HashTable *_5; + HashPosition _4; int ZEPHIR_LAST_CALL_STATUS; - zephir_nts_static zephir_fcall_cache_entry *_4 = NULL, *_9 = NULL; - zval *path, *variants, *vIUB, *vIUBnew, *stuffToRemove, *contents = NULL, *initialLength, *regex = NULL, *codeLength, *discard = NULL, *_0, *_1, _2, *_3 = NULL, **_7, *_8 = NULL, *_10 = NULL; + zephir_nts_static zephir_fcall_cache_entry *_3 = NULL, *_8 = NULL; + zval *path, *variants, *vIUB, *vIUBnew, *stuffToRemove, *contents = NULL, *initialLength, *regex = NULL, *codeLength, *discard = NULL, *_0, *_1, *_2 = NULL, **_6, *_7 = NULL, *_9 = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &path); @@ -158,33 +158,34 @@ PHP_METHOD(Test_RegexDNA, process) { ZVAL_LONG(initialLength, zephir_fast_strlen_ev(contents)); ZEPHIR_INIT_VAR(_1); ZEPHIR_CONCAT_SVS(_1, "/", stuffToRemove, "/mS"); - ZEPHIR_SINIT_VAR(_2); - ZVAL_STRING(&_2, "", 0); - ZEPHIR_CALL_FUNCTION(&_3, "preg_replace", &_4, _1, &_2, contents); + ZEPHIR_INIT_BNVAR(_0); + ZVAL_STRING(_0, "", 0); + ZEPHIR_CALL_FUNCTION(&_2, "preg_replace", &_3, _1, _0, contents); + zephir_check_temp_parameter(_0); zephir_check_call_status(); - ZEPHIR_CPY_WRT(contents, _3); + ZEPHIR_CPY_WRT(contents, _2); ZEPHIR_INIT_VAR(codeLength); ZVAL_LONG(codeLength, zephir_fast_strlen_ev(contents)); - zephir_is_iterable(variants, &_6, &_5, 0, 0, "test/regexdna.zep", 59); + zephir_is_iterable(variants, &_5, &_4, 0, 0, "test/regexdna.zep", 59); for ( - ; zephir_hash_get_current_data_ex(_6, (void**) &_7, &_5) == SUCCESS - ; zephir_hash_move_forward_ex(_6, &_5) + ; zephir_hash_get_current_data_ex(_5, (void**) &_6, &_4) == SUCCESS + ; zephir_hash_move_forward_ex(_5, &_4) ) { - ZEPHIR_GET_HVALUE(regex, _7); + ZEPHIR_GET_HVALUE(regex, _6); zend_print_zval(regex, 0); php_printf(" "); - ZEPHIR_INIT_LNVAR(_8); - ZEPHIR_CONCAT_SVS(_8, "/", regex, "/iS"); + ZEPHIR_INIT_LNVAR(_7); + ZEPHIR_CONCAT_SVS(_7, "/", regex, "/iS"); Z_SET_ISREF_P(discard); - ZEPHIR_CALL_FUNCTION(&_3, "preg_match_all", &_9, _8, contents, discard); + ZEPHIR_CALL_FUNCTION(&_2, "preg_match_all", &_8, _7, contents, discard); Z_UNSET_ISREF_P(discard); zephir_check_call_status(); - zend_print_zval(_3, 0); + zend_print_zval(_2, 0); php_printf("%c", '\n'); } - ZEPHIR_CALL_FUNCTION(&_10, "preg_replace", &_4, vIUB, vIUBnew, contents); + ZEPHIR_CALL_FUNCTION(&_9, "preg_replace", &_3, vIUB, vIUBnew, contents); zephir_check_call_status(); - ZEPHIR_CPY_WRT(contents, _10); + ZEPHIR_CPY_WRT(contents, _9); php_printf("%c", '\n'); zend_print_zval(initialLength, 0); php_printf("%c", '\n'); diff --git a/parser/parser.h b/parser/parser.h index c1fa9c295d..7b127db67f 100644 --- a/parser/parser.h +++ b/parser/parser.h @@ -115,5 +115,4 @@ #define XX_DOUBLE 115 #define XX_TRUE 116 #define XX_FALSE 117 -#define XX_XX_T_BITWISE_AND 118 -#define XX_CBLOCK 119 +#define XX_CBLOCK 118 diff --git a/parser/parser.lemon b/parser/parser.lemon index d052102ba0..6f8d74b1ea 100644 --- a/parser/parser.lemon +++ b/parser/parser.lemon @@ -2772,12 +2772,12 @@ xx_call_parameter(R) ::= IDENTIFIER(I) COLON xx_common_expr(E) . { } /* func(&expr) */ -xx_call_parameter(R) ::= XX_T_BITWISE_AND xx_common_expr(E) . { +xx_call_parameter(R) ::= BITWISE_AND xx_common_expr(E) . { R = xx_ret_call_parameter(NULL, E, status->scanner_state, 1); } /* func(name: &expr) */ -xx_call_parameter(R) ::= IDENTIFIER(I) COLON XX_T_BITWISE_AND xx_common_expr(E) . { +xx_call_parameter(R) ::= IDENTIFIER(I) COLON BITWISE_AND xx_common_expr(E) . { R = xx_ret_call_parameter(I, E, status->scanner_state, 0); }