Skip to content

Commit

Permalink
Fix PHP notice in Volt when if body is empty
Browse files Browse the repository at this point in the history
Fix #1998
  • Loading branch information
sjinks committed Feb 11, 2014
1 parent 003be7c commit 142aa35
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions ext/mvc/view/engine/volt/compiler.c
Original file line number Diff line number Diff line change
Expand Up @@ -2311,28 +2311,24 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileIf){
* 'If' statement
*/
PHALCON_SCONCAT_SVS(compilation, "<?php if (", expr_code, ") { ?>");
PHALCON_OBS_VAR(block_statements);
phalcon_array_fetch_string(&block_statements, statement, SL("true_statements"), PH_NOISY);

/**
* Process statements in the 'true' block
*/
PHALCON_INIT_VAR(code);
phalcon_call_method_p2(code, this_ptr, "_statementlist", block_statements, extends_mode);
phalcon_concat_self(&compilation, code TSRMLS_CC);
if (phalcon_array_isset_string_fetch(&block_statements, statement, SS("true_statements"))) {
/**
* Process statements in the 'true' block
*/
PHALCON_INIT_VAR(code);
phalcon_call_method_p2(code, this_ptr, "_statementlist", block_statements, extends_mode);
phalcon_concat_self(&compilation, code TSRMLS_CC);
}

/**
* Check for a 'else'/'elseif' block
*/
if (phalcon_array_isset_string(statement, SS("false_statements"))) {
if (phalcon_array_isset_string_fetch(&block_statements, statement, SS("false_statements"))) {
phalcon_concat_self_str(&compilation, SL("<?php } else { ?>") TSRMLS_CC);

/**
* Process statements in the 'false' block
*/
PHALCON_OBS_NVAR(block_statements);
phalcon_array_fetch_string(&block_statements, statement, SL("false_statements"), PH_NOISY);

PHALCON_INIT_NVAR(code);
phalcon_call_method_p2(code, this_ptr, "_statementlist", block_statements, extends_mode);
phalcon_concat_self(&compilation, code TSRMLS_CC);
Expand Down

0 comments on commit 142aa35

Please sign in to comment.