[PHP-CVS] com php-src: Merge branch 'PHP-5.3' into PHP-5.4: ext/spl/spl_directory.c

2012-08-19 Thread Felipe Pena
Commit:2497bb97e70aa8b7375c5a365b8d21a92357f262
Author:Felipe Pena felipe...@gmail.com Sun, 19 Aug 2012 12:55:43 
-0300
Parents:   7a724051711ad4746ac1f3fcab14f2af0a1ef100 
6cd0e446dd93b5232b49c6248102b77b17865904
Branches:  PHP-5.4 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=2497bb97e70aa8b7375c5a365b8d21a92357f262

Log:
Merge branch 'PHP-5.3' into PHP-5.4

* PHP-5.3:
  - Value stored to var is never used

Changed paths:
  MM  ext/spl/spl_directory.c


Diff:



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



[PHP-CVS] com php-src: Merge branch 'PHP-5.3' into PHP-5.4: ext/spl/spl_directory.c

2012-03-22 Thread David Soria Parra
Commit:b60f9fe146eea4edbcc1c17172d8ee3c0c719c82
Author:David Soria Parra d...@php.net Thu, 22 Mar 2012 12:13:52 
+0100
Parents:   0b646e8027131a1fb127e1e6cc845319b65e46a4 
14af1fe6923c65a91cd77eab5a8d4326f854391d
Branches:  PHP-5.4 5bf1efbf209b7d14edc8d01098465ed0bdda1516 
ef678028bf8b9b3fde0d609328c2722040fba269 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=b60f9fe146eea4edbcc1c17172d8ee3c0c719c82

Log:
Merge branch 'PHP-5.3' into PHP-5.4

* PHP-5.3:
  Fixed reference counting

Changed paths:
  MM  ext/spl/spl_directory.c

