Commit 727754c
authored
Merge pull request #1021 from CassianoRafael/master
Title: Prevent Potential Null Issue and Warnings in rawAddPrefix (#1021)
Description:
This pull request addresses a potential issue in the rawAddPrefix method of the PHP-MySQLi-Database-Class. In newer PHP versions, accessing properties of potentially null variables can trigger warnings.
Issue:
If the provided SQL query doesn't contain keywords like "FROM," "INTO," "UPDATE," "JOIN," or "DESCRIBE" (e.g., functions and procedures), the $table array used for prefixing might be empty. This could lead to:
PHP Deprecated Warnings: Accessing properties of a potentially null $table array can cause warnings in newer PHP versions.
Unexpected Behavior: An empty $table array could result in unexpected behavior when adding prefixes.
Fix:
This pull request introduces a conditional check to ensure there are table name matches before proceeding with prefix replacement. This prevents the $table array from being null and avoids potential warnings and unexpected behavior.
Benefits:
Improves code robustness and prevents warnings in newer PHP environments.
Enhances code clarity and maintainability.
Additional Notes:
This is a valuable contribution by first-time contributor @CassianoRafael (thanks!).1 file changed
+4
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
556 | 556 | | |
557 | 557 | | |
558 | 558 | | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
559 | 563 | | |
560 | 564 | | |
561 | 565 | | |
| |||
0 commit comments