|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2013-03-08 15:08 UTC] andrey@php.net
[2013-03-09 21:53 UTC] slangley at google dot com
[2013-03-11 08:40 UTC] andrey@php.net
[2014-02-26 10:19 UTC] uw@php.net
-Status: Open
+Status: Feedback
[2014-02-26 10:19 UTC] uw@php.net
[2014-12-30 10:41 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 16:00:01 2025 UTC |
Description: ------------ If a plugin alters the connection methods table, then the original connection table is not restored if there is a php_module_shutdown()/php_module_init() cycle in the same process. This is because mysqlnd_conn_methods is a pointer to MYSQLND_CLASS_METHOD_TABLE_NAME(mysqlnd_conn), sizeof(mysqlnd_conn_methods)) so changing the values in mysqlnd_conn_methods actually changes the values in the master table. To fix, mysqlnd_conn_methods should take a copy of the table on init. Test script: --------------- Create a plugin that replaces the conenct function with a function that simply flows the call to the original callback. static enum_func_status MYSQLND_METHOD(my_test_plugin, query)(MYSQLND* conn, const char* query, unsigned int query_len TSRMLS_DC) { return original_conn_methods.query(conn, query, query_len); } Register this plugin during MINIT struct st_mysqlnd_conn_methods* current_conn_methods = mysqlnd_conn_get_methods(); memcpy(&original_conn_methods, current_conn_methods, sizeof(st_mysqlnd_conn_methods)); current_conn_methods->connect = MYSQLND_METHOD(speckle_mysqlnd_conn, connect); Start/Stop/Start the php modules php_module_startup(...) php_module_shutdown(...) php_module_startup(...) Try and connect to the mysqldb - you'll get a stack overflow.