Unexposed module function should be static and should not be defined in
'php_modulename.h'.
- static int php_session_destroy(TSRMLS_D)
+ static int php_session_destroy()
2. Main module source file must be named 'modulename.c'.
zval *image = NULL;
zval *font = NULL;
- if (zend_parse_parameters(argc TSRMLS_CC, "rsrll|l", &image, &text, &text_len, &font, &x, &y, &color) == FAILURE)
+ if (zend_parse_parameters(argc, "rsrll|l", &image, &text, &text_len, &font, &x, &y, &color) == FAILURE)
return;
if (image) {
Checking output control layers status:
// Using OG()
- php_output_get_status(TSRMLS_C);
+ php_output_get_status();
Starting the default output handler:
- // php_start_ob_buffer(NULL, 0, 1 TSRMLS_CC);
- php_output_start_default(TSRMLS_C);
+ // php_start_ob_buffer(NULL, 0, 1);
+ php_output_start_default();
Starting an user handler by zval:
- // php_start_ob_buffer(zhandler, chunk_size, erase TSRMLS_CC);
- php_output_start_user(zhandler, chunk_size, flags TSRMLS_CC);
+ // php_start_ob_buffer(zhandler, chunk_size, erase);
+ php_output_start_user(zhandler, chunk_size, flags);
Starting an internal handler whithout context:
- // php_ob_set_internal_handler(my_php_output_handler_func_t, buffer_size, "output handler name", erase TSRMLS_CC);
- php_output_start_internal(handler_name, handler_name_len, my_php_output_handler_func_t, chunk_size, flags TSRMLS_CC);
+ // php_ob_set_internal_handler(my_php_output_handler_func_t, buffer_size, "output handler name", erase);
+ php_output_start_internal(handler_name, handler_name_len, my_php_output_handler_func_t, chunk_size, flags);
Starting an internal handler with context:
// not possible with old API
php_output_handler *h;
- h = php_output_handler_create_internal(handler_name, handler_name_len, my_php_output_handler_context_func_t, chunk_size, flags TSRMLS_CC);
+ h = php_output_handler_create_internal(handler_name, handler_name_len, my_php_output_handler_context_func_t, chunk_size, flags);
php_output_handler_set_context(h, my_context, my_context_dtor);
- php_output_handler_start(h TSRMLS_CC);
+ php_output_handler_start(h);
Testing whether a certain output handler has already been started:
- // php_ob_handler_used("output handler name" TSRMLS_CC);
- php_output_handler_started(handler_name, handler_name_len TSRMLS_CC);
+ // php_ob_handler_used("output handler name");
+ php_output_handler_started(handler_name, handler_name_len);
Flushing one output buffer:
- // php_end_ob_buffer(1, 1 TSRMLS_CC);
- php_output_flush(TSRMLS_C);
+ // php_end_ob_buffer(1, 1);
+ php_output_flush();
Flushing all output buffers:
// not possible with old API
- php_output_flush_all(TSRMLS_C);
+ php_output_flush_all();
Cleaning one output buffer:
- // php_ob_end_buffer(0, 1 TSRMLS_CC);
- php_output_clean(TSRMLS_C);
+ // php_ob_end_buffer(0, 1);
+ php_output_clean();
Cleaning all output buffers:
// not possible with old API
- php_output_clean_all(TSRMLS_C);
+ php_output_clean_all();
Discarding one output buffer:
- // php_ob_end_buffer(0, 0 TSRMLS_CC);
- php_output_discard(TSRMLS_C);
+ // php_ob_end_buffer(0, 0);
+ php_output_discard();
Discarding all output buffers:
- // php_ob_end_buffers(0 TSRMLS_CC);
- php_output_discard_all(TSRMLS_C);
+ // php_ob_end_buffers(0);
+ php_output_discard_all();
Stopping (and dropping) one output buffer:
- // php_ob_end_buffer(1, 0 TSRMLS_CC)
- php_output_end(TSRMLS_C);
+ // php_ob_end_buffer(1, 0)
+ php_output_end();
Stopping (and dropping) all output buffers:
- // php_ob_end_buffers(1, 0 TSRMLS_CC);
- php_output_end_all(TSRMLS_C);
+ // php_ob_end_buffers(1, 0);
+ php_output_end_all();
Retrieving output buffers contents:
- // php_ob_get_buffer(zstring TSRMLS_CC);
- php_output_get_contents(zstring TSRMLS_CC);
+ // php_ob_get_buffer(zstring);
+ php_output_get_contents(zstring);
Retrieving output buffers length:
- // php_ob_get_length(zlength TSRMLS_CC);
- php_output_get_length(zlength TSRMLS_CC);
+ // php_ob_get_length(zlength);
+ php_output_get_length(zlength);
Retrieving output buffering level:
// OG(nesting_level);
- php_output_get_level(TSRMLS_C);
+ php_output_get_level();
Issue a warning because of an output handler conflict:
- // php_ob_init_conflict("to be started handler name", "to be tested if already started handler name" TSRMLS_CC);
- php_output_handler_conflict(new_handler_name, new_handler_name_len, set_handler_name, set_handler_name_len TSRMLS_CC);
+ // php_ob_init_conflict("to be started handler name", "to be tested if already started handler name");
+ php_output_handler_conflict(new_handler_name, new_handler_name_len, set_handler_name, set_handler_name_len);
Registering a conflict checking function, which will be checked prior starting the handler:
// not possible with old API, unless hardcoding into output.c
- php_output_handler_conflict_register(handler_name, handler_name_len, my_php_output_handler_conflict_check_t TSRMLS_CC);
+ php_output_handler_conflict_register(handler_name, handler_name_len, my_php_output_handler_conflict_check_t);
Registering a reverse conflict checking function, which will be checked prior starting the specified foreign handler:
// not possible with old API
- php_output_handler_reverse_conflict_register(foreign_handler_name, foreign_handler_name_len, my_php_output_handler_conflict_check_t TSRMLS_CC);
+ php_output_handler_reverse_conflict_register(foreign_handler_name, foreign_handler_name_len, my_php_output_handler_conflict_check_t);
Facilitating a context from within an output handler callable with ob_start():
// not possible with old API
- php_output_handler_hook(PHP_OUTPUT_HANDLER_HOOK_GET_OPAQ, (void *) &custom_ctx_ptr_ptr TSRMLS_CC);
+ php_output_handler_hook(PHP_OUTPUT_HANDLER_HOOK_GET_OPAQ, (void *) &custom_ctx_ptr_ptr);
Disabling of the output handler by itself:
//not possible with old API
- php_output_handler_hook(PHP_OUTPUT_HANDLER_HOOK_DISABLE, NULL TSRMLS_CC);
+ php_output_handler_hook(PHP_OUTPUT_HANDLER_HOOK_DISABLE, NULL);
Marking an output handler immutable by itself because of irreversibility of its operation:
// not possible with old API
- php_output_handler_hook(PHP_OUTPUT_HANDLER_HOOK_IMMUTABLE, NULL TSRMLS_CC);
+ php_output_handler_hook(PHP_OUTPUT_HANDLER_HOOK_IMMUTABLE, NULL);
Restarting the output handler because of a CLEAN operation:
// not possible with old API
Prototypes
----------
/* Implemented. */
-int zend_parse_parameters(int num_args TSRMLS_DC, char *type_spec, ...);
-int zend_parse_parameters_ex(int flags, int num_args TSRMLS_DC, char *type_spec, ...);
+int zend_parse_parameters(int num_args, char *type_spec, ...);
+int zend_parse_parameters_ex(int flags, int num_args, char *type_spec, ...);
The zend_parse_parameters() function takes the number of parameters
passed to the extension function, the type specifier string, and the
PHP 5.5 includes a new function:
-int zend_parse_parameter(int flags, int arg_num TSRMLS_DC, zval **arg, const char *spec, ...);
+int zend_parse_parameter(int flags, int arg_num, zval **arg, const char *spec, ...);
This function behaves like zend_parse_parameters_ex() except that instead of
reading the arguments from the stack, it receives a single zval to convert
1)
char *str;
long str_len; /* XXX THIS IS WRONG!! Use size_t instead. */
- zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len)
+ zend_parse_parameters(ZEND_NUM_ARGS(), "s", &str, &str_len)
2)
int num; /* XXX THIS IS WRONG!! Use zend_long instead. */
- zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &num)
+ zend_parse_parameters(ZEND_NUM_ARGS(), "l", &num)
If you're in doubt, use check_parameters.php script to the parameters
and their types (it can be found in ./scripts/dev/ directory of PHP sources):
char *s;
size_t s_len;
zval *param;
-if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lsz",
+if (zend_parse_parameters(ZEND_NUM_ARGS(), "lsz",
&l, &s, &s_len, ¶m) == FAILURE) {
return;
}
zval *obj;
double d = 0.5;
zend_class_entry *my_ce;
-if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|d",
+if (zend_parse_parameters(ZEND_NUM_ARGS(), "O|d",
&obj, my_ce, &d) == FAILURE) {
return;
}
If null is passed for object, obj will be set to NULL. */
zval *obj;
zval *arr;
-if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o!a",
+if (zend_parse_parameters(ZEND_NUM_ARGS(), "o!a",
&obj, &arr) == FAILURE) {
return;
}
/* Gets a separated array which can also be null. */
zval *arr;
-if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/!",
+if (zend_parse_parameters(ZEND_NUM_ARGS(), "a/!",
&arr) == FAILURE) {
return;
}
*/
size_t length;
-if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC,
+if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(),
"lll", &l1, &l2, &l3) == SUCCESS) {
/* manipulate longs */
-} else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC,
+} else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(),
"s", &s, &length) == SUCCESS) {
/* manipulate string */
} else {
zval *varargs = NULL;
-if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "*", &varargs, &num_varargs) == FAILURE) {
+if (zend_parse_parameters(ZEND_NUM_ARGS(), "*", &varargs, &num_varargs) == FAILURE) {
return;
}
int i, num_varargs;
zval *varargs = NULL;
-if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s+", &str, &str_len, &varargs, &num_varargs) == FAILURE) {
+if (zend_parse_parameters(ZEND_NUM_ARGS(), "s+", &str, &str_len, &varargs, &num_varargs) == FAILURE) {
return;
}
int i, num_varargs;
zval *varargs = NULL;
-if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a*l", &array, &varargs, &num_varargs, &num) == FAILURE) {
+if (zend_parse_parameters(ZEND_NUM_ARGS(), "a*l", &array, &varargs, &num_varargs, &num) == FAILURE) {
return;
}
PHPAPI size_t php_stream_read(php_stream * stream, char * buf, size_t count);
PHPAPI size_t php_stream_write(php_stream * stream, const char * buf, size_t
count);
-PHPAPI size_t php_stream_printf(php_stream * stream TSRMLS_DC,
+PHPAPI size_t php_stream_printf(php_stream * stream,
const char * fmt, ...);
PHPAPI int php_stream_eof(php_stream * stream);
PHPAPI int php_stream_getc(php_stream * stream);
In most cases, you should use this API:
PHPAPI php_stream *php_stream_open_wrapper(const char *path, const char *mode,
- int options, char **opened_path TSRMLS_DC);
+ int options, char **opened_path);
Where:
path is the file or resource to open.
Open a FILE * with tmpfile() and convert into a stream.
PHPAPI php_stream *php_stream_fopen_temporary_file(const char *dir,
- const char *pfx, char **opened_path TSRMLS_DC);
+ const char *pfx, char **opened_path);
Generate a temporary file name and open it.
There are some network enabled relatives in php_network.h:
strcpy(raw_var, "RAW_");
strlcat(raw_var,var,var_len+5);
- php_register_variable_ex(raw_var, &new_var, array_ptr TSRMLS_DC);
+ php_register_variable_ex(raw_var, &new_var, array_ptr);
php_strip_tags(*val, val_len, NULL, NULL, 0);
zval **tmp;
zval *array_ptr = NULL;
- if(zend_parse_parameters(2 TSRMLS_CC, "ls", &arg, &var, &var_len) == FAILURE) {
+ if(zend_parse_parameters(2, "ls", &arg, &var, &var_len) == FAILURE) {
return;
}
error occurred).
The internal PHP code can set the global last error with:
-void intl_error_set_code(intl_error* err, UErrorCode err_code TSRMLS_DC);
-void intl_error_set_custom_msg(intl_error* err, char* msg, int copyMsg TSRMLS_DC);
-void intl_error_set(intl_error* err, UErrorCode code, char* msg, int copyMsg TSRMLS_DC);
+void intl_error_set_code(intl_error* err, UErrorCode err_code);
+void intl_error_set_custom_msg(intl_error* err, char* msg, int copyMsg);
+void intl_error_set(intl_error* err, UErrorCode code, char* msg, int copyMsg);
and by passing NULL as the first parameter. The last function is a combination
of the first two. If the message is not a static buffer, copyMsg should be 1.
The global error and the object error can be SIMULTANEOUSLY set with these
functions:
-void intl_errors_set_custom_msg(intl_error* err, char* msg, int copyMsg TSRMLS_DC);
-void intl_errors_set_code(intl_error* err, UErrorCode err_code TSRMLS_DC);
-void intl_errors_set(intl_error* err, UErrorCode code, char* msg, int copyMsg TSRMLS_DC);
+void intl_errors_set_custom_msg(intl_error* err, char* msg, int copyMsg);
+void intl_errors_set_code(intl_error* err, UErrorCode err_code);
+void intl_errors_set(intl_error* err, UErrorCode code, char* msg, int copyMsg);
by passing a pointer to the object's intl_error structed as the first parameter.
Node the extra 's' in the functions' names ('errors', not 'error').
ICU operates, where functions return immediately if an error is set.
Error resetting can be done with:
-void intl_error_reset(NULL TSRMLS_DC); /* reset global error */
-void intl_errors_reset(intl_error* err TSRMLS_DC ); /* reset global and object error */
+void intl_error_reset(NULL); /* reset global error */
+void intl_errors_reset(intl_error* err ); /* reset global and object error */
In practice, intl_errors_reset() is not used because most classes have also
plain functions mapped to the same internal functions as their instance methods.
BREAKITER_METHOD_INIT_VARS; /* macro also resets global error */
object = getThis();
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s",
&text, &text_len) == FAILURE) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "breakiter_set_text: bad arguments", 0 TSRMLS_CC);
+ "breakiter_set_text: bad arguments", 0);
RETURN_FALSE;
}