Bug 16228 - shared-mime-info detects a PHP file as HTML
Summary: shared-mime-info detects a PHP file as HTML
Alias: None
Product: shared-mime-info
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: x86 (IA32) Linux (All)
: high critical
Assignee: Jonathan Blandford
QA Contact:
Depends on:
Reported: 2008-06-04 11:41 UTC by Brett Alton
Modified: 2008-06-11 07:40 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Description Brett Alton 2008-06-04 11:41:17 UTC
Create a file that mimics:

<?php echo 'Test'; ?>

and save it as 'test.php'.

Open the file in a program such as gEdit and the file will be detected as HTML and not PHP, even though the file extension is .php and there is php code embedded (ie: '<?php')
Comment 1 Bastien Nocera 2008-06-11 07:40:28 UTC
gedit should probably use the mime-type from the globs first, rather than rely solely on the data.

As for detecting the file as HTML rather than PHP, the problem is that we only look in the first 64 characters for "<?php". And your test case is correctly detected as a PHP file...

Bring up this problem with the gedit developers, they should act on the extension first, before checking the data.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.