[TYPO3] gb_weather php5 domxml workaround

Alexander Heidl aheidl at fulcio.co.uk
Fri Nov 3 16:39:10 CET 2006


For those who also ran into a php5 compatibility problem with the latest 
gb_waether (1.0.0. stable) extension I have found a workaround.

The Problem:
 From within the gb_weather extension class.weather_collector.php on or 
around line 430 the function domxml_open_mem(). This causes the 
extension produce the following error message:

Fatal error: Call to undefined function domxml_open_mem() in 
/path/to/typo3/typo3conf/ext/gb_weather/pi1/class.weather_collector.php 
on line 430

Reason:
Although undocumented, domxml_open_mem does not exist in PHP5. A 
workaround is needed. checking www.php.net for further info a nice 
workaround script is available.

Solution:
A guy named Alexandre Alapetite has originally made a nice script for 
simulating the missing functions in php5, especially when migrating from 
php4. However, this is useful for us as this can be included with a 
little hacking:

1.
Go to 
http://alexandre.alapetite.net/doc-alex/domxml-php4-php5/index.en.html 
and download the domxml-php4-to-php5.php script.

2.
Place the script in the pi1 directory of gb_weather besides 
class.weather_collector.php

3.
Include the script inside class.weather_collector.php at or around line 
429, just after "function xml2array($xml ) {" by adding the following lines:
// MOD PHP5 compatibility
if (version_compare(PHP_VERSION,'5','>=')) { 
require_once('domxml-php4-to-php5.php'); }
// MOD END

4.
Clear cash and reload page. Job done.

BR,

Alex Heidl
www.dental-offer.com




More information about the TYPO3-english mailing list