We are moving to Git Issues for bug tracking in future releases. During transition, content will be in both tools. If you'd like to file a new bug, please create an issue.

Bug 5028 - Cannot return string offsets by reference in DataObject.inc.php
Cannot return string offsets by reference in DataObject.inc.php
Status: RESOLVED DUPLICATE of bug 5029
Product: PKP-LIB
Classification: Unclassified
Component: General
Undetermined
PC Windows XP
: P3 normal
Assigned To: jerico
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-01-10 20:27 PST by jerico
Modified: 2010-01-11 19:23 PST (History)
0 users

See Also:
Version Reported In: 2.3.1
Also Affects:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jerico 2010-01-10 20:27:34 PST
Fatal error: Cannot return string offsets by reference in /lib/pkp/classes/core/DataObject.inc.php on line 57

see http://journal.ciiss.net/index.php/ciiss/about/editorialTeamBio/28 as an example.
Comment 1 jerico 2010-01-10 20:30:56 PST
Found the error while unit testing DataObject, then while researching the error on the web the above URL appeared high in the rankings. I'm wondering why we didn't get this bug report earlier. Seems to be something very basic...
Comment 2 jerico 2010-01-10 21:23:47 PST
@Alec: Here again - can you give me a hint how I'd best grep this?
Comment 3 jerico 2010-01-10 21:56:28 PST
#5015 fixes this for DataObject, will leave the bug open until we checked that the same condition doesn't apply elsewhere.
Comment 4 jerico 2010-01-11 19:23:25 PST
This is a duplicate of #5029. With #5029 in mind the error can be explained like this:

Assume that the data array is initialized like this:
$this->data['somekey'] = 'somevalue';

The wrong test condition described in #5029 (isset() without is_array()) allowed the following access to the array:
$result =& $this->data['somekey']['some_locale'];

Which PHP internally resolves to:
$result =& $this->data['somekey'][0];

This is obviously an error as you cannot return a reference to a string offset in PHP (this being the 0'th character of the content of $this->data['somekey'] (='s', the first letter of 'somevalue').

*** This bug has been marked as a duplicate of bug 5029 ***