Discussion:
I suppose I can't put an SDO into the session...
Matthew Peters
2007-10-25 13:05:31 UTC
Permalink
I just thought I would raise this in case anyone had seen anything
similar:

The following little script is crashing for me, both under Zend Studio
and under Apache. If I take out the last line - assignment into the
session - I no longer get a crash. And if I add the document $doc into
the session instead of the SDO $cart it works fine. I guess I have to
always add the document, not the SDO.


<?php
include "SCA/SCA.php";
session_start();
$xmldas = SDO_DAS_XML::create(dirname(__FILE__) . '/../Schema/
Cart.xsd');
$doc = $xmldas->createDocument('cart');
$new_cart = $doc->getRootDataObject();
$item = $new_cart->createDataObject('item');
$item->itemId = 1;
$item->quantity = 1;
$item->description = "My very own item";
$_SESSION['cart'] = $new_cart;
?>
cem
2007-10-26 09:25:15 UTC
Permalink
Post by Matthew Peters
The following little script is crashing for me, both under Zend Studio
and under Apache. If I take out the last line - assignment into the
session - I no longer get a crash. And if I add the document $doc into
the session instead of the SDO $cart it works fine. I guess I have to
always add the document, not the SDO.
Hi - this is supposed to work - the SDO gets serialized into the
session. There's a phpunit test which shows it working. Most likely
you've revealed a memory management problem in the extension. Is it
possible to make your schema available for debugging?
Matthew Peters
2007-10-29 17:26:49 UTC
Permalink
Caroline, thanks for answering. I am actually glad that it is supposed
to work since I know it has worked for someone else - the person who
gave me the code in the first place.

The schema Cart.xsd is


<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:cart="urn::cartNS"
xmlns:cust="urn::customerNS"
targetNamespace="urn::cartNS">

<annotation>
<documentation>
+-----------------------------------------------------------------------------
+
| (c) Copyright IBM Corporation 2006,
2007 |
| All Rights
Reserved. |
+-----------------------------------------------------------------------------
+
| Licensed under the Apache License, Version 2.0 (the "License"); you
may not |
| use this file except in compliance with the License. You may obtain
a copy |
| of the License at
- |
|
|
| http://www.apache.org/licenses/LICENSE-2.0
|
|
|
| Unless required by applicable law or agreed to in writing,
software |
| distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT |
| WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied. |
| See the License for the specific language governing permissions
and |
| limitations under the
License. |
+-----------------------------------------------------------------------------
+
| Authors: Graham Charters, Matthew
Peters |
|
|
+-----------------------------------------------------------------------------
+
$Id: Cart.xsd,v 1.3 2007/08/16 14:31:40 wangkzai Exp $
</documentation>
</annotation>

<include schemaLocation="Customer.xsd"/>

<complexType name="CartItemType">
<sequence>
<element name="itemId" type="integer"/>
<element name="description" type="string"/>
<element name="quantity" type="integer"/>
<element name="price" type="string"/>
</sequence>
</complexType>

<complexType name="CartType">
<sequence>
<element name="cartId" type="ID"/>
<element name="customerId" type="ID"/>
<element name="item" maxOccurs="unbounded"
type="cart:CartItemType"/>
<element name="deliveryOption" type="integer"/>
<element name="shipAddress" type="cust:AddressType" />
<element name="cartValue" type="string"/>
</sequence>
</complexType>

<complexType name="CartsType">
<sequence>
<element name="cart" maxOccurs="unbounded" type="cart:CartType"/>
</sequence>
</complexType>

<element name="cart" type="cart:CartType"/>
<element name="carts" type="cart:CartsType"/>
</schema>
Caroline Maynard
2007-11-02 12:02:05 UTC
Permalink
Post by Matthew Peters
Caroline, thanks for answering. I am actually glad that it is supposed
to work since I know it has worked for someone else - the person who
gave me the code in the first place.
The schema Cart.xsd is
I needed a Customer.xsd too, but the one I found in the eServiceStore
sample did the trick.

So the good news is that it wasn't a memory management problem (hard),
but a simple regression in Tuscany in their string handling, so they no
longer cope with a null being passed as root element name. I've sent
them a patch, and also checked in a guard to our Fulmar branch to make
sure we don't reach that bit of code.

Continue reading on narkive:
Search results for 'I suppose I can't put an SDO into the session...' (Questions and Answers)
10
replies
Breastfeeding dilemma....Could use some advice/experiences....?
started 2009-05-22 13:08:15 UTC
newborn & baby
Loading...