NULL means "unset"?
I know PHP is low-hanging fruit, but I recently needed to create a Magento extension to unset a request parameter and ran into this:
Okay, fine, I should be able to work with that, right?
So, if I understand correctly when I try to set a parameter to null, I'm effectively doing nothing as long as that parameter is still in $_GET, or $_POST?
Am I misunderstanding something?
I didn't bother digging into Magento after I found this in ZF, but my observer would properly unset the variable, only for it to magically reincarnate in the action following.
any way for you to make $this ->getParamSources() return  without fracking everything up?
because if you do that it looks like things should stay unset.
Probably. I didn't bother checking... Perhaps I should.
What was odd is that when I was debugging it I could tell the variable was unset, and I could call getParams() and it would function as expected until my observer was finished, then that parameter would reappear with the original value.
I was so fed up with Magento and ZF (and PHP in general) at this point, and my problem could have been solved just by redirecting and calling exit (which I didn't really want to do at first) that I just opted for that solution.
I just don't understand under what circumstances a NULL means "unset"? Why not just make an "unsetParam" function?
What's wrong with that? In what situation would a parameter you specified as text through HTTP be null instead of an empty string or not existing?
I think I am(/was) just frustrated, but it's not the behavior I was expecting.
I guess I was expecting calling setParam with a null value to error out, or throw an exception or something.. I guess just really discourage its mis-use ("set"-ing something shouldn't "unset" it, in my opinion), and instead encourage the use of an "unsetParam" function, or similar.
The problem probably doesn't lie in Zend, per-se, but Magento (seeing as everything worked as expected until further into the request...). I'll have to try and take a closer look at why the parameters were being repopulated.
I was so fed up with Magento and ZF (and PHP in general) at this point
That's a pretty soul-sucking combo. I haven't looked at Magento for years, but it was a cluster. I used some libraries from ZF in an ecommerce system I developed, and it was full of stupid (tying monetary units to locales in money conversion classes).
And this is yet another reason that I don't touch PHP
Because of Zend Framework?
That's valid I guess. There are actually some decent php frameworks out there though - Zend is the worst one I've ever used.
This post is deleted!
I was so fed up with Magento
I was doing part of a data migration away from Magento today and it took a lot longer than expected. Mostly due to figuring out the multiple EAV table sets and the instructions I was given being incorrect and incomplete.
I guess this client was fed up with Magento too!