Re: what is the meaning of the following construct
| From: | Davey | Date: | Sat, 17 Apr 2004 12:17:22 +0000 |
| Subject: | Re: what is the meaning of the following construct | ||
| References: | 1 2 3 4 5 6 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-27847@lists.php.net to get a copy of this message | ||
Cipriano Groenendal wrote:
This code makes sense to me. The right hand operand is like '@'.'include_path'.'@' because if it were '@include_path@' it would be replaced by the installer too. (think: str_replace('@include_place@',$include_path,file_get_contents('scripts/pearcmd.php')) will not replace the *text* (talking about this as plain text, not PHP now) '@'.'include_path'.'@') What the code is doing, is checking that the @include_path@ substitution was made, and if so, set the include path. look at it this way: if ('@include_path@' == '@'.'include_path'.'@') { /* the first @include_path@ string was not replaced by the installer, so the string '@include_path@' is equal to the concated '@'.'include_path'.'@' therefore the include_path has not been set by the installer and we can't ini_set('include_path','/to/some/path');*/ This is hard to explain. All its doing is checking the string substitution for @include_path@ with an actual path has been done, and if so, it sets the include_path to that path. Perfectly valid code IMO. - Daveyif ('@include_path@' != '@'.'include_path'.'@') { ini_set('include_path', '@include_path@'); } I am not knowledgable about which program replaces these @include_path@ with '/usr/local/lib/php'.The PEAR installer does this when it's installing a package.Any way finally the installed code looks like the following if ('/usr/local/lib/php' != '@'.'include_path'.'@') { ini_set('include_path', '/usr/local/lib/php'); } So the if condition is absolutely not necessary. Please correct me if I am wrongIt is indeed quite strange code. It seems to check if it wasn't done correctly, and if so spcify the path itself, but that code wouldn't be done right anyway sine the @include_path@ never got translated... Cipri