Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Php8.4 #83

Merged
merged 4 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 0 additions & 54 deletions .github/workflows/phpcs.yml

This file was deleted.

5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ It means that composer will look at `master` branch of repository configured und

## Changelog

### 2025-02-04

- Fixes for PHP 8.4: `session_set_save_handler` accepts object, removed `E_STRICT` reference.
- 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.

### 2024-11-16

- Inflector fix: str_place with null.
Expand Down
4 changes: 0 additions & 4 deletions lib/Cake/Error/ErrorHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -302,10 +302,6 @@ public static function mapErrorCode($code) {
$error = 'Notice';
$log = LOG_NOTICE;
break;
case E_STRICT:
$error = 'Strict';
$log = LOG_NOTICE;
break;
case E_DEPRECATED:
case E_USER_DEPRECATED:
$error = 'Deprecated';
Expand Down
9 changes: 3 additions & 6 deletions lib/Cake/Model/Datasource/CakeSession.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@

App::uses('Hash', 'Utility');
App::uses('Security', 'Utility');
App::uses('SessionHandlerAdapter', 'Model/Datasource');


/**
* Session class for CakePHP.
Expand Down Expand Up @@ -591,12 +593,7 @@ protected static function _configureSession() {
$handler = static::_getHandler($sessionConfig['handler']['engine']);
if (!function_exists('session_status') || session_status() !== PHP_SESSION_ACTIVE) {
session_set_save_handler(
array($handler, 'open'),
array($handler, 'close'),
array($handler, 'read'),
array($handler, 'write'),
array($handler, 'destroy'),
array($handler, 'gc')
new SessionHandlerAdapter($handler)
);
}
}
Expand Down
43 changes: 43 additions & 0 deletions lib/Cake/Model/Datasource/SessionHandlerAdapter.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php

declare(strict_types=1);

class SessionHandlerAdapter implements SessionHandlerInterface
{

public function __construct(
private CakeSessionHandlerInterface $cakeSessionHandler
) {
}

public function close()
{
return $this->cakeSessionHandler->close();
}

public function destroy(string $id)
{
return $this->cakeSessionHandler->destroy($id);
}

public function gc(int $max_lifetime)
{
return $this->cakeSessionHandler->gc($max_lifetime);
}

public function open(string $path, string $name)
{
//Cake interface ignores these parameters.
return $this->cakeSessionHandler->open();
}

public function read(string $id)
{
return $this->cakeSessionHandler->read($id);
}

public function write(string $id, string $data)
{
return $this->cakeSessionHandler->write($id, $data);
}
}