Re: WEIRD, WEIRD problem with upgrade to 4.0.5

From: Date: Fri, 11 May 2001 16:47:57 +0000
Subject: Re: WEIRD, WEIRD problem with upgrade to 4.0.5
References: 1  Groups: php.dev php.general 
Request: Send a blank email to php-dev+get-54885@lists.php.net to get a copy of this message
As I said before, it is most likely due to the newlines that PHP can not recognize. You do not see the newlines, so as far as you are concerned, the code is totally valid. But this is not what PHP sees - PHP sees a long string rather than multiple lines in your code because it treats a single '\r' as a whitespace.. Try to replace all single '\r' in your code with '\n' or '\r\n'. This sould be a simple script that does not damage any of your scripts, can do that automatically, and should fix the problem.. The problem usually comes from editing your code with different editors - one uses '\r' as a newline, and the other - 'r\\n', for example. So some of your code will be broken, and some - not.. To make things more confusing, PHP allows you to have several statements on one line (sometimes), so in some places '\r' will not break it while in some other it will.. For example (I make newlines visible), if(x>y){\r echo "hellow";\r }\r will be seen by php as: if(x>y){ echo "hellow;} Which is a valid statement. But if you do: if(x>y){\r // say hellow \r echo "hellow";\r }\r which will be seen by php as: if(x>y){ // say hellow \r echo "hellow;} Which is obviously broken. In fact, php should give you an error because among other things you just commented out the closing curly bracket. Now, if you used UNIX-style or DOS-style ('\n' or '\r\n') newlines instead, everything would be fine Bottom line: It is not a // comments problem, you do not have to switch to /* */ comments, just take your hex editor, look at your source file in hex (pay attention to newlines) and replace them with proper newlines. That should fix that. Take care, Vlad P.S. Crossposting is a bad idea, so please select which list you really think his should be posted to. I think it is the right question for php-general, but I do not subscribe there, so I won't get anything you post there. Maxim Maletsky wrote:
well, I don't think that was the reason... because <? echo 'hello world'; // please no... echo '<BR>'; ?> will print me: // please no... echo '<BR>'; any further ideas? Maxim Maletsky -----Original Message----- From: Vlad Krupin [mailto:vlad@php.net] Sent: Friday, May 11, 2001 7:12 AM To: Maxim Maletsky Cc: 'PHP General List. (E-mail)'; 'php-dev@lists.php.net'; 'php-bugs@lists.php.net' Subject: Re: [PHP-DEV] WEIRD, WEIRD problem with upgrade to 4.0.5 That's most likely because you have newlines that PHP does not understand (it should in 4.0.6). In particular, the newline just before the // comment that got printed out where it should not is probably mac-style '\r' instead of unix-style '\n' or dos-style '\r\n'. Fix those newlines and everything will work like a charm, or wait tilll 4.0.6 and hope it works:) Vlad Maxim Maletsky wrote:
Hello everyone. in short: I had upgraded PHP from 4.0.1pl2 to 4.0.5. and this is what happened: The pages started breaking on '//' (YES, ON COMMENTS!) If there's no '//' then it works ok, but when it encounters any backslashes-commented line like here: -- <? $special_folder = 'inc'; $DoNotQuit =True; if( !$config_inc_def ) include("$DOCUMENT_ROOT/inc/config.php"); session_start(); session_register('array_ra'); session_register('PV'); session_register('w3'); session_unregister('view'); //unset($view); if (isset($w3)) $time_spent = time()+1-$w3; $w3 = time(); include ("$DOCUMENT_ROOT/inc/head.php"); -- IT CRASHES! The weird thing is that there a config file included before, and it HAS a WHOLE BUNCH of '//' but the page goes well until the first '//'
encountered.
AND, THE CODE IS BEING SHOWN ON THE PAGE! to give you an idea: -- config.inc echo "What the "; // should print some --- -- test.php include('conf.inc'); echo 'hell'; --- this works fine prints 'What the hell' but if modify test.php: -- test.php include('conf.inc'); // should work too.. echo 'hell'; --- it prints: 'What the // should work too..' ISN'T THAT WEIRD? WHAT IS IT? I cannot keep testing any further since we had out server down for the
whole
20 mins and had to place back from the tapes old PHP4.0.1pl2. CONCLUSION: IT WORKS ON 4.0.1pl2 AND CRASHES ON 4.0.5 MY PRESUMPTIONS: A BUG PHP COMPILED AS: --with-mysql --with-pgsql --with-apxs --enable-track-vars WHAT WAS CHANGED: php 4.0.5 is now also compiled --with-pgsql while the previous installation wasn't PLATFORM: LINUX Red Hat 6.1 Apache 1.3.9 Please help us with this. Sincerely, Maxim Maletsky Web Developer Digital Media, Japan Inc Communications www.japaninc.com maxim@japaninc.com TEL: 03-3499-2175 x 1271 FAX: 03-3499-3109


« previous php.dev (#54885) next »