#37395 [Opn->Csd]: fopen don't work in some conditions
ID: 37395
Updated by: tony2001@php.net
Reported By: n dot escuder at intra-links dot com
-Status: Open
+Status: Closed
Bug Type: Filesystem function related
Operating System: Linux
PHP Version: 5.1.4
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
There was a different issue, but now it's fixed in CVS.
Previous Comments:
------------------------------------------------------------------------
[2006-05-16 11:38:02] n dot escuder at intra-links dot com
I jave made a little mistake in my expample here is the good test file
:
<?
ini_set( "include_path", "/tmp/link" );
mkdir( "/tmp/php", 0777, true );
touch( "/tmp/php/one.php" );
symlink( "/tmp/php", "/tmp/link" );
require_once "one.php";
mkdir( "/tmp/essai" );
chroot( "/tmp/essai" );
mkdir( "/tmp/link", 0777, true );
$fd = fopen( "/tmp/link/one.php", "wb" );
?>
as you can see we just created /tmp/essai
and /tmp/link in chrooted of /tmp/essai
and after trye to create /tmp/link/one.php fail !
It's due to the link in the include_path
------------------------------------------------------------------------
[2006-05-15 21:49:43] tony2001@php.net
Remove all those @ and you'll see the very expected error messages.
------------------------------------------------------------------------
[2006-05-10 11:41:23] n dot escuder at intra-links dot com
Description:
------------
fopen report no such file or directory when open in w mode.
It's seem to be related with include path with symlink as you can see
in sample
if the include path is /tmp/php all work.
but if the include path is /tmp/link ( sym link ) the script fail.
Reproduce code:
---------------
ini_set('include_path', "/tmp/link");
@mkdir("/tmp/php", 0777, true);
touch("/tmp/php/one.php");
@symlink( "/tmp/php", "/tmp/link" );
require_once "one.php";
@mkdir("/tmp/essai");
chroot("/tmp/essai" );
@mkdir("/tmp/link/interfaces", 0777, true);
$fd = fopen("/tmp/link/one.php", "wb");
Expected result:
----------------
No error and an file pointer in $fd
Actual result:
--------------
Warning: fopen(/tmp/link/one.php): failed to open stream: No such file
or directory in /tmp/essai.php on line 16
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=37395&edit=1
Thread (7 messages)