php.net |  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
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: nohn@php.net 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] nohn@php.net
  touch("reports/test.txt");
  $fp = fopen("reports/test.txt","w");
  fwrite($fp, $wddx);
  fclose($fp);

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.



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-07-29 18:37 UTC] mfischer@php.net
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] nohn@php.net
First the compiler warnings:

http://www.phpcrawler.de/news/newsdetail.php?id=33

(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] nohn@php.net
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 ( http://nohn.net/lalafarm/php4-test.zip )

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/url_scanner_ex.re: In function `php_url_scanner_output_handler':
/home/thies/devel/php4/ext/standard/url_scanner_ex.re:392: 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] nohn@php.net
changed this to be verfied by msopacua@idg.nl 
 [2002-07-30 13:43 UTC] nohn@php.net
Now the Error-Log is at http://www.nohn.net/lalafarm/php4-test/error.log
 [2002-07-30 14:52 UTC] kalowsky@php.net
can you test the patch that stef@php.net just sent to PHP-Dev and see if this solves the touch issues?  
 [2002-07-30 16:51 UTC] nohn@php.net
I think, you meant this one (it's from sfox@php.net, not stef@php.net):

--- 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) {
-#ifndef HAVE_UTIME_NULL
                newtime->modtime = newtime->actime = time(NULL);
-#endif
        } else if (ac == 2 && zend_get_parameters_ex(2, &filename, &filetime) != FAILURE) {
                convert_to_long_ex(filetime);
                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: http://www.nohn.net/lalafarm/php4-test-reports/4.3.0-dev-1028061991.xml

 [2002-07-30 19:04 UTC] sfox@php.net
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] kalowsky@php.net
msopacua@idg.nl reports Stef patch fixes the bug on AIX.
 [2002-07-31 02:47 UTC] sfox@php.net
This bug has been fixed in CVS. You can grab a snapshot of the
CVS version at http://snaps.php.net/. In case this was a documentation 
problem, the fix will show up soon at http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites.
Thank you for the report, and for helping us make PHP better.

Sebastian agrees.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 07:01:27 2024 UTC