Re: Re: [ANNOUNCEMENT] Contact_Vcard_Parse-1.30 (stable) Released.
| From: | Lukas Smith | Date: | Wed, 18 Feb 2004 22:36:20 +0000 |
| Subject: | Re: Re: [ANNOUNCEMENT] Contact_Vcard_Parse-1.30 (stable) Released. | ||
| References: | 1 2 3 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-25705@lists.php.net to get a copy of this message | ||
Paul M Jones wrote:
Hi,Yeah I guess you could argue that way. I still dont quite agree, since the chance for a collision is very rare and you penalize all the 4.3 users for those rare cases. regards, Lukas Smith smith@backendmedia.com _______________________________ BackendMedia www.backendmedia.com berlin@backendmedia.com Linn Zwoch Smith GbR Pariser Str. 44 D-10707 Berlin Tel +49 30 83 22 50 00 Fax +49 30 83 22 50 07the better approach would have been to do something like this: if(!function_exists("file_get_contents")) {I thought of that, but I am paranoid about polluting the global function space. I don't like it when a class file also defines global functions; in my little world, a PEAR class file (really, any class file) should only define its class and class-related constants, nothing more, and certainly not global functions. The end-user (or another PEAR class) may already be using the function name, either for the same purpose or not (and if for the same purpose then it may not use the same parameters or logic, thus breaking the class code that depends on it). The "better approach" you note has a higher probability of a name collision in the global namespace, and I want to avoid that. Thus, I think the method used in Contact_Vcard_Parse is safer when combined with an unknown code base (which the end-user code base certainly is) ... but that's just me.function file_get_contents($filename, $use_include_path = 0) { $data = ''; // just to be safe. Dunno, if this is really needed $file = @fopen($filename, 'rb', $use_include_path); if($file) { while (!feof($file)) $data .= fread($file, 1024); fclose($file); } return $data; }}