From 14b58957d9c66171c220b0a6e545bd0ea2aedf06 Mon Sep 17 00:00:00 2001
From: Remi Collet <fedora@famillecollet.com>
Date: Sun, 31 Aug 2014 18:39:35 +0200
Subject: php54-php: fix f21 build

---
 php-5.4.15-system-libzip.patch | 500 -----------------------------------------
 php-5.4.16-iniscan.patch       | 159 -------------
 php.spec                       |   6 +-
 3 files changed, 3 insertions(+), 662 deletions(-)
 delete mode 100644 php-5.4.15-system-libzip.patch
 delete mode 100644 php-5.4.16-iniscan.patch

diff --git a/php-5.4.15-system-libzip.patch b/php-5.4.15-system-libzip.patch
deleted file mode 100644
index 7e8642b..0000000
--- a/php-5.4.15-system-libzip.patch
+++ /dev/null
@@ -1,500 +0,0 @@
-diff -up php-5.4.15/ext/zip/config.m4.systzip php-5.4.15/ext/zip/config.m4
---- php-5.4.15/ext/zip/config.m4.systzip	2013-05-08 07:41:20.000000000 +0200
-+++ php-5.4.15/ext/zip/config.m4	2013-05-09 06:46:26.084673644 +0200
-@@ -13,65 +13,116 @@ fi
- PHP_ARG_WITH(pcre-dir, pcre install prefix,
- [  --with-pcre-dir           ZIP: pcre install prefix], no, no)
- 
-+PHP_ARG_WITH(libzip, libzip,
-+[ --with-libzip[=DIR]        ZIP: use libzip], no, no)
-+
- if test "$PHP_ZIP" != "no"; then
-+  if test "$PHP_LIBZIP" != "no"; then
-+
-+    AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
-+
-+    dnl system libzip, depends on libzip
-+    AC_MSG_CHECKING(for libzip)
-+    if test -r $PHP_LIBZIP/include/zip.h; then
-+      LIBZIP_CFLAGS="-I$PHP_LIBZIP/include"
-+      LIBZIP_LIBDIR="$PHP_LIBZIP/$PHP_LIBDIR"
-+      AC_MSG_RESULT(from option: found in $PHP_LIBZIP)
-+
-+    elif test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libzip; then
-+      LIBZIP_CFLAGS=`$PKG_CONFIG libzip --cflags`
-+      LIBZIP_LIBDIR=`$PKG_CONFIG libzip --variable=libdir`
-+      AC_MSG_RESULT(from pkgconfig: found in $LIBZIP_LIBDIR)
- 
--  if test "$PHP_ZLIB_DIR" != "no" && test "$PHP_ZLIB_DIR" != "yes"; then
--    if test -f "$PHP_ZLIB_DIR/include/zlib/zlib.h"; then
--      PHP_ZLIB_DIR="$PHP_ZLIB_DIR"
--      PHP_ZLIB_INCDIR="$PHP_ZLIB_DIR/include/zlib"
--    elif test -f "$PHP_ZLIB_DIR/include/zlib.h"; then
--      PHP_ZLIB_DIR="$PHP_ZLIB_DIR"
--      PHP_ZLIB_INCDIR="$PHP_ZLIB_DIR/include"
-     else
--      AC_MSG_ERROR([Can not find zlib headers under "$PHP_ZLIB_DIR"])
-+      for i in /usr/local /usr; do
-+        if test -r $i/include/zip.h; then
-+          LIBZIP_CFLAGS="-I$i/include"
-+          LIBZIP_LIBDIR="$i/$PHP_LIBDIR"
-+          AC_MSG_RESULT(in default path: found in $i)
-+          break
-+        fi
-+      done
-     fi
-+
-+    if test -z "$LIBZIP_LIBDIR"; then
-+      AC_MSG_RESULT(not found)
-+      AC_MSG_ERROR(Please reinstall the libzip distribution)
-+    fi
-+
-+    dnl Could not think of a simple way to check libzip for overwrite support
-+    PHP_CHECK_LIBRARY(zip, zip_open,
-+    [
-+      PHP_ADD_LIBRARY_WITH_PATH(zip, $LIBZIP_LIBDIR, ZIP_SHARED_LIBADD)
-+      AC_DEFINE(HAVE_LIBZIP,1,[ ])
-+    ], [
-+      AC_MSG_ERROR(could not find usable libzip)
-+    ], [
-+      -L$LIBZIP_LIBDIR
-+    ])
-+
-+    AC_DEFINE(HAVE_ZIP,1,[ ]) 
-+    PHP_NEW_EXTENSION(zip, php_zip.c zip_stream.c, $ext_shared,, $LIBZIP_CFLAGS)
-+    PHP_SUBST(ZIP_SHARED_LIBADD)
-   else
--    for i in /usr/local /usr; do
--      if test -f "$i/include/zlib/zlib.h"; then
--        PHP_ZLIB_DIR="$i"
--        PHP_ZLIB_INCDIR="$i/include/zlib"
--      elif test -f "$i/include/zlib.h"; then
--        PHP_ZLIB_DIR="$i"
--        PHP_ZLIB_INCDIR="$i/include"
-+
-+  dnl bundled libzip, depends on zlib
-+    if test "$PHP_ZLIB_DIR" != "no" && test "$PHP_ZLIB_DIR" != "yes"; then
-+      if test -f "$PHP_ZLIB_DIR/include/zlib/zlib.h"; then
-+        PHP_ZLIB_DIR="$PHP_ZLIB_DIR"
-+        PHP_ZLIB_INCDIR="$PHP_ZLIB_DIR/include/zlib"
-+      elif test -f "$PHP_ZLIB_DIR/include/zlib.h"; then
-+        PHP_ZLIB_DIR="$PHP_ZLIB_DIR"
-+        PHP_ZLIB_INCDIR="$PHP_ZLIB_DIR/include"
-+      else
-+        AC_MSG_ERROR([Can not find zlib headers under "$PHP_ZLIB_DIR"])
-       fi
--    done
--  fi
-+    else
-+      for i in /usr/local /usr; do
-+        if test -f "$i/include/zlib/zlib.h"; then
-+          PHP_ZLIB_DIR="$i"
-+          PHP_ZLIB_INCDIR="$i/include/zlib"
-+        elif test -f "$i/include/zlib.h"; then
-+          PHP_ZLIB_DIR="$i"
-+          PHP_ZLIB_INCDIR="$i/include"
-+        fi
-+      done
-+    fi
- 
--  dnl # zlib
--  AC_MSG_CHECKING([for the location of zlib])
--  if test "$PHP_ZLIB_DIR" = "no"; then
--    AC_MSG_ERROR([zip support requires ZLIB. Use --with-zlib-dir=<DIR> to specify prefix where ZLIB include and library are located])
--  else
--    AC_MSG_RESULT([$PHP_ZLIB_DIR])
--    PHP_ADD_LIBRARY_WITH_PATH(z, $PHP_ZLIB_DIR/$PHP_LIBDIR, ZIP_SHARED_LIBADD)
--    PHP_ADD_INCLUDE($PHP_ZLIB_INCDIR)
--  fi
-+    dnl # zlib
-+    AC_MSG_CHECKING([for the location of zlib])
-+    if test "$PHP_ZLIB_DIR" = "no"; then
-+      AC_MSG_ERROR([zip support requires ZLIB. Use --with-zlib-dir=<DIR> to specify prefix where ZLIB include and library are located])
-+    else
-+      AC_MSG_RESULT([$PHP_ZLIB_DIR])
-+      PHP_ADD_LIBRARY_WITH_PATH(z, $PHP_ZLIB_DIR/$PHP_LIBDIR, ZIP_SHARED_LIBADD)
-+      PHP_ADD_INCLUDE($PHP_ZLIB_INCDIR)
-+    fi
- 
--  dnl This is PECL build, check if bundled PCRE library is used
--  old_CPPFLAGS=$CPPFLAGS
--  CPPFLAGS=$INCLUDES
--  AC_EGREP_CPP(yes,[
-+    dnl This is PECL build, check if bundled PCRE library is used
-+    old_CPPFLAGS=$CPPFLAGS
-+    CPPFLAGS=$INCLUDES
-+    AC_EGREP_CPP(yes,[
- #include <main/php_config.h>
- #if defined(HAVE_BUNDLED_PCRE) && !defined(COMPILE_DL_PCRE)
- yes
- #endif
--  ],[
--    PHP_PCRE_REGEX=yes
--  ],[
--    AC_EGREP_CPP(yes,[
-+    ],[
-+      PHP_PCRE_REGEX=yes
-+    ],[
-+      AC_EGREP_CPP(yes,[
- #include <main/php_config.h>
- #if defined(HAVE_PCRE) && !defined(COMPILE_DL_PCRE)
- yes
- #endif
--    ],[
--      PHP_PCRE_REGEX=pecl
--    ],[
--      PHP_PCRE_REGEX=no
-+      ],[
-+        PHP_PCRE_REGEX=pecl
-+      ],[
-+        PHP_PCRE_REGEX=no
-+      ])
-     ])
--  ])
--  CPPFLAGS=$old_CPPFLAGS
-+    CPPFLAGS=$old_CPPFLAGS
- 
--  PHP_ZIP_SOURCES="$PHP_ZIP_SOURCES lib/zip_add.c lib/zip_error.c lib/zip_fclose.c \
-+    PHP_ZIP_SOURCES="$PHP_ZIP_SOURCES lib/zip_add.c lib/zip_error.c lib/zip_fclose.c \
-                          lib/zip_fread.c lib/zip_open.c lib/zip_source_filep.c  \
-                          lib/zip_strerror.c lib/zip_close.c lib/zip_error_get.c \
-                          lib/zip_file_error_get.c lib/zip_free.c lib/zip_rename.c \
-@@ -98,10 +149,11 @@ yes
- 						 lib/zip_source_open.c lib/zip_source_pkware.c lib/zip_source_pop.c \
- 						 lib/zip_source_read.c lib/zip_source_stat.c"
- 
--  AC_DEFINE(HAVE_ZIP,1,[ ])
--  PHP_NEW_EXTENSION(zip, php_zip.c zip_stream.c $PHP_ZIP_SOURCES, $ext_shared)
--  PHP_ADD_BUILD_DIR($ext_builddir/lib, 1)
--  PHP_SUBST(ZIP_SHARED_LIBADD)
-+    AC_DEFINE(HAVE_ZIP,1,[ ])
-+    PHP_NEW_EXTENSION(zip, php_zip.c zip_stream.c $PHP_ZIP_SOURCES, $ext_shared)
-+    PHP_ADD_BUILD_DIR($ext_builddir/lib, 1)
-+    PHP_SUBST(ZIP_SHARED_LIBADD)
-+  fi
- 
-   dnl so we always include the known-good working hack.
-   PHP_ADD_MAKEFILE_FRAGMENT
-diff -up php-5.4.15/ext/zip/php_zip.c.systzip php-5.4.15/ext/zip/php_zip.c
---- php-5.4.15/ext/zip/php_zip.c.systzip	2013-05-08 07:41:20.000000000 +0200
-+++ php-5.4.15/ext/zip/php_zip.c	2013-05-09 06:50:33.286058049 +0200
-@@ -30,8 +30,232 @@
- #include "ext/pcre/php_pcre.h"
- #include "ext/standard/php_filestat.h"
- #include "php_zip.h"
-+#if defined(HAVE_LIBZIP)
-+#include <zip.h>
-+
-+/* Copied from libzip 0.10 */
-+
-+/* state of change of a file in zip archive */
-+
-+enum zip_state { ZIP_ST_UNCHANGED, ZIP_ST_DELETED, ZIP_ST_REPLACED,
-+                 ZIP_ST_ADDED, ZIP_ST_RENAMED };
-+
-+/* error source for layered sources */
-+
-+enum zip_les { ZIP_LES_NONE, ZIP_LES_UPPER, ZIP_LES_LOWER, ZIP_LES_INVAL };
-+
-+typedef zip_int64_t (*zip_source_layered_callback)(struct zip_source *, void *,
-+                                                   void *, zip_uint64_t,
-+                                                   enum zip_source_cmd);
-+
-+struct zip_error {
-+    int zip_err;        /* libzip error code (ZIP_ER_*) */
-+    int sys_err;        /* copy of errno (E*) or zlib error code */
-+    char *str;          /* string representation or NULL */
-+};
-+
-+/* zip archive, part of API */
-+
-+struct zip {
-+    char *zn;                   /* file name */
-+    FILE *zp;                   /* file */
-+    struct zip_error error;     /* error information */
-+
-+    unsigned int flags;         /* archive global flags */
-+    unsigned int ch_flags;	/* changed archive global flags */
-+
-+    char *default_password;     /* password used when no other supplied */
-+
-+    struct zip_cdir *cdir;	/* central directory */
-+    char *ch_comment;           /* changed archive comment */
-+    int ch_comment_len;         /* length of changed zip archive
-+                                 * comment, -1 if unchanged */
-+    zip_uint64_t nentry;        /* number of entries */
-+    zip_uint64_t nentry_alloc;  /* number of entries allocated */
-+    struct zip_entry *entry;    /* entries */
-+    int nfile;                  /* number of opened files within archive */
-+    int nfile_alloc;            /* number of files allocated */
-+    struct zip_file **file;     /* opened files within archive */
-+};
-+
-+/* file in zip archive, part of API */
-+
-+struct zip_file {
-+    struct zip *za;             /* zip archive containing this file */
-+    struct zip_error error;     /* error information */
-+    int eof;
-+    struct zip_source *src;     /* data source */
-+};
-+
-+/* zip archive directory entry (central or local) */
-+
-+struct zip_dirent {
-+    unsigned short version_madeby;	/* (c)  version of creator */
-+    unsigned short version_needed;	/* (cl) version needed to extract */
-+    unsigned short bitflags;            /* (cl) general purpose bit flag */
-+    unsigned short comp_method;         /* (cl) compression method used */
-+    time_t last_mod;                    /* (cl) time of last modification */
-+    unsigned int crc;                   /* (cl) CRC-32 of uncompressed data */
-+    unsigned int comp_size;             /* (cl) size of commpressed data */
-+    unsigned int uncomp_size;           /* (cl) size of uncommpressed data */
-+    char *filename;                     /* (cl) file name (NUL-terminated) */
-+    unsigned short filename_len;        /* (cl) length of filename (w/o NUL) */
-+    char *extrafield;                   /* (cl) extra field */
-+    unsigned short extrafield_len;	/* (cl) length of extra field */
-+    char *comment;                      /* (c)  file comment */
-+    unsigned short comment_len;         /* (c)  length of file comment */
-+    unsigned short disk_number;         /* (c)  disk number start */
-+    unsigned short int_attrib;          /* (c)  internal file attributes */
-+    unsigned int ext_attrib;            /* (c)  external file attributes */
-+    unsigned int offset;                /* (c)  offset of local header  */
-+};
-+
-+/* zip archive central directory */
-+
-+struct zip_cdir {
-+    struct zip_dirent *entry;   /* directory entries */
-+    int nentry;                 /* number of entries */
-+
-+    unsigned int size;          /* size of central direcotry */
-+    unsigned int offset;        /* offset of central directory in file */
-+    char *comment;              /* zip archive comment */
-+    unsigned short comment_len; /* length of zip archive comment */
-+};
-+
-+struct zip_source {
-+    struct zip_source *src;
-+    union {
-+	zip_source_callback f;
-+        zip_source_layered_callback l;
-+    } cb;
-+    void *ud;
-+    enum zip_les error_source;
-+    int is_open;
-+};
-+
-+/* entry in zip archive directory */
-+
-+struct zip_entry {
-+    enum zip_state state;
-+    struct zip_source *source;
-+    char *ch_filename;
-+    char *ch_extra;
-+    int ch_extra_len;
-+    char *ch_comment;
-+    int ch_comment_len;
-+};
-+
-+void _zip_dirent_finalize(struct zip_dirent *zde)
-+{
-+    free(zde->filename);
-+    zde->filename = NULL;
-+    free(zde->extrafield);
-+    zde->extrafield = NULL;
-+    free(zde->comment);
-+    zde->comment = NULL;
-+}
-+
-+void _zip_cdir_free(struct zip_cdir *cd)
-+{
-+    int i;
-+
-+    if (!cd)
-+        return;
-+
-+    for (i=0; i<cd->nentry; i++)
-+        _zip_dirent_finalize(cd->entry+i);
-+    free(cd->comment);
-+    free(cd->entry);
-+    free(cd);
-+}
-+
-+void _zip_error_fini(struct zip_error *err)
-+{
-+    free(err->str);
-+    err->str = NULL;
-+}
-+
-+void _zip_error_init(struct zip_error *err)
-+{
-+    err->zip_err = ZIP_ER_OK;
-+    err->sys_err = 0;
-+    err->str = NULL;
-+}
-+
-+void _zip_unchange_data(struct zip_entry *ze)
-+{
-+    if (ze->source) {
-+        zip_source_free(ze->source);
-+        ze->source = NULL;
-+    }
-+
-+    ze->state = ze->ch_filename ? ZIP_ST_RENAMED : ZIP_ST_UNCHANGED;
-+}
-+
-+void _zip_entry_free(struct zip_entry *ze)
-+{
-+    free(ze->ch_filename);
-+    ze->ch_filename = NULL;
-+    free(ze->ch_extra);
-+    ze->ch_extra = NULL;
-+    ze->ch_extra_len = -1;
-+    free(ze->ch_comment);
-+    ze->ch_comment = NULL;
-+    ze->ch_comment_len = -1;
-+
-+    _zip_unchange_data(ze);
-+}
-+
-+void
-+_zip_error_set(struct zip_error *err, int ze, int se)
-+{
-+    if (err) {
-+	err->zip_err = ze;
-+        err->sys_err = se;
-+    }
-+}
-+
-+void _zip_free(struct zip *za)
-+{
-+    int i;
-+
-+    if (za == NULL)
-+        return;
-+
-+    if (za->zn)
-+        free(za->zn);
-+
-+    if (za->zp)
-+       	fclose(za->zp);
-+
-+    free(za->default_password);
-+    _zip_cdir_free(za->cdir);
-+    free(za->ch_comment);
-+
-+    if (za->entry) {
-+        for (i=0; i<za->nentry; i++) {
-+            _zip_entry_free(za->entry+i);
-+        }
-+        free(za->entry);
-+    }
-+
-+    for (i=0; i<za->nfile; i++) {
-+        if (za->file[i]->error.zip_err == ZIP_ER_OK) {
-+            _zip_error_set(&za->file[i]->error, ZIP_ER_ZIPCLOSED, 0);
-+            za->file[i]->za = NULL;
-+        }
-+    }
-+
-+    free(za->file);
-+    free(za);
-+    return;
-+} 
-+
-+
-+#else
- #include "lib/zip.h"
- #include "lib/zipint.h"
-+#endif
- 
- /* zip_open is a macro for renaming libzip zipopen, so we need to use PHP_NAMED_FUNCTION */
- static PHP_NAMED_FUNCTION(zif_zip_open);
-@@ -1631,6 +1855,10 @@ static ZIPARCHIVE_METHOD(addEmptyDir)
- 	}
- 
- 	idx = zip_stat(intern, s, 0, &sb);
-+	/* We don't care about the NOENT status	error here. */
-+	if (intern->error.zip_err == ZIP_ER_NOENT) {
-+		_zip_error_set(&intern->error, ZIP_ER_OK, 0);
-+	}
- 	if (idx >= 0) {
- 		RETVAL_FALSE;
- 	} else {
-@@ -1853,6 +2081,10 @@ static ZIPARCHIVE_METHOD(addFromString)
- 	}
- 
- 	cur_idx = zip_name_locate(intern, (const char *)name, 0);
-+	/* We don't care about the NOENT status error here. */
-+	if (intern->error.zip_err == ZIP_ER_NOENT) {
-+		_zip_error_set(&intern->error, ZIP_ER_OK, 0);
-+	}
- 	/* TODO: fix  _zip_replace */
- 	if (cur_idx >= 0) {
- 		if (zip_delete(intern, cur_idx) == -1) {
-@@ -2877,5 +3109,9 @@ static PHP_MINFO_FUNCTION(zip)
- 	php_info_print_table_row(2, "Zip version", PHP_ZIP_VERSION_STRING);
--	php_info_print_table_row(2, "Libzip version", LIBZIP_VERSION);
-+#if defined(HAVE_LIBZIP)
-+	php_info_print_table_row(2, "Compiled against libzip version", LIBZIP_VERSION);
-+#else
-+	php_info_print_table_row(2, "Bundled libzip version", LIBZIP_VERSION);
-+#endif
- 
- 	php_info_print_table_end();
- }
-diff -up php-5.4.15/ext/zip/php_zip.h.systzip php-5.4.15/ext/zip/php_zip.h
---- php-5.4.15/ext/zip/php_zip.h.systzip	2013-05-08 07:41:20.000000000 +0200
-+++ php-5.4.15/ext/zip/php_zip.h	2013-05-09 06:46:26.086673656 +0200
-@@ -28,7 +28,11 @@ extern zend_module_entry zip_module_entr
- #include "TSRM.h"
- #endif
- 
-+#if defined(HAVE_LIBZIP)
-+#include <zip.h>
-+#else
- #include "lib/zip.h"
-+#endif
- 
- #define PHP_ZIP_VERSION_STRING "1.11.0"
- 
-diff -up php-5.4.15/ext/zip/tests/bug38943.phpt.systzip php-5.4.15/ext/zip/tests/bug38943.phpt
---- php-5.4.15/ext/zip/tests/bug38943.phpt.systzip	2013-05-08 07:41:20.000000000 +0200
-+++ php-5.4.15/ext/zip/tests/bug38943.phpt	2013-05-09 06:46:26.088673667 +0200
-@@ -27,7 +27,7 @@ array(1) {
-   [0]=>
-   int(1)
- }
--object(myZip)#1 (%d) {
-+object(myZip)#%d (%d) {
-   ["test":"myZip":private]=>
-   int(0)
-   ["testp"]=>
-diff -up php-5.4.15/ext/zip/tests/pecl12414.phpt.systzip php-5.4.15/ext/zip/tests/pecl12414.phpt
---- php-5.4.15/ext/zip/tests/pecl12414.phpt.systzip	2013-05-08 07:41:20.000000000 +0200
-+++ php-5.4.15/ext/zip/tests/pecl12414.phpt	2013-05-09 06:46:26.088673667 +0200
-@@ -5,6 +5,8 @@ Bug #12414 ( extracting files from damag
- /*$ */
- if(!extension_loaded('zip')) die('skip');
-  ?>
-+--XFAIL--
-+Doesn't work with system libzip (zip_readfile could not read from ...)
- --FILE--
- <?php
- $filename = 'MYLOGOV2.GFX';
-diff -up php-5.4.15/ext/zip/zip_stream.c.systzip php-5.4.15/ext/zip/zip_stream.c
---- php-5.4.15/ext/zip/zip_stream.c.systzip	2013-05-08 07:41:20.000000000 +0200
-+++ php-5.4.15/ext/zip/zip_stream.c	2013-05-09 06:46:26.088673667 +0200
-@@ -6,7 +6,11 @@
- #if HAVE_ZIP
- #ifdef ZEND_ENGINE_2
- 
-+#if defined(HAVE_LIBZIP)
-+#include <zip.h>
-+#else
- #include "lib/zip.h"
-+#endif
- 
- #include "php_streams.h"
- #include "ext/standard/file.h"
diff --git a/php-5.4.16-iniscan.patch b/php-5.4.16-iniscan.patch
deleted file mode 100644
index 237c09f..0000000
--- a/php-5.4.16-iniscan.patch
+++ /dev/null
@@ -1,159 +0,0 @@
-From da84f3af751aa9bbf76bc22924a488f981d47088 Mon Sep 17 00:00:00 2001
-From: Remi Collet <remi@php.net>
-Date: Wed, 29 Jan 2014 09:53:22 +0100
-Subject: [PATCH] Fixed Request #66574 Allow multiple paths in
- php_ini_scanned_path
-
-php_ini_scanned_path, from --with-config-file-scan-dir option or
-from PHP_INI_SCAN_DIR environment variable allow a single path.
-
-In some case it could be useful to allow multiple.
-
-In the proposed patch, multiple paths are allow, using syntax inspired
-from Unix MANPATH (: separated list, empty string for builtin value).
-
-For example, this allow to use:
-PHP_INI_SCAN_DIR=/foo/php.d:/bar/php.d   php
-PHP_INI_SCAN_DIR=:/myproject/php.d       php
-PHP_INI_SCAN_DIR=/myproject/php.d:       php
-
-Real use case: in SCL for dependent collections where each collection
-provides a separate tree for extensions, libraries and ini files.
----
- NEWS           |   3 ++
- main/php_ini.c | 106 +++++++++++++++++++++++++++++++++------------------------
- 2 files changed, 65 insertions(+), 44 deletions(-)
-
-diff --git a/main/php_ini.c b/main/php_ini.c
-index 1faec68..e20ba4b 100644
---- a/main/php_ini.c
-+++ b/main/php_ini.c
-@@ -613,63 +613,81 @@ int php_init_config(TSRMLS_D)
- 		zend_llist scanned_ini_list;
- 		zend_llist_element *element;
- 		int l, total_l = 0;
-+		char *bufpath, *debpath, *endpath;
-+		int lenpath;
- 
--		if ((ndir = php_scandir(php_ini_scanned_path, &namelist, 0, php_alphasort)) > 0) {
--			zend_llist_init(&scanned_ini_list, sizeof(char *), (llist_dtor_func_t) free_estring, 1);
--			memset(&fh2, 0, sizeof(fh2));
-+		zend_llist_init(&scanned_ini_list, sizeof(char *), (llist_dtor_func_t) free_estring, 1);
-+		memset(&fh2, 0, sizeof(fh2));
- 
--			for (i = 0; i < ndir; i++) {
-+		bufpath = estrdup(php_ini_scanned_path);
-+		for (debpath = bufpath ; debpath ; debpath=endpath) {
-+			endpath = strchr(debpath, DEFAULT_DIR_SEPARATOR);
-+			if (endpath) {
-+				*(endpath++) = 0;
-+			}
-+			if (!debpath[0]) {
-+				/* empty string means default builtin value
-+				   to allow "/foo/phd.d:" or ":/foo/php.d" */
-+				debpath = PHP_CONFIG_FILE_SCAN_DIR;
-+			}
-+			lenpath = strlen(debpath);
- 
--				/* check for any file with .ini extension */
--				if (!(p = strrchr(namelist[i]->d_name, '.')) || (p && strcmp(p, ".ini"))) {
--					free(namelist[i]);
--					continue;
--				}
--				/* Reset active ini section */
--				RESET_ACTIVE_INI_HASH();
-+			if (lenpath > 0 && (ndir = php_scandir(debpath, &namelist, 0, php_alphasort)) > 0) {
- 
--				if (IS_SLASH(php_ini_scanned_path[php_ini_scanned_path_len - 1])) {
--					snprintf(ini_file, MAXPATHLEN, "%s%s", php_ini_scanned_path, namelist[i]->d_name);
--				} else {
--					snprintf(ini_file, MAXPATHLEN, "%s%c%s", php_ini_scanned_path, DEFAULT_SLASH, namelist[i]->d_name);
--				}
--				if (VCWD_STAT(ini_file, &sb) == 0) {
--					if (S_ISREG(sb.st_mode)) {
--						if ((fh2.handle.fp = VCWD_FOPEN(ini_file, "r"))) {
--							fh2.filename = ini_file;
--							fh2.type = ZEND_HANDLE_FP;
--
--							if (zend_parse_ini_file(&fh2, 1, ZEND_INI_SCANNER_NORMAL, (zend_ini_parser_cb_t) php_ini_parser_cb, &configuration_hash TSRMLS_CC) == SUCCESS) {
--								/* Here, add it to the list of ini files read */
--								l = strlen(ini_file);
--								total_l += l + 2;
--								p = estrndup(ini_file, l);
--								zend_llist_add_element(&scanned_ini_list, &p);
-+				for (i = 0; i < ndir; i++) {
-+
-+					/* check for any file with .ini extension */
-+					if (!(p = strrchr(namelist[i]->d_name, '.')) || (p && strcmp(p, ".ini"))) {
-+						free(namelist[i]);
-+						continue;
-+					}
-+					/* Reset active ini section */
-+					RESET_ACTIVE_INI_HASH();
-+
-+					if (IS_SLASH(debpath[lenpath - 1])) {
-+						snprintf(ini_file, MAXPATHLEN, "%s%s", debpath, namelist[i]->d_name);
-+					} else {
-+						snprintf(ini_file, MAXPATHLEN, "%s%c%s", debpath, DEFAULT_SLASH, namelist[i]->d_name);
-+					}
-+					if (VCWD_STAT(ini_file, &sb) == 0) {
-+						if (S_ISREG(sb.st_mode)) {
-+							if ((fh2.handle.fp = VCWD_FOPEN(ini_file, "r"))) {
-+								fh2.filename = ini_file;
-+								fh2.type = ZEND_HANDLE_FP;
-+
-+								if (zend_parse_ini_file(&fh2, 1, ZEND_INI_SCANNER_NORMAL, (zend_ini_parser_cb_t) php_ini_parser_cb, &configuration_hash TSRMLS_CC) == SUCCESS) {
-+									/* Here, add it to the list of ini files read */
-+									l = strlen(ini_file);
-+									total_l += l + 2;
-+									p = estrndup(ini_file, l);
-+									zend_llist_add_element(&scanned_ini_list, &p);
-+								}
- 							}
- 						}
- 					}
-+					free(namelist[i]);
- 				}
--				free(namelist[i]);
-+				free(namelist);
- 			}
--			free(namelist);
-+		}
-+		efree(bufpath);
- 
--			if (total_l) {
--				int php_ini_scanned_files_len = (php_ini_scanned_files) ? strlen(php_ini_scanned_files) + 1 : 0;
--				php_ini_scanned_files = (char *) realloc(php_ini_scanned_files, php_ini_scanned_files_len + total_l + 1);
--				if (!php_ini_scanned_files_len) {
--					*php_ini_scanned_files = '\0';
--				}
--				total_l += php_ini_scanned_files_len;
--				for (element = scanned_ini_list.head; element; element = element->next) {
--					if (php_ini_scanned_files_len) {
--						strlcat(php_ini_scanned_files, ",\n", total_l);
--					}
--					strlcat(php_ini_scanned_files, *(char **)element->data, total_l);
--					strlcat(php_ini_scanned_files, element->next ? ",\n" : "\n", total_l);
-+		if (total_l) {
-+			int php_ini_scanned_files_len = (php_ini_scanned_files) ? strlen(php_ini_scanned_files) + 1 : 0;
-+			php_ini_scanned_files = (char *) realloc(php_ini_scanned_files, php_ini_scanned_files_len + total_l + 1);
-+			if (!php_ini_scanned_files_len) {
-+				*php_ini_scanned_files = '\0';
-+			}
-+			total_l += php_ini_scanned_files_len;
-+			for (element = scanned_ini_list.head; element; element = element->next) {
-+				if (php_ini_scanned_files_len) {
-+					strlcat(php_ini_scanned_files, ",\n", total_l);
- 				}
-+				strlcat(php_ini_scanned_files, *(char **)element->data, total_l);
-+				strlcat(php_ini_scanned_files, element->next ? ",\n" : "\n", total_l);
- 			}
--			zend_llist_destroy(&scanned_ini_list);
- 		}
-+		zend_llist_destroy(&scanned_ini_list);
- 	} else {
- 		/* Make sure an empty php_ini_scanned_path ends up as NULL */
- 		php_ini_scanned_path = NULL;
--- 
-1.8.4.3
-
diff --git a/php.spec b/php.spec
index 4db6395..133b7cb 100644
--- a/php.spec
+++ b/php.spec
@@ -22,7 +22,7 @@
 %global _hardened_build 1
 
 # Ugly hack. Harcoded values to avoid relocation.
-%global _httpd_mmn         %(cat %{_root_includedir}/httpd/.mmn 2>/dev/null || echo missing-httpd-devel)
+%global _httpd_mmn         %(cat %{_root_includedir}/httpd/.mmn 2>/dev/null || echo 0)
 %global _httpd_confdir     %{_root_sysconfdir}/httpd/conf.d
 %global _httpd_moddir      %{_libdir}/httpd/modules
 %global _root_httpd_moddir %{_root_libdir}/httpd/modules
@@ -1554,8 +1554,8 @@ fi
 %changelog
 * Sun Aug 31 2014 Remi Collet <rcollet@redhat.com> - 5.4.32-1
 - update to 5.4.32
-- cleanup
-- enable most extension
+- cleanup, merge with spec from remi repository
+- enable most extensions
 
 * Tue Feb  4 2014 Remi Collet <rcollet@redhat.com> - 5.4.16-16
 - allow multiple paths in ini_scan_dir #1058162
-- 
cgit