--- Builder.php 2009-05-05 09:41:01.000000000 -0700 +++ Builder.php 2009-05-05 08:43:28.000000000 -0700 @@ -457,7 +457,16 @@ $callback[0]->debug = $olddbg; } - $exitcode = is_resource($pp) ? pclose($pp) : -1; + if (is_resource($pp)) { + $exitcode = pclose($pp); + // If PHP was compiled with --enable-sigchild, pclose() return + // values cannot be trusted. (See http://bugs.php.net/bug.php?id=29123) + if ($this->_hasConfigureSetting('enable-sigchild') && $exitcode == -1) { + $exitcode = 0; + } + } else { + $exitcode = -1; + } return ($exitcode == 0); } @@ -471,4 +480,35 @@ } return PEAR_Common::log($level, $msg); } + + /** + * See if PHP was built with the particular configuration setting. + * Useful for checking whether --enable-sigchild is active; if it + * is, pclose() return values can't be trusted. + * + * @param string $setting the setting to check for. Will automatically + * have any leading dashes stripped. + * + * @return bool whether the setting is present + */ + + function _hasConfigureSetting($setting) { + $setting = preg_replace("/^-+/", '', $setting); + + ob_start(); + phpinfo(1); + $cc = ob_get_clean(); + foreach (explode("\n", $cc) as $line) { + if (array_shift(explode(' => ', $line)) == "Configure Command") { + $config = explode('___', preg_replace("/'\s+'/", "'___'", array_pop(explode(' => ', $line, 2)))); + break; + } + } + foreach ($config as $opt) { + if (false !== strpos($opt, $setting)) { + return true; + } + } + return false; + } } \ No newline at end of file