|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #56651 Segmentation fault when passing anything other than strings
Submitted: 2005-11-14 18:53 UTC Modified: 2005-11-16 19:19 UTC
From: Assigned: derick (profile)
Status: Closed Package: filter (PECL)
PHP Version: Irrelevant OS: Debian sarge
Private report: No CVE-ID: None
 [2005-11-14 18:53 UTC]
When trying to filter anything other than string values, a segmentation fault occurs because the C code expects nothing other than strings.

I'm not sure whether this is a by-design thing or should even be considered a bug, but it would be nice to filter values other than strings.

Reproduce code:
$float = 34.78;

var_dump(filter_data($float, FL_FLOAT));

Expected result:

Actual result:
Segmentation fault


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-11-15 16:12 UTC]
(And here's my patch for this:)

Index: filter.c
RCS file: /repository/pecl/filter/filter.c,v
retrieving revision 1.19
diff -u -u -r1.19 filter.c
--- filter.c	15 Nov 2005 11:55:28 -0000	1.19
+++ filter.c	15 Nov 2005 20:59:47 -0000
@@ -301,6 +301,9 @@
 		filter_func = php_find_filter(FS_DEFAULT);
+	/* Be sure we're passing a string */
+	convert_to_string(value);
 	filter_func.function(value, flags, options, charset TSRMLS_CC);
 [2005-11-16 19:19 UTC]
This bug has been fixed in CVS.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on

In case this was a website problem, the change will show
up on the website in short time.
Thank you for the report, and for helping us make PECL better.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 20 07:01:34 2024 UTC