[PHP-CVS] svn: /php/php-src/trunk/ext/spl/ spl_directory.c

2011-08-08 Thread Etienne Kneuss
colder   Mon, 08 Aug 2011 12:05:34 +

Revision: http://svn.php.net/viewvc?view=revision&revision=314485

Log:
Fix validator for SplFileInfo constructor

Changed paths:
U   php/php-src/trunk/ext/spl/spl_directory.c

Modified: php/php-src/trunk/ext/spl/spl_directory.c
===
--- php/php-src/trunk/ext/spl/spl_directory.c   2011-08-08 11:57:18 UTC (rev 
314484)
+++ php/php-src/trunk/ext/spl/spl_directory.c   2011-08-08 12:05:34 UTC (rev 
314485)
@@ -633,6 +633,7 @@
 * constructor or cleared its exception */

return (fsobj->u.dir.entry.d_name[0] != '\0' /* GlobIterator */ ||
+   fsobj->_path != NULL /* SplFileInfo */ ||
fsobj->orig_path != NULL /* Spl[Temp]FileObject */);
 }
 /* }}} */
@@ -2431,7 +2432,9 @@
 {
spl_filesystem_object *intern = 
(spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);

-   zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intern->flags);
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", 
&intern->flags) == FAILURE) {
+   return;
+   }
 } /* }}} */

 /* {{{ proto int SplFileObject::getFlags()

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP-CVS] svn: /php/php-src/trunk/ext/spl/ spl_directory.c

2009-07-29 Thread Felipe Pena
felipe   Wed, 29 Jul 2009 17:31:25 +

Revision: http://svn.php.net/viewvc?view=revision&revision=286526

Log:
- Fixed memleak on SplFileInfo::getLinkTarget()

Changed paths:
U   php/php-src/trunk/ext/spl/spl_directory.c

Modified: php/php-src/trunk/ext/spl/spl_directory.c
===
--- php/php-src/trunk/ext/spl/spl_directory.c   2009-07-29 17:20:16 UTC (rev 
286525)
+++ php/php-src/trunk/ext/spl/spl_directory.c   2009-07-29 17:31:25 UTC (rev 
286526)
@@ -1132,7 +1132,7 @@
spl_filesystem_object *intern = 
(spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
UChar *target;
int ret, link_len, target_len;
-   char *link, buff[MAXPATHLEN];
+   char *link = NULL, buff[MAXPATHLEN];
zend_error_handling error_handling;

zend_replace_error_handling(EH_THROW, spl_ce_RuntimeException, 
&error_handling TSRMLS_CC);
@@ -1144,11 +1144,14 @@
}

 #ifdef HAVE_SYMLINK
-   ret = readlink(intern->file_name.s, buff, MAXPATHLEN-1);
+   ret = link ? readlink(link, buff, MAXPATHLEN-1) : -1;
 #else
ret = -1; /* always fail if not implemented */
 #endif

+   if (link && intern->file_name_type == IS_UNICODE) {
+   efree(link);
+   }
if (ret == -1) {
zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, 
"Unable to read link %R, error: %s", intern->file_name_type, intern->file_name, 
strerror(errno));
RETVAL_FALSE;

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP-CVS] svn: php/php-src/trunk/ext/spl/ spl_directory.c

2009-07-20 Thread Felipe Pena
felipe  Mon, 20 Jul 2009 22:20:36 +

Revision: http://svn.php.net/viewvc?view=revision&revision=284458

Log:
- Sync proto with 5.3

Changed paths:
U   php/php-src/trunk/ext/spl/spl_directory.c

Modified: php/php-src/trunk/ext/spl/spl_directory.c
===
--- php/php-src/trunk/ext/spl/spl_directory.c   2009-07-20 19:58:43 UTC (rev 
284457)
+++ php/php-src/trunk/ext/spl/spl_directory.c   2009-07-20 22:20:36 UTC (rev 
284458)
@@ -2375,7 +2375,7 @@
 }
 /* }}} */

-/* {{{ proto array SplFileObject::fgetcsv([string delimiter [, string 
enclosure]]) U
+/* {{{ proto array SplFileObject::fgetcsv([string delimiter [, string 
enclosure [, escape = '\\']]]) U
Return current line as csv */
 SPL_METHOD(SplFileObject, fgetcsv)
 {

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php