Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.10.16

Bug #11936 run-tests fails to preserve SYSTEMROOT environment variable
Submitted: 2007-08-30 04:24 UTC
From: lukasfeiler Assigned: cellog
Status: Closed Package: PEAR (version CVS)
PHP Version: 5.2.3 OS: Windows XP
Roadmaps: 1.6.2    
Subscription  


 [2007-08-30 04:24 UTC] lukasfeiler (Lukas Feiler)
Description: ------------ Due to changes introduced in RunTest.php v1.25 (Fri Feb 16 05:36:57 2007 UTC) phpt unit tests ran using "pear run-tests" have no SYSTEMROOT environment variable available. For reasons I was unable to resolve mysql connections will fail without SYSTEMROOT - with the error message "Can't create TCP/IP socket (10106)" The system_with_timeout() function introduced RunTest.php v1.25 uses proc_open() and expressly sets the environment based on the contents of $_ENV. The problem is that if the php.ini variables_order option does not contain "E" $_ENV will be empty. Attached is a patch to RunTest.php v1.52. Test script: --------------- --TEST-- check for "Can't create TCP/IP socket (10106)" error --FILE-- <?php $success = mysql_connect('localhost', 'root', ''); ?> --EXPECT-- Actual result: -------------- Warning: mysql_connect(): Can't create TCP/IP socket (10106) in /tmp/test.php on line 2

Comments

 [2007-08-30 05:30 UTC] lukasfeiler (Lukas Feiler)
I just realized that the problem of course goes beyond SYSTEMROOT. Whatever environment variables one might want to use to influence a unit test will not be passed! I'm currently using an environment variable to set the DSN used for database dependent unit tests.
 [2007-09-03 02:59 UTC] cellog (Greg Beaver)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better. The only way around this is to manually enable EGPCS when running the PEAR command. Fortunately, this is easy to do, we just add -d variables_order=EGPCS to pear.sh and voila - there's your environment.