Skip to content

Update database config to remove deprecation warning on php 8.5 - #2089

Merged
Boy132 merged 2 commits into
mainfrom
boy132/php8.5-followup
Jan 9, 2026
Merged

Update database config to remove deprecation warning on php 8.5#2089
Boy132 merged 2 commits into
mainfrom
boy132/php8.5-followup

Conversation

@Boy132

@Boy132 Boy132 commented Jan 9, 2026

Copy link
Copy Markdown
Member

@Boy132 Boy132 self-assigned this Jan 9, 2026
@coderabbitai

coderabbitai Bot commented Jan 9, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Updates config/database.php: renames a local variable to fix a typo and adds a PHP version gate (PHP 8.5+, i.e., PHP_VERSION_ID >= 80500) to choose the namespaced MySQL SSL CA attribute constant when available; retains previous behavior if the PDO MySQL extension is absent.

Changes

Cohort / File(s) Summary
Local variable rename
config/database.php
Renamed local variable \$datapasePath\$databasePath and updated all internal references.
MySQL/MariaDB SSL attribute version gate
config/database.php
Added conditional selection for the MySQL SSL CA option key using PHP_VERSION_ID >= 80500 ? \Pdo\Mysql::ATTR_SSL_CA : \PDO::MYSQL_ATTR_SSL_CA in relevant connection option blocks; preserves no-options behavior when PDO MySQL is not loaded.
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: updating database config to remove PHP 8.5 deprecation warnings related to MySQL SSL attributes.
Description check ✅ Passed The description is related to the changeset, explaining that it's a follow-up to remove deprecation warnings and references the relevant Laravel config file.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


📜 Recent review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4d12fcc and 995a79f.

📒 Files selected for processing (1)
  • config/database.php
🔇 Additional comments (2)
config/database.php (2)

6-6: LGTM! Typo fix corrected.

The variable name has been corrected from $datapasePath to $databasePath, and the reference at line 44 has been updated accordingly.

Also applies to: 44-44


68-68: The implementation is correct. PHP 8.5 officially deprecates driver-specific PDO constants (like PDO::MYSQL_ATTR_SSL_CA) and replaces them with driver subclass constants (Pdo\Mysql::ATTR_SSL_CA). The conditional approach using PHP_VERSION_ID >= 80500 properly handles backward compatibility with older PHP versions while providing the correct constant for PHP 8.5+.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
config/database.php (1)

5-10: Fix sqlite database path variable typo/override (currently the absolute-path/:memory: branch is ignored).

Right now the override assigns $databasePath (Line 9), but sqlite uses $datapasePath (Line 44). This makes absolute paths and :memory: ineffective (and also looks like a simple typo).

Proposed fix
 $database = env('DB_DATABASE', 'database.sqlite');
-$datapasePath = database_path($database);
+$databasePath = database_path($database);

 if (str_starts_with($database, '/') || $database === ':memory:') {
     $databasePath = $database;
 }
...
         'sqlite' => [
             'driver' => 'sqlite',
             'url' => env('DB_URL'),
-            'database' => $datapasePath,
+            'database' => $databasePath,
             'prefix' => '',
             'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
             'busy_timeout' => null,
             'journal_mode' => null,
             'synchronous' => null,
         ],

Also applies to: 41-45

🤖 Fix all issues with AI agents
In @config/database.php:
- Around line 67-69: Rename the misspelled $datapasePath to $databasePath and
remove the redundant assignment to $databasePath so the SQLite
absolute-path/:memory: override uses the correct variable (affects the SQLite
config and the variable declared near the top of the file); also extract the
PHP-version ternary that selects \Pdo\Mysql::ATTR_SSL_CA vs
\PDO::MYSQL_ATTR_SSL_CA into a single top-level variable (e.g., $mysqlSslCaAttr)
and use that variable in both MySQL and MariaDB 'options' arrays instead of
repeating the ternary to avoid duplication and drift.
📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3b24e22 and 4d12fcc.

📒 Files selected for processing (1)
  • config/database.php

Comment thread config/database.php
@Boy132
Boy132 merged commit 6b9d683 into main Jan 9, 2026
32 checks passed
@Boy132
Boy132 deleted the boy132/php8.5-followup branch January 9, 2026 13:39
@github-actions github-actions Bot locked and limited conversation to collaborators Jan 9, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants