• Resolved lllor

    (@lllor)


    Hello,
    I’m reporting the following issue:

    WP 4.9.1, fresh install, PHP 7.0.10
    Huge IT Lightbox installed and active. No other plugins – default settings

    enabled debug in wp-config:

    define(‘WP_DEBUG’, true);
    define(‘WP_DEBUG_LOG’, true);
    define( ‘WP_DEBUG_DISPLAY’, true );

    for every page in the debug.log file the following messages appear:

    [04-Dec-2017 11:57:29 UTC] PHP Notice: Undefined index: urls in ***\wp-content\plugins\lightbox\lightbox.php on line 209

    [04-Dec-2017 11:57:29 UTC] PHP Stack trace:

    [04-Dec-2017 11:57:29 UTC] PHP 1. {main}() ***\wp-admin\admin-ajax.php:0

    [04-Dec-2017 11:57:29 UTC] PHP 2. do_action() ***\wp-admin\admin-ajax.php:97

    [04-Dec-2017 11:57:29 UTC] PHP 3. WP_Hook->do_action() ***\wp-includes\plugin.php:453

    [04-Dec-2017 11:57:29 UTC] PHP 4. WP_Hook->apply_filters() ***\wp-includes\class-wp-hook.php:310

    [04-Dec-2017 11:57:29 UTC] PHP 5. get_images_url() ***\wp-includes\class-wp-hook.php:286

    [04-Dec-2017 11:57:29 UTC] PHP Warning: Invalid argument supplied for foreach() in ***\wp-content\plugins\lightbox\lightbox.php on line 211

    [04-Dec-2017 11:57:29 UTC] PHP Stack trace:

    [04-Dec-2017 11:57:29 UTC] PHP 1. {main}() ***\wp-admin\admin-ajax.php:0

    [04-Dec-2017 11:57:29 UTC] PHP 2. do_action() ***\wp-admin\admin-ajax.php:97

    [04-Dec-2017 11:57:29 UTC] PHP 3. WP_Hook->do_action() ***\wp-includes\plugin.php:453

    [04-Dec-2017 11:57:29 UTC] PHP 4. WP_Hook->apply_filters() ***\wp-includes\class-wp-hook.php:310

    [04-Dec-2017 11:57:29 UTC] PHP 5. get_images_url() ***\wp-includes\class-wp-hook.php:286

    What is happening?

    • This topic was modified 6 years, 11 months ago by lllor.
    • This topic was modified 6 years, 11 months ago by lllor.
Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter lllor

    (@lllor)

    I suppose that line 209 $image_urls = $_POST[‘urls’] is the origin of the issue.

    I don’t understand the aim of the function get_images_url() and the two actions wp_ajax_lightbox_description and wp_ajax_nopriv_lightbox_description (I can’t see any do_action related)

    Dear lllor,

    Thanks for your post.
    Please try to use the following solution:

    1) fine lightbox.php file
    2) add this line of codes

    function get_images_url(){
    global $wpdb;
    $all_urls = array();
    $image_urls = array();
    if ( empty( $_POST[‘urls’] ) ) { return; }
    foreach ($_POST[‘urls’] as $value) {
    $image_urls[] = esc_url($value);
    }

    3) from get_images_url(){ till foreach ($image_urls as $image_url) {

    We will wait for your results.

    Thanks

    Thread Starter lllor

    (@lllor)

    Yes. It’s working now ??

    Anyway, I see there was also a probable SQL injection issue…

    • This reply was modified 6 years, 11 months ago by lllor.

    Dear lllor,

    Thank you very much for keeping us informed ??
    Could you let us know if we can help you with SQL injection issue you have reported?

    Wish you all the best!

    Thread Starter lllor

    (@lllor)

    No, there is no issue concerning SQL injection.
    I’ve just noticed that you added an esc_url() on $_POST… ??

    • This reply was modified 6 years, 11 months ago by lllor.

    Dear lllor,

    It’s great that everything is working fine now
    In the case, if you need our help any further, feel free to ask.
    We will be glad to assist.

    Wish you all the best!

    I am facing a similar problem even after trying the new code. I am getting the following warning- “PHP Warning: Invalid argument supplied for foreach() in ***/httpdocs/wp-content/plugins/lightbox/lightbox.php on line 211

    My current code is:

    function get_images_url(){
    global $wpdb;
    $image_urls = $_POST[‘urls’];
    $all_urls = array();
    foreach ($image_urls as $image_url) {
    $query = $wpdb->prepare(“SELECT ID FROM $wpdb->posts WHERE guid=’%s'”, $image_url);
    $id = $wpdb->get_var($query);
    $attachment = get_post( $id );
    $description = $attachment->post_content;
    array_push($all_urls,$description);
    }
    echo json_encode($all_urls);
    die();
    }

    Could you help with which code to use. Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Warning and Notice on WP 4.9.1’ is closed to new replies.