Bug #15160 Updated: strip_tags problem with <!-- javascript --> comments inside tags

From: Date: Tue, 22 Jan 2002 19:29:05 +0000
Subject: Bug #15160 Updated: strip_tags problem with <!-- javascript --> comments inside tags
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-77814@lists.php.net to get a copy of this message
ID: 15160 Updated by: sander Reported By: martin@humany.com Old Status: Open Status: Bogus Bug Type: Strings related Operating System: Linux 2.4 and Windows XP PHP Version: 4.1.1 New Comment: strip_tags removes everything between < and the _first_ occurence of > If you have "<abc> >" it returns " >". Not a bug. If you want to remove a whole comment, you need to use a regex. Previous Comments: ------------------------------------------------------------------------ [2002-01-22 07:24:47] martin@humany.com I experienced problems with strip_tags on javascript inside <!-- //--> brackets that also contains //comments. Below is first two properly working examples, then a example to reproduce the problem. Tested in both Windows XP and Linux 2.4, both with PHP 4.1.1 $data = "<br>hello there<!-- comment // --><br>"; $out = strip_tags($data); echo $out; //$out = hello there, as expected :) $data = "<br>hello there<!-- comment --><br>"; $out = strip_tags($data); echo $out; //$out = hello there, as expected :) $data = "<!-- \n". "function a(i) {\n". "// comment\n". "var x=1;\n". "if (i>1) x=2;\n". "}\n". "// -->"; $out = strip_tags($data); echo $out; $out now is: 1) x=2; } // --> ------------------------------------------------------------------------ Edit this bug report at http://bugs.php.net/?id=15160&edit=1

« previous php.dev (#77814) next »