Bug #74656 [NEW]: php -m command gives unreadable output when run via exec()

From: Date: Fri, 26 May 2017 09:52:05 +0000
Subject: Bug #74656 [NEW]: php -m command gives unreadable output when run via exec()
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-209265@lists.php.net to get a copy of this message
From:             frederik at how2 dot be
Operating system: CentOS 7.3
PHP version:      7.0.19
Package:          PHP options/info functions
Bug Type:         Bug
Bug description:php -m command gives unreadable output when run via exec()

Description:
------------
When I run the command "php -m" using:
- the exec function
- the shell_exec function
- a perl equivalent of the above

The output is unreadable like this:
OUT:Array ( [1] =>
�EQ�n�0��W���CED�RUȱ7���.����á�G^{f|�޻�]rWO������)ؤB���Z���%�����y���8�5J�f�#�ҬC�dd�o�`28�ǯ���/$��RƁC�����ĪZ�iŞI���띯5-Y�d\Q(
�t�ȏ�ݹ�a]M@�Z�m�{��\M=8�Q���5������V��
) 
RET:0

Other command such as "php --version" and executing the same on PHP
5.6.30 work fine.
The get_loaded_extensions function also works fine.
also tried running it with --no-php-ini but got the same result.

I can reproduce this on 2 servers with PHP 7.0.19.

Test script:
---------------
exec($bin.' --version', $extout, $extret);
echo '<br />OUT:';
print_r($extout);
echo '<br />RET:';
print_r($extret);


-- 
Edit bug report at https://bugs.php.net/bug.php?id=74656&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=74656&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=74656&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=74656&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=74656&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=74656&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=74656&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=74656&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=74656&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=74656&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=74656&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=74656&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=74656&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=74656&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74656&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=74656&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=74656&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=74656&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=74656&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=74656&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=74656&r=mysqlcfg



Thread (3 messages)

« previous php.bugs (#209265) next »