diff options
| author | Marcus Boerger <helly@php.net> | 2006-11-03 18:58:41 +0000 | 
|---|---|---|
| committer | Marcus Boerger <helly@php.net> | 2006-11-03 18:58:41 +0000 | 
| commit | 76ba475d7604f9ef521ee0e7d19685698a925204 (patch) | |
| tree | 1e24b44ec53428cdb988d293f196964f22daef05 | |
| parent | 76b73a6ff29d71bbbb400b4a64afd1737745a111 (diff) | |
| download | php-git-76ba475d7604f9ef521ee0e7d19685698a925204.tar.gz | |
- MFH: Synch
| -rwxr-xr-x | ext/spl/examples/directoryfilterdots.inc | 6 | ||||
| -rwxr-xr-x | ext/spl/internal/recursiveiteratoriterator.inc | 6 | ||||
| -rwxr-xr-x | ext/spl/php_spl.c | 6 | ||||
| -rwxr-xr-x | ext/spl/php_spl.h | 1 | ||||
| -rwxr-xr-x | ext/spl/tests/spl_autoload_009.phpt | 28 | 
5 files changed, 41 insertions, 6 deletions
diff --git a/ext/spl/examples/directoryfilterdots.inc b/ext/spl/examples/directoryfilterdots.inc index fceeda2a23..26896e7cd5 100755 --- a/ext/spl/examples/directoryfilterdots.inc +++ b/ext/spl/examples/directoryfilterdots.inc @@ -4,7 +4,7 @@   * @ingroup Examples   * @brief class DirectoryFilterDots   * @author  Marcus Boerger - * @date    2003 - 2005 + * @date    2003 - 2006   *   * SPL - Standard PHP Library   */ @@ -12,7 +12,7 @@  /** @ingroup Examples   * @brief   A filtered DirectoryIterator   * @author  Marcus Boerger - * @version 1.1 + * @version 1.2   *   * This Iteraotr takes a pathname from which it creates a DirectoryIterator   * and makes it recursive. Further more it filters the entries '.' and '..'. @@ -24,7 +24,7 @@ class DirectoryFilterDots extends RecursiveFilterIterator  	 */  	function __construct($path)  	{ -		parent::__construct(new DirectoryIterator($path)); +		parent::__construct(new RecursiveDirectoryIterator($path));  	}  	/** @return whether the current entry is neither '.' nor '..' diff --git a/ext/spl/internal/recursiveiteratoriterator.inc b/ext/spl/internal/recursiveiteratoriterator.inc index 716ab475ff..03c76394d1 100755 --- a/ext/spl/internal/recursiveiteratoriterator.inc +++ b/ext/spl/internal/recursiveiteratoriterator.inc @@ -217,7 +217,7 @@ class RecursiveIteratorIterator implements OuterIterator  			if ($after_move)  			{  				if (($this->mode == self::SELF_FIRST && $this->callHasChildren()) -				     $this->mode == self::LEAVES_ONLY) +				||   $this->mode == self::LEAVES_ONLY)  				$this->nextElement();  			}  			else @@ -229,7 +229,9 @@ class RecursiveIteratorIterator implements OuterIterator  	/** Called when the next element is available  	 */ -	function nextElement(); +	function nextElement() +	{ +	}  }  ?>
\ No newline at end of file diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c index cbe176caae..75ea892658 100755 --- a/ext/spl/php_spl.c +++ b/ext/spl/php_spl.c @@ -57,6 +57,7 @@ static PHP_GINIT_FUNCTION(spl)  {  	spl_globals->autoload_extensions = NULL;  	spl_globals->autoload_functions  = NULL; +	spl_globals->autoload_running    = 0;  }  /* }}} */ @@ -305,7 +306,7 @@ PHP_FUNCTION(spl_autoload)  	EG(active_op_array) = original_active_op_array;  	EG(function_state_ptr) = original_function_state_ptr; -	if (!found) { +	if (!found && !SPL_G(autoload_running)) {  		zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Class %s could not be loaded", class_name);  	}  } /* }}} */ @@ -361,6 +362,8 @@ PHP_FUNCTION(spl_autoload_call)  	}  	if (SPL_G(autoload_functions)) { +		int l_autoload_running = SPL_G(autoload_running); +		SPL_G(autoload_running) = 1;  		class_name_len = Z_STRLEN_P(class_name);  		lc_name = zend_str_tolower_dup(Z_STRVAL_P(class_name), class_name_len);  		zend_hash_internal_pointer_reset_ex(SPL_G(autoload_functions), &function_pos); @@ -377,6 +380,7 @@ PHP_FUNCTION(spl_autoload_call)  			zend_hash_move_forward_ex(SPL_G(autoload_functions), &function_pos);  		}  		efree(lc_name); +		SPL_G(autoload_running) = l_autoload_running;  	} else {  		/* do not use or overwrite &EG(autoload_func) here */  		zend_call_method_with_1_params(NULL, NULL, NULL, "spl_autoload", NULL, class_name); diff --git a/ext/spl/php_spl.h b/ext/spl/php_spl.h index 4e8c9b3f7d..fd8e5cb8b9 100755 --- a/ext/spl/php_spl.h +++ b/ext/spl/php_spl.h @@ -58,6 +58,7 @@ PHP_MINFO_FUNCTION(spl);  ZEND_BEGIN_MODULE_GLOBALS(spl)  	char *       autoload_extensions;  	HashTable *  autoload_functions; +	int          autoload_running;  ZEND_END_MODULE_GLOBALS(spl)  #ifdef ZTS diff --git a/ext/spl/tests/spl_autoload_009.phpt b/ext/spl/tests/spl_autoload_009.phpt new file mode 100755 index 0000000000..c282bf4452 --- /dev/null +++ b/ext/spl/tests/spl_autoload_009.phpt @@ -0,0 +1,28 @@ +--TEST-- +SPL: spl_autoload() and friends +--SKIPIF-- +<?php if (!extension_loaded("spl")) print "skip"; ?> +--INI-- +include_path=. +--FILE-- +<?php + +function my_autoload($name) +{ +	require $name . '.class.inc'; +	var_dump(class_exists($name)); +} + +spl_autoload_register("spl_autoload"); +spl_autoload_register("my_autoload"); + +$obj = new testclass; + +?> +===DONE=== +<?php exit(0); ?> +--EXPECTF-- +%stestclass.inc +%stestclass.class.inc +bool(true) +===DONE===  | 
