Version 9 + PHP 8.2 - HOTFIX
Permalink Browser Info Environment
Needed to update to Version 9 for a client and made some hotfixes
This is not completely tested and I guess there are more things to be fixed.
But it works for my client for now.
Maybe that helps others
First we need to make some functions in the fonts controller static
packages/fundamental/controllers/fonts.php [lines 46,83,102,139]
- public function download() {
+ public abstract function download() {
- private function buildFontList($fontFamilyIndex, $fontVariantIndex) {
+ private static function buildFontList($fontFamilyIndex, $fontVariantIndex) {
- private function buildCSS($element, $fontFamilyIndex, $fontVariantIndex) {
+ private static function buildCSS($element, $fontFamilyIndex, $fontVariantIndex) {
- private function toArray($data) {
+ private static function toArray($data) {
Then what needs to be done is that with PHP 8 there is a warning for undefined variables
after the variable add the following: "$var_name" ==> "$var_name ?? ''"
packages/fundamental/blocks/fundamental_section/view.php [lines 3,4,5,17,21,24,28,30]
packages/fundamental/blocks/fundamental_section/controller.php [line 182]
packages/fundamental/themes/fundamental/elements/head.php [line 101]
here it was easier to initialized the property or variable
packages/fundamental/blocks/autonav/templates/top_bar/view.php [line 140]
+ $navItem->icon = '';
packages/fundamental/themes/fundamental/blank.php [line 7]
packages/fundamental/themes/fundamental/default.php [line 7]
packages/fundamental/themes/fundamental/full_width.php [line 7]
packages/fundamental/themes/fundamental/left_sidebar.php [line 7]
packages/fundamental/themes/fundamental/right_sidebar.php [line 7]
+ $stickyFooter = '';
This is not completely tested and I guess there are more things to be fixed.
But it works for my client for now.
Maybe that helps others
First we need to make some functions in the fonts controller static
packages/fundamental/controllers/fonts.php [lines 46,83,102,139]
- public function download() {
+ public abstract function download() {
- private function buildFontList($fontFamilyIndex, $fontVariantIndex) {
+ private static function buildFontList($fontFamilyIndex, $fontVariantIndex) {
- private function buildCSS($element, $fontFamilyIndex, $fontVariantIndex) {
+ private static function buildCSS($element, $fontFamilyIndex, $fontVariantIndex) {
- private function toArray($data) {
+ private static function toArray($data) {
Then what needs to be done is that with PHP 8 there is a warning for undefined variables
after the variable add the following: "$var_name" ==> "$var_name ?? ''"
packages/fundamental/blocks/fundamental_section/view.php [lines 3,4,5,17,21,24,28,30]
packages/fundamental/blocks/fundamental_section/controller.php [line 182]
packages/fundamental/themes/fundamental/elements/head.php [line 101]
here it was easier to initialized the property or variable
packages/fundamental/blocks/autonav/templates/top_bar/view.php [line 140]
+ $navItem->icon = '';
packages/fundamental/themes/fundamental/blank.php [line 7]
packages/fundamental/themes/fundamental/default.php [line 7]
packages/fundamental/themes/fundamental/full_width.php [line 7]
packages/fundamental/themes/fundamental/left_sidebar.php [line 7]
packages/fundamental/themes/fundamental/right_sidebar.php [line 7]
+ $stickyFooter = '';
Type: | Ticket |
---|---|
Status: | In Progress |
FYI I am referring to
Then what needs to be done is that with PHP 8 there is a warning for undefined variables
after the variable add the following: "$var_name" ==> "$var_name ?? ''"
packages/fundamental/blocks/fundamental_section/view.php [lines 3,4,5,17,21,24,28,30]
packages/fundamental/blocks/fundamental_section/controller.php [line 182]
packages/fundamental/themes/fundamental/elements/head.php [line 101]
And the example was from
packages/fundamental/themes/fundamental/elements/head.php [line 101]
Then what needs to be done is that with PHP 8 there is a warning for undefined variables
after the variable add the following: "$var_name" ==> "$var_name ?? ''"
packages/fundamental/blocks/fundamental_section/view.php [lines 3,4,5,17,21,24,28,30]
packages/fundamental/blocks/fundamental_section/controller.php [line 182]
packages/fundamental/themes/fundamental/elements/head.php [line 101]
And the example was from
packages/fundamental/themes/fundamental/elements/head.php [line 101]
Thanks so much for your help. However, I suspect I have 2 problems still.
First is syntax.
For the one section you say - after the variable add the following: "$var_name" ==> "$var_name ?? ''"
Syntax wise I have something off
[code]
one of the current lines is
echo '<div class="'.$c->getPageWrapperClass().$classes.'">';
With the change I wasn't sure of what to make here as litteraly pasting it after is a syntax error e.g.,
echo '<div class="'.$c->getPageWrapperClass().$classes $classes ==> $classes ?? ''.'">';
</code>
When I made the change you suggested as well I am getting
Undefined variable $generalBoxed from a couple lines above it- but I suspect that might be due to all the lines of this code change being wrong (for the same reasons as above).
Thanks for your help again!
First is syntax.
For the one section you say - after the variable add the following: "$var_name" ==> "$var_name ?? ''"
Syntax wise I have something off
[code]
one of the current lines is
echo '<div class="'.$c->getPageWrapperClass().$classes.'">';
With the change I wasn't sure of what to make here as litteraly pasting it after is a syntax error e.g.,
echo '<div class="'.$c->getPageWrapperClass().$classes $classes ==> $classes ?? ''.'">';
</code>
When I made the change you suggested as well I am getting
Undefined variable $generalBoxed from a couple lines above it- but I suspect that might be due to all the lines of this code change being wrong (for the same reasons as above).
Thanks for your help again!
The ==> is not supposed to be part of the code. It is to signify the transition from the code example on the left to the code example on the right.
Your example would become
Basically you have to this for every error message of this kind. So when you get you gotta find that in the corresponding file and replace it with
Your example would become
echo '<div class="'.$c->getPageWrapperClass().$classes ?? ''.'">';
Basically you have to this for every error message of this kind. So when you get
undefined variable $generalBoxed
$generalBoxed ?? ''
Thanks a bunch that makes sense now. Making progress.
Ran into another one like this though and wondering if you could assist again.
Whoops \ Exception \ ErrorException (E_WARNING)
Undefined variable $titleColor
Stack frames (36)
35
Whoops\Exception\ErrorException
/home/clasc/public_html/newsite/packages/fundamental/blocks/fundamental_call_to_action/controller.php80
lines are
<code>
if($this->callToActionTitle) {
$title = '<'.$this->callToActionTitleSize.$titleColor.'>'.$this->callToActionTitle.'</'.$this->callToActionTitleSize.'>';
$this->set('title', $title);
}
</code>
I made these changes but it still gets the same warning
<code>
if($this->callToActionTitle) {
$title = '<'.$this->callToActionTitleSize.$titleColor ?? ''.'>'.$this->callToActionTitle.'</'.$this->callToActionTitleSize.'>';
$this->set('title', $title);
}
</code>
Am wondering if I have to escape out the quotes or...
Ran into another one like this though and wondering if you could assist again.
Whoops \ Exception \ ErrorException (E_WARNING)
Undefined variable $titleColor
Stack frames (36)
35
Whoops\Exception\ErrorException
/home/clasc/public_html/newsite/packages/fundamental/blocks/fundamental_call_to_action/controller.php80
lines are
<code>
if($this->callToActionTitle) {
$title = '<'.$this->callToActionTitleSize.$titleColor.'>'.$this->callToActionTitle.'</'.$this->callToActionTitleSize.'>';
$this->set('title', $title);
}
</code>
I made these changes but it still gets the same warning
<code>
if($this->callToActionTitle) {
$title = '<'.$this->callToActionTitleSize.$titleColor ?? ''.'>'.$this->callToActionTitle.'</'.$this->callToActionTitleSize.'>';
$this->set('title', $title);
}
</code>
Am wondering if I have to escape out the quotes or...
looks fine to me. check if there is another occurence. check the line number of the error message.
I have a question on the 2nd set of changes.
for Example I was looking here: (lines 99-102
Where exactly do I add your code? When I added it after the variable I get a syntax error, so I must be missing something.