1

In my controller, I call

Mage::getSingleton('adornis_tps/piCertifiedImport')->download();

which works on my mirror installation.

Then I copied the module onto the live system and it caused a fatal error resulting in a blank page as soon as I ask Magento to get that singleton.

Another model that had been included in an earlier version of the module causes no such trouble, fetching the singleton of that model works perfectly fine and has always worked fine.

This would usually make me believe I haven't cleared my cache, but I have. Or I misspelled something, but I don't think I have. Here's my config.

<?xml version="1.0"?>
<config>
    <modules>
        <Adornis_TPS>
            <version>1.1.0</version>
        </Adornis_TPS>
    </modules>
    <global>
        <blocks>...
        </blocks>
        <helpers>...
        </helpers>
        <models>
            <adornis_tps>
                <class>Adornis_TPS_Model</class>
            </adornis_tps>
        </models>
    </global>
    <admin>...
    </admin>
</config>

There's nothing to be found in my log files or the apache log.


EDIT:

This is working:
AvailabilityUpdate.php (class name Adornis_TPS_Model_AvailabilityUpdate) targeted with 'adornis_tps/availabilityUpdate'

This is not working:
PiCertifiedImport.php (class name Adornis_TPS_Model_PiCertifiedImport) targeted with 'adornis_tps/piCertifiedImport'


EDIT:

Availabilityupdate.php and Picertifiedimport.php (leading upper case only) does not change anything, the first one works, the second doesn't... I don't think it's about the file names


EDIT:

I don't think it's about the naming, but I'm clueless as to what else it would be then...


EDIT:

Well... it works now. See my answer.

2
  • What does the fatal error say? It would be helpful if you pasted that error.
    – Paras Sood
    Commented Feb 18, 2015 at 15:36
  • @ParasSood well, there is no error message in the logs or the apache log, I was just figuring it had to be a fatal one if Magento doesn't send a response
    – Yorrd
    Commented Feb 18, 2015 at 15:39

3 Answers 3

2

You've edited your answer to make it simpler, it seems, but I think I know what your problem is, looking at your previous unedited question.

This is most likely a letter case issue with different version of PHP on your servers. When you're instantiating objects using Magento's factory methods, it is best to use single words for class files because some versions of PHP doesn't work well with multiple upper letters in a file name. I've often had issues with letter cases when working on MAMP and various servers. Probably an OS issue, but I'm not exactly certain.

For example, instead of ThisClass.php, name it Thisclass.php. Then, use Mage::getModel('adornis_tps/thisclass'), so you can avoid any letter case incompatibility issues.

10
  • Well, good idea, but I have the exact same thing with another class in the same directory and that one works, please also have a look at what I commented below the other answer
    – Yorrd
    Commented Feb 18, 2015 at 17:28
  • Could you post some more examples of what's working and what's not working? Post on which server they work or don't work, as well.
    – laketuna
    Commented Feb 18, 2015 at 18:07
  • please see my edit below the original question
    – Yorrd
    Commented Feb 19, 2015 at 9:13
  • @Yorrd, I recommend naming your files Availabilityupdate.php and Picertifiedimport.php (leading upper case only). Then, use adornis_tps/availabilityupdate and adornis_tps/picertifiedimport. If you must use multiple upper case letters, update your live system's PHP to be the same version as your local instance's.
    – laketuna
    Commented Feb 19, 2015 at 16:36
  • well... that still doesn't work. I have done exactly as you said. availabilityupdate works, picertifiedimport doesn't...
    – Yorrd
    Commented Feb 19, 2015 at 17:28
0

Your model class factory method is wrong it should be

adornis_tps/piCertifiedImport

to

adornis_tps/picertifiedimport

Magento class after model prefix is very case sensitive

1
  • Well, unfortunately that doesn't help :/ Btw: My other module is called AvaUpdate and it's working when I do getSingleton('adornis_tps/avaUpdate'); Also, it worked that way on my other installation.
    – Yorrd
    Commented Feb 18, 2015 at 16:21
0

This was not at all about the Mage->getSingleton(), neither was it about the file name. I just simply had different versions of php on the local and the remote server (the remote server is behind), and there was an issue with string casting. Different topic - different question.

Anyways, the issue was that the class itself had an error because of an old php version, so it wasn't loaded and because I had turned off developer mode accidentally, I didn't see the error message.


tl;dr: The class wasn't loaded because php on the second server was outdated and didn't support string casting, therefore ->getSingleton() broke fatally.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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