Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatible error when not enough parameters passed #75

Open
sagikazarmark opened this issue Jan 11, 2015 · 2 comments
Open

Incompatible error when not enough parameters passed #75

sagikazarmark opened this issue Jan 11, 2015 · 2 comments

Comments

@sagikazarmark
Copy link

The error message in PHP core function is the same:
password_hash() expects at least 2 parameters, 0 given

In the backported function, there is something like this:
Missing argument 1....

This is not a major one, but still incompatible.

What I've done in backported function is that required arguments got a null default value (since type check is still necessary), so that I could trigger a proper error for less than enough argument count. The idea originates from ramsey/array_column.

@kAlvaro
Copy link

kAlvaro commented Apr 27, 2017

This belongs to PHP core. It cannot (and probably shouldn't) be addressed from plain PHP code:

function foo($a, $b) {
}
foo();

Output for 4.3.0 - 5.0.5, 5.1.0 - 5.6.30, 7.0.0 - 7.0.18
Warning: Missing argument 1 for foo()
Warning: Missing argument 2 for foo()
Output for 7.1.0 - 7.1.4
Fatal error: Uncaught ArgumentCountError: Too few arguments to function foo(), 0 passed

https://3v4l.org/ElVGo

@GrahamCampbell
Copy link
Contributor

This belongs to PHP core. It cannot (and probably shouldn't) be addressed from plain PHP code:

Not true really. We could simulate what happens on the internal functions if we wanted to, I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants