helly Sat Mar 4 22:56:11 2006 UTC
Modified files:
/php-src/ext/spl spl.php spl_directory.c
Log:
- Need to change a few things to exception based error handling
- Drop erroneus/useless RecursiveDirectoryIterator::getSubPathInfo()
http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/spl.php?r1=1.71&r2=1.72&diff_format=u
Index: php-src/ext/spl/spl.php
diff -u php-src/ext/spl/spl.php:1.71 php-src/ext/spl/spl.php:1.72
--- php-src/ext/spl/spl.php:1.71 Tue Feb 21 23:21:53 2006
+++ php-src/ext/spl/spl.php Sat Mar 4 22:56:11 2006
@@ -948,8 +948,8 @@
*/
function setFileClass(string class_name = "SplFileObject") {/**/}
- /** @param class_name name of class used with getFileInfo(),
getPathInfo(),
- * getSubPathInfo(). Must be derived from
SplFileInfo.
+ /** @param class_name name of class used with getFileInfo(),
getPathInfo().
+ * Must be derived from SplFileInfo.
*/
function setInfoClass(string class_name = "SplFileInfo") {/**/}
}
@@ -1041,13 +1041,6 @@
/** @return the current sub path
*/
function getSubPathname() {/**/}
-
- /** @return SplFileInfo created for the current sub path
- * @param class_name name of class to instantiate
- * @see SplFileInfo::setInfoClass()
- */
- function getSubPathInfo(string $class_name = NULL) {/**/}
-
}
/** @ingroup SPL
http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/spl_directory.c?r1=1.78&r2=1.79&diff_format=u
Index: php-src/ext/spl/spl_directory.c
diff -u php-src/ext/spl/spl_directory.c:1.78
php-src/ext/spl/spl_directory.c:1.79
--- php-src/ext/spl/spl_directory.c:1.78 Mon Feb 27 22:31:07 2006
+++ php-src/ext/spl/spl_directory.c Sat Mar 4 22:56:11 2006
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_directory.c,v 1.78 2006/02/27 22:31:07 helly Exp $ */
+/* $Id: spl_directory.c,v 1.79 2006/03/04 22:56:11 helly Exp $ */
#ifdef HAVE_CONFIG_H
# include "config.h"
@@ -748,26 +748,30 @@
spl_filesystem_object *intern =
(spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
zend_class_entry *ce = spl_ce_SplFileObject;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|C", &ce) ==
FAILURE) {
- return;
+ php_set_error_handling(EH_THROW, spl_ce_UnexpectedValueException
TSRMLS_CC);
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|C", &ce) ==
SUCCESS) {
+ intern->file_class = ce;
}
- intern->file_class = ce;
+ php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
}
/* }}} */
/* {{{ proto SplFileObject SplFileInfo::setInfoClass([string class_name])
- Class to use in getFileInfo(), getPathInfo(), getSubPathInfo() */
+ Class to use in getFileInfo(), getPathInfo() */
SPL_METHOD(SplFileInfo, setInfoClass)
{
spl_filesystem_object *intern =
(spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
zend_class_entry *ce = spl_ce_SplFileInfo;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|C", &ce) ==
FAILURE) {
- return;
+ php_set_error_handling(EH_THROW, spl_ce_UnexpectedValueException
TSRMLS_CC);
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|C", &ce) ==
SUCCESS) {
+ intern->info_class = ce;
}
- intern->info_class = ce;
+ php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
}
/* }}} */
@@ -778,11 +782,13 @@
spl_filesystem_object *intern =
(spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
zend_class_entry *ce = intern->info_class;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|C", &ce) ==
FAILURE) {
- return;
+ php_set_error_handling(EH_THROW, spl_ce_UnexpectedValueException
TSRMLS_CC);
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|C", &ce) ==
SUCCESS) {
+ spl_filesystem_object_create_type(ht, intern, SPL_FS_INFO, ce,
return_value TSRMLS_CC);
}
- spl_filesystem_object_create_type(ht, intern, SPL_FS_INFO, ce,
return_value TSRMLS_CC);
+ php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
}
/* }}} */
@@ -793,11 +799,13 @@
spl_filesystem_object *intern =
(spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
zend_class_entry *ce = intern->info_class;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|C", &ce) ==
FAILURE) {
- return;
+ php_set_error_handling(EH_THROW, spl_ce_UnexpectedValueException
TSRMLS_CC);
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|C", &ce) ==
SUCCESS) {
+ spl_filesystem_object_create_info(intern, intern->path,
intern->path_len, 1, ce, return_value TSRMLS_CC);
}
- spl_filesystem_object_create_info(intern, intern->path,
intern->path_len, 1, ce, return_value TSRMLS_CC);
+ php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
}
/* }}} */
@@ -810,7 +818,7 @@
int len;
long flags = SPL_FILE_DIR_CURRENT_AS_FILEINFO;
- php_set_error_handling(EH_THROW, spl_ce_RuntimeException TSRMLS_CC);
+ php_set_error_handling(EH_THROW, spl_ce_UnexpectedValueException
TSRMLS_CC);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &path,
&len, &flags) == FAILURE) {
php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
@@ -950,28 +958,6 @@
}
/* }}} */
-/* {{{ proto SplFileInfo RecursiveDirectoryIterator::getSubPathInfo([string
$class_info])
- Create SplFileInfo for sub path */
-SPL_METHOD(RecursiveDirectoryIterator, getSubPathInfo)
-{
- spl_filesystem_object *intern =
(spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
- char *sub_name;
- int len;
- zend_class_entry *ce = intern->info_class;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|C", &ce) ==
FAILURE) {
- return;
- }
-
- if (intern->u.dir.sub_path) {
- len = spprintf(&sub_name, 0, "%s%c%s", intern->u.dir.sub_path,
DEFAULT_SLASH, intern->u.dir.entry.d_name);
- spl_filesystem_object_create_info(intern, sub_name, len, 0, ce,
return_value TSRMLS_CC);
- } else {
- spl_filesystem_object_create_info(intern, intern->path,
intern->path_len, 1, ce, return_value TSRMLS_CC);
- }
-}
-/* }}} */
-
/* define an overloaded iterator structure */
typedef struct {
zend_object_iterator intern;
@@ -1337,7 +1323,6 @@
SPL_ME(RecursiveDirectoryIterator, getChildren, NULL, ZEND_ACC_PUBLIC)
SPL_ME(RecursiveDirectoryIterator, getSubPath, NULL, ZEND_ACC_PUBLIC)
SPL_ME(RecursiveDirectoryIterator, getSubPathname,NULL, ZEND_ACC_PUBLIC)
- SPL_ME(RecursiveDirectoryIterator,
getSubPathInfo,arginfo_info_optinalFileClass, ZEND_ACC_PUBLIC)
{NULL, NULL, NULL}
};
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php