PHP 4.0 Bug #6090 Updated: ftell() returns -1 (not false) if an error occurs.
| From: | Bug Database | Date: | Fri, 11 Aug 2000 02:25:46 +0000 |
| Subject: | PHP 4.0 Bug #6090 Updated: ftell() returns -1 (not false) if an error occurs. | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-28432@lists.php.net to get a copy of this message | ||
ID: 6090
User Update by: sagawa@sohgoh.net
Status: Open
Bug Type: Feature/Change Request
Description: ftell() returns -1 (not false) if an error occurs.
Umm... what I want to say,
PHP's ftell function returns directly C's ftell().
So, this is "Documentation problem", isn't it?
Please see below... (Quote from /ext/standerd/file.c )
-----------------------------------
/* {{{ proto int fseek(int fp, int offset [, int whence])
Seek on a file pointer */
PHP_FUNCTION(fseek)
{
zval **arg1, **arg2, **arg3;
int argcount = ARG_COUNT(ht), whence = SEEK_SET;
void *what;
if (argcount < 2 || argcount > 3 ||
zend_get_parameters_ex(argcount, &arg1, &arg2, &arg3) == FAILURE) {
WRONG_PARAM_COUNT;
}
what = zend_fetch_resource(arg1,-1,"File-Handle",NULL,2,le_fopen,le_popen);
ZEND_VERIFY_RESOURCE(what);
convert_to_long_ex(arg2);
if (argcount > 2) {
convert_to_long_ex(arg3);
whence = (*arg3)->value.lval;
}
RETURN_LONG(fseek((FILE*)what, (*arg2)->value.lval, whence));
}
/* }}} */
-----------------------------------
Full Bug description available at: http://bugs.php.net/?id=6090