[PHP-BUG] Bug #60541 [NEW]: FILTER_SANITIZE_NUMBER_INT fails to filter strings with plus and minus
From: klaussilveira Operating system: UNIX PHP version: 5.3.8 Package: Filter related Bug Type: Bug Bug description:FILTER_SANITIZE_NUMBER_INT fails to filter strings with plus and minus Description: The filter_var FILTER_SANITIZE_NUMBER_INT filter fails to sanitize plus and minus signs in a string. This is the expected behavior, since + and - are accepted in an integer. However, the filter fails to recognize multiple + and -, returning an string instead of an integer. For example: filter_var("I'm+captain4", FILTER_SANITIZE_NUMBER_INT; // returns +4, OK! filter_var("I'm++captain4", FILTER_SANITIZE_NUMBER_INT; // returns ++4, FAILURE! I wrote a small patch that makes the filter ignore + and - signs, which, i believe, it's the best behavior for this. Test script: --- https://bugs.php.net/bug.php?id=60541&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=60541&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=60541&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=60541&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=60541&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=60541&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=60541&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=60541&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=60541&r=needscript Try newer version: https://bugs.php.net/fix.php?id=60541&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=60541&r=support Expected behavior: https://bugs.php.net/fix.php?id=60541&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=60541&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=60541&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=60541&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=60541&r=php4 Daylight Savings:https://bugs.php.net/fix.php?id=60541&r=dst IIS Stability: https://bugs.php.net/fix.php?id=60541&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=60541&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=60541&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=60541&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=60541&r=mysqlcfg
Bug #60541 [PATCH]: FILTER_SANITIZE_NUMBER_INT fails to filter strings with plus and minus
Edit report at https://bugs.php.net/bug.php?id=60541&edit=1 ID: 60541 Patch added by: klaussilve...@php.net Reported by:klaussilve...@php.net Summary:FILTER_SANITIZE_NUMBER_INT fails to filter strings with plus and minus Status: Open Type: Bug Package:Filter related Operating System: UNIX PHP Version:5.3.8 Block user comment: N Private report: N New Comment: The following patch has been added/updated: Patch Name: sanitize_integers Revision: 1323994062 URL: https://bugs.php.net/patch-display.php?bug=60541&patch=sanitize_integers&revision=1323994062 Previous Comments: [2011-12-16 00:07:20] klaussilve...@php.net Description: The filter_var FILTER_SANITIZE_NUMBER_INT filter fails to sanitize plus and minus signs in a string. This is the expected behavior, since + and - are accepted in an integer. However, the filter fails to recognize multiple + and -, returning an string instead of an integer. For example: filter_var("I'm+captain4", FILTER_SANITIZE_NUMBER_INT; // returns +4, OK! filter_var("I'm++captain4", FILTER_SANITIZE_NUMBER_INT; // returns ++4, FAILURE! I wrote a small patch that makes the filter ignore + and - signs, which, i believe, it's the best behavior for this. Test script: --- https://bugs.php.net/bug.php?id=60541&edit=1
Bug #60541 [Com]: FILTER_SANITIZE_NUMBER_INT fails to filter strings with plus and minus
Edit report at https://bugs.php.net/bug.php?id=60541&edit=1 ID: 60541 Comment by: klaussilve...@php.net Reported by:klaussilve...@php.net Summary:FILTER_SANITIZE_NUMBER_INT fails to filter strings with plus and minus Status: Open Type: Bug Package:Filter related Operating System: UNIX PHP Version:5.3.8 Block user comment: N Private report: N New Comment: The most elegant solution was to detect only + and - signs that are next to a number, and remove all others. For example: filter_var("ad--td#$@++qsdh-3", FILTER_SANITIZE_NUMBER_INT); // returns -3 Right now, the filter behavior is: filter_var("ad--td#$@++qsdh-3", FILTER_SANITIZE_NUMBER_INT); // returns --++-3 Which is VERY bad and HORRIBLY wrong. Previous Comments: ---- [2011-12-16 00:07:42] klaussilve...@php.net The following patch has been added/updated: Patch Name: sanitize_integers Revision: 1323994062 URL: https://bugs.php.net/patch-display.php?bug=60541&patch=sanitize_integers&revision=1323994062 ---- [2011-12-16 00:07:20] klaussilve...@php.net Description: The filter_var FILTER_SANITIZE_NUMBER_INT filter fails to sanitize plus and minus signs in a string. This is the expected behavior, since + and - are accepted in an integer. However, the filter fails to recognize multiple + and -, returning an string instead of an integer. For example: filter_var("I'm+captain4", FILTER_SANITIZE_NUMBER_INT; // returns +4, OK! filter_var("I'm++captain4", FILTER_SANITIZE_NUMBER_INT; // returns ++4, FAILURE! I wrote a small patch that makes the filter ignore + and - signs, which, i believe, it's the best behavior for this. Test script: --- https://bugs.php.net/bug.php?id=60541&edit=1
Req #61601 [Com]: strftime format does not allow for all lower case month/weekday
Edit report at https://bugs.php.net/bug.php?id=61601&edit=1 ID: 61601 Comment by: klaussilve...@php.net Reported by:koen at fotoloog dot org Summary:strftime format does not allow for all lower case month/weekday Status: Open Type: Feature/Change Request Package:Date/time related Operating System: All PHP Version:Irrelevant Block user comment: N Private report: N New Comment: I have noticed that localized month names also come with the first letter in lowercase, as opposed to the default behavior in English. Is this what this bug report is all about? Your report is a little confusing, since there's already parameters to format weekdays and months. Previous Comments: [2012-04-02 11:48:30] koen at fotoloog dot org I wrote "The usual way of writing the full/abbreviated name of a month or a weekday" but I meant to write "The usual way of writing the full/abbreviated name of a month or a weekday *for my locale*..." [2012-04-02 11:47:08] koen at fotoloog dot org Description: --- >From manual page: >http://www.php.net/function.strftime#refsect1-function.strftime-description --- The usual way of writing the full/abbreviated name of a month or a weekday is with all lower case letters, e.g. 'december' as opposed to 'December'. And 'maandag' as opposed to 'Monday'. My locale is nl_nl. See http://nl.wikipedia.org/wiki/Hoofdletter_in_de_Nederlandse_spelling#Perioden (in Dutch) for explanation. Request is to add format parameters for weekdays and months: maandag;dinsdag;woensdag;donderdag;vrijdag;zaterdag;zondag januari;februari;maart;april;mei;juni;juli;augustus;september;oktober;november;december Test script: --- not applicable. -- Edit this bug report at https://bugs.php.net/bug.php?id=61601&edit=1