#22008 [Ana->Csd]: fgetss : 0 vs false, html on multiple lines

From: Date: Sun, 04 May 2003 11:49:17 +0000
Subject: #22008 [Ana->Csd]: fgetss : 0 vs false, html on multiple lines
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-39023@lists.php.net to get a copy of this message
ID: 22008 Updated by: moriyoshi@php.net Reported By: airtravel at anet dot ne dot jp -Status: Analyzed +Status: Closed Bug Type: Filesystem function related Operating System: all PHP Version: 4.3.0 New Comment: This bug has been fixed in CVS. In case this was a PHP problem, snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. In case this was a documentation problem, the fix will show up soon at http://www.php.net/manual/. In case this was a PHP.net website problem, the change will show up on the PHP.net site and on the mirror sites in short time. Thank you for the report, and for helping us make PHP better. The quick fix will be in 4.3.2. Previous Comments: ------------------------------------------------------------------------ [2003-05-03 05:44:19] moriyoshi@php.net This bug may be caused by the less stateful strip_tags implementation, which should be rewritten with something like re2c in the future anyway. ------------------------------------------------------------------------ [2003-02-18 15:50:37] phpdig at toiletoine dot net This code : <?php print "Test one :".strip_tags('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD><TITLE>Some title</TITLE> <META content="text/html; charset="ISO-8859-1" http-equiv=Content-Type>') ."<br>"; print "-----------<br>"; print "Test two :".strip_tags('<DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD><TITLE>Some title</TITLE> <META content="text/html; charset="ISO-8859-1" http-equiv=Content-Type>') ."<br>"; print "-----------<br>"; print "Test three :".strip_tags('<!FOO BAR> real text <br>') ."<br>"; ?> Gives me : Test one : ----------- Test two : Some title ----------- Test three : Any "<!SOMETHING..." strips all !! ------------------------------------------------------------------------ [2003-02-03 14:59:42] iliaa@php.net I've tried the latest CVS and tried to fetch the page you've specified. As far as I can tell the function had worked correctly, only non-html output was displayed. P.S. Philip the fgetss() function is supposed to handle tags that span multiple lines, so that should not be a problem. ------------------------------------------------------------------------ [2003-02-02 22:06:07] airtravel at anet dot ne dot jp This is something to do with <!DOCTYPE> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> seems to be causing problem. Again PHP4.2.3 or earlier treats this without problem. ------------------------------------------------------------------------ [2003-02-02 21:08:46] airtravel at anet dot ne dot jp Thank you for your comments. I found this problem only occurs when parsing specific html. Please try the following URL to see my problem. Thank you. <?php $fp = fopen("http://adds.aviationweather.gov/projects/adds/metars/index.php?metarIds=ksfo", "r"); while (($line=fgetss($fp, 4096))!==FALSE) { echo $line; } fclose($fp); ?> <?php $fp = fopen("http://adds.aviationweather.gov/projects/adds/metars/index.php?metarIds=ksfo", "r"); while (($line = strip_tags(fgets($fp, 4096)))!==FALSE) { echo $line; } fclose($fp); ?> ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/22008 -- Edit this bug report at http://bugs.php.net/?id=22008&edit=1

« previous php.bugs (#39023) next »