iliaa           Wed Nov 15 00:20:40 2006 UTC

  Modified files:              (Branch: PHP_5_2)
    /php-src/ext/standard       file.c 
    /php-src    NEWS 
  Log:
  Added missing object support to file_put_contents(). 
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.409.2.6.2.9&r2=1.409.2.6.2.10&diff_format=u
Index: php-src/ext/standard/file.c
diff -u php-src/ext/standard/file.c:1.409.2.6.2.9 
php-src/ext/standard/file.c:1.409.2.6.2.10
--- php-src/ext/standard/file.c:1.409.2.6.2.9   Mon Nov 13 20:31:27 2006
+++ php-src/ext/standard/file.c Wed Nov 15 00:20:40 2006
@@ -21,7 +21,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: file.c,v 1.409.2.6.2.9 2006/11/13 20:31:27 tony2001 Exp $ */
+/* $Id: file.c,v 1.409.2.6.2.10 2006/11/15 00:20:40 iliaa Exp $ */
 
 /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
 
@@ -653,11 +653,23 @@
                        }
                        break;
 
+               case IS_OBJECT:
+                       if (Z_OBJ_HT_P(data) != NULL) {
+                               zval out;
+
+                               if (zend_std_cast_object_tostring(data, &out, 
IS_STRING TSRMLS_CC) == SUCCESS) {
+                                       numbytes = php_stream_write(stream, 
Z_STRVAL(out), Z_STRLEN(out));
+                                       if (numbytes != Z_STRLEN(out)) {
+                                               php_error_docref(NULL 
TSRMLS_CC, E_WARNING, "Only %d of %d bytes written, possibly out of free disk 
space", numbytes, Z_STRLEN(out));
+                                               numbytes = -1;
+                                       }
+                                       zval_dtor(&out);
+                                       break;
+                               }
+                       }
                default:
-                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "The 2nd 
parameter should be either a string or an array");
-                       numbytes = -1;
+                       numbytes = -1;          
                        break;
-       
        }
        php_stream_close(stream);
 
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.362&r2=1.2027.2.547.2.363&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.362 php-src/NEWS:1.2027.2.547.2.363
--- php-src/NEWS:1.2027.2.547.2.362     Tue Nov 14 19:59:31 2006
+++ php-src/NEWS        Wed Nov 15 00:20:40 2006
@@ -1,6 +1,7 @@
 PHP                                                                        NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? ??? 2007, PHP 5.2.1
+- Added missing object support to file_put_contents(). (Ilia)
 - Updated bundled libcURL to version 7.16.0 in the Windows distro. (Edin)
 - cgi.* and fastcgi.* directives are moved to INI subsystem.
   The new directive cgi.check_shebang_line can be used to ommiting checnk

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

Reply via email to