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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: ramsey@php.net
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2024 The PHP Group
All rights reserved.
Last updated: Tue Dec 10 08:01:27 2024 UTC