php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57153 Adding child object issues errors
Submitted: 2006-07-24 23:30 UTC Modified: 2006-10-30 06:36 UTC
From: mim at serverconnect dot org Assigned: slaws (profile)
Status: Closed Package: SCA_SDO (PECL)
PHP Version: 5.1.2 OS: Debian GNU/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: mim at serverconnect dot org
New email:
PHP Version: OS:

 

 [2006-07-24 23:30 UTC] mim at serverconnect dot org
Description:
------------
SDO version: 1.0.2
PHP version: 5.1.4 (PECL form did not list 5.1.4!)

The following test seems to work but ugly warnings appear, and it also seems executePreparedQuery() outputs a couple of unexpected spaces when run with PHP's CLI.



Reproduce code:
---------------
<?php
/*
MySql statements:

CREATE DATABASE sdo_user;

USE sdo_user;

CREATE TABLE `Mbr` (
    `id` INTEGER auto_increment,
    `name` VARCHAR( 40 ) NULL,
    PRIMARY KEY ( `id` )
    ) COMMENT = 'Members';

CREATE TABLE `Profile` (
    `id` INTEGER auto_increment,
    `parent` VARCHAR( 40 ) NOT NULL,
    `address` VARCHAR( 100 ) NULL,
    PRIMARY KEY ( `id` )
    ) COMMENT = 'Contact address details';

INSERT INTO Mbr VALUES(NULL, "Jimmy");
*/
// Member table structure
$mbr = array(
    'name' => 'Mbr',
    'columns' => array('id', 'name'),
    'PK' => 'id'
    );

// Profile table structure
$profile = array (
    'name' => 'Profile',
    'columns' => array('id', 'parent', 'address'),
    'PK' => 'id',
    'FK' => array ('from' => 'parent', 'to' => 'Mbr')
    );

$table_lib = array($mbr, $profile);

// Table containment structure
$table_tree = array('parent' => 'Mbr', 'child' => 'Profile');

// Constants
define('PDO_DSN', 'mysql:host=localhost;dbname=sdo_user');
define('DATABASE_USER', 'mim');
define('DATABASE_PASSWORD', '????????');

// Get SDO/DAS

require 'SDO/DAS/Relational.php';

$dbh = new PDO(PDO_DSN, DATABASE_USER, DATABASE_PASSWORD);
$das = new SDO_DAS_Relational($table_lib, 'Mbr', array($table_tree));

$pdo_stmt = $dbh->prepare('select id from Mbr where name=?');
echo ":Odd spaces start (PHP CLI):";
$root = $das->executePreparedQuery($dbh, $pdo_stmt, array('Jimmy'), array('Mbr.id'));
echo ":Odd spaces end:";
$mbr = $root['Mbr'][0];
$profile = $mbr->createDataObject('Profile');
$profile->address = 'Somewhere';
$das->applyChanges($dbh, $root);
echo "Done\n";
?>

Expected result:
----------------
Done

Actual result:
--------------
:Odd spaces start (PHP CLI):  :Odd spaces end:PHP Notice:  Undefined variable: settings_as_array in /usr/local/lib/php/SDO/DAS/Relational/SettingListHelper.php on line 42

Notice: Undefined variable: settings_as_array in /usr/local/lib/php/SDO/DAS/Relational/SettingListHelper.php on line 42
PHP Warning:  array_key_exists(): The second argument should be either an array or an object in /usr/local/lib/php/SDO/DAS/Relational/UpdateAction.php on line 80

Warning: array_key_exists(): The second argument should be either an array or an object in /usr/local/lib/php/SDO/DAS/Relational/UpdateAction.php on line 80
Done


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-07-25 05:25 UTC] simonslaws at googlemail dot com
Thanks mim for reporting this. Looks like there is a bit of tidying that needs doing. I'm looking at the other open bugs for SDO so I'll take a look at this.
 [2006-07-27 13:01 UTC] simonslaws at googlemail dot com
The blank spaces come from the end of the file
PDOConstants.colon.inc.php. I will remove.

There are also some at the end of PDOConstants.underscore.inc.php.

The warnings are generated because SettingListHelper::getSettingsAsArray() doesn't initialize
$settings_as_array as an array. 

I will make the fixes.
 [2006-08-09 07:15 UTC] simonslaws at googlemail dot com
Fixed in 1.0.3
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 11:01:29 2024 UTC