You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Make AbstractSql render state private so subclasses can't corrupt it #246
AbstractSql::$processInfo and AbstractSql::$instanceParameterIndex are protected. They hold the parameter-naming state used while rendering: paramPrefix, subselectCount and, after #236, expressionCount. Any subclass, including driver platform decorators, can therefore write to them, and a bad write would produce clashing or unstable parameter names.
Current readers outside AbstractSql
PhpDb\Sql\Select::processLimit() and processOffset() read $this->processInfo['paramPrefix'].
PhpDb\Mysql\Sql\SelectDecorator::processLimit() and processOffset() do the same.
PhpDb\Sqlite\Sql\SelectDecorator::processLimit() and processOffset() do the same.
PhpDb\SqliteSelectDecoratorTest sets processInfo through reflection.
Make both properties private. The cross-instance writes in processSubSelect() and the get_object_vars() copy in localizeVariables() keep working, because both run in AbstractSql scope.
processExpression(), processSubSelect() and resolveColumnValue() don't need to be final. Once the state is private, an override can't corrupt it.
Downstream
This is a BC break for phpdb-mysql and phpdb-sqlite. Each needs a follow-up PR that switches to getParamPrefix() and raises its minimum phpdb version. The sqlite PR also needs to replace the reflection in its test. Those PRs land after the phpdb release.
Activity