The following snippet of code is an example of the code that is causing me problems.
I am reading in html meta data (one meta data record per line) from a text file and inserting it into a html document.
I find that if the line of meta data gets long ~500 characters, php seems to insert a line break:
ie. the following line of input is cut off at the 496th character:
<meta name="DC.Description" content="The victim impact statement (VIS) is a significant initiative which embraces concerns about victims' rights in a manner consistent with existing legal principles. The author describes overseas and Australian legislative responses to this issue and presents the arguments for and against the VIS. She also presents research findings on key questions relating to the effects and outcomes of the VIS. She argues that the VIS should be considered for adoption by all Australian jurisdictions.">
resulting in the output (the first line is 505 characters long):
<meta name="DC.Description" content="The victim impact statement (VIS) is a significant initiative which embraces concerns about victims' rights in a manner consistent with existing legal principles. The author describes overseas and Australian legislative responses to this issue and presents the arguments for and against the VIS. She also presents research findings on key questions relating to the effects and outcomes of the VIS. She argues that the VIS should be considered for adoption by a</meta>
ll Australian jurisdictions."></meta>
which is clearly wrong. I have had similar problems in other scripts that I have written. Is this line length a limitation/bug of php? or of the host OS.
I am running php 4.0.4pl1 under Red Hat Linux 7.0 / Apache 1.3.14.
Thanks in advance,
Peter
-------
$MAXLINELENGTH=4096;
$fpm = fopen($file, "r");
while (!feof($fpm))
{
$line=fgets($fpm, $MAXLINELENGTH);
$line=trim($line);
if(strlen($line)>0)
{
$meta.=$line."</meta>\n";
}
}
fclose($fpm);
Problems with line lengths - php bug?
Moderator: General Moderators
False alarm I'm afraid
The problem, which I must have overlooked at least a dozen times, ended up being in my script and is now resolved. Thanks to all those who replied.