cvs: pear /PHP_Compat/Compat/Function file_get_contents.php
| From: | Arpad Ray | Date: | Wed, 06 May 2009 20:34:30 +0000 |
| Subject: | cvs: pear /PHP_Compat/Compat/Function file_get_contents.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-56055@lists.php.net to get a copy of this message | ||
arpad Wed May 6 20:34:30 2009 UTC
Modified files:
/pear/PHP_Compat/Compat/Function file_get_contents.php
Log:
pass resource context through to fopen() if >= 4.3.0
http://cvs.php.net/viewvc.cgi/pear/PHP_Compat/Compat/Function/file_get_contents.php?r1=1.27&r2=1.28&diff_format=u
Index: pear/PHP_Compat/Compat/Function/file_get_contents.php
diff -u pear/PHP_Compat/Compat/Function/file_get_contents.php:1.27
pear/PHP_Compat/Compat/Function/file_get_contents.php:1.28
--- pear/PHP_Compat/Compat/Function/file_get_contents.php:1.27 Wed May 6 20:21:35 2009
+++ pear/PHP_Compat/Compat/Function/file_get_contents.php Wed May 6 20:34:30 2009
@@ -11,7 +11,7 @@
* @link http://php.net/function.file_get_contents
* @author Aidan Lister <aidan@php.net>
* @author Arpad Ray <arpad@php.net>
- * @version $Revision: 1.27 $
+ * @version $Revision: 1.28 $
* @internal resource_context is only supported for PHP 4.3.0+ (stream_context_get_options)
* @since PHP 4.3.0
* @require PHP 4.0.0 (user_error)
@@ -52,7 +52,12 @@
}
if (false === $data) {
- if (false === $fh = fopen($filename, 'rb', $incpath)) {
+ if (is_resource($resource_context) && version_compare(PHP_VERSION,
'4.3.0', 'ge')) {
+ $fh = fopen($filename, 'rb', $incpath, $resource_context);
+ } else {
+ $fh = fopen($filename, 'rb', $incpath);
+ }
+ if (false === $fh) {
user_error('failed to open stream: No such file or directory',
E_USER_WARNING);
return false;