From:             [EMAIL PROTECTED]
Operating system: Red Hat Linux 7.1 / kernel 2.4.4
PHP version:      4.0CVS-2002-03-21
PHP Bug Type:     Filesystem function related
Bug description:  ftruncate() won't truncate file

Under the latest CVS, the following script fails (ftruncate() returns an
error and doesn't truncate the file) but under PHP 4.1.2, it works fine:

<?php

if (! $fp = fopen('test','r+')) {
    die("Can't open test");
}

if (! ftruncate($fp,0)) {
    die("Can't truncate");

}

fclose($fp);

?>

(The file "test" exists and has some text in it.)

I get the same results whether the mode passed to fopen() is "r", "r+",
"a", or "a+" (with "w" or "w+", the call to ftruncate() still fails, but
the file is truncated due to the nature of the "w" fopen mode).


-- 
Edit bug report at http://bugs.php.net/?id=16211&edit=1
-- 
Fixed in CVS:        http://bugs.php.net/fix.php?id=16211&r=fixedcvs
Fixed in release:    http://bugs.php.net/fix.php?id=16211&r=alreadyfixed
Need backtrace:      http://bugs.php.net/fix.php?id=16211&r=needtrace
Try newer version:   http://bugs.php.net/fix.php?id=16211&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=16211&r=support
Expected behavior:   http://bugs.php.net/fix.php?id=16211&r=notwrong
Not enough info:     http://bugs.php.net/fix.php?id=16211&r=notenoughinfo
Submitted twice:     http://bugs.php.net/fix.php?id=16211&r=submittedtwice

Reply via email to