Skip to content

Runtime Notice for variable by &$reference #2

bartrail opened this Issue Jul 20, 2011 · 3 comments

2 participants


Thanks again for these beautiful maths!

I got into trouble with a strict PHP configuration, saying "Runtime Notice: Only variables should be assigned by reference in /home/con/www/lab/Moserware/Skills/HashMap.php line 36 "

When I disable the strict mode (or at least disable notices in php's error_reporting()) it works and I get a calculation. Unfortunately, I need the strict mode and all notices for the development to easier find bugs and the framework I'm using (Symfony2) even throws full Exceptions on notices (thanks to xdebug) so I can't even ignore a notice, even though I'd like to.

So I was trying to get rid of all ampersands as I don't fully understand the php 5.3 runtime notice for references - thought anything is a reference by now.. - seems it is not.. so unfortunately I broke the whole environment and some unit tests are totally going nuts..

Maybe you find some time to take a look over this, this is the commit where I radiacally (blindly, but not search & replace ;) removed the ampersands

and this is one of the tests that failed and I was trying to manually find out which else is failing in this TwoTeam Test case (came out this was it) - so I revered the unit test values in my fork back to the original ones, but maybe this can help you to locate which ampersand &reference is really needed...



Thanks for the info. I probably won't get a chance to look at it for quite some time, but if you resolve the issues I'd be happy to pull in the change.


Alright :) I'll let you know once I've made progress on this


I digged a bit more and found only a few lines where the references actually throw errors on runtime. Unfortunately phpunit isn't so error-greedy..

I started a new branch for the strict env php5.3 which I included into my project and keep up-to-date when I run into any new error.. all unit tests are still successful. When my project is finished in the next couple of weeks I will send back the pull request with the updated version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.