Bug #68250 [NEW]: Crash when finfo_buffer() used in object method

From: Date: Fri, 17 Oct 2014 12:08:10 +0000
Subject: Bug #68250 [NEW]: Crash when finfo_buffer() used in object method
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-188156@lists.php.net to get a copy of this message
From: miloslav dot hula at gmail dot com Operating system: Linux PHP version: master-Git-2014-10-17 (Git) Package: Scripting Engine problem Bug Type: Bug Bug description:Crash when finfo_buffer() used in object method 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) -- Edit bug report at https://bugs.php.net/bug.php?id=68250&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=68250&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=68250&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=68250&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=68250&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=68250&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=68250&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=68250&r=needscript Try newer version: https://bugs.php.net/fix.php?id=68250&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=68250&r=support Expected behavior: https://bugs.php.net/fix.php?id=68250&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=68250&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=68250&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=68250&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=68250&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=68250&r=dst IIS Stability: https://bugs.php.net/fix.php?id=68250&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=68250&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=68250&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=68250&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=68250&r=mysqlcfg

« previous php.bugs (#188156) next »