php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57765 getSequence() returns null with a complexType defined without mixed="true"
Submitted: 2007-08-01 13:15 UTC Modified: 2017-01-10 08:07 UTC
From: mattsch at gmail dot com Assigned:
Status: Suspended Package: SCA_SDO (PECL)
PHP Version: 5.2.3 OS: Gentoo Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: mattsch at gmail dot com
New email:
PHP Version: OS:

 

 [2007-08-01 13:15 UTC] mattsch at gmail dot com
Description:
------------
getSequence() returns null with a complexType defined without mixed="true".

Reproduce code:
---------------
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
  xmlns:letter="http://letterSchema"
  targetNamespace="http://letterSchema">
  <xs:element name="letters" type="FormLetter"/>
  <xs:complexType name="FormLetter">
      <xs:sequence>
      <xs:element name="date" minOccurs="1" type="xs:string"/>
      <xs:element name="firstName" minOccurs="1" type="xs:string"/>
      <xs:element name="lastName" minOccurs="1" type="xs:string"/>
    </xs:sequence>
  </xs:complexType>
</xs:schema>

<?php
/**
 * Create an XML document from scratch
 */
try {
   $xmldas = SDO_DAS_XML::create("letter.xsd");
   try {
       $doc = $xmldas->createDocument();
       $rdo = $doc->getRootDataObject();
       $seq = $rdo->getSequence();
       $seq->insert("April 09, 2005", NULL, 'date');
       $seq->insert("Tarun", NULL, "firstName");
       $seq->insert("Nayaraaa", NULL, "lastName");
       $rdo->lastName = "Nayar";
       print($xmldas->saveString($doc));
   } catch (SDO_Exception $e) {
       print($e);
   }
} catch (SDO_Exception $e) {
   print("Problem creating an XML document: " . $e->getMessage());
}
?>


Expected result:
----------------
<?xml version="1.0" encoding="UTF-8"?>
<letters xmlns="http://letterSchema" xmlns:tns="http://letterSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><date>April 09, 2005</date><firstName>Tarun</firstName><lastName>Nayar</lastName></letters>


Actual result:
--------------
Fatal error: Call to a member function insert() on a non-object in letter.php on line 11

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-08-01 13:25 UTC] mattsch at gmail dot com
There wasn't a choice for 5.2.3.  Changing version.
 [2007-08-01 17:09 UTC] lowt at bigfoot dot com
Looking at the code, SDOSchemaSAX2Parser::startComplexType, and SDOSchemaSAX2Parser::defineType appears to be the two places that isSequenced is set.  In startComplexType, it appears that both mixed and sequence are both treated as an attribute.  We cannot tell if it ever reads the child <sequence>,

It appears that isSequenced should be set to true on the basis of the child <sequence> and not on the basis of mixed.
 [2007-08-02 11:15 UTC] mattsch at gmail dot com
Since this seems to a be a Tuscany problem, here's a link:

https://issues.apache.org/jira/browse/TUSCANY-1504
 [2007-08-02 12:10 UTC] mfp@php.net
Matt, I'm impressed! You've raised the defect, investigated and pinpointed the problem, and passed the problem on to Tuscany, all in double-quick time. There's nothing left to do :-)
 [2017-01-10 08:07 UTC] kalle@php.net
-Status: Assigned +Status: Suspended -Assigned To: tuscany 1504 +Assigned To:
 [2017-01-10 08:07 UTC] kalle@php.net
Suspending this report as the extension have not had a release for almost 9 years.  Please revive this if the extension once again shows life
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Apr 28 21:01:29 2024 UTC