From: SourceForge.net <no...@so...> - 2010-07-25 15:35:02
|
Feature Requests item #3034311, was opened at 2010-07-25 15:35 Message generated for change (Tracker Item Submitted) made by You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=547458&aid=3034311&group_id=76550 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Unit test framework Group: None Status: Open Priority: 5 Private: No Submitted By: Burton Kent () Assigned to: Nobody/Anonymous (nobody) Summary: Bug Fix for WAMP include paths. Initial Comment: When using Simpletest on WAMP servers, it usually will default to the apache root instead of the script's document root. I discovered this was caused because of how register_shutdown_function() behaves on most (if not all) WAMP. (documented here http://www.php.net/manual/en/function.register-shutdown-function.php#92657) The fix is to recover the original path from $_SERVER variables. This is what works for me: function simpletest_autorun() { if (tests_have_run()) { return; } $script_path = getcwd(); if (isset($_SERVER['DOCUMENT_ROOT'])) { $script_path = $_SERVER['DOCUMENT_ROOT']; } elseif (isset($_SERVER['SCRIPT_FILENAME'])) { $script_path = dirname($_SERVER['SCRIPT_FILENAME']); } chdir($script_path); ... This bug is forcing many people to use absolute paths in include files, or prepend dirname(__FILE__) . to any files for import. Burton ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=547458&aid=3034311&group_id=76550 |