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
0 answers

my site is not working after adding ssl certificate working fine with HTTP but not with HTTPS

I am running my website on AWS elastic beanstalk and there I install PHP 8.1 64bit Amazon Linux 2/3.5.0. Everything works fine when I am running my website on HTTP but when I added an SSL certificate it's not working. Means it's working with the…
Shubham Azad
  • 786
  • 2
  • 10
  • 25
0
votes
2 answers

filter woocommerce_upsells_total doesn't return a integer

I'm stuck on a fatal error with my Woocommerce theme. It al started when we switched from PHP 7.4 to 8.1. We get the following error when we go to a product page: Fatal error: Uncaught TypeError: array_slice(): Argument #3 ($length) must be of type…
Michael W.
  • 23
  • 6
0
votes
0 answers

Laravel 9 - How to validate user with sanctum in Request

I have a route with the sanctum middleware, the idea of ​​this route is that only those users with a token can access it. If I make a call with a correct token, the method works, if I try to make the query with an INVALID token, it returns an error…
ilernet
  • 194
  • 1
  • 2
  • 7
0
votes
0 answers

unpack(): Type H with ZKTeco SDK and Laravel 8

I got This Error when I Try to call getUser(): unpack(): Type H: not enough input, need 1, have 0 I Using Laravel 8 and (ZKTeco SDK) for (fingerprint machine) and Xampp 8.1 Can somebody help me?
0
votes
0 answers

Quickform2's HTML_QuickForm2_Renderer_Proxy triggers a segfault

The code that I'm running is: HTML_QuickForm2_Renderer::factory('array'); That's it. In order to test this I pared it down to that line in a simple test script. In HTML_QuickForm2_Renderer_Proxy::__construct(), the line where it assigns the renderer…
Christoph
  • 978
  • 7
  • 17
0
votes
1 answer

Symfony 4.4 getResult hydrator slow - PHP 8.1

I updated my old Symfony 4.3 application to 4.4 and i moved the application on a new server with PHP8.1 and mySQL8. Before i used a Server with PHP7.4. I noticed now that my application is very slow on the new setup. Some routes are 1 second slower…
tablesuplex
  • 55
  • 1
  • 10
0
votes
0 answers

float image in left margin document. PhpWord 0.18, environment php 8.1, Laravel 9

I need to put the signature in the left margin of the word document, as shown in the following image. It worked fine in a PHP 7.4 environment, just put style="float: left" on the image element
0
votes
1 answer

Laravel Carbon: Wrong date: 1 day difference

I'm trying to use Laravel Carbon because strftime() will be deprecated in PHP 8.1. A simple example: date_default_timezone_set('Europe/Amsterdam'); setlocale(LC_ALL, 'nl_NL'); use…
bwhendrickx
  • 63
  • 1
  • 8
0
votes
1 answer

CSV import problem since converting to PHP 8.1

I have the following Wordpress function that worked in PHP 7. Since converting to 8.1, it's not working. function dropdown_handler() { $output = drop_function(); //send back text to replace shortcode in post return $output; } function…
bertster
  • 383
  • 1
  • 3
  • 17
0
votes
0 answers

Handling of Mongodb when Moving from PHP 7.2 to PHP 8.1

I want to migrate from PHP 7.2 to PHP 8.1 I am also using mongodb driver with php I added this line on php.ini of version 8.1: extension=mongodb.so I have "mongodb.so" in this folder "/opt/cpanel/ea-php72/root/usr/lib64/php/modules/" but not in…
mohamed
  • 173
  • 2
  • 2
  • 14
0
votes
1 answer

How to compare two datetime form Json data with the current datetime in PHP 8

I want to compare two DateTime from JSON data with the current DateTime. compare the start date & end date with the current date to data between these two dates. If dates do not match give 0 answer. $json = '[ { "type":"playlist", …
0
votes
0 answers

How to test enums since they are marked final

I'm trying to write some tests for code in PHP8.1, which introduced enums. However, mocking does not seem to allow for enums, generating the following exception: PHPUnit\Framework\MockObject\RuntimeException : Return value for…
0
votes
1 answer

PHP - Time part not being returned in custom datetime conversion function

Using PHP, I need to extract encoded datetime values from a SQLite database for display on a web page. The datetime are encoded in a custom format, as described in this question. However, my code is only extracting the date part and not the time…
Steve F
  • 1,527
  • 1
  • 29
  • 55
0
votes
1 answer

PHP: Select enum case from string value of case name

I'm looking at enum in PHP 8.1. I have a string variable gathered from a database record, and I want to select the correct enum value case based on that string. For example: enum Test: string { case FOO = 'baz'; case BAR = 'buz'; } I can…
Stephen R
  • 3,512
  • 1
  • 28
  • 45
0
votes
0 answers

Not able to execute laravel 8 on centOS7. php version 8.1.0. Tried customizing .env as well .htaccess

Not able to execute laravel 8 on centOS7. php version 8.1.0. Tried customizing .env as well .htaccess but not able to execute the application. This page isn’t working113.193.213.44 is currently unable to handle this request. HTTP ERROR 500