cvs: pear-core / System.php

From: Date: Thu, 10 Jul 2008 22:28:56 +0000
Subject: cvs: pear-core / System.php
Groups: php.pear.cvs php.pear.core 
Request: Send a blank email to pear-core+get-7623@lists.php.net to get a copy of this message
dufuz Thu Jul 10 22:28:56 2008 UTC Modified files: /pear-core System.php Log: Bug #14041 Unpredictable unit test processing sequence # array_merge_recursive wasn't using $struct as base, using natsort instead of sort http://cvs.php.net/viewvc.cgi/pear-core/System.php?r1=1.62&r2=1.63&diff_format=u Index: pear-core/System.php diff -u pear-core/System.php:1.62 pear-core/System.php:1.63 --- pear-core/System.php:1.62 Thu Jan 3 20:26:34 2008 +++ pear-core/System.php Thu Jul 10 22:28:56 2008 @@ -15,7 +15,7 @@ * @author Tomas V.V.Cox <cox@idecnet.com> * @copyright 1997-2008 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version CVS: $Id: System.php,v 1.62 2008/01/03 20:26:34 cellog Exp $ + * @version CVS: $Id: System.php,v 1.63 2008/07/10 22:28:56 dufuz Exp $ * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ @@ -60,7 +60,7 @@ * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 0.1 -* @static +* @static */ class System { @@ -71,7 +71,7 @@ * @param string $short_options the allowed option short-tags * @param string $long_options the allowed option long-tags * @return array the given options and there values - * @static + * @static * @access private */ function _parseArgs($argv, $short_options, $long_options = null) @@ -88,7 +88,7 @@ * * @param mixed $error a PEAR error or a string with the error message * @return bool false - * @static + * @static * @access private */ function raiseError($error) @@ -122,7 +122,7 @@ * @param integer $aktinst starting deep of the lookup * @param bool $silent if true, do not emit errors. * @return array the structure of the dir - * @static + * @static * @access private */ @@ -135,6 +135,7 @@ } return $struct; // XXX could not open error } + $struct['dirs'][] = $sPath = realpath($sPath); // XXX don't add if '.' or '..' ? $list = array(); while (false !== ($file = readdir($dir))) { @@ -142,19 +143,21 @@ $list[] = $file; } } + closedir($dir); - sort($list); + natsort($list); if ($aktinst < $maxinst || $maxinst == 0) { foreach ($list as $val) { $path = $sPath . DIRECTORY_SEPARATOR . $val; if (is_dir($path) && !is_link($path)) { - $tmp = System::_dirToStruct($path, $maxinst, $aktinst+1, $silent); - $struct = array_merge_recursive($tmp, $struct); + $tmp = System::_dirToStruct($path, $maxinst, $aktinst+1, $silent); + $struct = array_merge_recursive($struct, $tmp); } else { $struct['files'][] = $path; } } } + return $struct; } @@ -163,7 +166,7 @@ * * @param array $files Array listing files and dirs * @return array - * @static + * @static * @see System::_dirToStruct() */ function _multipleToStruct($files) @@ -187,7 +190,7 @@ * * @param string $args the arguments for rm * @return mixed PEAR_Error or true for success - * @static + * @static * @access public */ function rm($args) @@ -231,7 +234,7 @@ * The -p option will create parent directories * @param string $args the name of the director(y|ies) to create * @return bool True for success - * @static + * @static * @access public */ function mkDir($args) @@ -297,7 +300,7 @@ * * @param string $args the arguments * @return boolean true on success - * @static + * @static * @access public */ function &cat($args) @@ -371,7 +374,7 @@ * @param string $args The arguments * @return mixed the full path of the created (file|dir) or false * @see System::tmpdir() - * @static + * @static * @access public */ function mktemp($args = null) @@ -414,7 +417,7 @@ * Remove temporary files created my mkTemp. This function is executed * at script shutdown time * - * @static + * @static * @access private */ function _removeTmpFiles() @@ -433,7 +436,7 @@ * Note: php.ini-recommended removes the "E" from the variables_order setting, * making unavaible the $_ENV array, that s why we do tests with _ENV * - * @static + * @static * @return string The temporary directory on the system */ function tmpdir() @@ -466,7 +469,7 @@ * @param mixed $fallback Value to return if $program is not found * * @return mixed A string with the full path or false if not found - * @static + * @static * @author Stig Bakken <ssb@php.net> */ function which($program, $fallback = false) @@ -538,7 +541,7 @@ * * @param mixed Either array or string with the command line * @return array Array of found files - * @static + * @static * */ function find($args)

« previous php.pear.core (#7623) next »