5.6.4.0 and PHP 7.4 Warnings (continue)

Permalink
I have one legacy 5.6.4.0 site where the server was upgraded to PHP 7.4 (7.2 is no longer available there).

I know it's no longer supported, but I am seeing only 3 errors so far in the core:

PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in concrete/core/models/custom_style.php on line 75
PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in concrete/core/models/custom_style.php on line 82
PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in concrete/core/models/custom_style.php on line 93

Anyone know if those should be changed to break; or continue 2; ?

I know I could just try changing them myself, but I don't know how to test it. Unfortunately Xdebug is not available there.

I see it is only called in 3 places:

concrete/tools/edit_block_popup.php:
  $styleHeader = '#'.$csr->getCustomStyleRuleCSSID(1).' {'. $csr->getCustomStyleRuleText(). "}";  ?>
concrete/core/models/collection.php:
  $styleHeader .= '#'.$st->getCustomStyleRuleCSSID(1).' {'. $st->getCustomStyleRuleText(). "} \r\n";
concrete/core/controllers/blocks/core_stack_display.php:
  $styleHeader = '#'.$csr->getCustomStyleRuleCSSID(1).' {'. $csr->getCustomStyleRuleText(). "} \r\n";


Any hint(s) on an easy way to visually check if one or the other works properly?

Thanks!
- John

jasteele12
 
ConcreteOwl replied on at Permalink Reply
ConcreteOwl
Hi John
Here is the code I am using in the file 'concrete/core/models/custom_style.php' from line 45 to line 96, this is being used in several 5.6.4.0 sites running on PHP 7.4
public function getCustomStyleRuleText() {
      $stylesStr=''; 
      $tempStyles=array();
      $styles = $this->getCustomStyleRuleCustomStylesArray();
      foreach($styles as $key=>$val){
         if( !trim($key) ) continue;
         switch($key){                
            case 'border_position':   
            case 'border_color':   
            case 'border_style':   
               $tempStyles[$key]=$val;
               break;               
            case 'border_width':
            case 'padding_left':
            case 'padding_top':

PHP 7.4 appears quite happy with it as I see no errors.
jasteele12 replied on at Permalink Reply
jasteele12
Thank you, David.

Your code changes seem to be working great.

The only real problem I see with 7.4 are uncaught exceptions if I have a script with PHP syntax errors (and a few tweaks to some packages were needed).

Thanks again,

John