Skip to content

Commit

Permalink
Adjust some build options
Browse files Browse the repository at this point in the history
  • Loading branch information
jbboehr committed Feb 10, 2024
1 parent 6ba5f9c commit 33bebca
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
3 changes: 2 additions & 1 deletion derivation.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ buildPecl rec {
[]
++ lib.optional debugSupport "--enable-vyrtue-debug";

makeFlags = ["phpincludedir=$(out)/include/php"];
makeFlags = ["phpincludedir=$(dev)/include"];
outputs = ["out" "dev"];

#TEST_PHP_DETAILED = 1;
NO_INTERACTION = 1;
Expand Down
22 changes: 20 additions & 2 deletions src/preprocess.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,14 +275,23 @@ static zend_ast *vyrtue_ast_process_call_enter(zend_ast *ast, struct vyrtue_prep

// ignore dynamic calls
if (name_ast->kind != ZEND_AST_ZVAL || Z_TYPE_P(zend_ast_get_zval(name_ast)) != IS_STRING) {
#ifdef VYRTUE_DEBUG
if (UNEXPECTED(NULL != getenv("PHP_VYRTUE_DEBUG_CALL"))) {
php_error_docref(NULL, E_WARNING, "vyrtue: Dynamic function call");
}
#endif
return NULL;
}

bool is_fully_qualified;
zend_string *name_str = vyrtue_resolve_function_name(Z_STR_P(zend_ast_get_zval(name_ast)), name_ast->attr, &is_fully_qualified, ctx);
if (!is_fully_qualified) {
// ignore unqualified function calls
// php_error_docref(NULL, E_WARNING, "Unqualified function call: %.*s", (int) name_str->len, name_str->val);
#ifdef VYRTUE_DEBUG
if (UNEXPECTED(NULL != getenv("PHP_VYRTUE_DEBUG_CALL"))) {
php_error_docref(NULL, E_WARNING, "vyrtue: Unqualified function call: %.*s", (int) name_str->len, name_str->val);
}
#endif
return NULL;
}

Expand All @@ -299,14 +308,23 @@ static zend_ast *vyrtue_ast_process_call_leave(zend_ast *ast, struct vyrtue_prep

// ignore dynamic calls
if (name_ast->kind != ZEND_AST_ZVAL || Z_TYPE_P(zend_ast_get_zval(name_ast)) != IS_STRING) {
#ifdef VYRTUE_DEBUG
if (UNEXPECTED(NULL != getenv("PHP_VYRTUE_DEBUG_CALL"))) {
php_error_docref(NULL, E_WARNING, "vyrtue: Dynamic function call");
}
#endif
return NULL;
}

bool is_fully_qualified;
zend_string *name_str = vyrtue_resolve_function_name(Z_STR_P(zend_ast_get_zval(name_ast)), name_ast->attr, &is_fully_qualified, ctx);
if (!is_fully_qualified) {
// ignore unqualified function calls
// php_error_docref(NULL, E_WARNING, "Unqualified function call: %.*s", (int) name_str->len, name_str->val);
#ifdef VYRTUE_DEBUG
if (UNEXPECTED(NULL != getenv("PHP_VYRTUE_DEBUG_CALL"))) {
php_error_docref(NULL, E_WARNING, "vyrtue: Unqualified function call: %.*s", (int) name_str->len, name_str->val);
}
#endif
return NULL;
}

Expand Down

0 comments on commit 33bebca

Please sign in to comment.