]> granicus.if.org Git - php/commitdiff
Fixed shmop tests fails
authorXinchen Hui <laruence@gmail.com>
Tue, 3 Feb 2015 14:07:31 +0000 (22:07 +0800)
committerXinchen Hui <laruence@gmail.com>
Tue, 3 Feb 2015 14:07:31 +0000 (22:07 +0800)
ext/shmop/shmop.c

index 0779d276717d4a6ad86f8c89dff122c9c6abd177..2000bd24f01d6bbdf5082a9ecb2bcb8af36ebf99 100644 (file)
@@ -237,7 +237,7 @@ PHP_FUNCTION(shmop_read)
                return;
        }
 
-       if ((shmop = (struct php_shmop *)zend_fetch_resource(Z_RES_P(shmid), "shmop", shm_type))) {
+       if ((shmop = (struct php_shmop *)zend_fetch_resource(Z_RES_P(shmid), "shmop", shm_type)) == NULL) {
                RETURN_FALSE;
        }
 
@@ -264,17 +264,19 @@ PHP_FUNCTION(shmop_read)
    closes a shared memory segment */
 PHP_FUNCTION(shmop_close)
 {
-       zend_long shmid;
-       zval *res;
+       zval *shmid;
+       struct php_shmop *shmop;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &shmid) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &shmid) == FAILURE) {
                return;
        }
 
-       res = zend_hash_index_find(&EG(regular_list), shmid);
-       if (res) {
-               zend_list_close(Z_RES_P(res));
+
+       if ((shmop = (struct php_shmop *)zend_fetch_resource(Z_RES_P(shmid), "shmop", shm_type)) == NULL) {
+               RETURN_FALSE;
        }
+
+       zend_list_close(Z_RES_P(shmid));
 }
 /* }}} */
 
@@ -289,7 +291,7 @@ PHP_FUNCTION(shmop_size)
                return;
        }
 
-       if ((shmop = (struct php_shmop *)zend_fetch_resource(Z_RES_P(shmid), "shmop", shm_type))) {
+       if ((shmop = (struct php_shmop *)zend_fetch_resource(Z_RES_P(shmid), "shmop", shm_type)) == NULL) {
                RETURN_FALSE;
        }
 
@@ -311,7 +313,7 @@ PHP_FUNCTION(shmop_write)
                return;
        }
 
-       if ((shmop = (struct php_shmop *)zend_fetch_resource(Z_RES_P(shmid), "shmop", shm_type))) {
+       if ((shmop = (struct php_shmop *)zend_fetch_resource(Z_RES_P(shmid), "shmop", shm_type)) == NULL) {
                RETURN_FALSE;
        }
 
@@ -343,7 +345,7 @@ PHP_FUNCTION(shmop_delete)
                return;
        }
 
-       if ((shmop = (struct php_shmop *)zend_fetch_resource(Z_RES_P(shmid), "shmop", shm_type))) {
+       if ((shmop = (struct php_shmop *)zend_fetch_resource(Z_RES_P(shmid), "shmop", shm_type)) == NULL) {
                RETURN_FALSE;
        }