Edit report at https://bugs.php.net/bug.php?id=63886&edit=1
ID: 63886 Updated by: and...@php.net Reported by: rubs33 at gmail dot com Summary: PHP crashes when quoting string with PDO and using mysqlnd_ms -Status: Assigned +Status: Feedback Type: Bug Package: MySQL related Operating System: Fedora Linux 17 x86_64 PHP Version: 5.5.0alpha2 Assigned To: mysql Block user comment: N Private report: N New Comment: Please try using this snapshot: http://snaps.php.net/php5.4-latest.tar.gz For Windows: http://windows.php.net/snapshots/ Please try with updated PHP - from snaps.php.net . The fix was just commited. The next snapshot should have it. Previous Comments: ------------------------------------------------------------------------ [2013-01-30 16:34:05] u...@php.net Automatic comment from SVN on behalf of uw Revision: http://svn.php.net/viewvc/?view=revision&revision=329374 Log: PDO and invalid charset bug 63886 ------------------------------------------------------------------------ [2013-01-30 15:36:09] u...@php.net Hi, this should be a follow up crash due to a mysqlnd bug. The connection is in an invalid state. You should not be allowed to connect at all. Albeit the charset is invalid, you can connect if using mysqlnd: bash: /home/nixnutz/git/superhero/php-srcphp: Datei oder Verzeichnis nicht gefunden nixnutz@linux-0v4u:~/php-src/pecl/mysqlnd_ms/trunk> php -d mysqlnd.debug="d:t:O,/tmp/mysqlnd.trace" -r '$pdo = new PDO("mysql:host=127.0.0.1;port=3307;dbname=test;charset=x"); var_dump($pdo->quote("a"));' string(3) "'a'" ixnutz@linux-0v4u:~/php-src/pecl/mysqlnd_ms/trunk> php -i | grep pdo Configure Command => './configure' '--with-mysql=mysqlnd' '--with-mysqli=mysqlnd' '--with-pdo-mysql=mysqlnd' '--enable-debug' '--disable-pear' API Extensions => pdo_mysql,mysqli,mysql pdo_mysql pdo_mysql.debug => no value => no value pdo_mysql.default_socket => /tmp/mysql.sock => /tmp/mysql.sock However, if using libmysql one gets an error as I'd expect it: nixnutz@linux-0v4u:~/php-src/pecl/mysqlnd_ms/trunk> /home/nixnutz/git/superhero/php-src/sapi/cli/php -d mysqlnd.debug="d:t:O,/tmp/mysqlnd.trace" -r '$pdo = new PDO("mysql:host=127.0.0.1;port=3307;dbname=test;charset=x"); var_dump($pdo->quote("a"));' Character set 'x' is not a compiled character set and is not specified in the '/home/nixnutz/ftp/mysql-5.6/install/share/charsets/Index.xml' file Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [2019] Can't initialize character set x (path: /home/nixnutz/ftp/mysql-5.6/install/share/charsets/)' in Command line code:1 Stack trace: #0 Command line code(1): PDO->__construct('mysql:host=127....') #1 {main} thrown in Command line code on line 1 nixnutz@linux-0v4u:~/php-src/pecl/mysqlnd_ms/trunk> /home/nixnutz/git/superhero/php-src/sapi/cli/php -i | grep pdo Configure Command => './configure' '--with-mysql=mysqlnd' '--with-mysqli=mysqlnd' '--with-pdo-mysql=/home/nixnutz/ftp/mysql-5.6/install/bin/mysql_config' '--enable-debug' '--disable-pear' pdo_mysql pdo_mysql.default_socket => /tmp/mysql.sock => /tmp/mysql.sock pdo_sqlite I'd say: Andrey, please have a look... Ulf PS: No mysqlnd package in select box? ------------------------------------------------------------------------ [2013-01-02 19:20:00] rubs33 at gmail dot com Description: ------------ I am testing mysqlnd_ms plugin and I have just noticed that PHP crashes when I use PDO::quote method at these conditions: 1 - Enable mysqlnd_ms 2 - At PDO constructor call, specify a host to a replicated database and specify an invalid charset. The plugin itself is working fine for its propose. The problem is with the "quote" method, that might been affected by the plugin. Versions: PHP: 5.5.0alpha2 mysqlnd: 5.0.11-dev - 20120503 mysqlnd_ms: 1.4.2 (10402) MySQL: 5.5.28 Note: when I run the test script with a non replicated database, I get the expected result and PHP did not crash. Test script: --------------- <?php $pdo = new PDO('mysql:host=myapp;dbname=test;charset=x', 'rubens', '123'); $value = $pdo->quote('a'); var_dump($value); ?> Expected result: ---------------- string(3) "'a'" Actual result: -------------- Segmentation fault (core dumped) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=63886&edit=1