Bug 16228 - shared-mime-info detects a PHP file as HTML
Summary: shared-mime-info detects a PHP file as HTML
Status: RESOLVED NOTOURBUG
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:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
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:


Attachments

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

<html>
<head>
<title>Test</title>
</head>
<body>
<?php echo 'Test'; ?>
</body>
</html>

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.