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

How to inject env VARS into abstract class in a Symfony54 php81 app

I have recently undertaken upgrading an old Symfony 4.4 app (to 5.4 and PHP 8.1) and have been following the brilliant tutorials over at symfonycasts.com. I have come up to a point where I don't understand how to move forward. class One extends…
Oceanic_Panda
  • 112
  • 1
  • 13
0
votes
1 answer

strftime in PHP 8.1

I'm slowly moving all my sites from PHP 7.4 to PHP 8.1 and one of the issues I'm facing is this piece of code: setlocale(LC_TIME, array('nl_NL.UTF-8', 'nl_NL@euro', 'nl_NL', 'dutch')); echo ucfirst(strftime('%B', mktime(0, 0, 0, 1, 1, 2022))); I…
vespino
  • 1,714
  • 3
  • 15
  • 28
0
votes
1 answer

PHP use ENUM in Attributes

Look at the following code:
112Legion
  • 1,129
  • 12
  • 25
0
votes
0 answers

Warning: Undefined property: stdClass since php8.1

Since update to php 8.1 I've the problem in a foreach that will give the below error. Warning: Undefined property: stdClass::$1 in /ActivityShow.php on line 2271 line: 2271: is

" . …

AdemD
  • 13
  • 4
0
votes
0 answers

PHP: Issues after upgrade

I have migrated from php 7.x to PHP 8.1 and just noticed that my screen exec() are no longer working. They were working fine before. I can see the screens running with screen -ls but it’s like the exec() in the php file is no longer executed. It…
Daniele
  • 3
  • 2
0
votes
1 answer

Laravel send mail

I'm trying to send an email and I get this error Typed property Symfony\Component\Mailer\Transport\AbstractTransport::$dispatcher must not be accessed before initialization use Illuminate\Support\Facades\Mail; use App\Mail\Signups as…
alex
  • 51
  • 5
0
votes
0 answers

PHP with active xdebug handles 0 values as null

Description xdebug seems to handle 0 as well as "0" values as null values if it is enabled and PhpStorm actively listens to incoming connections. If xdebug is enabled but PhpStorm doesn't listen to connections ("the debugger is disabled" - so to…
Felix
  • 2,531
  • 14
  • 25
0
votes
0 answers

PHP: strtr() memory exhausted

I have a function that checks and decodes the content from various variables: public static function decode($content, $flag=ENT_NOQUOTES){ if ( !empty($content) && is_string($content) && !is_numeric($content) && !is_array($content) &&…
Ivijan Stefan Stipić
  • 6,249
  • 6
  • 45
  • 78
0
votes
2 answers

Error when run "setup:di:compile" in Magento ver. 2.4.5-p1, PHP 8.1

After upgrading to magento 2.4.5-p1 and to php 8.1 I get this error while I try to compile I tried to delete the vendor folder and did composer update but same results. any way to solve this issue? public_html$ bin/magento…
kobi077
  • 33
  • 5
0
votes
1 answer

Azure + Debian + PHP8.1 trying to install sqlsrv_pdo and getting "error: `make` failed;

Trying to deploy a PHP Azure "App Service" app, which connects to a SQL Server database I have to add the sqlsrv and sqlsrv_pdo packages by running pecl install pdo_sqlsrv and pecl install sqlsrv` Other threads have mentioned adding apt-get install…
Mike Wright
  • 111
  • 1
  • 2
0
votes
0 answers

How to setup PHP 8.1 as default version on Ubuntu 20.04 server

I have upgraded from PHP7.4 to PHP 8.1.It here when i use command line $ php -v PHP 8.1.12 (cli) (built: Oct 28 2022 17:39:37) (NTS) Copyright (c) The PHP Group Zend Engine v4.1.12, Copyright (c) Zend Technologies with Zend OPcache v8.1.12,…
0
votes
0 answers

"addcslashes(): Passing null to parameter #1 ($string) of type string is deprecated" in Drupal

Following error is thrown after upgrading from Drupal 8.7 to Drupal 9.4, and PHP 7.2 to PHP 8.1: Deprecated function: addcslashes(): Passing null to parameter #1 ($string) of type string is deprecated in…
tushar
  • 1
0
votes
1 answer

Unexpected behaviour with PHP trim() native function

Is this for real? Native PHP trim function uses the $char_double by default. I expected the $trimmed_single_double to be as $trimmed_matching_double. This code was tested on https://onlinephp.io/c/9799e2b3-6598-447b-9ca1-31218983d9e1 using (PHP…
thorstorm
  • 153
  • 3
  • 10
0
votes
0 answers

Swift Mailer stopped working after update to PHP 8.1

I recently updated PHP version on our server to 8.1.11, and SwiftMailer stops working. Specifically, this function causes a HTTP 500 error on the page: $transport = Swift_SmtpTransport::newInstance("smtp.gmail.com", 465, "ssl") ->…
Nick Giordano
  • 31
  • 1
  • 6
0
votes
1 answer

session_write_close() raises "TypeError: Session callback must have a return value of type bool, int returned" error in PHP 8.1

I'm testing PHP 8.1.9 and when I try calling session_write_close(); It gave me a TypeError: Session callback must have a return value of type bool, int returned error. Maybe that one relates with this line in php-src/ext/session/mod_user.c Now I…
The Anh Nguyen
  • 748
  • 2
  • 11
  • 27