Closed joanhey closed 2 years ago
https://github.com/bcosca/fatfree/blob/master/lib/base.php#L2533 https://github.com/bcosca/fatfree/blob/3.7.3/lib/base.php#L2533 (it's the same here):
2533 if (PHP_SAPI=='cli-server' &&
2534 preg_match('/^'.preg_quote($base,'/').'$/',$this->hive['URI']))
2535 $this->reroute('/');
It's using v3.7.2 https://github.com/bcosca/fatfree/blob/3.7.2/lib/base.php#L2533
I'll try now with v3.7.3
With v3.7.3
PHP message: PHP Fatal error: $GLOBALS can only be modified using the $GLOBALS[$name] = $value syntax in /fat-free/vendor/bcosca/fatfree-core/base.php on line 2538
https://github.com/bcosca/fatfree/blob/3.7.3/lib/base.php#L2538
The relevant snippet is:
if (ini_get('auto_globals_jit'))
// Override setting
$GLOBALS+=['_ENV'=>$_ENV,'_REQUEST'=>$_REQUEST];
It basically tries to outsmart the lazy population of super globals, and PHP 8.1 does not allow it. See PHP 8.1: $GLOBALS
variable restrictions.
I don't understand the reason behind this. PHP should seamlessly populate the super globals the first time it is retrieved, and I think it's alright to simply remove the highlighted snippet.
There are few more deprecation notices popping up (Return type of Base::offsetunset($key) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void,...
, etc.) due to PHP 8.1: Return types in PHP built-in class methods and deprecation notices
I have one site that uses F3, and I will be making a PR that tries to bring PHP 8.1 compatibility.
I was just about to point these issues out. I fixed them by reluncantly doing the following modifications to base.php file:
2358:
Replace:
$GLOBALS+=['_ENV'=>$_ENV,'_REQUEST'=>$_REQUEST];
With:
$GLOBALS['_ENV'] = $_ENV; $GLOBALS['_REQUEST'] = $_REQUEST;
And finally, insert the attribute #[\ReturnTypeWillChange]
above the following functions:
2237: offsetexists 2247: offsetset 2256: offsetget 2265: offsetunset
These changes fix the issues I've been having as far as I can tell but there could be more.
To not duplicate the efforts, @slicke has made a PR at bcosca/fatfree-core#332 with what seems to be all of the changes.
With v3.7.3
PHP message: PHP Fatal error: $GLOBALS can only be modified using the $GLOBALS[$name] = $value syntax in /fat-free/vendor/bcosca/fatfree-core/base.php on line 2538
https://github.com/bcosca/fatfree/blob/3.7.3/lib/base.php#L2538
Same error on '3.7.3-Release' version: PHP Fatal error: $GLOBALS can only be modified using the $GLOBALS[$name] = $value syntax in lib/base.php on line 2538
I was just about to point these issues out. I fixed them by reluncantly doing the following modifications to base.php file:
2358: Replace:
$GLOBALS+=['_ENV'=>$_ENV,'_REQUEST'=>$_REQUEST];
With:
$GLOBALS['_ENV'] = $_ENV; $GLOBALS['_REQUEST'] = $_REQUEST;
And finally, insert the attribute
#[\ReturnTypeWillChange]
above the following functions:2237: offsetexists 2247: offsetset 2256: offsetget 2265: offsetunset
These changes fix the issues I've been having as far as I can tell but there could be more.
If someone didn't know about Attributes so am I, here is a quick link: https://www.php.net/manual/en/language.attributes.overview.php
In addition to your fixes:
Line 162:
$key,NULL,PREG_SPLIT_NO_EMPTY|PREG_SPLIT_DELIM_CAPTURE);
replaced with:
$key,0,PREG_SPLIT_NO_EMPTY|PREG_SPLIT_DELIM_CAPTURE);
My changes where merged into this PR, which I think fixes most issues :) https://github.com/bcosca/fatfree-core/pull/333
everything fixed 🤞
PHP Fatal error: $GLOBALS can only be modified using the $GLOBALS[$name] = $value syntax in /fat-free/vendor/bcosca/fatfree-core/base.php on line 2533