ID:               17159
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-Status:           Open
+Status:           Closed
 Bug Type:         Reproducible crash
 Operating System: linux, kernel 2.4.18
 PHP Version:      4.2.0
 New Comment:

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/. 
Thank you for the report, and for helping us make PHP better.


Previous Comments:
------------------------------------------------------------------------

[2002-05-11 16:54:28] [EMAIL PROTECTED]

In PHP 4.2.0 the touch() function seems to be broken!
When you use touch($filename) the mtime is a random value... if you use
touch($filename,time()), anything works fine.

I checked the source and I think, I found the BUG!

[php-4.2.0/ext/standard/filestat.c # PHP_FUNCTION(touch)]

[..]
        struct utimbuf newtimebuf;
        struct utimbuf *newtime = &newtimebuf;
        int ac = ZEND_NUM_ARGS();

        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) {

[..]

have a look at the part with HAVE_UTIME_NULL. if HAVE_UTIME_NULL is
*not* defined, it will be initialized with time(NULL). But if it is
defined, newtime->modtime and newtime->actime will be
*uninitialized*!!! There's no code to initialize both values with
something like 0 or NULL. The struct newtime is on the stack and has
random content!

HAVE_UTIME_NULL seems to be defined on my system and so touch() sets
random values for modtime and actime.

Greetings from Germany,
Stefan Briesenick


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=17159&edit=1

Reply via email to