Updating Sage 9 site to PHP 8 - Sage Autoloader Error

Tried switching my old Sage site from PHP 7.4 to PHP 8.1 and ran into lots of errors like this:

Deprecated: Return type of Illuminate\Support\Collection::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/lamlashcruisesor/public_html/wp-content/themes/lamlash-cruises/vendor/illuminate/support/Collection.php on line 1789

Deprecated: Return type of Illuminate\Support\Collection::offsetGet($key) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/lamlashcruisesor/public_html/wp-content/themes/lamlash-cruises/vendor/illuminate/support/Collection.php on line 1800

Deprecated: Return type of Illuminate\Support\Collection::offsetSet($key, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/lamlashcruisesor/public_html/wp-content/themes/lamlash-cruises/vendor/illuminate/support/Collection.php on line 1812

Deprecated: Return type of Illuminate\Support\Collection::offsetUnset($key) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/lamlashcruisesor/public_html/wp-content/themes/lamlash-cruises/vendor/illuminate/support/Collection.php on line 1827

Deprecated: Return type of Illuminate\Support\Collection::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/lamlashcruisesor/public_html/wp-content/themes/lamlash-cruises/vendor/illuminate/support/Collection.php on line 1768

Deprecated: Return type of Illuminate\Support\Collection::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/lamlashcruisesor/public_html/wp-content/themes/lamlash-cruises/vendor/illuminate/support/Collection.php on line 1747

Deprecated: Return type of Illuminate\Support\Collection::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/lamlashcruisesor/public_html/wp-content/themes/lamlash-cruises/vendor/illuminate/support/Collection.php on line 1716

Deprecated: Return type of Illuminate\Container\Container::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/lamlashcruisesor/public_html/wp-content/themes/lamlash-cruises/vendor/illuminate/container/Container.php on line 1197

Deprecated: Return type of Illuminate\Container\Container::offsetGet($key) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/lamlashcruisesor/public_html/wp-content/themes/lamlash-cruises/vendor/illuminate/container/Container.php on line 1208

Deprecated: Return type of Illuminate\Container\Container::offsetSet($key, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/lamlashcruisesor/public_html/wp-content/themes/lamlash-cruises/vendor/illuminate/container/Container.php on line 1220

Deprecated: Return type of Illuminate\Container\Container::offsetUnset($key) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/lamlashcruisesor/public_html/wp-content/themes/lamlash-cruises/vendor/illuminate/container/Container.php on line 1233

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 32768 bytes) in /home/lamlashcruisesor/public_html/wp-content/plugins/wordpress-seo/lib/model.php on line 1

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 45056 bytes) in /home/lamlashcruisesor/public_html/wp-includes/functions.php on line 4276

In order to look into this I wanted to get a local copy working. I’ve downloaded a site onto my machine using “Local”, and copied the Sage theme down from my git repository.

When I run the site locally I get the following error:

'# Sage › Error
<small>Autoloader not found.</small>

You must run `composer install` from the Sage directory.

