ZTS fixes.

This commit is contained in:
Sebastian Bergmann 2005-08-12 14:08:28 +00:00
parent 3aad9e2048
commit 52b001cc05
19 changed files with 31 additions and 31 deletions

View file

@ -588,12 +588,12 @@ void zend_register_default_exception(TSRMLS_D)
zend_declare_property_long(error_exception_ce, "severity", sizeof("severity")-1, E_ERROR, ZEND_ACC_PROTECTED TSRMLS_CC); zend_declare_property_long(error_exception_ce, "severity", sizeof("severity")-1, E_ERROR, ZEND_ACC_PROTECTED TSRMLS_CC);
} }
ZEND_API zend_class_entry *zend_exception_get_default(void) ZEND_API zend_class_entry *zend_exception_get_default(TSRMLS_D)
{ {
return U_CLASS_ENTRY(default_exception_ce); return U_CLASS_ENTRY(default_exception_ce);
} }
ZEND_API zend_class_entry *zend_get_error_exception(void) ZEND_API zend_class_entry *zend_get_error_exception(TSRMLS_D)
{ {
return U_CLASS_ENTRY(error_exception_ce); return U_CLASS_ENTRY(error_exception_ce);
} }

View file

@ -30,8 +30,8 @@ void zend_throw_exception_internal(zval *exception TSRMLS_DC);
void zend_register_default_exception(TSRMLS_D); void zend_register_default_exception(TSRMLS_D);
ZEND_API zend_class_entry *zend_exception_get_default(void); ZEND_API zend_class_entry *zend_exception_get_default(TSRMLS_D);
ZEND_API zend_class_entry *zend_get_error_exception(void); ZEND_API zend_class_entry *zend_get_error_exception(TSRMLS_D);
ZEND_API void zend_register_default_classes(TSRMLS_D); ZEND_API void zend_register_default_classes(TSRMLS_D);
/* exception_ce NULL or zend_exception_get_default() or a derived class /* exception_ce NULL or zend_exception_get_default() or a derived class

View file

@ -4035,7 +4035,7 @@ ZEND_API void zend_register_reflection_api(TSRMLS_D) {
reflection_object_handlers.write_property = _reflection_write_property; reflection_object_handlers.write_property = _reflection_write_property;
INIT_CLASS_ENTRY(_reflection_entry, "ReflectionException", reflection_exception_functions); INIT_CLASS_ENTRY(_reflection_entry, "ReflectionException", reflection_exception_functions);
reflection_exception_ptr = zend_register_internal_class_ex(&_reflection_entry, zend_exception_get_default(), NULL TSRMLS_CC); reflection_exception_ptr = zend_register_internal_class_ex(&_reflection_entry, zend_exception_get_default(TSRMLS_C), NULL TSRMLS_CC);
INIT_CLASS_ENTRY(_reflection_entry, "Reflection", reflection_functions); INIT_CLASS_ENTRY(_reflection_entry, "Reflection", reflection_functions);
reflection_ptr = zend_register_internal_class(&_reflection_entry TSRMLS_CC); reflection_ptr = zend_register_internal_class(&_reflection_entry TSRMLS_CC);

View file

@ -192,7 +192,7 @@ PHP_MINIT_FUNCTION(com_dotnet)
php_com_persist_minit(INIT_FUNC_ARGS_PASSTHRU); php_com_persist_minit(INIT_FUNC_ARGS_PASSTHRU);
INIT_CLASS_ENTRY(ce, "com_exception", NULL); INIT_CLASS_ENTRY(ce, "com_exception", NULL);
php_com_exception_class_entry = zend_register_internal_class_ex(&ce, zend_exception_get_default(), NULL TSRMLS_CC); php_com_exception_class_entry = zend_register_internal_class_ex(&ce, zend_exception_get_default(TSRMLS_C), NULL TSRMLS_CC);
php_com_exception_class_entry->ce_flags |= ZEND_ACC_FINAL; php_com_exception_class_entry->ce_flags |= ZEND_ACC_FINAL;
/* php_com_exception_class_entry->constructor->common.fn_flags |= ZEND_ACC_PROTECTED; */ /* php_com_exception_class_entry->constructor->common.fn_flags |= ZEND_ACC_PROTECTED; */

View file

