1

I have a strange issue where any page load attempts simply outputs a string of PHP code. When inspecting the source code, it reveals that it's actually the entire content of a class file as shown below. This happens on a particular server and for any page request.

The same code base and database works fine on my local environment. Any idea what might be doing this?

Page doesn't load

2 Answers 2

3

Looking at your code, the first thing that pops out is you're using a PHP short tag to start your PHP file

`<?`

You'll want to change that to

`<?php`

My guess if your server is setup with the short_open_tag ini set to false, which means <? will be interpreted as a regular bit of text.

1
  • Hmmmm yes! I completely missed that. Thanks!
    – laketuna
    Commented Sep 25, 2014 at 13:58
2

Something about this old question just jumped out to me - in your screenshot you have created a Block which extends the Mage_Core_Block_Template class.

However, your block methods are named as actions, indicating that this may be controller code. Further, you're using loadLayout and renderLayout - both are methods that come from the Mage_Core_Controller_Varien_Action - again, controller code.

I believe that besides PHP short tags you likely have other issues here.

Hope that helps!

2
  • Yeah, good catch! This is actually comical. I believe I was troubleshooting somebody's bug and that's just a screenshot of the source. I have no idea what this did or does.
    – laketuna
    Commented Sep 9, 2015 at 16:24
  • Ha, I recognize that code from a review: twitter.com/fschmengler/status/608000603814526976 (luckily, the block does nothing) Commented Sep 9, 2015 at 20:11

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.