Skip to content

Instantly share code, notes, and snippets.

@KalleZ
Last active March 19, 2019 04:47
Show Gist options
  • Save KalleZ/08feb65ca07e8d9ffd4babd90f628ef2 to your computer and use it in GitHub Desktop.
Save KalleZ/08feb65ca07e8d9ffd4babd90f628ef2 to your computer and use it in GitHub Desktop.
diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c
index 52da36c2cf..0b42683e40 100644
--- a/ext/mbstring/mbstring.c
+++ b/ext/mbstring/mbstring.c
@@ -60,7 +60,7 @@
# include "php_onig_compat.h"
# include <oniguruma.h>
# undef UChar
-#elif HAVE_PCRE || HAVE_BUNDLED_PCRE
+#else
# include "ext/pcre/php_pcre.h"
#endif
@@ -1024,7 +1024,7 @@ static void _php_mb_free_regex(void *opaque)
onig_free((php_mb_regex_t *)opaque);
}
/* }}} */
-#elif HAVE_PCRE || HAVE_BUNDLED_PCRE
+#else
/* {{{ _php_mb_compile_regex */
static void *_php_mb_compile_regex(const char *pattern)
{
diff --git a/ext/pcre/config.w32 b/ext/pcre/config.w32
index 2aef554e0d..3da5daeea5 100644
--- a/ext/pcre/config.w32
+++ b/ext/pcre/config.w32
@@ -5,8 +5,6 @@ EXTENSION("pcre", "php_pcre.c", false /* never shared */,
ADD_SOURCES("ext/pcre/pcre2lib", "pcre2_auto_possess.c pcre2_chartables.c pcre2_compile.c pcre2_config.c pcre2_context.c pcre2_dfa_match.c pcre2_error.c pcre2_jit_compile.c pcre2_maketables.c pcre2_match.c pcre2_match_data.c pcre2_newline.c pcre2_ord2utf.c pcre2_pattern_info.c pcre2_serialize.c pcre2_string_utils.c pcre2_study.c pcre2_substitute.c pcre2_substring.c pcre2_tables.c pcre2_ucd.c pcre2_valid_utf.c pcre2_xclass.c pcre2_find_bracket.c pcre2_convert.c pcre2_extuni.c", "pcre");
ADD_DEF_FILE("ext\\pcre\\php_pcre.def");
-AC_DEFINE('HAVE_BUNDLED_PCRE', 1, 'Using bundled PCRE library');
-AC_DEFINE('HAVE_PCRE', 1, 'Have PCRE library');
AC_DEFINE('PCRE2_CODE_UNIT_WIDTH', 8, 'Have PCRE library');
AC_DEFINE("PCRE2_STATIC", 1, "");
PHP_PCRE="yes";
diff --git a/ext/pcre/config0.m4 b/ext/pcre/config0.m4
index 2ae174b479..5b24f90f1f 100644
--- a/ext/pcre/config0.m4
+++ b/ext/pcre/config0.m4
@@ -22,7 +22,6 @@ if test "$PHP_EXTERNAL_PCRE" != "no"; then
PHP_EVAL_INCLINE($PCRE2_CFLAGS)
PHP_EVAL_LIBLINE($PCRE2_LIBS)
AC_DEFINE(PCRE2_CODE_UNIT_WIDTH, 8, [ ])
- AC_DEFINE(HAVE_PCRE, 1, [ ])
if test "$PHP_PCRE_JIT" != "no"; then
AC_MSG_CHECKING([for JIT support in PCRE2])
@@ -72,7 +71,6 @@ else
PHP_NEW_EXTENSION(pcre, $pcrelib_sources php_pcre.c, no,,$PHP_PCRE_CFLAGS)
PHP_ADD_BUILD_DIR($ext_builddir/pcre2lib)
PHP_INSTALL_HEADERS([ext/pcre], [php_pcre.h pcre2lib/])
- AC_DEFINE(HAVE_BUNDLED_PCRE, 1, [ ])
AC_DEFINE(PCRE2_CODE_UNIT_WIDTH, 8, [ ])
AC_MSG_CHECKING([whether to enable PCRE JIT functionality])
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c
index e1c46842b9..7cbb7d9252 100644
--- a/ext/pcre/php_pcre.c
+++ b/ext/pcre/php_pcre.c
@@ -24,8 +24,6 @@
#include "ext/standard/basic_functions.h"
#include "zend_smart_str.h"
-#if HAVE_PCRE || HAVE_BUNDLED_PCRE
-
#include "ext/standard/php_string.h"
#define PREG_PATTERN_ORDER 1
@@ -3023,11 +3021,6 @@ zend_module_entry pcre_module_entry = {
NULL,
STANDARD_MODULE_PROPERTIES_EX
};
-
-#ifdef COMPILE_DL_PCRE
-ZEND_GET_MODULE(pcre)
-#endif
-
/* }}} */
PHPAPI pcre2_match_context *php_pcre_mctx(void)
@@ -3063,5 +3056,3 @@ PHPAPI pcre2_code *php_pcre_pce_re(pcre_cache_entry *pce)
assert(NULL != pce);
return pce->re;
}/*}}}*/
-
-#endif /* HAVE_PCRE || HAVE_BUNDLED_PCRE */
diff --git a/ext/pcre/php_pcre.h b/ext/pcre/php_pcre.h
index 0377ce77a8..dd5669c4b4 100644
--- a/ext/pcre/php_pcre.h
+++ b/ext/pcre/php_pcre.h
@@ -19,13 +19,7 @@
#ifndef PHP_PCRE_H
#define PHP_PCRE_H
-#if HAVE_PCRE || HAVE_BUNDLED_PCRE
-
-#if HAVE_BUNDLED_PCRE
#include "pcre2lib/pcre2.h"
-#else
-#include "pcre2.h"
-#endif
#if HAVE_LOCALE_H
#include <locale.h>
@@ -79,13 +73,6 @@ ZEND_END_MODULE_GLOBALS(pcre)
PHPAPI ZEND_EXTERN_MODULE_GLOBALS(pcre)
#define PCRE_G(v) ZEND_MODULE_GLOBALS_ACCESSOR(pcre, v)
-
-#else
-
-#define pcre_module_ptr NULL
-
-#endif /* HAVE_PCRE || HAVE_BUNDLED_PCRE */
-
#define phpext_pcre_ptr pcre_module_ptr
#endif /* PHP_PCRE_H */
diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c
index 8af52bb0bd..abe137ffc5 100644
--- a/ext/spl/spl_iterators.c
+++ b/ext/spl/spl_iterators.c
@@ -1480,7 +1480,6 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z
intern->u.append.iterator = spl_ce_ArrayIterator->get_iterator(spl_ce_ArrayIterator, &intern->u.append.zarrayit, 0);
zend_restore_error_handling(&error_handling);
return intern;
-#if HAVE_PCRE || HAVE_BUNDLED_PCRE
case DIT_RegexIterator:
case DIT_RecursiveRegexIterator: {
zend_string *regex;
@@ -1510,7 +1509,6 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z
php_pcre_pce_incref(intern->u.regex.pce);
break;
}
-#endif
case DIT_CallbackFilterIterator:
case DIT_RecursiveCallbackFilterIterator: {
_spl_cbfilter_it_intern *cfi = emalloc(sizeof(*cfi));
@@ -1912,7 +1910,6 @@ SPL_METHOD(ParentIterator, __construct)
spl_dual_it_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, spl_ce_ParentIterator, spl_ce_RecursiveIterator, DIT_ParentIterator);
} /* }}} */
-#if HAVE_PCRE || HAVE_BUNDLED_PCRE
/* {{{ proto RegexIterator::__construct(Iterator it, string regex [, int mode [, int flags [, int preg_flags]]])
Create an RegexIterator from another iterator and a regular expression */
SPL_METHOD(RegexIterator, __construct)
@@ -2224,8 +2221,6 @@ SPL_METHOD(RecursiveRegexIterator, accept)
zend_call_method_with_0_params(Z_OBJ_P(ZEND_THIS), spl_ce_RegexIterator, NULL, "accept", return_value);
}
-#endif
-
/* {{{ spl_dual_it_dtor */
static void spl_dual_it_dtor(zend_object *_object)
{
@@ -2263,7 +2258,6 @@ static void spl_dual_it_free_storage(zend_object *_object)
zval_ptr_dtor(&object->u.caching.zcache);
}
-#if HAVE_PCRE || HAVE_BUNDLED_PCRE
if (object->dit_type == DIT_RegexIterator || object->dit_type == DIT_RecursiveRegexIterator) {
if (object->u.regex.pce) {
php_pcre_pce_decref(object->u.regex.pce);
@@ -2272,7 +2266,6 @@ static void spl_dual_it_free_storage(zend_object *_object)
zend_string_release_ex(object->u.regex.regex, 0);
}
}
-#endif
if (object->dit_type == DIT_CallbackFilterIterator || object->dit_type == DIT_RecursiveCallbackFilterIterator) {
if (object->u.cbfilter) {
@@ -2362,7 +2355,6 @@ static const zend_function_entry spl_funcs_ParentIterator[] = {
PHP_FE_END
};
-#if HAVE_PCRE || HAVE_BUNDLED_PCRE
ZEND_BEGIN_ARG_INFO_EX(arginfo_regex_it___construct, 0, 0, 2)
ZEND_ARG_OBJ_INFO(0, iterator, Iterator, 0)
ZEND_ARG_INFO(0, regex)
@@ -2411,7 +2403,6 @@ static const zend_function_entry spl_funcs_RecursiveRegexIterator[] = {
SPL_ME(RecursiveRegexIterator, getChildren, arginfo_recursive_it_void, ZEND_ACC_PUBLIC)
PHP_FE_END
};
-#endif
static inline int spl_limit_it_valid(spl_dual_it_object *intern)
{
@@ -3699,7 +3690,6 @@ PHP_MINIT_FUNCTION(spl_iterators)
REGISTER_SPL_IMPLEMENTS(RecursiveIteratorIterator, OuterIterator);
REGISTER_SPL_SUB_CLASS_EX(InfiniteIterator, IteratorIterator, spl_dual_it_new, spl_funcs_InfiniteIterator);
-#if HAVE_PCRE || HAVE_BUNDLED_PCRE
REGISTER_SPL_SUB_CLASS_EX(RegexIterator, FilterIterator, spl_dual_it_new, spl_funcs_RegexIterator);
REGISTER_SPL_CLASS_CONST_LONG(RegexIterator, "USE_KEY", REGIT_USE_KEY);
REGISTER_SPL_CLASS_CONST_LONG(RegexIterator, "INVERT_MATCH",REGIT_INVERTED);
@@ -3711,10 +3701,6 @@ PHP_MINIT_FUNCTION(spl_iterators)
REGISTER_SPL_PROPERTY(RegexIterator, "replacement", 0);
REGISTER_SPL_SUB_CLASS_EX(RecursiveRegexIterator, RegexIterator, spl_dual_it_new, spl_funcs_RecursiveRegexIterator);
REGISTER_SPL_IMPLEMENTS(RecursiveRegexIterator, RecursiveIterator);
-#else
- spl_ce_RegexIterator = NULL;
- spl_ce_RecursiveRegexIterator = NULL;
-#endif
REGISTER_SPL_STD_CLASS_EX(EmptyIterator, NULL, spl_funcs_EmptyIterator);
REGISTER_SPL_ITERATOR(EmptyIterator);
diff --git a/ext/spl/spl_iterators.h b/ext/spl/spl_iterators.h
index 4e314eb203..af2f815538 100644
--- a/ext/spl/spl_iterators.h
+++ b/ext/spl/spl_iterators.h
@@ -21,9 +21,7 @@
#include "php.h"
#include "php_spl.h"
-#if HAVE_PCRE || HAVE_BUNDLED_PCRE
#include "ext/pcre/php_pcre.h"
-#endif
#define spl_ce_Traversable zend_ce_traversable
#define spl_ce_Iterator zend_ce_iterator
@@ -71,10 +69,8 @@ typedef enum {
DIT_NoRewindIterator,
DIT_InfiniteIterator,
DIT_AppendIterator,
-#if HAVE_PCRE || HAVE_BUNDLED_PCRE
DIT_RegexIterator,
DIT_RecursiveRegexIterator,
-#endif
DIT_CallbackFilterIterator,
DIT_RecursiveCallbackFilterIterator,
DIT_Unknown = ~0
@@ -150,7 +146,6 @@ typedef struct _spl_dual_it_object {
zval zarrayit;
zend_object_iterator *iterator;
} append;
-#if HAVE_PCRE || HAVE_BUNDLED_PCRE
struct {
zend_long flags;
zend_long preg_flags;
@@ -159,7 +154,6 @@ typedef struct _spl_dual_it_object {
regex_mode mode;
int use_flags;
} regex;
-#endif
_spl_cbfilter_it_intern *cbfilter;
} u;
zend_object std;
diff --git a/main/SAPI.c b/main/SAPI.c
index 05b7bbbbec..a5a68f8c68 100644
--- a/main/SAPI.c
+++ b/main/SAPI.c
@@ -27,9 +27,7 @@
#include "php_ini.h"
#include "ext/standard/php_string.h"
#include "ext/standard/pageinfo.h"
-#if (HAVE_PCRE || HAVE_BUNDLED_PCRE) && !defined(COMPILE_DL_PCRE)
#include "ext/pcre/php_pcre.h"
-#endif
#ifdef ZTS
#include "TSRM.h"
#endif
diff --git a/main/internal_functions_win32.c b/main/internal_functions_win32.c
index 45093ec739..7d5e0d4ffd 100644
--- a/main/internal_functions_win32.c
+++ b/main/internal_functions_win32.c
@@ -62,9 +62,7 @@
#include "ext/iconv/php_iconv.h"
#endif
#include "ext/standard/reg.h"
-#if HAVE_PCRE || HAVE_BUNDLED_PCRE
#include "ext/pcre/php_pcre.h"
-#endif
#if HAVE_UODBC
#include "ext/odbc/php_odbc.h"
#endif
@@ -139,9 +137,7 @@ static zend_module_entry * const php_builtin_extensions[] = {
#if HAVE_UODBC
,phpext_odbc_ptr
#endif
-#if HAVE_PCRE || HAVE_BUNDLED_PCRE
,phpext_pcre_ptr
-#endif
,phpext_reflection_ptr
#if HAVE_PHP_SESSION
,phpext_session_ptr
diff --git a/main/php_compat.h b/main/php_compat.h
index 01d3e326c5..0775b66faf 100644
--- a/main/php_compat.h
+++ b/main/php_compat.h
@@ -25,7 +25,6 @@
#include <php_config.h>
#endif
-#if defined(HAVE_BUNDLED_PCRE) || !defined(PHP_VERSION)
#define pcre2_jit_callback_8 php_pcre2_jit_callback
#define pcre2_callout_enumerate_8 php_pcre2_callout_enumerate
#define pcre2_code_copy_8 php_pcre2_code_copy
@@ -95,7 +94,6 @@
#define pcre2_substring_number_from_name_8 php_pcre2_substring_number_from_name
#define pcre2_set_recursion_limit_8 php_pcre2_set_recursion_limit
#define pcre2_set_recursion_memory_management_8 php_pcre2_set_recursion_memory_management
-#endif
#define lookup php_lookup
#define hashTableInit php_hashTableInit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment