[vbox-dev] Problems w/ the vboxServiceWrappers.php module

Joseph Smith joseph1962smith at yahoo.com
Fri Dec 4 21:14:53 GMT 2009


Hi James,
Thanks for the quick response!
Here are my system details:
Host: openSuSe 11.1PHP: PHP 5.2.11 with Suhosin-Patch 0.9.7 (cli) (built: Sep 24 2009 12:37:34)
Regarding being verbose ... you are absolutely correct.  That is actually a residue of my converting from the classes I had written before your generated version was published.  Thanks for the reminder ... I'll adjust my code.
Once you have had a chance to look at this and possibly made any updates ... I would be happy to run through a suite of quick tests before you release ... just drop me a note.

Thanks,Joe

--- On Fri, 12/4/09, James Lucas <jimmy at secsme.org.au> wrote:

From: James Lucas <jimmy at secsme.org.au>
Subject: Re: [vbox-dev] Problems w/ the vboxServiceWrappers.php module
To: "Joseph Smith" <joseph1962smith at yahoo.com>
Cc: vbox-dev at virtualbox.org
Date: Friday, December 4, 2009, 4:06 PM

Hi Joseph,

I'll take a look at all of these by Monday (I am away about to leave on a
weekend holiday with no laptop).

Can you please tell me your PHP version / OS. There should be no need to perform
a type cast to array in the return val as the collection class should handle
that, however it does make sense just to add it as a safety.

The last issue with Progress I'll have to have a think about. The XIDL code is 

    <attribute name="object" type="$unknown" readonly="yes">
      <desc>
        Object this metric belongs to.
      </desc>
    </attribute>

Which as you see doesn't define a class. I'll have to think how to handle this.

Just a final note. You don't need to be as verbose on the function calls there
are magic __get and __set methods for instance variables (Have a look at the
sample code which takes a screen shot of a running vm).

$mediumAttachmentRefList = $machine->getMediumAttachments (); can become
$mediumAttachmentRefList = $machine->mediumAttachments;

- James

Quoting Joseph Smith <joseph1962smith at yahoo.com>:

> Hi,
> I've been working extensively on a PHP web interface using the virtual box
> webservice APIs.  I had already completed a working version of a base class
> that handled interaction with the APIs using raw Soap calls ... but then came
> the generated vboxServiceWrappers.php module.  I've been modifying my code to
> use the wrappers ... but have found some problems.
> I have opened Ticket #5657 with an explanation of the issues I have found.
> In talking w/ the dev team on IRC, it was suggested I drop a note to this
> list and include mjlucas on 'cc'.
> For your convenience, here is the contents of the ticket I opened:
> Ticket #5657 (new defect)Opened 1 day agoProblems with
> vboxServiceWrappers.php moduleReported by:joseph1962smithAssigned
> to:Priority:majorComponent:webservicesVersion:VirtualBox
> 3.1.0Keywords:vboxServiceWrappers.phpCc:Guest type:LinuxHost
> type:LinuxDescriptionA number of issues have been detected with the PHP
> wrapper module. Many of the instances are related to a single class and by
> addressing that issue, it should address a large number of them.The problems
> I describe below may also exist in other SDK wrappers as the wrappers are
> generated from presumably the same code-base.Where possible, I have provided
> one possible solution approach to the problem but is not the only way the bug
> can be fixed.For Possible solutions, the typecasting in many cases to an
> array by using '(array)' vs 'array ( ... )' will depend on whether the
> data-element is an array of objects vs an array of references to an object.
> Bugs:
> //
>
---------------------------------------------------------------------getDVDDrives
> method of the IHost object incorrectly tries to build the IMediumCollection
> object .. - Should pass an array of items for parameter number 2 ... not a
> string.Current code:return new IMediumCollection ($this->connection,
> $response->returnval);Possible Solutions:return new IMediumCollection
> ($this->connection, (array) $response->returnval);
> //
>
---------------------------------------------------------------------getFloppyDrives
> method of the IHost object incorrectly tries to build the IMediumCollection
> object .. - Should pass an array of items for parameter number 2 ... not a
> string.Current code:return new IMediumCollection ($this->connection,
> $response->returnval);Should Be:return new IMediumCollection
> ($this->connection, array ($response->returnval));
> //
>
---------------------------------------------------------------------getFloppyImages
> method of the IVirtualBox object incorrectly tries to build the
> IMediumCollection object .. - Should pass an array of items for parameter
> number 2 ... not a string.Current code:return new IMediumCollection
> ($this->connection, $response->returnval);Should Be:return new
> IMediumCollection ($this->connection, (array)$response->returnval);
> //
>
---------------------------------------------------------------------IMediumCollection
> in general: It seems when an IMedium collection is used, an array of
> reference IDs (handles) is returned rather than an array of IMedium
> objects.e.g: Array ([0] '20e6f88ea0bffc6d-0000000000000822'[1]
> '20e6f88ea0bffc6d-0000000000000823'[2] '20e6f88ea0bffc6d-0000000000000824'[3]
> '20e6f88ea0bffc6d-0000000000000825'[4]
> '20e6f88ea0bffc6d-0000000000000826')The work-around for
> IMediumAttachment::getMedium below can allow developers to build the IMedium
> object on-the-fly if this scenario should happen.IMediumAttachment::getMedium
> method retuns a string (with the handle for the IMedium object) rather than
> returning the IMedium object.Work-Around:$mediumAttachmentRefList =
> $machine->getMediumAttachments ();foreach ($mediumAttachmentRefList as
> $mediumAttachmentRef){    $mediumRef = $mediumAttachmentRef->getMedium ();    //
> BUG w/ 3.1 APIs ... mediumRef should be an object    //
>  however, an internal reference pointer string is returnd    // handle for both
> string and object until it's fixed    if (!is_object ($mediumRef))        $mediumRef =
> new IMedium ($this->connection, $mediumRef);
>     ...    ...}
> NOTE: The work-around above assumes $machine is valid and is of type
> IMachine
> //
>
---------------------------------------------------------------------IMedium::getMachineIds
> type-casts to string which is not correct.Current code:return
> (string)$response->returnval;Should Bereturn (array)$response->returnval;
> //
>
---------------------------------------------------------------------getSharedFolders
> method of the IVirtualBox object incorrectly tries to build the
> ISharedFolderCollection object .. - Should pass an array of items for
> parameter number 2 ... not a string.Current code:return new
> ISharedFolderCollection ($this->connection, $response->returnval);Should
> Be:return new ISharedFolderCollection ($this->connection, (array)
> $response->returnval);
> //
>
---------------------------------------------------------------------getDHCPServers
> method of the IVirtualBox object incorrectly tries to build the
> IDHCPServerCollection object .. - Should pass an array of items for parameter
> number 2 ... not a string.Current code:return new ISharedFolderCollection
> ($this->connection, $response->returnval);Should Be:return new
> IDHCPServerCollection ($this->connection, (array) $response->returnval);
> //
>
---------------------------------------------------------------------getProgressOperations
> method of the IVirtualBox object incorrectly tries to build the
> IProgressCollection object .. - Should pass an array of items for parameter
> number 2 ... not a string.Current code:return new ISharedFolderCollection
> ($this->connection, $response->returnval);Should Be:return new
> IProgressCollection ($this->connection, (array) $response->returnval);
> 
> //
>
---------------------------------------------------------------------getObject
> method on the IPerformanceMetric class attempts to return an 'unknown'
> object
> //
>
---------------------------------------------------------------------getInitiator
> method on the IProgress class attempts to return a '$unknown' object ... but
> $unknown is not defined.
> 
> 
> 
>       


--
UTS CRICOS Provider Code:  00099F
DISCLAIMER: This email message and any accompanying attachments may contain
confidential information.  If you are not the intended recipient, do not
read, use, disseminate, distribute or copy this message or attachments.  If
you have received this message in error, please notify the sender
immediately and delete this message. Any views expressed in this message
are those of the individual sender, except where the sender expressly, and
with authority, states them to be the views the University of Technology,
Sydney. Before opening any attachments, please check them for viruses and
defects.



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.virtualbox.org/pipermail/vbox-dev/attachments/20091204/b81bb4b1/attachment.html>


More information about the vbox-dev mailing list