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 = '';

Type: Ticket
Status: In Progress
kouba
View Replies:
plschneide replied on at Permalink Reply
plschneide
Thanks for the help on this.

I have a question on the 2nd set of changes.

for Example I was looking here: (lines 99-102

$classArray = array($generalBoxed, $stickyFooter);
      $classes = implode(" ", $classArray);         
      echo '<div class="'.$c->getPageWrapperClass().$classes.'">';               
      ?>


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.
plschneide replied on at Permalink Reply
plschneide
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]
kouba replied on at Permalink Reply
kouba
In your example you probably get an error regarding $stickyFooter not being defined

$classArray = array($generalBoxed, $stickyFooter);
will then become
$classArray = array($generalBoxed, $stickyFooter ?? '');
plschneide replied on at Permalink Reply
plschneide
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!
kouba replied on at Permalink Reply
kouba
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
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
you gotta find that in the corresponding file and replace it with
$generalBoxed ?? ''
plschneide replied on at Permalink Reply
plschneide
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...
kouba replied on at Permalink Reply
kouba
looks fine to me. check if there is another occurence. check the line number of the error message.

concrete5 Environment Information

# Concrete Version
Core Version - 9.2.2
Version Installed - 9.2.2
Database Version - 20231002142400

# Hostname
32e752a3a554

# Environment
production

# Database Information
Version: 8.0.35-0ubuntu0.22.04.1
SQL Mode: ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION

# Concrete Packages
Consent Management & Privacy Tool (1.0.1), Cookies Notice (1.3.2), Easy Fancybox 2 (0.18), Fundamental (4.0.8), PDF Viewer (1.0.1), Pure Accordion (0.9.2), Styled Maps (1.2.3)

# Concrete Overrides
/var/www/xxx/www/html/application/blocks/tag_manager/view.php, /var/www/xxx/www/html/application/blocks/tag_manager/controller.php, /var/www/xxx/www/html/application/blocks/tag_manager/edit.php, /var/www/xxx/www/html/application/blocks/tag_manager/form_add_edit.php, /var/www/xxx/www/html/application/blocks/tag_manager/db.xml, /var/www/xxx/www/html/application/blocks/tag_manager/icon.png, /var/www/xxx/www/html/application/blocks/tag_manager/add.php, /var/www/xxx/www/html/application/blocks/tag_manager, /var/www/xxx/www/html/application/blocks/file/templates/blank/view.php, /var/www/xxx/www/html/application/blocks/file/templates/blank, /var/www/xxx/www/html/application/blocks/file/templates/fancybox/view.php, /var/www/xxx/www/html/application/blocks/file/templates/fancybox/pdf_viewer.min.js, /var/www/xxx/www/html/application/blocks/file/templates/fancybox/pdf.worker.min.js, /var/www/xxx/www/html/application/blocks/file/templates/fancybox/view.js, /var/www/xxx/www/html/application/blocks/file/templates/fancybox/view.css, /var/www/xxx/www/html/application/blocks/file/templates/fancybox, /var/www/xxx/www/html/application/blocks/file/templates, /var/www/xxx/www/html/application/blocks/file, /var/www/xxx/www/html/application/blocks/fancybox2/templates/first/view.php, /var/www/xxx/www/html/application/blocks/fancybox2/templates/first, /var/www/xxx/www/html/application/blocks/fancybox2/templates, /var/www/xxx/www/html/application/blocks/fancybox2, /var/www/xxx/www/html/application/blocks/youtube/templates/2-click/view.php, /var/www/xxx/www/html/application/blocks/youtube/templates/2-click/view.js, /var/www/xxx/www/html/application/blocks/youtube/templates/2-click/view.css, /var/www/xxx/www/html/application/blocks/youtube/templates/2-click, /var/www/xxx/www/html/application/blocks/youtube/templates, /var/www/xxx/www/html/application/blocks/youtube

# Concrete Cache Settings
Block Cache - Off
Overrides Cache - On
Full Page Caching - Off
Full Page Cache Lifetime - Every 6 hours (default setting).

# Server Software
Apache

# Server API
fpm-fcgi

# PHP Version
8.2.8

# PHP Extensions
bcmath, cgi-fcgi, Core, ctype, curl, date, dom, exif, fileinfo, filter, ftp, gd, hash, iconv, imagick, imap, intl, json, libxml, mbstring, mysqli, mysqlnd, openssl, pcre, PDO, pdo_mysql, pdo_sqlite, Phar, posix, random, readline, Reflection, session, SimpleXML, sodium, SPL, sqlite3, standard, tokenizer, xml, xmlreader, xmlwriter, zip, zlib

# PHP Settings
max_execution_time - 360
max_file_uploads - 20
max_input_nesting_level - 64
max_input_time - 60
max_input_vars - 1000
max_multipart_body_parts - -1
memory_limit - 512M
post_max_size - 300M
upload_max_filesize - 300M
zend.exception_string_param_max_len - 0
mbstring.regex_retry_limit - 1000000
mbstring.regex_stack_limit - 100000
mysqli.max_links - Unlimited
mysqli.max_persistent - Unlimited
pcre.backtrack_limit - 1000000
pcre.recursion_limit - 100000
session.cache_limiter - <i>no value</i>
session.gc_maxlifetime - 7200
unserialize_max_depth - 4096

Browser User-Agent String

Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/119.0

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You may not request a refund that is not currently owned by you.