|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #58614 xhprof_runs.php expects PHP6 constant FILE_BINARY
Submitted: 2009-04-03 08:33 UTC Modified: 2009-04-03 16:38 UTC
From: harry at local dot ch Assigned: kannan (profile)
Status: Closed Package: xhprof (PECL)
PHP Version: 5.2.6 OS:
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.
Block user comment
Status: Assign to:
Bug Type:
From: harry at local dot ch
New email:
PHP Version: OS:


 [2009-04-03 08:33 UTC] harry at local dot ch
Using the xhprof UI (through index.php), seeing errors like;

Notice: Use of undefined constant FILE_BINARY - assumed 'FILE_BINARY' in /home/harry/public_html/xhprof_lib/utils/xhprof_runs.php on line 119

According to;

    The content is read as binary data. This is the default setting and cannot be used with FILE_TEXT. This flag is only available since PHP 6. 

This package reports it requires PHP 5.2.0+ not PHP6


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-04-03 10:47 UTC]
Looks like for 5.x versions, file_get_contents() doesn't support the "flags" argument anyway, and that we should simply drop the 2nd (FILE_BINARY) argument from the call.

i.e. change:
$contents = file_get_contents($file_name, FILE_BINARY); 
$contents = file_get_contents($file_name);

Can you try that out to see if it fixes your issue? 

When we get a chance, we'll try it out as well, and put in a fix.
 [2009-04-03 10:57 UTC] harry at local dot ch
> Can you try that out to see if it fixes your issue? 

Tried it - solves the problem.

Looking closer at the purpose of FILE_BINARY, I believe that relates to purely PHP6 features anyway - it tells PHP6 not to try to be smart about character set handling / conversion when reading a file.
 [2009-04-03 15:10 UTC]

Thanks for reporting the issue and trying out the fix.


To summarize/clarify: This issue shouldn't cause any functional incorrectness. It'll cause notice messages to be spewed when browsing your report. We'll put in the fix.

Also note: the issue exists in XHProfRuns_Default() which is just meant to be a sample implementation of the iXHProfRuns interface. 

We anticipate users will provide their own implementation of iXHProfRuns (e.g., to save the results to a central DB, or to compress the data before saving, etc.).

For example, in the save_run() step you can do a:

and in the get_run() you can return:
 [2009-04-03 16:38 UTC]
This bug has been fixed in CVS.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on

In case this was a website problem, the change will show
up on the website in short time.
Thank you for the report, and for helping us make PECL better.

cvs head has the fix now. 

The next release (0.9.2) should have it as well.
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sun Jan 19 07:01:23 2020 UTC