Exception handling - 'Allowed memory size' exhasted issues
I'm having issues with Exception handling. I've hit a few places, where rather than getting provided with a useful error message, I am getting WSOD and then in the Apache error logs I am seeing "PHP Fatal error: Allowed memory size of xxx bytes exhausted (tried to allocate xxx bytes) in Unknown on line 0".
"Unknown on line 0" isn't very helpful. One instance where I am getting this is if I want to view a contribution page, that has "Allow individuals to contribute and / or signup for membership on behalf of an organisation?" selected, but the user does not have the 'CiviCRM: profile create' permission.
It's taken me a while to narrow down the problem following a debug_backtrace() in templates/CRM/Contribute/Form/Contribution/Main.tpl.
I've tracked it as far as CRM_Core_Exception. The constructor method here is working ok, but there is another method, getErrorData() which is somehow getting called, but I cannot figure out where from. It seems to me that there must be some kind of infinite loop thing going on with one Exception class calling another. CRM_Core_Exception extends PEAR_Exception which extends Exception.
I have at least three other instances of WSOD on the site, with the same uninformative 'Allowed memory size ..' errors in the Apache log, but I haven't got as far as tracking them down to see if it is the same thing yet.
Is anyone else having problems like this? Would appreciate any thoughts.