php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49130 sha1_file() returns incorrect/unpredictable values
Submitted: 2009-08-01 10:47 UTC Modified: 2009-08-25 01:00 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: adam at elishome dot org Assigned:
Status: No Feedback Package: hash related
PHP Version: 5.2.10 OS: freebsd
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: adam at elishome dot org
New email:
PHP Version: OS:

 

 [2009-08-01 10:47 UTC] adam at elishome dot org
Description:
------------
The value returned for the sha1_file() function is not reliable.

The sha1_file function's result in PHP 5.2.10 is not the same as the sha1 value returned by the freebsd system, or by ruby's sha1 function.

PHP 5.2.9 always returns the correct sha1 values, but 5.2.10 does not.  It occasionally gets it right, but the large majority of the time it is incorrect.

Reproduce code:
---------------
Lookup a file's sha1 value using PHP 5.2.9 using the sha1_file function (or using freebsd's system function, or using Ruby's sha1 function), and then compare it to the value returned by PHP 5.2.10's sha1_file function.

Expected result:
----------------
I expect the sha1_file function to return correct values.

Actual result:
--------------
The values returned by sha1_file were not correct.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-08-13 09:56 UTC] sjoerd-php at linuxonly dot nl
Thank you for your bug report.

Since I could not reproduce it, I have some questions for you. Can you reproduce the problem on a system with another OS? Is the output of php-5.2.10 sha1_file consistent for a given file, or does it give a different output each time? Can you supply an example file which gives a wrong hash, with both the good and the wrong hash?
 [2009-08-17 02:08 UTC] scottmac@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.

I can't reproduce this.

Nothing in the sha code has changed in 2+ years.
 [2009-08-25 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Apr 19 04:01:23 2021 UTC