Bug #80051 [Opn->Nab]: strip_tags clears string when starting with the lesser then or equal operator.

From: Date: Thu, 03 Sep 2020 20:21:07 +0000
Subject: Bug #80051 [Opn->Nab]: strip_tags clears string when starting with the lesser then or equal operator.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-228867@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80051&edit=1 ID: 80051 Updated by: requinix@php.net Reported by: stefan at concera dot com Summary: strip_tags clears string when starting with the lesser then or equal operator. -Status: Open +Status: Not a bug Type: Bug Package: Strings related Operating System: Ubuntu 16.04.7 LTS x86_64 PHP Version: 7.4.10 Block user comment: N Private report: N New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php https://www.php.net/manual/en/function.strip-tags.php > Warning > Because strip_tags() does not actually validate the HTML, partial or broken tags > can result in the removal of more text/data than expected. Don't use strip_tags() for HTML sanitization. Previous Comments: ------------------------------------------------------------------------ [2020-09-03 17:10:49] stefan at concera dot com Description: ------------ When executing the strip_tags function, using a string that starts with the lesser then or equal operator, it will be deleted... I accidentally found this out when stripping tags of an array with values, used for a <select>-element. When I strip the string '<= (Less then or equal)', it will result into an empty string. I also tried to add it to the $allowable_tags parameter, like this strip_tags('<= (Less then or equal)', '<=>'), but this doesn't seem to work either. Test script: --------------- <?php $array = [ '= (Equal)', '!= (Not equal)', '> (Greater then)', '>= (Greater then or equal)', '< (Less then)', '<= (Less then or equal)', ]; foreach( $array as $key => $value ) { echo $key."\t=>\t".strip_tags($value)."\n"; } Expected result: ---------------- 0 => = (Equal) 1 => != (Not equal) 2 => > (Greater then) 3 => >= (Greater then or equal) 4 => < (Less then) 5 => <= (Less then or equal) Actual result: -------------- 0 => = (Equal) 1 => != (Not equal) 2 => > (Greater then) 3 => >= (Greater then or equal) 4 => < (Less then) 5 => ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=80051&edit=1

« previous php.bugs (#228867) next »