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
1
vote
1 answer

annotation to attribute syntax: The annotation "@Security" in method App\Controller\… was never imported

By switching my app from Sf5 to Sf6, I have annotation to attribute issues : [Semantical Error] The annotation "@Security" in method App\Controller\MyController::delete() was never imported. Did you maybe forget to add a "use" statement for this…
bcag2
  • 1,988
  • 1
  • 17
  • 31
1
vote
0 answers

Repeated Doctrine Migrations Generated for PHP 8.1 Enum Column in Symfony

I'm currently working on a Symfony project and using Doctrine ORM. I'm trying to use a native PHP 8.1 enum for a column in one of my entities. Here is the definition of the entity and the enum: namespace App\Entity; use…
TomKorec
  • 206
  • 2
  • 6
1
vote
2 answers

Cannot enable Xdebug step debugger PHP 8.1 FPM

So I just updated my PHP on Plesk from 7.4 to 8.1 and I cannot get Xdebug to Step Debug. At a loss as what I'm missing. I attached image of Xdebug settings from phpinfo. Of course 7.4 works fine but is old. My PHP.ini is modified like…
user1110938
  • 153
  • 4
  • 11
1
vote
2 answers

Installing PHP on ubuntu server 22.10

I'm trying to install php on Ubuntu 22.10, I used to be able to do "apt install php" and be done with it but now I can't for some reason? All I get when I run install php is this: root@backups:/# apt install php Reading package lists...…
Alex
  • 37
  • 5
1
vote
2 answers

how to implement EnumClass::$userInput on php 8.1 Enums?

I have been learning the new enums introduction on php 8.1 with laravel for an eccomerce cms. i'm brandly new on SOLID principles. This this my Enum class: enum PaymentMethods : string { case PAYPAL = 'pay with paypal'; case STRIPE = 'pay…
Mehran Nasr
  • 157
  • 8
1
vote
1 answer

Cakephp1.3 with PHP 8.1

Can I upgrade PHP version 5.2 to PHP 8.1 with CakePHP 1.3? What will be challenges during upgradation? We need to to upgrade test cases too. we want to run cakePHP 1.3 project with latest PHP version of server with out upgrading our cakephp version.…
1
vote
1 answer

Install Remi repository on CentOS Linux release 8.5.2111 (not CentOS 8 stream)

I want to update to PHP 8.1 in my old Centos 8.5.2111 server. But I'm unable to install Remi repository. I get the following: othing provides (redhat-release >= 8.7 or centos-stream-release >= 8) needed by…
Cris
  • 23
  • 1
  • 7
1
vote
0 answers

How do I compare a csrf Token with a current Session Token in PHP 8?

Perhaps I am doing this wrong for php-fpm PHP 8. It seems to work otherwise on my local test server. Server is Running Apache 2.4 and php-fpm v8.1.15 I have tried changing around the following bootstrap settings: ini_set('session.use_only_cookies',…
1
vote
1 answer

Enum explicit cast to int returns 1 (and warning)

Here's a runnable example: https://onlinephp.io/c/d9c58 enum DigitEnum : int { case TWO = 2; } $i = (int) DigitEnum::TWO; // emits a warning, expected echo $i; // outputs 1 The output is: Warning: Object of class DigitEnum could not be…
Adam Cameron
  • 29,677
  • 4
  • 37
  • 78
1
vote
1 answer

Laravel sqlsrv query execution time is very slow

I have Microsoft SQL Server database (SQLSRV) and I am trying to execute a query via Laravel DB class (Illuminate\Support\Facades\DB): DB::select(DB::raw("select * from [table]")); and Laravel Eloquent: Items::select('*')->get(); and the execution…
1
vote
1 answer

Getting error bz2 module requires libbz2 >= 1.0.0 while compiling php 8.1.13

I am trying to compile PHP with ./configure --with-bz2=/path_to_bzip2/bzip2/1.0.6 But when the build reaches bz2 it gives out below error .. checking for BZip2 support... yes checking for BZ2_bzerror in -lbz2... no configure:…
Lokesh Purohit
  • 523
  • 6
  • 9
1
vote
1 answer

Rector Failed to create "/tmp/rector_cached_files/26": mkdir(): Permission denied

When I run the command: vendor/bin/rector process --dry-run I get the error: [ERROR] Failed to create "/tmp/rector_cached_files/26": mkdir(): Permission denied Web server processes on this system currently run as the user. If I run the script as…
1
vote
2 answers

Class "Zend\Log\Writer\Stream" not found magento2.4.5 And magento2.4.5p1++

Magento 2 old versions like magento 2.4.0 are accepted like taht I found a solution to fixed custom log t Magento 2.4.3+++++: $writer = new \Zend_Log_Writer_Stream(BP . '/var/log/mycustom.log'); $logger = new…
1
vote
1 answer

Laravel Date Type Column Changes Format When Upgrading to Ubuntu 22.04

I'm running a Laravel app in a Docker container that is using Ubuntu as its base image. After upgrading from Ubuntu 20.04 to 22.04, SQL Server date type columns started returning with a different format. Migration: Schema::create('my_table',…
1
vote
0 answers

php8.1 Call to undefined function iconv

Please help me my source code iconv('UTF-8', 'UTF-8//IGNORE', $value); error message PHP Fatal error: Uncaught Error: Call to undefined function iconv() server ubuntu : 22.04 php v : PHP 8.1.13 use : php8.1-fpm.service I want to use the iconv…
jayden
  • 11
  • 1