php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57185 createDocument is creating a weird doc when one property has a null value
Submitted: 2006-08-18 11:30 UTC Modified: 2006-11-27 06:14 UTC
From: mfp@php.net Assigned: tuscany (profile)
Status: Closed Package: SCA_SDO (PECL)
PHP Version: 5.1.4 OS: WinXP
Private report: No CVE-ID: None
 [2006-08-18 11:30 UTC] mfp@php.net
Description:
------------
As part of generating the body of our soap request we use the special three-argument form of createDocument that takes an exising SDO. This is misbehaving when the SDO that it is passed contains a null.

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

$xsd = <<<EOF
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
  targetNamespace="http://ConvertedStockQuote">
  <xs:element name="getQuote">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="ticker" type="xs:string" nillable="true"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

EOF;
file_put_contents('bug.xsd',$xsd);

$xmldas        = SDO_DAS_XML::create('bug.xsd');
$get_quote_sdo = $xmldas->createDataObject('http://ConvertedStockQuote','getQuote');
$get_quote_sdo ->ticker = 'IBM';
$xdoc2         = $xmldas->createDocument(null, 'getQuote', $get_quote_sdo);
$xmlstr        = $xmldas->saveString($xdoc2,2);
echo $xmlstr;

$get_quote_sdo = $xmldas->createDataObject('http://ConvertedStockQuote','getQuote');
$get_quote_sdo ->ticker = null;
$xdoc2         = $xmldas->createDocument(null, 'getQuote', $get_quote_sdo);
$xmlstr        = $xmldas->saveString($xdoc2,2);
echo $xmlstr;
?>

Expected result:
----------------
In the result of the second echo I want to see a null ticker like this:

  <ticker xmlns="http://ConvertedStockQuote" xsi:nil="true"/>


Actual result:
--------------
What I actually see has getQuote where I expect to see ticker

<getQuote xmlns="http://ConvertedStockQuote" xsi:nil="true"/>

and what's more I have a getQuote embeddded in a getQUote. 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-09-07 06:31 UTC] cem@php.net
I created http://issues.apache.org/jira/browse/TUSCANY-705 for this
 [2006-10-17 12:23 UTC] cem@php.net
There's a Tuscany patch available at :
http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXMLWriter.cpp?r1=420798&r2=447403&pathrev=447403&view=patch

This should be rolled up in the next release.
 [2006-11-27 06:14 UTC] cem@php.net
Thank you for your bug report. This issue has been fixed
in the latest released version of the package, which you can download at
http://pecl.php.net/get/SCA_SDO

Release 1.1.0 includes this fix.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 19:01:30 2024 UTC