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')
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.