From 936a7b90b28ac759373860fe39b2a58580d0b293 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 5 Jun 2013 17:29:33 +0200 Subject: PHP 5.4.16 --- php-5.4.16-fpm.patch | 31 ++++++++++++++++++ php-5.4.16-gc.patch | 83 +++++++++++++++++++++++++++++++++++++++++++++++ php-5.4.16-pdopgsql.patch | 33 +++++++++++++++++++ php-5.4.16-pdotests.patch | 34 +++++++++++++++++++ php-fpm.service | 1 + php54.spec | 59 ++++++++++++++++++++++++++------- 6 files changed, 230 insertions(+), 11 deletions(-) create mode 100644 php-5.4.16-fpm.patch create mode 100644 php-5.4.16-gc.patch create mode 100644 php-5.4.16-pdopgsql.patch create mode 100644 php-5.4.16-pdotests.patch diff --git a/php-5.4.16-fpm.patch b/php-5.4.16-fpm.patch new file mode 100644 index 0000000..4a32fcf --- /dev/null +++ b/php-5.4.16-fpm.patch @@ -0,0 +1,31 @@ +From 9f6ca9bc6400fc9c8eaebf963f6eb048dde4b34f Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Fri, 24 May 2013 12:09:05 +0200 +Subject: [PATCH] Fixed Bug #64915 (error_log ignored when daemonize=0) + +Use configured error_log file when stderr is not a tty. +So only use tty during interactive debug run. +--- + NEWS | 3 +++ + sapi/fpm/fpm/fpm_stdio.c | 4 ++++ + 2 files changed, 7 insertions(+) + +diff --git a/sapi/fpm/fpm/fpm_stdio.c b/sapi/fpm/fpm/fpm_stdio.c +index 10b867d..d81e101 100644 +--- a/sapi/fpm/fpm/fpm_stdio.c ++++ b/sapi/fpm/fpm/fpm_stdio.c +@@ -291,7 +291,11 @@ int fpm_stdio_open_error_log(int reopen) /* {{{ */ + fd = fpm_globals.error_log_fd; /* for FD_CLOSEXEC to work */ + } else { + fpm_globals.error_log_fd = fd; ++#if HAVE_UNISTD_H ++ if (fpm_global_config.daemonize || !isatty(STDERR_FILENO)) { ++#else + if (fpm_global_config.daemonize) { ++#endif + zlog_set_fd(fpm_globals.error_log_fd); + } + } +-- +1.7.11.5 + diff --git a/php-5.4.16-gc.patch b/php-5.4.16-gc.patch new file mode 100644 index 0000000..a1f4323 --- /dev/null +++ b/php-5.4.16-gc.patch @@ -0,0 +1,83 @@ +From 3c87945c95c9c31986e690bb046c70e58c8d8896 Mon Sep 17 00:00:00 2001 +From: Xinchen Hui +Date: Wed, 5 Jun 2013 17:25:00 +0800 +Subject: [PATCH] Fixed bug #64960 (Segfault in gc_zval_possible_root) + +--- + NEWS | 2 ++ + Zend/tests/bug64960.phpt | 40 ++++++++++++++++++++++++++++++++++++++++ + Zend/zend_execute_API.c | 6 ++---- + 3 files changed, 44 insertions(+), 4 deletions(-) + create mode 100644 Zend/tests/bug64960.phpt + +diff --git a/Zend/tests/bug64960.phpt b/Zend/tests/bug64960.phpt +new file mode 100644 +index 0000000..b31cca3 +--- /dev/null ++++ b/Zend/tests/bug64960.phpt +@@ -0,0 +1,40 @@ ++--TEST-- ++Bug #64960 (Segfault in gc_zval_possible_root) ++--FILE-- ++_trace = debug_backtrace(); ++ ++ throw $e; ++}); ++ ++// trigger error handler ++$a['waa']; ++?> ++--EXPECTF-- ++Notice: ob_end_flush(): failed to delete and flush buffer. No buffer to delete or flush in %sbug64960.php on line 3 ++ ++Fatal error: Uncaught exception 'Exception' in %sbug64960.php:19 ++Stack trace: ++#0 [internal function]: {closure}(8, 'ob_end_clean():...', '%s', 9, Array) ++#1 %sbug64960.php(9): ob_end_clean() ++#2 [internal function]: ExceptionHandler->__invoke(Object(Exception)) ++#3 {main} ++ thrown in %sbug64960.php on line 19 +diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c +index 9781889..687520d 100644 +--- a/Zend/zend_execute_API.c ++++ b/Zend/zend_execute_API.c +@@ -263,15 +263,13 @@ void shutdown_executor(TSRMLS_D) /* {{{ */ + if (EG(user_error_handler)) { + zeh = EG(user_error_handler); + EG(user_error_handler) = NULL; +- zval_dtor(zeh); +- FREE_ZVAL(zeh); ++ zval_ptr_dtor(&zeh); + } + + if (EG(user_exception_handler)) { + zeh = EG(user_exception_handler); + EG(user_exception_handler) = NULL; +- zval_dtor(zeh); +- FREE_ZVAL(zeh); ++ zval_ptr_dtor(&zeh); + } + + zend_stack_destroy(&EG(user_error_handlers_error_reporting)); +-- +1.7.11.5 + diff --git a/php-5.4.16-pdopgsql.patch b/php-5.4.16-pdopgsql.patch new file mode 100644 index 0000000..eff1edb --- /dev/null +++ b/php-5.4.16-pdopgsql.patch @@ -0,0 +1,33 @@ +From 1c623e3b07128e78362911ff5754e7eee57fa8bb Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Fri, 31 May 2013 08:39:32 +0200 +Subject: [PATCH] Fixed Bug #64949 (Buffer overflow in _pdo_pgsql_error) + +There is a lot of call such as: + pdo_pgsql_error(dbh, PGRES_FATAL_ERROR, "Copy command failed"); +Where the 3rd paramater is a error message string where a sqlstate (5 chars) +is expected. This cause a segfault in copy_from.phpt and copy_to.phpt. + +This is only a sanity check to avoid buffer overflow, but obviously this +calls need to be fixed (using NULL or a correct sqlstate). +--- + NEWS | 3 +++ + ext/pdo_pgsql/pgsql_driver.c | 2 +- + 2 files changed, 4 insertions(+), 1 deletion(-) + +diff --git a/ext/pdo_pgsql/pgsql_driver.c b/ext/pdo_pgsql/pgsql_driver.c +index 645fd36..55f4418 100644 +--- a/ext/pdo_pgsql/pgsql_driver.c ++++ b/ext/pdo_pgsql/pgsql_driver.c +@@ -76,7 +76,7 @@ int _pdo_pgsql_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, int errcode, const char * + einfo->errmsg = NULL; + } + +- if (sqlstate == NULL) { ++ if (sqlstate == NULL || strlen(sqlstate) >= sizeof(pdo_error_type)) { + strcpy(*pdo_err, "HY000"); + } + else { +-- +1.7.11.5 + diff --git a/php-5.4.16-pdotests.patch b/php-5.4.16-pdotests.patch new file mode 100644 index 0000000..7371798 --- /dev/null +++ b/php-5.4.16-pdotests.patch @@ -0,0 +1,34 @@ +From c08e1d2be948d63f7a9309344a0ed4092ac8dace Mon Sep 17 00:00:00 2001 +From: Nikita Popov +Date: Sun, 24 Mar 2013 17:52:16 +0100 +Subject: [PATCH] Fix PDO::inTransaction() test for pgsql + +inTransaction() nowadays casts the in_transaction result to boolean. +I'm not sure whether the INERROR state should result in true or false. +For now I went with the result that we actually get. +--- + ext/pdo_pgsql/tests/is_in_transaction.phpt | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/ext/pdo_pgsql/tests/is_in_transaction.phpt b/ext/pdo_pgsql/tests/is_in_transaction.phpt +index 99ff561..72da4f4 100644 +--- a/ext/pdo_pgsql/tests/is_in_transaction.phpt ++++ b/ext/pdo_pgsql/tests/is_in_transaction.phpt +@@ -57,10 +57,10 @@ var_dump($db->inTransaction()); + ?> + --EXPECT-- + Test PDO::PGSQL_TRANSACTION_INTRANS +-int(2) ++bool(true) + Test PDO::PGSQL_TRANSACTION_IDLE +-int(0) ++bool(false) + Test PDO::PGSQL_TRANSACTION_INERROR +-int(3) ++bool(true) + Test PDO::PGSQL_TRANSACTION_IDLE +-int(0) ++bool(false) +-- +1.7.11.5 + diff --git a/php-fpm.service b/php-fpm.service index d90ed8c..ea09910 100644 --- a/php-fpm.service +++ b/php-fpm.service @@ -3,6 +3,7 @@ Description=The PHP FastCGI Process Manager After=syslog.target network.target [Service] +Type=notify PIDFile=/run/php-fpm/php-fpm.pid EnvironmentFile=/etc/sysconfig/php-fpm ExecStart=/usr/sbin/php-fpm --nodaemonize diff --git a/php54.spec b/php54.spec index ee8e33c..d70d376 100644 --- a/php54.spec +++ b/php54.spec @@ -46,6 +46,16 @@ %{!?_httpd_moddir: %{expand: %%global _httpd_moddir %%{_libdir}/httpd/modules}} %{!?_httpd_contentdir: %{expand: %%global _httpd_contentdir /var/www}} +%if 0%{?fedora} >= 15 || 0%{?rhel} >= 7 +%global with_systemd 1 +%else +%global with_systemd 0 +%endif +%if 0%{?fedora} >= 16 || 0%{?rhel} >= 7 +%global with_systemdfull 1 +%else +%global with_systemdfull 0 +%endif %if 0%{?fedora} < 17 && 0%{?rhel} < 7 %global with_libzip 0 %else @@ -65,7 +75,7 @@ Summary: PHP scripting language for creating dynamic web sites Name: php -Version: 5.4.15 +Version: 5.4.16 %if 0%{?snapdate:1}%{?rcver:1} Release: 0.5.%{?snapdate}%{?rcver}%{?dist} %else @@ -103,6 +113,12 @@ Patch8: php-5.4.7-libdb.patch # Fixes for extension modules # https://bugs.php.net/63171 no odbc call during timeout Patch21: php-5.4.7-odbctimer.patch +# Fixed Bug #64949 (Buffer overflow in _pdo_pgsql_error) +Patch22: php-5.4.16-pdopgsql.patch +# Fixed bug #64960 (Segfault in gc_zval_possible_root) +Patch23: php-5.4.16-gc.patch +# Fixed Bug #64915 (error_log ignored when daemonize=0) +Patch24: php-5.4.16-fpm.patch # Functional changes Patch40: php-5.4.0-dlopen.patch @@ -120,6 +136,7 @@ Patch46: php-5.4.9-fixheader.patch Patch47: php-5.4.9-phpinfo.patch # Fixes for tests +Patch60: php-5.4.16-pdotests.patch # RC Patch Patch91: php-5.3.7-oci8conf.patch @@ -201,7 +218,10 @@ Summary: PHP FastCGI Process Manager License: PHP and Zend and BSD Requires: php-common%{?_isa} = %{version}-%{release} Requires(pre): /usr/sbin/useradd -%if 0%{?fedora} >= 15 || 0%{?rhel} >= 7 +%if %{with_systemdfull} +BuildRequires: systemd-devel +%endif +%if %{with_systemd} BuildRequires: systemd-units Requires: systemd-units Requires(post): systemd-units @@ -751,6 +771,9 @@ httpd -V | grep -q 'threaded:.*yes' && exit 1 rm -f ext/json/utf8_to_utf16.* %patch21 -p1 -b .odbctimer +%patch22 -p1 -b .pdopgsql +%patch23 -p1 -b .gc +%patch24 -p1 -b .fpm %patch40 -p1 -b .dlopen %patch41 -p1 -b .easter @@ -767,6 +790,8 @@ rm -f ext/json/utf8_to_utf16.* %patch46 -p1 -b .fixheader %patch47 -p1 -b .phpinfo +%patch60 -p1 -b .pdotests + %patch91 -p1 -b .remi-oci8 @@ -1056,6 +1081,9 @@ popd # Build php-fpm pushd build-fpm build --enable-fpm \ +%if %{with_systemdfull} + --with-fpm-systemd \ +%endif --libdir=%{_libdir}/php \ --without-mysql --disable-pdo \ ${without_shared} @@ -1275,7 +1303,7 @@ mv $RPM_BUILD_ROOT%{_sysconfdir}/php-fpm.conf.default . # LogRotate install -m 755 -d $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d install -m 644 %{SOURCE7} $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/php-fpm -%if 0%{?fedora} >= 15 || 0%{?rhel} >= 7 +%if %{with_systemd} install -m 755 -d $RPM_BUILD_ROOT/run/php-fpm # tmpfiles.d install -m 755 -d $RPM_BUILD_ROOT%{_prefix}/lib/tmpfiles.d @@ -1283,9 +1311,11 @@ install -m 644 php-fpm.tmpfiles $RPM_BUILD_ROOT%{_prefix}/lib/tmpfiles.d/php-fpm # install systemd unit files and scripts for handling server startup install -m 755 -d $RPM_BUILD_ROOT%{_unitdir} install -m 644 %{SOURCE6} $RPM_BUILD_ROOT%{_unitdir}/ -%if 0%{?fedora} < 16 && 0%{?rhel} < 7 -# PrivateTmp only work on fedora >= 16 -sed -i -e '/PrivateTmp/s/true/false/' ${RPM_BUILD_ROOT}%{_unitdir}/php-fpm.service +%if ! %{with_systemdfull} +# PrivateTmp and Type=notify only work on fedora >= 16 +sed -e '/^PrivateTmp/s/true/false/' \ + -e '/^Type/s/notify/simple/' \ + -i${RPM_BUILD_ROOT}%{_unitdir}/php-fpm.service %endif %else install -m 755 -d $RPM_BUILD_ROOT%{_localstatedir}/run/php-fpm @@ -1418,7 +1448,7 @@ exit 0 %else if [ $1 = 1 ]; then # Initial installation -%if 0%{?fedora} >= 15 +%if %{with_systemd} /bin/systemctl daemon-reload >/dev/null 2>&1 || : %else /sbin/chkconfig --add php-fpm @@ -1432,7 +1462,7 @@ fi %else if [ $1 = 0 ]; then # Package removal, not upgrade -%if 0%{?fedora} >= 15 +%if %{with_systemd} /bin/systemctl --no-reload disable php-fpm.service >/dev/null 2>&1 || : /bin/systemctl stop php-fpm.service >/dev/null 2>&1 || : %else @@ -1446,7 +1476,7 @@ fi %if 0%{?systemd_postun_with_restart:1} %systemd_postun_with_restart php-fpm.service %else -%if 0%{?fedora} >= 15 +%if %{with_systemd} /bin/systemctl daemon-reload >/dev/null 2>&1 || : if [ $1 -ge 1 ]; then # Package upgrade, not uninstall @@ -1463,7 +1493,7 @@ fi # We can tell if a SysV version of php-fpm was previously installed by # checking to see if the initscript is present. %triggerun fpm -- php-fpm -%if 0%{?fedora} >= 15 +%if %{with_systemd} if [ -f /etc/rc.d/init.d/php-fpm ]; then # Save the current service runlevel info # User must manually run systemd-sysv-convert --apply php-fpm @@ -1529,7 +1559,7 @@ fi %config(noreplace) %{_sysconfdir}/php-fpm.d/www.conf %config(noreplace) %{_sysconfdir}/logrotate.d/php-fpm %config(noreplace) %{_sysconfdir}/sysconfig/php-fpm -%if 0%{?fedora} >= 15 +%if %{with_systemd} %{_prefix}/lib/tmpfiles.d/php-fpm.conf %{_unitdir}/php-fpm.service %dir /run/php-fpm @@ -1603,6 +1633,13 @@ fi %changelog +* Wed Jun 5 2013 Remi Collet 5.4.16-1 +- update to 5.4.16 +- switch systemd unit to Type=notify +- patch for upstream Bug #64915 error_log ignored when daemonize=0 +- patch for upstream Bug #64949 Buffer overflow in _pdo_pgsql_error +- patch for upstream bug #64960 Segfault in gc_zval_possible_root + * Thu May 9 2013 Remi Collet 5.4.15-1 - update to 5.4.15 - clean very old obsoletes -- cgit