php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48163 FILTER_CALLBACK generates strange results
Submitted: 2009-05-06 11:48 UTC Modified: 2009-05-06 14:11 UTC
From: redaction at nuxwin dot com Assigned:
Status: Not a bug Package: Filter related
PHP Version: 5.2.0 OS: debian
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: redaction at nuxwin dot com
New email:
PHP Version: OS:

 

 [2009-05-06 11:48 UTC] redaction at nuxwin dot com
Description:
------------
HI all,

When I apply a one trim callback via filter, I get an erroneous result on the display.

Sorry , i'm french...

Reproduce code:
---------------
$_SERVER['REMOTE_ADDR'] = '    80.10.20.30  ';

$remote_addr_list = explode(',', $_SERVER['REMOTE_ADDR']);
filter_var_array(array('remote_addr_list' => $remote_addr_list),
array('remote_addr_list' => array('filter' => FILTER_CALLBACK, 'options' => 'trim','flags'=> FILTER_REQUIRE_ARRAY|FILTER_FORCE_ARRAY)));

I has this result :

echo '<pre>';
print_r($remote_addr_list);
echo '</pre>';


Expected result:
----------------
Array
(
    [0] => 80.10.20.30
)

Actual result:
--------------
Array
(
    [0] => &#65533;&#65533;&#65533;)&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;
)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-05-06 11:50 UTC] redaction at nuxwin dot com
excuse, :

Actual result:
<pre>Array
(
    [0] => &#65533;&#65533;&#65533;)&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;
)
</pre>
 [2009-05-06 13:40 UTC] jani@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/

Works fine for me..
 [2009-05-06 13:42 UTC] fa@php.net
works fine for me with 5.2.9 release and CLI
 [2009-05-06 13:48 UTC] redaction at nuxwin dot com
Hi;

sorry, my version is PHP Version 5.2.0. I go to try with later.

If you want, you can close it.
 [2009-05-06 13:52 UTC] redaction at nuxwin dot com
changed version
 [2009-05-06 13:53 UTC] redaction at nuxwin dot com
ok, close it !
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Dec 01 03:03:40 2021 UTC