Bug #80075

PHP 7.1: QueryGenerator declares $this->queryConfig as an array but it used as array and string.

Added by Christer V over 2 years ago. Updated almost 2 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Database API (Doctrine DBAL)
Target version:
Start date:
2017-03-01
Due date:
% Done:

100%

TYPO3 Version:
8
PHP Version:
7.1
Tags:
Complexity:
no-brainer
Is Regression:
No
Sprint Focus:

Description

When using PHP 7.1 the DB Check module throws an exception when using the advanced search functionality, because of $this->queryConfig being declared as a array but used as string and array.

In QueryGenerator::procesData $this->queryConfig can be set to and string instead of an array. This causes cleanUpQueryConfig to fail since indexing into and string will not created an array for the foreach to process.

Associated revisions

Revision efa373a9 (diff)
Added by Christer V over 2 years ago

[BUGFIX] Incorrect usages of string as array in QueryGenerator

Changed so an empty $queryConfig is always an array.

$queryConfig is declared as an array but can be used as an array or
string, therefore in PHP 7.1 an exception was thrown.

Resolves: #80075
Releases: master, 7.6
Change-Id: Ifd8b89e0ccce4f93a6c7bee5afe10bf52fa73634
Reviewed-on: https://review.typo3.org/51915
Tested-by: TYPO3com <>
Reviewed-by: Thomas Hohn <>
Reviewed-by: Markus Klein <>
Tested-by: Markus Klein <>
Reviewed-by: Morton Jonuschat <>
Tested-by: Morton Jonuschat <>

Revision 98d93c70 (diff)
Added by Christer V over 2 years ago

[BUGFIX] Incorrect usages of string as array in QueryGenerator

Changed so an empty $queryConfig is always an array.

$queryConfig is declared as an array but can be used as an array or
string, therefore in PHP 7.1 an exception was thrown.

Resolves: #80075
Releases: master, 7.6
Change-Id: Ifd8b89e0ccce4f93a6c7bee5afe10bf52fa73634
Reviewed-on: https://review.typo3.org/51944
Tested-by: TYPO3com <>
Reviewed-by: Morton Jonuschat <>
Tested-by: Morton Jonuschat <>

History

#1 Updated by Gerrit Code Review over 2 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/51915

#2 Updated by Kasper Ligaard over 2 years ago

  • Priority changed from Should have to Must have
  • Complexity set to no-brainer

This must be a "Must have" since TYPO8 LTS is to support PHP 7.1. Luckily this is also a no-brainer to fix.

#3 Updated by Gerrit Code Review over 2 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/51915

#4 Updated by Kasper Ligaard over 2 years ago

The reason for this error in PHP 7.1 is only in the case when $queryString is empty:

The empty index operator is not supported for strings anymore
Applying the empty index operator to a string (e.g. $str[] = $x) throws a fatal error instead of converting silently to array.
Ref.: https://secure.php.net/manual/en/migration71.incompatible.php#migration71.incompatible.empty-string-index-operator

Probably more to the point:

...As of PHP 7.1.0, assigning an empty string throws a fatal error. Formerly, it assigned a NULL byte.
Ref.: https://secure.php.net/manual/en/language.types.string.php#language.types.string.substr

Examples of the above for PHP 7.0 and PHP 7.1 respectively:

PHP 7.0:

$ php -a
Interactive shell

php > $a = '';
php > $a[] = 'b';
php >

PHP 7.1:

$ php -a
Interactive shell

php > $a = '';
php > $a[] = 'b';

Warning: Uncaught Error: [] operator not supported for strings in php shell code:1
Stack trace:
#0 {main}
  thrown in php shell code on line 1
php > 

#5 Updated by Gerrit Code Review over 2 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/51915

#6 Updated by Gerrit Code Review over 2 years ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/51915

#7 Updated by Gerrit Code Review over 2 years ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/51915

#8 Updated by Gerrit Code Review over 2 years ago

Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/51915

#9 Updated by Gerrit Code Review over 2 years ago

Patch set 7 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/51915

#10 Updated by Gerrit Code Review over 2 years ago

Patch set 1 for branch TYPO3_7-6 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/51944

#11 Updated by Christer V over 2 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#12 Updated by Riccardo De Contardi almost 2 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF