Questions tagged [php-8.1]

For questions specific to the usage and new features of PHP 8.1. Also, include the more generic [php] tag when using this tag.

PHP 8.1 (released November 2021) includes many new features including:

A full list of changes can be found in the migration guide.

336 questions
0
votes
1 answer

php8.1 - Deprecated Functionality: DateTime()

We use the following code that worked perfectly on php7.4, but we get a deprecated error on php8.1. But how can we succesfully rewrite this for php8.1? Error: Deprecated Functionality: DateTime::__construct(): Passing null to parameter #1…
JGeer
  • 1,768
  • 1
  • 31
  • 75
0
votes
1 answer

Unable to resolve service "memcache" to a factory; are you certain you provided it during configuration?

I am working on upgrading PHP 7.4 to 8.1 on my Laminas project. In config/autoload/global.php I have- 'caches' => require DIR . '/caches.php', This is caches.php- 'caches' => array( 'memcached' => array( 'adapter' =>…
manishk
  • 526
  • 8
  • 26
0
votes
0 answers

Firefox can’t establish a connection to the server at wss://

I have installed Ratchet websocket through for my website that is under https: php ~/composer.phar require cboden/ratchet then I have set the bin/server.php: [...] class Chat $server = IoServer::factory( new HttpServer( new WsServer( …
0
votes
0 answers

PHP 8.1 not running on macOS

I'm trying to use PHP 8 with composer, but the PHP itself gives me an error. Here is the result when I run PHP -v on the terminal. My OS is macOS, and I used Homebrew to install PHP. PHP Warning: PHP Startup: ^(text/|application/xhtml\+xml)…
0
votes
2 answers

Convert PHP 8.1 Enums to constants

I have this PHP 8.1 Enum Class but when I uploaded my code, my VPS supports up to PHP 8.0. enum AssignmentState: string { case Draft = 'draft'; case Published = 'published'; case Graded = 'graded'; } And this is how I use it in the…
Herman Ceaser
  • 90
  • 2
  • 12
0
votes
1 answer

Symfony - how to access table data from link table

I have a user table, a module table, and a user_module binding table. The user_module table has user_id and module_id as foreign keys, and an is_activated attribute. When I fetch a row from the slugs of the user and module tables, I can see all the…
0
votes
1 answer

DigitalOcean - Ubuntu php8.1 - pecl install grpc g++: fatal error: Killed signal terminated program cc1plus - ERROR: `make' failed

Can't get pecl to install grpc. Command sudo pecl install grpc Error g++: fatal error: Killed signal terminated program cc1plus compilation terminated. make: *** [Makefile:226: src/core/ext/filters/client_channel/client_channel.lo] Error 1 ERROR:…
K-G
  • 2,799
  • 4
  • 26
  • 42
0
votes
0 answers

Remove global scopes while applying another scope in Laravel

In my multi-tenant application, Institutions can only see the Assignments they create. Assignments become templates if they are marked as is_template. If a template is marked as is_shared then all institutions should be able to see it. To achieve…
Jacob Barrow
  • 631
  • 1
  • 8
  • 25
0
votes
2 answers

Merge 2D array into another 2D array with different structure

I have 2 multidimensional arrays. I need to merge the content from the second array into first array. First array consists of dates and/or some urls. array:2 [ 0 => array:3 [ 0 => array:2 [ "startDate" => "2022-01-01" "endDate" =>…
user1687891
  • 794
  • 2
  • 14
  • 30
0
votes
0 answers

Warning after updating php version 8.1

After updating PHP 7.4 to PHP 8.1 , PHP produces following erro when cheking php version Deprecated: Return type of APCuIterator::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should…
Saad
  • 73
  • 1
  • 8
0
votes
1 answer

How to show input and output exemple with nelmio-api-bundle and php8.1

I'm currently trying to make an API doc page thanks to nelmio-api-bundle. I only have one route which is a POST route. I'm receiving a JSON in the body of the request and I'm using the Serializer from symfony to deserialize it in a DTO. I'm also…
jeff
  • 35
  • 6
0
votes
1 answer

Migrating PHP 7 to 8 - Object's constructor is not called

We need to migrate our live online store from PHP 7.x to PHP 8.x My main XAMPP folder is running PHP 7.4.3, and I've installed the latest XAMPP (8.1.6) into another folder. The main site seems to work fine when I run the PHP 8 instance, but the…
Mike West
  • 15
  • 5
0
votes
2 answers

Laravel 9 upgrade issue during deployment

I have an existing Laravel 8 application that is deployed in Google cloud App Engine. I'm trying to upgrade to Laravel 9, however facing a strange issue while trying to deploy - Updating service [default]...failed. …
Asif
  • 75
  • 2
  • 6
0
votes
2 answers

Attempt to assign property "status" on null

I have the following code running on PHP 7.4.2, but after the update to PHP 8.1.2, I'm getting an error in order to fill an array with some data. if ($result->num_rows > 0) { while($row = $result->fetch_assoc()) { $myObj->status = '1'; …
Paul Mark
  • 189
  • 12
0
votes
0 answers

There is no active transaction error while installing OroCommerce App

I'm trying to install OroCommerce application, but i'm getting this error [PDOException] There is no active transaction I'm using the below command to install php bin/console oro:install --timeout=2000 -vvv I'm using Mysql…
Haithem Rihane
  • 394
  • 2
  • 5
  • 15