KnpLabs / Gaufrette

PHP library that provides a filesystem abstraction layer − will be a feast for your files!
http://knplabs.github.io/Gaufrette
MIT License
2.47k stars 355 forks source link

on php8.2 $context on StreamWrapper is missing #703

Open pscheit opened 1 year ago

pscheit commented 1 year ago

Hi there,

i upgraded to php 8.2 and now got the error if doing file_get_contents on a gaufrette-streamwrapper url:

Creation of dynamic property Gaufrette\StreamWrapper::$context is deprecated

pscheit commented 1 year ago

seems to be enough to just declare the property: https://github.com/phpspec/phpspec/pull/1435

KevinArtus commented 1 year ago

Hi. We're working on it to update this project to php ^8.0 https://github.com/KnpLabs/Gaufrette/pull/692

ZZromanZZ commented 7 months ago

For those who won't or can't wait to release version with PHP 8.2 support. I did dirty workaround to solve this issue by patching the probematic file via composer scripts.

In composer.json:

"scripts": {
    "fix-php-8-2-compatibility": [
        "sed -i 's/private static $filesystemMap;$/private static $filesystemMap;public $context;/g' vendor/knplabs/gaufrette/src/Gaufrette/StreamWrapper.php"
    ],
    "post-install-cmd": [
        "@fix-php-8-2-compatibility"
    ],
    "post-update-cmd": [
        "@fix-php-8-2-compatibility"
    ]
}

(CLI command sed is required to be installed`)

Luckily for me it was the only issue.

ihor-drevetskyi commented 7 months ago

For those who won't or can't wait to release version with PHP 8.2 support. I did dirty workaround to solve this issue by patching the probematic file via composer scripts.

In composer.json:

"scripts": {
    "fix-php-8-2-compatibility": [
        "sed -i 's/private static $filesystemMap;$/private static $filesystemMap;public $context;/g' vendor/knplabs/gaufrette/src/Gaufrette/StreamWrapper.php"
    ],
    "post-install-cmd": [
        "@fix-php-8-2-compatibility"
    ],
    "post-update-cmd": [
        "@fix-php-8-2-compatibility"
    ]
}

(CLI command sed is required to be installed`)

Luckily for me it was the only issue.

Thank you