[roots.io/sage/docs/](https://roots.io/sage/docs/)'

I have done as suggested but now I get

Problem 1
    - illuminate/config is locked to version v5.6.39 and an update of this package was not requested.
    - illuminate/config v5.6.39 requires php ^7.1.3 -> your php version (8.2.1) does not satisfy that requirement.
  Problem 2
    - illuminate/container is locked to version v5.6.39 and an update of this package was not requested.
    - illuminate/container v5.6.39 requires php ^7.1.3 -> your php version (8.2.1) does not satisfy that requirement.
  Problem 3
    - illuminate/contracts is locked to version v5.6.39 and an update of this package was not requested.
    - illuminate/contracts v5.6.39 requires php ^7.1.3 -> your php version (8.2.1) does not satisfy that requirement.
  Problem 4
    - illuminate/events is locked to version v5.6.39 and an update of this package was not requested.
    - illuminate/events v5.6.39 requires php ^7.1.3 -> your php version (8.2.1) does not satisfy that requirement.
  Problem 5
    - illuminate/filesystem is locked to version v5.6.39 and an update of this package was not requested.
    - illuminate/filesystem v5.6.39 requires php ^7.1.3 -> your php version (8.2.1) does not satisfy that requirement.
  Problem 6
    - illuminate/support is locked to version v5.6.39 and an update of this package was not requested.
    - illuminate/support v5.6.39 requires php ^7.1.3 -> your php version (8.2.1) does not satisfy that requirement.
  Problem 7
    - illuminate/view is locked to version v5.6.39 and an update of this package was not requested.
    - illuminate/view v5.6.39 requires php ^7.1.3 -> your php version (8.2.1) does not satisfy that requirement.
  Problem 8
    - illuminate/console is locked to version v5.6.39 and an update of this package was not requested.
    - illuminate/console v5.6.39 requires php ^7.1.3 -> your php version (8.2.1) does not satisfy that requirement.
  Problem 9
    - paragonie/random_compat is locked to version v9.99.99 and an update of this package was not requested.
    - paragonie/random_compat v9.99.99 requires php ^7 -> your php version (8.2.1) does not satisfy that requirement.
  Problem 10
    - illuminate/config v5.6.39 requires php ^7.1.3 -> your php version (8.2.1) does not satisfy that requirement.
    - roots/sage-lib 9.0.9 requires illuminate/config ~5.6 -> satisfiable by illuminate/config[v5.6.39].
    - roots/sage-lib is locked to version 9.0.9 and an update of this package was not requested.

So then I tried the compser update command but get this instead…

PHP Deprecated:  Return type of Symfony\Component\Console\Helper\HelperSet::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/local/bin/composer/vendor/symfony/console/Helper/HelperSet.php on line 112

Deprecated: Return type of Symfony\Component\Console\Helper\HelperSet::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/local/bin/composer/vendor/symfony/console/Helper/HelperSet.php on line 112
Deprecation Notice: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in phar:///usr/local/bin/composer/vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Constraint.php:48
Deprecation Notice: Return type of Composer\Repository\ArrayRepository::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/local/bin/composer/src/Composer/Repository/ArrayRepository.php:277
Deprecation Notice: Return type of Composer\Repository\ArrayRepository::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/local/bin/composer/src/Composer/Repository/ArrayRepository.php:277
Deprecation Notice: Return type of Composer\Repository\ArrayRepository::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/local/bin/composer/src/Composer/Repository/ArrayRepository.php:277
Deprecation Notice: Return type of Symfony\Component\Finder\Finder::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/local/bin/composer/vendor/symfony/finder/Finder.php:675
Deprecation Notice: Return type of Symfony\Component\Finder\Finder::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/local/bin/composer/vendor/symfony/finder/Finder.php:732
Deprecation Notice: Return type of Symfony\Component\Finder\Iterator\FilterIterator::rewind() should either be compatible with FilterIterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/local/bin/composer/vendor/symfony/finder/Iterator/FilterIterator.php:30
Deprecation Notice: Return type of Symfony\Component\Finder\Iterator\FileTypeFilterIterator::accept() should either be compatible with FilterIterator::accept(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/local/bin/composer/vendor/symfony/finder/Iterator/FileTypeFilterIterator.php:42
Deprecation Notice: Return type of Symfony\Component\Finder\Iterator\RecursiveDirectoryIterator::getChildren() should either be compatible with RecursiveDirectoryIterator::getChildren(): RecursiveDirectoryIterator, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/local/bin/composer/vendor/symfony/finder/Iterator/RecursiveDirectoryIterator.php:85
Deprecation Notice: Return type of Symfony\Component\Finder\Iterator\RecursiveDirectoryIterator::rewind() should either be compatible with FilesystemIterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/local/bin/composer/vendor/symfony/finder/Iterator/RecursiveDirectoryIterator.php:113
Deprecation Notice: Return type of Symfony\Component\Finder\Iterator\RecursiveDirectoryIterator::current() should either be compatible with FilesystemIterator::current(): SplFileInfo|FilesystemIterator|string, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/local/bin/composer/vendor/symfony/finder/Iterator/RecursiveDirectoryIterator.php:65
Deprecation Notice: Return type of Symfony\Component\Finder\Iterator\ExcludeDirectoryFilterIterator::accept() should either be compatible with FilterIterator::accept(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/local/bin/composer/vendor/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.php:55
Deprecation Notice: Return type of Symfony\Component\Finder\Iterator\ExcludeDirectoryFilterIterator::hasChildren() should either be compatible with RecursiveIterator::hasChildren(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/local/bin/composer/vendor/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.php:71
Deprecation Notice: Return type of Symfony\Component\Finder\Iterator\ExcludeDirectoryFilterIterator::getChildren() should either be compatible with RecursiveIterator::getChildren(): ?RecursiveIterator, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/local/bin/composer/vendor/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.php:76
Deprecation Notice: Return type of Symfony\Component\Finder\Iterator\FilterIterator::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/local/bin/composer/vendor/symfony/finder/Iterator/FilterIterator.php:30
Deprecation Notice: Return type of Symfony\Component\Finder\Iterator\DateRangeFilterIterator::accept() should either be compatible with FilterIterator::accept(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/local/bin/composer/vendor/symfony/finder/Iterator/DateRangeFilterIterator.php:41
Deprecation Notice: Return type of Symfony\Component\Finder\Iterator\PathFilterIterator::accept() should either be compatible with FilterIterator::accept(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/local/bin/composer/vendor/symfony/finder/Iterator/PathFilterIterator.php:27
Deprecation Notice: Using ${var} in strings is deprecated, use {$var} instead in phar:///usr/local/bin/composer/src/Composer/Autoload/AutoloadGenerator.php:777
Deprecation Notice: Using ${var} in strings is deprecated, use {$var} instead in phar:///usr/local/bin/composer/src/Composer/Autoload/AutoloadGenerator.php:782
Loading composer repositories with package information
Deprecation Notice: Implicit conversion from float 206.03 to int loses precision in phar:///usr/local/bin/composer/src/Composer/Platform/Version.php:100
Info from https://repo.packagist.org: #StandWithUkraine
Deprecation Notice: Return type of Composer\DependencyResolver\Pool::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/local/bin/composer/src/Composer/DependencyResolver/Pool.php:76
Updating dependencies
Deprecation Notice: Return type of Composer\DependencyResolver\RuleSet::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/local/bin/composer/src/Composer/DependencyResolver/RuleSet.php:116
Deprecation Notice: Return type of Composer\DependencyResolver\RuleSet::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/local/bin/composer/src/Composer/DependencyResolver/RuleSet.php:101
Deprecation Notice: Return type of Composer\DependencyResolver\Decisions::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/local/bin/composer/src/Composer/DependencyResolver/Decisions.php:155
Deprecation Notice: Return type of Composer\DependencyResolver\Decisions::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/local/bin/composer/src/Composer/DependencyResolver/Decisions.php:165
Deprecation Notice: Return type of Composer\DependencyResolver\Decisions::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/local/bin/composer/src/Composer/DependencyResolver/Decisions.php:160
Deprecation Notice: Return type of Composer\DependencyResolver\Decisions::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/local/bin/composer/src/Composer/DependencyResolver/Decisions.php:170
Deprecation Notice: Return type of Composer\DependencyResolver\Decisions::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/local/bin/composer/src/Composer/DependencyResolver/Decisions.php:150
Deprecation Notice: Return type of Composer\DependencyResolver\Decisions::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/local/bin/composer/src/Composer/DependencyResolver/Decisions.php:145
Deprecation Notice: Return type of Composer\DependencyResolver\RuleSetIterator::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/local/bin/composer/src/Composer/DependencyResolver/RuleSetIterator.php:36
Deprecation Notice: Return type of Composer\DependencyResolver\RuleSetIterator::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/local/bin/composer/src/Composer/DependencyResolver/RuleSetIterator.php:46
Deprecation Notice: Return type of Composer\DependencyResolver\RuleSetIterator::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/local/bin/composer/src/Composer/DependencyResolver/RuleSetIterator.php:41
Deprecation Notice: Return type of Composer\DependencyResolver\RuleSetIterator::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/local/bin/composer/src/Composer/DependencyResolver/RuleSetIterator.php:89
Deprecation Notice: Return type of Composer\DependencyResolver\RuleSetIterator::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/local/bin/composer/src/Composer/DependencyResolver/RuleSetIterator.php:70
Deprecation Notice: Using ${var} in strings is deprecated, use {$var} instead in phar:///usr/local/bin/composer/src/Composer/DependencyResolver/Problem.php:308
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - illuminate/support[v5.6.0, ..., v5.6.39] require php ^7.1.3 -> your php version (8.2.1) does not satisfy that requirement.
    - Root composer.json requires illuminate/support 5.6.* -> satisfiable by illuminate/support[v5.6.0, ..., v5.6.39].

naomispirit@Naomis-MacBook-Pro lamlash-cruises % 

Any ideas of what to do to get this working?

Hi @meemal,

Sage 9 on PHP 8 is not officially supported, but some others have managed to do it.

You might have success by replacing roots/sage-lib with GitHub - mcaskill/sage-lib: Library files for Sage 9

I believe the key is making sure your illuminate/ dependencies are version 8 or newer.

You’ll also want to upgrade your composer installation too, as that’s also throwing deprecation notices by the looks of it. Try composer self-update.

1 Like

AH, I had completely forgotten that. Want to get PHP 8 for performance and hopefully the WooCommerce HPOS update.

I’ll give your hints a try.

If anyone has had success if would be great to hear from them, especially if it also involved a woocommerce installation.

Thanks

See Sage 9 + PHP 8.0

2 Likes