[libvirt] [libvirt-php PATCH] Use zend_long instead of zend_ulong64

Neal Gompa ngompa13 at gmail.com
Fri Apr 15 10:10:11 UTC 2016


In PHP 7.0, the zend_(u)long64 definition was removed in favor
of zend_(u)long changing depending on whether PHP was compiled on
a 64-bit architecture or not.

The patch set that originally ported libvirt-php to PHP7+ did not
use zend_ulong64. However, it was altered to use it during the review,
which broke PHP 7.0 support. This fixes that by using zend_long and
checking for if the value is invalid and returning false when that happens.
---
 src/libvirt-php.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/libvirt-php.c b/src/libvirt-php.c
index 7dcead8..435bf97 100644
--- a/src/libvirt-php.c
+++ b/src/libvirt-php.c
@@ -6666,11 +6666,12 @@ PHP_FUNCTION(libvirt_domain_memory_peek)
     zval *zdomain;
     int retval;
     zend_long flags=0;
-    zend_ulong64 start;
+    zend_long start;
     zend_long size;
     char *buff;
 
     GET_DOMAIN_FROM_ARGS("rlll",&zdomain,&start,&size,&flags);
+    if (start < 0) RETURN_FALSE;
     buff=(char *)emalloc(size);
     retval=virDomainMemoryPeek(domain->domain,start,size,buff,flags);
     if (retval != 0) RETURN_FALSE;
-- 
2.5.5




More information about the libvir-list mailing list