php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71434 finfo throws notice for specific python file
Submitted: 2016-01-22 18:49 UTC Modified: 2016-01-24 16:26 UTC
From: bluewind at xinu dot at Assigned:
Status: Closed Package: Filesystem function related
PHP Version: 7.0.2 OS: Arch Linux
Private report: No CVE-ID: None
 [2016-01-22 18:49 UTC] bluewind at xinu dot at
Description:
------------
Finfo and releated functions throw a Notice for certain files when using php 7.0.2. This is not the case when using 5.6.17.

Test script:
---------------
<?php
$a='#!env python
# -*- coding:utf-8 -*-

from serial import Serial
from sys import exit
';
$finfo = new finfo(FILEINFO_MIME_TYPE);
echo $finfo->buffer($a) . "\n";



Expected result:
----------------
text/x-python

Actual result:
--------------
Notice: Array to string conversion in /home/flo/test.php on line 9
text/x-python

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-01-24 16:17 UTC] laruence@php.net
This seems a little weird , the origin problem is in 5.6 branch: https://github.com/php/php-src/commit/46906925#diff-56e765972d18c84894ea061cfe58076aR1757

if (zend_hash_has_more_elements_ex(ht, &outer_pos) == SUCCESS &&
                    zend_hash_move_forward_ex(ht, &outer_pos)) {
}

the zend_hash_move_forward_ex(ht, &outer_pos) should return SUCCESS(0) on okey.

but this condition seems expect it return FAILURE...

not sure, what does it really want to do here :<


thanks
 [2016-01-24 16:26 UTC] laruence@php.net
-Status: Open +Status: Analyzed
 [2016-01-25 03:50 UTC] laruence@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=da7f42de38e02f49aa156d4717385f9a157222ce
Log: Fixed bug #71434 (finfo throws notice for specific python file)
 [2016-01-25 03:50 UTC] laruence@php.net
-Status: Analyzed +Status: Closed
 [2016-07-20 11:33 UTC] davey@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=da7f42de38e02f49aa156d4717385f9a157222ce
Log: Fixed bug #71434 (finfo throws notice for specific python file)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 08:01:29 2024 UTC