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

optional named argument after variadic argument

In PHP 7.x, I had some code like the below: =$min && $value<=$max) $sum += $value; return…
safineh
  • 80
  • 9
-1
votes
1 answer

Move_uploaded_file() not showing temp_name and others field in php 8.1

After Upgrading to php 8.1 my move_uploaded_file function is not working. Tmp_name is empty and showing Error 6. I am using PHPExcel. When I uploading it manually my data is fetching correctly but with using moveuploadedfunction the file is not…
Aashir Azeem
  • 173
  • 6
-1
votes
1 answer

Doctrine 2.13.2 Warning: Object of class Enum could not be converted to int

Since last week I noticed problem on few places in the app I am working on. After investigation I found that with composer require doctrine/orm 2.13.1 Everything is ok, but with: composer require doctrine/orm 2.13.2 App brakes on places where I…
-1
votes
2 answers

I can not create a class instance from a string in Symfony

What I wanted to is to create class instance from string in Symfony framework to use Doctrine Repository. Here is my code block: $type = "SomeClassName"; $productType =…
Onur
  • 414
  • 1
  • 11
  • 31
-1
votes
1 answer

"--PHP-alt-" appearing in email body with php 8.1

I have upgraded to php 8.1 and now email sent with mail() is arriving with the following at the beginning of the body, where before it didn't: --PHP-alt-4de4a7c8434ad5b8f6adb6e50c35b0da Content-Type: text/plain;…
mseifert
  • 5,390
  • 9
  • 38
  • 100
-1
votes
1 answer

Symfony 5 Cannot Find Docker Compose

I'm trying to follow the Symfony 5: The Fast Track tutorial, and I'm stuck before I even leave the gate. I've made several attempts to uninstall and reinstall Docker, Docker Compose and Symfony CLI, but the command symfony book:check-requirements…
Darwin von Corax
  • 5,201
  • 3
  • 17
  • 28
-1
votes
1 answer

How to check if variable is an Enum or a Case?

There is a lot of type checking functions in PHP (is_string, is_resource etc) but there is no function to check if variable is an Enum or a Case. How to check it properly?
Grzegorz Adam Kowalski
  • 5,243
  • 3
  • 29
  • 40
-1
votes
2 answers

What does question mark do in php?

class Service { private Logger $logger; public function __construct( ?Logger $logger = null, ) { $this->logger = $logger ?? new NullLogger(); } } I'm learning php oop. What does question mark do in ?Logger $logger =…
rurumita
  • 17
  • 2
-1
votes
2 answers

Upgrade PHP version in project from 5.6 to 8.1

I need to upgrade PHP version of my project. It is PHP5.6 and I want to upgrade it to PHP8.1. I tried to search for such information but couldn't find it, thus, I want to ask. Is it better to upgrade directly from PHP5.6 to PHP8.1, or step by step…
Mr_T
  • 15
  • 1
  • 1
  • 4
-1
votes
1 answer

How to fix phpMyAdmin Fatal error: Uncaught TypeError: mb_strtolower() expects parameter 1 to be string

PhpMyAdmin causes error while executing a query: SELECT * FROM users u INNER JOIN address a ON u.userid=a.id INNER JOIN health_status h ON u.userid=h.uid WHERE u.userid='1634627411' SELECT * from users u INNER join friends f on…
swamper
  • 117
  • 1
  • 10
-2
votes
1 answer

Gitlab Laravel PHPUnit test runner warning

When I made Laravel application upgrades to Laravel 10, PHP 8.1, and PHPUnit 10, I am encountering an error at the end of the update process. All tests run successfully, but this error occurs at the end. Here is how phpunit.xml looks like: What I…
mrakodol
  • 1,143
  • 3
  • 12
  • 41
-2
votes
1 answer

can laravel 7 and 9 live on php 8.1

I have some applications using laravel 7 with PHP7.4 and now I want to make an application with laravel 9 and it looks like I have to upgrade PHP to version 8.1 (cmiiw), and the problem is that Laravel 7 can't run smoothly (many depricated) on PHP…
iwan
  • 11
  • 1
-2
votes
1 answer

jQuery AJAX call broken under PHP 8.X (PHP 8 Uncaught TypeError: array_key_exists() error)

I will try to be as much explicative as possible. I have a PHP+jQuery application (some sort of a text game) where the system works reading and writing JSON files with AJAX all the time. Everything is absolutely perfect under PHP 7.4, however, when…
Cospefogo
  • 147
  • 1
  • 4
  • 12
-2
votes
1 answer

After upgrade php version 7.4 to 8.1 soapCall not working

After upgrade php version 7.4 to 8.1 soapCall not working. I have debugged both ini file and both look like same PHP 7.4 : /usr/local/php7.4/etc/cli/php.ini PHP 8.1 : /usr/local/php8.1/etc/cli/php.ini PHP 7.4 soap call is working fine , but 8.1…
Arif
  • 195
  • 12
-2
votes
1 answer

How I can save image with using a best practices in Laravel (php)?

I have a code with saving a article. With my article I have a photo ('img'), which I want to add to Model Article in field 'img'. How I can do it with using a best practices in Laravel? ArticleController: public function __construct(Article…
Klipe_LD
  • 31
  • 3
1 2 3
22
23