|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2014-03-10 10:26 UTC] rennie at bdevel dot co dot uk
Description:
------------
code snipit
$string = file($tfile, FILE_IGNORE_NEW_LINES or FILE_SKIP_EMPTY_LINES);
echo "Array is: ".sizeof($string)."<br>";
$k = 0;
do {
$string[$k] = str_replace("<","",$string[$k]);
echo "Number ".$k." String ".$string[$k]."<br>";
$k++;
}while($k<200);
line(s) that fails is (cut and paste using Dreamweaver):
<a href="ppl/a/b/cae94b82d133a7c8fba.php">Charles Edward Steel<span class="grampsid"> [I2780]</span></a>
All data past <span class="grampsid"> is dropped until the /a. This happens with fget fgets et. etc. 100% reproduced. There is a similar bug report but the "fix" given does not work for me!
Expected result:
----------------
Number 50 String a href="ppl/a/b/cae94b82d133a7c8fba.php">Charles Edward Steel span class="grampsid"> [I2780] /span> /a>
Actual result:
--------------
Number 50 String a href="ppl/a/b/cae94b82d133a7c8fba.php">Charles Edward Steel/a>
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 06:00:01 2025 UTC |
<?php echo "Starting Individuals - Created a new IdToGramps<br>"; $tfile = trim($_SERVER['DOCUMENT_ROOT'])."/Bowe/GrampsWeb/individuals.php"; //$fo = fopen ($tfile, "r") or die("No individuals.php"); // for fget etc. $count = 0; $string = file($tfile, FILE_IGNORE_NEW_LINES or FILE_SKIP_EMPTY_LINES); echo "Array is: ".sizeof($string)."<br>"; $k = 0; do { $string[$k] = str_replace("<","",$string[$k]); echo "Number ".$k." String ".$string[$k]."<br>"; $k++; }while($k<200); ?> individuals.php is what I call a "flat file" this is sufficient to demonstrate the problem. (The actual file holds details of about 9000 people.) <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-GB" lang="en-GB"> <head lang="en-GB"> <title>Bowe Family Big Tree - Individuals</title> <meta charset="UTF-8" /> <meta name ="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=1" /> <meta name ="apple-mobile-web-app-capable" content="yes" /> <meta name="generator" content="Gramps 3.4.4-1 http://gramps-project.org/" /> <meta name="author" content="Rennie Bowe" /> <link href="images/favicon2.ico" type="image/x-icon" rel="shortcut icon" /> <link media="screen" href="css/narrative-screen.css" rel="stylesheet" type="text/css" /> <link media="print" href="css/narrative-print.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="header"> <h1 id="SiteTitle">Bowe Family Big Tree</h1> </div> <div class="wrapper" role="navigation" id="nav"> <div class="container"> <ul class="menu" id="dropmenu"> <li class = "CurrentSection"><a href="individuals.php" title="Individuals">Individuals</a></li> <li><a href="index.php" title="Surnames">Surnames</a></li> <li><a href="families.php" title="Families">Families</a></li> <li><a href="places.php" title="Places">Places</a></li> <li><a href="sources.php" title="Sources">Sources</a></li> </ul> </div> </div> <div class="content" id="Individuals"> <p id="description"> This page contains an index of all the individuals in the database, sorted by their last names. Selecting the person’s name will take you to that person’s individual page. </p> <div id="alphanav"> <ul> <li><a href="#A" title="Alphabet Menu: A">A</a></li> <li><a href="#B" title="Alphabet Menu: B">B</a></li> <li><a href="#C" title="Alphabet Menu: C">C</a></li> <li><a href="#D" title="Alphabet Menu: D">D</a></li> <li><a href="#E" title="Alphabet Menu: E">E</a></li> <li><a href="#F" title="Alphabet Menu: F">F</a></li> <li><a href="#G" title="Alphabet Menu: G">G</a></li> <li><a href="#H" title="Alphabet Menu: H">H</a></li> <li><a href="#I" title="Alphabet Menu: I">I</a></li> <li><a href="#J" title="Alphabet Menu: J">J</a></li> <li><a href="#K" title="Alphabet Menu: K">K</a></li> <li><a href="#L" title="Alphabet Menu: L">L</a></li> <li><a href="#M" title="Alphabet Menu: M">M</a></li> <li><a href="#N" title="Alphabet Menu: N">N</a></li> <li><a href="#O" title="Alphabet Menu: O">O</a></li> <li><a href="#P" title="Alphabet Menu: P">P</a></li> <li><a href="#Q" title="Alphabet Menu: Q">Q</a></li> <li><a href="#R" title="Alphabet Menu: R">R</a></li> <li><a href="#S" title="Alphabet Menu: S">S</a></li> <li><a href="#T" title="Alphabet Menu: T">T</a></li> <li><a href="#U" title="Alphabet Menu: U">U</a></li> <li><a href="#V" title="Alphabet Menu: V">V</a></li> <li><a href="#W" title="Alphabet Menu: W">W</a></li> <li><a href="#Y" title="Alphabet Menu: Y">Y</a></li> <li><a href="#Z" title="Alphabet Menu: Z">Z</a></li> </ul> </div> <table class="infolist primobjlist IndividualList"> <thead> <tr> <th class="ColumnSurname">Surname</th> <th class="ColumnName">Given Name</th> <th class="ColumnDate">Birth</th> <th class="ColumnDate">Death</th> <th class="ColumnPartner">Partner</th> <th class="ColumnParents">Parents</th> </tr> </thead> <tbody> <tr class = "BeginSurname"> <td class="ColumnSurname"><a id="A" name="A" title="Surnames Abbott beginning with letter A">Abbott</a></td> <td class="ColumnName"> <a href="ppl/a/b/cae94b82d133a7c8fba.php">Charles Edward Steel<span class="grampsid"> [I2780]</span></a> </td> <td class="ColumnBirth">about Nov 1869</td> <td class="ColumnDeath">about Aug 1943</td>