Skip to content

patch from https://github.com/kamilwylegala/cakephp2-php8/pull/83#15

Merged
basi merged 1 commit intobasi:mainfrom
HaiTo:work/upgrade-for-php84
Apr 10, 2025
Merged

patch from https://github.com/kamilwylegala/cakephp2-php8/pull/83#15
basi merged 1 commit intobasi:mainfrom
HaiTo:work/upgrade-for-php84

Conversation

@HaiTo
Copy link
Copy Markdown

@HaiTo HaiTo commented Apr 6, 2025

PHP 8.4 Compatibility Upgrade

This pull request incorporates patches from kamilwylegala/cakephp2-php8#83 to ensure compatibility with PHP 8.4.

Key Changes

Session Handling

  • Added new SessionHandlerAdapter class implementing SessionHandlerInterface to adapt CakePHP's session handlers to PHP's standard interface
  • Modified session_set_save_handler() calls to use the adapter object instead of arrays of callbacks, addressing PHP 8.4's deprecation of the array-style handler registration

Error Handling

  • Removed references to E_STRICT error constant which has been deprecated in PHP 8.4
  • Updated error mapping in ErrorHandler.php

Build System

  • Removed the GitHub Actions workflow for PHP CodeSniffer (phpcs.yml)
  • Updated README with changelog entry for these modifications

Implementation Details

The changes were applied using the following method:

wget https://github.com/kamilwylegala/cakephp2-php8/pull/83.patch
patch -p1 < 83.patch

These modifications ensure that CakePHP 2.x applications can run smoothly on PHP 8.4 environments without deprecation warnings or errors.

Summary by CodeRabbit

  • Chores
    • Removed the automated code check workflow on GitHub to simplify the development process.
  • Documentation
    • Added information about PHP 8.4 compatibility and development process improvements to the changelog.
  • Refactor
    • Improved system maintainability and efficiency through the revision of error handling and session management methods.

@basi basi assigned basi and HaiTo and unassigned basi Apr 10, 2025
@basi basi requested a review from Copilot April 10, 2025 04:46
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 1 out of 5 changed files in this pull request and generated 1 comment.

Files not reviewed (4)
  • .github/workflows/phpcs.yml: Language not supported
  • lib/Cake/Error/ErrorHandler.php: Language not supported
  • lib/Cake/Model/Datasource/CakeSession.php: Language not supported
  • lib/Cake/Model/Datasource/SessionHandlerAdapter.php: Language not supported

Comment on lines +65 to +66
- Removed github action with php code sniffer. It's quite painful to work with. Need to migrate to something newer, that will affect code base as little as possible.

This comment was marked as resolved.

@basi
Copy link
Copy Markdown
Owner

basi commented Apr 10, 2025

@coderabbitai summary

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 10, 2025

✅ Actions performed

Summary regeneration triggered.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 10, 2025

Walkthrough

This pull request includes the removal of the GitHub Actions workflow for PHP CodeSniffer (phpcs.yml), the addition of PHP 8.4 compatibility fixes and PHPCS action removal notes to the README, the removal of E_STRICT error handling in ErrorHandler, and the modification of the session handler configuration in CakeSession from the traditional array approach to a new object-oriented approach using SessionHandlerAdapter.

Changes

File Change Summary
.github/workflows/phpcs.yml The GitHub Actions workflow for PHP CodeSniffer has been removed.
README.md A new "2025-02-04" update date section has been added to the changelog, documenting PHP 8.4 compatibility fixes (session_set_handler accepts objects, removed E_STRICT reference) and the removal of the PHP code sniffer GitHub action.
lib/Cake/Error/ErrorHandler.php The E_STRICT error handling case has been removed from the mapErrorCode method, updating the error mapping process.
lib/Cake/Model/Datasource/CakeSession.php The session handler configuration has been changed from the traditional method reference array to a new object-oriented approach using SessionHandlerAdapter.

Sequence Diagram(s)

sequenceDiagram
    participant CS as CakeSession
    participant SA as SessionHandlerAdapter
    participant CSH as CakeSessionHandler
    
    CS->>SA: Configure session handler
    SA->>CSH: Delegate open()/read()/write()/close()/destroy()/gc() operations
Loading

@basi basi self-requested a review April 10, 2025 04:56
Copy link
Copy Markdown
Owner

@basi basi left a comment

Choose a reason for hiding this comment

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

👍

@basi basi merged commit ee1aaf6 into basi:main Apr 10, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants