php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47626 Call to undefined function filter_input()
Submitted: 2009-03-11 18:45 UTC Modified: 2009-03-11 22:48 UTC
From: geo_pro at hotmail dot com Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 5.2.9 OS: FreeBSD 7.1
Private report: No CVE-ID: None
 [2009-03-11 18:45 UTC] geo_pro at hotmail dot com
Description:
------------
apache 2.2, php as apache module

It seems that filter_input() function is missing. As far as I know it should be in "base" php (no extensions required).

I noticed this in my apache log:
PHP Fatal error:  Call to undefined function filter_input() in /usr/local/www/pulsar/temp/testtt.php on line 2

testtt.php is exactly the same sample from http://www.php.net/manual/en/function.filter-input.php

This happens to php 5.2.9 and php 5.2.8 too (havent tested older)

I'll post more details if requested

Reproduce code:
---------------
<?php
$search_html = filter_input(INPUT_GET, 'search', FILTER_SANITIZE_SPECIAL_CHARS);
$search_url = filter_input(INPUT_GET, 'search', FILTER_SANITIZE_ENCODED);
echo "You have searched for $search_html.\n";
echo "<a href='?search=$search_url'>Search again.</a>";
?>



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-03-11 19:01 UTC] pajoye@php.net
How did you install PHP? Do you have the configure line?
 [2009-03-11 19:14 UTC] geo_pro at hotmail dot com
I used the freebsd ports system. I updated my ports tree and did:
cd /usr/ports/lang/php5/ && make install clean

Here is the Configure Commandline I got from phpinfo():

'./configure' '--with-layout=GNU' '--with-config-file-scan-dir=/usr/local/etc/php' '--disable-all' '--enable-libxml' '--with-libxml-dir=/usr/local' '--enable-reflection' '--program-prefix=' '--enable-fastcgi' '--with-apxs2=/usr/local/sbin/apxs' '--with-regex=php' '--with-zend-vm=CALL' '--enable-debug' '--disable-ipv6' '--prefix=/usr/local' '--mandir=/usr/local/man' '--infodir=/usr/local/info/' '--build=i386-portbld-freebsd7.1'
 [2009-03-11 21:55 UTC] scottmac@php.net
The filter extension is needed, with --disable-all you disable everything. Add --enable-filter
 [2009-03-11 22:26 UTC] pajoye@php.net
It looks more like you use freebsd's ports. Please ask support there. I suppose they provide everything as shared extension (which is not a very good idea).
 [2009-03-11 22:48 UTC] geo_pro at hotmail dot com
Yes, thanks a lot.

I have been thinking (obviously wrong) that when something is enabled by default in php5 ( http://www.php.net/manual/en/filter.installation.php ) it should exist in php5 on freebsd without installing additional ports or extensions.

My problem was solved when I installed php5-filter port :)
now the given example code works as expected, and I dont get any more errors in the log.

Sorry for reporting this as a bug, my mistake.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Dec 07 15:00:01 2025 UTC