php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77609 Tests from mailparse extension fails
Submitted: 2019-02-12 22:18 UTC Modified: 2019-03-20 08:52 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: ralf dot habacker at freenet dot de Assigned:
Status: Closed Package: *Mail Related
PHP Version: Irrelevant OS: linux
Private report: No CVE-ID: None
 [2019-02-12 22:18 UTC] ralf dot habacker at freenet dot de
Description:
------------
Running tests from mailparse extensions are skipped because a run time dependency is missing.

Build complete.
Don't forget to run 'make test'.

make test
PHP Warning:  Cannot load module 'mailparse' because required module 'mbstring' is not loaded in Unknown on line 0
PHP Warning:  Cannot load module 'mailparse' because required module 'mbstring' is not loaded in Unknown on line 0

PHP_SAPI    : cli
PHP_VERSION : 7.0.7
ZEND_VERSION: 3.0.0
PHP_OS      : Linux - Linux bramsche.habacker.de 4.4.165-81-default #1 SMP Mon Dec 3 07:47:23 UTC 2018 (0bfc9ed) x86_64
INI actual  : /home/ralf/src/pecl-mail-mailparse-build/tmp-php.ini
More .INIs  :   
CWD         : /home/ralf/src/pecl-mail-mailparse
Extra dirs  : 
VALGRIND    : Not used
=====================================================================
TIME START 2019-02-12 22:02:15
=====================================================================
SKIP Check for mailparse presence [tests/001.phpt] 
SKIP Check stream encoding [tests/002.phpt] 
SKIP Check handling of multiple To headers [tests/003.phpt] 
SKIP Check uudecode_all [tests/004.phpt] 
SKIP Check quoted-printable encoding generates S/MIME safe content [tests/005.phpt] 
SKIP Check extract_part_file [tests/006.phpt] 
SKIP Check RFC822 Conformance [tests/007.phpt] 
SKIP OO API Segfault when opening a file is not possible [tests/008.phpt] 
SKIP Multiple UUE attachments not recognized [tests/009.phpt] 
SKIP Multiple headers not parsed into arra bug #6862 [tests/010.phpt] 
SKIP Check mailparse_determine_best_xfer_encoding [tests/011.phpt] 
SKIP Check mailparse_mimemessage_extract_uue [tests/012.phpt] 
SKIP Check mailparse_mimemessage_extract_uue [tests/013.phpt] 
SKIP mailparse_msg_free causes double free segfault [tests/bug001.phpt] 
SKIP Parse messages in testdata dir [tests/parse_test_messages.phpt] 
=====================================================================
TIME END 2019-02-12 22:02:16



Expected result:
----------------
The tests should should find the required mbstring extension

Actual result:
--------------
The tests could not be started because a required dependency is missing.

Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-02-12 22:32 UTC] requinix@php.net
-Status: Open +Status: Feedback
 [2019-02-12 22:32 UTC] requinix@php.net
Maybe I'm missing something important, but did you actually build PHP with mbstring support? Does php -m list mbstring?
 [2019-02-12 23:56 UTC] ralf dot habacker at freenet dot de
-Status: Feedback +Status: Open
 [2019-02-12 23:56 UTC] ralf dot habacker at freenet dot de
> Maybe I'm missing something important, but did you actually build PHP with mbstring support? 
yes
> Does php -m list mbstring?
yes

The problem is that running 'make test' in a phpize'd build creates a custom php ini file not including the installed extensions. In principal there is code to include installed php related config files (see https://github.com/php/php-src/blob/master/Makefile.global#L99), but extensions are excluded by PHP_DEPRECATED_DIRECTIVES_REGEX, which is 

Makefile:130:PHP_DEPRECATED_DIRECTIVES_REGEX = '^(magic_quotes_(gpc|runtime|sybase)?|(zend_)?extension(_debug)?(_ts)?)[\t\ ]*='
 [2019-02-12 23:59 UTC] ralf dot habacker at freenet dot de
The definition of PHP_DEPRECATED_DIRECTIVES_REGEX is https://github.com/php/php-src/blob/6e3600f41b95d97d11ef48f817e6389a4ee95091/Makefile.global#L86
 [2019-02-13 00:15 UTC] ralf dot habacker at freenet dot de
> PHP_DEPRECATED_DIRECTIVES_REGEX = '^(magic_quotes_(gpc|runtime|sybase)?|(zend_)?extension(_debug)?(_ts)?)[\t\ ]*='

Was the intention perhaps to exclude (zend_extension|extension_debug)?

Changing this lead to the next issue:

 At https://github.com/php/php-src/blob/dd8e59da8f5aafd9d77a0f1f17e5e272d09f643f/Makefile.global#L100 there is php called with -d extension_dir=.. expecting installed extensions in a local build dir.

Running make test now returns

Warning: PHP Startup: Unable to load dynamic library '/home/ralf/src/pecl-mail-mailparse-build/modules/pdo.so' - /home/ralf/src/pecl-mail-mailparse-build/modules/pdo.so: cannot open shared object file: No such file or directory in Unknown on line 0
 [2019-02-28 22:46 UTC] petk@php.net
The following pull request has been associated:

Patch Name: Add installed php extensions to temporary created ini file
On GitHub:  https://github.com/php/php-src/pull/3898
Patch:      https://github.com/php/php-src/pull/3898.patch
 [2019-03-01 21:46 UTC] petk@php.net
Automatic comment on behalf of ralf.habacker@freenet.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=3ead67239419632eecb83f0f101ead2021ee6c14
Log: Fix #77609: Tests from mailparse extension fails
 [2019-03-01 21:46 UTC] petk@php.net
-Status: Open +Status: Closed
 [2019-03-20 08:52 UTC] remi@php.net
-Status: Closed +Status: Re-Opened
 [2019-03-20 08:52 UTC] remi@php.net
re-opened as current fix breaks everything.
See comment on https://github.com/php/php-src/commit/3ead67239419632eecb83f0f101ead2021ee6c14
 [2019-03-20 10:56 UTC] remi@php.net
Automatic comment on behalf of remi
Revision: http://git.php.net/?p=php-src.git;a=commit;h=32e7b0864ca1e5094ecea73641c4dc87bcdaa684
Log: Revert "Fix #77609: Tests from mailparse extension fails"
 [2019-03-20 10:56 UTC] remi@php.net
-Status: Re-Opened +Status: Closed
 [2019-03-20 11:22 UTC] remi@php.net
Automatic comment on behalf of remi
Revision: http://git.php.net/?p=php-src.git;a=commit;h=eb279fdb16405acc55ac9376b2dc109e1eda865c
Log: Revert "Fix #77609: Tests from mailparse extension fails"
 [2019-03-20 15:12 UTC] cmb@php.net
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=5b7a781a5d49854d9e3abf7944b478d0d98d6c5e
Log: Revert "Fix #77609: Tests from mailparse extension fails"
 [2019-03-21 13:39 UTC] remi@php.net
The proper way to loaded shared dependent extension is to use the --EXTENSIONS-- section in phpt files.

Ok, this have some issues with load order, especially when PHP is built with RTLD_NOW (common option on Linux distribution)

So another working way is to define TEST_PHP_ARGS in the environment before running the test suite

Example:

export TEST_PHP_EXECUTABLE=$(which php)
export TEST_PHP_ARGS="-n -d extension=mbstring.so -d extension=modules/mailparse.so"
php run-tests.php --show-diff


So I think it is better to keep current situation, and don't try to fix a not real issue.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 13:01:29 2024 UTC