This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 2418 - PHP file validation
Summary: PHP file validation
Status: RESOLVED INVALID
Alias: None
Product: Validator
Classification: Unclassified
Component: check (show other bugs)
Version: HEAD
Hardware: PC Windows XP
: P5 normal
Target Milestone: ---
Assignee: Terje Bless
QA Contact: qa-dev tracking
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-10-25 18:58 UTC by Bryan
Modified: 2005-10-25 23:16 UTC (History)
0 users

See Also:


Attachments

Description Bryan 2005-10-25 18:58:03 UTC
I am receiving the follwoing error when I try to validate a .php file;

Sorry, I am unable to validate this document because its content type is 
application/octet-stream, which is not currently supported by this service. 

The Content-Type field is sent by your web server (or web browser if you use 
the file upload interface) and depends on its configuration. Commonly, web 
servers will have a mapping of filename extensions (such as ".html") to MIME 
Content-Type values (such as text/html). 

That you received this message can mean that your server is not configured 
correctly, that your file does not have the correct filename extension, or 
that you are attempting to validate a file type that we do not support yet.

However, If I JUST rename the file to .html it passes validation.

What could be the problem?
Thanks
Comment 1 Terje Bless 2005-10-25 20:10:23 UTC
Your web server or your PHP code is broken. It's claiming the output of
your PHP is arbitrary binary data ("application/octet-stream") instead
of HTML ("text/html") as it should.

Take a look at http://php.net/header or ask on some PHP related forum
for help with fixing this.

In either case, this is not a Validator bug.
Comment 2 Bryan 2005-10-25 23:06:59 UTC
Hi,

This is the header of my php file;

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
   
   
<!-- Administrator registration and validation adminform.php -->

   <head>
      
      <title>Administrator Registration Form Validation</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>

Content is set to text/html as you can see.
Comment 3 Bj 2005-10-25 23:11:16 UTC
The <meta http-equiv="Content-Type" ... is not relevant here. Also, it sounds 
like you are using the file upload validation rather than by web address, in 
this case your browser determines the Content-Type it reports to the web server 
when uploading the file. It probably does not recognize .php files and uses 
some default content type. In this case it might be difficult for you to use 
the file upload feature with your PHP code.
Comment 4 Olivier Thereaux 2005-10-25 23:16:20 UTC
If you are using the file upload interface, try to rename your files with extensions .html, this will probably 
help your browser send proper content-type information with the upload.

If you are using the "by URL" interface, follow the instructions in Comment #1.