mirror of
https://github.com/php/php-src.git
synced 2024-11-28 04:14:26 +08:00
Added missing object support to file_put_contents().
This commit is contained in:
parent
6640a1c861
commit
fca0e24410
1
NEWS
1
NEWS
@ -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
|
||||
|
@ -653,11 +653,23 @@ PHP_FUNCTION(file_put_contents)
|
||||
}
|
||||
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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user