Using var_dump() causes blank page (error reporting is on)

1.5k views Asked by At

Does anybody have idea why I get blank page when using var_dump()? In the Joomla global config I set up showing errors too. (checked with phpinfo() and the local values are on too)

<?php
    ini_set('display_errors', 1); 
    error_reporting(E_ALL);  

    $widget_id = $widget->id.'-'.uniqid();
    $settings  = $widget->settings;
    // var_dump($settings);
    // if I uncomment the line above, works fine 
    $sets      = array_chunk($widget->items, $settings['items_per_set']);
    // var_dump($sets); 
    // if I uncomment the line above 
    // and not using the the foreach below
    // blank page appears
    foreach ($sets as $set => $items){
                    var_dump($items);
                      // this line above causes blank page
                        } 

    foreach (array_keys($sets) as $s) {
        $nav[] = '<li><span></span></li>';
    }

    $i = 0;           
?>

Thank you.

1

There are 1 answers

0
Hraday Joshi On

Save $items into another variable. Try this

 foreach ($sets as $set => $items){
$testvar=$items;
var_dump($testvar);
 // this line above causes blank page
     }