mirror of
https://github.com/php/php-src.git
synced 2024-09-22 02:17:32 +00:00
Remove HAVE_SPL checks
SPL is always built. Also clean up spl_ce_RuntimeException handling in PDO.
This commit is contained in:
parent
5c327d7f5c
commit
2eb4728611
@ -34,6 +34,7 @@
|
||||
#include "php_mysqli_structs.h"
|
||||
#include "mysqli_priv.h"
|
||||
#include "zend_exceptions.h"
|
||||
#include "ext/spl/spl_exceptions.h"
|
||||
#include "zend_interfaces.h"
|
||||
|
||||
ZEND_DECLARE_MODULE_GLOBALS(mysqli)
|
||||
@ -603,11 +604,7 @@ PHP_MINIT_FUNCTION(mysqli)
|
||||
"MySqli persistent connection", module_number);
|
||||
|
||||
INIT_CLASS_ENTRY(cex, "mysqli_sql_exception", mysqli_exception_methods);
|
||||
#ifdef HAVE_SPL
|
||||
mysqli_exception_class_entry = zend_register_internal_class_ex(&cex, spl_ce_RuntimeException);
|
||||
#else
|
||||
mysqli_exception_class_entry = zend_register_internal_class_ex(&cex, zend_ce_exception);
|
||||
#endif
|
||||
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);
|
||||
zend_declare_property_string(mysqli_exception_class_entry, "sqlstate", sizeof("sqlstate")-1, "00000", ZEND_ACC_PROTECTED);
|
||||
@ -999,9 +996,7 @@ PHP_MINFO_FUNCTION(mysqli)
|
||||
|
||||
/* Dependancies */
|
||||
static const zend_module_dep mysqli_deps[] = {
|
||||
#if defined(HAVE_SPL) && (PHP_VERSION_ID >= 50100)
|
||||
ZEND_MOD_REQUIRED("spl")
|
||||
#endif
|
||||
#if defined(MYSQLI_USE_MYSQLND)
|
||||
ZEND_MOD_REQUIRED("mysqlnd")
|
||||
#endif
|
||||
|
@ -78,10 +78,6 @@ extern void php_mysqli_report_error(const char *sqlstate, int errorno, const cha
|
||||
extern void php_mysqli_report_index(const char *query, unsigned int status);
|
||||
extern void php_mysqli_throw_sql_exception(char *sqlstate, int errorno, char *format, ...);
|
||||
|
||||
#ifdef HAVE_SPL
|
||||
extern PHPAPI zend_class_entry *spl_ce_RuntimeException;
|
||||
#endif
|
||||
|
||||
#define PHP_MYSQLI_EXPORT(__type) PHP_MYSQLI_API __type
|
||||
|
||||
PHP_MYSQLI_EXPORT(zend_object *) mysqli_objects_new(zend_class_entry *);
|
||||
|
@ -216,10 +216,6 @@ extern zend_object_iterator *php_mysqli_result_get_iterator(zend_class_entry *ce
|
||||
|
||||
extern void php_mysqli_fetch_into_hash_aux(zval *return_value, MYSQL_RES * result, zend_long fetchtype);
|
||||
|
||||
#ifdef HAVE_SPL
|
||||
extern PHPAPI zend_class_entry *spl_ce_RuntimeException;
|
||||
#endif
|
||||
|
||||
#define MYSQLI_DISABLE_MQ if (mysql->multi_query) { \
|
||||
mysql_set_server_option(mysql->mysql, MYSQL_OPTION_MULTI_STATEMENTS_OFF); \
|
||||
mysql->multi_query = 0; \
|
||||
|
@ -32,8 +32,7 @@
|
||||
#include "php_pdo_driver.h"
|
||||
#include "php_pdo_int.h"
|
||||
#include "zend_exceptions.h"
|
||||
|
||||
static zend_class_entry *spl_ce_RuntimeException;
|
||||
#include "ext/spl/spl_exceptions.h"
|
||||
|
||||
zend_class_entry *pdo_dbh_ce, *pdo_dbstmt_ce, *pdo_row_ce;
|
||||
|
||||
@ -79,20 +78,9 @@ PDO_API char *php_pdo_str_tolower_dup(const char *src, int len) /* {{{ */
|
||||
|
||||
PDO_API zend_class_entry *php_pdo_get_exception_base(int root) /* {{{ */
|
||||
{
|
||||
#if defined(HAVE_SPL)
|
||||
if (!root) {
|
||||
if (!spl_ce_RuntimeException) {
|
||||
zend_class_entry *pce;
|
||||
|
||||
if ((pce = zend_hash_str_find_ptr(CG(class_table), "runtimeexception", sizeof("RuntimeException") - 1))) {
|
||||
spl_ce_RuntimeException = pce;
|
||||
return pce;
|
||||
}
|
||||
} else {
|
||||
return spl_ce_RuntimeException;
|
||||
}
|
||||
return spl_ce_RuntimeException;
|
||||
}
|
||||
#endif
|
||||
return zend_ce_exception;
|
||||
}
|
||||
/* }}} */
|
||||
@ -130,9 +118,7 @@ const zend_function_entry pdo_functions[] = {
|
||||
/* {{{ pdo_functions[] */
|
||||
#if ZEND_MODULE_API_NO >= 20050922
|
||||
static const zend_module_dep pdo_deps[] = {
|
||||
#ifdef HAVE_SPL
|
||||
ZEND_MOD_REQUIRED("spl")
|
||||
#endif
|
||||
ZEND_MOD_END
|
||||
};
|
||||
#endif
|
||||
@ -351,8 +337,6 @@ PHP_MINIT_FUNCTION(pdo)
|
||||
{
|
||||
zend_class_entry ce;
|
||||
|
||||
spl_ce_RuntimeException = NULL;
|
||||
|
||||
if (FAILURE == pdo_sqlstate_init_error_table()) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
@ -3581,9 +3581,7 @@ static const zend_module_dep phar_deps[] = {
|
||||
#if defined(HAVE_HASH) && !defined(COMPILE_DL_HASH)
|
||||
ZEND_MOD_REQUIRED("hash")
|
||||
#endif
|
||||
#if HAVE_SPL
|
||||
ZEND_MOD_REQUIRED("spl")
|
||||
#endif
|
||||
ZEND_MOD_END
|
||||
};
|
||||
|
||||
|
@ -55,13 +55,11 @@
|
||||
#include "TSRM/tsrm_strtok_r.h"
|
||||
#endif
|
||||
#include "Zend/zend_virtual_cwd.h"
|
||||
#if HAVE_SPL
|
||||
#include "ext/spl/spl_array.h"
|
||||
#include "ext/spl/spl_directory.h"
|
||||
#include "ext/spl/spl_engine.h"
|
||||
#include "ext/spl/spl_exceptions.h"
|
||||
#include "ext/spl/spl_iterators.h"
|
||||
#endif
|
||||
#include "php_phar.h"
|
||||
#ifdef PHAR_HASH_OK
|
||||
#include "ext/hash/php_hash.h"
|
||||
@ -210,10 +208,8 @@ ZEND_TSRMLS_CACHE_EXTERN();
|
||||
#endif
|
||||
#include "pharzip.h"
|
||||
|
||||
#if HAVE_SPL
|
||||
typedef union _phar_archive_object phar_archive_object;
|
||||
typedef union _phar_entry_object phar_entry_object;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* used in phar_entry_info->fp_type to
|
||||
@ -473,21 +469,17 @@ typedef struct _phar_entry_data {
|
||||
phar_entry_info *internal_file;
|
||||
} phar_entry_data;
|
||||
|
||||
#if HAVE_SPL
|
||||
/* archive php object */
|
||||
union _phar_archive_object {
|
||||
spl_filesystem_object spl;
|
||||
phar_archive_data *archive;
|
||||
};
|
||||
#endif
|
||||
|
||||
#if HAVE_SPL
|
||||
/* entry php object */
|
||||
union _phar_entry_object {
|
||||
spl_filesystem_object spl;
|
||||
phar_entry_info *entry;
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifndef PHAR_MAIN
|
||||
extern zend_string *(*phar_save_resolve_path)(const char *filename, int filename_len);
|
||||
|
@ -25,10 +25,7 @@
|
||||
static zend_class_entry *phar_ce_archive;
|
||||
static zend_class_entry *phar_ce_data;
|
||||
static zend_class_entry *phar_ce_PharException;
|
||||
|
||||
#if HAVE_SPL
|
||||
static zend_class_entry *phar_ce_entry;
|
||||
#endif
|
||||
|
||||
#if PHP_VERSION_ID >= 50300
|
||||
# define PHAR_ARG_INFO
|
||||
@ -1071,7 +1068,6 @@ PHP_METHOD(Phar, isValidPharFilename)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#if HAVE_SPL
|
||||
/**
|
||||
* from spl_directory
|
||||
*/
|
||||
@ -1104,7 +1100,6 @@ static spl_other_handler phar_spl_foreign_handler = {
|
||||
phar_spl_foreign_dtor,
|
||||
phar_spl_foreign_clone
|
||||
};
|
||||
#endif /* HAVE_SPL */
|
||||
|
||||
/* {{{ proto void Phar::__construct(string fname [, int flags [, string alias]])
|
||||
* Construct a Phar archive object
|
||||
@ -1117,9 +1112,6 @@ static spl_other_handler phar_spl_foreign_handler = {
|
||||
*/
|
||||
PHP_METHOD(Phar, __construct)
|
||||
{
|
||||
#if !HAVE_SPL
|
||||
zend_throw_exception_ex(zend_ce_exception, 0, "Cannot instantiate Phar object without SPL extension");
|
||||
#else
|
||||
char *fname, *alias = NULL, *error, *arch = NULL, *entry = NULL, *save_fname;
|
||||
size_t fname_len, alias_len = 0;
|
||||
int arch_len, entry_len, is_data;
|
||||
@ -1244,7 +1236,6 @@ PHP_METHOD(Phar, __construct)
|
||||
|
||||
phar_obj->spl.info_class = phar_ce_entry;
|
||||
efree(fname);
|
||||
#endif /* HAVE_SPL */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@ -1363,8 +1354,6 @@ PHP_METHOD(Phar, unlinkArchive)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#if HAVE_SPL
|
||||
|
||||
#define PHAR_ARCHIVE_OBJECT() \
|
||||
zval *zobj = getThis(); \
|
||||
phar_archive_object *phar_obj = (phar_archive_object*)((char*)Z_OBJ_P(zobj) - Z_OBJ_P(zobj)->handlers->offset); \
|
||||
@ -5043,8 +5032,6 @@ PHP_METHOD(PharFileInfo, decompress)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#endif /* HAVE_SPL */
|
||||
|
||||
/* {{{ phar methods */
|
||||
PHAR_ARG_INFO
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_phar___construct, 0, 0, 1)
|
||||
@ -5113,7 +5100,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_ua, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, archive)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
#if HAVE_SPL
|
||||
PHAR_ARG_INFO
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_build, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, iterator)
|
||||
@ -5232,12 +5218,7 @@ ZEND_BEGIN_ARG_INFO(arginfo_phar__void, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
|
||||
#endif /* HAVE_SPL */
|
||||
|
||||
zend_function_entry php_archive_methods[] = {
|
||||
#if !HAVE_SPL
|
||||
PHP_ME(Phar, __construct, arginfo_phar___construct, ZEND_ACC_PRIVATE)
|
||||
#else
|
||||
PHP_ME(Phar, __construct, arginfo_phar___construct, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(Phar, __destruct, arginfo_phar__void, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(Phar, addEmptyDir, arginfo_phar_emptydir, ZEND_ACC_PUBLIC)
|
||||
@ -5279,7 +5260,6 @@ zend_function_entry php_archive_methods[] = {
|
||||
PHP_ME(Phar, setStub, arginfo_phar_setStub, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(Phar, startBuffering, arginfo_phar__void, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(Phar, stopBuffering, arginfo_phar__void, ZEND_ACC_PUBLIC)
|
||||
#endif
|
||||
/* static member functions */
|
||||
PHP_ME(Phar, apiVersion, arginfo_phar__void, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
|
||||
PHP_ME(Phar, canCompress, arginfo_phar_cancompress, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
|
||||
@ -5299,7 +5279,6 @@ zend_function_entry php_archive_methods[] = {
|
||||
PHP_FE_END
|
||||
};
|
||||
|
||||
#if HAVE_SPL
|
||||
PHAR_ARG_INFO
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_entry___construct, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, filename)
|
||||
@ -5328,7 +5307,6 @@ zend_function_entry php_entry_methods[] = {
|
||||
PHP_ME(PharFileInfo, setMetadata, arginfo_phar_setMetadata, ZEND_ACC_PUBLIC)
|
||||
PHP_FE_END
|
||||
};
|
||||
#endif /* HAVE_SPL */
|
||||
|
||||
zend_function_entry phar_exception_methods[] = {
|
||||
PHP_FE_END
|
||||
@ -5345,7 +5323,6 @@ void phar_object_init(void) /* {{{ */
|
||||
INIT_CLASS_ENTRY(ce, "PharException", phar_exception_methods);
|
||||
phar_ce_PharException = zend_register_internal_class_ex(&ce, zend_ce_exception);
|
||||
|
||||
#if HAVE_SPL
|
||||
INIT_CLASS_ENTRY(ce, "Phar", php_archive_methods);
|
||||
phar_ce_archive = zend_register_internal_class_ex(&ce, spl_ce_RecursiveDirectoryIterator);
|
||||
|
||||
@ -5358,15 +5335,6 @@ void phar_object_init(void) /* {{{ */
|
||||
|
||||
INIT_CLASS_ENTRY(ce, "PharFileInfo", php_entry_methods);
|
||||
phar_ce_entry = zend_register_internal_class_ex(&ce, spl_ce_SplFileInfo);
|
||||
#else
|
||||
INIT_CLASS_ENTRY(ce, "Phar", php_archive_methods);
|
||||
phar_ce_archive = zend_register_internal_class(&ce);
|
||||
phar_ce_archive->ce_flags |= ZEND_ACC_FINAL;
|
||||
|
||||
INIT_CLASS_ENTRY(ce, "PharData", php_archive_methods);
|
||||
phar_ce_data = zend_register_internal_class(&ce);
|
||||
phar_ce_data->ce_flags |= ZEND_ACC_FINAL;
|
||||
#endif
|
||||
|
||||
REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "BZ2", PHAR_ENT_COMPRESSED_BZ2)
|
||||
REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "GZ", PHAR_ENT_COMPRESSED_GZ)
|
||||
|
@ -45,9 +45,6 @@ extern zend_module_entry simplexml_module_entry;
|
||||
|
||||
PHP_MINIT_FUNCTION(simplexml);
|
||||
PHP_MSHUTDOWN_FUNCTION(simplexml);
|
||||
#ifdef HAVE_SPL
|
||||
PHP_RINIT_FUNCTION(simplexml);
|
||||
#endif
|
||||
PHP_MINFO_FUNCTION(simplexml);
|
||||
|
||||
typedef enum {
|
||||
|
@ -33,10 +33,7 @@
|
||||
#include "php_snmp.h"
|
||||
|
||||
#include "zend_exceptions.h"
|
||||
|
||||
#if HAVE_SPL
|
||||
#include "ext/spl/spl_exceptions.h"
|
||||
#endif
|
||||
|
||||
#if HAVE_SNMP
|
||||
|
||||
@ -2414,11 +2411,7 @@ PHP_MINIT_FUNCTION(snmp)
|
||||
|
||||
/* Register SNMPException class */
|
||||
INIT_CLASS_ENTRY(cex, "SNMPException", NULL);
|
||||
#ifdef HAVE_SPL
|
||||
php_snmp_exception_ce = zend_register_internal_class_ex(&cex, spl_ce_RuntimeException);
|
||||
#else
|
||||
php_snmp_exception_ce = zend_register_internal_class_ex(&cex, zend_ce_exception);
|
||||
#endif
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
@ -2452,9 +2445,7 @@ PHP_MINFO_FUNCTION(snmp)
|
||||
*/
|
||||
#if ZEND_MODULE_API_NO >= 20050922
|
||||
static const zend_module_dep snmp_module_deps[] = {
|
||||
#ifdef HAVE_SPL
|
||||
ZEND_MOD_REQUIRED("spl")
|
||||
#endif
|
||||
ZEND_MOD_END
|
||||
};
|
||||
#endif
|
||||
|
@ -46,9 +46,7 @@
|
||||
#include "php_string.h"
|
||||
#include "php_rand.h"
|
||||
#include "zend_smart_str.h"
|
||||
#ifdef HAVE_SPL
|
||||
#include "ext/spl/spl_array.h"
|
||||
#endif
|
||||
|
||||
/* {{{ defines */
|
||||
#define EXTR_OVERWRITE 0
|
||||
@ -821,9 +819,7 @@ PHP_FUNCTION(count)
|
||||
RETURN_LONG(cnt);
|
||||
break;
|
||||
case IS_OBJECT: {
|
||||
#ifdef HAVE_SPL
|
||||
zval retval;
|
||||
#endif
|
||||
/* first, we check if the handler is defined */
|
||||
if (Z_OBJ_HT_P(array)->count_elements) {
|
||||
RETVAL_LONG(1);
|
||||
@ -831,7 +827,6 @@ PHP_FUNCTION(count)
|
||||
return;
|
||||
}
|
||||
}
|
||||
#ifdef HAVE_SPL
|
||||
/* if not and the object implements Countable we call its count() method */
|
||||
if (instanceof_function(Z_OBJCE_P(array), spl_ce_Countable)) {
|
||||
zend_call_method_with_0_params(array, NULL, NULL, "count", &retval);
|
||||
@ -841,7 +836,6 @@ PHP_FUNCTION(count)
|
||||
}
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
default:
|
||||
RETURN_LONG(1);
|
||||
|
Loading…
Reference in New Issue
Block a user