@ -485,7 +485,7 @@ PHP_MINIT_FUNCTION(dom)
zend_hash_init(&classes, 0, NULL, NULL, 1); zend_hash_init(&classes, 0, NULL, NULL, 1);
INIT_CLASS_ENTRY(ce, "DOMException", php_dom_domexception_class_functions); INIT_CLASS_ENTRY(ce, "DOMException", php_dom_domexception_class_functions);
dom_domexception_class_entry = zend_register_internal_class_ex(&ce, zend_exception_get_default(), NULL TSRMLS_CC); dom_domexception_class_entry = zend_register_internal_class_ex(&ce, zend_exception_get_default(TSRMLS_C), NULL TSRMLS_CC);
dom_domexception_class_entry->ce_flags |= ZEND_ACC_FINAL; dom_domexception_class_entry->ce_flags |= ZEND_ACC_FINAL;
zend_declare_property_long(dom_domexception_class_entry, "code", sizeof("code")-1, 0, ZEND_ACC_PUBLIC TSRMLS_CC); zend_declare_property_long(dom_domexception_class_entry, "code", sizeof("code")-1, 0, ZEND_ACC_PUBLIC TSRMLS_CC);

View file

@ -2032,7 +2032,7 @@ static void php_mysql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type,
* single value is an array. Also we'd have to make that one * single value is an array. Also we'd have to make that one
* argument passed by reference. * argument passed by reference.
*/ */
zend_throw_exception(zend_exception_get_default(), "Parameter ctor_params must be an array", 0 TSRMLS_CC); zend_throw_exception(zend_exception_get_default(TSRMLS_C), "Parameter ctor_params must be an array", 0 TSRMLS_CC);
return; return;
} }
} else { } else {
@ -2047,7 +2047,7 @@ static void php_mysql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type,
fcc.object_pp = &return_value; fcc.object_pp = &return_value;
if (zend_call_function(&fci, &fcc TSRMLS_CC) == FAILURE) { if (zend_call_function(&fci, &fcc TSRMLS_CC) == FAILURE) {
zend_throw_exception_ex(zend_exception_get_default(), 0 TSRMLS_CC, "Could not execute %v::%v()", ce->name, ce->constructor->common.function_name); zend_throw_exception_ex(zend_exception_get_default(TSRMLS_C), 0 TSRMLS_CC, "Could not execute %v::%v()", ce->name, ce->constructor->common.function_name);
} else { } else {
if (retval_ptr) { if (retval_ptr) {
zval_ptr_dtor(&retval_ptr); zval_ptr_dtor(&retval_ptr);
@ -2057,7 +2057,7 @@ static void php_mysql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type,
efree(fci.params); efree(fci.params);
} }
} else if (ctor_params) { } else if (ctor_params) {
zend_throw_exception_ex(zend_exception_get_default(), 0 TSRMLS_CC, "Class %v does not have a constructor hence you cannot use ctor_params", ce->name); zend_throw_exception_ex(zend_exception_get_default(TSRMLS_C), 0 TSRMLS_CC, "Class %v does not have a constructor hence you cannot use ctor_params", ce->name);
} }
} }
} }

View file

