php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #44976 PHP 5.2.6 says Fatal error: Call to undefined function filter_var()
Submitted: 2008-05-13 03:11 UTC Modified: 2008-05-13 09:18 UTC
Votes:4
Avg. Score:5.0 ± 0.0
Reproduced:4 of 4 (100.0%)
Same Version:4 (100.0%)
Same OS:3 (75.0%)
From: marcabconfederacy24 at yahoo dot com Assigned: pajoye (profile)
Status: Not a bug Package: *General Issues
PHP Version: 5.2.6 OS: FreeBSD 6.3
Private report: No CVE-ID: None
 [2008-05-13 03:11 UTC] marcabconfederacy24 at yahoo dot com
Description:
------------
I take the sample code directly from your website.  This is not the first time sample code from it has not worked.

http://us.php.net/manual/en/function.filter-var.php

I have the latest PHP version, 5.2.6


I use "var_dump(filter_var('bob@example.com', FILTER_VALIDATE_EMAIL));"

Exactly what your website says.


PHP 5.2.6 says "Fatal error: Call to undefined function filter_var()"

I googled it and the old reason it should do that is on older PHP versions.  But mine is 5.2.6.



PS: I've had to so far do 20 tries to read your captcha and your site made me confirm this a million times, each time having to read a new one.  I think I should buy captcha-reading software from that Chinese website as it reads better than humans.

Reproduce code:
---------------
var_dump(filter_var('bob@example.com', FILTER_VALIDATE_EMAIL));

Expected result:
----------------
What it says at http://us.php.net/manual/en/function.filter-var.php



Actual result:
--------------
Fatal error: Call to undefined function filter_var() in /usr/local/www/[my website name removed]/www/register.php on line 172

[my website name removed] = I'd rather not post my website's name until it's ready to open.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-05-13 03:16 UTC] marcabconfederacy24 at yahoo dot com
I forgot to mention, phpinfo says "mod_filter" is loaded.
 [2008-05-13 03:17 UTC] marcabconfederacy24 at yahoo dot com
test
 [2008-05-13 03:25 UTC] marcabconfederacy24 at yahoo dot com
I checked and these also get "Fatal error: Call to undefined function" on 5.2.6 with phpinfo saying mod_filter is loaded

filter_var_array() 
filter_input() 
filter_input_array()
 [2008-05-13 06:11 UTC] pajoye@php.net
Please load the "filter" extension, not Apache's mod_filter.
 [2008-05-13 09:02 UTC] marcabconfederacy24 at yahoo dot com
Oops I was looking at the wrong thing.

Anyway, the manual says the filter extension is built in to version 5.2.0 and above and does not need to be installed.  And only older versions need it installed.
 [2008-05-13 09:14 UTC] marcabconfederacy24 at yahoo dot com
Proof it should be built into PHPH 5.2.0 and above.

http://pecl.php.net/package/filter  --  last release separately was in 2006.  And yet in the other bug reports, there are notes that they recently fixed bugs in it this year.
 [2008-05-13 09:18 UTC] pajoye@php.net
Right, I was wrong to ask for activating php_filter.dll in your php.ini

However, you are doing something wrong. Below is the bundled and activated module in 5.2.6 (win32). Please ask in php.install or double check your install (and error logs). 

C:\php526>php -m
[PHP Modules]
bcmath
calendar
com_dotnet
ctype
date
dom
filter  <<< the filter extension
ftp
hash
iconv
json
libxml
odbc
pcre
Reflection
session
SimpleXML
SPL
standard
tokenizer
wddx
xml
xmlreader
xmlwriter
zlib


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 16:01:28 2024 UTC