php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57377 Serialise then unserialise fails
Submitted: 2006-11-15 10:47 UTC Modified: 2006-11-17 12:08 UTC
From: mfp@php.net Assigned: cem (profile)
Status: Closed Package: SCA_SDO (PECL)
PHP Version: 5.1.6 OS: WinXP
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: mfp@php.net
New email:
PHP Version: OS:

 

 [2006-11-15 10:47 UTC] mfp@php.net
Description:
------------
I have an xsd that defines an element that can be empty. I can create an object to match OK but if I serialize it it will not de-serialize.

I knwo the example looks a little odd but this is a simplified version of what we do when we construct WSDL for a method that takes no parameters - you get an empty element. 

If you can suggest a better way to code the element definition, one that will not cause this problem to occur, then that would be a satisfactory solution.

Just coding <xs:element name="testTriggerEvent"/> is no better, by the way.

Reproduce code:
---------------
<?php

echo phpversion('sdo') . "\n";
$wsdl = <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
      targetNamespace="http://AnnotationTest">
      <xs:element name="testTriggerEvent">
        <xs:complexType>
          <xs:sequence>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:schema>
EOF;

file_put_contents('bug.wsdl',$wsdl);

$xmldas            = SDO_DAS_XML::create('bug.wsdl');
$doc               = $xmldas->createDocument('testTriggerEvent');
$root              = $doc->getRootDataObject();
$serialized_root   = serialize ($root);
$unserialized_root = unserialize($serialized_root);
?>

Expected result:
----------------
I expect the object to de-serialize without any bother and definitely no exception to be thrown.

Actual result:
--------------
1.0.4
<br />
<b>Fatal error</b>:  Uncaught exception 'SDO_Exception' with message 'The referenced object is null ' in C:\Program Files\Apache Group\Apache2\htdocs\MyService\AnnotationTest\bug.php:23
Stack trace:
#0 C:\Program Files\Apache Group\Apache2\htdocs\MyService\AnnotationTest\bug.php(23): unserialize('C:18:&quot;SDO_DataO...')
#1 C:\Program Files\Zend\ZendStudioClient-5.1.0\bin\php5\dummy.php(1): include('C:\Program File...')
#2 {main}
  thrown in <b>C:\Program Files\Apache Group\Apache2\htdocs\MyService\AnnotationTest\bug.php</b> on line <b>23</b><br />

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-11-17 10:55 UTC] cem@php.net
I've discussed this with the Apache Tuscany folks, and we've determined that the problem is that the targetNamespace is missing from the serialized form. The consequence was that when the data was unserialized, there was apparently no root data object, and this caused the exception. 

I've checked in an update for this to CVS HEAD, which fixes your testcase for me. Could you try this out, please?
 [2006-11-17 11:30 UTC] mfp@php.net
Thank you, much better. All my tests run cleanly now.
 [2006-11-17 12:08 UTC] cem@php.net
This bug has been fixed in CVS.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pecl.php.net.

In case this was a pecl.php.net website problem, the change will show
up on the website in short time.
 
Thank you for the report, and for helping us make PECL better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 13:01:30 2024 UTC