@ -449,7 +449,7 @@ PHP_MINIT_FUNCTION(mysqli)
#ifdef HAVE_SPL #ifdef HAVE_SPL
mysqli_exception_class_entry = zend_register_internal_class_ex(&cex, spl_ce_RuntimeException, NULL TSRMLS_CC); mysqli_exception_class_entry = zend_register_internal_class_ex(&cex, spl_ce_RuntimeException, NULL TSRMLS_CC);
#else #else
mysqli_exception_class_entry = zend_register_internal_class_ex(&cex, zend_exception_get_default(), NULL TSRMLS_CC); mysqli_exception_class_entry = zend_register_internal_class_ex(&cex, zend_exception_get_default(TSRMLS_C), NULL TSRMLS_CC);
#endif #endif
mysqli_exception_class_entry->ce_flags |= ZEND_ACC_FINAL; mysqli_exception_class_entry->ce_flags |= ZEND_ACC_FINAL;
zend_declare_property_long(mysqli_exception_class_entry, "code", sizeof("code")-1, 0, ZEND_ACC_PROTECTED TSRMLS_CC); zend_declare_property_long(mysqli_exception_class_entry, "code", sizeof("code")-1, 0, ZEND_ACC_PROTECTED TSRMLS_CC);
@ -876,7 +876,7 @@ void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int override_flags
* single value is an array. Also we'd have to make that one * single value is an array. Also we'd have to make that one
* argument passed by reference. * argument passed by reference.
*/ */
zend_throw_exception(zend_exception_get_default(), "Parameter ctor_params must be an array", 0 TSRMLS_CC); zend_throw_exception(zend_exception_get_default(TSRMLS_C), "Parameter ctor_params must be an array", 0 TSRMLS_CC);
return; return;
} }
} else { } else {
@ -891,7 +891,7 @@ void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int override_flags
fcc.object_pp = &return_value; fcc.object_pp = &return_value;
if (zend_call_function(&fci, &fcc TSRMLS_CC) == FAILURE) { if (zend_call_function(&fci, &fcc TSRMLS_CC) == FAILURE) {
zend_throw_exception_ex(zend_exception_get_default(), 0 TSRMLS_CC, "Could not execute %s::%s()", ce->name, ce->constructor->common.function_name); zend_throw_exception_ex(zend_exception_get_default(TSRMLS_C), 0 TSRMLS_CC, "Could not execute %s::%s()", ce->name, ce->constructor->common.function_name);
} else { } else {
if (retval_ptr) { if (retval_ptr) {
zval_ptr_dtor(&retval_ptr); zval_ptr_dtor(&retval_ptr);
@ -901,7 +901,7 @@ void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int override_flags
efree(fci.params); efree(fci.params);
} }
} else if (ctor_params) { } else if (ctor_params) {
zend_throw_exception_ex(zend_exception_get_default(), 0 TSRMLS_CC, "Class %s does not have a constructor hence you cannot use ctor_params", ce->name); zend_throw_exception_ex(zend_exception_get_default(TSRMLS_C), 0 TSRMLS_CC, "Class %s does not have a constructor hence you cannot use ctor_params", ce->name);
} }
} }
} }

View file

@ -79,7 +79,7 @@ static int driver_report_write(mysqli_object *obj, zval *value TSRMLS_DC)
{ {
MyG(report_mode) = Z_LVAL_P(value); MyG(report_mode) = Z_LVAL_P(value);
php_set_error_handling(MyG(report_mode) & MYSQLI_REPORT_STRICT ? EH_THROW : EH_NORMAL, php_set_error_handling(MyG(report_mode) & MYSQLI_REPORT_STRICT ? EH_THROW : EH_NORMAL,
zend_exception_get_default() TSRMLS_CC); zend_exception_get_default(TSRMLS_C) TSRMLS_CC);
return SUCCESS; return SUCCESS;
} }
/* }}} */ /* }}} */

View file

@ -2009,7 +2009,7 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, long result_type,
* single value is an array. Also we'd have to make that one * single value is an array. Also we'd have to make that one
* argument passed by reference. * argument passed by reference.
*/ */
zend_throw_exception(zend_exception_get_default(), "Parameter ctor_params must be an array", 0 TSRMLS_CC); zend_throw_exception(zend_exception_get_default(TSRMLS_C), "Parameter ctor_params must be an array", 0 TSRMLS_CC);
return; return;
} }
} else { } else {
@ -2024,7 +2024,7 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, long result_type,
fcc.object_pp = &return_value; fcc.object_pp = &return_value;
if (zend_call_function(&fci, &fcc TSRMLS_CC) == FAILURE) { if (zend_call_function(&fci, &fcc TSRMLS_CC) == FAILURE) {
zend_throw_exception_ex(zend_exception_get_default(), 0 TSRMLS_CC, "Could not execute %s::%s()", ce->name, ce->constructor->common.function_name); zend_throw_exception_ex(zend_exception_get_default(TSRMLS_C), 0 TSRMLS_CC, "Could not execute %s::%s()", ce->name, ce->constructor->common.function_name);
} else { } else {
if (retval_ptr) { if (retval_ptr) {
zval_ptr_dtor(&retval_ptr); zval_ptr_dtor(&retval_ptr);
@ -2034,7 +2034,7 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, long result_type,
efree(fci.params); efree(fci.params);
} }
} else if (ctor_params) { } else if (ctor_params) {
zend_throw_exception_ex(zend_exception_get_default(), 0 TSRMLS_CC, "Class %s does not have a constructor hence you cannot use ctor_params", ce->name); zend_throw_exception_ex(zend_exception_get_default(TSRMLS_C), 0 TSRMLS_CC, "Class %s does not have a constructor hence you cannot use ctor_params", ce->name);
} }
} }
} }

View file

