From 7a1d0fd3285fd91d090f7930d636e516d0f27912 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 19 Jun 2019 23:04:28 +0300 Subject: [PATCH] pcre extension can not disabled --- pcre-shared.patch | 189 ---------------------------------------------- php.spec | 47 ++---------- 2 files changed, 8 insertions(+), 228 deletions(-) delete mode 100644 pcre-shared.patch diff --git a/pcre-shared.patch b/pcre-shared.patch deleted file mode 100644 index b57e59e..0000000 --- a/pcre-shared.patch +++ /dev/null @@ -1,189 +0,0 @@ ---- php-src-PHP-7.4/ext/pcre/config0.m4~ 2019-05-04 15:24:15.000000000 +0300 -+++ php-src-PHP-7.4/ext/pcre/config0.m4 2019-05-05 18:48:35.524688151 +0300 -@@ -58,8 +58,9 @@ - fi - fi - -- PHP_NEW_EXTENSION(pcre, php_pcre.c, no,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1) -+ PHP_NEW_EXTENSION(pcre, php_pcre.c, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1) - PHP_INSTALL_HEADERS([ext/pcre], [php_pcre.h]) -+ EXTRA_LIBS="$EXTRA_LIBS -lpcre2-8" - else - AC_MSG_CHECKING([for PCRE library to use]) - AC_MSG_RESULT([bundled]) ---- php-7.3.0beta3/ext/pcre/php_pcre.h~ 2018-09-11 11:41:50.000000000 +0300 -+++ php-7.3.0beta3/ext/pcre/php_pcre.h 2018-09-11 11:41:54.865778887 +0300 -@@ -33,7 +33,29 @@ - #include - #endif - -+#if !defined(COMPILE_DL_PCRE_NOREDIRECT) -+#define pcre_get_compiled_regex (*pcre_get_compiled_regex_p) -+#define pcre_get_compiled_regex_cache (*pcre_get_compiled_regex_cache_p) -+#define php_pcre_replace_impl (*php_pcre_replace_impl_p) -+#define php_pcre_match_impl (*php_pcre_match_impl_p) -+#define php_pcre_split_impl (*php_pcre_split_impl_p) -+#if !defined(COMPILE_DL_PCRE_NOEXTERN) -+# define PCRE_EXTERN extern -+#else -+# define PCRE_EXTERN -+#endif -+#else -+// for pcre.c -+#define PCRE_EXTERN -+extern void *pcre_get_compiled_regex_p; -+extern void *pcre_get_compiled_regex_cache_p; -+extern void *php_pcre_replace_impl_p; -+extern void *php_pcre_match_impl_p; -+extern void *php_pcre_split_impl_p; -+#endif -+ - PHPAPI zend_string *php_pcre_replace(zend_string *regex, zend_string *subject_str, char *subject, size_t subject_len, zend_string *replace_str, size_t limit, size_t *replace_count); -+PCRE_EXTERN - PHPAPI pcre2_code* pcre_get_compiled_regex(zend_string *regex, uint32_t *capture_count, uint32_t *options); - PHPAPI pcre2_code* pcre_get_compiled_regex_ex(zend_string *regex, uint32_t *capture_count, uint32_t *preg_options, uint32_t *coptions); - -@@ -45,14 +67,18 @@ - - typedef struct _pcre_cache_entry pcre_cache_entry; - -+PCRE_EXTERN - PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex); - -+PCRE_EXTERN - PHPAPI void php_pcre_match_impl( pcre_cache_entry *pce, char *subject, size_t subject_len, zval *return_value, - zval *subpats, int global, int use_flags, zend_long flags, zend_off_t start_offset); - -+PCRE_EXTERN - PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, zend_string *subject_str, char *subject, size_t subject_len, zend_string *replace_str, - size_t limit, size_t *replace_count); - -+PCRE_EXTERN - PHPAPI void php_pcre_split_impl( pcre_cache_entry *pce, zend_string *subject_str, zval *return_value, - zend_long limit_val, zend_long flags); - ---- php-7.3.0beta3/ext/pcre/php_pcre.c~ 2018-09-11 11:43:27.000000000 +0300 -+++ php-7.3.0beta3/ext/pcre/php_pcre.c 2018-09-11 11:43:30.747506034 +0300 -@@ -21,6 +21,9 @@ - #include "php.h" - #include "php_ini.h" - #include "php_globals.h" -+#if COMPILE_DL_PCRE -+#define COMPILE_DL_PCRE_NOREDIRECT -+#endif - #include "php_pcre.h" - #include "ext/standard/info.h" - #include "ext/standard/basic_functions.h" -@@ -208,6 +211,17 @@ - REGISTER_LONG_CONSTANT("PREG_JIT_STACKLIMIT_ERROR", PHP_PCRE_JIT_STACKLIMIT_ERROR, CONST_CS | CONST_PERSISTENT); - REGISTER_STRING_CONSTANT("PCRE_VERSION", (char *)pcre_version(), CONST_CS | CONST_PERSISTENT); - -+#if COMPILE_DL_PCRE -+ pcre_get_compiled_regex_p = pcre_get_compiled_regex; -+ pcre_get_compiled_regex_cache_p = pcre_get_compiled_regex_cache; -+ php_pcre_replace_impl_p = php_pcre_replace_impl; -+ php_pcre_match_impl_p = php_pcre_match_impl; -+ php_pcre_split_impl_p = php_pcre_split_impl; -+ php_pcre_create_match_data_p = php_pcre_create_match_data; -+ php_pcre_free_match_data_p = php_pcre_free_match_data; -+ php_pcre_mctx_p = php_pcre_mctx; -+#endif -+ - return SUCCESS; - } - /* }}} */ ---- php-7.2.0RC5/ext/standard/basic_functions.c 2017-10-28 21:08:47.383549141 +0300 -+++ php-7.2.0RC5/ext/standard/basic_functions.c 2017-10-28 21:10:20.625051932 +0300 -@@ -113,6 +113,18 @@ - PHPAPI php_basic_globals basic_globals; - #endif - -+#if COMPILE_DL_PCRE -+// Declare the pointers in core library -+void *pcre_get_compiled_regex_p; -+void *pcre_get_compiled_regex_cache_p; -+void *php_pcre_replace_impl_p; -+void *php_pcre_match_impl_p; -+void *php_pcre_split_impl_p; -+void *php_pcre_create_match_data_p; -+void *php_pcre_free_match_data_p; -+void *php_pcre_mctx_p; -+#endif -+ - #include "php_fopen_wrappers.h" - #include "streamsfuncs.h" - ---- php-5.3.2/sapi/cli/tests/018.phpt~ 2008-03-17 16:05:39.000000000 +0200 -+++ php-5.3.2/sapi/cli/tests/018.phpt 2010-03-16 20:41:11.341251246 +0200 -@@ -20,8 +20,6 @@ - --EXPECTF-- - [PHP Modules] - %a --pcre --%a - - [Zend Modules] - %aDone ---- php-7.0.0beta3/main/php_ini.c~ 2015-08-26 18:50:15.000000000 +0300 -+++ php-7.0.0beta3/main/php_ini.c 2015-08-26 22:33:59.126957396 +0300 -@@ -765,8 +765,8 @@ - */ - void php_ini_register_extensions(void) - { -- zend_llist_apply(&extension_lists.engine, php_load_zend_extension_cb); - zend_llist_apply(&extension_lists.functions, php_load_php_extension_cb); -+ zend_llist_apply(&extension_lists.engine, php_load_zend_extension_cb); - - zend_llist_destroy(&extension_lists.engine); - zend_llist_destroy(&extension_lists.functions); ---- php-5.3.1/ext/phar/Makefile.frag~ 2009-07-23 15:48:04.000000000 +0000 -+++ php-5.3.1/ext/phar/Makefile.frag 2009-11-30 16:10:29.687175948 +0000 -@@ -10,7 +10,7 @@ - $(top_srcdir)/build/shtool echo -n -- "$(top_builddir)/$(SAPI_CLI_PATH) -n"; \ - if test "x$(PHP_MODULES)" != "x"; then \ - $(top_srcdir)/build/shtool echo -n -- " -d extension_dir=$(top_builddir)/modules"; \ -- for i in spl bz2 zlib phar; do \ -+ for i in pcre spl bz2 zlib phar; do \ - if test -f "$(top_builddir)/modules/$$i.la"; then \ - . $(top_builddir)/modules/$$i.la; $(top_srcdir)/build/shtool echo -n -- " -d extension=$$dlname"; \ - fi; \ ---- php-7.3.0beta3/ext/pcre/php_pcre.h~ 2018-09-11 11:41:50.000000000 +0300 -+++ php-7.3.0beta3/ext/pcre/php_pcre.h 2018-09-11 11:41:54.865778887 +0300 -@@ -37,6 +37,9 @@ - #define php_pcre_replace_impl (*php_pcre_replace_impl_p) - #define php_pcre_match_impl (*php_pcre_match_impl_p) - #define php_pcre_split_impl (*php_pcre_split_impl_p) -+#define php_pcre_create_match_data (*php_pcre_create_match_data_p) -+#define php_pcre_free_match_data (*php_pcre_free_match_data_p) -+#define php_pcre_mctx (*php_pcre_mctx_p) - #if !defined(COMPILE_DL_PCRE_NOEXTERN) - # define PCRE_EXTERN extern - #else -@@ -50,6 +53,9 @@ - extern void *php_pcre_replace_impl_p; - extern void *php_pcre_match_impl_p; - extern void *php_pcre_split_impl_p; -+extern void *php_pcre_create_match_data_p; -+extern void *php_pcre_free_match_data_p; -+extern void *php_pcre_mctx_p; - #endif - - PHPAPI zend_string *php_pcre_replace(zend_string *regex, zend_string *subject_str, char *subject, size_t subject_len, zend_string *replace_str, size_t limit, size_t *replace_count); -@@ -83,6 +89,7 @@ - PHPAPI void php_pcre_grep_impl( pcre_cache_entry *pce, zval *input, zval *return_value, - zend_long flags); - -+PCRE_EXTERN - PHPAPI pcre2_match_context *php_pcre_mctx(void); - PHPAPI pcre2_general_context *php_pcre_gctx(void); - PHPAPI pcre2_compile_context *php_pcre_cctx(void); -@@ -90,7 +97,9 @@ - PHPAPI void php_pcre_pce_decref(pcre_cache_entry *); - PHPAPI pcre2_code *php_pcre_pce_re(pcre_cache_entry *); - /* capture_count can be ignored, re is required. */ -+PCRE_EXTERN - PHPAPI pcre2_match_data *php_pcre_create_match_data(uint32_t, pcre2_code *); -+PCRE_EXTERN - PHPAPI void php_pcre_free_match_data(pcre2_match_data *); - - ZEND_BEGIN_MODULE_GLOBALS(pcre) diff --git a/php.spec b/php.spec index d842d68..e666677 100644 --- a/php.spec +++ b/php.spec @@ -1,7 +1,7 @@ # NOTES # - mysqlnd driver doesn't support reconnect: https://bugs.php.net/bug.php?id=52561 # TODO 7.4: -# - follow upstream: drop spl, pcre, subpackages (tired of maintaining them) +# - follow upstream: drop spl, subpackages (tired of maintaining them) # TODO 5.6: # - enable --with-fpm-systemd, but ensure it checks for sd_booted() # TODO 5.4: @@ -72,7 +72,6 @@ %bcond_without opcache # without Enable Zend OPcache extension support %bcond_without openssl # without OpenSSL support and OpenSSL extension (module) %bcond_without pcntl # without pcntl extension module -%bcond_without pcre # without PCRE extension module %bcond_without pdo # without PDO extension module %bcond_without pdo_dblib # without PDO dblib extension module %bcond_without pdo_firebird # without PDO Firebird extension module @@ -145,11 +144,6 @@ %undefine with_fpm %endif -# filter depends on pcre -%if %{without pcre} -%undefine with_filter -%endif - %if %{without pdo} %undefine with_pdo_dblib %undefine with_pdo_firebird @@ -225,7 +219,6 @@ Patch45: %{orgname}-imap-annotations.patch Patch46: %{orgname}-imap-myrights.patch Patch50: extension-shared-optional-dep.patch Patch51: spl-shared.patch -Patch52: pcre-shared.patch Patch53: fix-test-run.patch Patch55: bug-52078-fileinode.patch Patch59: %{orgname}-systzdata.patch @@ -289,7 +282,7 @@ BuildRequires: openssl-devel >= 1.0.1 %endif %{?with_oci:%{?with_instantclient:BuildRequires: oracle-instantclient-devel}} BuildRequires: pam-devel -%{?with_pcre:BuildRequires: pcre2-8-devel >= 10.30} +BuildRequires: pcre2-8-devel >= 10.30 BuildRequires: pkgconfig %{?with_pgsql:BuildRequires: postgresql-devel} BuildRequires: readline-devel @@ -584,16 +577,18 @@ Provides: %{name}(zend_module_api) = %{zend_module_api} Provides: %{name}-core Provides: %{name}-date Provides: %{name}-hash = %{epoch}:%{version}-%{release} +Provides: %{name}-pcre = %{epoch}:%{version}-%{release} Provides: %{name}-reflection Provides: %{name}-standard Provides: php(core) = %{version} Provides: php(date) Provides: php(hash) = %{hashver} Provides: php(libxml) +Provides: php(pcre) Provides: php(reflection) Provides: php(standard) %{!?with_mysqlnd:Obsoletes: %{name}-mysqlnd} -%{?with_pcre:%requires_ge_to pcre2-8 pcre2-8-devel} +%requires_ge_to pcre2-8 pcre2-8-devel Suggests: browscap Obsoletes: php-common < 4:5.3.28-7 Obsoletes: php-filepro < 4:5.2.0 @@ -607,6 +602,7 @@ Obsoletes: php-pecl-hash < %{hashver} Obsoletes: php-qtdom < 3:5.0.0 Conflicts: php4-common < 3:4.4.4-8 Conflicts: php55-common < 4:5.5.10-4 +Obsoletes: php-pcre < 4:5.3.28-7 Conflicts: rpm < 4.4.2-0.2 %if %{with mhash} Provides: php(mhash) @@ -643,7 +639,7 @@ Requires: libtool >= 2:2.4.6 %else Requires: libtool %endif -%{?with_pcre:Requires: pcre2-8-devel >= 10.30} +Requires: pcre2-8-devel >= 10.30 Requires: shtool Provides: php-devel = %{epoch}:%{version}-%{release} Obsoletes: php-devel @@ -1261,22 +1257,6 @@ waitpid(), signal() etc. Moduł PHP umożliwiający tworzenie nowych procesów i kontrolę nad nimi. Obsługuje funkcje takie jak fork(), waitpid(), signal() i podobne. -%package pcre -Summary: PCRE extension module for PHP -Summary(pl.UTF-8): Moduł PCRE dla PHP -Group: Libraries -Requires: %{name}-common = %{epoch}:%{version}-%{release} -Provides: php(pcre) -Obsoletes: php-pcre < 4:5.3.28-7 - -%description pcre -This is a dynamic shared object (DSO) for PHP that will add Perl -Compatible Regular Expression support. - -%description pcre -l pl.UTF-8 -Moduł PHP umożliwiający korzystanie z perlowych wyrażeń regularnych -(Perl Compatible Regular Expressions) - %package pdo Summary: PHP Data Objects (PDO) Summary(pl.UTF-8): Obsługa PHP Data Objects (PDO) @@ -1969,7 +1949,6 @@ cp -p php.ini-production php.ini #%patch46 -p1 # imap myrights. fixme %patch50 -p1 %patch51 -p1 -b .spl-shared -%patch52 -p1 -b .pcre-shared %patch53 -p1 %undos ext/spl/tests/SplFileInfo_getInode_basic.phpt %patch55 -p1 @@ -2354,6 +2333,7 @@ for sapi in $sapis; do %{?with_kerberos5:--with-kerberos} \ --with-tcadb=/usr \ %{__with_without pcre pcre-regex /usr} \ + %{?with_pcre:--with-external-pcre} \ %{__enable_disable filter filter shared} \ --with-pear=%{php_pear_dir} \ %{__with_without pgsql pgsql shared,/usr} \ @@ -2445,8 +2425,6 @@ generate_inifiles() { # opcache.so is zend extension nm $so | grep -q zend_extension_entry && ext=zend_extension conf="$mod.ini" - # pre needs to be loaded before SPL - [ "$mod" = "pcre" ] && conf="PCRE.ini" # spl needs to be loaded before mysqli [ "$mod" = "spl" ] && conf="SPL.ini" # session needs to be loaded before php-pecl-http, php-pecl-memcache, php-pecl-session_mysql @@ -2823,7 +2801,6 @@ fi \ %extension_scripts odbc %extension_scripts opcache %extension_scripts openssl -%extension_scripts pcre %extension_scripts pdo %extension_scripts pdo-dblib %extension_scripts pdo-firebird @@ -3196,14 +3173,6 @@ fi %attr(755,root,root) %{php_extensiondir}/pcntl.so %endif -%if %{with pcre} -%files pcre -%defattr(644,root,root,755) -%doc ext/pcre/CREDITS -%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/PCRE.ini -%attr(755,root,root) %{php_extensiondir}/pcre.so -%endif - %if %{with pdo} %files pdo %defattr(644,root,root,755) -- 2.44.0