From c43806f4152c3ff908c7ead039daf5e163700f0e Mon Sep 17 00:00:00 2001 From: Zeev Suraski Date: Mon, 30 Jul 2001 08:24:42 +0000 Subject: Zend compatibility patch --- ext/calendar/calendar.c | 8 ++-- ext/com/COM.c | 2 +- ext/crack/crack.c | 6 +-- ext/curl/curl.c | 8 ++-- ext/db/db.c | 42 ++++++++---------- ext/dbx/dbx.c | 10 +++-- ext/fbsql/php_fbsql.c | 47 +++++++++------------ ext/gd/gd.c | 88 +++++++++++++++++++------------------- ext/gd/gd_ctx.c | 6 +-- ext/imap/php_imap.c | 1 - ext/ingres_ii/ii.c | 2 +- ext/mailparse/mailparse.c | 26 +++++++----- ext/mailparse/rfc2045cdecode.c | 5 ++- ext/mssql/php_mssql.c | 19 ++++----- ext/mysql/php_mysql.c | 4 +- ext/odbc/php_odbc.c | 33 +++++++-------- ext/odbc/php_odbc.h | 2 +- ext/openssl/openssl.c | 96 +++++++++++++++++++++--------------------- ext/pcntl/pcntl.c | 29 +++++++------ ext/pcre/php_pcre.c | 4 +- ext/pgsql/pgsql.c | 2 +- ext/readline/readline.c | 2 +- ext/rpc/com/com_wrapper.c | 2 +- ext/sablot/sablot.c | 9 ++-- ext/session/mod_user.c | 2 +- ext/sockets/sockets.c | 6 +-- ext/standard/array.c | 66 ++++++++++++++--------------- ext/standard/assert.c | 2 +- ext/standard/basic_functions.c | 20 ++++----- ext/standard/file.c | 4 +- ext/standard/formatted_print.c | 16 +++---- ext/standard/fsock.c | 3 +- ext/standard/scanf.c | 7 +-- ext/standard/scanf.h | 4 +- ext/standard/string.c | 15 +++---- ext/standard/var.c | 4 +- ext/wddx/wddx.c | 8 ++-- ext/xml/xml.c | 2 +- ext/xslt/xslt.c | 7 +-- ext/yp/yp.c | 2 +- main/fopen_wrappers.c | 2 +- main/main.c | 6 +-- main/output.c | 10 ++--- main/streams.c | 26 ++++++++---- sapi/cgi/cgi_main.c | 2 +- sapi/isapi/php4isapi.c | 14 +++--- sapi/pi3web/pi3web_sapi.c | 2 +- sapi/servlet/servlet.c | 2 +- 48 files changed, 342 insertions(+), 343 deletions(-) diff --git a/ext/calendar/calendar.c b/ext/calendar/calendar.c index 1823db120c..83e92b0e44 100644 --- a/ext/calendar/calendar.c +++ b/ext/calendar/calendar.c @@ -150,7 +150,7 @@ PHP_FUNCTION(cal_info) } convert_to_long_ex(cal); if (Z_LVAL_PP(cal) < 0 || Z_LVAL_PP(cal) >= CAL_NUM_CALS) { - zend_error(E_WARNING, "%s(): invalid calendar ID %d", get_active_function_name(), Z_LVAL_PP(cal)); + zend_error(E_WARNING, "%s(): invalid calendar ID %d", get_active_function_name(TSRMLS_C), Z_LVAL_PP(cal)); RETURN_FALSE; } @@ -192,7 +192,7 @@ PHP_FUNCTION(cal_days_in_month) convert_to_long_ex(year); if (Z_LVAL_PP(cal) < 0 || Z_LVAL_PP(cal) >= CAL_NUM_CALS) { - zend_error(E_WARNING, "%s(): invalid calendar ID %d", get_active_function_name(), Z_LVAL_PP(cal)); + zend_error(E_WARNING, "%s(): invalid calendar ID %d", get_active_function_name(TSRMLS_C), Z_LVAL_PP(cal)); RETURN_FALSE; } @@ -228,7 +228,7 @@ PHP_FUNCTION(cal_to_jd) convert_to_long_ex(year); if (Z_LVAL_PP(cal) < 0 || Z_LVAL_PP(cal) >= CAL_NUM_CALS) { - zend_error(E_WARNING, "%s(): invalid calendar ID %d", get_active_function_name(), Z_LVAL_PP(cal)); + zend_error(E_WARNING, "%s(): invalid calendar ID %d", get_active_function_name(TSRMLS_C), Z_LVAL_PP(cal)); RETURN_FALSE; } @@ -254,7 +254,7 @@ PHP_FUNCTION(cal_from_jd) convert_to_long_ex(cal); if (Z_LVAL_PP(cal) < 0 || Z_LVAL_PP(cal) >= CAL_NUM_CALS) { - zend_error(E_WARNING, "%s(): invalid calendar ID %d", get_active_function_name(), Z_LVAL_PP(cal)); + zend_error(E_WARNING, "%s(): invalid calendar ID %d", get_active_function_name(TSRMLS_C), Z_LVAL_PP(cal)); RETURN_FALSE; } calendar = &cal_conversion_table[Z_LVAL_PP(cal)]; diff --git a/ext/com/COM.c b/ext/com/COM.c index ddd3a4a7ae..a9d18cec9f 100644 --- a/ext/com/COM.c +++ b/ext/com/COM.c @@ -1628,7 +1628,7 @@ static int php_COM_load_typelib(ITypeLib *TypeLib, int mode) SysFreeString(bstr_ids); c.name_len = strlen(ids)+1; c.name = ids; - if (zend_get_constant(c.name, c.name_len-1, &exists)) + if (zend_get_constant(c.name, c.name_len-1, &exists TSRMLS_CC)) { /* Oops, it already exists. No problem if it is defined as the same value */ /* Check to see if they are the same */ diff --git a/ext/crack/crack.c b/ext/crack/crack.c index e69c63e290..f261381022 100644 --- a/ext/crack/crack.c +++ b/ext/crack/crack.c @@ -61,7 +61,7 @@ PHP_INI_BEGIN() STD_PHP_INI_ENTRY("crack.default_dictionary", NULL, PHP_INI_SYSTEM, OnUpdateString, default_dictionary, zend_crack_globals, crack_globals) PHP_INI_END() -long _crack_open_dict(char *dictpath) +long _crack_open_dict(char *dictpath TSRMLS_DC) { PWDICT *pwdict; long resource; @@ -145,7 +145,7 @@ ZEND_FUNCTION(crack_opendict) convert_to_string_ex(dictpath); - if (-1 == (resource = _crack_open_dict(Z_STRVAL_PP(dictpath)))) { + if (-1 == (resource = _crack_open_dict(Z_STRVAL_PP(dictpath) TSRMLS_CC))) { RETURN_FALSE; } @@ -202,7 +202,7 @@ ZEND_FUNCTION(crack_check) RETURN_FALSE; } if (NULL != CRACKG(default_dictionary) && CRACKG(current_id) == -1) { - _crack_open_dict(CRACKG(default_dictionary)); + _crack_open_dict(CRACKG(default_dictionary) TSRMLS_CC); } id = CRACKG(current_id); break; diff --git a/ext/curl/curl.c b/ext/curl/curl.c index ef242ef5fa..2d74030608 100644 --- a/ext/curl/curl.c +++ b/ext/curl/curl.c @@ -286,7 +286,7 @@ static size_t curl_write(char *data, size_t size, size_t nmemb, void *ctx) error = call_user_function(EG(function_table), NULL, t->func, - retval, 2, argv); + retval, 2, argv TSRMLS_CC); if (error == FAILURE) { php_error(E_WARNING, "Cannot call the CURLOPT_WRITEFUNCTION"); length = -1; @@ -340,7 +340,7 @@ static size_t curl_read(char *data, size_t size, size_t nmemb, void *ctx) error = call_user_function(EG(function_table), NULL, t->func, - retval, 3, argv); + retval, 3, argv TSRMLS_CC); if (error == FAILURE) { php_error(E_WARNING, "Cannot call the CURLOPT_READFUNCTION"); length = -1; @@ -402,7 +402,7 @@ static size_t curl_write_header(char *data, size_t size, size_t nmemb, void *ctx error = call_user_function(EG(function_table), NULL, t->func, - retval, 2, argv); + retval, 2, argv TSRMLS_CC); if (error == FAILURE) { php_error(E_WARNING, "Couldn't call the CURLOPT_HEADERFUNCTION"); length = -1; @@ -450,7 +450,7 @@ static size_t curl_passwd(void *ctx, char *prompt, char *buf, int buflen) error = call_user_function(EG(function_table), NULL, func, - retval, 2, argv); + retval, 2, argv TSRMLS_CC); if (error == FAILURE) { php_error(E_WARNING, "Couldn't call the CURLOPT_PASSWDFUNCTION"); ret = -1; diff --git a/ext/db/db.c b/ext/db/db.c index 323641b235..018981af5f 100644 --- a/ext/db/db.c +++ b/ext/db/db.c @@ -168,13 +168,12 @@ void *dbm_mutex; /* {{{ php_find_dbm */ -dbm_info *php_find_dbm(pval *id) +dbm_info *php_find_dbm(pval *id TSRMLS_DC) { list_entry *le; dbm_info *info; int numitems, i; int info_type; - TSRMLS_FETCH(); if (Z_TYPE_P(id) == IS_STRING) { numitems = zend_hash_num_elements(&EG(regular_list)); @@ -260,7 +259,8 @@ PHP_FUNCTION(dblist) /* {{{ proto int dbmopen(string filename, string mode) Opens a dbm database */ -PHP_FUNCTION(dbmopen) { +PHP_FUNCTION(dbmopen) +{ pval *filename, *mode; dbm_info *info=NULL; int ret; @@ -272,7 +272,7 @@ PHP_FUNCTION(dbmopen) { convert_to_string(filename); convert_to_string(mode); - info = php_dbm_open(Z_STRVAL_P(filename), Z_STRVAL_P(mode)); + info = php_dbm_open(Z_STRVAL_P(filename), Z_STRVAL_P(mode) TSRMLS_CC); if (info) { ret = zend_list_insert(info, le_db); RETURN_LONG(ret); @@ -284,22 +284,19 @@ PHP_FUNCTION(dbmopen) { /* {{{ php_dbm_open */ -dbm_info *php_dbm_open(char *filename, char *mode) +dbm_info *php_dbm_open(char *filename, char *mode TSRMLS_DC) { dbm_info *info; int ret, lock=0; char *lockfn = NULL; int lockfd = 0; - #if NFS_HACK int last_try = 0; struct stat sb; int retries = 0; #endif - DBM_TYPE dbf=NULL; DBM_MODE_TYPE imode; - TSRMLS_FETCH(); if (filename == NULL) { php_error(E_WARNING, "NULL filename passed to php_dbm_open()"); @@ -492,7 +489,7 @@ PHP_FUNCTION(dbminsert) convert_to_string(key); convert_to_string(value); - info = php_find_dbm(id); + info = php_find_dbm(id TSRMLS_CC); if (!info) { php_error(E_WARNING, "not a valid database identifier %d", Z_LVAL_P(id)); RETURN_FALSE; @@ -552,25 +549,24 @@ PHP_FUNCTION(dbmreplace) convert_to_string(key); convert_to_string(value); - info = php_find_dbm(id); + info = php_find_dbm(id TSRMLS_CC); if (!info) { php_error(E_WARNING, "not a valid database identifier %d", Z_LVAL_P(id)); RETURN_FALSE; } - ret = php_dbm_replace(info, Z_STRVAL_P(key), Z_STRVAL_P(value)); + ret = php_dbm_replace(info, Z_STRVAL_P(key), Z_STRVAL_P(value) TSRMLS_CC); RETURN_LONG(ret); } /* }}} */ /* {{{ php_dbm_replace */ -int php_dbm_replace(dbm_info *info, char *key, char *value) +int php_dbm_replace(dbm_info *info, char *key, char *value TSRMLS_DC) { DBM_TYPE dbf; int ret; datum key_datum, value_datum; - TSRMLS_FETCH(); if (PG(magic_quotes_runtime)) { php_stripslashes(key,NULL); @@ -614,13 +610,13 @@ PHP_FUNCTION(dbmfetch) } convert_to_string(key); - info = php_find_dbm(id); + info = php_find_dbm(id TSRMLS_CC); if (!info) { php_error(E_WARNING, "not a valid database identifier %d", Z_LVAL_P(id)); RETURN_FALSE; } - ret = php_dbm_fetch(info, Z_STRVAL_P(key)); + ret = php_dbm_fetch(info, Z_STRVAL_P(key) TSRMLS_CC); if (ret) { RETVAL_STRING(ret, 0); } else { @@ -631,12 +627,11 @@ PHP_FUNCTION(dbmfetch) /* {{{ php_dbm_fetch */ -char *php_dbm_fetch(dbm_info *info, char *key) +char *php_dbm_fetch(dbm_info *info, char *key TSRMLS_DC) { datum key_datum, value_datum; char *ret; DBM_TYPE dbf; - TSRMLS_FETCH(); key_datum.dptr = key; key_datum.dsize = strlen(key); @@ -691,7 +686,7 @@ PHP_FUNCTION(dbmexists) } convert_to_string(key); - info = php_find_dbm(id); + info = php_find_dbm(id TSRMLS_CC); if (!info) { php_error(E_WARNING, "not a valid database identifier %d", Z_LVAL_P(id)); RETURN_FALSE; @@ -740,7 +735,7 @@ PHP_FUNCTION(dbmdelete) } convert_to_string(key); - info = php_find_dbm(id); + info = php_find_dbm(id TSRMLS_CC); if (!info) { php_error(E_WARNING, "not a valid database identifier %d", Z_LVAL_P(id)); RETURN_FALSE; @@ -787,7 +782,7 @@ PHP_FUNCTION(dbmfirstkey) WRONG_PARAM_COUNT; } - info = php_find_dbm(id); + info = php_find_dbm(id TSRMLS_CC); if (!info) { php_error(E_WARNING, "not a valid database identifier %d", Z_LVAL_P(id)); RETURN_FALSE; @@ -849,13 +844,13 @@ PHP_FUNCTION(dbmnextkey) } convert_to_string(key); - info = php_find_dbm(id); + info = php_find_dbm(id TSRMLS_CC); if (!info) { php_error(E_WARNING, "not a valid database identifier %d", Z_LVAL_P(id)); RETURN_FALSE; } - ret = php_dbm_nextkey(info, Z_STRVAL_P(key)); + ret = php_dbm_nextkey(info, Z_STRVAL_P(key) TSRMLS_CC); if (!ret) { RETURN_FALSE; } else { @@ -866,12 +861,11 @@ PHP_FUNCTION(dbmnextkey) /* {{{ php_dbm_nextkey */ -char *php_dbm_nextkey(dbm_info *info, char *key) +char *php_dbm_nextkey(dbm_info *info, char *key TSRMLS_DC) { datum key_datum, ret_datum; char *ret; DBM_TYPE dbf; - TSRMLS_FETCH(); key_datum.dptr = key; key_datum.dsize = strlen(key); diff --git a/ext/dbx/dbx.c b/ext/dbx/dbx.c index f4ec5c39a4..470379495d 100644 --- a/ext/dbx/dbx.c +++ b/ext/dbx/dbx.c @@ -79,16 +79,18 @@ int split_dbx_handle_object(zval ** dbx_object, zval *** pdbx_handle, zval *** p } /* from dbx.h, to be used in support-files (dbx_mysql.c etc...) */ -void dbx_call_any_function(INTERNAL_FUNCTION_PARAMETERS, char * function_name, zval ** returnvalue, int number_of_arguments, zval *** params) { +void dbx_call_any_function(INTERNAL_FUNCTION_PARAMETERS, char * function_name, zval ** returnvalue, int number_of_arguments, zval ***params) +{ zval * zval_function_name; + MAKE_STD_ZVAL(zval_function_name); ZVAL_STRING(zval_function_name, function_name, 1); - if (call_user_function_ex(EG(function_table), NULL, zval_function_name, returnvalue, number_of_arguments, params, 0, NULL) == FAILURE) { + if (call_user_function_ex(EG(function_table), NULL, zval_function_name, returnvalue, number_of_arguments, params, 0, NULL TSRMLS_CC) == FAILURE) { zend_error(E_ERROR, "function '%s' not found", zval_function_name->value.str.val); - } + } zval_dtor(zval_function_name); /* to free stringvalue memory */ FREE_ZVAL(zval_function_name); - } +} /* switch_dbx functions declarations * each must be supported in the dbx_module files as dbx_module_function, diff --git a/ext/fbsql/php_fbsql.c b/ext/fbsql/php_fbsql.c index 61b83343e5..94d501b58e 100644 --- a/ext/fbsql/php_fbsql.c +++ b/ext/fbsql/php_fbsql.c @@ -260,7 +260,7 @@ static void phpfbReleaseResult(zend_rsrc_list_entry *rsrc) } -static void phpfbReleaseLink (zend_rsrc_list_entry *rsrc) +static void phpfbReleaseLink(zend_rsrc_list_entry *rsrc) { PHPFBLink* link = (PHPFBLink *)rsrc->ptr; TSRMLS_FETCH(); @@ -283,7 +283,7 @@ static void phpfbReleaseLink (zend_rsrc_list_entry *rsrc) } } -static void phpfbReleasePLink (zend_rsrc_list_entry *rsrc) +static void phpfbReleasePLink(zend_rsrc_list_entry *rsrc) { PHPFBLink* link = (PHPFBLink *)rsrc->ptr; TSRMLS_FETCH(); @@ -307,10 +307,8 @@ static void phpfbReleasePLink (zend_rsrc_list_entry *rsrc) } } -static void php_fbsql_set_default_link(int id) +static void php_fbsql_set_default_link(int id TSRMLS_DC) { - TSRMLS_FETCH(); - if (FB_SQL_G(linkIndex)!=-1) { zend_list_delete(FB_SQL_G(linkIndex)); } @@ -539,7 +537,7 @@ static void php_fbsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistant) if (ptr && (type==le_link || type==le_plink)) { zend_list_addref(link); return_value->value.lval = link; - php_fbsql_set_default_link(link); + php_fbsql_set_default_link(link TSRMLS_CC); return_value->type = IS_RESOURCE; return; } else { @@ -577,7 +575,7 @@ static void php_fbsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistant) } FB_SQL_G(linkCount)++; } - php_fbsql_set_default_link(return_value->value.lval); + php_fbsql_set_default_link(return_value->value.lval TSRMLS_CC); } /* }}} */ @@ -660,12 +658,11 @@ PHP_FUNCTION(fbsql_close) /* {{{ php_fbsql_select_db */ -static int php_fbsql_select_db(char *databaseName, PHPFBLink *link) +static int php_fbsql_select_db(char *databaseName, PHPFBLink *link TSRMLS_DC) { unsigned port; FBCDatabaseConnection* c; FBCMetaData* md; - TSRMLS_FETCH(); if (!link->databaseName || strcmp(link->databaseName, databaseName)) { @@ -1072,8 +1069,9 @@ PHP_FUNCTION(fbsql_select_db) } } - if (!php_fbsql_select_db(name, phpLink)) RETURN_FALSE; - + if (!php_fbsql_select_db(name, phpLink TSRMLS_CC)) { + RETURN_FALSE; + } RETURN_TRUE; } /* }}} */ @@ -1386,7 +1384,9 @@ PHP_FUNCTION(fbsql_stop_db) convert_to_string_ex(database_name); databaseName = (*database_name)->value.str.val; - if (!php_fbsql_select_db(databaseName, phpLink)) RETURN_FALSE; + if (!php_fbsql_select_db(databaseName, phpLink TSRMLS_CC)) { + RETURN_FALSE; + } /* printf("Stop db %x\n",phpDatabase->connection); */ if (!fbcdcStopDatabase(phpLink->connection)) @@ -1499,7 +1499,6 @@ static void phpfbQuery(INTERNAL_FUNCTION_PARAMETERS, char* sql, PHPFBLink* link) char* tp; char* fh; unsigned int sR = 1, cR = 0; - TSRMLS_FETCH(); meta = fbcdcExecuteDirectSQL(link->connection, sql); @@ -1639,12 +1638,9 @@ PHP_FUNCTION(fbsql_db_query) convert_to_string_ex(query); convert_to_string_ex(dbname); - if (php_fbsql_select_db((*dbname)->value.str.val, phpLink)) - { + if (php_fbsql_select_db((*dbname)->value.str.val, phpLink TSRMLS_CC)) { phpfbQuery(INTERNAL_FUNCTION_PARAM_PASSTHRU, (*query)->value.str.val, phpLink); - } - else - { + } else { RETURN_FALSE; } } @@ -1728,13 +1724,10 @@ PHP_FUNCTION(fbsql_list_tables) convert_to_string_ex(database_name); databaseName = (*database_name)->value.str.val; - if (databaseName == NULL) - { - php_fbsql_select_db(FB_SQL_G(databaseName), phpLink); - } - else - { - php_fbsql_select_db(databaseName, phpLink); + if (databaseName == NULL) { + php_fbsql_select_db(FB_SQL_G(databaseName), phpLink TSRMLS_CC); + } else { + php_fbsql_select_db(databaseName, phpLink TSRMLS_CC); } phpfbQuery(INTERNAL_FUNCTION_PARAM_PASSTHRU, sql, phpLink); @@ -1776,7 +1769,9 @@ PHP_FUNCTION(fbsql_list_fields) convert_to_string_ex(table_name); tableName = (*table_name)->value.str.val; - if (!php_fbsql_select_db(databaseName, phpLink)) RETURN_FALSE; + if (!php_fbsql_select_db(databaseName, phpLink TSRMLS_CC)) { + RETURN_FALSE; + } sprintf(sql,"EXTRACT TABLE %s;",tableName); diff --git a/ext/gd/gd.c b/ext/gd/gd.c index 873272e2b1..68eaa490c1 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -545,7 +545,7 @@ PHP_FUNCTION(imagecreatetruecolor) ZEND_REGISTER_RESOURCE(return_value, im, le_gd); #else - zend_error(E_ERROR, "%s(): requires GD 2.0 or later", get_active_function_name()); + zend_error(E_ERROR, "%s(): requires GD 2.0 or later", get_active_function_name(TSRMLS_C)); #endif } /* }}} */ @@ -571,7 +571,7 @@ PHP_FUNCTION(imagetruecolortopalette) RETURN_TRUE; #else - zend_error(E_ERROR, "%s(): requires GD 2.0 or later", get_active_function_name()); + zend_error(E_ERROR, "%s(): requires GD 2.0 or later", get_active_function_name(TSRMLS_C)); #endif } @@ -597,7 +597,7 @@ PHP_FUNCTION(imagesetthickness) RETURN_TRUE; #else - zend_error(E_ERROR, "%s(): requires GD 2.0 or later", get_active_function_name()); + zend_error(E_ERROR, "%s(): requires GD 2.0 or later", get_active_function_name(TSRMLS_C)); #endif } @@ -628,7 +628,7 @@ PHP_FUNCTION(imageellipse) RETURN_TRUE; #else - zend_error(E_ERROR, "%s(): requires GD 2.0 or later", get_active_function_name()); + zend_error(E_ERROR, "%s(): requires GD 2.0 or later", get_active_function_name(TSRMLS_C)); #endif } /* }}} */ @@ -658,7 +658,7 @@ PHP_FUNCTION(imagefilledellipse) RETURN_TRUE; #else - zend_error(E_ERROR, "%s(): requires GD 2.0 or later", get_active_function_name()); + zend_error(E_ERROR, "%s(): requires GD 2.0 or later", get_active_function_name(TSRMLS_C)); #endif } /* }}} */ @@ -697,7 +697,7 @@ PHP_FUNCTION(imagefilledarc) gdImageFilledArc(im,Z_LVAL_PP(cx),Z_LVAL_PP(cy),Z_LVAL_PP(w),Z_LVAL_PP(h),st,e,Z_LVAL_PP(col), Z_LVAL_PP(style)); RETURN_TRUE; #else - zend_error(E_ERROR, "%s(): requires GD 2.0 or later", get_active_function_name()); + zend_error(E_ERROR, "%s(): requires GD 2.0 or later", get_active_function_name(TSRMLS_C)); #endif } /* }}} */ @@ -722,7 +722,7 @@ PHP_FUNCTION(imagealphablending) RETURN_TRUE; #else - zend_error(E_ERROR, "%s(): requires GD 2.0 or later", get_active_function_name()); + zend_error(E_ERROR, "%s(): requires GD 2.0 or later", get_active_function_name(TSRMLS_C)); #endif } /* }}} */ @@ -749,7 +749,7 @@ PHP_FUNCTION(imagecolorresolvealpha) RETURN_LONG(gdImageColorResolveAlpha(im, Z_LVAL_PP(red), Z_LVAL_PP(green), Z_LVAL_PP(blue), Z_LVAL_PP(alpha))); #else - zend_error(E_ERROR, "%s(): requires GD 2.0 or later", get_active_function_name()); + zend_error(E_ERROR, "%s(): requires GD 2.0 or later", get_active_function_name(TSRMLS_C)); #endif } @@ -777,7 +777,7 @@ PHP_FUNCTION(imagecolorclosestalpha) RETURN_LONG(gdImageColorClosestAlpha(im, Z_LVAL_PP(red), Z_LVAL_PP(green), Z_LVAL_PP(blue), Z_LVAL_PP(alpha))); #else - zend_error(E_ERROR, "%s(): requires GD 2.0 or later", get_active_function_name()); + zend_error(E_ERROR, "%s(): requires GD 2.0 or later", get_active_function_name(TSRMLS_C)); #endif } /* }}} */ @@ -804,7 +804,7 @@ PHP_FUNCTION(imagecolorexactalpha) RETURN_LONG(gdImageColorExactAlpha(im, Z_LVAL_PP(red), Z_LVAL_PP(green), Z_LVAL_PP(blue), Z_LVAL_PP(alpha))); #else - zend_error(E_ERROR, "%s(): requires GD 2.0 or later", get_active_function_name()); + zend_error(E_ERROR, "%s(): requires GD 2.0 or later", get_active_function_name(TSRMLS_C)); #endif } /* }}} */ @@ -848,7 +848,7 @@ PHP_FUNCTION(imagecopyresampled) gdImageCopyResampled(im_dst, im_src, dstX, dstY, srcX, srcY, dstW, dstH, srcW, srcH); RETURN_TRUE; #else - zend_error(E_ERROR, "%s(): requires GD 2.0 or later", get_active_function_name()); + zend_error(E_ERROR, "%s(): requires GD 2.0 or later", get_active_function_name(TSRMLS_C)); #endif } /* }}} */ @@ -873,7 +873,7 @@ PHP_FUNCTION(imagesettile) RETURN_TRUE; #else - zend_error(E_ERROR, "%s(): requires a more recent version of GD", get_active_function_name()); + zend_error(E_ERROR, "%s(): requires a more recent version of GD", get_active_function_name(TSRMLS_C)); #endif } /* }}} */ @@ -898,7 +898,7 @@ PHP_FUNCTION(imagesetbrush) RETURN_TRUE; #else - zend_error(E_ERROR, "%s(): requires a more recent version of GD", get_active_function_name()); + zend_error(E_ERROR, "%s(): requires a more recent version of GD", get_active_function_name(TSRMLS_C)); #endif } /* }}} */ @@ -999,7 +999,7 @@ gdImagePtr _php_image_create_from_string (zval **data, char *tn, gdImagePtr (*io im = (*ioctx_func_p)(io_ctx); if (!im) { - php_error(E_WARNING, "%s: Passed data is not in '%s' format", get_active_function_name(), tn); + php_error(E_WARNING, "%s: Passed data is not in '%s' format", get_active_function_name(TSRMLS_C), tn); return NULL; } @@ -1118,7 +1118,7 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type, #endif if (!fp && !socketd) { php_strip_url_passwd(fn); - php_error(E_WARNING, "%s: Unable to open '%s' for reading", get_active_function_name(), fn); + php_error(E_WARNING, "%s: Unable to open '%s' for reading", get_active_function_name(TSRMLS_C), fn); RETURN_FALSE; } @@ -1127,7 +1127,7 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type, #endif if(issock && !ioctx_func_p) { - php_error(E_WARNING, "%s: Sockets are not supported for image type '%s'",get_active_function_name(),tn); + php_error(E_WARNING, "%s: Sockets are not supported for image type '%s'",get_active_function_name(TSRMLS_C),tn); RETURN_FALSE; } @@ -1140,7 +1140,7 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type, buff_size = php_fread_all(&buff_em, socketd, fp, issock); if(!buff_size) { - php_error(E_WARNING,"%s: Cannot read image data",get_active_function_name()); + php_error(E_WARNING,"%s: Cannot read image data",get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -1150,7 +1150,7 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type, io_ctx = gdNewDynamicCtx(buff_size,buff); if(!io_ctx) { - php_error(E_WARNING,"%s: Cannot allocate GD IO context",get_active_function_name()); + php_error(E_WARNING,"%s: Cannot allocate GD IO context",get_active_function_name(TSRMLS_C)); RETURN_FALSE; } if (image_type == PHP_GDIMG_TYPE_GD2PART) { @@ -1172,7 +1172,7 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type, } if (!im) { - php_error(E_WARNING,"%s: '%s' is not a valid %s file", get_active_function_name(), fn, tn); + php_error(E_WARNING,"%s: '%s' is not a valid %s file", get_active_function_name(TSRMLS_C), fn, tn); RETURN_FALSE; } @@ -1328,20 +1328,20 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char if ((argc == 2) || (argc == 3 && Z_STRLEN_PP(file))) { if (!fn || fn == empty_string || php_check_open_basedir(fn)) { - php_error(E_WARNING, "%s: invalid filename '%s'", get_active_function_name(), fn); + php_error(E_WARNING, "%s: invalid filename '%s'", get_active_function_name(TSRMLS_C), fn); RETURN_FALSE; } fp = VCWD_FOPEN(fn, "wb"); if (!fp) { - php_error(E_WARNING, "%s: unable to open '%s' for writing", get_active_function_name(), fn); + php_error(E_WARNING, "%s: unable to open '%s' for writing", get_active_function_name(TSRMLS_C), fn); RETURN_FALSE; } switch(image_type) { case PHP_GDIMG_CONVERT_WBM: if(q<0||q>255) { - php_error(E_WARNING, "%s: invalid threshold value '%d'. It must be between 0 and 255",get_active_function_name(), q); + php_error(E_WARNING, "%s: invalid threshold value '%d'. It must be between 0 and 255",get_active_function_name(TSRMLS_C), q); } case PHP_GDIMG_TYPE_JPG: (*func_p)(im, fp, q); @@ -1365,14 +1365,14 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char tmp = tmpfile(); if (tmp == NULL) { - php_error(E_WARNING, "%s: unable to open temporary file", get_active_function_name()); + php_error(E_WARNING, "%s: unable to open temporary file", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } switch(image_type) { case PHP_GDIMG_CONVERT_WBM: if(q<0||q>255) { - php_error(E_WARNING, "%s: invalid threshold value '%d'. It must be between 0 and 255",get_active_function_name(), q); + php_error(E_WARNING, "%s: invalid threshold value '%d'. It must be between 0 and 255",get_active_function_name(TSRMLS_C), q); } case PHP_GDIMG_TYPE_JPG: (*func_p)(im, tmp, q); @@ -2518,7 +2518,7 @@ PHP_FUNCTION(imagecopymergegray) gdImageCopyMergeGray(im_dst, im_src, dstX, dstY, srcX, srcY, srcW, srcH, pct); RETURN_TRUE; #else - php_error(E_WARNING, "%s(): was introduced in GD version 1.5", get_active_function_name()); + php_error(E_WARNING, "%s(): was introduced in GD version 1.5", get_active_function_name(TSRMLS_C)); RETURN_FALSE; #endif } @@ -2611,7 +2611,7 @@ PHP_FUNCTION(imageftbbox) #if HAVE_LIBGD20 && HAVE_LIBFREETYPE && HAVE_GD_STRINGFTEX php_imagettftext_common(INTERNAL_FUNCTION_PARAM_PASSTHRU, TTFTEXT_BBOX, 1); #else - php_error(E_WARNING, "%s(): No FreeType 2 support in this PHP build", get_active_function_name()); + php_error(E_WARNING, "%s(): No FreeType 2 support in this PHP build", get_active_function_name(TSRMLS_C)); RETURN_FALSE; #endif } @@ -2624,7 +2624,7 @@ PHP_FUNCTION(imagefttext) #if HAVE_LIBGD20 && HAVE_LIBFREETYPE && HAVE_GD_STRINGFTEX php_imagettftext_common(INTERNAL_FUNCTION_PARAM_PASSTHRU, TTFTEXT_DRAW, 1); #else - php_error(E_WARNING, "%s(): No FreeType 2 support in this PHP build", get_active_function_name()); + php_error(E_WARNING, "%s(): No FreeType 2 support in this PHP build", get_active_function_name(TSRMLS_C)); RETURN_FALSE; #endif } @@ -2677,7 +2677,7 @@ void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode, int extende #if !HAVE_GD_STRINGFTEX if (extended) { - zend_error(E_ERROR, "%s(): gdImageStringFTEx not supported in this PHP build", get_active_function_name()); + zend_error(E_ERROR, "%s(): gdImageStringFTEx not supported in this PHP build", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } #endif @@ -3365,18 +3365,18 @@ static void _php_image_bw_convert( gdImagePtr im_org, gdIOCtx *out, int threshol im_dest = gdImageCreate (dest_width, dest_height); if (im_dest == NULL) { - php_error (E_WARNING, "%s: unable to allocate temporary buffer", get_active_function_name()); + php_error (E_WARNING, "%s: unable to allocate temporary buffer", get_active_function_name(TSRMLS_C)); return; } white = gdImageColorAllocate (im_dest, 255, 255, 255); if( white == -1) { - php_error (E_WARNING, "%s: unable to allocate the colors for the destination buffer", get_active_function_name()); + php_error (E_WARNING, "%s: unable to allocate the colors for the destination buffer", get_active_function_name(TSRMLS_C)); return; } black = gdImageColorAllocate (im_dest, 0, 0, 0); if (black == -1) { - php_error (E_WARNING, "%s: unable to allocate the colors for the destination buffer", get_active_function_name()); + php_error (E_WARNING, "%s: unable to allocate the colors for the destination buffer", get_active_function_name(TSRMLS_C)); return; } @@ -3440,33 +3440,33 @@ static void _php_image_convert(INTERNAL_FUNCTION_PARAMETERS, int image_type ) /* Check threshold value */ if( int_threshold < 0 || int_threshold > 8 ) { - php_error (E_WARNING, "Invalid threshold value '%d' in %s",int_threshold, get_active_function_name()); + php_error (E_WARNING, "Invalid threshold value '%d' in %s",int_threshold, get_active_function_name(TSRMLS_C)); RETURN_FALSE; } /* Check origin file */ if (!fn_org || fn_org == empty_string || php_check_open_basedir(fn_org)) { - php_error (E_WARNING, "%s: invalid origin filename '%s'", get_active_function_name(), fn_org); + php_error (E_WARNING, "%s: invalid origin filename '%s'", get_active_function_name(TSRMLS_C), fn_org); RETURN_FALSE; } /* Check destination file */ if (!fn_dest || fn_dest == empty_string || php_check_open_basedir(fn_dest)) { - php_error (E_WARNING, "%s: invalid destination filename '%s'", get_active_function_name(), fn_dest); + php_error (E_WARNING, "%s: invalid destination filename '%s'", get_active_function_name(TSRMLS_C), fn_dest); RETURN_FALSE; } /* Open origin file */ org = VCWD_FOPEN(fn_org, "rb"); if (!org) { - php_error (E_WARNING, "%s: unable to open '%s' for reading", get_active_function_name(), fn_org); + php_error (E_WARNING, "%s: unable to open '%s' for reading", get_active_function_name(TSRMLS_C), fn_org); RETURN_FALSE; } /* Open destination file */ dest = VCWD_FOPEN(fn_dest, "wb"); if (!dest) { - php_error (E_WARNING, "%s: unable to open '%s' for writing", get_active_function_name(), fn_dest); + php_error (E_WARNING, "%s: unable to open '%s' for writing", get_active_function_name(TSRMLS_C), fn_dest); RETURN_FALSE; } @@ -3475,7 +3475,7 @@ static void _php_image_convert(INTERNAL_FUNCTION_PARAMETERS, int image_type ) case PHP_GDIMG_TYPE_GIF: im_org = gdImageCreateFromGif (org); if (im_org == NULL) { - php_error (E_WARNING, "%s: unable to open '%s' Not a valid GIF file", get_active_function_name(), fn_dest); + php_error (E_WARNING, "%s: unable to open '%s' Not a valid GIF file", get_active_function_name(TSRMLS_C), fn_dest); RETURN_FALSE; } break; @@ -3485,7 +3485,7 @@ static void _php_image_convert(INTERNAL_FUNCTION_PARAMETERS, int image_type ) case PHP_GDIMG_TYPE_JPG: im_org = gdImageCreateFromJpeg (org); if (im_org == NULL) { - php_error (E_WARNING, "%s: unable to open '%s' Not a valid JPEG file", get_active_function_name(), fn_dest); + php_error (E_WARNING, "%s: unable to open '%s' Not a valid JPEG file", get_active_function_name(TSRMLS_C), fn_dest); RETURN_FALSE; } break; @@ -3496,14 +3496,14 @@ static void _php_image_convert(INTERNAL_FUNCTION_PARAMETERS, int image_type ) case PHP_GDIMG_TYPE_PNG: im_org = gdImageCreateFromPng(org); if (im_org == NULL) { - php_error (E_WARNING, "%s: unable to open '%s' Not a valid PNG file", get_active_function_name(), fn_dest); + php_error (E_WARNING, "%s: unable to open '%s' Not a valid PNG file", get_active_function_name(TSRMLS_C), fn_dest); RETURN_FALSE; } break; #endif /* HAVE_GD_PNG */ default: - php_error(E_WARNING, "%s: Format not supported", get_active_function_name()); + php_error(E_WARNING, "%s: Format not supported", get_active_function_name(TSRMLS_C)); break; } @@ -3539,7 +3539,7 @@ static void _php_image_convert(INTERNAL_FUNCTION_PARAMETERS, int image_type ) im_tmp = gdImageCreate (dest_width, dest_height); if (im_tmp == NULL ) { - php_error(E_WARNING, "%s: unable to allocate temporary buffer", get_active_function_name()); + php_error(E_WARNING, "%s: unable to allocate temporary buffer", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -3551,18 +3551,18 @@ static void _php_image_convert(INTERNAL_FUNCTION_PARAMETERS, int image_type ) im_dest = gdImageCreate(dest_width, dest_height); if (im_dest == NULL) { - php_error(E_WARNING, "%s: unable to allocate destination buffer", get_active_function_name()); + php_error(E_WARNING, "%s: unable to allocate destination buffer", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } white = gdImageColorAllocate(im_dest, 255, 255, 255); if (white == -1) { - php_error(E_WARNING, "%s: unable to allocate the colors for the destination buffer", get_active_function_name()); + php_error(E_WARNING, "%s: unable to allocate the colors for the destination buffer", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } black = gdImageColorAllocate(im_dest, 0, 0, 0); if (black == -1) { - php_error(E_WARNING, "%s: unable to allocate the colors for the destination buffer", get_active_function_name()); + php_error(E_WARNING, "%s: unable to allocate the colors for the destination buffer", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } diff --git a/ext/gd/gd_ctx.c b/ext/gd/gd_ctx.c index aadd36aec1..b6c5df5986 100644 --- a/ext/gd/gd_ctx.c +++ b/ext/gd/gd_ctx.c @@ -50,13 +50,13 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type, if ((argc == 2) || (argc == 3 && Z_STRLEN_PP(file))) { if (!fn || fn == empty_string || php_check_open_basedir(fn)) { - php_error(E_WARNING, "%s: invalid filename '%s'", get_active_function_name(), fn); + php_error(E_WARNING, "%s: invalid filename '%s'", get_active_function_name(TSRMLS_C), fn); RETURN_FALSE; } fp = VCWD_FOPEN(fn, "wb"); if (!fp) { - php_error(E_WARNING, "%s: unable to open '%s' for writing", get_active_function_name(), fn); + php_error(E_WARNING, "%s: unable to open '%s' for writing", get_active_function_name(TSRMLS_C), fn); RETURN_FALSE; } @@ -77,7 +77,7 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type, switch(image_type) { case PHP_GDIMG_CONVERT_WBM: if(q<0||q>255) { - php_error(E_WARNING, "%s: invalid threshold value '%d'. It must be between 0 and 255",get_active_function_name(), q); + php_error(E_WARNING, "%s: invalid threshold value '%d'. It must be between 0 and 255",get_active_function_name(TSRMLS_C), q); } case PHP_GDIMG_TYPE_JPG: (*func_p)(im, ctx, q); diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c index c4be4a392e..e02d5d2274 100644 --- a/ext/imap/php_imap.c +++ b/ext/imap/php_imap.c @@ -1883,7 +1883,6 @@ PHP_FUNCTION(imap_lsub_full) pils *imap_le_struct; FOBJECTLIST *cur=NIL; char *delim=NIL; - TSRMLS_FETCH(); delim = emalloc(2 * sizeof(char)); diff --git a/ext/ingres_ii/ii.c b/ext/ingres_ii/ii.c index 4cc642bf19..11d31a0e64 100644 --- a/ext/ingres_ii/ii.c +++ b/ext/ingres_ii/ii.c @@ -191,7 +191,7 @@ static void _close_ii_plink(zend_rsrc_list_entry *rsrc) */ static void _clean_ii_plink(zend_rsrc_list_entry *rsrc) { - II_LINK *link = (II_LINK *)rsrc->ptr; + II_LINK *link = (II_LINK *)rsrc->ptr; IIAPI_AUTOPARM autoParm; TSRMLS_FETCH(); diff --git a/ext/mailparse/mailparse.c b/ext/mailparse/mailparse.c index 7945411d0f..1d45e2fcc3 100755 --- a/ext/mailparse/mailparse.c +++ b/ext/mailparse/mailparse.c @@ -133,7 +133,9 @@ PHP_RSHUTDOWN_FUNCTION(mailparse) static void mailparse_rfc822t_errfunc(const char * msg, int num) { - php_error(E_WARNING, "%s(): %s %d", get_active_function_name(), msg, num); + TSRMLS_FETCH(); + + php_error(E_WARNING, "%s(): %s %d", get_active_function_name(TSRMLS_C), msg, num); } /* {{{ proto array mailparse_rfc822_parse_addresses(string addresses) @@ -313,7 +315,7 @@ PHP_FUNCTION(mailparse_stream_encode) enc = mbfl_name2no_encoding(Z_STRVAL_PP(encod)); if (enc == mbfl_no_encoding_invalid) { zend_error(E_WARNING, "%s(): unknown encoding \"%s\"", - get_active_function_name(), + get_active_function_name(TSRMLS_C), Z_STRVAL_PP(encod) ); RETURN_FALSE; @@ -387,7 +389,7 @@ PHP_FUNCTION(mailparse_msg_parse_file) /* open file and read it in */ fp = VCWD_FOPEN(Z_STRVAL_PP(filename), "r"); if (fp == NULL) { - zend_error(E_WARNING, "%s(): unable to open file %s", get_active_function_name(), Z_STRVAL_PP(filename)); + zend_error(E_WARNING, "%s(): unable to open file %s", get_active_function_name(TSRMLS_C), Z_STRVAL_PP(filename)); RETURN_FALSE; } @@ -446,18 +448,20 @@ PHP_FUNCTION(mailparse_msg_create) } /* }}} */ -static void get_structure_callback(struct rfc2045 *p, struct rfc2045id * id, void * ptr) +static void get_structure_callback(struct rfc2045 *p, struct rfc2045id *id, void *ptr) { zval * return_value = (zval *)ptr; char intbuf[16]; char buf[256]; int len, i = 0; + TSRMLS_FETCH(); + while(id && i < sizeof(buf)) { sprintf(intbuf, "%d", id->idnum); len = strlen(intbuf); if (len > (sizeof(buf)-i)) { /* too many sections: bail */ - zend_error(E_WARNING, "%s(): too many nested sections in message", get_active_function_name()); + zend_error(E_WARNING, "%s(): too many nested sections in message", get_active_function_name(TSRMLS_C)); return; } sprintf(&buf[i], "%s%c", intbuf, id->next ? '.' : '\0'); @@ -509,8 +513,8 @@ static int extract_callback_user_func(const char *p, size_t n, zval *userfunc) /* TODO: use zend_is_callable */ - if (call_user_function(EG(function_table), NULL, userfunc, retval, 1, &arg) == FAILURE) - zend_error(E_WARNING, "%s(): unable to call user function", get_active_function_name()); + if (call_user_function(EG(function_table), NULL, userfunc, retval, 1, &arg TSRMLS_CC) == FAILURE) + zend_error(E_WARNING, "%s(): unable to call user function", get_active_function_name(TSRMLS_C)); zval_dtor(retval); zval_dtor(arg); @@ -627,12 +631,12 @@ PHP_FUNCTION(mailparse_msg_extract_part_file) /* open file and read it in */ fp = VCWD_FOPEN(Z_STRVAL_PP(filename), "rb"); if (fp == NULL) { - zend_error(E_WARNING, "%s(): unable to open file %s", get_active_function_name(), Z_STRVAL_PP(filename)); + zend_error(E_WARNING, "%s(): unable to open file %s", get_active_function_name(TSRMLS_C), Z_STRVAL_PP(filename)); RETURN_FALSE; } if (fseek(fp, body, SEEK_SET) == -1) { - zend_error(E_WARNING, "%s(): unable to seek to section start", get_active_function_name()); + zend_error(E_WARNING, "%s(): unable to seek to section start", get_active_function_name(TSRMLS_C)); RETVAL_FALSE; goto cleanup; } @@ -648,7 +652,7 @@ PHP_FUNCTION(mailparse_msg_extract_part_file) n = fread(filebuf, sizeof(char), n, fp); if (n == 0) { - zend_error(E_WARNING, "%s(): error reading from file \"%s\", offset %d", get_active_function_name(), Z_STRVAL_PP(filename), body); + zend_error(E_WARNING, "%s(): error reading from file \"%s\", offset %d", get_active_function_name(TSRMLS_C), Z_STRVAL_PP(filename), body); RETVAL_FALSE; goto cleanup; } @@ -783,7 +787,7 @@ PHP_FUNCTION(mailparse_msg_get_part) newsection = rfc2045_find(rfcbuf, (*mimesection)->value.str.val); if (!newsection) { - php_error(E_WARNING, "%s(): cannot find section %s in message", get_active_function_name(), (*mimesection)->value.str.val); + php_error(E_WARNING, "%s(): cannot find section %s in message", get_active_function_name(TSRMLS_C), (*mimesection)->value.str.val); RETURN_FALSE; } ZEND_REGISTER_RESOURCE(return_value, newsection, le_rfc2045_nofree); diff --git a/ext/mailparse/rfc2045cdecode.c b/ext/mailparse/rfc2045cdecode.c index 858f48dfde..8ec5d5de76 100755 --- a/ext/mailparse/rfc2045cdecode.c +++ b/ext/mailparse/rfc2045cdecode.c @@ -28,13 +28,14 @@ void rfc2045_cdecode_start(struct rfc2045 *p, void *miscptr) { enum mbfl_no_encoding from = mbfl_no_encoding_8bit; - + TSRMLS_FETCH(); + if (p->content_transfer_encoding) { from = mbfl_name2no_encoding(p->content_transfer_encoding); if (from == mbfl_no_encoding_invalid) { zend_error(E_WARNING, "%s(): I don't know how to decode %s transfer encoding!", - get_active_function_name(), + get_active_function_name(TSRMLS_C), p->content_transfer_encoding); from = mbfl_no_encoding_8bit; } diff --git a/ext/mssql/php_mssql.c b/ext/mssql/php_mssql.c index b3a80e38c1..c63a887640 100644 --- a/ext/mssql/php_mssql.c +++ b/ext/mssql/php_mssql.c @@ -215,10 +215,8 @@ static void _free_mssql_result(zend_rsrc_list_entry *rsrc) efree(result); } -static void php_mssql_set_default_link(int id) +static void php_mssql_set_default_link(int id TSRMLS_DC) { - TSRMLS_FETCH(); - if (MS_SQL_G(default_link)!=-1) { zend_list_delete(MS_SQL_G(default_link)); } @@ -587,7 +585,7 @@ static void php_mssql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) if (ptr && (type==le_link || type==le_plink)) { zend_list_addref(link); return_value->value.lval = link; - php_mssql_set_default_link(link); + php_mssql_set_default_link(link TSRMLS_CC); return_value->type = IS_RESOURCE; efree(hashed_details); return; @@ -644,7 +642,7 @@ static void php_mssql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) MS_SQL_G(num_links)++; } efree(hashed_details); - php_mssql_set_default_link(return_value->value.lval); + php_mssql_set_default_link(return_value->value.lval TSRMLS_CC); } @@ -866,12 +864,11 @@ static void php_mssql_get_column_content_without_type(mssql_link *mssql_ptr,int } } -int _mssql_fetch_batch(mssql_link *mssql_ptr, mssql_result *result, int retvalue) +static int _mssql_fetch_batch(mssql_link *mssql_ptr, mssql_result *result, int retvalue TSRMLS_DC) { int i, j = 0; int *column_types; char computed_buf[16]; - TSRMLS_FETCH(); column_types = (int *) emalloc(sizeof(int) * result->num_fields); for (i=0; inum_fields; i++) { @@ -964,7 +961,7 @@ PHP_FUNCTION(mssql_fetch_batch) mssql_ptr = result->mssql_ptr; _free_result(result, 0); result->cur_row=result->num_rows=0; - result->num_rows = _mssql_fetch_batch(mssql_ptr, result, result->lastresult); + result->num_rows = _mssql_fetch_batch(mssql_ptr, result, result->lastresult TSRMLS_CC); RETURN_LONG(result->num_rows); } /* }}} */ @@ -1047,7 +1044,7 @@ PHP_FUNCTION(mssql_query) result->cur_field=result->cur_row=result->num_rows=0; result->fields = (mssql_field *) emalloc(sizeof(mssql_field)*result->num_fields); - result->num_rows = _mssql_fetch_batch(mssql_ptr, result, retvalue); + result->num_rows = _mssql_fetch_batch(mssql_ptr, result, retvalue TSRMLS_CC); ZEND_REGISTER_RESOURCE(return_value, result, le_result); } @@ -1640,7 +1637,7 @@ PHP_FUNCTION(mssql_next_result) result->num_fields = dbnumcols(mssql_ptr->link); result->fields = (mssql_field *) emalloc(sizeof(mssql_field)*result->num_fields); - result->num_rows = _mssql_fetch_batch(mssql_ptr, result, retvalue); + result->num_rows = _mssql_fetch_batch(mssql_ptr, result, retvalue TSRMLS_CC); RETURN_TRUE; } @@ -1958,7 +1955,7 @@ PHP_FUNCTION(mssql_execute) result->num_fields = num_fields; result->fields = (mssql_field *) emalloc(sizeof(mssql_field)*num_fields); - result->num_rows = _mssql_fetch_batch(mssql_ptr, result, retvalue); + result->num_rows = _mssql_fetch_batch(mssql_ptr, result, retvalue TSRMLS_CC); } retval_results=dbresults(mssql_ptr->link); } diff --git a/ext/mysql/php_mysql.c b/ext/mysql/php_mysql.c index f15f5507a6..f589c5cd6d 100644 --- a/ext/mysql/php_mysql.c +++ b/ext/mysql/php_mysql.c @@ -969,7 +969,7 @@ static void php_mysql_do_query_general(zval **query, zval **mysql_link, int link mysql_result = (MYSQL_RES *) zend_list_find(mysql->active_result_id, &type); if (mysql_result && type==le_result && !mysql_eof(mysql_result)) { php_error(E_NOTICE, "Called %s() without first fetching all rows from a previous unbuffered query", - get_active_function_name()); + get_active_function_name(TSRMLS_C)); while (mysql_fetch_row(mysql_result)); zend_list_delete(mysql->active_result_id); mysql->active_result_id = 0; @@ -1080,7 +1080,7 @@ PHP_FUNCTION(mysql_db_query) break; } - zend_error(E_NOTICE, "%s is deprecated; use mysql_select_db() and mysql_query() instead", get_active_function_name()); + zend_error(E_NOTICE, "%s is deprecated; use mysql_select_db() and mysql_query() instead", get_active_function_name(TSRMLS_C)); php_mysql_do_query_general(query, mysql_link, id, db, MYSQL_STORE_RESULT, return_value TSRMLS_CC); } diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c index 3847e83f37..390b0eff60 100644 --- a/ext/odbc/php_odbc.c +++ b/ext/odbc/php_odbc.c @@ -564,13 +564,12 @@ void php_odbc_fetch_attribs(INTERNAL_FUNCTION_PARAMETERS, int mode) } -int odbc_bindcols(odbc_result *result) +int odbc_bindcols(odbc_result *result TSRMLS_DC) { RETCODE rc; int i; SWORD colnamelen; /* Not used */ SDWORD displaysize; - TSRMLS_FETCH(); result->values = (odbc_result_value *) emalloc(sizeof(odbc_result_value)*result->numcols); @@ -839,7 +838,7 @@ PHP_FUNCTION(odbc_prepare) SQLNumResultCols(result->stmt, &(result->numcols)); if (result->numcols > 0) { - if (!odbc_bindcols(result)) { + if (!odbc_bindcols(result TSRMLS_CC)) { efree(result); RETURN_FALSE; } @@ -1022,7 +1021,7 @@ PHP_FUNCTION(odbc_execute) SQLNumResultCols(result->stmt, &(result->numcols)); if (result->numcols > 0) { - if (!odbc_bindcols(result)) { + if (!odbc_bindcols(result TSRMLS_CC)) { efree(result); RETVAL_FALSE; } @@ -1181,7 +1180,7 @@ PHP_FUNCTION(odbc_exec) /* For insert, update etc. cols == 0 */ if (result->numcols > 0) { - if (!odbc_bindcols(result)) { + if (!odbc_bindcols(result TSRMLS_CC)) { efree(result); RETURN_FALSE; } @@ -2280,7 +2279,7 @@ PHP_FUNCTION(odbc_next_result) SQLNumResultCols(result->stmt, &(result->numcols)); if (result->numcols > 0) { - if (!odbc_bindcols(result)) { + if (!odbc_bindcols(result TSRMLS_CC)) { efree(result); RETVAL_FALSE; } @@ -2681,7 +2680,7 @@ PHP_FUNCTION(odbc_tables) SQLNumResultCols(result->stmt, &(result->numcols)); if (result->numcols > 0) { - if (!odbc_bindcols(result)) { + if (!odbc_bindcols(result TSRMLS_CC)) { efree(result); RETURN_FALSE; } @@ -2761,7 +2760,7 @@ PHP_FUNCTION(odbc_columns) SQLNumResultCols(result->stmt, &(result->numcols)); if (result->numcols > 0) { - if (!odbc_bindcols(result)) { + if (!odbc_bindcols(result TSRMLS_CC)) { efree(result); RETURN_FALSE; } @@ -2840,7 +2839,7 @@ PHP_FUNCTION(odbc_columnprivileges) SQLNumResultCols(result->stmt, &(result->numcols)); if (result->numcols > 0) { - if (!odbc_bindcols(result)) { + if (!odbc_bindcols(result TSRMLS_CC)) { efree(result); RETURN_FALSE; } @@ -2940,7 +2939,7 @@ PHP_FUNCTION(odbc_foreignkeys) SQLNumResultCols(result->stmt, &(result->numcols)); if (result->numcols > 0) { - if (!odbc_bindcols(result)) { + if (!odbc_bindcols(result TSRMLS_CC)) { efree(result); RETURN_FALSE; } @@ -3013,7 +3012,7 @@ PHP_FUNCTION(odbc_gettypeinfo) SQLNumResultCols(result->stmt, &(result->numcols)); if (result->numcols > 0) { - if (!odbc_bindcols(result)) { + if (!odbc_bindcols(result TSRMLS_CC)) { efree(result); RETURN_FALSE; } @@ -3088,7 +3087,7 @@ PHP_FUNCTION(odbc_primarykeys) SQLNumResultCols(result->stmt, &(result->numcols)); if (result->numcols > 0) { - if (!odbc_bindcols(result)) { + if (!odbc_bindcols(result TSRMLS_CC)) { efree(result); RETURN_FALSE; } @@ -3171,7 +3170,7 @@ PHP_FUNCTION(odbc_procedurecolumns) SQLNumResultCols(result->stmt, &(result->numcols)); if (result->numcols > 0) { - if (!odbc_bindcols(result)) { + if (!odbc_bindcols(result TSRMLS_CC)) { efree(result); RETURN_FALSE; } @@ -3252,7 +3251,7 @@ PHP_FUNCTION(odbc_procedures) SQLNumResultCols(result->stmt, &(result->numcols)); if (result->numcols > 0) { - if (!odbc_bindcols(result)) { + if (!odbc_bindcols(result TSRMLS_CC)) { efree(result); RETURN_FALSE; } @@ -3341,7 +3340,7 @@ PHP_FUNCTION(odbc_specialcolumns) SQLNumResultCols(result->stmt, &(result->numcols)); if (result->numcols > 0) { - if (!odbc_bindcols(result)) { + if (!odbc_bindcols(result TSRMLS_CC)) { efree(result); RETURN_FALSE; } @@ -3425,7 +3424,7 @@ PHP_FUNCTION(odbc_statistics) SQLNumResultCols(result->stmt, &(result->numcols)); if (result->numcols > 0) { - if (!odbc_bindcols(result)) { + if (!odbc_bindcols(result TSRMLS_CC)) { efree(result); RETURN_FALSE; } @@ -3501,7 +3500,7 @@ PHP_FUNCTION(odbc_tableprivileges) SQLNumResultCols(result->stmt, &(result->numcols)); if (result->numcols > 0) { - if (!odbc_bindcols(result)) { + if (!odbc_bindcols(result TSRMLS_CC)) { efree(result); RETURN_FALSE; } diff --git a/ext/odbc/php_odbc.h b/ext/odbc/php_odbc.h index 5d597e9607..cea272f08a 100644 --- a/ext/odbc/php_odbc.h +++ b/ext/odbc/php_odbc.h @@ -314,7 +314,7 @@ void odbc_del_result(HashTable *list, int count); int odbc_add_conn(HashTable *list, HDBC conn); odbc_connection *odbc_get_conn(HashTable *list, int count); void odbc_del_conn(HashTable *list, int ind); -int odbc_bindcols(odbc_result *result); +int odbc_bindcols(odbc_result *result TSRMLS_DC); #define ODBC_SQL_ERROR_PARAMS odbc_connection *conn_resource, ODBC_SQL_STMT_T stmt, char *func diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index e2deb4b115..c4ac6e6ffb 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -104,8 +104,8 @@ static void _php_x509_free(zend_rsrc_list_entry *rsrc); static int le_x509; static X509 * php_openssl_x509_from_zval(zval ** val, int makeresource, long * resourceval); -static EVP_PKEY * php_openssl_evp_from_zval(zval ** val, int public_key, char * passphrase, int makeresource, long * resourceval); -static X509_STORE * setup_verify(zval * calist); +static EVP_PKEY * php_openssl_evp_from_zval(zval ** val, int public_key, char * passphrase, int makeresource, long * resourceval TSRMLS_DC); +static X509_STORE * setup_verify(zval * calist TSRMLS_DC); static STACK_OF(X509) * load_all_certs_from_file(char *certfile); /* {{{ PHP_MINIT_FUNCTION @@ -263,7 +263,7 @@ static X509 * php_openssl_x509_from_zval(zval ** val, int makeresource, long * r empty string rather than NULL for the passphrase - NULL causes a passphrase prompt to be emitted in the Apache error log! */ -static EVP_PKEY * php_openssl_evp_from_zval(zval ** val, int public_key, char * passphrase, int makeresource, long * resourceval) +static EVP_PKEY * php_openssl_evp_from_zval(zval ** val, int public_key, char * passphrase, int makeresource, long * resourceval TSRMLS_DC) { EVP_PKEY * key = NULL; X509 * cert = NULL; @@ -280,7 +280,7 @@ static EVP_PKEY * php_openssl_evp_from_zval(zval ** val, int public_key, char * /* get passphrase */ if (zend_hash_index_find(HASH_OF(*val), 1, (void **)&zphrase) == FAILURE) { - zend_error(E_WARNING, "%s(): key array must be of the form array(0 => key, 1 => phrase)", get_active_function_name()); + zend_error(E_WARNING, "%s(): key array must be of the form array(0 => key, 1 => phrase)", get_active_function_name(TSRMLS_C)); return NULL; } convert_to_string_ex(zphrase); @@ -288,7 +288,7 @@ static EVP_PKEY * php_openssl_evp_from_zval(zval ** val, int public_key, char * /* now set val to be the key param and continue */ if (zend_hash_index_find(HASH_OF(*val), 0, (void **)&val) == FAILURE) { - zend_error(E_WARNING, "%s(): key array must be of the form array(0 => key, 1 => phrase)", get_active_function_name()); + zend_error(E_WARNING, "%s(): key array must be of the form array(0 => key, 1 => phrase)", get_active_function_name(TSRMLS_C)); return NULL; } } @@ -405,7 +405,7 @@ PHP_FUNCTION(openssl_private_encrypt) pkey = php_openssl_evp_from_zval(key, 0, "", 0, &keyresource); if (pkey == NULL) { - zend_error(E_WARNING, "%s(): key param is not a valid private key", get_active_function_name()); + zend_error(E_WARNING, "%s(): key param is not a valid private key", get_active_function_name(TSRMLS_C) TSRMLS_CC); RETURN_FALSE; } @@ -475,7 +475,7 @@ PHP_FUNCTION(openssl_private_decrypt) pkey = php_openssl_evp_from_zval(key, 0, "", 0, &keyresource); if (pkey == NULL) { - zend_error(E_WARNING, "%s(): key param is not a valid private key", get_active_function_name()); + zend_error(E_WARNING, "%s(): key param is not a valid private key", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -550,9 +550,9 @@ PHP_FUNCTION(openssl_public_encrypt) RETVAL_FALSE; - pkey = php_openssl_evp_from_zval(key, 1, NULL, 0, &keyresource); + pkey = php_openssl_evp_from_zval(key, 1, NULL, 0, &keyresource TSRMLS_CC); if (pkey == NULL) { - zend_error(E_WARNING, "%s(): key param is not a valid public key", get_active_function_name()); + zend_error(E_WARNING, "%s(): key param is not a valid public key", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -620,9 +620,9 @@ PHP_FUNCTION(openssl_public_decrypt) convert_to_string_ex(data); RETVAL_FALSE; - pkey = php_openssl_evp_from_zval(key, 1, NULL, 0, &keyresource); + pkey = php_openssl_evp_from_zval(key, 1, NULL, 0, &keyresource TSRMLS_CC); if (pkey == NULL) { - zend_error(E_WARNING, "%s(): key param is not a valid public key", get_active_function_name()); + zend_error(E_WARNING, "%s(): key param is not a valid public key", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -685,10 +685,10 @@ PHP_FUNCTION(openssl_get_privatekey) } return_value->type = IS_RESOURCE; - pkey = php_openssl_evp_from_zval(key, 0, argc == 2 ? Z_STRVAL_PP(passphrase) : "", 1, &(return_value->value.lval)); + pkey = php_openssl_evp_from_zval(key, 0, argc == 2 ? Z_STRVAL_PP(passphrase) : "", 1, &(return_value->value.lval) TSRMLS_CC); if (pkey == NULL) { - zend_error(E_WARNING, "%s(): unable to coerce arg to a private key", get_active_function_name()); + zend_error(E_WARNING, "%s(): unable to coerce arg to a private key", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } } @@ -747,7 +747,7 @@ static time_t asn1_time_to_time_t(ASN1_UTCTIME * timestr) long gmadjust = 0; if (timestr->length < 13) { - zend_error(E_WARNING, "%s(): extension author too lazy to parse %s correctly", get_active_function_name(), timestr->data); + zend_error(E_WARNING, "%s(): extension author too lazy to parse %s correctly", get_active_function_name(TSRMLS_C), timestr->data); return (time_t)-1; } @@ -897,20 +897,21 @@ static STACK_OF(X509) * load_all_certs_from_file(char *certfile) STACK_OF(X509) *stack=NULL, *ret=NULL; BIO *in=NULL; X509_INFO *xi; + TSRMLS_FETCH(); if(!(stack = sk_X509_new_null())) { - zend_error(E_ERROR, "%s(): memory allocation failure", get_active_function_name()); + zend_error(E_ERROR, "%s(): memory allocation failure", get_active_function_name(TSRMLS_C)); goto end; } if(!(in=BIO_new_file(certfile, "r"))) { - zend_error(E_WARNING, "%s(): error opening the file, %s", get_active_function_name(), certfile); + zend_error(E_WARNING, "%s(): error opening the file, %s", get_active_function_name(TSRMLS_C), certfile); goto end; } /* This loads from a file, a stack of x509/crl/pkey sets */ if(!(sk=PEM_X509_INFO_read_bio(in, NULL, NULL, NULL))) { - zend_error(E_WARNING, "%s(): error reading the file, %s", get_active_function_name(), certfile); + zend_error(E_WARNING, "%s(): error reading the file, %s", get_active_function_name(TSRMLS_C), certfile); goto end; } @@ -926,7 +927,7 @@ static STACK_OF(X509) * load_all_certs_from_file(char *certfile) X509_INFO_free(xi); } if(!sk_X509_num(stack)) { - zend_error(E_WARNING, "%s(): no certificates in file, %s", get_active_function_name(), certfile); + zend_error(E_WARNING, "%s(): no certificates in file, %s", get_active_function_name(TSRMLS_C), certfile); sk_X509_free(stack); goto end; } @@ -944,11 +945,12 @@ static int check_cert(X509_STORE *ctx, X509 *x, STACK_OF(X509) *untrustedchain, { int ret=0; X509_STORE_CTX *csc; + TSRMLS_FETCH(); csc = X509_STORE_CTX_new(); if (csc == NULL) { - zend_error(E_ERROR, "%s(): memory allocation failure", get_active_function_name()); + zend_error(E_ERROR, "%s(): memory allocation failure", get_active_function_name(TSRMLS_C)); return 0; } X509_STORE_CTX_init(csc, ctx, x, untrustedchain); @@ -990,7 +992,7 @@ PHP_FUNCTION(openssl_x509_checkpurpose) } convert_to_long_ex(zpurpose); - cainfo = setup_verify(*zcainfo); + cainfo = setup_verify(*zcainfo TSRMLS_CC); if (cainfo == NULL) goto clean_exit; @@ -1023,7 +1025,7 @@ PHP_FUNCTION(openssl_get_publickey) } return_value->type = IS_RESOURCE; - pkey = php_openssl_evp_from_zval(cert, 1, NULL, 1, &(return_value->value.lval)); + pkey = php_openssl_evp_from_zval(cert, 1, NULL, 1, &(return_value->value.lval) TSRMLS_CC); if (pkey == NULL) { RETURN_FALSE; @@ -1064,7 +1066,7 @@ PHP_FUNCTION(openssl_x509_read) x509 = php_openssl_x509_from_zval(cert, 1, &(return_value->value.lval)); if (x509 == NULL) { - zend_error(E_WARNING, "%s() supplied parameter cannot be coerced into an X509 certificate!", get_active_function_name()); + zend_error(E_WARNING, "%s() supplied parameter cannot be coerced into an X509 certificate!", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } } @@ -1090,7 +1092,7 @@ PHP_FUNCTION(openssl_x509_free) * calist is an array containing file and directory names. create a * certificate store and add those certs to it for use in verification. */ -static X509_STORE * setup_verify(zval * calist) +static X509_STORE * setup_verify(zval * calist TSRMLS_DC) { X509_STORE *store; X509_LOOKUP * dir_lookup, * file_lookup; @@ -1114,14 +1116,14 @@ static X509_STORE * setup_verify(zval * calist) convert_to_string_ex(item); if (VCWD_STAT(Z_STRVAL_PP(item), &sb) == -1) { - zend_error(E_WARNING, "%s() unable to stat %s", get_active_function_name(), Z_STRVAL_PP(item)); + zend_error(E_WARNING, "%s() unable to stat %s", get_active_function_name(TSRMLS_C), Z_STRVAL_PP(item)); continue; } if ((sb.st_mode & S_IFREG) == S_IFREG) { file_lookup = X509_STORE_add_lookup(store, X509_LOOKUP_file()); if (file_lookup == NULL || !X509_LOOKUP_load_file(file_lookup, Z_STRVAL_PP(item), X509_FILETYPE_PEM)) - zend_error(E_WARNING, "%s() error loading file %s", get_active_function_name(), Z_STRVAL_PP(item)); + zend_error(E_WARNING, "%s() error loading file %s", get_active_function_name(TSRMLS_C), Z_STRVAL_PP(item)); else nfiles++; file_lookup = NULL; @@ -1129,7 +1131,7 @@ static X509_STORE * setup_verify(zval * calist) else { dir_lookup = X509_STORE_add_lookup(store, X509_LOOKUP_hash_dir()); if (dir_lookup == NULL || !X509_LOOKUP_add_dir(dir_lookup, Z_STRVAL_PP(item), X509_FILETYPE_PEM)) - zend_error(E_WARNING, "%s() error loading directory %s", get_active_function_name(), Z_STRVAL_PP(item)); + zend_error(E_WARNING, "%s() error loading directory %s", get_active_function_name(TSRMLS_C), Z_STRVAL_PP(item)); else ndirs++; dir_lookup = NULL; @@ -1207,7 +1209,7 @@ PHP_FUNCTION(openssl_pkcs7_verify) if (argc >= 4) { if (Z_TYPE_PP(cainfo) != IS_ARRAY) { - zend_error(E_WARNING, "%s(): 4th parameter must be an array", get_active_function_name()); + zend_error(E_WARNING, "%s(): 4th parameter must be an array", get_active_function_name(TSRMLS_C)); goto clean_exit; } } @@ -1251,7 +1253,7 @@ PHP_FUNCTION(openssl_pkcs7_verify) } else { zend_error(E_WARNING, "%s(): signature OK, but cannot open %s for writing", - get_active_function_name(), signersfilename); + get_active_function_name(TSRMLS_C), signersfilename); RETVAL_LONG(-1); } } @@ -1299,7 +1301,7 @@ PHP_FUNCTION(openssl_pkcs7_encrypt) if ((*zheaders)->type == IS_NULL) zheaders = NULL; else if ((*zheaders)->type != IS_ARRAY) { - zend_error(E_WARNING, "%s(): 4th param must be an array/null value!", get_active_function_name()); + zend_error(E_WARNING, "%s(): 4th param must be an array/null value!", get_active_function_name(TSRMLS_C)); goto clean_exit; } } @@ -1445,7 +1447,7 @@ PHP_FUNCTION(openssl_pkcs7_sign) if ((*zheaders)->type == IS_NULL) zheaders = NULL; else if ((*zheaders)->type != IS_ARRAY) { - zend_error(E_WARNING, "%s(): 5th param must be an array/null value!", get_active_function_name()); + zend_error(E_WARNING, "%s(): 5th param must be an array/null value!", get_active_function_name(TSRMLS_C)); goto clean_exit; } } @@ -1453,33 +1455,33 @@ PHP_FUNCTION(openssl_pkcs7_sign) convert_to_string_ex(zinfilename); convert_to_string_ex(zoutfilename); - privkey = php_openssl_evp_from_zval(zprivkey, 0, "", 0, &keyresource); + privkey = php_openssl_evp_from_zval(zprivkey, 0, "", 0, &keyresource TSRMLS_CC); if (privkey == NULL) { - zend_error(E_WARNING, "%s(): error getting private key", get_active_function_name()); + zend_error(E_WARNING, "%s(): error getting private key", get_active_function_name(TSRMLS_C)); goto clean_exit; } cert = php_openssl_x509_from_zval(zcert, 0, &certresource); if (cert == NULL) { - zend_error(E_WARNING, "%s(): error getting cert", get_active_function_name()); + zend_error(E_WARNING, "%s(): error getting cert", get_active_function_name(TSRMLS_C)); goto clean_exit; } infile = BIO_new_file(Z_STRVAL_PP(zinfilename), "r"); if (infile == NULL) { - zend_error(E_WARNING, "%s(): error opening input file %s!", get_active_function_name(), Z_STRVAL_PP(zinfilename)); + zend_error(E_WARNING, "%s(): error opening input file %s!", get_active_function_name(TSRMLS_C), Z_STRVAL_PP(zinfilename)); goto clean_exit; } outfile = BIO_new_file(Z_STRVAL_PP(zoutfilename), "w"); if (outfile == NULL) { - zend_error(E_WARNING, "%s(): error opening output file %s!", get_active_function_name(), Z_STRVAL_PP(zoutfilename)); + zend_error(E_WARNING, "%s(): error opening output file %s!", get_active_function_name(TSRMLS_C), Z_STRVAL_PP(zoutfilename)); goto clean_exit; } p7 = PKCS7_sign(cert, privkey, others, infile, flags); if (p7 == NULL) { - zend_error(E_WARNING, "%s(): error creating PKCS7 structure!", get_active_function_name()); + zend_error(E_WARNING, "%s(): error creating PKCS7 structure!", get_active_function_name(TSRMLS_C)); goto clean_exit; } @@ -1539,13 +1541,13 @@ PHP_FUNCTION(openssl_pkcs7_decrypt) cert = php_openssl_x509_from_zval(recipcert, 0, &certresval); if (cert == NULL) { - zend_error(E_WARNING, "%s(): unable to coerce param 3 to x509 cert", get_active_function_name()); + zend_error(E_WARNING, "%s(): unable to coerce param 3 to x509 cert", get_active_function_name(TSRMLS_C)); goto clean_exit; } - key = php_openssl_evp_from_zval(argc == 3 ? recipcert : recipkey, 0, "", 0, &keyresval); + key = php_openssl_evp_from_zval(argc == 3 ? recipcert : recipkey, 0, "", 0, &keyresval TSRMLS_CC); if (key == NULL) { - zend_error(E_WARNING, "%s(): unable to coerce param %d to a private key", get_active_function_name(), argc); + zend_error(E_WARNING, "%s(): unable to coerce param %d to a private key", get_active_function_name(TSRMLS_C), argc); goto clean_exit; } @@ -1598,9 +1600,9 @@ PHP_FUNCTION(openssl_sign) } convert_to_string_ex(data); - pkey = php_openssl_evp_from_zval(key, 0, "", 0, &keyresource); + pkey = php_openssl_evp_from_zval(key, 0, "", 0, &keyresource TSRMLS_CC); if (pkey == NULL) { - zend_error(E_WARNING, "%s(): supplied key param cannot be coerced into a private key", get_active_function_name()); + zend_error(E_WARNING, "%s(): supplied key param cannot be coerced into a private key", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -1640,9 +1642,9 @@ PHP_FUNCTION(openssl_verify) convert_to_string_ex(data); convert_to_string_ex(signature); - pkey = php_openssl_evp_from_zval(key, 1, NULL, 0, &keyresource); + pkey = php_openssl_evp_from_zval(key, 1, NULL, 0, &keyresource TSRMLS_CC); if (pkey == NULL) { - zend_error(E_WARNING, "%s(): supplied key param cannot be coerced into a public key", get_active_function_name()); + zend_error(E_WARNING, "%s(): supplied key param cannot be coerced into a public key", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -1699,9 +1701,9 @@ PHP_FUNCTION(openssl_seal) i = 0; while (zend_hash_get_current_data_ex(pubkeysht, (void **) &pubkey, &pos) == SUCCESS) { - pkeys[i] = php_openssl_evp_from_zval(pubkey, 1, NULL, 0, &key_resources[i]); + pkeys[i] = php_openssl_evp_from_zval(pubkey, 1, NULL, 0, &key_resources[i] TSRMLS_CC); if (pkeys[i] == NULL) { - zend_error(E_WARNING, "%s(): not a public key (%dth member of pubkeys)", get_active_function_name(), i); + zend_error(E_WARNING, "%s(): not a public key (%dth member of pubkeys)", get_active_function_name(TSRMLS_C), i); RETVAL_FALSE; goto clean_exit; } @@ -1811,9 +1813,9 @@ PHP_FUNCTION(openssl_open) convert_to_string_ex(data); convert_to_string_ex(ekey); - pkey = php_openssl_evp_from_zval(privkey, 0, "", 0, &keyresource); + pkey = php_openssl_evp_from_zval(privkey, 0, "", 0, &keyresource TSRMLS_CC); if (pkey == NULL) { - zend_error(E_WARNING, "%s(): unable to coerce param 4 into a private key", get_active_function_name()); + zend_error(E_WARNING, "%s(): unable to coerce param 4 into a private key", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } buf = emalloc(Z_STRLEN_PP(data) + 1); diff --git a/ext/pcntl/pcntl.c b/ext/pcntl/pcntl.c index cba769d12a..23b771e697 100755 --- a/ext/pcntl/pcntl.c +++ b/ext/pcntl/pcntl.c @@ -192,7 +192,7 @@ PHP_FUNCTION(pcntl_fork) id=fork(); if (id == -1) { - php_error(E_ERROR, "Error %d in %s", errno, get_active_function_name()); + php_error(E_ERROR, "Error %d in %s", errno, get_active_function_name(TSRMLS_C)); } RETURN_LONG((long) id); @@ -366,23 +366,23 @@ PHP_FUNCTION(pcntl_signal) /* Special long value case for SIG_DFL and SIG_IGN */ if (Z_TYPE_PP(handle)==IS_LONG) { if (Z_LVAL_PP(handle)!= (long) SIG_DFL && Z_LVAL_PP(handle) != (long) SIG_IGN) { - php_error(E_WARNING, "Invalid value for handle argument specifEied in %s", get_active_function_name()); + php_error(E_WARNING, "Invalid value for handle argument specifEied in %s", get_active_function_name(TSRMLS_C)); } if (php_signal(Z_LVAL_PP(signo), (Sigfunc *) Z_LVAL_PP(handle))==SIG_ERR) { - php_error(E_WARNING, "Error assigning singal in %s", get_active_function_name()); + php_error(E_WARNING, "Error assigning singal in %s", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } RETURN_TRUE; } if (Z_TYPE_PP(handle)!=IS_STRING) { - php_error(E_WARNING, "Invalid type specified for handle argument in %s", get_active_function_name()); + php_error(E_WARNING, "Invalid type specified for handle argument in %s", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } convert_to_string_ex(handle); /* Just in case */ if (!zend_is_callable(*handle, 0, &func_name)) { - php_error(E_WARNING, "%s: %s is not a callable function name error", get_active_function_name(), func_name); + php_error(E_WARNING, "%s: %s is not a callable function name error", get_active_function_name(TSRMLS_C), func_name); efree(func_name); RETURN_FALSE; } @@ -392,7 +392,7 @@ PHP_FUNCTION(pcntl_signal) zend_hash_index_update(&PCNTL_G(php_signal_table), Z_LVAL_PP(signo), Z_STRVAL_PP(handle), (Z_STRLEN_PP(handle) + 1) * sizeof(char), NULL); if (php_signal(Z_LVAL_PP(signo), pcntl_signal_handler)==SIG_ERR) { - php_error(E_WARNING, "Error assigning singal in %s", get_active_function_name()); + php_error(E_WARNING, "Error assigning singal in %s", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } RETURN_TRUE; @@ -404,9 +404,10 @@ static void old_pcntl_signal_handler(int signo) { char *func_name; zval *param, *call_name, *retval; - - PCNTL_LS_FETCH(); - DEBUG_OUT("Caught signal: %d\n", signo); + PCNTL_LS_FETCH(); + TSRMLS_FETCH(); + + DEBUG_OUT("Caught signal: %d\n", signo); if (zend_hash_index_find(&PCNTL_G(php_signal_table), (long) signo, (void *) &func_name)==FAILURE) { DEBUG_OUT("Signl handler not fount"); return; @@ -419,7 +420,7 @@ static void old_pcntl_signal_handler(int signo) ZVAL_STRING(call_name, func_name, 1); /* Call php singal handler - Note that we do not report errors, and we ignore the return value */ - call_user_function(EG(function_table), NULL, call_name, retval, 1, ¶m); + call_user_function(EG(function_table), NULL, call_name, retval, 1, ¶m TSRMLS_CC); zval_dtor(call_name); efree(call_name); @@ -477,11 +478,13 @@ void pcntl_zend_extension_deactivate(void) } /* Custom hook to ensure signals only get called at a safe poing in Zend's execute process */ -void pcntl_zend_extension_statement_handler(zend_op_array *op_array) { +void pcntl_zend_extension_statement_handler(zend_op_array *op_array) +{ zend_llist_element *element; - zval *param, *call_name, *retval; + zval *param, *call_name, *retval; char *func_name; PCNTL_LS_FETCH(); + TSRMLS_FETCH(); /* Bail if the queue is empty or if we are already playing the queue*/ if (! PCNTL_G(signal_queue_ready) || PCNTL_G(processing_signal_queue)) @@ -515,7 +518,7 @@ void pcntl_zend_extension_statement_handler(zend_op_array *op_array) { ZVAL_STRING(call_name, func_name, 0); /* Call php singal handler - Note that we do not report errors, and we ignore the return value */ - call_user_function(EG(function_table), NULL, call_name, retval, 1, ¶m); + call_user_function(EG(function_table), NULL, call_name, retval, 1, ¶m TSRMLS_CC); } /* Clear */ zend_llist_clean(&PCNTL_G(php_signal_queue)); diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index 50230cbd03..14309f35a0 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -566,7 +566,7 @@ static int preg_do_repl_func(zval *function, char *subject, int *offsets, int co add_next_index_stringl(subpats, &subject[offsets[i<<1]], offsets[(i<<1)+1] - offsets[i<<1], 1); args[0] = &subpats; - if (call_user_function_ex(EG(function_table), NULL, function, &retval_ptr, 1, args, 0, NULL) == SUCCESS && retval_ptr) { + if (call_user_function_ex(EG(function_table), NULL, function, &retval_ptr, 1, args, 0, NULL TSRMLS_CC) == SUCCESS && retval_ptr) { convert_to_string_ex(&retval_ptr); *result = estrndup(Z_STRVAL_P(retval_ptr), Z_STRLEN_P(retval_ptr)); result_len = Z_STRLEN_P(retval_ptr); @@ -993,7 +993,7 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_callabl if (is_callable_replace) { if (!zend_is_callable(*replace, 0, &callback_name)) { php_error(E_WARNING, "%s() requires argument 2, '%s', to be a valid callback", - get_active_function_name(), callback_name); + get_active_function_name(TSRMLS_C), callback_name); efree(callback_name); *return_value = **subject; zval_copy_ctor(return_value); diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index 0001adf52c..ef16d1f7e4 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -43,7 +43,7 @@ #define PGSQL_NUM 1<<1 #define PGSQL_BOTH (PGSQL_ASSOC|PGSQL_NUM) -#define CHECK_DEFAULT_LINK(x) if (x == -1) { php_error(E_WARNING, "%s: no PostgreSQL link opened yet", get_active_function_name()); } +#define CHECK_DEFAULT_LINK(x) if (x == -1) { php_error(E_WARNING, "%s: no PostgreSQL link opened yet", get_active_function_name(TSRMLS_C)); } /* {{{ pgsql_functions[] */ diff --git a/ext/readline/readline.c b/ext/readline/readline.c index 2c9e955e4f..560eec8e0b 100644 --- a/ext/readline/readline.c +++ b/ext/readline/readline.c @@ -394,7 +394,7 @@ static char **_readline_completion_cb(char *text, int start, int end) params[2]=_readline_long_zval(start); params[3]=_readline_long_zval(end); - if (call_user_function(CG(function_table), NULL, params[0], &_readline_array, 3, params+1) == SUCCESS) { + if (call_user_function(CG(function_table), NULL, params[0], &_readline_array, 3, params+1 TSRMLS_CC) == SUCCESS) { if (_readline_array.type == IS_ARRAY) { matches = completion_matches(text,_readline_command_generator); } diff --git a/ext/rpc/com/com_wrapper.c b/ext/rpc/com/com_wrapper.c index ddd3a4a7ae..a9d18cec9f 100644 --- a/ext/rpc/com/com_wrapper.c +++ b/ext/rpc/com/com_wrapper.c @@ -1628,7 +1628,7 @@ static int php_COM_load_typelib(ITypeLib *TypeLib, int mode) SysFreeString(bstr_ids); c.name_len = strlen(ids)+1; c.name = ids; - if (zend_get_constant(c.name, c.name_len-1, &exists)) + if (zend_get_constant(c.name, c.name_len-1, &exists TSRMLS_CC)) { /* Oops, it already exists. No problem if it is defined as the same value */ /* Check to see if they are the same */ diff --git a/ext/sablot/sablot.c b/ext/sablot/sablot.c index 88c909b2d6..d5b856d716 100644 --- a/ext/sablot/sablot.c +++ b/ext/sablot/sablot.c @@ -1133,10 +1133,11 @@ static void _php_sablot_call_handler_function(zval *handlerName, int argc, zval zval *retval; int i; TSRMLS_FETCH(); + MAKE_STD_ZVAL(retval); - if (call_user_function(EG(function_table), NULL, handlerName, retval, argc, args) == FAILURE) { - php_error(E_WARNING, "Sorry, couldn't call %s handler", function_name); + if (call_user_function(EG(function_table), NULL, handlerName, retval, argc, args TSRMLS_CC) == FAILURE) { + php_error(E_WARNING, "Sorry, couldn't call %s handler", function_name); } zval_dtor(retval); @@ -1433,7 +1434,7 @@ static MH_ERROR _php_sablot_error(void *userData, SablotHandle p, MH_ERROR code, } } - if (call_user_function(EG(function_table), NULL, errorHandler, retval, argc, argv) == FAILURE) { + if (call_user_function(EG(function_table), NULL, errorHandler, retval, argc, argv TSRMLS_CC) == FAILURE) { php_error(E_WARNING, "Sorry, couldn't call %s error handler", Z_STRVAL_P(errorHandler)); } @@ -1510,7 +1511,7 @@ static int _php_sablot_sh_getAll(void *userData, SablotHandle p, const char *sch handle->getAllHandler, retval, argc, - argv) == FAILURE) { + argv TSRMLS_CC) == FAILURE) { php_error(E_WARNING, "Sorry couldn't call function, %s, with handler of type %s", handle->getAllHandler->value.str.val, "Scheme GetALL"); } diff --git a/ext/session/mod_user.c b/ext/session/mod_user.c index 0d8ebbc277..1173cfa447 100644 --- a/ext/session/mod_user.c +++ b/ext/session/mod_user.c @@ -59,7 +59,7 @@ static zval *ps_call_handler(zval *func, int argc, zval **argv) MAKE_STD_ZVAL(retval); if (call_user_function(EG(function_table), NULL, func, retval, - argc, argv) == FAILURE) { + argc, argv TSRMLS_CC) == FAILURE) { zval_ptr_dtor(&retval); retval = NULL; } diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c index 9057fbc4bf..d4ded35d70 100644 --- a/ext/sockets/sockets.c +++ b/ext/sockets/sockets.c @@ -450,7 +450,7 @@ PHP_FUNCTION(socket_fd_set) FD_SET(php_sock->socket, &(php_fd->set)); max_fd = php_sock->socket; } else { - php_error(E_ERROR, "expecting variable of type array or resource in %s()", get_active_function_name()); + php_error(E_ERROR, "expecting variable of type array or resource in %s()", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -484,7 +484,7 @@ PHP_FUNCTION(socket_fd_clear) ZEND_FETCH_RESOURCE(php_sock, php_socket*, arg2, -1, le_socket_name, le_socket); FD_CLR(php_sock->socket, &(php_fd->set)); } else { - php_error(E_ERROR, "expecting variable of type array or resource in %s()", get_active_function_name()); + php_error(E_ERROR, "expecting variable of type array or resource in %s()", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -571,7 +571,7 @@ PHP_FUNCTION(socket_select) } if (!sets) { - php_error(E_ERROR, "expecting atleast one %s in %s()", le_destroy_name, get_active_function_name()); + php_error(E_ERROR, "expecting atleast one %s in %s()", le_destroy_name, get_active_function_name(TSRMLS_C)); RETURN_FALSE; } diff --git a/ext/standard/array.c b/ext/standard/array.c index 1a6b6798b8..a12a95e170 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -364,7 +364,7 @@ static void php_natsort(INTERNAL_FUNCTION_PARAMETERS, int fold_case) target_hash = HASH_OF(*array); if (!target_hash) { php_error(E_WARNING, "Wrong datatype in %s() call", - get_active_function_name()); + get_active_function_name(TSRMLS_C)); return; } @@ -530,7 +530,7 @@ static int array_user_compare(const void *a, const void *b) args[0] = (pval **) f->pData; args[1] = (pval **) s->pData; - if (call_user_function_ex(EG(function_table), NULL, *BG(user_compare_func_name), &retval_ptr, 2, args, 0, NULL)==SUCCESS + if (call_user_function_ex(EG(function_table), NULL, *BG(user_compare_func_name), &retval_ptr, 2, args, 0, NULL TSRMLS_CC)==SUCCESS && retval_ptr) { long retval; @@ -634,7 +634,7 @@ static int array_user_key_compare(const void *a, const void *b) Z_TYPE(key2) = IS_LONG; } - status = call_user_function(EG(function_table), NULL, *BG(user_compare_func_name), &retval, 2, args); + status = call_user_function(EG(function_table), NULL, *BG(user_compare_func_name), &retval, 2, args TSRMLS_CC); zval_dtor(&key1); zval_dtor(&key2); @@ -978,7 +978,7 @@ static int php_array_walk(HashTable *target_hash, zval **userdata) /* Call the userland function */ if (call_user_function_ex(EG(function_table), NULL, *BG(array_walk_func_name), - &retval_ptr, userdata ? 3 : 2, args, 0, NULL) == SUCCESS) { + &retval_ptr, userdata ? 3 : 2, args, 0, NULL TSRMLS_CC) == SUCCESS) { zval_ptr_dtor(&retval_ptr); } else @@ -1012,14 +1012,14 @@ PHP_FUNCTION(array_walk) target_hash = HASH_OF(*array); if (!target_hash) { php_error(E_WARNING, "Wrong datatype in %s() call", - get_active_function_name()); + get_active_function_name(TSRMLS_C)); BG(array_walk_func_name) = old_walk_func_name; RETURN_FALSE; } if (Z_TYPE_PP(BG(array_walk_func_name)) != IS_ARRAY && Z_TYPE_PP(BG(array_walk_func_name)) != IS_STRING) { php_error(E_WARNING, "Wrong syntax for function name in %s() call", - get_active_function_name()); + get_active_function_name(TSRMLS_C)); BG(array_walk_func_name) = old_walk_func_name; RETURN_FALSE; } @@ -1052,12 +1052,12 @@ static void php_search_array(INTERNAL_FUNCTION_PARAMETERS, int behavior) } if (Z_TYPE_PP(value) == IS_ARRAY || Z_TYPE_PP(value) == IS_OBJECT) { - php_error(E_WARNING, "Wrong datatype for first argument in call to %s", get_active_function_name()); + php_error(E_WARNING, "Wrong datatype for first argument in call to %s", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } if (Z_TYPE_PP(array) != IS_ARRAY) { - php_error(E_WARNING, "Wrong datatype for second argument in call to %s", get_active_function_name()); + php_error(E_WARNING, "Wrong datatype for second argument in call to %s", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -1167,7 +1167,7 @@ PHP_FUNCTION(extract) extract_type = Z_LVAL_PP(z_extract_type); if (extract_type > EXTR_SKIP && extract_type <= EXTR_PREFIX_INVALID) { php_error(E_WARNING, "%s() expects a prefix to be specified", - get_active_function_name()); + get_active_function_name(TSRMLS_C)); return; } break; @@ -1188,13 +1188,13 @@ PHP_FUNCTION(extract) if (extract_type < EXTR_OVERWRITE || extract_type > EXTR_PREFIX_INVALID) { php_error(E_WARNING, "Unknown extract type in call to %s()", - get_active_function_name()); + get_active_function_name(TSRMLS_C)); return; } if (Z_TYPE_PP(var_array) != IS_ARRAY) { php_error(E_WARNING, "%s() expects first argument to be an array", - get_active_function_name()); + get_active_function_name(TSRMLS_C)); return; } @@ -2150,7 +2150,7 @@ PHP_FUNCTION(array_pad) /* Make sure arguments are of the proper type */ if (Z_TYPE_PP(input) != IS_ARRAY) { php_error(E_WARNING, "Argument to %s() should be an array", - get_active_function_name()); + get_active_function_name(TSRMLS_C)); return; } convert_to_long_ex(pad_size); @@ -2598,7 +2598,7 @@ PHP_FUNCTION(array_multisort) sort_order = Z_LVAL_PP(args[i]) == SORT_DESC ? -1 : 1; parse_state[MULTISORT_ORDER] = 0; } else { - php_error(E_WARNING, "Argument %i to %s() is expected to be an array or sorting flag that has not already been specified", i+1, get_active_function_name()); + php_error(E_WARNING, "Argument %i to %s() is expected to be an array or sorting flag that has not already been specified", i+1, get_active_function_name(TSRMLS_C)); MULTISORT_ABORT; } break; @@ -2612,20 +2612,20 @@ PHP_FUNCTION(array_multisort) sort_type = Z_LVAL_PP(args[i]); parse_state[MULTISORT_TYPE] = 0; } else { - php_error(E_WARNING, "Argument %i to %s() is expected to be an array or sorting flag that has not already been specified", i+1, get_active_function_name()); + php_error(E_WARNING, "Argument %i to %s() is expected to be an array or sorting flag that has not already been specified", i+1, get_active_function_name(TSRMLS_C)); MULTISORT_ABORT; } break; default: php_error(E_WARNING, "Argument %i to %s() is an unknown sort flag", i+1, - get_active_function_name()); + get_active_function_name(TSRMLS_C)); MULTISORT_ABORT; break; } } else { - php_error(E_WARNING, "Argument %i to %s() is expected to be an array or a sort flag", i+1, get_active_function_name()); + php_error(E_WARNING, "Argument %i to %s() is expected to be an array or a sort flag", i+1, get_active_function_name(TSRMLS_C)); MULTISORT_ABORT; } } @@ -2735,7 +2735,7 @@ PHP_FUNCTION(array_rand) if (Z_TYPE_PP(input) != IS_ARRAY) { zend_error(E_WARNING, "Argument to %s() has to be an array", - get_active_function_name()); + get_active_function_name(TSRMLS_C)); return; } @@ -2745,7 +2745,7 @@ PHP_FUNCTION(array_rand) convert_to_long_ex(num_req); num_req_val = Z_LVAL_PP(num_req); if (num_req_val <= 0 || num_req_val > num_avail) { - zend_error(E_WARNING, "Second argument to %s() has to be between 1 and the number of elements in the array", get_active_function_name()); + zend_error(E_WARNING, "Second argument to %s() has to be between 1 and the number of elements in the array", get_active_function_name(TSRMLS_C)); return; } } else @@ -2816,7 +2816,7 @@ PHP_FUNCTION(array_sum) if (Z_TYPE_PP(input) != IS_ARRAY) { php_error(E_WARNING, "The argument to %s() should be an array", - get_active_function_name()); + get_active_function_name(TSRMLS_C)); return; } @@ -2863,13 +2863,13 @@ PHP_FUNCTION(array_reduce) if (Z_TYPE_PP(input) != IS_ARRAY) { php_error(E_WARNING, "%s() expects argument 1 to be an array", - get_active_function_name()); + get_active_function_name(TSRMLS_C)); return; } if (!zend_is_callable(*callback, 0, &callback_name)) { php_error(E_WARNING, "%s() expects argument 2, '%s', to be a valid callback", - get_active_function_name(), callback_name); + get_active_function_name(TSRMLS_C), callback_name); efree(callback_name); return; } @@ -2891,10 +2891,10 @@ PHP_FUNCTION(array_reduce) if (result) { args[0] = &result; args[1] = operand; - if (call_user_function_ex(EG(function_table), NULL, *callback, &retval, 2, args, 0, NULL) == SUCCESS && retval) { + if (call_user_function_ex(EG(function_table), NULL, *callback, &retval, 2, args, 0, NULL TSRMLS_CC) == SUCCESS && retval) { result = retval; } else { - php_error(E_WARNING, "%s() had an error invoking the reduction callback", get_active_function_name()); + php_error(E_WARNING, "%s() had an error invoking the reduction callback", get_active_function_name(TSRMLS_C)); return; } } else @@ -2929,14 +2929,14 @@ PHP_FUNCTION(array_filter) if (Z_TYPE_PP(input) != IS_ARRAY) { php_error(E_WARNING, "%s() expects argument 1 to be an array", - get_active_function_name()); + get_active_function_name(TSRMLS_C)); return; } if (ZEND_NUM_ARGS() > 1) { if (!zend_is_callable(*callback, 0, &callback_name)) { php_error(E_WARNING, "%s() expects argument 2, '%s', to be a valid callback", - get_active_function_name(), callback_name); + get_active_function_name(TSRMLS_C), callback_name); efree(callback_name); return; } @@ -2953,14 +2953,14 @@ PHP_FUNCTION(array_filter) if (callback) { args[0] = operand; - if (call_user_function_ex(EG(function_table), NULL, *callback, &retval, 1, args, 0, NULL) == SUCCESS && retval) { + if (call_user_function_ex(EG(function_table), NULL, *callback, &retval, 1, args, 0, NULL TSRMLS_CC) == SUCCESS && retval) { if (!zend_is_true(retval)) { zval_ptr_dtor(&retval); continue; } else zval_ptr_dtor(&retval); } else { - php_error(E_WARNING, "%s() had an error invoking the filter callback", get_active_function_name()); + php_error(E_WARNING, "%s() had an error invoking the filter callback", get_active_function_name(TSRMLS_C)); return; } } else if (!zend_is_true(*operand)) @@ -3008,7 +3008,7 @@ PHP_FUNCTION(array_map) callback = *args[0]; if (Z_TYPE_P(callback) != IS_NULL && !zend_is_callable(callback, 0, &callback_name)) { php_error(E_WARNING, "%s() expects argument 1, '%s', to be either NULL or a valid callback", - get_active_function_name(), callback_name); + get_active_function_name(TSRMLS_C), callback_name); efree(callback_name); efree(args); return; @@ -3022,7 +3022,7 @@ PHP_FUNCTION(array_map) for (i = 0; i < ZEND_NUM_ARGS()-1; i++) { if (Z_TYPE_PP(args[i+1]) != IS_ARRAY) { php_error(E_WARNING, "%s() expects argument %d to be an array", - get_active_function_name(), i + 2); + get_active_function_name(TSRMLS_C), i + 2); efree(array_len); efree(args); return; @@ -3075,8 +3075,8 @@ PHP_FUNCTION(array_map) } if (Z_TYPE_P(callback) != IS_NULL) { - if (!call_user_function_ex(EG(function_table), NULL, callback, &result, ZEND_NUM_ARGS()-1, params, 0, NULL) == SUCCESS && result) { - php_error(E_WARNING, "%s() had an error invoking the map callback", get_active_function_name()); + if (!call_user_function_ex(EG(function_table), NULL, callback, &result, ZEND_NUM_ARGS()-1, params, 0, NULL TSRMLS_CC) == SUCCESS && result) { + php_error(E_WARNING, "%s() had an error invoking the map callback", get_active_function_name(TSRMLS_C)); efree(array_len); efree(args); zval_dtor(return_value); @@ -3108,7 +3108,7 @@ PHP_FUNCTION(key_exists) } if (Z_TYPE_PP(array) != IS_ARRAY && Z_TYPE_PP(array) != IS_OBJECT) { - php_error(E_WARNING, "Wrong datatype for second argument in call to %s", get_active_function_name()); + php_error(E_WARNING, "Wrong datatype for second argument in call to %s", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } @@ -3126,7 +3126,7 @@ PHP_FUNCTION(key_exists) RETURN_FALSE; default: - php_error(E_WARNING, "Wrong datatype for first argument in call to %s", get_active_function_name()); + php_error(E_WARNING, "Wrong datatype for first argument in call to %s", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } diff --git a/ext/standard/assert.c b/ext/standard/assert.c index fe018ffb67..e0bb336d25 100644 --- a/ext/standard/assert.c +++ b/ext/standard/assert.c @@ -195,7 +195,7 @@ PHP_FUNCTION(assert) ZVAL_FALSE(retval); /* XXX do we want to check for error here? */ - call_user_function(CG(function_table), NULL, ASSERTG(callback), retval, 3, args); + call_user_function(CG(function_table), NULL, ASSERTG(callback), retval, 3, args TSRMLS_CC); for (i = 0; i <= 2; i++) { zval_ptr_dtor(&(args[i])); diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 82d4e7787e..e2ef244d47 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -933,7 +933,7 @@ PHP_FUNCTION(constant) } convert_to_string_ex(const_name); - if (!zend_get_constant(Z_STRVAL_PP(const_name), Z_STRLEN_PP(const_name), return_value)) { + if (!zend_get_constant(Z_STRVAL_PP(const_name), Z_STRLEN_PP(const_name), return_value TSRMLS_CC)) { php_error(E_WARNING, "Couldn't find constant %s", Z_STRVAL_PP(const_name)); RETURN_NULL(); } @@ -1624,13 +1624,13 @@ PHP_FUNCTION(call_user_func) if (!zend_is_callable(*params[0], 0, &name)) { php_error(E_WARNING, "%s() expects first argument, '%s', to be a valid callback", - get_active_function_name(), name); + get_active_function_name(TSRMLS_C), name); efree(name); efree(params); RETURN_NULL(); } - if (call_user_function_ex(EG(function_table), NULL, *params[0], &retval_ptr, argc - 1, params + 1, 0, NULL)==SUCCESS && retval_ptr) { + if (call_user_function_ex(EG(function_table), NULL, *params[0], &retval_ptr, argc - 1, params + 1, 0, NULL TSRMLS_CC)==SUCCESS && retval_ptr) { COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr); } else { php_error(E_WARNING, "Unable to call %s()", name); @@ -1668,7 +1668,7 @@ PHP_FUNCTION(call_user_func_array) if (!zend_is_callable(*func, 0, &name)) { php_error(E_WARNING, "%s() expects first argument, '%s', to be a valid callback", - get_active_function_name(), name); + get_active_function_name(TSRMLS_C), name); efree(name); RETURN_NULL(); } @@ -1684,7 +1684,7 @@ PHP_FUNCTION(call_user_func_array) current++; } - if (call_user_function_ex(EG(function_table), NULL, *func, &retval_ptr, count, func_params, 0, NULL) == SUCCESS && retval_ptr) { + if (call_user_function_ex(EG(function_table), NULL, *func, &retval_ptr, count, func_params, 0, NULL TSRMLS_CC) == SUCCESS && retval_ptr) { COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr); } else { php_error(E_WARNING, "Unable to call %s()", name); @@ -1723,7 +1723,7 @@ PHP_FUNCTION(call_user_method) } SEPARATE_ZVAL(params[0]); convert_to_string(*params[0]); - if (call_user_function_ex(EG(function_table), params[1], *params[0], &retval_ptr, arg_count-2, params+2, 0, NULL)==SUCCESS && retval_ptr) { + if (call_user_function_ex(EG(function_table), params[1], *params[0], &retval_ptr, arg_count-2, params+2, 0, NULL TSRMLS_CC)==SUCCESS && retval_ptr) { COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr); } else { php_error(E_WARNING,"Unable to call %s()", Z_STRVAL_PP(params[0])); @@ -1771,7 +1771,7 @@ PHP_FUNCTION(call_user_method_array) zend_hash_move_forward(params_ar)) element++; - if (call_user_function_ex(EG(function_table), obj, *method_name, &retval_ptr, num_elems, method_args, 0, NULL) == SUCCESS && retval_ptr) { + if (call_user_function_ex(EG(function_table), obj, *method_name, &retval_ptr, num_elems, method_args, 0, NULL TSRMLS_CC) == SUCCESS && retval_ptr) { COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr); } else { php_error(E_WARNING, "Unable to call %s()", Z_STRVAL_PP(method_name)); @@ -1806,7 +1806,7 @@ static int user_shutdown_function_call(php_shutdown_function_entry *shutdown_fun zval retval; TSRMLS_FETCH(); - if (call_user_function(EG(function_table), NULL, shutdown_function_entry->arguments[0], &retval, shutdown_function_entry->arg_count-1, shutdown_function_entry->arguments+1)==SUCCESS) { + if (call_user_function(EG(function_table), NULL, shutdown_function_entry->arguments[0], &retval, shutdown_function_entry->arg_count-1, shutdown_function_entry->arguments+1 TSRMLS_CC)==SUCCESS) { zval_dtor(&retval); } else { php_error(E_WARNING,"Unable to call %s() - function does not exist", @@ -1822,7 +1822,7 @@ static void user_tick_function_call(user_tick_function_entry *tick_fe) TSRMLS_FETCH(); if (call_user_function(EG(function_table), NULL, function, &retval, - tick_fe->arg_count - 1, tick_fe->arguments + 1) == SUCCESS) { + tick_fe->arg_count - 1, tick_fe->arguments+1 TSRMLS_CC) == SUCCESS) { zval_dtor(&retval); } else { zval **obj, **method; @@ -2387,7 +2387,7 @@ PHP_FUNCTION(unregister_tick_function) /* This function is not directly accessible to end users */ PHPAPI PHP_FUNCTION(warn_not_available) { - php_error(E_WARNING, "%s() is not supported in this PHP build", get_active_function_name()); + php_error(E_WARNING, "%s() is not supported in this PHP build", get_active_function_name(TSRMLS_C)); RETURN_FALSE; } diff --git a/ext/standard/file.c b/ext/standard/file.c index a01946cf1d..b03911f897 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -621,7 +621,7 @@ PHP_FUNCTION(fopenstream) stream = php_stream_fopen(Z_STRVAL_PP(zfilename), Z_STRVAL_PP(zmode)); if (stream == NULL) { - zend_error(E_WARNING, "%s(): unable to open %s: %s", get_active_function_name(), Z_STRVAL_PP(zfilename), strerror(errno)); + zend_error(E_WARNING, "%s(): unable to open %s: %s", get_active_function_name(TSRMLS_C), Z_STRVAL_PP(zfilename), strerror(errno)); RETURN_FALSE; } ZEND_REGISTER_RESOURCE(return_value, stream, le_stream); @@ -1247,7 +1247,7 @@ PHP_FUNCTION(fscanf) convert_to_string_ex( format_string ); result = php_sscanf_internal( buf,(*format_string)->value.str.val, - argCount,args, 2,&return_value); + argCount, args, 2, &return_value TSRMLS_CC); efree(args); efree(buf); if (SCAN_ERROR_WRONG_PARAM_COUNT == result) { diff --git a/ext/standard/formatted_print.c b/ext/standard/formatted_print.c index 3521865970..0a4d6d3ee1 100644 --- a/ext/standard/formatted_print.c +++ b/ext/standard/formatted_print.c @@ -136,11 +136,11 @@ static char *php_convert_to_decimal(double arg, int ndigits, int *decpt, int *si inline static void -php_sprintf_appendchar(char **buffer, int *pos, int *size, char add) +php_sprintf_appendchar(char **buffer, int *pos, int *size, char add TSRMLS_DC) { if ((*pos + 1) >= *size) { *size <<= 1; - PRINTF_DEBUG(("%s: ereallocing buffer to %d bytes\n", get_active_function_name(), *size)); + PRINTF_DEBUG(("%s: ereallocing buffer to %d bytes\n", get_active_function_name(TSRMLS_C), *size)); *buffer = erealloc(*buffer, *size); } PRINTF_DEBUG(("sprintf: appending '%c', pos=\n", add, *pos)); @@ -438,15 +438,15 @@ php_formatted_print(int ht, int *len TSRMLS_DC) PRINTF_DEBUG(("sprintf: format[%d]='%c'\n", inpos, format[inpos])); PRINTF_DEBUG(("sprintf: outpos=%d\n", outpos)); if (format[inpos] != '%') { - php_sprintf_appendchar(&result, &outpos, &size, format[inpos++]); + php_sprintf_appendchar(&result, &outpos, &size, format[inpos++] TSRMLS_CC); } else if (format[inpos + 1] == '%') { - php_sprintf_appendchar(&result, &outpos, &size, '%'); + php_sprintf_appendchar(&result, &outpos, &size, '%' TSRMLS_CC); inpos += 2; } else { if (currarg >= argc && format[inpos + 1] != '%') { efree(result); efree(args); - php_error(E_WARNING, "%s(): too few arguments",get_active_function_name()); + php_error(E_WARNING, "%s(): too few arguments",get_active_function_name(TSRMLS_C)); return NULL; } /* starting a new format specifier, reset variables */ @@ -470,7 +470,7 @@ php_formatted_print(int ht, int *len TSRMLS_DC) if (argnum >= argc) { efree(result); efree(args); - php_error(E_WARNING, "%s(): too few arguments",get_active_function_name()); + php_error(E_WARNING, "%s(): too few arguments", get_active_function_name(TSRMLS_C)); return NULL; } @@ -570,7 +570,7 @@ php_formatted_print(int ht, int *len TSRMLS_DC) case 'c': convert_to_long_ex(args[argnum]); php_sprintf_appendchar(&result, &outpos, &size, - (char) (*args[argnum])->value.lval); + (char) (*args[argnum])->value.lval TSRMLS_CC); break; case 'o': @@ -606,7 +606,7 @@ php_formatted_print(int ht, int *len TSRMLS_DC) break; case '%': - php_sprintf_appendchar(&result, &outpos, &size, '%'); + php_sprintf_appendchar(&result, &outpos, &size, '%' TSRMLS_CC); break; default: diff --git a/ext/standard/fsock.c b/ext/standard/fsock.c index 0f321ff08e..8e3eac0828 100644 --- a/ext/standard/fsock.c +++ b/ext/standard/fsock.c @@ -679,13 +679,14 @@ static int php_sockop_flush(php_stream * stream) static int php_sockop_cast(php_stream * stream, int castas, void ** ret) { php_sockbuf * sock = (php_sockbuf*)stream->abstract; + TSRMLS_FETCH(); switch(castas) { case PHP_STREAM_AS_STDIO: if (ret) { /* DANGER!: data buffered in stream->readbuf will be forgotten! */ if (TOREAD(sock) > 0) - zend_error(E_WARNING, "%s(): buffered data lost during conversion to FILE*!", get_active_function_name()); + zend_error(E_WARNING, "%s(): buffered data lost during conversion to FILE*!", get_active_function_name(TSRMLS_C)); *ret = fdopen(sock->socket, stream->mode); if (*ret) return SUCCESS; diff --git a/ext/standard/scanf.c b/ext/standard/scanf.c index 47c9590ddc..3a6008738c 100644 --- a/ext/standard/scanf.c +++ b/ext/standard/scanf.c @@ -328,6 +328,7 @@ PHPAPI int ValidateFormat(char *format,int numVars,int *totalSubs) int staticAssign[STATIC_LIST_SIZE]; int *nassign = staticAssign; int objIndex, xpgSize, nspace = STATIC_LIST_SIZE; + TSRMLS_FETCH(); /* * Initialize an array that records the number of times a variable @@ -408,7 +409,7 @@ PHPAPI int ValidateFormat(char *format,int numVars,int *totalSubs) if (gotXpg) { mixedXPG: php_error(E_WARNING, - "cannot mix \"%\" and \"%n$\" conversion specifiers in %s", get_active_function_name() ); + "cannot mix \"%\" and \"%n$\" conversion specifiers in %s", get_active_function_name(TSRMLS_C) ); goto error; } @@ -593,7 +594,7 @@ PHPAPI int ValidateFormat(char *format,int numVars,int *totalSubs) PHPAPI int php_sscanf_internal( char *string,char *format, int argCount,zval ***args, - int varStart,pval **return_value) + int varStart,pval **return_value TSRMLS_DC) { int numVars, nconversions, totalVars = -1; int i, value, result; @@ -642,7 +643,7 @@ PHPAPI int php_sscanf_internal( char *string,char *format, for (i = varStart;i < argCount;i++){ if ( ! PZVAL_IS_REF( *args[ i ] ) ) { php_error(E_WARNING,"Parameter %d to %s() must be passed by reference", - i, get_active_function_name()); + i, get_active_function_name(TSRMLS_C)); scan_set_error_return(numVars, return_value); return SCAN_ERROR_VAR_PASSED_BYVAL; } diff --git a/ext/standard/scanf.h b/ext/standard/scanf.h index 4d5807d199..5de014f75b 100644 --- a/ext/standard/scanf.h +++ b/ext/standard/scanf.h @@ -43,8 +43,8 @@ * e.g. fscanf */ PHPAPI int ValidateFormat(char *format, int numVars, int *totalVars); -PHPAPI int php_sscanf_internal(char *string,char *format,int argCount,zval ***args, - int varStart,pval **return_value); +PHPAPI int php_sscanf_internal(char *string,char *format,int argCount,zval ***args, + int varStart,pval **return_value TSRMLS_DC); #endif /* SCANF_H */ diff --git a/ext/standard/string.c b/ext/standard/string.c index ffcfbd2c0b..a2522823c2 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -796,7 +796,7 @@ PHP_FUNCTION(implode) delim = *arg1; } else { php_error(E_WARNING, "Bad arguments to %s()", - get_active_function_name()); + get_active_function_name(TSRMLS_C)); return; } php_implode(delim, arr, return_value); @@ -1088,7 +1088,7 @@ PHP_FUNCTION(pathinfo) opt = Z_LVAL_PP(uopt); if (opt < PHP_PATHINFO_DIRNAME || opt > PHP_PATHINFO_EXTENSION) { php_error(E_WARNING, "Invalid option in call to %s()", - get_active_function_name()); + get_active_function_name(TSRMLS_C)); return; } } @@ -3220,7 +3220,7 @@ PHP_FUNCTION(str_repeat) if ((*mult)->value.lval < 0) { php_error(E_WARNING, "Second argument to %s() has to be greater than or equal to 0", - get_active_function_name()); + get_active_function_name(TSRMLS_C)); return; } @@ -3538,7 +3538,7 @@ PHP_FUNCTION(str_pad) convert_to_string_ex(pad_string); if (Z_STRLEN_PP(pad_string) == 0) { php_error(E_WARNING, "Padding string cannot be empty in %s()", - get_active_function_name()); + get_active_function_name(TSRMLS_C)); return; } pad_str_val = Z_STRVAL_PP(pad_string); @@ -3548,7 +3548,7 @@ PHP_FUNCTION(str_pad) convert_to_long_ex(pad_type); pad_type_val = Z_LVAL_PP(pad_type); if (pad_type_val < STR_PAD_LEFT || pad_type_val > STR_PAD_BOTH) { - php_error(E_WARNING, "Padding type has to be STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH in %s()", get_active_function_name()); + php_error(E_WARNING, "Padding type has to be STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH in %s()", get_active_function_name(TSRMLS_C)); return; } } @@ -3602,7 +3602,6 @@ PHP_FUNCTION(sscanf) zval ***args; int argCount; - argCount = ZEND_NUM_ARGS(); if (argCount < 2) { WRONG_PARAM_COUNT; @@ -3621,8 +3620,8 @@ PHP_FUNCTION(sscanf) result = php_sscanf_internal( (*literal)->value.str.val, (*format)->value.str.val, - argCount,args, - 2,&return_value); + argCount, args, + 2, &return_value TSRMLS_CC); efree(args); if (SCAN_ERROR_WRONG_PARAM_COUNT == result) { diff --git a/ext/standard/var.c b/ext/standard/var.c index bd874ae587..dd2cd9d8b8 100644 --- a/ext/standard/var.c +++ b/ext/standard/var.c @@ -240,7 +240,7 @@ PHPAPI void php_var_serialize(zval *buf, zval **struc, HashTable *var_hash) MAKE_STD_ZVAL(fname); ZVAL_STRING(fname,"__sleep",1); - res = call_user_function_ex(CG(function_table), struc, fname, &retval_ptr, 0, 0, 1, NULL); + res = call_user_function_ex(CG(function_table), struc, fname, &retval_ptr, 0, 0, 1, NULL TSRMLS_CC); if (res == SUCCESS) { if (retval_ptr && HASH_OF(retval_ptr)) { @@ -583,7 +583,7 @@ PHPAPI int php_var_unserialize(zval **rval, const char **p, const char *max, Has MAKE_STD_ZVAL(fname); ZVAL_STRING(fname,"__wakeup",1); - call_user_function_ex(CG(function_table), rval, fname, &retval_ptr, 0, 0, 1, NULL); + call_user_function_ex(CG(function_table), rval, fname, &retval_ptr, 0, 0, 1, NULL TSRMLS_CC); zval_dtor(fname); FREE_ZVAL(fname); diff --git a/ext/wddx/wddx.c b/ext/wddx/wddx.c index 9c36969554..4847cecb1c 100644 --- a/ext/wddx/wddx.c +++ b/ext/wddx/wddx.c @@ -446,7 +446,7 @@ static void php_wddx_serialize_object(wddx_packet *packet, zval *obj) * We try to call __sleep() method on object. It's supposed to return an * array of property names to be serialized. */ - if (call_user_function_ex(CG(function_table), &obj, fname, &retval, 0, 0, 1, NULL) == SUCCESS) { + if (call_user_function_ex(CG(function_table), &obj, fname, &retval, 0, 0, 1, NULL TSRMLS_CC) == SUCCESS) { if (retval && HASH_OF(retval)) { PHP_CLASS_ATTRIBUTES; @@ -813,7 +813,7 @@ static void php_wddx_pop_element(void *user_data, const char *name) MAKE_STD_ZVAL(fname); ZVAL_STRING(fname, "__wakeup", 1); - call_user_function_ex(NULL, &ent1->data, fname, &retval, 0, 0, 0, NULL); + call_user_function_ex(NULL, &ent1->data, fname, &retval, 0, 0, 0, NULL TSRMLS_CC); zval_dtor(fname); FREE_ZVAL(fname); @@ -1027,7 +1027,7 @@ PHP_FUNCTION(wddx_serialize_vars) argc = ZEND_NUM_ARGS(); if (argc < 1) { php_error(E_WARNING, "%s() requires at least 1 argument, 0 given", - get_active_function_name()); + get_active_function_name(TSRMLS_C)); return; } @@ -1144,7 +1144,7 @@ PHP_FUNCTION(wddx_add_vars) argc = ZEND_NUM_ARGS(); if (argc < 2) { php_error(E_WARNING, "%s() requires at least 2 arguments, %d given", - get_active_function_name(), ZEND_NUM_ARGS()); + get_active_function_name(TSRMLS_C), ZEND_NUM_ARGS()); return; } diff --git a/ext/xml/xml.c b/ext/xml/xml.c index 88798c82f6..74beeb9b3c 100644 --- a/ext/xml/xml.c +++ b/ext/xml/xml.c @@ -378,7 +378,7 @@ xml_call_handler(xml_parser *parser, zval *handler, int argc, zval **argv) MAKE_STD_ZVAL(retval); ZVAL_FALSE(retval); - result = call_user_function(EG(function_table), &parser->object, handler, retval, argc, argv); + result = call_user_function(EG(function_table), &parser->object, handler, retval, argc, argv TSRMLS_CC); if (result == FAILURE) { zval **method; diff --git a/ext/xslt/xslt.c b/ext/xslt/xslt.c index 48cffef156..54e6e85714 100644 --- a/ext/xslt/xslt.c +++ b/ext/xslt/xslt.c @@ -81,11 +81,12 @@ extern void xslt_make_array(zval **zarr, char ***carr) zval **current; HashTable *arr; int idx = 0; + TSRMLS_FETCH(); arr = HASH_OF(*zarr); if (! arr) { php_error(E_WARNING, "Invalid argument or parameter array to %s", - get_active_function_name()); + get_active_function_name(TSRMLS_C)); return; } @@ -104,7 +105,7 @@ extern void xslt_make_array(zval **zarr, char ***carr) type = zend_hash_get_current_key(arr, &string_key, &num_key, 0); if (type == HASH_KEY_IS_LONG) { php_error(E_WARNING, "Invalid argument or parameter array to %s", - get_active_function_name()); + get_active_function_name(TSRMLS_C)); return; } @@ -229,7 +230,7 @@ extern void xslt_call_function(char *name, /* Call the function */ error = call_user_function_ex(EG(function_table), NULL, function, - retval, argc, argv, 0, NULL); + retval, argc, argv, 0, NULL TSRMLS_CC); if (error == FAILURE) { php_error(E_WARNING, "Cannot call the %s handler: %s", name, Z_STRVAL_P(function)); diff --git a/ext/yp/yp.c b/ext/yp/yp.c index fa588260df..3a4ffea717 100644 --- a/ext/yp/yp.c +++ b/ext/yp/yp.c @@ -237,7 +237,7 @@ static int php_foreach_all (int instatus, char *inkey, int inkeylen, char *inval MAKE_STD_ZVAL (value); ZVAL_STRINGL (value, inval, invallen, 1); - if(call_user_function_ex(CG(function_table), NULL, *((zval **)indata), &retval, 3, args, 0, NULL) != SUCCESS) + if(call_user_function_ex(CG(function_table), NULL, *((zval **)indata), &retval, 3, args, 0, NULL TSRMLS_CC) != SUCCESS) { zend_error(E_ERROR, "Function call failed"); return 1; diff --git a/main/fopen_wrappers.c b/main/fopen_wrappers.c index f1271ad0a4..df72859581 100644 --- a/main/fopen_wrappers.c +++ b/main/fopen_wrappers.c @@ -462,7 +462,7 @@ PHPAPI FILE *php_fopen_with_path(char *filename, char *mode, char *path, char ** /* append the calling scripts' current working directory * as a fall back case */ - if (zend_is_executing()) { + if (zend_is_executing(TSRMLS_C)) { exec_fname = zend_get_executed_filename(TSRMLS_C); exec_fname_length = strlen(exec_fname); path_length = strlen(path); diff --git a/main/main.c b/main/main.c index 92dcd6a4d2..bfe8b67d0c 100644 --- a/main/main.c +++ b/main/main.c @@ -152,7 +152,7 @@ static PHP_INI_MH(OnUpdateTimeout) /* Don't set a timeout on startup, only per-request */ return SUCCESS; } - zend_unset_timeout(); + zend_unset_timeout(TSRMLS_C); zend_set_timeout(EG(timeout_seconds)); return SUCCESS; } @@ -484,7 +484,7 @@ PHP_FUNCTION(set_time_limit) } convert_to_long_ex(new_timeout); - zend_unset_timeout(); + zend_unset_timeout(TSRMLS_C); zend_set_timeout(Z_LVAL_PP(new_timeout)); } /* }}} */ @@ -708,7 +708,7 @@ void php_request_shutdown(void *dummy) } zend_end_try(); zend_try { - zend_unset_timeout(); + zend_unset_timeout(TSRMLS_C); } zend_end_try(); } /* }}} */ diff --git a/main/output.c b/main/output.c index 562c28702c..cf5272acdd 100644 --- a/main/output.c +++ b/main/output.c @@ -183,7 +183,7 @@ PHPAPI void php_end_ob_buffer(zend_bool send_buffer, zend_bool just_flush) params[0] = &orig_buffer; params[1] = &z_status; OG(ob_lock) = 1; - if (call_user_function_ex(CG(function_table), NULL, OG(active_ob_buffer).output_handler, &alternate_buffer, 2, params, 1, NULL)==SUCCESS) { + if (call_user_function_ex(CG(function_table), NULL, OG(active_ob_buffer).output_handler, &alternate_buffer, 2, params, 1, NULL TSRMLS_CC)==SUCCESS) { convert_to_string_ex(&alternate_buffer); final_buffer = alternate_buffer->value.str.val; final_buffer_length = alternate_buffer->value.str.len; @@ -489,14 +489,10 @@ static int php_ub_body_write(const char *str, uint str_length) zend_bailout(); } if (php_header()) { - if (zend_is_compiling()) { - TSRMLS_FETCH(); - + if (zend_is_compiling(TSRMLS_C)) { OG(output_start_filename) = zend_get_compiled_filename(TSRMLS_C); OG(output_start_lineno) = zend_get_compiled_lineno(TSRMLS_C); - } else if (zend_is_executing()) { - TSRMLS_FETCH(); - + } else if (zend_is_executing(TSRMLS_C)) { OG(output_start_filename) = zend_get_executed_filename(TSRMLS_C); OG(output_start_lineno) = zend_get_executed_lineno(TSRMLS_C); } diff --git a/main/streams.c b/main/streams.c index 6b3cd0f472..d221708ce1 100755 --- a/main/streams.c +++ b/main/streams.c @@ -149,7 +149,9 @@ PHPAPI int php_stream_flush(php_stream * stream) PHPAPI size_t php_stream_write(php_stream * stream, const char * buf, size_t count) { if (strchr(stream->mode, 'w') == NULL) { - zend_error(E_WARNING, "%s(): stream was not opened for writing", get_active_function_name()); + TSRMLS_FETCH(); + + zend_error(E_WARNING, "%s(): stream was not opened for writing", get_active_function_name(TSRMLS_C)); return 0; } @@ -311,13 +313,17 @@ PHPAPI int php_stream_cast(php_stream * stream, int castas, void ** ret, int sho goto exit_success; } - /* must be either: - a) programmer error - b) no memory - -> lets bail - */ - zend_error(E_ERROR, "%s(): fopencookie failed", get_active_function_name()); - return FAILURE; + { + TSRMLS_FETCH(); + + /* must be either: + a) programmer error + b) no memory + -> lets bail + */ + zend_error(E_ERROR, "%s(): fopencookie failed", get_active_function_name(TSRMLS_C)); + return FAILURE; + } #endif goto exit_fail; @@ -328,12 +334,14 @@ PHPAPI int php_stream_cast(php_stream * stream, int castas, void ** ret, int sho exit_fail: if (show_err) { + TSRMLS_FETCH(); + /* these names depend on the values of the PHP_STREAM_AS_XXX defines in php_streams.h */ static const char * cast_names[3] = { "STDIO FILE*", "File Descriptor", "Socket Descriptor" }; zend_error(E_WARNING, "%s(): cannot represent a stream of type %s as a %s", - get_active_function_name(), + get_active_function_name(TSRMLS_C), stream->ops->label, cast_names[castas] ); diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index e58c7be8ae..5914064f3e 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -750,7 +750,7 @@ any .htaccess restrictions anywhere on your site you can leave doc_root undefine if (open_file_for_scanning(&file_handle TSRMLS_CC)==SUCCESS) { php_get_highlight_struct(&syntax_highlighter_ini); - zend_highlight(&syntax_highlighter_ini); + zend_highlight(&syntax_highlighter_ini TSRMLS_CC); fclose(file_handle.handle.fp); } return SUCCESS; diff --git a/sapi/isapi/php4isapi.c b/sapi/isapi/php4isapi.c index 8526665233..6bfaafd586 100644 --- a/sapi/isapi/php4isapi.c +++ b/sapi/isapi/php4isapi.c @@ -156,7 +156,6 @@ static void php_info_isapi(ZEND_MODULE_INFO_FUNC_ARGS) }; char ***server_variable_names; LPEXTENSION_CONTROL_BLOCK lpECB; - TSRMLS_FETCH(); lpECB = (LPEXTENSION_CONTROL_BLOCK) SG(server_context); @@ -246,7 +245,6 @@ static int sapi_isapi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC) HSE_SEND_HEADER_EX_INFO header_info; char status_buf[MAX_STATUS_LENGTH]; sapi_header_struct default_content_type; - TSRMLS_FETCH(); /* Obtain headers length */ if (SG(sapi_headers).send_default_content_type) { @@ -497,7 +495,7 @@ static void sapi_isapi_register_server_variables2(char **server_variables, LPEXT } -static void sapi_isapi_register_server_variables(zval *track_vars_array TSRMLS_DC TSRMLS_DC TSRMLS_DC) +static void sapi_isapi_register_server_variables(zval *track_vars_array TSRMLS_DC) { DWORD variable_len = ISAPI_SERVER_VAR_BUF_SIZE; char *variable; @@ -648,7 +646,7 @@ DWORD WINAPI HttpFilterProc(PHTTP_FILTER_CONTEXT pfc, DWORD notificationType, LP } -static void init_request_info(sapi_globals_struct *sapi_globals, LPEXTENSION_CONTROL_BLOCK lpECB) +static void init_request_info(LPEXTENSION_CONTROL_BLOCK lpECB TSRMLS_DC) { SG(request_info).request_method = lpECB->lpszMethod; SG(request_info).query_string = lpECB->lpszQueryString; @@ -718,18 +716,16 @@ DWORD WINAPI HttpExtensionProc(LPEXTENSION_CONTROL_BLOCK lpECB) { zend_file_handle file_handle; zend_bool stack_overflown=0; - TSRMLS_FETCH(); - TSRMLS_FETCH(); - TSRMLS_FETCH(); #ifdef PHP_ENABLE_SEH LPEXCEPTION_POINTERS e; #endif + TSRMLS_FETCH(); zend_try { #ifdef PHP_ENABLE_SEH __try { #endif - init_request_info(sapi_globals, lpECB); + init_request_info(lpECB TSRMLS_CC); SG(server_context) = lpECB; #ifdef WITH_ZEUS @@ -750,7 +746,7 @@ DWORD WINAPI HttpExtensionProc(LPEXTENSION_CONTROL_BLOCK lpECB) } } #else - file_handle.filename = sapi_globals->request_info.path_translated; + file_handle.filename = SG(request_info.path_translated); file_handle.free_filename = 0; #endif file_handle.type = ZEND_HANDLE_FILENAME; diff --git a/sapi/pi3web/pi3web_sapi.c b/sapi/pi3web/pi3web_sapi.c index 120cf91c72..25f6b3f079 100644 --- a/sapi/pi3web/pi3web_sapi.c +++ b/sapi/pi3web/pi3web_sapi.c @@ -403,7 +403,7 @@ DWORD PHP4_wrapper(LPCONTROL_BLOCK lpCB) if ( open_file_for_scanning( &file_handle TSRMLS_CC ) == SUCCESS ) { php_get_highlight_struct( &syntax_highlighter_ini ); - zend_highlight( &syntax_highlighter_ini ); + zend_highlight( &syntax_highlighter_ini TSRMLS_CC ); } else { diff --git a/sapi/servlet/servlet.c b/sapi/servlet/servlet.c index fccdf017d0..d0c29fb23c 100644 --- a/sapi/servlet/servlet.c +++ b/sapi/servlet/servlet.c @@ -381,7 +381,7 @@ JNIEXPORT void JNICALL Java_net_php_servlet_send if (open_file_for_scanning(&file_handle TSRMLS_CC)==SUCCESS) { php_get_highlight_struct(&syntax_highlighter_ini); sapi_send_headers(); - zend_highlight(&syntax_highlighter_ini); + zend_highlight(&syntax_highlighter_ini TSRMLS_CC); } } else { php_execute_script(&file_handle TSRMLS_CC); -- cgit v1.2.1