Jump to content

Problem with PHP version 8.0


Recommended Posts

4 minutes ago, Daniel F said:

1. Check your PHP error log.
2. Take a look at the blocks in the ACP to see if any contains any customized templates. If yes, review them and make sure that the used code works with PHP 8 / PHP 8.1

In the "Systems Log" I get thousands of this:

 

Could contain: Text, Page

 

And if I open one I get this:

 

Could contain: Text, Page, Document, Word, Flyer, Brochure, Poster, Advertisement, Paper

 

5 minutes ago, Daniel F said:

any customized templates.

Well yes, I have cusotmized templates. But how can I find out what is not working? And why PHP 8.0 give all these problems?

Link to comment
Share on other sites

6 minutes ago, Marc Stridgen said:

This is because there is PHP code which is not comparible with PHP 8. With the one above, have you checked that test page? It looks like you have a custom block on there which is causing you issues

I can not even check right now, because I can not open the page at all and I don't rememember exactly which blocks I was using there. So I should get back to PHP 7.4 to access the page.

 

But even when I will be able to see which blocks I have there, how can I find out which is the block causing the problem?


Thanks!

Link to comment
Share on other sites

7 minutes ago, Daniel F said:

The block with ID 165 seems to be the evil one.

Based on the error message which mentions usort, I'm betting my money on some weird usort usage, PHP8 got here much more strict, pls see https://wiki.php.net/rfc/stable_sorting

You are right, that is the "evil" one. This is a custom block made by one of the IPS users. By the way now he is in holidays 😄 Here is the content, can you please tell me if something needs to be changed to fix this?

Thanks!

 

Quote

{{$categoryId = 585;}}


{{$cats = iterator_to_array( \IPS\Db::i()->select('*', 'cms_database_categories', array('category_parent_id=?', $categoryId ) ) );}}

{{foreach $cats as $idx => $cat}}

    {{try{}}
        {{$cats[ $idx ]['quota'] = \IPS\Db::i()->select( 'field_36','cms_custom_database_9', array('category_id=? AND record_approved=1', $cat['category_id'] ) )->first();}}
    {{} catch( \Exception $ex ){}}
        {{$cats[ $idx ]['quota'] = 0;}}
    {{ } }}

{{endforeach}}

{{usort( $cats, function ($a, $b ){ return ($b['quota'] - $a['quota']); } );}}
  <h3 style="font-family:Quicksand,sans-serif; font-size: 26px; padding-left: 30px" class='ipsWidget_title ipsType_reset'>Summer Olympic Games Paris 2024 Qualified Athletes by Nation</h3>

<div class='ipsCarousel ipsClearfix quoteBlock' data-ipsCarousel data-ipsCarousel-slideshow>
                <div class='ipsCarousel_inner'>
                    <div class='cDownloadsCarousel ipsClearfix ipsGrid' data-role="carouselItems" data-ipsgrid data-ipsgrid-equalheights="row">
                        {{foreach $cats as $catArray}}
                        {{$cat = \IPS\cms\Categories9::load( $catArray['category_id'] );}}
                        <div class='ipsCarousel_item' data-ipsLazyLoad>
                            <div class="SG_category_item ipsAreaBackground_reset ipsBox ipsGrid_span2">
                                <center>                
                                  {{if $cat->pcimage}}
                                  <a href="{{if $cat->pcl_url}}{$cat->pcl_url}{{else}}{$cat->url()}{{endif}}">
                                  <div class="SG_cat_image" style="background-image:url('{file='$cat->pcimage'}');"></div>
                                  </a>
                                  {{endif}}

                                    <div class="ipsDataItem_main ipsPos_middle">
                                      <h4 class="ipsDataItem_title ipsType_large catLarge">
                                        <a href="{{if $cat->pcl_url}}{$cat->pcl_url}{{else}}{$cat->url()}{{endif}}">{$cat->_title}</a>
                                      </h4>
                                      
                                   </div>

                                   {{if isset( $catArray['quota'] )}}
                                          <div class='ipsMargin_top:half ipsType_reset ipsType_light ipsType_large'>
                                              <strong>Total Athletes:</strong> {$catArray['quota']}
                                          </div>
                                      {{endif}}
                                </center>
                            </div>
                        </div>
                        {{endforeach}}
                    </div>
                </div>
                <span class='ipsCarousel_shadow ipsCarousel_shadowLeft'></span>
                <span class='ipsCarousel_shadow ipsCarousel_shadowRight'></span>
                <a href='#' class='ipsCarousel_nav ipsHide' data-action='prev'><i class='fa fa-chevron-left'></i></a>
                <a href='#' class='ipsCarousel_nav ipsHide' data-action='next'><i class='fa fa-chevron-right'></i></a>
            </div>

 

 

Link to comment
Share on other sites

22 hours ago, Daniel F said:

The block with ID 165 seems to be the evil one.

Based on the error message which mentions usort, I'm betting my money on some weird usort usage, PHP8 got here much more strict, pls see https://wiki.php.net/rfc/stable_sorting

Hello @Daniel F, I have copied in the post above the code for that block. I have no clue how what to edit there and I would not want to damage the code. Maybe it is just a matter of changing something in the code and the problem would be fixed?

Thank you!

Link to comment
Share on other sites

31 minutes ago, Balto said:

Hello @Daniel F, I have copied in the post above the code for that block. I have no clue how what to edit there and I would not want to damage the code. Maybe it is just a matter of changing something in the code and the problem would be fixed?

Thank you!

You would really need to contact the author of that code for support. We would not generally issue support for custom items

Link to comment
Share on other sites

On 8/10/2022 at 3:06 PM, Marc Stridgen said:

You would really need to contact the author of that code for support. We would not generally issue support for custom items

Thanks! @Kirill Gromov is the author. He is in holidays now, I hope he will be able to fix this when he will be back. 🤒 @Kirill Gromov Please look at @Daniel F link, maybe this helps you to fix the block. Thanks!

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...