ID: 26693 Updated by: [EMAIL PROTECTED] Reported By: crucifyer at korea dot com -Status: Open +Status: Bogus Bug Type: Documentation problem Operating System: Gentoo Linux 1.4 PHP Version: 4.3.4 New Comment:
http://www.php.net/manual/en/functions.arguments.php say: "The default value must be a constant expression, not (for example) a variable, a class member or a function call." Previous Comments: ------------------------------------------------------------------------ [2003-12-22 09:38:57] crucifyer at korea dot com Description: ------------ parse error in function's default value. thanks. Reproduce code: --------------- class LinkManager { var $uri, $flag; function LinkManager($uri = $_SERVER['REQUEST_URI']) // this line bug. $uri = '' is ok. $uri = $_ is error. why not? { $this->uri = $uri; if(strpos($uri, '?')) $this->flag = '&'; else $this->flag = '?'; return TRUE; } } Actual result: -------------- active code. class LinkManager { var $uri, $flag; function LinkManager($uri = '') { if($uri == '') $this->uri = $_SERVER['REQUEST_URI']; else $this->uri = $uri; if(strpos($uri, '?')) $this->flag = '&'; else $this->flag = '?'; return TRUE; } } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=26693&edit=1