За последние 24 часа нас посетили 21933 программиста и 1101 робот. Сейчас ищут 723 программиста ...

Php неопределенное свойство

Тема в разделе "PHP для новичков", создана пользователем bostic, 6 апр 2020.

  1. bostic

    bostic Новичок

    С нами с:
    6 апр 2020
    Сообщения:
    6
    Симпатии:
    0
    Всем привет!Сервер,error log сыпет ошибками относительно компонента sppagebuilder,разработчик на вопросы не отвечает,так как с php на ВЫ ищу помощи здесь,как побороть эти ошибки?Буду признателен любой помощи,спасибо!
    Кусок лога,вернее два
    Код (Text):
    1. [error] 17916#17916: *12766 FastCGI sent in stderr: "PHP message: PHP Notice:  Undefined property: stdClass::$section_height_option in /home/xxxxx/web/mysite.com/public_html/components/com_sppagebuilder/layouts/row/css.php on line 32PHP
    2.  PHP Notice:  Uninitialized string offset: 11 in /home/xxxxx/web/mysite.com/public_html/components/com_sppagebuilder/helpers/css-parser.php on line 110PHP
    3.  
    4.  
    5. [error] 17916#17916: *12766 FastCGI sent in stderr: "Uninitialized string offset: 48 in /home/xxxxx/web/mysite.com/public_html/components/com_sppagebuilder/helpers/css-parser.php on line 110PHP
    6. PHP Notice:  Uninitialized string offset: 58 in /home/xxxxx/web/mysite.com/public_html/components/com_sppagebuilder/helpers/css-parser.php on line 110PHP
    Так же два фрагмента кода:1-css.php.
    Код (Text):
    1. $row_styles = '';
    2. $style ='';
    3. $style_sm ='';
    4. $style_xs ='';
    5.  
    6. if(isset($options->section_height)){
    7.     if(is_object($options->section_height)){
    8.         if(isset($options->section_height->md) && $options->section_height->md){
    9.             if($options->section_height_option=='height'){
    10.                 $style .= 'height:'.$options->section_height->md.'px;';
    11.             }
    12.         }
    13.            
    14.         if (isset($options->section_height->sm) && $options->section_height->sm){
    15.             if($options->section_height_option=='height'){
    16.                 $style_sm .= 'height:'.$options->section_height->sm.'px;';
    17.             }
    18.         }
    19.            
    20.         if (isset($options->section_height->xs) && $options->section_height->xs){
    21.             if($options->section_height_option=='height'){
    22.                 $style_xs .= 'height:'.$options->section_height->xs.'px;';
    23.             }
    24.         }
    25.     } else {
    26.         if ($options->section_height) {
    27.             if($options->section_height_option=='height'){
    28.                 $style .= 'height:'.$options->section_height.'px;';
    29.             }
    30.         }
    31.     }
    32. }
    2-css-parser.php
    Код (Text):
    1.  $css = preg_replace('/\/\*.*\*\//Us', '', $css);
    2.         while(preg_match('/^\s*(\@(media|import|local)([^\{\}]+)(\{)|([^\{\}]+)(\{)|([^\{\}]*)(\}))/Usi', $css, $match)) {
    3.           if(isset($match[8]) && ($match[8] == '}')) {
    4.             if($section !== false) {
    5.               $code = trim($match[7]);
    6.               $idx = 0;
    7.               $inQuote = false;
    8.               $property = false;
    9.               $codeLen = strlen($code);
    10.               $parenthesis = array();
    11.               while($idx < $codeLen) {
    12.  
    13.                 if($code == null){
    14.                     break;
    15.                 }
    16.                 $c = $code{$idx};
    17.                 $idx++;
    18.                 if($inQuote !== false) {
    19.                   if($inQuote === $c) {
    20.                     $inQuote = false;
    21.                   }
    22.                 } elseif(($inQuote === false) && ($c == '(')) {
    23.                   array_push($parenthesis, '(');
    24.                 } elseif(($inQuote === false) && ($c == ')')) {
    25.                   array_pop($parenthesis);
    26.                 } elseif(($c == '\'') || ($c == '"')) {
    27.                   $inQuote = $c;
    28.                 } elseif(($property === false) && ($c == ':')) {
    29.                   $property = trim(substr($code, 0, $idx - 1));
    30.                   if(preg_match('/^(.*)\[([0-9]*)\]$/Us', $property, $propMatch)) {
    31.                     $property = $propMatch[1].'['.static::$propCounter.']';
    32.                     static::$propCounter += 1;
    33.                   }
    34.                   $code = substr($code, $idx);
    35.                   $idx = 0;
    36.                 } elseif((count((array) $parenthesis) == 0) && ($c == ';')) {
    37.                   $value = trim(substr($code, 0, $idx - 1));
    38.                   $code = substr($code, $idx);
    39.                   $idx = 0;
    40.                   $this->AddProperty($currentMedia, $section, $property, $value);
    41.                   $property = false;
    42.                 }
     
  2. ADSoft

    ADSoft Старожил

    С нами с:
    12 мар 2007
    Сообщения:
    3.825
    Симпатии:
    738
    Адрес:
    Татарстан
    А вы лог внимательно посмотрели? Там говорится о css-parser.php, а вы какие то левые файлы предоставили

    Находите файл, находите строку 110 и ее внимательно изучаете, или выкладывание сюда кусок с 100 по 120 строку, указав какая же из строк 110...

    Мы же не телепаты
     
  3. bostic

    bostic Новичок

    С нами с:
    6 апр 2020
    Сообщения:
    6
    Симпатии:
    0
    Дык я и выложил css-parser.php,это второй фрагмент,в горячке не указал строку,сори.110 строка здесь начинается с 16 строки-
    Код (Text):
    1. $c = $code{$idx};
     
  4. ADSoft

    ADSoft Старожил

    С нами с:
    12 мар 2007
    Сообщения:
    3.825
    Симпатии:
    738
    Адрес:
    Татарстан
    скорее всего там скобки [] должны быть
    PHP:
    1. $c = $code[$idx];
     
  5. bostic

    bostic Новичок

    С нами с:
    6 апр 2020
    Сообщения:
    6
    Симпатии:
    0
    Заменил на скобки,к сожалению лог все тот же..
    Код (Text):
    1. 2020/04/06 21:40:53 [error] 25045#25045: *13255 FastCGI sent in stderr: "PHP message: PHP Notice:  Undefined property: stdClass::$section_height_option in /home/xxxxx/web/mysite.com/public_html/components/com_sppagebuilder/layouts/row/css.php on line 32PHP message
    2. 2020/04/06 21:40:54 [error] 25045#25045: *13255 FastCGI sent in stderr: "Uninitialized string offset: 48 in /home/xxxxx/web/mysite.com/public_html/components/com_sppagebuilder/helpers/css-parser.php on line 110PHP message: PHP Notice:  Uninitialized string offset:
     
  6. bostic

    bostic Новичок

    С нами с:
    6 апр 2020
    Сообщения:
    6
    Симпатии:
    0
    Предлагали заменить везде strlen на mb_strlen,так же не дало результата...
     
  7. Artur_hopf

    Artur_hopf Активный пользователь

    С нами с:
    7 май 2018
    Сообщения:
    2.266
    Симпатии:
    405
    @bostic скинь ссылку на эту приблуду
     
  8. bostic

    bostic Новичок

    С нами с:
    6 апр 2020
    Сообщения:
    6
    Симпатии:
    0
    Не совсем понял,на какую приблуду?https://www.joomshaper.com/page-builder
    --- Добавлено ---
    Ошибку в css-parser.php победили заменой
    Код (Text):
    1. $c = $code{$idx};
    на
    Код (Text):
    1. $c = isset($code{$idx}) ? $code{$idx} : '';
    Остается вопрос по css.php.,свежий лог
    Код (Text):
    1. 09:28:50 [error] 964#964: *414 FastCGI sent in stderr: "PHP message: PHP Notice:  Undefined property: stdClass::$section_height_option in /home/xxxxx/web/mysite.com/public_html/components/com_sppagebuilder/layouts/row/css.php on line 32PHP message: PHP Notice:  Undefined property: stdClass::$section_height_option in /home/xxxxx/web/mysite.com/public_html/components/com_sppagebuilder/layouts/row/css.php on line 32PHP message: PHP Warning:  "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /home/xxxxx/web/mysite.com/public_html/plugins/system/helixultimate/core/classes/Minifier.php on line 226" while reading response header from upstream, client: 54.37.73.108, server: mysite.com, request: "GET / HTTP/2.0", upstream: "fastcgi://unix:/run/php/php7.3-fpm-mysite.com.sock:", host: "mysite.com"
     
  9. bostic

    bostic Новичок

    С нами с:
    6 апр 2020
    Сообщения:
    6
    Симпатии:
    0
    Вопрос закрыт,всем спасибо за помощь !