Execution

zend_bool zend_make_callable(zval *callable, char **callable_name TSRMLS_DC); zend_bool zend_is_callable(zval *callable, uint check_flags, char **call_name); zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **call_name, int *call_name_len, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zval ***zobj_ptr_ptr TSRMLS_DC);

Checks whether the named function is callable. Returns 0 if callable, nonzero if otherwise.

Argument

Purpose

callable

Universal callback value. Might be a simple string identifying a normal function, or an array containing an object/class and a method name.

check_flags

Either or none of the following values: IS_CALLABLE_CHECK_SYNTAX_ONLY, IS_CALLABLE_CHECK_IS_STATIC.

call_name

If not passed as NULL, populated with a human readable representation of the call syntax that would be used. Helpful for error messages.

call_name_len

Length of the formatted call_name string.

ce_ptr

When specified using array syntax, this value is populated with the discovered class entry.

fptr_ptr

Populated with a pointer to the zend_function* of the discovered function or method.

zobj_ptr_ptr

When specified using array syntax, this value is populated with the discovered object instance.

int call_user_function(HashTable *function_table, zval **object_pp, zval *function_name, zval *retval_ptr, zend_uint param_count, zval *params[] TSRMLS_DC); int call_user_function_ex(HashTable *function_table, zval **object_pp, zval *function_name, zval **retval_ptr_ptr, zend_uint param_count, zval **params[], int no_separation, HashTable *symbol_table TSRMLS_DC);

Calls a userspace or internal function by its userspace name. The function's return value will be either copied into retval_ptr or referenced into retval_ptr_ptr. Returns SUCCESS or FAILURE.

Argument

Purpose

function_table

Default function table to look for the named function in. Typically this will be EG(function_table).

object_pp

Object instance or classname to perform a method call.

function_name

Universal callback value. Either String or Array as described for zend_is_callable().

retval_ptr(_ptr)

Populated with the result of the called function.

param_count

Number of parameters to expect in the params vector.

params

Vector of param_count elements of single or double dereferenced zvals.

Arguments

Purpose

no_separation

When set to 1, attempts to separate the passed argument will result in a call FAILURE.

symbol_table

Prebuilt symbol table to be given to function being called. Note: On completion of this function the symbol table will be destroyed.

int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSRMLS_DC); int zend_eval_string_ex(char *str, zval *retval_ptr, char *string_name, int handle_exceptns TSRMLS_DC);

Evaluates an arbitrary string of PHP code as with the userspace function eval().

Argument

Purpose

str

PHP code string to process.

retval_ptr

Populated with the return value if one is produced.

string_name

Descriptive string used for error responding.

handle_exceptns

If set to true, any exceptions will be automatically rethrown and a result code of FAILURE returned.

int zend_execute_scripts(int type TSRMLS_DC, zval **retval, int count, ...);

Executes one or more script files referred to by prepared zend_file_handle structures. This method is similar to the php_execute_script() function used in Chapter 19, "Setting Up a Host Environment." That shouldn't be any surprise because it's the underlying function call that php_execute_script() uses. The primary difference between these two is that the PHPAPI version handles additional INI setting such as auto_prepend_file and auto_append_file.

Argument

Purpose

type

Inclusion type. One of ZEND_INCLUDE, ZEND_REQUIRE, ZEND_INCLUDE_ONCE, or ZEND_REQUIRE_ONCE.

retval

Populated on completion with the final return value produced by the series of scripts.

count

Number of zend_file_handle structs that can be expected in the following variable argument list.

...

List of count occurrences of zend_file_handle* variables to be processed.

void zend_set_timeout(long seconds); void zend_unset_timeout(TSRMLS_D);

Control script execution timeouts as with the userspace set_time_limit() function.

Категории