On Sat, 2006-04-01 at 21:39, Jasper Bryant-Greene wrote: > Robert Cummings wrote: > > > There's smart lazy programming, and sloppy lazy programming. I don't > > trust anything magical in PHP. Most of us are familiar with the magic > > quotes and global vars fiascos *LOL*. But hey, if you can squeeze a > > rewrite of an application out of a client for relying on dirty > > techniques, who am I to critique your forward thinking manipulative > > methods -- not to say that's your intent -- but I'd sure question your > > motives and judgement if it comes around ;) > > I very much doubt PHP will ever enforce the closing of resources such as > database connections at the end of every script. That would be a > needless BC break. I'm sure that was the thought on magic quotes and register globals also. > Also, I do it this way because some projects that use my framework want > persistent connections. If my framework closed connections automatically > then that wouldn't be possible. Your database layer should handle whether a connection is really freed. Just because the developer calls the close() method on your DB object, doesn't mean you need to close the connection. But if they don't call a close() method, then in the future if you do need that functionality... it's not there. > Of course, it wouldn't exactly be a rewrite to make it close the > connection at the end of every script before PHP did, if I'm proven > wrong and it one day is necessary. I'd only need to change the database > objects layer. Wrong, you would just be doing the same thing PHP does... closing the connection at the end of the script. What happens if you need to open 20 connections to 20 different databases... are you going to keep them all open? I guess you would since it sounds like you don't have a facility to close them. I don't think what you're doing is incredibly obscene, I mean 90% of PHP developers are doing the same thing. 90% of the coding population can't be wrong... but one that same line of thought... when you open an image file or text file for reading or writing... do you close it? Or just leave it open for PHP to close at the end? I mean PHP will magically close all resources for you, there's obviously no need to close it... or maybe there are valid times when you need to close a resource yourself, I dunno, I feel like I'm out on a limb here ;) Cheers, Rob -- .------------------------------------------------------------. | InterJinn Application Framework - http://www.interjinn.com | :------------------------------------------------------------: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `------------------------------------------------------------' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php