Supporting each other

Community forums

Welcome, Guest
Username: Password: Remember me
Report any technical problems you discover and discuss solutions.
  • Page:
  • 1
  • 2

TOPIC:

Upgrading from Xerte v1 to v2.0 - problem with pre 11 years 3 weeks ago #920

  • Kalle
  • Kalle's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 17
  • Thank you received: 0
Dear all,

I am upgrading from Xerte v1 to Xerte v2 and have run into viewing problems with some learning objects created in v1. I have tracked down the problem to the ampersand character in the preview.xml. I think v1 did not encode ampersand properly as it is stored as a plain character whilst other special characters are encoded with html encoding. The preview fails if the learning object contains an ampersand. I have searched the forums and internet without finding any answers.

Has anyone experienced the same problem?

The way preview.xml is handled seems to have changed between v.1 and v.2.
Version 2 uses the SimpleXml_from_string() function.


I have tracked it down to the file /website_code/php/xmlInspector.php.
Around line 130, we have the call:
$this->xml = simplexml_load_string($xml);

This call fails if the text contains an ampersand ("&").
I have a fix for it though….

This is how to replicate the problem:
1. Create a learning object in v1.
2. Include an hotspot item . Make sure the hotspot has a "&" in it.
Example:

<hotspot name="Videos & podcasts" text=" There are loads of free videos and podcasts available to download online." x="560.4703125" y="335.7203125" w="192.652890625" h="95.729453125" />

3. Save it.
4. Copy the USER-FILES folder and import the database to v.2.
5. Try to preview the learning object in v.2. This should result in an HTTP Error 500


These are my server details:

Windows Server 2008
Apache 2.2
PHP 5.2.10
MySQL Ver 14.14 Distrib 5.1.38, for Win64 (unknown)
Xerte 2.0 (svn r1087)

Please Inloggen or Create an account to join the conversation.

Last edit: by Kalle.

Upgrading from Xerte v1 to v2.0 - problem with ore 11 years 3 weeks ago #921

  • tom
  • tom's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 1286
  • Thank you received: 324
Yes, this is a known issue and the code should have handled it. I'm not at my desk right now, but I'll check it tonight. I'll let you know where this is supposed to be handled.

Tom

Please Inloggen or Create an account to join the conversation.

Upgrading from Xerte v1 to v2.0 - problem with ore 11 years 3 weeks ago #923

  • tom
  • tom's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 1286
  • Thank you received: 324
Hi,

The $this->xml = simplexml_load_string($xml); line is at line 139 in my version, and just above it is the code that tries to fix this issue, starting at line 125.

If you don't have this in your code, could you try to pickup the latest 2.0 (or 2.1-beta) from this site (from resources->Downloads)

If you have this code, it doesn't solve your particular issue, would you mind setting $development to true in config.php (line 26 ) and make sure the debug log file (defined on line 33) is at a location the webserver has write permissions, and send the contents of the log to me, or post it here?

Please Inloggen or Create an account to join the conversation.

Upgrading from Xerte v1 to v2.0 - problem with ore 11 years 2 weeks ago #933

  • Kalle
  • Kalle's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 17
  • Thank you received: 0
If have tried both v2.0 and 2.1beta but the Edit, Preview, Delete, Duplicate buttons etc in My Projects are disabled. I have cleared my Firefox cache as suggested here

www.xerte.org.uk/index.php?option=com_ku...temid=759&lang=en#41

without luck. Any ideas of how to get them enabled?

Edit
The reason why the buttons were disabled was that I forgot to change the site_url.
To fix it, run
SELECT * FROM xerte.xt_sitedetails;

and make sure that the
site_url
has the correct value.

Please Inloggen or Create an account to join the conversation.

Last edit: by Kalle.

Upgrading from Xerte v1 to v2.0 - problem with ore 10 years 11 months ago #992

  • Kalle
  • Kalle's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 17
  • Thank you received: 0
I've updated to Xerte version 2.1 (git git-82-g70282af).

I've have these lines which I assume is the fix:
if (!$this->isValidXml($xml)) {
    // Try and  fix it ?
    _debug("Invalid XML found; trying to repair");		
    $ok = $this->fixXmlFile($name);
    if ($ok === false) {
        // Could not fix it!
        _debug("Could not fix up the xml file with $name; consult error logs etc.");
    }
    else {
    // reload.
    $xml = file_get_contents($name);
    }
}
$this->xml = simplexml_load_string($xml);

I do a
var_dump($this->xml);
after the fix and this returns
bool(false)
.
The output of
libxml_get_errors();
array(4) { 
	[0]=> object(LibXMLError)#8 (6) 
	{ 	["level"]=> int(3) 
		["code"]=> int(68) 
		["column"]=> int(2321)
		["message"]=> string(27) "xmlParseEntityRef: no name " 
		["file"]=> string(0) "" 
		["line"]=> int(1) 
	} 
	[1]=> object(LibXMLError)#20 (6) 
	{ 	["level"]=> int(3) 
		["code"]=> int(68) 
		["column"]=> int(3381) 
		["message"]=> string(27) "xmlParseEntityRef: no name " 
		["file"]=> string(0) "" 
		["line"]=> int(1) 
	} 
	[2]=> object(LibXMLError)#19 (6) 
	{ 	["level"]=> int(3) 
		["code"]=> int(68) 
		["column"]=> int(2321) 
		["message"]=> string(27) "xmlParseEntityRef: no name " 
		["file"]=> string(0) "" 
		["line"]=> int(1) 
	} 
	[3]=> object(LibXMLError)#18 (6) 
	{ 	["level"]=> int(3) 
		["code"]=> int(68) 
		["column"]=> int(3381) 
		["message"]=> string(27) "xmlParseEntityRef: no name " 
		["file"]=> string(0) "" 
		["line"]=> int(1) 
	} 
}


This is the output of the debug.log file which I have anonymised:
2013-12-02 16:42:37 \website_code\php\xmlInspector.php111Trying to simplexml_load_file : USER-FILES/357-staff-Nottingham/preview.xml
2013-12-02 16:42:37 \website_code\php\xmlInspector.php95Error detected in XML :  : line 1, col:2321, message:xmlParseEntityRef: no name
, : line 1, col:3381, message:xmlParseEntityRef: no name

2013-12-02 16:42:37 \website_code\php\xmlInspector.php132Invalid XML found; trying to repair
2013-12-02 16:42:37 \xerte\website_code\php\xmlInspector.php51We were able to fixup the file : USER-FILES/357-staff-Nottingham/preview.xml

Any suggestions?

Please Inloggen or Create an account to join the conversation.

Last edit: by Kalle.

Upgrading from Xerte v1 to v2.0 - problem with ore 10 years 11 months ago #994

  • tom
  • tom's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 1286
  • Thank you received: 324
Could you send me the file USER-FILES/357-staff-Nottingham/preview.xml
(There seems to be an issue at position 2321 and at position 3381 in that file)

Please Inloggen or Create an account to join the conversation.

  • Page:
  • 1
  • 2
Moderators: ronmjultenJohnSmith
Time to create page: 0.051 seconds
Copyright © 2024 The Xerte Project.
Xerte logo Apereo logo OSI Logo

Search