Project

General

Profile

Actions

Bug #78257

closed

dbal class DatabaseConnection tries to explode array (TYPO3 7.6 and 6.2)

Added by M. Ecker over 7 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2016-10-11
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
7
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

Situation:
An extbase extension connects to an external postgres database (as additional database, which is also accessed by other systems) with models 'person', 'organisationUnit' and 'affiliation' (which contains each one person, one organisationUnit and other properties). Invoking the listAction for affiliation within a backend module causes

Uncaught TYPO3 Exception
#1: PHP Warning: explode() expects parameter 2 to be string, array given in /var/www/typo3_src-7.6.11/typo3/sysext/dbal/Classes/Database/DatabaseConnection.php line 3673

Existing code (line 3670ff.):

// do we have a field name in the value?
// this is a very simplistic check, beware
if (!is_numeric($sqlPartArray[$k]['value'][0]) && !isset($sqlPartArray[$k]['value'][1])) {
                        $fieldArray = explode('.', $sqlPartArray[$k]['value'][0]);
...
}

Analysis:
If the query was built by extbase to get a subentity (the person of an affiliation), $sqlPartArray[$k]['value']0 will contain the array structure this code is expecting to be found at $sqlPartArray[$k]['value'] - so it's neither numeric nor a $sqlPartArray[$k]['value']1 exists.

A very simple patch would be to add an additional condition in line 3672:

if (!is_numeric($sqlPartArray[$k]['value'][0]) && !is_array($sqlPartArray[$k]['value'][0]) && !isset($sqlPartArray[$k]['value'][1])) 
{...}

As far as I can see this seems to work without any side effects, while changing the array $sqlPartArray[$k]['value'] would cause side effects.

In TYPO3 6.2 the code is the same, the line number is 3553.

Actions #1

Updated by Riccardo De Contardi over 6 years ago

  • Status changed from New to Closed

Hi and sorry for the late answer;

EXT:dbal has been decoupled from the TYPO3 Core since version 8.7.x when the integration with Doctrine has been added
and most of the issues with PostgreSQL should have been fixed now.

I close this issue for now, as EXT:dbal is now maintained as a separate extension by the FriendsOfTypo3 Team.

If you still need support on this issue on TYPO3 version 7.6.x, please open an issue at https://github.com/FriendsOfTYPO3/dbal

If you experience the issue again with TYPO3 8.7.x, please reopen it or open a new issue with a reference to this one. Thank you.

Actions

Also available in: Atom PDF