3.20.0
MagicObject Version 3.20.0
Change: Removal of Math-Related Classes
In this release, several math-related classes have been removed from MagicObject to keep the core library lightweight and focused.
Removed Modules
- Complex Numbers
- Matrix Operations
- Geometry Utilities
Migration
These classes are not discontinued, but have been moved into a new dedicated repository:
Developers who rely on these math utilities should install the new package separately:
composer require planetbiru/magic-mathNew Feature: PDO Connection Verification Method
A new method isPdoConnected() has been introduced to allow developers to verify not only the TCP-level connection, but also the ability of PHP to execute SQL statements on the database.
New Method: PicoPageData::getResultAsArray()
The new getResultAsArray() method allows users to return a list of data directly as an array, which can be immediately sent as JSON. This eliminates the need to first collect the data as an array of objects and then manually construct an array.
Bug Fix: Handle Exception in method getDatabaseCredentialsFromPdo($pdo, $driver, $dbType)
If an error occurs when executing:
$dsn = $pdo->getAttribute(PDO::ATTR_CONNECTION_STATUS);getDatabaseCredentialsFromPdo($pdo, $driver, $dbType) will return an empty instance of SecretObject.
Enhancement: Improved getDatabaseCredentialsFromPdo Handling
The method getDatabaseCredentialsFromPdo has been updated to better handle
PDO drivers that do not support certain attributes (e.g., PDO::ATTR_CONNECTION_STATUS).
Key Improvements
-
Warning Suppression
Suppresses warnings whenPDO::getAttribute(PDO::ATTR_CONNECTION_STATUS)
is not supported by the active PDO driver (e.g., SQLite). -
Graceful Fallback
Introduced an optional$databaseCredentialsparameter, which is used as a
fallback source for host, port, and database name if they cannot be extracted
from the PDO connection. -
Driver-Agnostic Behavior
Ensures compatibility across multiple database drivers (MySQL, PostgreSQL, SQLite, etc.)
without causing runtime warnings. -
Consistent Output
Always returns a populatedSecretObjectwith connection details.
If extraction fails, either the provided$databaseCredentialsis returned,
or a new emptySecretObjectis created.
Why It Matters?
- Prevents noisy PHP warnings in environments where PDO drivers expose limited attributes.
- Provides a more reliable and consistent mechanism for retrieving database credentials.
- Ensures backward compatibility while making the method more robust in multi-database environments.
What's Changed
- Move Mathematic Classes by @kamshory in #162
- Feature/version 3.20.0 by @kamshory in #163
- Handle exception by @kamshory in #164
- Feature/version 3.20.0 by @kamshory in #165
- Update CHANGELOG.md by @kamshory in #166
- Feature/version 3.20.0 by @kamshory in #167
- Update CHANGELOG.md by @kamshory in #168
- Bug fixing boolean value PHP 8 by @kamshory in #169
- Update CHANGELOG.md by @kamshory in #170
- Add method PicoPageData::getResultAsArray() by @kamshory in #171
Full Changelog: 3.19.0...3.20.0