[libvirt] [libvirt-php] Fix get_xml when xpath is null

Michal Novotny minovotn at redhat.com
Wed Apr 13 07:32:32 UTC 2011


On 04/13/2011 06:10 AM, Lyre wrote:
> Hi all:
>
> 	To my surprise, it seems that passing null to php as a string parameter,
> will set the pointer which retrive it to an empty string "" , but not NULL.
> get_xml_from_xpath() doesn't work correctly since an empty string is 
> passed as the xpath argument, and libxml will complain "Invalid expression"
>
> I know seldom about xpath, I'm not sure if it is the correct way to fix it.
>
> BTW, what xpath shall I pass to get the entire xml?
>
Hi Lyre,
thanks for the information however I was always using the NULL value as
second argument for the get_xml_desc(), like e.g.:

$entire_xml = libvirt_domain_get_xml_desc($dom, NULL);

My development and testing is done on Fedora 14 and
php-5.3.6-1.fc14.i686 version of the package and it's working fine for
me. However the patch you sent to the list seems better and it's working
fine so I've pushed it to the repository right now.

Just for the record, what did you mean by passing NULL to php as a
string parameter? To pass as 'null' ? I'm using it the way described
above and 'null' is required only for libvirt_connect() since there are
some issues with passing NULL to libvirt_connect(). We still may need to
fix the libvirt_connect() function, that's true.

Michal

-- 
Michal Novotny <minovotn at redhat.com>, RHCE
Virtualization Team (xen userspace), Red Hat




More information about the libvir-list mailing list