note 94790 added to function.filter-var
| From: | drtebiatyahoo at osu1 dot php dot net | Date: | Wed, 25 Nov 2009 07:55:09 +0000 |
| Subject: | note 94790 added to function.filter-var | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-163260@lists.php.net to get a copy of this message | ||
Notice that filter_var with FILTER_VALIDATE_EMAIL does not work if you are trying to get a String
from an XML document e.g. via xpath.
I often use XML files as configuration files and use a function that returns a string from the
config file via xpath. While this worked fine before 5.2.11, it doesn't anymore (and
shouldn't, since it's an XML Element, not a String).
To overcome this problem, $variable can be type-casted:
<?php
$variable = fancyXmlGetFunction('from');
filter_var((String) $variable, FILTER_VALIDATE_EMAIL);
?>
----
Server IP: 208.69.120.55
Probable Submitter: 75.101.62.200
----
Manual Page -- http://www.php.net/manual/en/function.filter-var.php
Edit -- https://master.php.net/note/edit/94790
Del: integrated -- https://master.php.net/note/delete/94790/integrated
Del: useless -- https://master.php.net/note/delete/94790/useless
Del: bad code -- https://master.php.net/note/delete/94790/bad+code
Del: spam -- https://master.php.net/note/delete/94790/spam
Del: non-english -- https://master.php.net/note/delete/94790/non-english
Del: in docs -- https://master.php.net/note/delete/94790/in+docs
Del: other reasons-- https://master.php.net/note/delete/94790
Reject -- https://master.php.net/note/reject/94790
Search -- https://master.php.net/manage/user-notes.php