How to fix Fatal error: Exception thrown without a stack frame

From time to time I get the infamous

Fatal error: Exception thrown without a stack frame in Unknown on line 0

but googling about it yesterday I found this article that describes a method for seeing through it and discover the real error. It’s very simple and yet powerful (and it works).

The key trick is

  1. find the line N where your script is misbehaving. This is tedious but easily done with a binary search on the execution line. At the beginning, the execution line can be that of the whole script.
    • find an approximate middle point in the current execution line
    • put an exit instruction there and execute the script again
    • do you get the same error?
      • YES: make the executed half the next execution line
      • NO: make the non executed half the next execution line
    • remove the exit
    • repeat all until the exit on line N is clean and on line N+1 is dirty
  2. look at what you have on line N and try to figure out how to force your script to willfully do right there the same operations that are automatically done on shut down
    • in my case yesterday, like the author of the article, I had a session_start on line N, so that I added a session_write_close() on line N+1 and an exit on line N+2. Magically the real error message got displayed!!

 

How to search and replace multiple lines in ZendStudio / Eclipse

  1. Edit the file
  2. Type [cmd + F]
  3. Among the Options, tick Regular expressions
  4. Type [esc]
  5. (Type and) select in the file the Replace with lines of text
  6. Type [cmd + F] [cmd + X] [tab] [cmd + V] [esc]
  7. (Type and) select in the file the Find lines of text
  8. Type [cmd + F] [tab] [down arrow] [down arrow] [enter]

Mac AppStore forces me to the Spanish site

  1. My ID is associated to the Spanish site because my credit card is from there.
  2. Now I’m in Holland but I do not speak Dutch.
  3. In the AppStore I can select the country, but not the language!!
  4. When I shop for something I want to read reviews about it.
  5. Spanish reviews are not available. (most of the times)
  6. I select the USA site.
  7. Changing country logs me out!!
  8. Now I have many reviews to browse. (I knew it!!)
  9. If I want to buy something, I click the Buy button.
  10. It wants me to login again, but…
  11. …it results in an error. (Translation: this Apple ID can only be used in the Spanish App Store)
  12. After accepting the error, I get redirected to the home of the Spanish site.
  13. Now I have to find that app again…