PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » HTTP » HTTP_Upload » Bug #6678

Missing return statement in HTTP_Upload::isMissing()

Details

Submitted2006-02-03 04:00 UTC
Fromowen at op-design dot com
Assignedwenz
StatusClosed
PackageHTTP_Upload
PHP Version4.4.2
OSRedHat Enterprise 3
Roadmaps(Not assigned)

Comments

[2006-02-03 04:00 UTC] owen at op-design dot com

Description:
------------
In the isMissing function in HTTP_Upload, a return statement on line 475 of Upload.php is missing. This makes it so that if an error is raised, it cannot be caught using the normal method to check for an error.

Like 475 is:

$this->raiseError('NO_USER_FILE');

It should be:

return $this->raiseError('NO_USER_FILE');

Test script:
---------------
---------- HTML Upload Form ---------
<form enctype="multipart/form-data" action="myupload.php" method="POST">
<input type="hidden" name="step" value="1">
<input type="hidden" name="MAX_FILE_SIZE" value="100000" />
Upload File: <input name="f[]" type="file" />

<p><input type="submit" value="Upload >>" />
</form>

----------- myupload.php -----------

require_once 'HTTP/Upload.php';

$upload = new HTTP_Upload('en');
$upload_error = $upload->isMissing();
if (PEAR::isError($upload_error)) {
echo "No files were uploaded. Please go back and try again.";
}

Expected result:
----------------
An error should be raised. No error will be raised if no files are attached.

Actual result:
--------------
No error is raised.