@ -4035,7 +4035,7 @@ ZEND_API void zend_register_reflection_api(TSRMLS_D) {
reflection_object_handlers.write_property = _reflection_write_property; reflection_object_handlers.write_property = _reflection_write_property;
INIT_CLASS_ENTRY(_reflection_entry, "ReflectionException", reflection_exception_functions); INIT_CLASS_ENTRY(_reflection_entry, "ReflectionException", reflection_exception_functions);
reflection_exception_ptr = zend_register_internal_class_ex(&_reflection_entry, zend_exception_get_default(), NULL TSRMLS_CC); reflection_exception_ptr = zend_register_internal_class_ex(&_reflection_entry, zend_exception_get_default(TSRMLS_C), NULL TSRMLS_CC);
INIT_CLASS_ENTRY(_reflection_entry, "Reflection", reflection_functions); INIT_CLASS_ENTRY(_reflection_entry, "Reflection", reflection_functions);
reflection_ptr = zend_register_internal_class(&_reflection_entry TSRMLS_CC); reflection_ptr = zend_register_internal_class(&_reflection_entry TSRMLS_CC);

View file

@ -79,7 +79,7 @@ typedef struct {
#define SIMPLEXML_G(v) (simplexml_globals.v) #define SIMPLEXML_G(v) (simplexml_globals.v)
#endif #endif
ZEND_API zend_class_entry *sxe_get_element_class_entry(); ZEND_API zend_class_entry *sxe_get_element_class_entry(TSRMLS_D);
#endif #endif

View file

@ -40,7 +40,7 @@
zend_class_entry *sxe_class_entry = NULL; zend_class_entry *sxe_class_entry = NULL;
ZEND_API zend_class_entry *sxe_get_element_class_entry() ZEND_API zend_class_entry *sxe_get_element_class_entry(TSRMLS_D)
{ {
return U_CLASS_ENTRY(sxe_class_entry); return U_CLASS_ENTRY(sxe_class_entry);
} }
@ -1357,7 +1357,7 @@ SXE_METHOD(__construct)
int data_len; int data_len;
xmlDocPtr docp; xmlDocPtr docp;
php_set_error_handling(EH_THROW, zend_exception_get_default() TSRMLS_CC); php_set_error_handling(EH_THROW, zend_exception_get_default(TSRMLS_C) TSRMLS_CC);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &data, &data_len) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &data, &data_len) == FAILURE) {
php_std_error_handling(); php_std_error_handling();
return; return;
@ -1367,7 +1367,7 @@ SXE_METHOD(__construct)
docp = xmlParseMemory(data, data_len); docp = xmlParseMemory(data, data_len);
if (!docp) { if (!docp) {
((php_libxml_node_object *)sxe)->document = NULL; ((php_libxml_node_object *)sxe)->document = NULL;
zend_throw_exception(zend_exception_get_default(), "String could not be parsed as XML", 0 TSRMLS_CC); zend_throw_exception(zend_exception_get_default(TSRMLS_C), "String could not be parsed as XML", 0 TSRMLS_CC);
return; return;
} }

View file

@ -525,7 +525,7 @@ PHP_MINIT_FUNCTION(soap)
/* Register SoapFault class */ /* Register SoapFault class */
INIT_CLASS_ENTRY(ce, PHP_SOAP_FAULT_CLASSNAME, soap_fault_functions); INIT_CLASS_ENTRY(ce, PHP_SOAP_FAULT_CLASSNAME, soap_fault_functions);
#ifdef ZEND_ENGINE_2 #ifdef ZEND_ENGINE_2
soap_fault_class_entry = zend_register_internal_class_ex(&ce, zend_exception_get_default(), NULL TSRMLS_CC); soap_fault_class_entry = zend_register_internal_class_ex(&ce, zend_exception_get_default(TSRMLS_C), NULL TSRMLS_CC);
#else #else
soap_fault_class_entry = zend_register_internal_class(&ce TSRMLS_CC); soap_fault_class_entry = zend_register_internal_class(&ce TSRMLS_CC);
#endif #endif

View file

@ -47,7 +47,7 @@ PHPAPI zend_class_entry *spl_ce_RangeException;
PHPAPI zend_class_entry *spl_ce_UnderflowException; PHPAPI zend_class_entry *spl_ce_UnderflowException;
PHPAPI zend_class_entry *spl_ce_UnexpectedValueException; PHPAPI zend_class_entry *spl_ce_UnexpectedValueException;
#define spl_ce_Exception zend_exception_get_default() #define spl_ce_Exception zend_exception_get_default(TSRMLS_C)
/* {{{ PHP_MINIT_FUNCTION(spl_exceptions) */ /* {{{ PHP_MINIT_FUNCTION(spl_exceptions) */
PHP_MINIT_FUNCTION(spl_exceptions) PHP_MINIT_FUNCTION(spl_exceptions)

View file

@ -790,7 +790,7 @@ static INLINE spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAME
break; break;
} }
php_set_error_handling(EH_THROW, zend_exception_get_default() TSRMLS_CC); php_set_error_handling(EH_THROW, zend_exception_get_default(TSRMLS_C) TSRMLS_CC);
zobject->refcount++; zobject->refcount++;
intern->inner.zobject = zobject; intern->inner.zobject = zobject;

