Re: [PHP4BETA] New Bug??
| From: | Zeev Suraski | Date: | Tue, 15 Jun 1999 00:06:42 +0000 |
| Subject: | Re: [PHP4BETA] New Bug?? | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-1559@lists.php.net to get a copy of this message | ||
At 05:00 14/06/99 , Lee Payne wrote:
Why does this produce a parse error bug on line 7 ( expecting } )? This has been reproduceable on 3 different machines, updated a few minutes ago. <? $server="localhost"; $port=143; $mailbox="usermailbox"; $user="username"; $pass="password"; $mbox = imap_open("{$server:$port}$mailbox", $user, $pass, OP_READONLY); ?>I've been meaning to answer your previous post, but didn't get around to it... The parse error here is due to the increased support for variables within quoted string that's introduced in PHP 4.0. It does trigger a very rare incompatibility issue, in places where you have an open curly braces character, immediately followed by a variable reference (in this case, {$server). PHP 4.0 (Zend) allows you to reference any type of variable, using any number of indirections, calculations and what not inside quoted strings, by surrounding your variable with curly braces. For example: print "The value of the 5th element of the 5th element is {$arr[5][5]}.\n"; Or even $x = 5; print "The value of the 5th element of the 5th element is {$arr[$x][20/5+1]}.\n"; Solving your parse error would mean you'd have to escape the open-curly braces, i.e.: $mbox = imap_open("\{$server:$port}$mailbox", $user, $pass, OP_READONLY); Zeev -- Zeev Suraski <zeev@zend.com> http://www.zend.com/ For a PGP public key, finger bourbon@netvision.net.il