Hi James,
I have uncovered a problem with the IPerformanceCollector class
(queryMetricsData method) that casuses a fatal error.
I am including the vbox-dev community as I believe the change I recommend below
might help someone else.
First ... I am actually still using version 3.1.0 (I don't like to jump on the
latest releases too quickly unless there are serious probs that force me to).
Anyway ... I encountered a problem with ver 3.1.0 where that version was trying
to instantiate the abstract class 'VBox_ManagedObjectCollection' rather than
the 'IPerformanceMetricCollection' class. To work around this, I corrected
this today in my local copy by changing from the abstract class to the
'IPerformanceMetricCollection' and all was
well.
So I decided to go ahead and upgrade to ver 3.1.2. Since the APIs did not
change too much ... I decided to take the chance and do a quick test by using
the 3.1.2 vboxServiceWrappers against my version 3.1.0 VirtualBox environment
(again ... I don't like rushing into upgrading and figured the diff was not too
big ...).
In doing this ... I have found a problem with version 3.1.2
vboxServiceWrappers.php.
In version 3.1.2, the queryMetricsData method, when returning the result set,
attempts to instantiate an invalid collection (Line #6102): 'new
$unknownCollection'. This object is not defined and as a result is causing an
error. Interestingly, the name of the variable in the signature is called
'unknown' ... so I think that might be part of the problem.
Like in ver 3.1.0, I believe the correct object to instantiate is
IPerformanceMetricCollection.
I made that adjustment and as you might expect, that prevented the PHP fatal
error. This however uncovered another problem. The return statement for ver
3.1.2 is not correct (does not match the API documentation). Each of the
return data elements are being type-cast incorrectly. Ver 3.1.0 did have the
correct type-cast.
Ver 3.1.2 (with my IPerformanceMetricCollection change) has the
following:return array((int)$response->returnval,
(string)$response->returnMetricNames, new IPerformanceMetricCollection
($this->connection, $response->returnObjects), (string)$response->returnUnits,
(int)$response->returnScales, (int)$response->returnSequenceNumbers,
(int)$response->returnDataIndices, (int)$response->returnDataLengths);
I believe it should be:return array((array)$response->returnval,
(array)$response->returnMetricNames, new IPerformanceMetricCollection
($this->connection, (array)$response->returnObjects),
(array)$response->returnUnits, (array)$response->returnScales,
(array)$response->returnSequenceNumbers, (array)$response->returnDataIndices,
(array)$response->returnDataLengths);
Notice ... the typecast for all the returned data elements are arrays and not
string or int.
Thanks,Joe
_______________________________________________
vbox-dev mailing list
[email protected]
http://vbox.innotek.de/mailman/listinfo/vbox-dev