php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68250 Crash when finfo_buffer() used in object method
Submitted: 2014-10-17 12:08 UTC Modified: 2014-10-17 15:13 UTC
From: miloslav dot hula at gmail dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: master-Git-2014-10-17 (Git) OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: miloslav dot hula at gmail dot com
New email:
PHP Version: OS:

 

 [2014-10-17 12:08 UTC] miloslav dot hula at gmail dot com
Description:
------------
Testing on af3354dc43ae3c4bc6c9a9fb74aee2d9c2f406e3 (10.10.2014).

When calling finfo_buffer() from class method context, warning is emmited. It looks like the function is thinking that is finfo::buffer().

When I uncomment the first call in test below, I get SIGSEGV.

Test script:
---------------
// var_dump(finfo_buffer(finfo_open(FILEINFO_MIME_TYPE), '<!DOCTYPE html>'));

class Test
{
    public function detect()
    {
        return finfo_buffer(finfo_open(FILEINFO_MIME_TYPE), '<!DOCTYPE html>');
    }
}

var_dump(finfo_buffer(finfo_open(FILEINFO_MIME_TYPE), '<!DOCTYPE html>'));
var_dump((new Test)->detect());


Expected result:
----------------
string(9) "text/html"
string(9) "text/html"


Actual result:
--------------
string(9) "text/html"

Warning: finfo_buffer() expects parameter 2 to be long, string given in /tmp/php7/finfo.php on line 7
bool(false)


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-10-17 14:49 UTC] nikic@php.net
-Status: Open +Status: Feedback
 [2014-10-17 14:49 UTC] nikic@php.net
I've applied a fix in this direction just yesterday (https://github.com/php/php-src/commit/cf5920e8aa8958d47f391c483d7399fc77a58092), could you try a more recent build and confirm that the issue is resolved?
 [2014-10-17 15:13 UTC] miloslav dot hula at gmail dot com
-Status: Feedback +Status: Closed
 [2014-10-17 15:13 UTC] miloslav dot hula at gmail dot com
Yes, the commit fixed that. I'm sorry for duplicating. Closing.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 12 05:01:33 2025 UTC