calast Posted October 14, 2008 Share Posted October 14, 2008 I ran into an interesting problem when doing a customer demo today (worst possible time) that I traced to an IE-specific behavior. I've coded around this but am interested in knowing if others have run into this, and if there's an obvious workaround, because I really liked this code... Assume that there is a class called Facility, stripped down to this: class Facility { var $id; var $Latitude; var $Longitude; // and some other properties... function Facility($id) { $this->id = $id; } function ReadFromDB($rec) { // read a record from the database, filing in all properties for this object from the specified record } function GetLatitude() { return $this->Latitude; } function GetLongitude() { return $this->Longitude; } } Note that I just typed this in, and please believe any typos I make here are not in the original code. Now, there is another class called Dispatch, which also has latitude and longitude information, which I wish to copy from the facility. class Dispatch() { $latitude; $longitude; $facility; // various other properties function SetLatLon() { // from the facility $f = new Facility(0); $f->ReadFromDB($this->facility); $this->latitude = $f->GetLatitude(); $this->longitude = $f->GetLongitude(); } } Now this works fine in Firefox - I have not yet tested in Safari and Opera. But in IE, it complains that $f->getlatitude is not defined. Note that the error message has mapped the call to all lower case, which might be OK - but it doesn't work. Note also that it didn't complain about the constructor or the ReadFromDB method - just GetLatitude. So it seems clear that it isn't a problem with finding the class file - require_once('facility.php') - since if it couldn't find that file, it could not have found the other methods either. This behavior is observed on different hosts running different versions of PHP, and I have looked directly at the included class definition to ensure that I didn't have some old version that was missing those methods. Besides which, it works OK in Firefox, just not in IE. Anyone have an idea as to what is going on here? Not a showstopper, since I fixed it by retrieving the info from outside the class, but if this really is an IE limitation, I'd like to not make this mistake again. Thanks for any suggestions. -Ken Quote Link to comment Share on other sites More sharing options...
DarkWater Posted October 14, 2008 Share Posted October 14, 2008 First of all, you're using deprecated PHP4 OOP syntax, which is bad already. Secondly, if you need to ask that question, I don't think you completely understand what PHP is. PHP is completely server-side, and any processing is browser-independent. Maybe FF just isn't showing the errors for whatever reason? Add the following lines to the top of the script: ini_set('display_errors', 1); error_reporting(E_ALL); Quote Link to comment Share on other sites More sharing options...
keeB Posted October 14, 2008 Share Posted October 14, 2008 I seriously lol'd.. A lot. People are staring. Quote Link to comment Share on other sites More sharing options...
DarkWater Posted October 14, 2008 Share Posted October 14, 2008 I seriously lol'd.. A lot. People are staring. I hate it when people stare when you burst out laughing. I was on the phone with my friend in the mall and she told me something, I started laughing, and everyone was just like staring at me. xD Quote Link to comment Share on other sites More sharing options...
calast Posted October 14, 2008 Author Share Posted October 14, 2008 OK, we'll skip over the vaguely insulting tone, and just take the opportunity to point out that I understand completely where PHP runs. I make my living writing Ajax code. It does not change the fact the problem can only be observed when the browser in use is IE. Also, there is a reason that the code is written to version 4 standards. I have no control over the server environment, and it has to run under PHP 4. When you do this for a living, you work in the environment your employer specifies. Such is life. Quote Link to comment Share on other sites More sharing options...
DarkWater Posted October 14, 2008 Share Posted October 14, 2008 OK, we'll skip over the vaguely insulting tone, and just take the opportunity to point out that I understand completely where PHP runs. I make my living writing Ajax code. It does not change the fact the problem can only be observed when the browser in use is IE. Also, there is a reason that the code is written to version 4 standards. I have no control over the server environment, and it has to run under PHP 4. When you do this for a living, you work in the environment your employer specifies. Such is life. 1) I don't think he was really being that insulting, he was probably being serious. 2) Although I still live with my parents (I'm 15), I still program for a (pseudo?)living (if by living you mean clubs, movie theaters, and mall, then yeah), so I very well understand the implications of employers having bad servers. =P I talk to them and they usually find a way to upgrade. Did you add the code I suggested? Also, are you actually accessing this page through Ajax or just through normal browsing? I'd suggest the latter until it's up and running (so all errors can be observed). Quote Link to comment Share on other sites More sharing options...
keeB Posted October 15, 2008 Share Posted October 15, 2008 I couldn't care less what you do for a living. Your lack of knowledge about the subject was laughable. So, I laughed. I'll bet that the page IS being access via Ajax, and the disparity functionality from browser to browser has to do with JavaScript and not PHP. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.