Bug->Req #69223 [Opn]: passing extra parameters in function/method call

From: Date: Wed, 11 Mar 2015 20:09:23 +0000
Subject: Bug->Req #69223 [Opn]: passing extra parameters in function/method call
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-191322@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69223&edit=1 ID: 69223 Updated by: aharvey@php.net Reported by: php at w3x4 dot com Summary: passing extra parameters in function/method call Status: Open -Type: Bug +Type: Feature/Change Request -Package: Unknown/Other Function +Package: Scripting Engine problem Operating System: W7 64 PHP Version: 5.6.6 Block user comment: N Private report: N New Comment: This is supported because PHP 5.5 and earlier used this for variadic functions, so at present this is expected behaviour. There's an open RFC at present which would address this: https://wiki.php.net/rfc/strict_argcount. I'll move this to a feature request pending the outcome of that RFC. Previous Comments: ------------------------------------------------------------------------ [2015-03-11 20:06:11] php at w3x4 dot com Description: ------------ /* Using Visual Studio 2013 with Devsense PHP Tools, or * Using UEStudio 15: * * 1) Set breakpoint on the 3 lines containing: $c=2 * * 2) Examine Locals window to confirm that $a does not appear when a static call or a function call passes more variables than the called method/function expects. * * 3) Examine the error log to confirm that php does not throw an error or report a warning. * * 4) Note that the existence of a reference to $a in Class Two results in $a being displayed in the Locals window. Note also that removing '$b=1' will result in $a being displayed in Locals window. * * I suggest that PHP should throw a fatal error when passing more parameters than the function/method expects; it seems some other (related) php problem is the cause of $a not being displayed in Locals window. * * * <SAA> */ Test script: --------------- $xyz = new Class1; class Class1 { public function __construct() { $this->_callHook(); } function _callHook(){ $ret = One::f1('a'); $ret = f1('b'); $ret = Two::f1('a'); } } class One{ static function f1(){ $a=1; $b=1; $c=2; } } function f1(){ $a=1; $b=1; $c=2; } class Two{ static function f1(){ $a=1; $b=1; $c=2; echo $a; } } ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=69223&edit=1

« previous php.bugs (#191322) next »