Bug->Doc #75869 [Opn->Ver]: mysqli_driver is monostate

From: Date: Fri, 06 Mar 2020 09:20:44 +0000
Subject: Bug->Doc #75869 [Opn->Ver]: mysqli_driver is monostate
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-17378@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=75869&edit=1 ID: 75869 Updated by: cmb@php.net Reported by: xavier dot leune at gmail dot com -Summary: Lack of isolation on mysqli_driver->report_mode +Summary: mysqli_driver is monostate -Status: Open +Status: Verified -Type: Bug +Type: Documentation Problem Package: MySQLi related Operating System: Ubuntu 17.04 PHP Version: 7.2.1 Block user comment: N Private report: N New Comment: The mysqli_driver class is an instance of the monostate pattern[1], i.e. there is only one driver which can be accessed though an arbitrary amount of mysqli_driver instances. It would have been less confusing to implement that as a set of plain functions. Anyhow, this is unlikely to change, but needs to be documented. [1] <https://wiki.c2.com/?MonostatePattern> Previous Comments: ------------------------------------------------------------------------ [2018-01-24 17:52:55] xavier dot leune at gmail dot com Description: ------------ Hi there, When changing the report_mode of an instance of mysqli_driver, all instances (already created or future instances) will share the same value of report_mode. This can be very annoying when a 3rd party library enables the exceptions on mysqli, if some other 3rd party library makes the assumption that the report_mode is to it's default value. Thanks, Xavier. Test script: --------------- https://gist.github.com/xavierleune/8cde9fc97ea7136d425a1d63cbb974fb Expected result: ---------------- $tainted->report_mode: int(2) $original->report_mode: int(0) Actual result: -------------- $tainted->report_mode: int(2) $original->report_mode: int(2) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=75869&edit=1

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