|
Mantis - Quercus
|
|||||
| Viewing Issue Advanced Details | |||||
|
|
|||||
| ID: | Category: | Severity: | Reproducibility: | Date Submitted: | Last Update: |
| 4296 | major | always | 11-16-10 16:15 | 11-16-10 16:15 | |
|
|
|||||
| Reporter: | fredo | Platform: | |||
| Assigned To: | OS: | ||||
| Priority: | normal | OS Version: | |||
| Status: | new | Product Version: | 4.0.13 | ||
| Product Build: | Resolution: | open | |||
| Projection: | none | ||||
| ETA: | none | Fixed in Version: | |||
|
|
|||||
| 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 |
||||
| Steps To Reproduce: | |||||
| Additional Information: |
should be fixed like: @ReturnNullAsFalse 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; if(offset>0) { is.seek(offset, BinaryInput.SEEK_SET); } StringValue bb = env.createLargeBinaryBuilder(); bb.appendReadAll(is, maxLen); s.close(); return bb; } |
||||
| Relationships | |||||
| Attached Files: | |||||
| There are no notes attached to this issue. |