
- You are not logged in. | Login
March 14, 2007 8:02 am
- bobbee
- Member


Server suddenly stops working when connecting two functions
To say in a few words, the situation is following (though I understand it is silly): having decoded some entity (html_entity_decode) php-runner makes preg_replace work as exit(). At this it finishes the work correctly; the process is not left to stick.
<?
ob_implicit_flush();
error_reporting(E_ALL);
for($i=0;$i<250;$i++) echo "<!-- -->";
echo $blabla; // here is an error to make you see that errors are displayed
echo "line " . __LINE__ . "<br>"; // line 6
$var = file_get_contents("test.txt");
echo "line " . __LINE__ . "<br>"; // line 8
$var = html_entity_decode($var);
echo "line " . __LINE__ . "<br>"; // line 10
$var = preg_replace("/^.+?(\<body.+?\/body\> ).+?$/is", "$1", $var);
echo "line " . __LINE__ . "<br>"; // line 12
echo "<pre><xmp>"; print_r($var); echo "</xmp></pre>";
?>We read txt-file into line and try to do some manipulations.
script finishes its work on the line 11 without having accomplished at least half of the necessary operations but without any errors.
Place where the script breaks down and, to tell more precisely, the reason of it is IMPOSSIBLE to discover as far as any manipulation (editing) with txt-file results into normal script’s work.
The script works as well if you make trim or don’t make html_entity_decode.
Help me to analyze the situation.
As a matter of fact I’m interested in the reason of work finishing on preg_replace WITHOUT any errors.
In order to evade them in the future.
Concerning txt-file I can say only that it has symbol end_of_line but, as I already said, it’s difficult to understand if it matters as far as any editing of the file results into working ability.
P.S. PHP Version 5.0.4, Apache 2.0 Handler
March 14, 2007 8:05 am
- reetesh
- Member


Re: Server suddenly stops working when connecting two functions
The matter could be in the archive 
March 14, 2007 8:09 am
- bobbee
- Member


Re: Server suddenly stops working when connecting two functions
reetesh, could you write more detailed about >$1. I cannot realize it completely.
It seems to me that by archive manipulations txt-file is spoilt. At least, at my local after archive everything functions properly.
I hope that someone has already faced such a situation when by crossing from html_entity_decode to preg_replace script finished its work without any error and he is able to explain the reason to me…
I’m going to examine bug reports a bit later because I’m tired.
March 14, 2007 8:13 am
- reetesh
- Member


Re: Server suddenly stops working when connecting two functions
Apache/1.3.33 (Win32) PHP/5.2.0:
Notice: Undefined variable: blabla in test.php on line 5 line 6 line 8 line 10 line 12 <body> <p><a HREF="software.html">programs for free</a> <br> <a HREF="software.html">software for sale</a> <br> <a HREF="contact.html">contact programs (software) developer</a> <br> Variety of programs, shareware and freeware. PDF2DOC which allows you to extract contents of PDF file (Adobe Acrobat) to DOC file (Microsoft Word), in other words it allows you to convert PDF to DOC. Another program is MP3 Tools Professional, which works with MP3 files and you can split mp3, join mp3, sort mp3, find duplicates of mp3, encode mp3 and decode mp3, and many other tools for your mp3 collection. Auto Mouse, which in other words is a mouse clicker or cursor clicked, automated computer use and automated mouse mover. Record mouse position and play back what you recorded. Play games like POGO and do other useful tasks with AutoMouse. FOREX Analyzer is the newest title. Foreign exchange market analysis program. FOREX tips or forex hints, program provides forex signals and gives you accurate sell signals and buy signals. Great investment opportunity with low risk and high profit. Foreign exchange analyzer can also do it automatically while you're away or sleeping, making you easy money. There are numerous of other free titles, like fake emailer to sand anonymous e-mail, America Online Instant Messenger (AIM) tools and plug-ins, mIRC for IRC network and java applets supporting IRC just like AIM can write in color, fade colors, randomize colors and randomize fonts, and other misc programs random wallpaper (wallpaper changer), etc. If you have any questions, you can contact me via contact page and I'll be glad to help out. Dmitri Kisten (DIMSOFT, designer and developer.). </p> </body>
March 14, 2007 8:17 am
- bobbee
- Member


Re: Server suddenly stops working when connecting two functions
Well, it works after the archive. Fixing isn’t a problem – trim is enough. I just want to realize why this all happens. Do I need var_dump?
March 14, 2007 8:20 am
- reetesh
- Member


Re: Server suddenly stops working when connecting two functions
Frankly speaking, I don’t understand you.
Why are you talking about archive? It just transfers files as they are on your hard and records checksum for integrity verification.
Give me the script that ‘suddenly stops working’, I will debug it and we’ll continue our conversation. I haven’t seen anything by the time.
March 14, 2007 8:25 am
- bobbee
- Member


Re: Server suddenly stops working when connecting two functions
If only I could understand it myself…
You already have the script. This is the same as at the page.
The txt-file in the link is the same with which script works.
As I said, by each manipulation with file such as editing, archiving etc. the script works at once.
To get absolutely clean file you are to request it with socket here http://www.dimsoft.com/ as far as with file_get_contents we get quite the different things.
So I ask for an advice here because it’s difficult for me to understand what the reason is. By any other circumstances I would manage it myself.
Look, it’s nonsense: having decoded any entity the script makes preg_replace work as как exit(); Isn’t it stupid? At this it finishes the work correctly.
March 14, 2007 8:30 am
- monkeydude
- Member


Re: Server suddenly stops working when connecting two functions
PHP Version 5.0.4
You seem to be fond of ancient things
You are to update up to 5.2.1. first and then we’ll see…
March 14, 2007 8:34 am
- bobbee
- Member


Re: Server suddenly stops working when connecting two functions
Today I updated up to 5.0.5 and the bug disappeared at once…
At this in all the rpm-repositories there is only 5.0.4 for FC4. I’ve found 5.0.5 in the testing variant only. The latest PHP-versions demand new libraries and those in their turn demand axis core renewal which is not good.
If someone ever occasionally (or on purpose) faces a bug like this and examines it carefully (occasionally or on purpose), I beg you to let me know about entity (maybe it’s the symbols’ order) that has such results.


