Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined Offset 21 - PropertyMetadata (master) #581

Closed
ghost opened this issue May 9, 2016 · 0 comments
Closed

Undefined Offset 21 - PropertyMetadata (master) #581

ghost opened this issue May 9, 2016 · 0 comments

Comments

@ghost
Copy link

ghost commented May 9, 2016

i get an 'Undefined Offset 21' Exception during unserializing. I think the problem depends on the mix of different index key types (numeric, and strings). After unserializing i get an array with 22 elements, and all array keys are integers, expect the 'xmlEntryNamespace' key.That's the reason, why an index 21 does not exists. the array structure looks like this.

array(
0 => '...',
1 => '....',
xmlEntryNamespace => '...',
2 => '.....'
...
20 => '...'
)

i found a solution, but i am not familar how to contribute and share my solution. Everything works fine, if i change the following methods in the PropertyMetadata Class.

`
public function serialize()
{
return serialize(array(
$this->sinceVersion,
$this->untilVersion,
$this->groups,
$this->serializedName,
$this->type,
$this->xmlCollection,
$this->xmlCollectionInline,
$this->xmlEntryName,
$this->xmlEntryNamespace,
$this->xmlKeyAttribute,
$this->xmlAttribute,
$this->xmlValue,
$this->xmlNamespace,
$this->xmlKeyValuePairs,
$this->xmlElementCData,
$this->getter,
$this->setter,
$this->inline,
$this->readOnly,
$this->xmlAttributeMap,
$this->maxDepth,
parent::serialize()
));
}

public function unserialize($str)
{
$unserialized = unserialize($str);
list(
$this->sinceVersion,
$this->untilVersion,
$this->groups,
$this->serializedName,
$this->type,
$this->xmlCollection,
$this->xmlCollectionInline,
$this->xmlEntryName,
$this->xmlEntryNamespace,
$this->xmlKeyAttribute,
$this->xmlAttribute,
$this->xmlValue,
$this->xmlNamespace,
$this->xmlKeyValuePairs,
$this->xmlElementCData,
$this->getter,
$this->setter,
$this->inline,
$this->readOnly,
$this->xmlAttributeMap,
$this->maxDepth,
$parentStr
) = $unserialized;
if (isset($unserialized[8])){
$this->xmlEntryNamespace = $unserialized[8];
}
parent::unserialize($parentStr);
}
`

What do yout thing about this approach? is this to pragmatic? How can I contribute and place my possible solution?

Regards
Nico

@ghost ghost closed this as completed May 9, 2016
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants