#4288 [Com]: parse error when trying to use <?xml ... ?> declaration

From: Date: Tue, 01 Oct 2002 12:09:06 +0000
Subject: #4288 [Com]: parse error when trying to use <?xml ... ?> declaration
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-20916@lists.php.net to get a copy of this message
ID: 4288 Comment by: xanthor@netcourrier..com Reported By: hrothgar@techie.com Status: Closed Bug Type: Scripting Engine problem Operating System: Linux i586 2.2.14 PHP Version: 4.0 Release Candidate 1 New Comment: A solution is to write : <?php echo('<?xml version="1.0" encoding="UTF-8"?>'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> Previous Comments: ------------------------------------------------------------------------ [2000-05-02 00:29:04] hrothgar@techie.com I tried that. Made the change, then did apachectrl restart. Still gave me the parse error. Sounds like the short tags option isn't working. ------------------------------------------------------------------------ [2000-05-01 23:22:40] rasmus@cvs.php.net Edit your php.ini file and turn off the short tags. Then use <?php ... ?> for your PHP tags. ------------------------------------------------------------------------ [2000-05-01 22:20:12] hrothgar@techie.com Situation: I'm trying to use XHTML (HTML meets XML) to build a site. In my current implementation, I'm trying to use an include statement to insert the workings of a header.php file, but for simplification purposes, I've reduced the problem down to a single, *static* file for the parser to chew on. Consider the file, test.php, to illustrate the problem: >>>test.php <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head>foo</head> <body>bar</body> </html> <<<test.php I get the following parse error when trying to view this: Parse error: parse error in /home/httpd/html/test.php on line 1 It appears that the php parser is not respecting the <?xml tag as being a non-php tag. If a non-php <?* tag is found, the parser should simply quote the tag instead of just dieing (IMHO). Thanks configuration: ./configure --with-mysql --with-axps --disable-debug apache 1.3.9 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=4288&edit=1

« previous php.bugs (#20916) next »