Strange PHP behaviour after porting site to new database
Posted: Thu Apr 26, 2007 12:05 pm
For political reasons, my employers require that I run the CMS under IIS and MS-SQL (and I believe I have the same attitude to this as almost all of you do). I've got virtually everything working (The previous prototype ran under IIS and MySQL but that was not deemed acceptable. Using ODBC I ported all the tables from one to the other, which seemed to go remarkably smoothly, I had already completed the few mods to the core code which were required (basically MS-SQL takes the strictly accurate but unhelpful view that you can't compare strings using "=", you have to use "LIKE": this is solved by modifying the SQL to cast them as varchars. Oh, and by default MS-SQL only returns the first 4096 bytes of a string: you have to tell it to deliver more in an ini variable). I also made sure the module environment was stable by exporting all the modules to XML from the MySQL version then importing them into the MS-SQL site.
Nearly everything works, except for a few niggly places: I haven't checked every example, but it appears that I'm getting Undefined Index notices usually for common smarty tags like message. These refuse to go away, even when I set error_reporting to 1 (which should only display fatal errors.
Why should changing the database affect the way PHP behaves? I've noticed that smarty seems to mess around with with the value of error_reporting (not sure why). I come from a Perl background and the idea of raising an exception when a key of an associative array comes back as null seems a bit odd - it's useful for a number of optimisations, not least providing a neat cache mechanism.
Any help people could provide would be very welcome, and yes, I know about wrapping the access in an ifset() but going around modifying the core code piecemeal as they crop up doesn't seem a very rigourous way of going about it, and besides, too many of these will probably slow the code down. The oddest bit is that the two implementations share a copy of php, and hence of php.ini.
Regards, Andy Holyer
Nearly everything works, except for a few niggly places: I haven't checked every example, but it appears that I'm getting Undefined Index notices usually for common smarty tags like message. These refuse to go away, even when I set error_reporting to 1 (which should only display fatal errors.
Why should changing the database affect the way PHP behaves? I've noticed that smarty seems to mess around with with the value of error_reporting (not sure why). I come from a Perl background and the idea of raising an exception when a key of an associative array comes back as null seems a bit odd - it's useful for a number of optimisations, not least providing a neat cache mechanism.
Any help people could provide would be very welcome, and yes, I know about wrapping the access in an ifset() but going around modifying the core code piecemeal as they crop up doesn't seem a very rigourous way of going about it, and besides, too many of these will probably slow the code down. The oddest bit is that the two implementations share a copy of php, and hence of php.ini.
Regards, Andy Holyer