title: Magento 2: syntax error, unexpected '"', expecting '-' or identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in phtml file
body: <p>Could someone please tell me why am I getting the following error?</p>
  <p>Parse error: syntax error, unexpected '&quot;', expecting '-' or identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in /app/vendor/magenest/module-instagram-shop/view/frontend/templates/slider/slider.phtml on line 161 ?</p>
  <p>The file is unmodified.
  PHP version: PHP 7.2.30 (cli) (built: Apr 23 2020 18:36:52) ( NTS )
  short_open_tag = On.
  PHPStorm's code inspector is not throwing any issue.</p>
  <p>I think it could be related to my environment settings. If i remove everything from the file (0 length), the page containing this widget renders properly. The module is properly set up in the backend. I am stumped. Thank you very much!</p>
  <p>The line is</p>
  <pre><code>if ($widgetOptions[&quot;lazy_load&quot;]) {
  </code></pre>
  <p>Full code:</p>
  <pre><code>&lt;?php
  if ($sliderBlock = $block-&gt;getSliderBlock()) {
      $widgetOptions = $sliderBlock-&gt;getWidgetOptions();
      $photos = $sliderBlock-&gt;getPhotos();
      $slickConfig   = $sliderBlock-&gt;getData();
      $totalItems    = $photos-&gt;getSize();
      $itemsPerSlide = $sliderBlock-&gt;getItemsPerSlide();
  
      $prefixElementClass = uniqid();
  
      $storyBlock = $sliderBlock-&gt;getStoryBlock(); ?&gt;
      &lt;!--    allow show widget if photos is not null --&gt;
      &lt;?php if ($photos-&gt;getSize() != 0 || $storyBlock != '') { ?&gt;
          &lt;div class=&quot;photo-slider-wrapper&quot;
               id=&quot;slider-&lt;?= $block-&gt;escapeHtmlAttr($prefixElementClass) ?&gt;&quot;
               style=&quot;display: none;&quot;&gt;
              &lt;div class=&quot;slider&quot;&gt;
                  &lt;?= $block-&gt;getSharedPopupHtml($sliderBlock-&gt;getPhotoSource()) ?&gt;
              &lt;/div&gt;
              &lt;div class=&quot;block-title&quot;&gt;
                  &lt;h2 class=&quot;title&quot;&gt;&lt;?= $block-&gt;escapeHtml($sliderBlock-&gt;getTitle()) ?&gt;&lt;/h2&gt;
              &lt;/div&gt;
              &lt;?= $storyBlock ?&gt;
              &lt;div class=&quot;block-content&quot;&gt;
                  &lt;div class=&quot;block block-photo-slider slider-list container&quot;&gt;
                      &lt;?php if ($totalItems) { ?&gt;
                          &lt;div class=&quot;photos-wrapper&quot;&gt;
                              &lt;ul class=&quot;photos-slick slick-&lt;?= $block-&gt;escapeHtmlAttr($prefixElementClass) ?&gt;&quot;
                                  &lt;?php
                                  if ($widgetOptions[&quot;rtl&quot;] == &quot;true&quot;) {
                                      echo (&quot;dir='rtl'&quot;);
                                  }
                                  ?&gt;&gt;
                                  &lt;?php
                                  $count = 0;
                                  /** @var \Magenest\InstagramShop\Model\Photo $photo */
                                  foreach ($photos as $photo) {
                                      if (!$sliderBlock-&gt;isDefaultTemplate() &amp;&amp; $count % $itemsPerSlide == 0) {
                                          echo $block-&gt;escapeHtml(
                                              '&lt;li class=&quot;slide-item&quot;&gt;&lt;ul class=&quot;'
                                              . $block-&gt;getItemsPerSlideClass()
                                              . '-photo&quot;&gt;'
                                          );
                                      } ?&gt;
                                      &lt;li class=&quot;&lt;?= $block-&gt;escapeHtmlAttr($photo-&gt;getPhotoId()) ?&gt;
                                                 instagram-photo
                                                 &lt;?php if ($sliderBlock-&gt;isDefaultTemplate()) {
                                                      echo 'default';
                                                 } ?&gt;&quot;
                                          id=&quot;&lt;?= $block-&gt;escapeHtmlAttr($photo-&gt;getPhotoId()) ?&gt;&quot;&gt;
                                          &lt;a href=&quot;&lt;?= $block-&gt;escapeUrl($photo-&gt;getUrl()) ?&gt;&quot;
                                             &lt;?php if (!$sliderBlock-&gt;isDefaultTemplate()) {
                                                  echo 'class=&quot;instagram-link-photo&quot;';
                                             } ?&gt;&gt;
                                              &lt;?php if ($widgetOptions[&quot;lazy_load&quot;]): ?&gt;
                                                  &lt;img data-lazy=&quot;&lt;?= $sliderBlock-&gt;getPhotoSourceOptimize($photo) ?&gt;&quot;
                                                       alt=&quot;&quot;/&gt;
                                              &lt;?php else: ?&gt;
                                                  &lt;img src=&quot;&lt;?= $sliderBlock-&gt;getPhotoSourceOptimize($photo) ?&gt;&quot; alt=&quot;&quot;/&gt;
                                              &lt;?php endif; ?&gt;
                                              &lt;?php if ($photo-&gt;getMediaType() == 'VIDEO') { ?&gt;
                                                  &lt;i class=&quot;fas fa-video&quot;
                                                     style=&quot;
                                                          float: right;
                                                          margin: 5px;
                                                          font-size: 20px;
                                                          position: absolute;
                                                          right: 0;
                                                          top: 0&quot;&gt;
                                                  &lt;/i&gt;
                                              &lt;?php } ?&gt;
                                              &lt;div class=&quot;overlay&quot;&gt;&lt;/div&gt;
                                              &lt;div class=&quot;text&quot;&gt;
                                                  &lt;span class=&quot;widget-icon&quot;&gt;
                                                      &lt;i class=&quot;far fa-heart&quot;&gt;
                                                          &lt;?= $block-&gt;escapeHtml($photo-&gt;getLikes()) ?&gt;
                                                      &lt;/i&gt;
                                                      &lt;i class=&quot;far fa-comment&quot;&gt;
                                                          &lt;?= $block-&gt;escapeHtml($photo-&gt;getComments()) ?&gt;
                                                      &lt;/i&gt;
                                                  &lt;/span&gt;
                                                  &lt;p class=&quot;photo-caption&quot;&gt;
                                                      &lt;?= $block-&gt;getPhotoCaption($photo-&gt;getCaption()) ?&gt;
                                                  &lt;/p&gt;
                                              &lt;/div&gt;
                                          &lt;/a&gt;
                                          &lt;?=  $sliderBlock-&gt;getLinkedProductsHtml($photo) ?&gt;
                                          &lt;?= $sliderBlock-&gt;getHotspotHtml($photo) ?&gt;
                                          &lt;?php if ($sliderBlock-&gt;canShowVideo()) {
                                              echo $sliderBlock-&gt;getVideoHtml($photo);
                                          } ?&gt;
                                      &lt;/li&gt;
                                      &lt;?php
                                      $count++;
                                      if (!$sliderBlock-&gt;isDefaultTemplate()
                                          &amp;&amp; ($count % $itemsPerSlide == 0 || $count == $totalItems)) {
                                          echo ('&lt;/ul&gt;&lt;/li&gt;');
                                      }
                                  } ?&gt;
                              &lt;/ul&gt;
                          &lt;/div&gt;
                          &lt;?php if ($sliderBlock-&gt;displayGalleryButton()): ?&gt;
                              &lt;div class=&quot;gallery-btn-block&quot;&gt;
                                  &lt;a href=&quot;&lt;?= $block-&gt;escapeUrl($sliderBlock-&gt;getUrl('instagram/gallery/')) ?&gt;&quot;
                                     style=&quot;&lt;?= $sliderBlock-&gt;getViewFullGalleryCss() ?&gt;&quot;
                                     class=&quot;instagram-button&quot;&gt;
                                      &lt;?= $block-&gt;escapeHtml($sliderBlock-&gt;getViewFullGalleryTitle()) ?&gt;
                                  &lt;/a&gt;
                              &lt;/div&gt;
                          &lt;?php endif; ?&gt;
                      &lt;?php } ?&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;?php } ?&gt;
  
      &lt;?php if ($photos-&gt;getSize()):
          $scriptString = &lt;&lt;&lt;script
              require([
                  'jquery',
                  'photoModel',
                  'slick'
              ], function ($, photoModel) {
                  let item_number = {$block-&gt;escapeHtml($widgetOptions[&quot;items_number_desktop&quot;])},
                      photos      = {$sliderBlock-&gt;getPhotosData($photos)},
                      photoSize   = {$block-&gt;escapeHtml($totalItems)};
                  $('#slider-{$block-&gt;escapeHtml($prefixElementClass)}').on('init', function () {
                      $(this).attr('style', 'display: block;');
                  });
                  $('.photos-slick.slick-{$block-&gt;escapeHtml($prefixElementClass)}')
                      .on('afterChange', function (event, slick, currentSlide) {
                          //currentSlide is undefined on init -- set it to 0 in this case (currentSlide is 0 based)
                          let i = (currentSlide ? currentSlide : 0) + 1;
                          // no dots -&gt; no slides
                          if (slick.\$dots) {
                              // use dots to get some count information
                                  dotsLength = (slick.\$dots[0].children.length);
                              if (i == dotsLength) {
                                  $(this).slick('slickGoTo', 0, true);
                              }
                          }
                          if (i &lt;= photoSize) {
                              let iterator = item_number + 20, photo = [];
                              for (var j = 0; j &lt; iterator; j++) {
                                  if(typeof photos[i+item_number] != 'undefined') {
                                      photo.push(photos[i+item_number]);
                                      i++;
                                  }
                              }
                              photoModel.setPhotos(photo);
                          }
                      });
  
                  $('.photos-slick.slick-{$block-&gt;escapeHtml($prefixElementClass)}').slick({
                      slidesToShow: {$widgetOptions[&quot;items_number_desktop&quot;]},
                      slidesToScroll: {$widgetOptions[&quot;slides_to_scroll&quot;]},
                      infinite: false,
                      dots: {$block-&gt;escapeHtml($widgetOptions[&quot;animation_dots&quot;])},
                      arrows: {$block-&gt;escapeHtml($widgetOptions[&quot;animation_arrows&quot;])},
          script;
          if ($widgetOptions[&quot;lazy_load&quot;]) {
              $scriptString .= &lt;&lt;&lt;script
                      lazyLoad: 'ondemand',
              script;
          }
          $scriptString .= &lt;&lt;&lt;script
                      autoplay: {$block-&gt;escapeHtml($widgetOptions[&quot;autoplay&quot;])},
                      autoplaySpeed: {$block-&gt;escapeHtml($widgetOptions[&quot;autoplaySpeed&quot;])},
                      rtl: {$block-&gt;escapeHtml($widgetOptions[&quot;rtl&quot;])},
                      responsive: [
                          {
                              breakpoint: 1023,
                              settings: {
                                  slidesToShow: {$widgetOptions[&quot;items_number_tablet&quot;]},
                              }
                          },
                          {
                              breakpoint: 640,
                              settings: {
                                  slidesToShow: {$widgetOptions[&quot;items_number_mobile&quot;]},
                              }
                          }
                      ]
                  }).slick('setPosition');
              });
              require(['mage/url'], function (urlBuilder) {
                  return urlBuilder.setBaseUrl('{$block-&gt;escapeUrl($sliderBlock-&gt;getBaseUrl())}');
              });
          script;
          ?&gt;
          &lt;?= isset($secureRenderer)
          ? $secureRenderer-&gt;renderTag('script', [], $scriptString, false)
          : &quot;&lt;script&gt;$scriptString&lt;/script&gt;&quot; ?&gt;
  
          &lt;?php
          $canShowVideo = $sliderBlock-&gt;canShowVideo() ? 'true' : 'false';
          $scriptString = &lt;&lt;&lt;script
          {
              &quot;#slider-{$block-&gt;escapeHtml($prefixElementClass)}&quot;: {
                  &quot;instagramPopup&quot;: {
                      &quot;photos&quot; : {$sliderBlock-&gt;getPhotosData($photos, true)},
                      &quot;canShowVideo&quot;: {$canShowVideo},
                      &quot;prefixContainer&quot;:&quot;.slider&quot;,
                      &quot;prefixElement&quot;:&quot;ul.slick-{$block-&gt;escapeHtml($prefixElementClass)} li&quot;,
                      &quot;photoType&quot;: {$block-&gt;escapeHtml($sliderBlock-&gt;getPhotoType())},
                      &quot;prefixElementClass&quot;: &quot;#slider-{$block-&gt;escapeHtml($prefixElementClass)}&quot;,
                      &quot;baseMediaUrl&quot;: &quot;{$block-&gt;escapeUrl($block-&gt;getBaseMediaUrl())}&quot;
                  }
              }
          }
          script;
          ?&gt;
          &lt;?= isset($secureRenderer)
          ? $secureRenderer-&gt;renderTag('script', ['type' =&gt; 'text/x-magento-init'], $scriptString, false)
          : &quot;&lt;script type='text/x-magento-init'&gt;$scriptString&lt;/script&gt;&quot; ?&gt;
      &lt;?php elseif ($storyBlock != ''):
          $scriptString = &lt;&lt;&lt;script
              require(['jquery'], function ($) {
                  $('#slider-{$block-&gt;escapeHtml($prefixElementClass)}').css('display', 'block');
              })
          script;
          ?&gt;
          &lt;?= isset($secureRenderer)
              ? $secureRenderer-&gt;renderTag('script', [], $scriptString, false)
              : &quot;&lt;script&gt;$scriptString&lt;/script&gt;&quot; ?&gt;
      &lt;?php endif; ?&gt;
      &lt;?php
  } ?&gt;
  
  </code></pre>