Req #52727 [NEW]: Combined function default argument value
| From: | grzegorz129 at gmail dot com | Date: | Sun, 29 Aug 2010 03:00:35 +0000 |
| Subject: | Req #52727 [NEW]: Combined function default argument value | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-153889@lists.php.net to get a copy of this message | ||
From:
Operating system: All
PHP version: 5.3.3
Package: Scripting Engine problem
Bug Type: Feature/Change Request
Bug description:Combined function default argument value
Description:
------------
First of all - I marked it as feature/chamge request (not bug) bcs it`s not
so
important but maybe it`s a bug.
Official manual quote:
"The default value must be a constant expression, not (for example) a
variable, a
class member or a function call."
Code written below is correct according to the documentation but
interpreter
generate parse error: syntax error, unexpected '.', expecting ')'
function foobar($a = "abc"."def") { print($a); } //Wynik: Parse error:
syntax
error, unexpected '.', expecting ')'
Test script:
---------------
define("TEST", "abc");
function foo($a = TEST) { print($a); } //Res: abc
function bar($a = "def") { print($a); } //Res: def
function foobar($a = TEST."def") { print($a); } //Wynik: Parse error:
syntax error, unexpected '.', expecting ')'
//abstract but also causes parse error
function foobar($a = "abc"."def") { print($a); } //Wynik: Parse error:
syntax error, unexpected '.', expecting ')'
--
Edit bug report at http://bugs.php.net/bug.php?id=52727&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=52727&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=52727&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=52727&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=52727&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=52727&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=52727&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=52727&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=52727&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=52727&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=52727&r=support
Expected behavior: http://bugs.php.net/fix.php?id=52727&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=52727&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=52727&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=52727&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52727&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=52727&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=52727&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=52727&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=52727&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=52727&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=52727&r=mysqlcfg