Project

General

Profile

Actions

Bug #54323

closed

$GLOBALS['TYPO3_DB']->isConnected() doesn't work when MySQL server has gone away

Added by Bill Dagou almost 11 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Database API (Doctrine DBAL)
Target version:
Start date:
2013-12-11
Due date:
% Done:

100%

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

Description

Dear TYPO3 Team,

Thank you for your great work on TYPO3, it's really a powerful CMS I could tell.

When I was working on my own extension, I found a DB problem with CLI, not sure whether it would happen in web or not.

The situation is, I was using both cUrl and sleep in my code, and I would get "MySQL server has gone away" error while $GLOBALS['TYPO3_DB']->isConnected() could not detect it. And the code logic is as follow.

------------------------------- Code logic start -----------------------------------
// cUrl a captcha image and save it to the server
..........

do {
sleep(15); // Set 15 seconds delay for manually enter the captcha code in captcha.txt file.

// Load the content of captcha.txt and set it to $captcha
.........
} while (!$captcha);

// cUrl the login page with $captcha
.........

// Get the page content and insert it into the database
$GLOBALS['TYPO3']->exec_INSERTquery('table', $insertArray);
------------------------------- Code logic end -----------------------------------

I think the problem is $GLOBALS['TYPO3_DB']->isConnected() is returning $this->isConnected rather than checking the real connection. And what I do now is $GLOBALS['TYPO3_DB']->__sleep() before the db operation.

BTW, if I choose the wrong project, please help to correct it. There are a lot in the list, and I don't know which one to choose :)

Cheers,
Bill

Actions

Also available in: Atom PDF