Posts Tagged ‘debug’

How to see what fails when you get internal server error in PHP (500 HTTP Error)

31/01/2013

Add this lines as first lines when debugging in maintenance mode:

error_reporting(E_ALL | E_STRICT);

ini_set(‘display_errors’, 1);

 

In Magento you can set developer mode:

Mage::setIsDeveloperMode(true);

 

Anuncis

Tip to debug objects in Magento development environment

25/01/2013

Change $_item with the object you want to debug and see methods and attributes:

$var=$_item;echo 'Class '.get_class($var).':';echo ''.implode("() ",get_class_methods($var));foreach($var->getData() as $k=>$v){        echo 'getData(''.$k.'')';}

 

Magento Tip: Template and modules debug functions

03/10/2012

Some helpful snippets of code to use when debugging magento templates in development:

  var_export(get_class_methods(get_class($classname)));

  var_export(array_keys( $this->getData() )); //or

  var_export(array_keys( $object->getData() ));

  var_export($object->debug());

 

When using with Mage::log() for modules in community or local code pools.

  Mage::log(var_export(get_class_methods(get_class($classname)), TRUE),NULL,’some_filename.log’);

  Mage::log(var_export(array_keys( $this->getData() ), TRUE),NULL,’some_filename.log’); //or

  Mage::log(var_export(array_keys( $object->getData() ), TRUE),NULL,’some_filename.log’);

  Mage::log(var_export($object->debug(), TRUE));