#44655 [Bgs]: > closes PHP script rather than ?>

From: Date: Mon, 07 Apr 2008 22:57:18 +0000
Subject: #44655 [Bgs]: > closes PHP script rather than ?>
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-124062@lists.php.net to get a copy of this message
ID: 44655 User updated by: william at ash dot id dot au Reported By: william at ash dot id dot au Status: Bogus Bug Type: Scripting Engine problem Operating System: Windows XP SPII PHP Version: 5.2.5 New Comment: Jani if you read my second comment ([7 Apr 1:38am UTC] william at ash dot id dot au) you would note that I picked up the missing ' on line three - this was due to my cutting and pasting of text. Even with the ' in the script it still doesn't work - I have also attached a copy of a mail.php script which I do use on a production server (Linux) and it doesn't work on my recently installed windows server. Please wake up and read the complete bug before calling it Bogus otherwise people might think you are a bunch of idiots! Or maybe have a high list of bugs - which would either suggest that PHP sucks or that your method of listing bugs sucks and that finding detail on whether a bug already exists for a problem is available. I am going with the latter case as I tried searching bugs for an answer and found either nothing or 100's or 1,000's of results - either way both were inadequate. I tried searching for > and ?> and got nothing - I expect that is because it is to short a string for searching. Then I tried end tag which got nothing too! then i tried close - which gave 900+ results which I looked through until the date was before the release I am using and thought it wouldn't be there. One of my scripts - mail.php works on my websites ash.id.au and billyash.com.au - under the "Contact Us" link in the drop down menu. Yet when I run it on my windows machine running PHP 5.2.5 and Apache 2.2.8 I get the following PHP script being displayed on my web page: $from, 'To' => $to, 'Subject' => $subject); $smtp = Mail::factory('smtp', array ('host' => $host, 'auth' => true, 'username' => $username, 'password' => $password)); $mail = $smtp->send($to, $headers, $comments2); if (PEAR::isError($mail)) { echo(" " . $mail->getMessage() . " "); } else { echo(" Message successfully sent! "); ?> Your Email Address : If you don't put an e-mail address the e-mail won't send - you could use a dummy e-mail like someone@nowhere.com if you would like to remain anonymous There are some graphics in the above screen dump. Again the issue is that the PHP terminates at the first > in the PHP script - although the other script it is the second > - but they both terminate at a > and that is the only commonality that I can see. The complete mail.php script that works on my server but not on my windows machine is: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Contact BillyAsh Pty Ltd - Email Form</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <?php //check if the submit button has been pressed. $submit = $_GET['submit']; //if the submit button has been pressed, send the email if ($submit == 'true') { require_once "Mail.php"; $from = $_POST[txtEmail]; $subject = $_POST[txtSubject]; $comments = $_POST[txtComments]; $contact = $_POST[contactyesno]; $comments2 = $comments . $contact; $to = "support@billyash.com.au"; // this is the email address to send the form results to $host = "localhost"; $username = "support@billyash.com.au"; // replace with your email address hosted by MD Webhosting $password = "french06"; // replace with the password for your email address $headers = array ('From' => $from, 'To' => $to, 'Subject' => $subject); $smtp = Mail::factory('smtp', array ('host' => $host, 'auth' => true, 'username' => $username, 'password' => $password)); $mail = $smtp->send($to, $headers, $comments2); if (PEAR::isError($mail)) { echo("<p>" . $mail->getMessage() . "</p>"); } else { echo("<p>Message successfully sent!</p>"); ?> <a href="index.html"><img src="images/homepage.gif" width="78" height="28" border="0"></a> <?php } } // if the submit button has not been pressed, display the email form else { ?> <table border="0"> <form action="mail.php?submit=true" method="post"> <tr> <td>Your Email Address :</td> <!--<td><textarea name="txtEmail" rows="1" wrap="off" cols="35" text=""></textarea></td> --> <td><input type="text" name="txtEmail" size="80"></td> </tr> <tr> <th colspan="2"> <p align="center">If you don't put an e-mail address the e-mail won't<br> send - you could use a dummy e-mail like someone@nowhere.com if you would like to remain anonymous </tr></p> <tr> <td valign="top">Subject :</td> <!--<td><textarea name="txtSubject" rows="1" wrap="off" cols="35" text=""></textarea></td> --> <td><input type="text" name="txtSubject" size="80"></td> </tr> <tr> <td valign="top">Comments :</td> <td><textarea name="txtComments" rows="20" wrap="ON" cols="60" text=""></textarea></td> </tr> <tr></tr> <tr> <th colspan="2"> <p align="left">Please check this check box if you would like a reply: </p> <tr> <td> <input type="checkbox" name="contactyesno" td=""> </td> </tr> <tr></tr> <td><input type="submit" value="Send"></td></tr> </form> </table> <br> <a href="index.html"><img src="images/homepage.gif" width="78" height="28" border="0"></a> </body> </html> <? } ?> If you do find an error in the script then can you please advise why it works on my server but not on my windows machine? I am sorry if I was rude at the top of my posting - I was a little annoyed to think that someone thought that I posted a bug because of my own incompetence. I admit that I occassionally make mistakes but if the bug was read and understood - the main point I think I made was that a script works on one machine but not on another. Previous Comments: ------------------------------------------------------------------------ [2008-04-07 12:06:43] jani@php.net Your example has missing ' on line 3. No bug here. ------------------------------------------------------------------------ [2008-04-07 02:07:24] william at ash dot id dot au Looks like I won't need to do a backtrace - as nothing crashes! It just interprets information incorrectly - resulting in incorrect output! ------------------------------------------------------------------------ [2008-04-07 01:42:02] william at ash dot id dot au I also have PEAR installed ------------------------------------------------------------------------ [2008-04-07 01:38:23] william at ash dot id dot au Looks like I left the ' off my original script - I was cutting and pasting. In the Reproduce Code: section echo '<p>This also is PHP</p>; should have a ' between </p> and ; like echo '<p>This also is PHP</p>'; ------------------------------------------------------------------------ [2008-04-07 00:31:28] william at ash dot id dot au Description: ------------ I have two scripts that work fine on my website hosted by outside server. I installed to PHP on home computer for testing future scripts. The two scripts I do have use a > from a html tag within the PHP script to close the PHP script. There is no ? before the > so it should not do this. for some reason the PHP is terminating with the first > it comes across instead of needing a ?> - please help. Modules that I installed with PHP 5.2.5 for Windows running Apache 2.2.8 are: cvsclient, dio, docblock, event, EXIF, FDF, Fileinfo, GD2, Gettext, htscanner, pecl_http, id3, IMAP, Java, mailparse, Mimetype, MySQLi, ntuser, oggvorbis, OpenSSL, Operator, parsekit, PDFlib, phar, PHPDoc, POP3, Printer, sdo, Shared Memory, SMTP, SOAP, Sockets, Standard PHP, SQLite, ssh2, Tidy, threads, timezonedb, win32ps, win32schedule, win32service, win32std, zip and zlib_filter. This problem occured before making any changes to my php.ini file - I have tried making changes to it to correct it but nothing I have done has made a difference. I haven't done a backtrace yet as I am hoping that this isn't the first issue and I couldn't locate the bug relating to this and there is a simple answer - if a backtrace is needed please let me know. Reproduce code: --------------- Script that does cause the problem. <?php echo '<p>This is PHP</p>'; echo '<p>This also is PHP</p>; ?> Expected result: ---------------- This should output "This is PHP" and "This also is PHP" to the screen Fix implemented to make it work (below) - which won't help on complicated scripts so I would appreciate a fix! <?php echo '<p>This is PHP</p> <?php echo '<p>This also is PHP</p> Actual result: -------------- but it outputs This is PHP '; echo ' This also is PHP '; ?> the > at the </p> on the first <p>...</p> html tag is closing the PHP script - it is identical problem on my other script - it's not actually the first > as there is one in the opening <p> tag - it's the one (>) after a closing </p> tag so I expect that the / (forward slash) might have something to do with it too! ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=44655&edit=1

« previous php.bugs (#124062) next »