View file

@ -146,7 +146,7 @@ static zend_function_entry spl_funcs_SimpleXMLIterator[] = {
SPL_API PHP_MINIT_FUNCTION(spl_sxe) /* {{{ */ SPL_API PHP_MINIT_FUNCTION(spl_sxe) /* {{{ */
{ {
zend_class_entry *spl_ce_SimpleXML_Element = sxe_get_element_class_entry(); zend_class_entry *spl_ce_SimpleXML_Element = sxe_get_element_class_entry(TSRMLS_C);
if (!spl_ce_SimpleXML_Element) { if (!spl_ce_SimpleXML_Element) {
return SUCCESS; /* SimpleXML must be initialized before */ return SUCCESS; /* SimpleXML must be initialized before */

View file

@ -288,7 +288,7 @@ int _pdo_sqlite2_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, char *errmsg, const cha
} }
if (!dbh->methods) { if (!dbh->methods) {
zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "SQLSTATE[%s] [%d] %s", zend_throw_exception_ex(php_pdo_get_exception(TSRMLS_C), 0 TSRMLS_CC, "SQLSTATE[%s] [%d] %s",
*pdo_err, einfo->errcode, einfo->errmsg); *pdo_err, einfo->errcode, einfo->errmsg);
} }
@ -576,7 +576,7 @@ static int pdo_sqlite2_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRML
filename = make_filename_safe(dbh->data_source TSRMLS_CC); filename = make_filename_safe(dbh->data_source TSRMLS_CC);
if (!filename) { if (!filename) {
zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, zend_throw_exception_ex(php_pdo_get_exception(TSRMLS_C), 0 TSRMLS_CC,
"safe_mode/open_basedir prohibits opening %s", "safe_mode/open_basedir prohibits opening %s",
dbh->data_source); dbh->data_source);
goto cleanup; goto cleanup;

View file

@ -1028,7 +1028,7 @@ PHP_MINIT_FUNCTION(sqlite)
#if defined(HAVE_SPL) && ((PHP_MAJOR_VERSION > 5) || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 1)) #if defined(HAVE_SPL) && ((PHP_MAJOR_VERSION > 5) || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 1))
REGISTER_SQLITE_CLASS(Exception, exception, spl_ce_RuntimeException); REGISTER_SQLITE_CLASS(Exception, exception, spl_ce_RuntimeException);
#else #else
REGISTER_SQLITE_CLASS(Exception, exception, zend_exception_get_default()); REGISTER_SQLITE_CLASS(Exception, exception, zend_exception_get_default(TSRMLS_C));
#endif #endif
sqlite_ce_db->ce_flags &= ~ZEND_ACC_FINAL_CLASS; sqlite_ce_db->ce_flags &= ~ZEND_ACC_FINAL_CLASS;

View file

@ -932,7 +932,7 @@ PHP_MINIT_FUNCTION(tidy)
REGISTER_TIDY_CLASS(tidy, doc, NULL, 0); REGISTER_TIDY_CLASS(tidy, doc, NULL, 0);
REGISTER_TIDY_CLASS(tidyNode, node, NULL, ZEND_ACC_FINAL_CLASS); REGISTER_TIDY_CLASS(tidyNode, node, NULL, ZEND_ACC_FINAL_CLASS);
/* no exceptions for now.. /* no exceptions for now..
REGISTER_TIDY_CLASS(tidyException, exception, zend_exception_get_default()); REGISTER_TIDY_CLASS(tidyException, exception, zend_exception_get_default(TSRMLS_C));
*/ */
tidy_object_handlers_doc.get_class_entry = tidy_get_ce_doc; tidy_object_handlers_doc.get_class_entry = tidy_get_ce_doc;
tidy_object_handlers_node.get_class_entry = tidy_get_ce_node; tidy_object_handlers_node.get_class_entry = tidy_get_ce_node;