-or how i spent a morning fixing something that didnt need fixing !!!
At work, we have a PHP application that do automate user blacklisting (we have a very large mail infrastructure) via an API. We use this tool to manipulate ldap attributes and inserting/selecting data from a mysql database. Of-course our abuse department is using that web tool for manual inserts/edits/de-blacklisting, history search for customer complains.
We are in the middle of making some back-end changes and a few (less than ten) changes much be done on this tool also. Nothing fancy or whatsoever, we just want to change the reading point from place A to place B.
Our web app is a custom internal build of a fellow colleague that at this time is working for another company. So I take charge to this easy and simple task.
Five minutes later and all the changes were made. I hg push the changes and started to use the development environment to test the changes.
And nothing is working !!!!
Did a hg diff and see the SEVEN (7) tiny changes on the code.
To clear some things up, the changes was in the below form:
// read from ldap the attribute Profile $attr_old = array ("Profile" ); // write to mysql the value of Profile $old_profile = $entries [$i] ["Profile"] ;
after almost a full hour -I was hitting my head on the wall at that time- i tried to var_dump all the arrays.
And WHAT I see, was unreal !!!
The code is reading the ldap attribute: Profile from the ldap as Profile.
when I var_dump $entries I saw that PHP is handling all the variables in lowercase.
so Profile is becoming profile
I still dont know/understand whys is this happening!
I just did two more tiny changes, so that mysql is now inserting
$entries [$i] ["profile"] ;
and not the wrong one:
$entries [$i] ["Profile"] ;
and everything is OK now.