b60f9fe146eea4edbcc1c17172d8ee3c0c719c82
diff --combined ext/spl/spl_directory.c
index c6eec94,9d454c9..7bd340b
--- a/ext/spl/spl_directory.c
+++ b/ext/spl/spl_directory.c
@@@ -148,6 -148,7 +148,6 @@@ static zend_object_value spl_filesystem
  {
zend_object_value retval;
spl_filesystem_object *intern;
 -  zval *tmp;
  
intern = emalloc(sizeof(spl_filesystem_object));
memset(intern, 0, sizeof(spl_filesystem_object));
@@@ -157,7 -158,7 +157,7 @@@
if (obj) *obj = intern;
  
zend_object_std_init(intern-std, class_type TSRMLS_CC);
 -  zend_hash_copy(intern-std.properties, class_type-default_properties, 
(copy_ctor_func_t) zval_add_ref, (void *) tmp, sizeof(zval *));
 +  object_properties_init(intern-std, class_type);
  
retval.handle = zend_objects_store_put(intern, 
(zend_objects_store_dtor_t) zend_objects_destroy_object, 
(zend_objects_free_object_storage_t) spl_filesystem_object_free_storage, NULL 
TSRMLS_CC);
retval.handlers = spl_filesystem_object_handlers;
@@@ -244,7 -245,7 +244,7 @@@ static void spl_filesystem_dir_open(spl
  
intern-type = SPL_FS_DIR;
intern-_path_len = strlen(path);
 -  intern-u.dir.dirp = php_stream_opendir(path, 
ENFORCE_SAFE_MODE|REPORT_ERRORS, NULL);
 +  intern-u.dir.dirp = php_stream_opendir(path, REPORT_ERRORS, 
FG(default_context));
  
if (intern-_path_len  1  IS_SLASH_AT(path, intern-_path_len-1)) {
intern-_path = estrndup(path, --intern-_path_len);
@@@ -270,20 -271,9 +270,20 @@@
  
  static int spl_filesystem_file_open(spl_filesystem_object *intern, int 
use_include_path, int silent TSRMLS_DC) /* {{{ */
  {
 +  zval  tmp;
 +
intern-type = SPL_FS_FILE;
 +
 +  php_stat(intern-file_name, intern-file_name_len, FS_IS_DIR, tmp 
TSRMLS_CC);
 +  if (Z_LVAL(tmp)) {
 +  intern-u.file.open_mode = NULL;
 +  intern-file_name = NULL;
 +  zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, 
Cannot use SplFileObject with directories);
 +  return FAILURE;
 +  }
 +
intern-u.file.context = 
php_stream_context_from_zval(intern-u.file.zcontext, 0);
 -  intern-u.file.stream = php_stream_open_wrapper_ex(intern-file_name, 
intern-u.file.open_mode, (use_include_path ? USE_PATH : 0) | ENFORCE_SAFE_MODE 
| REPORT_ERRORS, NULL, intern-u.file.context);
 +  intern-u.file.stream = php_stream_open_wrapper_ex(intern-file_name, 
intern-u.file.open_mode, (use_include_path ? USE_PATH : 0) | REPORT_ERRORS, 
NULL, intern-u.file.context);
  
if (!intern-file_name_len || !intern-u.file.stream) {
if (!EG(exception)) {
@@@ -595,10 -585,6 +595,10 @@@ static HashTable* spl_filesystem_object
  
*is_temp = 1;
  
 +  if (!intern-std.properties) {
 +  rebuild_object_properties(intern-std);
 +  }
 +
ALLOC_HASHTABLE(rv);
ZEND_INIT_SYMTABLE_EX(rv, 
zend_hash_num_elements(intern-std.properties) + 3, 0);
  
@@@ -660,17 -646,16 +660,17 @@@
  }
  /* }}} */
  
 -zend_function *spl_filesystem_object_get_method_check(zval **object_ptr, char 
*method, int method_len TSRMLS_DC) /* {{{ */
 +zend_function *spl_filesystem_object_get_method_check(zval **object_ptr, char 
*method, int method_len, const struct _zend_literal *key TSRMLS_DC) /* {{{ */
  {
spl_filesystem_object *fsobj = zend_object_store_get_object(*object_ptr 
TSRMLS_CC);

if (fsobj-u.dir.entry.d_name[0] == '\0'  fsobj-orig_path == NULL) {
method = _bad_state_ex;
method_len = sizeof(_bad_state_ex) - 1;
 +  key = NULL;
}

 -  return zend_get_std_object_handlers()-get_method(object_ptr, method, 
method_len TSRMLS_CC);
 +  return zend_get_std_object_handlers()-get_method(object_ptr, method, 
method_len, key TSRMLS_CC);
  }
  /* }}} */
  
@@@ -1252,7 -1237,11 +1252,7 @@@ SPL_METHOD(SplFileInfo, getLinkTarget
RETURN_FALSE;
} else if (!IS_ABSOLUTE_PATH(intern-file_name, intern-file_name_len)) 
{
char expanded_path[MAXPATHLEN];
 -
 -  /* TODO: Fix expand_filepath to do not resolve links but only 
expand the path
 - avoiding double two resolution attempts
 - (Pierre) */
 -  if (!expand_filepath(intern-file_name, expanded_path 
TSRMLS_CC)) {
 +  if 

[PHP-CVS] com php-src: Merge branch 'PHP-5.3' into PHP-5.4: ext/spl/spl_directory.c

2012-03-22 Thread Stanislav Malyshev
Commit:bcc15b56331f3055c99d8c126a61f48b33229c1c
Author:Stanislav Malyshev s...@php.net Thu, 22 Mar 2012 22:30:51 
-0700
Parents:   ee755fafb99ba618fd82bbe05758ace68584ded1 
a89c4a34ee55686ab1430a5060e1460335fc5203
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=bcc15b56331f3055c99d8c126a61f48b33229c1c

Log:
Merge branch 'PHP-5.3' into PHP-5.4

* PHP-5.3:
  Revert - Fixed bug #61418 (Segmentation fault when DirectoryIterator's or - 
causes bug #61482
  Add initialization tests for SQLT_INT binds
  Fix NEWS

Bugs:
https://bugs.php.net/61418
https://bugs.php.net/61482

Changed paths:
  MM  ext/spl/spl_directory.c

bcc15b56331f3055c99d8c126a61f48b33229c1c
diff --combined ext/spl/spl_directory.c
index c6eec94,f0e903f..22d4ffa
--- a/ext/spl/spl_directory.c
+++ b/ext/spl/spl_directory.c
@@@ -120,16 -120,6 +120,6 @@@ static void spl_filesystem_object_free_
spl_filesystem_file_free_line(intern TSRMLS_CC);
break;
}
- 
-   {
-   zend_object_iterator *iterator;
-   iterator = (zend_object_iterator*)
-   spl_filesystem_object_to_iterator(intern);
-   if (iterator-data != NULL) {
-   iterator-data = NULL;
-   iterator-funcs-dtor(iterator TSRMLS_CC);
-   }
-   }
efree(object);
  } /* }}} */
  
@@@ -148,6 -138,7 +138,6 @@@ static zend_object_value spl_filesystem
  {
zend_object_value retval;
spl_filesystem_object *intern;
 -  zval *tmp;
  
intern = emalloc(sizeof(spl_filesystem_object));
memset(intern, 0, sizeof(spl_filesystem_object));
@@@ -157,7 -148,7 +147,7 @@@
if (obj) *obj = intern;
  
zend_object_std_init(intern-std, class_type TSRMLS_CC);
 -  zend_hash_copy(intern-std.properties, class_type-default_properties, 
(copy_ctor_func_t) zval_add_ref, (void *) tmp, sizeof(zval *));
 +  object_properties_init(intern-std, class_type);
  
retval.handle = zend_objects_store_put(intern, 
(zend_objects_store_dtor_t) zend_objects_destroy_object, 
(zend_objects_free_object_storage_t) spl_filesystem_object_free_storage, NULL 
TSRMLS_CC);
retval.handlers = spl_filesystem_object_handlers;
@@@ -244,7 -235,7 +234,7 @@@ static void spl_filesystem_dir_open(spl
  
intern-type = SPL_FS_DIR;
intern-_path_len = strlen(path);
 -  intern-u.dir.dirp = php_stream_opendir(path, 
ENFORCE_SAFE_MODE|REPORT_ERRORS, NULL);
 +  intern-u.dir.dirp = php_stream_opendir(path, REPORT_ERRORS, 
FG(default_context));
  
if (intern-_path_len  1  IS_SLASH_AT(path, intern-_path_len-1)) {
intern-_path = estrndup(path, --intern-_path_len);
@@@ -270,20 -261,9 +260,20 @@@
  
  static int spl_filesystem_file_open(spl_filesystem_object *intern, int 
use_include_path, int silent TSRMLS_DC) /* {{{ */
  {
 +  zval  tmp;
 +
intern-type = SPL_FS_FILE;
 +
 +  php_stat(intern-file_name, intern-file_name_len, FS_IS_DIR, tmp 
TSRMLS_CC);
 +  if (Z_LVAL(tmp)) {
 +  intern-u.file.open_mode = NULL;
 +  intern-file_name = NULL;
 +  zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, 
Cannot use SplFileObject with directories);
 +  return FAILURE;
 +  }
 +
intern-u.file.context = 
php_stream_context_from_zval(intern-u.file.zcontext, 0);
 -  intern-u.file.stream = php_stream_open_wrapper_ex(intern-file_name, 
intern-u.file.open_mode, (use_include_path ? USE_PATH : 0) | ENFORCE_SAFE_MODE 
| REPORT_ERRORS, NULL, intern-u.file.context);
 +  intern-u.file.stream = php_stream_open_wrapper_ex(intern-file_name, 
intern-u.file.open_mode, (use_include_path ? USE_PATH : 0) | REPORT_ERRORS, 
NULL, intern-u.file.context);
  
if (!intern-file_name_len || !intern-u.file.stream) {
if (!EG(exception)) {
@@@ -595,10 -575,6 +585,10 @@@ static HashTable* spl_filesystem_object
  
*is_temp = 1;
  
 +  if (!intern-std.properties) {
 +  rebuild_object_properties(intern-std);
 +  }
 +
ALLOC_HASHTABLE(rv);
ZEND_INIT_SYMTABLE_EX(rv, 
zend_hash_num_elements(intern-std.properties) + 3, 0);
  
@@@ -660,17 -636,16 +650,17 @@@
  }
  /* }}} */
  
 -zend_function *spl_filesystem_object_get_method_check(zval **object_ptr, char 
*method, int method_len TSRMLS_DC) /* {{{ */
 +zend_function *spl_filesystem_object_get_method_check(zval **object_ptr, char 
*method, int method_len, const struct _zend_literal *key TSRMLS_DC) /* {{{ */
  {
spl_filesystem_object *fsobj = zend_object_store_get_object(*object_ptr 
TSRMLS_CC);

if (fsobj-u.dir.entry.d_name[0] == '\0'  fsobj-orig_path == NULL) {
method = _bad_state_ex;
method_len = sizeof(_bad_state_ex) - 1;
 +  key = NULL;
}

 -  return zend_get_std_object_handlers()-get_method(object_ptr,