4

I had an extremely strange error occur today when I added

$error_message = "error Doing Saasu Order Link";
Mage:log($error_message);
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__($error_message));

If I comment out the Mage::log line, it works fine

Error comes up with
( ! ) Fatal error: Label 'Mage' already defined in C:\wamp\www\local_wildfire\app\code\local\Wildfiretextbooks\Saasu\Model\Saasuconnect.php on line 849
Call Stack
#   Time    Memory  Function    Location
1   0.0009  380632  {main}( )   ..\index.php:0
2   0.0094  748832  Mage::run( )    ..\index.php:80
3   0.0300  1978136 Mage_Core_Model_App->run( ) ..\Mage.php:640
4   1.2155  9668488 Mage_Core_Controller_Varien_Front->dispatch( )  ..\App.php:349
5   1.2459  10954408    Mage_Core_Controller_Varien_Router_Standard->match( )   ..\Front.php:176
6   1.2576  11581480    Mage_Core_Controller_Varien_Action->dispatch( ) ..\Standard.php:250
7   1.4137  14910232    Slink_MageSaasu_Admin_SchedulesController->runAction( ) ..\Action.php:420
8   1.4217  15034424    Slink_MageSaasu_Model_Schedules->run( ) ..\SchedulesController.php:163
9   1.4355  15384808    Inventory->execute( )   ..\Schedules.php:77
10  1.4450  15560200    Mage::getModel( )   ..\Inventory.php:53
11  1.4451  15560320    Mage_Core_Model_Config->getModelInstance( ) ..\Mage.php:432
12  1.4451  15560688    class_exists ( )    ..\Config.php:1348
13  1.4451  15561024    Varien_Autoload->autoload( )    ..\Autoload.php:0

The line that it says it crashed on is
10  1.4450  15560200    Mage::getModel( )   ..\Inventory.php:53
$wildfire_sassu_model = Mage::getModel('Wildfiretextbooks_Saasu/Saasuconnect');

It does not even call the function where the log is, however, that module is loaded.

Any explanation as to what is happening?

4

You have a typo:

Mage:log($error_message);

should be:

Mage::log($error_message);

Note the extra :.

0
1

Thank Jonathan for the good answer!

I want to give a little more context:

A label is used together with goto. Like this:

Thanks to http://php.net/goto
goto label;
echo 'Foo';

label:
echo 'Bar';

So goto changes the flow of the program and let the program go on at the label.

1
  • 1
    Great explanation. Very esoteric and shows why it was not a compile error. Thanks a lot – angelofraietta Oct 24 '14 at 2:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.