OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Problem using import/export issues plugin

Are you responsible for making OJS work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

Forum rules
The Public Knowledge Project Support Forum is moving to http://forum.pkp.sfu.ca

This forum will be maintained permanently as an archived historical resource, but all new questions should be added to the new forum. Questions will no longer be monitored on this old forum after March 30, 2015.

Problem using import/export issues plugin

Postby Marc » Tue Jan 17, 2006 6:18 am

Hi everybody,

I'm using $Id: NativeImportDom.inc.php,v 1.13 2005/08/04 20:01:09 alec Exp$ to import issues en XML format on my box.

I've PHP 5.0.5 installed and I think it is the cause of my troubles, but I need it...
When I try to import it returns this message:

Fatal error: Only variables can be passed by reference in /dades/RACO/ojs-2.0.2-1/plugins/importexport/native/NativeImportDom.inc.php on line 565

Googleing I've found that there is a php bug with something about arrays.

I would know if I can to use the latest version of NativeImportDom.inc.php (1.24), if I need to change all the plugin import/export files or if there not yet solution...

Thanks a lot!

Marc
Marc
 
Posts: 34
Joined: Thu Jul 07, 2005 5:16 am
Location: Barcelona

Solution??

Postby Marc » Tue Jan 17, 2006 8:59 am

A work companion has told me a solution:

--- NativeImportDom.inc.php.ORIGINAL 2006-01-17 16:25:44.510736176 +0100
+++ NativeImportDom.inc.php 2006-01-17 16:27:58.500366656 +0100
@@ -562,8 +562,15 @@
return false;
}
$originalName = $embed->getAttribute('filename');
- if (($fileId = $articleFileManager->writePublicFile($originalName, base64_decode($embed->getValue()), $embed->getAttribute('mime_type')))===false) {
- $errors[] = array('plugins.importexport.native.import.error.couldNotWriteFile', array('originalName' => $originalName));
+//NTM 17-01-2006
+$ntm0=$embed->getValue();
+$ntm1=base64_decode($ntm0);
+$ntm2=$embed->getAttribute('mime_type');
+if (($fileId = $articleFileManager->writePublicFile($originalName,$ntm1, $ntm2))===false) {
+
+//if (($fileId = $articleFileManager->writePublicFile($originalName, base64_decode($embed->getValue()), $embed->getAttribute('mime_type')))===false) {
+
+ $errors[] = array('plugins.importexport.native.import.error.couldNotWriteFile', array('originalName' => $originalName));
return false;
}
}
Marc
 
Posts: 34
Joined: Thu Jul 07, 2005 5:16 am
Location: Barcelona

Postby asmecher » Tue Jan 17, 2006 2:50 pm

Hi Marc,

This isn't a PHP bug, it's a minor coding bug in OJS -- but recent changes to the way PHP handles references made this visible where before it was just ignored. (Different versions of PHP now complain in different situations without a lot of consistency.)

There's a scattering of these bugs through OJS, and fixing them is trivial. For example, instead of:
Code: Select all
function &myFunc() {
     return null;
}
you now have to write:
Code: Select all
function &myFunc() {
     $nullVariable = null;
     return $nullVariable;
}
Basically, some versions of PHP are now stricter about references: if your function definition says you'll be returning a variable reference, you absolutely must return one.

Our next release of OJS, which is due at the end of the month, has had a number of these issues corrected.

Regards,
Alec Smecher
Open Journal Systems Team
asmecher
 
Posts: 10015
Joined: Wed Aug 10, 2005 12:56 pm


Return to OJS Technical Support

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 1 guest