note 104273 deleted from function.filter-var by cmb
| From: | cmb@php.net | Date: | Tue, 16 Oct 2018 10:06:13 +0000 |
| Subject: | note 104273 deleted from function.filter-var by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-209446@lists.php.net to get a copy of this message | ||
Note Submitter: Luke America
----
And ... if you also want to handle pre-encoded multi-byte international URL's, you can include
the additional code here:
<?php
// convert multi-byte international url's by stripping multi-byte chars
$uri = urldecode($uri) . ' ';
$len = mb_strlen($uri);
if ($len !== strlen($uri))
{
$convmap = array(0x0, 0x2FFFF, 0, 0xFFFF);
$uri = mb_decode_numericentity($uri, $convmap, 'UTF-8');
}
$uri = trim($uri);
// now, process pre-encoded MBI's
$regex =
'#&([a-z]{1,2})(?:acute|cedil|circ|grave|lig|orn|ring|slash|th|tilde|uml);#i';
$uri_test = preg_replace($regex, '$1', htmlentities($uri, ENT_QUOTES, 'UTF-8'));
if ($uri_test != '') {$uri = $uri_test;}
?>