From b9eda6e77b4be813ce36d245f74741d5de4a279d Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 23 Jun 2014 19:27:15 +0200 Subject: [PATCH] - fix phpdbg with libedit https://bugs.php.net/67499 - add workaround for unserialize/mock issue from 5.4/5.5 --- php-5.6.0-mock.patch | 20 ++++++++ php-phpdbg.patch | 120 +++++++++++++++++++++++++++++++++++++++++++ php.spec | 11 +++- 3 files changed, 150 insertions(+), 1 deletion(-) create mode 100644 php-5.6.0-mock.patch create mode 100644 php-phpdbg.patch diff --git a/php-5.6.0-mock.patch b/php-5.6.0-mock.patch new file mode 100644 index 0000000..37bc452 --- /dev/null +++ b/php-5.6.0-mock.patch @@ -0,0 +1,20 @@ +diff -up php-5.6.0RC1/ext/standard/var_unserializer.c.mock php-5.6.0RC1/ext/standard/var_unserializer.c +--- php-5.6.0RC1/ext/standard/var_unserializer.c.mock 2014-06-19 03:26:09.000000000 +0200 ++++ php-5.6.0RC1/ext/standard/var_unserializer.c 2014-06-23 18:51:04.702265786 +0200 +@@ -22,6 +22,7 @@ + #include "php.h" + #include "ext/standard/php_var.h" + #include "php_incomplete_class.h" ++#include "Zend/zend_interfaces.h" + + /* {{{ reference-handling for unserializer: var_* */ + #define VAR_ENTRIES_MAX 1024 +@@ -394,7 +395,7 @@ static inline long object_common1(UNSERI + + (*p) += 2; + +- if (ce->serialize == NULL) { ++ if (ce->serialize == NULL || ce->unserialize == zend_user_unserialize || ZEND_INTERNAL_CLASS != ce->type) { + object_init_ex(*rval, ce); + } else { + /* If this class implements Serializable, it should not land here but in object_custom(). The passed string diff --git a/php-phpdbg.patch b/php-phpdbg.patch new file mode 100644 index 0000000..5d791ac --- /dev/null +++ b/php-phpdbg.patch @@ -0,0 +1,120 @@ +diff -up sapi/phpdbg/config.m4.old sapi/phpdbg/config.m4 +--- sapi/phpdbg/config.m4.old 2014-06-23 09:42:29.381980030 +0200 ++++ sapi/phpdbg/config.m4 2014-06-23 09:20:13.948592684 +0200 +@@ -21,7 +21,7 @@ if test "$PHP_PHPDBG" != "no"; then + PHP_PHPDBG_CFLAGS="-D_GNU_SOURCE" + PHP_PHPDBG_FILES="phpdbg.c phpdbg_parser.c phpdbg_lexer.c phpdbg_prompt.c phpdbg_help.c phpdbg_break.c phpdbg_print.c phpdbg_bp.c phpdbg_opcode.c phpdbg_list.c phpdbg_utils.c phpdbg_info.c phpdbg_cmd.c phpdbg_set.c phpdbg_frame.c phpdbg_watch.c phpdbg_btree.c" + +- if test "$PHP_READLINE" != "no"; then ++ if test "$PHP_READLINE" != "no" -o "$PHP_LIBEDIT" != "no"; then + PHPDBG_EXTRA_LIBS="$PHP_READLINE_LIBS" + fi + +diff -up sapi/phpdbg/phpdbg_cmd.c.old sapi/phpdbg/phpdbg_cmd.c +--- sapi/phpdbg/phpdbg_cmd.c.old 2014-06-23 09:43:13.910158686 +0200 ++++ sapi/phpdbg/phpdbg_cmd.c 2014-06-23 09:35:30.571299456 +0200 +@@ -792,7 +792,7 @@ PHPDBG_API int phpdbg_stack_execute(phpd + PHPDBG_API char* phpdbg_read_input(char *buffered TSRMLS_DC) /* {{{ */ + { + char *cmd = NULL; +-#ifndef HAVE_LIBREADLINE ++#if !defined(HAVE_LIBREADLINE) && !defined(HAVE_LIBEDIT) + char buf[PHPDBG_MAX_CMD]; + #endif + char *buffer = NULL; +@@ -811,7 +811,7 @@ disconnect: + return NULL; + } + +-#ifndef HAVE_LIBREADLINE ++#if !defined(HAVE_LIBREADLINE) && !defined(HAVE_LIBEDIT) + if (!(PHPDBG_G(flags) & PHPDBG_IS_REMOTE)) { + if (!phpdbg_write("%s", phpdbg_get_prompt(TSRMLS_C))) { + goto disconnect; +@@ -850,7 +850,7 @@ readline: + + buffer = estrdup(cmd); + +-#ifdef HAVE_LIBREADLINE ++#if defined(HAVE_LIBREADLINE) || defined(HAVE_LIBEDIT) + if (!buffered && cmd && + !(PHPDBG_G(flags) & PHPDBG_IS_REMOTE)) { + free(cmd); +diff -up sapi/phpdbg/phpdbg.h.old sapi/phpdbg/phpdbg.h +--- sapi/phpdbg/phpdbg.h.old 2014-06-23 09:42:47.364052178 +0200 ++++ sapi/phpdbg/phpdbg.h 2014-06-23 09:22:20.941107800 +0200 +@@ -64,7 +64,7 @@ + # include "TSRM.h" + #endif + +-#ifdef HAVE_LIBREADLINE ++#if defined(HAVE_LIBREADLINE) || defined(HAVE_LIBEDIT) + # include + # include + #endif +diff -up sapi/phpdbg/phpdbg_prompt.c.old sapi/phpdbg/phpdbg_prompt.c +--- sapi/phpdbg/phpdbg_prompt.c.old 2014-06-23 09:43:04.216119792 +0200 ++++ sapi/phpdbg/phpdbg_prompt.c 2014-06-23 09:32:02.850463053 +0200 +@@ -732,6 +732,11 @@ PHPDBG_COMMAND(print) /* {{{ */ + #else + phpdbg_writeln("Readline\tno"); + #endif ++#ifdef HAVE_LIBEDIT ++ phpdbg_writeln("Libedit\t\tyes"); ++#else ++ phpdbg_writeln("Libedit\t\tno"); ++#endif + + phpdbg_writeln("Exec\t\t%s", PHPDBG_G(exec) ? PHPDBG_G(exec) : "none"); + phpdbg_writeln("Compiled\t%s", PHPDBG_G(ops) ? "yes" : "no"); +diff -up sapi/phpdbg/phpdbg_utils.c.old sapi/phpdbg/phpdbg_utils.c +--- sapi/phpdbg/phpdbg_utils.c.old 2014-06-23 09:43:20.690185888 +0200 ++++ sapi/phpdbg/phpdbg_utils.c 2014-06-23 09:58:37.075896488 +0200 +@@ -400,12 +400,16 @@ PHPDBG_API const char *phpdbg_get_prompt + } + + /* create cached prompt */ ++#ifdef HAVE_LIBREADLINE ++ /* TODO: libedit doesn't seems to support coloured prompt */ + if ((PHPDBG_G(flags) & PHPDBG_IS_COLOURED)) { + asprintf( + &PHPDBG_G(prompt)[1], "\033[%sm%s\033[0m ", + PHPDBG_G(colors)[PHPDBG_COLOR_PROMPT]->code, + PHPDBG_G(prompt)[0]); +- } else { ++ } else ++#endif ++ { + asprintf( + &PHPDBG_G(prompt)[1], "%s ", + PHPDBG_G(prompt)[0]); +diff -up sapi/phpdbg/phpdbg.h.orig sapi/phpdbg/phpdbg.h +--- sapi/phpdbg/phpdbg.h.orig 2014-06-23 10:10:19.674754095 +0200 ++++ sapi/phpdbg/phpdbg.h 2014-06-23 10:13:14.041460315 +0200 +@@ -64,10 +64,13 @@ + # include "TSRM.h" + #endif + +-#if defined(HAVE_LIBREADLINE) || defined(HAVE_LIBEDIT) ++#ifdef LIBREADLINE + # include + # include + #endif ++#ifdef HAVE_LIBEDIT ++# include ++#endif + + #include "phpdbg_lexer.h" + #include "phpdbg_cmd.h" +diff -up sapi/phpdbg/phpdbg_utils.c.orig sapi/phpdbg/phpdbg_utils.c +--- sapi/phpdbg/phpdbg_utils.c.orig 2014-06-23 10:10:13.224727967 +0200 ++++ sapi/phpdbg/phpdbg_utils.c 2014-06-23 10:12:41.309327759 +0200 +@@ -400,7 +400,7 @@ PHPDBG_API const char *phpdbg_get_prompt + } + + /* create cached prompt */ +-#ifdef HAVE_LIBREADLINE ++#ifndef HAVE_LIBEDIT + /* TODO: libedit doesn't seems to support coloured prompt */ + if ((PHPDBG_G(flags) & PHPDBG_IS_COLOURED)) { + asprintf( diff --git a/php.spec b/php.spec index 4131870..67e757e 100644 --- a/php.spec +++ b/php.spec @@ -71,7 +71,7 @@ Summary: PHP scripting language for creating dynamic web sites Name: php Version: 5.6.0 -Release: 0.1.%{rcver}%{?dist} +Release: 0.2.%{rcver}%{?dist} # All files licensed under PHP version 3.01, except # Zend is licensed under Zend # TSRM is licensed under BSD @@ -119,8 +119,11 @@ Patch45: php-5.4.8-ldap_r.patch Patch46: php-5.4.9-fixheader.patch # drop "Configure command" from phpinfo output Patch47: php-5.4.9-phpinfo.patch +# temporary fix (from 5.4/5.5) for unserialize/mock +Patch48: php-5.6.0-mock.patch # Upstream fixes (100+) +Patch100: php-phpdbg.patch # Security fixes (200+) @@ -740,8 +743,10 @@ httpd -V | grep -q 'threaded:.*yes' && exit 1 %endif %patch46 -p1 -b .fixheader %patch47 -p1 -b .phpinfo +%patch48 -p1 -b .mock # upstream patches +%patch100 -p0 -b .libedit # security patches @@ -1574,6 +1579,10 @@ exit 0 %changelog +* Mon Jun 23 2014 Remi Collet 5.6.0-0.2.RC1 +- fix phpdbg with libedit https://bugs.php.net/67499 +- add workaround for unserialize/mock issue from 5.4/5.5 + * Thu Jun 19 2014 Remi Collet 5.6.0-0.1.RC1 - php 5.6.0RC1 https://fedoraproject.org/wiki/Changes/Php56