|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18623 touch, fopen, fwrite don't work
Submitted: 2002-07-29 10:17 UTC Modified: 2002-07-31 02:47 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: Assigned:
Status: Closed Package: Filesystem function related
PHP Version: 4CVS-2002-07-29 OS: Compaq Tru64/Alpha
Private report: No CVE-ID: None
 [2002-07-29 10:17 UTC]
  $fp = fopen("reports/test.txt","w");
  fwrite($fp, $wddx);

Fails on Compaq Tru64/Alpha:

Warning: Unable to access reports/test.txt in test.php on line 76

Warning: Unable to access reports/test.txt in test.php on line 77

Warning: fopen("reports/test.txt ") - No such file or directory in test.php on line 77

Warning: fwrite(): supplied argument is not a valid File-Handle resource in test.php on line 78

Warning: fclose(): supplied argument is not a valid File-Handle resource in test.php on line 79

Works fine with PHP 4.2.0 on the same machine.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-07-29 18:37 UTC]
Does it work if you simply copy ext/standard/filestat.c from 4.2.0 over current CVS ? There has been only a little modification which at a brief glance shouldn't do anything bad .. but you never know.

For CVS with it's original filestat.c, do you get any compiler warnings about pointer mismatch ?
 [2002-07-30 04:17 UTC]
First the compiler warnings:

(im going to put that in a "real" file this afternoon, but from here, I can't use FTP to put it on server that is accessable for everyone)
 [2002-07-30 04:32 UTC]
When copying filestat.c like you described, everything works fine. PHP compiles as expected (well there are some warnings, but it runs at least). The file-functions work too.

strip_slashes from my bug-testing-script still failes ( )

When starting PHP it still gives some strange errors:

> ~/php4-200207292100_install/bin/php 
Unaligned access pid=20430 <php> va=0x14006387c pc=0x1201b2870 ra=0x1201b2864 inst=0xb4010000

Like described in Bugs #18558 #16360 #17449

 [2002-07-30 08:03 UTC] msopacua at idg dot nl
reproduced on AIX 4.3.3.

Relevant compiler warnings:
/data/mdev/_src/php-HEAD/ext/standard/filestat.c: In function `php_stat':
/data/mdev/_src/php-HEAD/ext/standard/filestat.c:560: warning: passing arg 1 of `php_check_open_basedir' discar
ds qualifiers from pointer target type
/home/thies/devel/php4/ext/standard/ In function `php_url_scanner_output_handler':
/home/thies/devel/php4/ext/standard/ warning: passing arg 3 of `url_adapt_ext' from incom
patible pointer type
/data/mdev/_src/php-HEAD/sapi/cgi/cgi_main.c: In function `main':
/data/mdev/_src/php-HEAD/sapi/cgi/cgi_main.c:603: warning: passing arg 2 of `cfg_get_long' from incompatible po
inter type

Since 'man' means installing X and a whole lot of other stuff on AIX I don't have them available, but will get back with some links from the IBM docserver, later today.
 [2002-07-30 12:02 UTC]
changed this to be verfied by 
 [2002-07-30 13:43 UTC]
Now the Error-Log is at
 [2002-07-30 14:52 UTC]
can you test the patch that just sent to PHP-Dev and see if this solves the touch issues?  
 [2002-07-30 16:51 UTC]
I think, you meant this one (it's from, not

--- old_filestat.c      2002-07-28 23:35:50.000000000 +0000
+++ filestat.c  2002-07-30 17:16:48.000000000 +0000
@@ -481,9 +481,7 @@
        newtime = &newtimebuf;

        if (ac == 1 && zend_get_parameters_ex(1, &filename) != FAILURE) {
                newtime->modtime = newtime->actime = time(NULL);
        } else if (ac == 2 && zend_get_parameters_ex(2, &filename, &filetime) != FAILURE) {
                newtime->actime = time(NULL);


and yes... It works fine. Tested with php4-200207301200 tested on Compaq Testdrive machine (a little bit slow, but it does what it should do). Full report here:

 [2002-07-30 19:04 UTC]
woo, that was unexpected :)  I thought I'd come across a separate win32 issue.

Does that mean I can close this one now?
 [2002-07-31 00:32 UTC] reports Stef patch fixes the bug on AIX.
 [2002-07-31 02:47 UTC]
This bug has been fixed in CVS. You can grab a snapshot of the
CVS version at In case this was a documentation 
problem, the fix will show up soon at
In case this was a website problem, the change will show
up on the site and on the mirror sites.
Thank you for the report, and for helping us make PHP better.

Sebastian agrees.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Wed Feb 01 20:04:13 2023 UTC