Bug 6552 - error msg while adding author in editing submission metadata
error msg while adding author in editing submission metadata
Status: RESOLVED FIXED
Product: OCS
Classification: Unclassified
Component: Editing
2.3.4
All All
: P5 critical
Assigned To: PKP Support
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-03-29 07:55 PDT by Renato Mendes
Modified: 2011-05-03 14:14 PDT (History)
2 users (show)

See Also:
Version Reported In:
Also Affects:


Attachments
Patch against OCS 2.3.3-1 (583 bytes, patch)
2011-05-03 14:14 PDT, Alec Smecher
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Renato Mendes 2011-03-29 07:55:10 PDT
DB Error: Column 'paper_id' cannot be null
Comment 1 Renato Mendes 2011-05-03 12:14:28 PDT
Solution is to add the missing "&" in ocs/classes/submission/form/MetadataForm.inc.php at line 217:

-				$author = new Author();
+				$author = &new Author();
Comment 2 Alec Smecher 2011-05-03 12:31:45 PDT
Renato, are you using PHP 4.x? In PHP 5.x, the "$var = &new ClassName" syntax (instantiation by reference) is deprecated. To work around this for both PHP4 and PHP5, use a conditional like the following:

if (checkPhpVersion('5.0.0')) { // WARNING: This form needs $this in constructor
   $var = new ClassName();
} else {
   $var =& new ClassName();
}

Can you confirm if this works for you?
Comment 3 Renato Mendes 2011-05-03 12:43:17 PDT
Alec, yes we use PHP 4.4.9. I replaced

$author = &new Author();

for the conditional statement

if (checkPhpVersion('5.0.0')) { // WARNING: This form needs $this in constructor
			   $author = new Author();
		} else {
			   $author =& new Author();

And it is working.
Comment 4 Alec Smecher 2011-05-03 14:14:14 PDT
Created attachment 3504 [details]
Patch against OCS 2.3.3-1
Comment 5 Alec Smecher 2011-05-03 14:14:36 PDT
Fixed.