Skip to content
Permalink
Browse files

Fix #77609: Tests from mailparse extension fails

Add installed php extensions to temporary created ini file

In php extensions configured with phpize, a temporarily generated
php.ini is used for testing, but currently contains no installed
PHP extensions, which is required by the mailparse extension,
for example.

Installed extensions must be added with their absolute path,
because the extension_dir parameter is already occupied.

See https://bugs.php.net/bug.php?id=77609
  • Loading branch information...
rhabacker authored and petk committed Mar 1, 2019
1 parent 5025eb0 commit 3ead67239419632eecb83f0f101ead2021ee6c14
Showing with 4 additions and 3 deletions.
  1. +4 −3 Makefile.global
@@ -83,20 +83,21 @@ PHP_TEST_SHARED_EXTENSIONS = ` \
. $$i; $(top_srcdir)/build/shtool echo -n -- " -d $(ZEND_EXT_TYPE)=$(top_builddir)/modules/$$dlname"; \
done; \
fi`
PHP_DEPRECATED_DIRECTIVES_REGEX = '^(magic_quotes_(gpc|runtime|sybase)?|(zend_)?extension(_debug)?(_ts)?)[\t\ ]*='
PHP_FILTERED_DIRECTIVES_REGEX = '^(magic_quotes_(gpc|runtime|sybase)?|zend_extension(_debug)?(_ts)?)[\t\ ]*='
PHP_EXTENSION_PATH_FIX_REGEX = "/^extension *= *[^/]/s,extension *= *,extension=$(EXTENSION_DIR)/,g"

test: all
@if test ! -z "$(PHP_EXECUTABLE)" && test -x "$(PHP_EXECUTABLE)"; then \
INI_FILE=`$(PHP_EXECUTABLE) -d 'display_errors=stderr' -r 'echo php_ini_loaded_file();' 2> /dev/null`; \
if test "$$INI_FILE"; then \
$(EGREP) -h -v $(PHP_DEPRECATED_DIRECTIVES_REGEX) "$$INI_FILE" > $(top_builddir)/tmp-php.ini; \
$(EGREP) -h -v $(PHP_FILTERED_DIRECTIVES_REGEX) "$$INI_FILE" | $(SED) $(PHP_EXTENSION_PATH_FIX_REGEX) > $(top_builddir)/tmp-php.ini; \
else \
echo > $(top_builddir)/tmp-php.ini; \
fi; \
INI_SCANNED_PATH=`$(PHP_EXECUTABLE) -d 'display_errors=stderr' -r '$$a = explode(",\n", trim(php_ini_scanned_files())); echo $$a[0];' 2> /dev/null`; \
if test "$$INI_SCANNED_PATH"; then \
INI_SCANNED_PATH=`$(top_srcdir)/build/shtool path -d $$INI_SCANNED_PATH`; \
$(EGREP) -h -v $(PHP_DEPRECATED_DIRECTIVES_REGEX) "$$INI_SCANNED_PATH"/*.ini >> $(top_builddir)/tmp-php.ini; \
$(EGREP) -h -v $(PHP_FILTERED_DIRECTIVES_REGEX) "$$INI_SCANNED_PATH"/*.ini | $(SED) $(PHP_EXTENSION_PATH_FIX_REGEX) >> $(top_builddir)/tmp-php.ini; \
fi; \
TEST_PHP_EXECUTABLE=$(PHP_EXECUTABLE) \
TEST_PHP_SRCDIR=$(top_srcdir) \

3 comments on commit 3ead672

@remicollet

This comment has been minimized.

Copy link
Contributor

replied Mar 20, 2019

This is wrong and breaks everything

All build of extension start failing.
Ex:


BUILDSTDERR: PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/bz2' (tried: /usr/lib64/php/modules/bz2 (/usr/lib64/php/modules/bz2: cannot open shared object file: No such file or directory), /usr/lib64/php/modules//usr/lib64/php/modules/bz2.so (/usr/lib64/php/modules//usr/lib64/php/modules/bz2.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
BUILDSTDERR: PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/calendar' (tried: /usr/lib64/php/modules/calendar (/usr/lib64/php/modules/calendar: cannot open shared object file: No such file or directory), /usr/lib64/php/modules//usr/lib64/php/modules/calendar.so (/usr/lib64/php/modules//usr/lib64/php/modules/calendar.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
BUILDSTDERR: PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/ctype' (tried: /usr/lib64/php/modules/ctype (/usr/lib64/php/modules/ctype: cannot open shared object file: No such file or directory), /usr/lib64/php/modules//usr/lib64/php/modules/ctype.so (/usr/lib64/php/modules//usr/lib64/php/modules/ctype.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
BUILDSTDERR: PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/curl' (tried: /usr/lib64/php/modules/curl (/usr/lib64/php/modules/curl: cannot open shared object file: No such file or directory), /usr/lib64/php/modules//usr/lib64/php/modules/curl.so (/usr/lib64/php/modules//usr/lib64/php/modules/curl.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
BUILDSTDERR: PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/dom' (tried: /usr/lib64/php/modules/dom (/usr/lib64/php/modules/dom: cannot open shared object file: No such file or directory), /usr/lib64/php/modules//usr/lib64/php/modules/dom.so (/usr/lib64/php/modules//usr/lib64/php/modules/dom.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
BUILDSTDERR: PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/exif' (tried: /usr/lib64/php/modules/exif (/usr/lib64/php/modules/exif: cannot open shared object file: No such file or directory), /usr/lib64/php/modules//usr/lib64/php/modules/exif.so (/usr/lib64/php/modules//usr/lib64/php/modules/exif.so: cannot open shared object file: No such file or 
...
@remicollet

This comment has been minimized.

Copy link
Contributor

replied Mar 20, 2019

Some issues with current implementation

  • missing .so suffix which is optional but mandatory when full patch is given
  • if tested extension is installed, it will be enabled, and thus, load twice
  • breaks "make test" of PHP itself, when PHP already installed
@remicollet

This comment has been minimized.

Copy link
Contributor

replied Mar 20, 2019

This have been reverted.

Please sign in to comment.
You can’t perform that action at this time.