Doc #66055 [Com]: PDO::quote does weird conversions with floats

From: Date: Fri, 08 Nov 2013 15:16:15 +0000
Subject: Doc #66055 [Com]: PDO::quote does weird conversions with floats
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-10594@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=66055&edit=1 ID: 66055 Comment by: willfitch@php.net Reported by: llmll at gmx dot de Summary: PDO::quote does weird conversions with floats Status: Open Type: Documentation Problem Package: PDO related Operating System: any? PHP Version: 5.5.5 Block user comment: N Private report: N New Comment: Please provide more details behind your environment and test script. I've tried this with pdo_mysql using both the string you provided and actual double value with valid results. Also, your call to quote in your test script results in a fatal error in 5.5 as quote is not a static method. Previous Comments: ------------------------------------------------------------------------ [2013-11-07 22:05:09] llmll at gmx dot de Description: ------------ --- From manual page: http://www.php.net/pdo.quote --- The PDO::quote messes around with number formats. The documentation does not mention this. It appears, that quote() checks the variable type, and if it detects a float, it will format it according to the locale. This happens EVEN THOUGH you call quote() without second parameter, which tells it to handle the variables as raw string. Test script: --------------- //string $float = '1.55'; echo PDO::quote($float); // returns '1,55' with point replaced to comma Expected result: ---------------- should either leave strings alone or mention in the documentation, that it does what it does. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=66055&edit=1

« previous php.doc.bugs (#10594) next »