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

Errors raised in DB_storage::toString() if there are multi-column keys, on PHP >= 7 #35

Merged
merged 1 commit into from
Feb 29, 2024

Conversation

MarkMaldaba
Copy link
Contributor

As reported by PHPCompatibility:

FILE: ./DB/storage.php
-----------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------
 254 | ERROR | Indirect access to variables, properties and methods will be
     |       | evaluated strictly in left-to-right order since PHP 7.0. Use
     |       | curly braces to remove ambiguity.
-----------------------------------------------------------------------------

On PHP 5 this code correctly retrieves the class property whose name is held in $keyname[$i].

As of PHP 7 it raises a number of PHP errors. They are notices on PHP 7 and warnings on PHP 8:

Warning: Array to string conversion in DB/storage.php on line 254

Warning: Undefined property: DB_storage::$Array in DB/storage.php on line 254

Warning: Trying to access array offset on null in DB/storage.php on line 254

Adding explicit braces resolves this issue and restores the intended behaviour across all PHP versions.

…s, on PHP >= 7

As reported by PHPCompatibility:

```
FILE: ./DB/storage.php
-----------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------
 254 | ERROR | Indirect access to variables, properties and methods will be
     |       | evaluated strictly in left-to-right order since PHP 7.0. Use
     |       | curly braces to remove ambiguity.
-----------------------------------------------------------------------------
```

On PHP 5 this code correctly retrieves the class property whose name is held in `$keyname[$i]`.

As of PHP 7 it raises a number of PHP errors.  They are notices on PHP 7 and warnings on PHP 8:

```
Warning: Array to string conversion in DB/storage.php on line 254

Warning: Undefined property: DB_storage::$Array in DB/storage.php on line 254

Warning: Trying to access array offset on null in DB/storage.php on line 254
```

Adding explicit braces resolves this issue and restores the intended behaviour across all PHP versions.
@schengawegga schengawegga merged commit f79e405 into pear:trunk Feb 29, 2024
@schengawegga schengawegga added this to the Version 1.12.2 milestone Feb 29, 2024
@MarkMaldaba MarkMaldaba deleted the patch-1 branch March 1, 2024 00:35
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

Successfully merging this pull request may close these issues.

2 participants