Minor errors in VuzitPHP Vuzit_Document class
There seem to be a couple of small problems with the VuzitPHP library (version 1.1.0), in the Vuzit_Document::upload() method.
The first one looks like a typo: there's a parameter "$fileType" that's defaulted to null, but when it's tested (on line 294), it's referred to as "$file_type". That causes a PHP notice to be thrown because $file_type is uninitialized.
Secondly, upon success the ID is set (on line 339) to $xml->web_id. However, that's a SimpleXML element object, not a scalar, so the getId() method will throw a notice (on PHP 5.2.10).
The first one looks like a typo: there's a parameter "$fileType" that's defaulted to null, but when it's tested (on line 294), it's referred to as "$file_type". That causes a PHP notice to be thrown because $file_type is uninitialized.
Secondly, upon success the ID is set (on line 339) to $xml->web_id. However, that's a SimpleXML element object, not a scalar, so the getId() method will throw a notice (on PHP 5.2.10).
1
person has this problem
I have this problem, too!
Tell me when someone solves it.
The more people who report this problem, the more it gets noticed.
The more people who report this problem, the more it gets noticed.
-
Inappropriate?The fix for the first problem seems to be to change line 294 to:
if($fileType != null) {
The fix for the second problem seems to be to add this line before line 300:
$params['id'] = null;
The PHP notice isn't because of the SimpleXML element, it's because $params['id'] isn't set before calling postParams(). However, it still seems like getId() is intended to return a scalar, not an object. Currently, you can get the doc ID by doing something like this, assuming that $doc is an instance of Vuzit_Document:
$x = $doc->getId();
echo $x[0]; -
The above will not reliably give you the doc ID as a string. The problem is that the SimpleXML needs to be cast to a string before it's returned from upload(). The fix is to replace line 339 with:
$result->setId((string) $xml->web_id); -
Inappropriate?Thanks Jeff. A fix was committed for the first problem here: http://bit.ly/IDj3A As for the second problem that's definitely a new one. I'll be checking in your fix soon. Thanks very much!
1 person says
this solves the problem
Loading Profile...



EMPLOYEE