php.net |  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: ramsey@php.net 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] ramsey@php.net
Description:
------------
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:
---------------
<?php
$float = 34.78;

var_dump(filter_data($float, FL_FLOAT));
?>

Expected result:
----------------
float(34.78)

Actual result:
--------------
Segmentation fault

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-11-15 16:12 UTC] ramsey@php.net
(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] sniper@php.net
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 pecl.php.net.

In case this was a pecl.php.net 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-2019 The PHP Group
All rights reserved.
Last updated: Tue Jun 18 22:01:26 2019 UTC