[prev in list] [next in list] [prev in thread] [next in thread]
List: pecl-cvs
Subject: [PECL-CVS] com =?UTF-8?Q?pecl/file=5Fsystem/xattr=3A=20return=20NULL=20instead=20of?= =?UTF-8?Q?=20F
From: Remi Collet <remi () php ! net>
Date: 2020-04-23 10:34:12
Message-ID: php-mail-634ca00e3fad3f1dc5bb766a4378a920825799981 () git ! php ! net
[Download RAW message or body]
Commit: f5c6bead73978e437da9a06e7ac78380eb1314a5
Author: Remi Collet <remi@php.net> Thu, 23 Apr 2020 12:34:12 +0200
Parents: b6578fa429b8da35172af7079598a48524d2b733
Branches: master
Link: http://git.php.net/?p=pecl/file_system/xattr.git;a=commitdiff;h=f5c6bead73978e437da9a06e7ac78380eb1314a5
Log:
return NULL instead of FALSE in error cases
Changed paths:
M package.xml
M tests/002-set-get.phpt
M tests/003-set-get-link.phpt
M tests/004-create-replace.phpt
M xattr.c
M xattr.stub.php
M xattr_arginfo.h
Diff:
diff --git a/package.xml b/package.xml
index b2bdbde..f1a59ec 100644
--- a/package.xml
+++ b/package.xml
@@ -23,7 +23,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
<date>2020-04-22</date>
<version>
<release>1.4.0dev</release>
- <api>1.2.0</api>
+ <api>1.4.0</api>
</version>
<stability>
<release>stable</release>
@@ -33,6 +33,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
<notes>
- drop dupport for PHP older than 7.2
- add type hinting in reflection
+- return NULL instead of FALSE in error cases
</notes>
<contents>
<dir name="/">
diff --git a/tests/002-set-get.phpt b/tests/002-set-get.phpt
index 2911d2f..fdde456 100644
--- a/tests/002-set-get.phpt
+++ b/tests/002-set-get.phpt
@@ -52,5 +52,5 @@ array(1) {
bool(true)
-- Remove
bool(true)
-bool(false)
+NULL
Done
diff --git a/tests/003-set-get-link.phpt b/tests/003-set-get-link.phpt
index 13cc62e..7e828c5 100644
--- a/tests/003-set-get-link.phpt
+++ b/tests/003-set-get-link.phpt
@@ -49,24 +49,24 @@ string(3) "xxx"
-- List
array(3) {
[0]=>
- string(17) "trusted.php.test1"
+ string(16) "security.selinux"
[1]=>
- string(17) "trusted.php.test2"
+ string(17) "trusted.php.test1"
[2]=>
- string(16) "security.selinux"
+ string(17) "trusted.php.test2"
}
array(3) {
[0]=>
- string(17) "trusted.php.test1"
+ string(16) "security.selinux"
[1]=>
- string(17) "trusted.php.test2"
+ string(17) "trusted.php.test1"
[2]=>
- string(16) "security.selinux"
+ string(17) "trusted.php.test2"
}
array(2) {
[0]=>
- string(17) "trusted.php.test3"
- [1]=>
string(16) "security.selinux"
+ [1]=>
+ string(17) "trusted.php.test3"
}
Done
diff --git a/tests/004-create-replace.phpt b/tests/004-create-replace.phpt
index f21e3b7..7cde8f4 100644
--- a/tests/004-create-replace.phpt
+++ b/tests/004-create-replace.phpt
@@ -31,7 +31,7 @@ Done
Warning: xattr_set Attribute user.php.test doesn't exists in \
%s004-create-replace.php on line 7 bool(false)
-bool(false)
+NULL
bool(true)
string(1) "2"
diff --git a/xattr.c b/xattr.c
index ec6797f..b6cc9b6 100644
--- a/xattr.c
+++ b/xattr.c
@@ -178,7 +178,7 @@ PHP_FUNCTION(xattr_set)
/* Enforce open_basedir and safe_mode */
if (php_check_open_basedir(path)) {
- RETURN_FALSE;
+ RETURN_NULL();
}
prefixed_name = add_prefix(attr_name, flags);
@@ -239,7 +239,7 @@ PHP_FUNCTION(xattr_get)
/* Enforce open_basedir and safe_mode */
if (php_check_open_basedir(path)) {
- RETURN_FALSE;
+ RETURN_NULL();
}
prefixed_name = add_prefix(attr_name, flags);
@@ -292,7 +292,7 @@ PHP_FUNCTION(xattr_get)
break;
}
- RETURN_FALSE;
+ RETURN_NULL();
}
/* }}} */
@@ -359,7 +359,7 @@ PHP_FUNCTION(xattr_remove)
/* Enforce open_basedir and safe_mode */
if (php_check_open_basedir(path)) {
- RETURN_FALSE;
+ RETURN_NULL();
}
prefixed_name = add_prefix(attr_name, flags);
@@ -419,7 +419,7 @@ PHP_FUNCTION(xattr_list)
/* Enforce open_basedir and safe_mode */
if (php_check_open_basedir(path)) {
- RETURN_FALSE;
+ RETURN_NULL();
}
buffer = emalloc(buffer_size);
@@ -452,7 +452,7 @@ PHP_FUNCTION(xattr_list)
}
efree(buffer);
- RETURN_FALSE;
+ RETURN_NULL();
}
/* Resize buffer to the required size */
@@ -475,7 +475,7 @@ PHP_FUNCTION(xattr_list)
/* If there is still an error and it's not ERANGE then return false */
if (error == -1) {
efree(buffer);
- RETURN_FALSE;
+ RETURN_NULL();
}
buffer_size = error;
diff --git a/xattr.stub.php b/xattr.stub.php
index 38af7d5..9956977 100644
--- a/xattr.stub.php
+++ b/xattr.stub.php
@@ -1,12 +1,12 @@
<?php
-function xattr_set(string $path, string $name, string $value, int $flag = 0): bool \
{} +function xattr_set(string $path, string $name, string $value, int $flag = 0): \
?bool {}
-function xattr_get(string $path, string $name, int $flags = 0): string {}
+function xattr_get(string $path, string $name, int $flags = 0): ?string {}
-function xattr_supported(string $path, int $flags = 0): bool {}
+function xattr_supported(string $path, int $flags = 0): ?bool {}
-function xattr_remove(string $path, string $name, int $flags = 0): bool {}
+function xattr_remove(string $path, string $name, int $flags = 0): ?bool {}
-function xattr_list(string $path, int $flags = 0): array {}
+function xattr_list(string $path, int $flags = 0): ?array {}
diff --git a/xattr_arginfo.h b/xattr_arginfo.h
index 064a76f..816bb93 100644
--- a/xattr_arginfo.h
+++ b/xattr_arginfo.h
@@ -1,30 +1,30 @@
/* This is a generated file, edit the .stub.php file instead. */
-ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xattr_set, 0, 3, _IS_BOOL, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xattr_set, 0, 3, _IS_BOOL, 1)
ZEND_ARG_TYPE_INFO(0, path, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flag, IS_LONG, 0, "0")
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xattr_get, 0, 2, IS_STRING, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xattr_get, 0, 2, IS_STRING, 1)
ZEND_ARG_TYPE_INFO(0, path, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "0")
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xattr_supported, 0, 1, _IS_BOOL, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xattr_supported, 0, 1, _IS_BOOL, 1)
ZEND_ARG_TYPE_INFO(0, path, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "0")
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xattr_remove, 0, 2, _IS_BOOL, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xattr_remove, 0, 2, _IS_BOOL, 1)
ZEND_ARG_TYPE_INFO(0, path, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "0")
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xattr_list, 0, 1, IS_ARRAY, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xattr_list, 0, 1, IS_ARRAY, 1)
ZEND_ARG_TYPE_INFO(0, path, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "0")
ZEND_END_ARG_INFO()
--
PECL CVS Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic