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

Removing Severity: 8192 from PHP 8.1 error log

Recently upgraded my PHP version from 8.0 to 8.1, now it's displaying tons of error regarding this, mainly Severity: 8192 --> Implicit conversion from float-string "1651218180.598425" to int loses precision I have already turned error_reporting…
1
vote
2 answers

How to install PHP 8.1 on Amazon Linux 2 (ARM64)

I'm trying to install php 8.1 on a Graviton 2 (ARM64) EC2 instance thats running Amazon Linux 2. All of the guides I've followed use remi-release-7.rpm. When I use this repository, yum updates are flooded with 404 errors…
Hunter
  • 241
  • 2
  • 11
1
vote
1 answer

Enums extend or use traits (reusability)

I have enums that must have additional methods for translation purposes:
RomkaLTU
  • 3,683
  • 8
  • 40
  • 63
1
vote
2 answers

Using Native Enum in Api-Platform / OpenApi

I am learning OpenApi/Swagger API with Api-Platform. I created a new endpoint, that accepts values of an enum as a parameter: #[ApiResource( itemOperations: [ 'get_by_name' => [ 'openapi_context' => [ .... …
PrimuS
  • 2,505
  • 6
  • 33
  • 66
1
vote
0 answers

IIS - PHP 8.1.4 Performance Degrades After 2 Hours

I am running IIS 10 on Windows Server 2016. I am using PHP 8.1.4 NTS with FastCGI. PHP is optimized following the usual recommendations. I noticed that the server's response times start to increase after about 2 hours. For example, the TTFB is…
ChrisB3127
  • 31
  • 3
1
vote
1 answer

Difference between gettype() and get_debug_type() in PHP8.1?

What is the exact difference between gettype() and get_debug_type()? Official documentation describes it, but too vague for me: gettype(): Get the type or object name of a variable get_debug_type(): Get the type of a variable
WebDevPassion
  • 422
  • 1
  • 4
  • 12
1
vote
2 answers

PHP file_get_contents() and curl_exec() fail from website but work from command line

Created .test.php file with one line of code: When I open .test.php from browser, it shows bool(false) but when I run it from command line, it shows my WAN IP as expected. php…
1
vote
1 answer

Can a PHP class return an array of classes without calling methods or variables?

Within PHP, I'd like to be able to iterate over a collection of classes to help with settings, inserting, and validating values. Using a class as a type in method args would make the code more strict which would help avoiding bugs. I am able to…
MCSharp
  • 1,068
  • 1
  • 14
  • 37
1
vote
1 answer

PHP 8.1 fastcgi exe is not available in non thread safe version

I'm upgrading my php from 7.2 to 8.1 to be used with IIS FastCgi. When I download Non Thread Safe version from below url, as recommended by PHP for IIS FastCGI, the php-cgi.exe is not available in the downloaded…
Sam
  • 53
  • 4
1
vote
1 answer

preg_match is faster than strpos on large text?

I am currently updating very old script written for PHP 5.2.17 for PHP 8.1.2. There is a lot of text processing code blocks and almost all of them are preg_match/preg_match_all. I used to know, that strpos for string matching have always been faster…
somers
  • 11
  • 3
1
vote
2 answers

Why is PHP 8.1.1 not loading PDO driver using Apache 2.4.52 even the modules are loaded on PHP CLI?

Why is PHP 8.1.1 not loading PDO driver using Apache 2.4.52 even the modules are loaded on PHP CLI? I am running a window 11 64bit system I tried Apache/2.4.52 (Win64) (Apache 2.4 VS16) and Apache 2.4.x OpenSSL 1.1.1 VC15 from…
Mehrwarz
  • 413
  • 1
  • 10
1
vote
2 answers

PHP 8.1.1 issue with __toString() Method - causing Class not found if instance created before declaration of class itself

I have an issue after upgrade from PHP 7.3 to 8.1.1 There is lot to be done of course, but this is kind of weird. This example is not working for me with error Fatal error: Uncaught Error: Class "TestC" not found…
Chada
  • 46
  • 5
1
vote
1 answer

composer and laravel 7 not working with php 8.1

Today i updated php in xampp to 8.1.0 after that all Laravel projects stopped in localhost. So, after update composer.json from to "php": "^7.3|^8.0", I see the composer have problem like this after run composer update or any composer command: PHP…
Hasan Hatem
  • 55
  • 1
  • 2
  • 8
1
vote
0 answers

Phpunit doesn't recognize my project namespaces and class names

recently I've recognized that the project opis/closure is facing issues with deprecated serialization solution for php 8.1.1. So I created a fork of that and tried to fix the issue, while I was fixing the issue, I tried to test the output with the…
Arash Khajelou
  • 560
  • 3
  • 16
1
vote
1 answer

Why is PHP 8.1 telling me that the signature of my function is deprecated?

I installed PHP 8.1 but I have an error appear about deprecated function. Do you have an idea about that and to resolve it? Deprecated: Return type of OM\Db::prepare(string $statement, $driver_options = null) should either be compatible with…
dixewi7232
  • 71
  • 8