Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught exception 'Exception' with message 'Serialization of 'SimpleXMLElement' #254

Closed
sudo-tee opened this issue May 20, 2011 · 6 comments

Comments

@sudo-tee
Copy link

Since I migrated from php5.3. I have this issue really often when running unit tests.

RuntimeException: Fatal error: Uncaught exception 'Exception' with message 'Serialization of 'SimpleXMLElement' is not allowed' in - on line 32

Exception: Serialization of 'SimpleXMLElement' is not allowed in - on line 32

Call Stack:
0.0038 410996 1. {main}() -:0
0.0604 3407540 2. __phpunit_run_isolated_test() -:195
0.0721 3698952 3. serialize() -:32

The actual faulty code in this error is:

echo $someArray['KEY_THAT_DONT_EXIST'];

Wich is in fact a real bug in the Application.

Since i'm not dealing with any SimpleXmlElement in the testes class it makes it really hard to find the real issue since I receive this generic error message a lot. I didn't had the issue on php 5.2.17 now i'm on php 5.3.5.

I tested with both OSX and Unbuntu and still get the same result on both OS.

Thanks for your help.

@matthewhaworth
Copy link

I have had a similar problem within the context of magento, did you find a fix for this?

@sudo-tee
Copy link
Author

sudo-tee commented Nov 1, 2011

Yes disable the process isolation with --process-isolation=false if you are running in the command line or in your phpunit.xml:

<phpunit processIsolation="false" ..................

There is one drawback though if you disable process isolation you won't get a full report if there is a fatal error.
Also if you disable process isolation some test might freak up if you use variables in the global scope like singletons or in your super globals.

hope it helps

@samsamm777
Copy link

+1 is there any progress on this?

@terite
Copy link

terite commented Nov 21, 2013

I just hit this issue. +1

@ghost
Copy link

ghost commented Dec 16, 2013

Got the same issue. +1

@sebastianbergmann
Copy link
Owner

There is nothing we can do about this. Objects that cannot be serialized cannot be serialized. Serialization is required for the backup and restoration of global variables (which can be turned off) as well as for process isolation. Both features should not be needed for testing clean code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants