Project

General

Profile

Actions

Bug #24757

closed

BE ajax request fails on some systems with php 5.3

Added by Joh. Feustel about 13 years ago. Updated almost 11 years ago.

Status:
Closed
Priority:
Should have
Category:
-
Target version:
-
Start date:
2011-01-23
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.5
PHP Version:
5.3
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Beacause of a php bug on some systems the request to ajax.php fails because it includes '../t3lib/class.t3lib_div.php' with relative path while init.php uses PATH_t3lib.'class.t3lib_div.php'. On some systems PHP seems not to be able to detect the already included file when different patch are used.

Was detected on mac/MAMP PHP 5.3.2 with introductionpackage 4.5RC1

Solution: remove loading of t3lib_div and use $_REQUEST['ajaxID'];

http://lists.typo3.org/pipermail/typo3-dev/2011-January/042340.html
(issue imported from #M17250)


Files

17250.diff (540 Bytes) 17250.diff Administrator Admin, 2011-01-23 19:25
17250v2.diff (554 Bytes) 17250v2.diff Administrator Admin, 2011-01-24 18:40
17250v3.diff (463 Bytes) 17250v3.diff Administrator Admin, 2011-01-25 10:34

Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Bug #25408: BE list module fails on some systems with php 5.3ClosedXavier Perseguers2011-03-28

Actions
Related to TYPO3 Core - Bug #26535: Cannot redeclare class backend_toolbaritemClosedXavier Perseguers2011-05-01

Actions
Actions #1

Updated by Oliver Hader about 13 years ago

Does PHP throw any errors in this case? What does the logfile tell?

Actions #2

Updated by Joh. Feustel about 13 years ago

there is some more information in the mailing list.
Actually the problem seems to be with the internal require_once handling of PHP which doesnt recognize the already included file. So the logfile says

[24-Jan-2011 15:49:53] PHP Fatal error: Cannot redeclare class t3lib_div in /Users/jo/Sites/introduction/t3lib/class.t3lib_div.php on line 230

This is probably caused by the internal realpath function which returns not the same path as detected for PATH_t3lib constant. In my case the paths are the following:

realpath('../t3lib/class.t3lib_div.php'): /users/jo/Sites/introduction/t3lib/class.t3lib_div.php
PATH_t3lib.'class.t3lib_div.php'): /Users/jo/Sites/introduction/t3lib/class.t3lib_div.php

Notice the lowercase u which is wrong here but works because of case insensitive file system.
This is the default website directory of my mac user account and many users trying out the introduction package might put the files there.

Inserting
if (class_exists('t3lib_div')) { return; }
in class.t3lib_div.php as proposed by Tolleiv did not help since at least on my system there where many strange "LF" outputs (as strings) all over the backend.

Actions #3

Updated by Joh. Feustel about 13 years ago

Since there where some objections against calling $_REQUEST directly v3 changes the require_once to call the file with absolute path using dirname(FILE).
Strange anough that getcwd() also returned wrong path with only one letter in lowercase as mentioned in my last comment.

Actions #4

Updated by Christa Pottfay about 13 years ago

Hi, some more information: I encountered similar problems on mac os x 10.5, php v. 5.3.0 (entropy-php), but not only with ajax.php.

First occurrence was with typo3 4.4.4, one day I could no longer login to backend. Curiously I could log in after reboot, but the next time I tried it was not possible again. After a next reboot - no login.
Php-error:
PHP Fatal error: Cannot redeclare class backend_toolbarItem in /Users/christa/Sites/typo3_src-4.4.4/typo3/interfaces/interface.backend_toolbaritem.php on line 36
PHP Stack trace:
PHP 1. {main}() /Users/christa/Sites/typo3_src-4.4.4/typo3/backend.php:0
PHP 2. include_once() /Users/christa/Sites/typo3_src-4.4.4/typo3/backend.php:744
PHP 3. require_once() /Users/christa/Sites/sca/typo3conf/ext/t3dev/class.tx_t3dev_additionalToolbarIcons.php:25

I deactivated extension t3dev and problem was solved. Then I updated to version 4.4.6 - same error with opendocs:
PHP Fatal error: Cannot redeclare class backend_toolbarItem in /Users/christa/Sites/typo3_src-4.4.6/typo3/interfaces/interface.backend_toolbaritem.php on line 36, referer: http://localhost/~christa/sca/typo3/index.php
PHP Stack trace:, referer: http://localhost/~christa/sca/typo3/index.php
PHP 1. {main}() /Users/christa/Sites/typo3_src-4.4.6/typo3/backend.php:0, referer: http://localhost/~christa/sca/typo3/index.php
PHP 2. include_once() /Users/christa/Sites/typo3_src-4.4.6/typo3/backend.php:744, referer: http://localhost/~christa/sca/typo3/index.php
PHP 3. include_once() /Users/christa/Sites/typo3_src-4.4.6/typo3/sysext/opendocs/registerToolbarItem.php:8, referer: http://localhost/~christa/sca/typo3/index.php
PHP 4. require_once() /Users/christa/Sites/typo3_src-4.4.6/typo3/sysext/opendocs/class.tx_opendocs.php:28, referer: http://localhost/~christa/sca/typo3/index.php

I solved the problem in deactivating opendocs, then I could login to the backend again. The php-error-log still lists errors referring to ajax.php, but I ecountered no problems in login and working in the backend.
Error-log:
PHP Fatal error: Cannot redeclare class t3lib_div in /Users/christa/Sites/typo3_src-4.4.6/t3lib/class.t3lib_div.php on line 230, referer: http://localhost/~christa/sca/typo3/backend.php
PHP Stack trace:, referer: http://localhost/~christa/sca/typo3/backend.php
PHP 1. {main}() /Users/christa/Sites/typo3_src-4.4.6/typo3/ajax.php:0, referer: http://localhost/~christa/sca/typo3/backend.php
PHP 2. require() /Users/christa/Sites/typo3_src-4.4.6/typo3/ajax.php:55, referer: http://localhost/~christa/sca/typo3/backend.php
PHP 3. require_once() /users/christa/Sites/typo3_src-4.4.6/typo3/init.php:200, referer: http://localhost/~christa/sca/typo3/backend.php

Today I made a new typo3-installation with version 4.5.2 - same problem as mentioned above (with ajax.php). Login was possible, but Error-Message "Module loader. No module found. If this is a temporary error, please reload the Backend!" is the only thing that appears.
Error-log:
PHP Fatal error: Cannot redeclare class t3lib_div in /Users/christa/Sites/typo3_src-4.5.2/t3lib/class.t3lib_div.php on line 230, referer: http://localhost/~christa/newsite/typo3/backend.php
PHP Stack trace:, referer: http://localhost/~christa/newsite/typo3/backend.php
PHP 1. {main}() /Users/christa/Sites/typo3_src-4.5.2/typo3/ajax.php:0, referer: http://localhost/~christa/newsite/typo3/backend.php
PHP 2. require() /Users/christa/Sites/typo3_src-4.5.2/typo3/ajax.php:55, referer: http://localhost/~christa/newsite/typo3/backend.php
PHP 3. require_once() /users/christa/Sites/typo3_src-4.5.2/typo3/init.php:200, referer: http://localhost/~christa/newsite/typo3/backend.php

Solved the problem as suggested. But I have no explanation why this started one day, because I can't remember having changed something on my system (no php-update, no typo3-update).

Actions #5

Updated by Xavier Perseguers about 13 years ago

I confirm this bug running:

PHP 5.3.6 from WebStart with those configuration options:

'./configure' '--prefix=/usr/local/webstart/sw/php-5.3' '--with-config-file-path=/usr/local/webstart/sw/php-5.3' '--with-apxs2=/usr/local/webstart/sw/apache2/bin/apxs' '--with-db4=/usr/local/webstart/sw/bdb/' '--with-kerberos=/usr' '--with-mcrypt=/usr/local/webstart/sw/lib-mcrypt' '--with-mhash=/usr/local/webstart/sw/mhash' '--with-ldap=/usr/local/webstart/sw/openldap' '--with-mysql=/usr/local/webstart/sw/mysql' '--with-mysql-sock=/tmp/mysql.sock' '--with-mysqli=/usr/local/webstart/sw/mysql/bin/mysql_config' '--with-pdo-mysql=/usr/local/webstart/sw/mysql' '--with-iodbc=/usr' '--with-zlib-dir=/usr' '--with-bz2' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--enable-shmop' '--enable-sockets' '--enable-mbstring' '--with-gettext=/usr/local/webstart/sw/gettext' '--enable-exif' '--with-jpeg-dir=/usr/local/webstart/sw/lib-jpeg' '--with-png-dir=/usr/local/webstart/sw/lib-png' '--with-freetype-dir=/usr/local/webstart/sw/freetype' '--with-gd' '--enable-gd-native-ttf' '--with-curl=/usr' '--enable-ftp' '--disable-rpath' '--with-xsl' '--enable-soap' '--enable-bcmath' '--enable-calendar' '--enable-cli' '--disable-debug' '--with-openssl' '--with-xmlrpc' '--with-iconv=/usr/local/webstart/sw/lib-iconv' '--with-mssql=/usr/local/webstart/sw/freetds'

Actions #7

Updated by Xavier Perseguers about 12 years ago

  • Status changed from Resolved to Closed
Actions #8

Updated by Ernesto Baschny almost 11 years ago

  • Target version deleted (1081)
Actions

Also available in: Atom PDF