PHP Fatal error: Cannot call overloaded function for non-object in /var/www/html/includes/database/query.inc on line 331
On the requirements page there is a "Version specific notes on PHP requirements" section that gives information on supported PHP versions.

Notice that it doesn't mention PHP 5.4 anywhere.
I take this to mean that Drupal 7 is not guaranteed to work with PHP 5.4.

In addition to this there is no hard requirement for any contributed modules to support PHP 5.4 yet.
Some modules will work and some will have problems.
Some modules have already had these problems fixed and I have seen in some cases, maintainers saying they will not support 5.4 if the fix causes problems for older versions, because php 5.2 &amp; 5.3 are the main target versions of Drupal 7.

I would recommend if possible to not use PHP 5.4, and if you do you will quite probably be having to debug more of these issues as you encounter them.

Also, your version of drupal is 10 versions (more than a year) old. If you want to use the cutting edge version of PHP you have to also use the latest versions of all modules as this will give you the best chance of these kinds of issues having been fixed.

Not to mention that there have been some security fixes since 7.12 that you would benefit from having.

Is it an option for you to stay on PHP 5.3?