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

added mysqli::connect() to callmap #6805

Merged
merged 3 commits into from
Nov 3, 2021
Merged

Conversation

SMAtaurRahman
Copy link
Contributor

This PR adds mysqli::connect() function signature to callmap including its change of return value in PHP 8.1

Fixes #6406

@orklah orklah added the release:fix The PR will be included in 'Fixes' section of the release notes label Nov 3, 2021
@@ -627,6 +627,10 @@
'old' => ['bool', 'ldap'=>'resource', 'callback'=>'string'],
'new' => ['bool', 'ldap'=>'LDAP\Connection', 'callback'=>'string'],
],
'mysqli::connect' => [
'old' => ['null|false', 'hostname='=>'string', 'username='=>'string', 'password='=>'string', 'database='=>'string', 'port='=>'int', 'socket='=>'string'],
'new' => ['bool', 'hostname='=>'string', 'username='=>'string', 'password='=>'string', 'database='=>'string', 'port='=>'int', 'socket='=>'string'],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Starting with PHP 8 all parameters are nullable:

$ php -v
PHP 8.0.7 (cli) (built: Aug  1 2021 01:14:34) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.7, Copyright (c) Zend Technologies
    with Zend OPcache v8.0.7, Copyright (c), by Zend Technologies
    with Xdebug v3.0.4, Copyright (c) 2002-2021, by Derick Rethans

$ php --rf 'mysqli::connect'
Method [ <internal:mysqli> public method connect ] {

  - Parameters [6] {
    Parameter #0 [ <optional> ?string $hostname = null ]
    Parameter #1 [ <optional> ?string $username = null ]
    Parameter #2 [ <optional> ?string $password = null ]
    Parameter #3 [ <optional> ?string $database = null ]
    Parameter #4 [ <optional> ?int $port = null ]
    Parameter #5 [ <optional> ?string $socket = null ]
  }
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before that, they were just optional.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great find. TIL about php --rf argument. I think its time to read man php properly. Thanks for the knowledge.
I've updated mysqli::__construct too, since they are almost same.
I guess I should submit a PR to PHP-doc repo now to reflect this change.

@weirdan weirdan merged commit edb7655 into vimeo:master Nov 3, 2021
@weirdan
Copy link
Collaborator

weirdan commented Nov 3, 2021

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:fix The PR will be included in 'Fixes' section of the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

mysqli::connect() returns true rather then null on success
3 participants