Mantis Bugtracker

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0004296 [Quercus] major always 11-16-10 16:15 11-16-10 16:15
Reporter fredo View Status public  
Assigned To
Priority normal Resolution open  
Status new   Product Version 4.0.13
Summary 0004296: file_get_contents ignores offset parameter
Description php docs say:

string file_get_contents ( string $filename [, bool $use_include_path = false [, resource $context [, int $offset = -1 [, int $maxlen ]]]] )

This function is similar to file(), except that file_get_contents() returns the file in a string, starting at the specified offset up to maxlen bytes. On failure, file_get_contents() will return FALSE.

BUT the implementation in Quercus will always return the file-contents from the start of the file
Additional Information should be fixed like:

  public static StringValue
    file_get_contents(Env env,
                      StringValue filename,
                      @Optional boolean useIncludePath,
                      @Optional Value context,
                      @Optional("-1") long offset,
                      @Optional("4294967296") long maxLen)
    if (filename.length() == 0) {
      env.warning(L.l("file name must not be null"));
      return null;

    BinaryStream s = fopen(env, filename, "r", useIncludePath, context);

    if (! (s instanceof BinaryInput))
      return null;

    BinaryInput is = (BinaryInput) s;
    {, BinaryInput.SEEK_SET);
    StringValue bb = env.createLargeBinaryBuilder();
    bb.appendReadAll(is, maxLen);

    return bb;
Attached Files

- Relationships

There are no notes attached to this issue.

- Issue History
Date Modified Username Field Change
11-16-10 16:15 fredo New Issue
11-17-10 03:16 kdecherf Issue Monitored: kdecherf

Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
28 total queries executed.
25 unique queries executed.
Powered by Mantis Bugtracker