What will cause a print_r and / or var_dump error to debug a variable?

I am trying to debug the PayPal review process in Magento. Every time I try to reset the following variable, I get a white page:

//the variable declaration:
$shippingAddress = $this->getShippingAddress();

//the dump that breaks the page:
 <?php echo '<pre>';print_r($shippingAddress);echo '</pre>'; ?>

I also tried using a variable on the page that was used for something other than if statements.

//this variable displays results
<?php echo '<pre>';print_r($billingBlock->setShowAsShippingCheckbox(true)->toHtml());echo '</pre>'; ?>

//however, this one does not:
<?php echo '<pre>';print_r($billingBlock);echo '</pre>'; ?>

I'm just wondering what could cause my var_dump to break the page? How do I see what is in an object if I cannot reset it?

+3
source share
2 answers

-, PHP " ". , , PHP - . , , , PHP Magento .

, Magento - . PHP var_dump print_r . , PHP , memory_limit ini, .

PHP xDebug, . xDebug var_dump, , . xdebug.var_display_max_children, xdebug.var_display_max_data xdebug.var_display_max_depth ini - , , xDebug . ( PHP- )

, var_dump .

,

var_dump(get_class($thing));

Magento, ,

var_dump(array_keys($thing->getData()));

var_dump($thing->getData('key_name'));
var_dump($thing->getKeyName()));
+10

PHP . , .

php ( PHP-)

ini_set('display_errors',1);
error_reporting(E_ALL);
0

All Articles