Req #31424 [Opn->Csd]: Make mode optional on mkdir

From: Date: Tue, 27 Oct 2020 10:23:00 +0000
Subject: Req #31424 [Opn->Csd]: Make mode optional on mkdir
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-229935@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=31424&edit=1 ID: 31424 Updated by: cmb@php.net Reported by: aidan@php.net Summary: Make mode optional on mkdir -Status: Open +Status: Closed Type: Feature/Change Request Package: Directory function related PHP Version: 5CVS-2005-01-06 (dev) -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: As of PHP 8.0.0 you can use named arguments[1], what seems to be a good alternative to your suggestion. If you still feel that there should be a way to skip default parameters without using named arguments, please raise that on the internals mailing list[2], since this would need discussion and an RFC[3]. [1] <https://3v4l.org/AEP76> [2] <https://www.php.net/mailing-lists.php#internals> [3] <https://wiki.php.net/rfc/howto> Previous Comments: ------------------------------------------------------------------------ [2018-03-10 13:55:43] cmb@php.net I fail to see why NULL would be preferable to the more explicit 0777 here. IMHO: won't fix. ------------------------------------------------------------------------ [2005-01-06 03:07:53] aidan@php.net Description: ------------ As all but the first parameter of mkdir are optional and non sequential, it makes sense to be able to pass NULL to each if a later param is required. E.g. mkdir('some/path/foobar', null, true); Reproduce code: --------------- This patch adds this functionality: http://rafb.net/paste/results/0QWc5F15.html Included in the report: --- \repository\php-src\ext\standard\file.1.395.c Mon Dec 13 10:21:53 2004 +++ \repository\php-src\ext\standard\file.c Thu Jan 06 12:29:41 2005 @@ -1372,7 +1372,7 @@ char *dir; php_stream_context *context; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lbr", &dir, &dir_len, &mode, &recursive, &zcontext) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|!lbr", &dir, &dir_len, &mode, &recursive, &zcontext) == FAILURE) { RETURN_FALSE; } ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=31424&edit=1

« previous php.bugs (#229935) next »