PHP ArgumentCountError服务器是否特定?

I am facing very weird problem since last two days, I have two different servers one is windows(php v5.3) and second is linux(php v7.1 ngnix). I have a project(written by someone) which is already running on windows server, now I have to move this project on linux server (with no code change). My issue, There is a login function -

Function userAuthentication($username,$password,$locationId,$url,$source)
{
....
}

And It is calling as (On windows server)

userAuthentication($username, $password,'',$url) ;

I know parameters are mismatched in this case but as I tested, this code is actually giving me result and working fine on windows but that same code is giving me obvious error on Linux server-

ArgumentCountError: Too few arguments to function Authentication::userAuthentication(), 4 passed in

It can be resolve by changing that code but I don't want (can to be many function with same error). I already googled but not found anything. I am very curious to know Why this is not happening on windows. Is that ArgumentCountError server specific or windows server not taking it as critical as linux, or php version issue or any other config.? what I suppose to fix to resolve this issue.?

Anyone have any idea about that please help me out, Thanks

The difference isn't in the Environment (windows vs. linux) rather the PHP version.

As you can see in the migration from PHP 7.0 to 7.1 (link: http://php.net/manual/en/migration71.incompatible.php)

Throw on passing too few function arguments

Previously, a warning would be emitted for invoking user-defined functions with too few arguments. Now, this warning has been promoted to an Error exception. This change only applies to user-defined functions, not internal functions. For example:

<?php
function test($param){}
test();

The above example will output something similar to:

Fatal error: Uncaught ArgumentCountError: Too few arguments to function test(), 0 passed in %s on line %d and exactly 1 expected in %s:%d

How to solve it?

You'll have to define all the parameters in the function. It might be "uncomfortable" but it's a better practice as a developer. Don't be lazy regarding this issue.

This has everything to do with the newer PHP versions that are (as they should) be more strict about calling. If you want this to work again make the additional parameters optional by giving them default values.

You should update to 7.x locally to prevent this sort of issues.

Like:

Function userAuthentication($username,$password,$locationId,$url,$source = '')

比起PYTHON的版本特性,PHP已经好很多了,但是PHP社区却从没注意过,PHP作为以前网站应用最广泛的语言,特么这种向前不兼容性会导致多少用户不再使用PHP

我接受公司的项目几年了,一直在PHP5.6上跑,后来改到了7.0上面...

现在搞笑了,网安用了某个安全公司的扫描软件,发现其紧急漏洞,要求服务器PHP版本要到某7.1.X 或者某7.2.X 或者7.3.3以上...

现在光一个 ArgumentCountError 的特性就可以搞死我...(当然不止这个)

近万个PHP文件.... 限期整改完....

这已经不是懒不懒的问题了,现在项目都是互相协作的,你不能保证第三方的编码是否规范,你也没办法你接受的项目之前有多少坑,

老板考虑的永远都是成本,现在为了这狗屁可能更好的“uncomfortable”得损失多少经济效益?

像MSYQL那样就很好,大小写是否验证都是可以用参数设置的。

JAVA也蛮好,不建议使用的方法都会着重标出。

我升级银行的一个项目JDK1.4到1.7,引用了200多个JAR包,兼容性+测试一个个检查走过去,也就用了一个礼拜。

估计这次没一个月是没的玩的,说不定我得直接删库跑路了....MMB的...