From: <var...@us...> - 2020-04-21 10:58:18
|
Revision: 10169 http://sourceforge.net/p/phpwiki/code/10169 Author: vargenau Date: 2020-04-21 10:58:16 +0000 (Tue, 21 Apr 2020) Log Message: ----------- Upgrade PEAR.php to release 1.10.12 Modified Paths: -------------- trunk/lib/pear/PEAR.php Modified: trunk/lib/pear/PEAR.php =================================================================== --- trunk/lib/pear/PEAR.php 2020-04-21 10:48:14 UTC (rev 10168) +++ trunk/lib/pear/PEAR.php 2020-04-21 10:58:16 UTC (rev 10169) @@ -75,7 +75,7 @@ * @author Greg Beaver <ce...@ph...> * @copyright 1997-2006 The PHP Group * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.10.1 + * @version Release: 1.10.12 * @link http://pear.php.net/package/PEAR * @see PEAR_Error * @since Class available since PHP 4.0.2 @@ -170,7 +170,7 @@ $destructor = "_$classname"; if (method_exists($this, $destructor)) { global $_PEAR_destructor_object_list; - $_PEAR_destructor_object_list[] = &$this; + $_PEAR_destructor_object_list[] = $this; if (!isset($GLOBALS['_PEAR_SHUTDOWN_REGISTERED'])) { register_shutdown_function("_PEAR_call_destructors"); $GLOBALS['_PEAR_SHUTDOWN_REGISTERED'] = true; @@ -450,7 +450,7 @@ } /** - * This method deletes all occurences of the specified element from + * This method deletes all occurrences of the specified element from * the expected error codes stack. * * @param mixed $error_code error code that should be deleted @@ -542,7 +542,7 @@ count($object->_expected_errors) > 0 && count($exp = end($object->_expected_errors)) ) { - if ($exp[0] == "*" || + if ($exp[0] === "*" || (is_int(reset($exp)) && in_array($code, $exp)) || (is_string(reset($exp)) && in_array($message, $exp)) ) { @@ -598,11 +598,11 @@ protected static function _throwError($object, $message = null, $code = null, $userinfo = null) { if ($object !== null) { - $a = &$object->raiseError($message, $code, null, null, $userinfo); + $a = $object->raiseError($message, $code, null, null, $userinfo); return $a; } - $a = &PEAR::raiseError($message, $code, null, null, $userinfo); + $a = PEAR::raiseError($message, $code, null, null, $userinfo); return $a; } @@ -766,6 +766,28 @@ return @dl('php_'.$ext.$suffix) || @dl($ext.$suffix); } + + /** + * Get SOURCE_DATE_EPOCH environment variable + * See https://reproducible-builds.org/specs/source-date-epoch/ + * + * @return int + * @access public + */ + static function getSourceDateEpoch() + { + if ($source_date_epoch = getenv('SOURCE_DATE_EPOCH')) { + if (preg_match('/^\d+$/', $source_date_epoch)) { + return (int) $source_date_epoch; + } else { + // "If the value is malformed, the build process SHOULD exit with a non-zero error code." + self::raiseError("Invalid SOURCE_DATE_EPOCH: $source_date_epoch"); + exit(1); + } + } else { + return time(); + } + } } function _PEAR_call_destructors() @@ -823,7 +845,7 @@ * @author Gregory Beaver <ce...@ph...> * @copyright 1997-2006 The PHP Group * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.10.1 + * @version Release: 1.10.12 * @link http://pear.php.net/manual/en/core.pear.pear-error.php * @see PEAR::raiseError(), PEAR::throwError() * @since Class available since PHP 4.0.2 @@ -914,7 +936,8 @@ } else { $format = $options; } - die(sprintf($format, $msg)); + printf($format, $msg); + exit($code); } if ($this->mode & PEAR_ERROR_CALLBACK && is_callable($this->callback)) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |