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

PHP 8.1 : PHP Deprecated: strcmp() null parameter #844

Closed
fundo-moretti opened this issue Jun 22, 2022 · 2 comments
Closed

PHP 8.1 : PHP Deprecated: strcmp() null parameter #844

fundo-moretti opened this issue Jun 22, 2022 · 2 comments
Assignees
Labels
bug core ADOdb core (library and base classes) PHP8.1 PHP8.1 Compatibility Issues
Milestone

Comments

@fundo-moretti
Copy link

fundo-moretti commented Jun 22, 2022

Hi,

When using ADOConnection::GetUpdateSQL() with NULL fields, PHP 8.1 output this message:

Deprecated: strcmp(): Passing null to parameter #1 ($string1) of type string is deprecated in adodb-lib.inc.php on line 753

Thanks

@dregad dregad added bug core ADOdb core (library and base classes) PHP8.1 PHP8.1 Compatibility Issues labels Jun 22, 2022
@dregad dregad added this to the v5.22.3 milestone Jun 22, 2022
@dregad dregad self-assigned this Jun 22, 2022
@dregad
Copy link
Member

dregad commented Jun 22, 2022

I'm not really sure why we're using strcmp() here - using a strict comparison operator (i.e. $val !== $arrFields[$upperfname]) would seem more logical and efficient.

@mnewnham thoughts ?

@mnewnham
Copy link
Contributor

I just think it's old code where strcmp worked ok, but not anymore. I would agree that your solution is appropriate

dregad added a commit that referenced this issue Jul 22, 2022
PHP 8.1 throws a warning when compared field value is null. Fixed by
replacing strcmp() with a strict-comparison operator.

Fixes #844
@dregad dregad closed this as completed Jul 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug core ADOdb core (library and base classes) PHP8.1 PHP8.1 Compatibility Issues
Projects
None yet
Development

No branches or pull requests

3 participants