php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #63329 Read Error
Submitted: 2012-10-22 06:52 UTC Modified: 2012-11-12 22:42 UTC
From: pam at metanet dot ch Assigned: salathe
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS: Any
Private report: No CVE-ID:
 [2012-10-22 06:52 UTC] pam at metanet dot ch
Description:
------------
---
From manual page: http://www.php.net/function.exif-imagetype#refsect1-function.exif-imagetype-returnvalues
---
Can you propably write in the php doc that if the file is smaller than 11 bytes and you call the function exif_imagetype() for it, there is a "Read Error!" thrown.

Test script:
---------------
<?php

// Throws "Read Error!"
$returnValue = exif_imagetype('less11bytes.txt');
var_dump($returnValue);

// Workaround against a "Read Error!"
$returnValue = (filesize('less11bytes.txt') > 11)?exif_imagetype('less11bytes.txt'):false;
var_dump($returnValue);

?>

Expected result:
----------------
Notice:  exif_imagetype() [function.exif-imagetype]: Read error! in C:\xampp\htdocs\test.php on line 12

bool(false)
bool(false)


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-10-31 20:26 UTC] mail+php at requinix dot net
It requires somewhere between 3 and 12 bytes, depending on what it finds as it 
reads bytes in from the file. At least it's just a notice, right?

Did you know you can easily submit changes to the online documentation? Look for 
the [edit] link in the top-right corner of manual pages.

I've created a patch mentioning the caveat:
"exif_imagetype requires a minimum number of bytes (bug #63329)"
http://edit.php.net/?patchID=756&project=PHP
 [2012-11-12 22:33 UTC] salathe@php.net
Automatic comment from SVN on behalf of salathe
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=328333
Log: exif_imagetype (actually standard/image.c, php_getimagetype) requires between 3 and 12 bytes in a file, otherwise it E_NOTICEs. (doc #63329)

--
Provided by anonymous #22227 (mail+php@requinix.net)
 [2012-11-12 22:42 UTC] salathe@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.

Committed requinix's patch.
 [2012-11-12 22:42 UTC] salathe@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: salathe
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Sat Apr 19 01:01:59 2014 UTC