com php-src: Fixed shmop tests fails: ext/shmop/shmop.c

From: Date: Tue, 03 Feb 2015 14:07:31 +0000
Subject: com php-src: Fixed shmop tests fails: ext/shmop/shmop.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-84614@lists.php.net to get a copy of this message
Commit: 2c842dfce076037873ec223a1709011aefbd653e Author: Xinchen Hui <laruence@gmail.com> Tue, 3 Feb 2015 22:07:31 +0800 Parents: d4546601f3e04990c36f5d2b6794944739c26c8c Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=2c842dfce076037873ec223a1709011aefbd653e Log: Fixed shmop tests fails Changed paths: M ext/shmop/shmop.c Diff: diff --git a/ext/shmop/shmop.c b/ext/shmop/shmop.c index 0779d27..2000bd2 100644 --- a/ext/shmop/shmop.c +++ b/ext/shmop/shmop.c @@ -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; }

« previous php.cvs (#84614) next »