php-7.4

PHP 7.4 & MySQL: caching_sha2_password Denying long (20c) passwords

谁说我不能喝 提交于 2019-12-23 13:31:06
问题 UPDATE: I've found out which passwords are affected. See my answer below. An answer to why long passwords are rejected would still be much appreciated. Disclaimer: I have tried about 2 hours just setting different passwords. I am absolutely confident that the password below causes the issue. It works with other passwords. I do know how to fix it: use a different password. I want to know why it does not work. Because such inconsistency is not acceptable. I am able to reproduce the issue on my

php7.4 mysqli times out with “gone away”

送分小仙女□ 提交于 2019-12-23 09:29:16
问题 I have just installed php7.4, everything seems ok but when I try to go on my phpmyadmin, I can't : Note works fine in php7.3 before this installation The error is : mysqli_real_connect(): Unexpected server response while doing caching_sha2 auth: 109 mysqli_real_connect(): (HY000/2006): MySQL server has gone away looking my php mysql library : php7.4-mysql . it's installed. Forget something ? Thank you. NOTICE: Not enabling PHP 7.4 FPM by default. NOTICE: To enable PHP 7.4 FPM in Apache2 do:

PhpStorm does not recognize properties type hinting for PHP 7.4

≯℡__Kan透↙ 提交于 2019-12-12 06:46:37
问题 Recently I found out that with PHP 7.4 we can type-hint properties in classes. Here is my code class Tournament { private Organization $organization; private array $teams; public function __construct() { $this->teams = array(); } public function setOrganization(Organization $organization) { if (!$this->organization->equals($organization)) { $this->organization = $organization; } } } I use PhpStorm and it gives me a warning for ($this->organization->equals(..)) , saying that the referenced

Splatpacking versus array_values() to re-index an array with numeric keys

坚强是说给别人听的谎言 提交于 2019-12-10 00:34:49
问题 As of PHP7.4, there is a newly available technique to re-index an array with numeric keys. I'll call it " array re-packing " or maybe something fun like " splatpacking ". The simple process involves using the splat operator ( ... ) -- aka "spread operator" -- to unpack an array then fills a new array with with the contents. Comparison Code: (Demo) $array = [2 => 4, 5 => 3, "3" => null, -10.9 => 'foo']; var_export(array_values($array)); var_export([...$array]); Both will output: array ( 0 => 4

Splatpacking versus array_values() to re-index an array with numeric keys

 ̄綄美尐妖づ 提交于 2019-12-04 22:07:51
As of PHP7.4, there is a newly available technique to re-index an array with numeric keys. I'll call it " array re-packing " or maybe something fun like " splatpacking ". The simple process involves using the splat operator ( ... ) -- aka " spread operator " -- to unpack an array then fills a new array with with the contents. Comparison Code: ( Demo ) $array = [2 => 4, 5 => 3, "3" => null, -10.9 => 'foo']; var_export(array_values($array)); var_export([...$array]); Both will output: array ( 0 => 4, 1 => 3, 2 => NULL, 3 => 'foo', ) Again, the splatpacking technique is strictly limited to arrays

How to use arrow functions in PHP?

主宰稳场 提交于 2019-12-04 14:29:28
问题 I got to know about arrow functions in PHP 7.4. I tried using them like <?php $num = 1; $arrowfunction = () => { return $num + 1; } echo $arrowfunction(); Because I saw the => operator in the pull request. Just like javascript. I expected '2' as the output but this didn't work! I got Parse error: syntax error, unexpected ')' in /test.php on line 3 回答1: Arrow functions in PHP are introduced in PHP 7.4. They are a little different . The fn keyword The new fn keyword is now a reserved keyword.