• Resolved kreestal

    (@kreestal)


    Hi!

    I’m setting the WP_DEBUG variable to true on my development environment.

    I noticed that WP YouTube Lyte creates a few warnings:

    Warning: Illegal string offset 'title' in /path/to/wp-content/plugins/wp-youtube-lyte/wp-youtube-lyte.php on line 311
    
    Notice: Uninitialized string offset: 0 in /path/to/wp-content/plugins/wp-youtube-lyte/wp-youtube-lyte.php on line 311
    
    Warning: Illegal string offset 'title' in /path/to/wp-content/plugins/wp-youtube-lyte/wp-youtube-lyte.php on line 311
    
    Notice: Uninitialized string offset: 0 in /path/to/wp-content/plugins/wp-youtube-lyte/wp-youtube-lyte.php on line 311
    
    Warning: Illegal string offset 'title' in /path/to/wp-content/plugins/wp-youtube-lyte/wp-youtube-lyte.php on line 311
    
    Notice: Uninitialized string offset: 0 in /path/to/wp-content/plugins/wp-youtube-lyte/wp-youtube-lyte.php on line 311

    Line 311 is the following:

    $lytetemplate = $wrapper."<div class=\"lyMe".$audioClass.$hidefClass.$plClass.$qsaClass."\" id=\"WYL_".$vid."\"><div id=\"lyte_".$vid."\" data-src=\"".$thumbUrl."\" class=\"pL\"><div class=\"tC".$titleClass."\"><div class=\"tT\">".$yt_resp_array["title"]."</div></div><div class=\"play\"></div><div class=\"ctrl\"><div class=\"Lctrl\"></div><div class=\"Rctrl\"></div></div></div>".$noscript."</div></div>".$lytelinks_txt;

    I temporarily fixed it by replacing line 311 with these:

    $lytetemplate = $wrapper."<div class=\"lyMe".$audioClass.$hidefClass.$plClass.$qsaClass."\" id=\"WYL_".$vid."\"><div id=\"lyte_".$vid."\" data-src=\"".$thumbUrl."\" class=\"pL\">";
    
    if (isset($yt_resp_array) && !empty($yt_resp_array) && $yt_resp_array["title"] != NULL) :
    				$lytetemplate .= "<div class=\"tC".$titleClass."\"><div class=\"tT\">".$yt_resp_array['title']."</div></div>";
    				endif;
    
    $lytetemplate .= "<div class=\"play\"></div><div class=\"ctrl\"><div class=\"Lctrl\"></div><div class=\"Rctrl\"></div></div></div>".$noscript."</div></div>".$lytelinks_txt;

    And yes, I know this will be overwritten with the next plugin’s update, but let’s hope it will be fixed by then 🙂

    https://ww.wp.xz.cn/plugins/wp-youtube-lyte/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Frank Goossens

    (@futtta)

    Well, … you can always fork Lyte on GitHub, fix & issue a pull request 🙂

    frank

    Thread Starter kreestal

    (@kreestal)

    Plugin Author Frank Goossens

    (@futtta)

    I pushed out a new version which includes (a slightly tweaked version of) your fixes as well kReEsTaL 🙂

    frank

    I never had any trouble before, but the new update (v1.6.5) really doesn’t work for me. On the production site (PHP v5.5.13), all of the videos went invisible. In my PHP error log I find

    PHP Warning: Invalid argument supplied for foreach() in /home/elsiecar/public_html/wp-content/plugins/wp-youtube-lyte/wp-youtube-lyte.php on line 58

    On the development site, using PHP v5.5.12, with WP_DEBUG set to true, for every video, instead of a video, I receive the error messages

    NOTICE: UNDEFINED VARIABLE: LYTETEMPLATE IN C:\WAMP\WWW\LOCALELSIE\WP-CONTENT\PLUGINS\WP-YOUTUBE-LYTE\WP-YOUTUBE-LYTE.PHP ON LINE 322

    and

    NOTICE: UNDEFINED VARIABLE: TEMPLATETYPE IN C:\WAMP\WWW\LOCALELSIE\WP-CONTENT\PLUGINS\WP-YOUTUBE-LYTE\WP-YOUTUBE-LYTE.PHP ON LINE 322

    It’s the same for PHP v7.0.2, actually.

    I’ve switch back to v.1.6.4 of the plugin. Let me know if you would like me to test anything.

    Alex
    http://www.elsiecarlisle.com

    P.S. I know those are warnings and notices and not fatal errors, but I didn’t receive them before, and I don’t get any videos displayed now, so something is wrong. 🙂

    Plugin Author Frank Goossens

    (@futtta)

    can’t find similar errors in any of my PROD or TEST-instances Alex, all works as it should.

    Can you on your local dev environment go back to 1.6.5 and:
    * make (and upload) a screenshot of the page with broken lyte’s so I can see (or not see) what is happening?
    * look at your browser console for JS errors that might cause the vids to disappear?
    * check if you have any customizations (using AO’s API or other) that might be impacting things (I see the vids look different from stock lyte’s to start with, so …)

    frank

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘WP_DEBUG and plugin's PHP errors’ is closed to new replies.