From db453e1058efd8556a617e7b72277131cb8e290e Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Mon, 12 Apr 2021 20:18:43 +0100 Subject: [PATCH 01/63] #597 - Add test case --- ext/stub/assign.zep.c | 30 ++++++++++++++++++++++++++++++ ext/stub/assign.zep.h | 9 +++++++++ stub/assign.zep | 17 +++++++++++++++++ tests/Extension/AssignTest.php | 13 +++++++++++++ 4 files changed, 69 insertions(+) diff --git a/ext/stub/assign.zep.c b/ext/stub/assign.zep.c index dc47fe9d68..6afd37a016 100644 --- a/ext/stub/assign.zep.c +++ b/ext/stub/assign.zep.c @@ -2500,3 +2500,33 @@ PHP_METHOD(Stub_Assign, testAssignSuperGlobalsGET) ZEPHIR_MM_RESTORE(); } +PHP_METHOD(Stub_Assign, issue597) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval _POST, _GET, s$$4, _0$$4; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&_POST); + ZVAL_UNDEF(&_GET); + ZVAL_UNDEF(&s$$4); + ZVAL_UNDEF(&_0$$4); + + + ZEPHIR_MM_GROW(); + zephir_get_global(&_GET, SL("_GET")); + zephir_get_global(&_POST, SL("_POST")); + + if (zephir_array_isset_string(&_POST, SL("a"))) { + if (zephir_array_isset_string(&_GET, SL("r"))) { + } + } + if (zephir_array_isset_string(&_GET, SL("s"))) { + zephir_array_fetch_string(&_0$$4, &_GET, SL("s"), PH_NOISY | PH_READONLY, "stub/assign.zep", 953); + ZEPHIR_INIT_VAR(&s$$4); + ZVAL_LONG(&s$$4, (zephir_get_numberval(&_0$$4) * 5)); + zephir_array_update_string(&_GET, SL("s"), &s$$4, PH_COPY | PH_SEPARATE); + RETURN_CCTOR(&s$$4); + } + ZEPHIR_MM_RESTORE(); +} + diff --git a/ext/stub/assign.zep.h b/ext/stub/assign.zep.h index 40a9eac3f2..6a14d3c155 100644 --- a/ext/stub/assign.zep.h +++ b/ext/stub/assign.zep.h @@ -95,6 +95,7 @@ PHP_METHOD(Stub_Assign, testArrayBoolExpressionAssign); PHP_METHOD(Stub_Assign, testAssignSuperGlobals); PHP_METHOD(Stub_Assign, testAssignSuperGlobalsSERVER); PHP_METHOD(Stub_Assign, testAssignSuperGlobalsGET); +PHP_METHOD(Stub_Assign, issue597); ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_assign_gettestvar, 0, 0, 0) ZEND_END_ARG_INFO() @@ -395,6 +396,9 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_assign_testassignsuperglobalsget, 0, 0, 0) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_assign_issue597, 0, 0, 0) +ZEND_END_ARG_INFO() + ZEPHIR_INIT_FUNCS(stub_assign_method_entry) { #if PHP_VERSION_ID >= 80000 PHP_ME(Stub_Assign, getTestVar, arginfo_stub_assign_gettestvar, ZEND_ACC_PUBLIC) @@ -623,6 +627,11 @@ ZEPHIR_INIT_FUNCS(stub_assign_method_entry) { PHP_ME(Stub_Assign, testAssignSuperGlobalsGET, arginfo_stub_assign_testassignsuperglobalsget, ZEND_ACC_PUBLIC) #else PHP_ME(Stub_Assign, testAssignSuperGlobalsGET, NULL, ZEND_ACC_PUBLIC) +#endif +#if PHP_VERSION_ID >= 80000 + PHP_ME(Stub_Assign, issue597, arginfo_stub_assign_issue597, ZEND_ACC_PUBLIC) +#else + PHP_ME(Stub_Assign, issue597, NULL, ZEND_ACC_PUBLIC) #endif PHP_FE_END }; diff --git a/stub/assign.zep b/stub/assign.zep index 26d0e1eb8f..fe5057124f 100644 --- a/stub/assign.zep +++ b/stub/assign.zep @@ -939,4 +939,21 @@ class Assign { let _GET = array_merge(_GET, ["g1": "aaa", "g2": "bbb"]); } + + public function issue597() + { + if isset _POST["a"] { + if isset _GET["r"] { + // Nothing here + } + } + + if isset _GET["s"] { + var s; + let s = _GET["s"] * 5; + let _GET["s"] = s; + + return s; + } + } } diff --git a/tests/Extension/AssignTest.php b/tests/Extension/AssignTest.php index 3750b4b0eb..c23b804ef4 100644 --- a/tests/Extension/AssignTest.php +++ b/tests/Extension/AssignTest.php @@ -176,4 +176,17 @@ public function testGlobalVarAssignGET(): void $this->assertCount($getCount + 2, $_GET); } + + public function testIssue597() + { + $_GET = []; + $this->test->issue597(); + + $this->assertEmpty($_GET); + + $_GET['s'] = 10; + $this->test->issue597(); + + $this->assertSame(50, $_GET['s']); + } } From 3f8c232d0744a38f05894cf37b550991c0024bc8 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Mon, 12 Apr 2021 20:50:53 +0100 Subject: [PATCH 02/63] #1094 - Add failing test case --- stub/arrayaccesstest.zep | 28 ++++++++++++++++++++++++++++ tests/Extension/ArrayAccessTest.php | 17 +++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/stub/arrayaccesstest.zep b/stub/arrayaccesstest.zep index f5ddcd44a9..80171d73e9 100644 --- a/stub/arrayaccesstest.zep +++ b/stub/arrayaccesstest.zep @@ -43,4 +43,32 @@ class ArrayAccessTest return in_array(s, arr); } + + public function issue1094Test1(const array items = null) -> bool + { + bool isItemsNULL; + + // This syntax do not exist in Zephir... + //let isItemsNULL = null === items; + + return isItemsNULL; + } + + public function issue1094Test2(const array items = null) -> bool + { + bool isItemsNULL; + + let isItemsNULL = items === null; + + return isItemsNULL; + } + + public function issue1094Test3(const array items = null) -> bool + { + bool isItemsNULL; + + let isItemsNULL = is_null(items); + + return isItemsNULL; + } } diff --git a/tests/Extension/ArrayAccessTest.php b/tests/Extension/ArrayAccessTest.php index 86a0dca138..e146ec90e5 100644 --- a/tests/Extension/ArrayAccessTest.php +++ b/tests/Extension/ArrayAccessTest.php @@ -44,4 +44,21 @@ public function testIssue1155(): void $this->assertFalse($class->issue1155()); } + + public function testIssue1094(): void + { + $class = new \Stub\ArrayAccessTest(); + + $this->assertFalse($class->issue1094Test1()); + $this->assertFalse($class->issue1094Test1([])); + $this->assertFalse($class->issue1094Test1(['test' => 'ok'])); + + $this->assertTrue($class->issue1094Test2()); + $this->assertFalse($class->issue1094Test2([])); + $this->assertFalse($class->issue1094Test2(['test' => 'ok'])); + + $this->assertTrue($class->issue1094Test3()); + $this->assertFalse($class->issue1094Test3([])); + $this->assertFalse($class->issue1094Test3(['test' => 'ok'])); + } } From 41e812cefcc1eee3b07970da00010e158f334385 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Tue, 13 Apr 2021 09:12:24 +0100 Subject: [PATCH 03/63] #914 - Add test case --- stub/issue914.zep | 9 +++++++++ tests/Extension/Issue914Test.php | 27 +++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 stub/issue914.zep create mode 100644 tests/Extension/Issue914Test.php diff --git a/stub/issue914.zep b/stub/issue914.zep new file mode 100644 index 0000000000..09e410ce12 --- /dev/null +++ b/stub/issue914.zep @@ -0,0 +1,9 @@ +namespace Stub; + +class Issue914 extends \mysqli +{ + public function __construct() + { + parent::__construct(); + } +} diff --git a/tests/Extension/Issue914Test.php b/tests/Extension/Issue914Test.php new file mode 100644 index 0000000000..43fbc46913 --- /dev/null +++ b/tests/Extension/Issue914Test.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Extension; + +use PHPUnit\Framework\TestCase; +use Stub\Issue914; + +final class Issue914Test extends TestCase +{ + public function testIssue914(): void + { + $test = new Issue914(); + + $this->assertInstanceOf(\mysqli::class, $test); + } +} From ac77d2f0e7c53e288945a7bd128e493dc6b35ba7 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Tue, 13 Apr 2021 09:12:51 +0100 Subject: [PATCH 04/63] #914 - Add installation of 'mysqli' inside Dockerfiles --- docker-compose.yml | 5 ----- docker/7.4/Dockerfile | 2 +- docker/8.0/Dockerfile | 2 +- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 85923e0fae..8e766f3026 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,10 +1,5 @@ # For local development only. -# First development steps after start containers: -# - .ci/install-zephir-parser.sh -# - php zephir stubs -# - cd ext/ && ./install - version: '3' services: diff --git a/docker/7.4/Dockerfile b/docker/7.4/Dockerfile index 5de4f9e83e..6dd0d38a92 100644 --- a/docker/7.4/Dockerfile +++ b/docker/7.4/Dockerfile @@ -15,7 +15,7 @@ RUN apt update -y && apt install -y \ libzip-dev && \ pecl install psr -RUN docker-php-ext-install zip gmp intl && \ +RUN docker-php-ext-install zip gmp intl mysqli && \ docker-php-ext-enable psr # Install Zephir parser diff --git a/docker/8.0/Dockerfile b/docker/8.0/Dockerfile index 7e33039b88..e96b898804 100644 --- a/docker/8.0/Dockerfile +++ b/docker/8.0/Dockerfile @@ -15,7 +15,7 @@ RUN apt update -y && apt install -y \ libzip-dev && \ pecl install psr -RUN docker-php-ext-install zip gmp intl && \ +RUN docker-php-ext-install zip gmp intl mysqli && \ docker-php-ext-enable psr # Install Zephir parser From d0b1214639f8006da7db6205797e3395c42b66f3 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Tue, 13 Apr 2021 09:24:45 +0100 Subject: [PATCH 05/63] #914 - Add installation of 'mysqli' Win CI --- .github/workflows/build-windows.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index 30bbfb124a..3cfc84433d 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -51,7 +51,7 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} - extensions: mbstring, fileinfo, gmp, sqlite, pdo_sqlite, psr, zip + extensions: mbstring, fileinfo, gmp, sqlite, pdo_sqlite, psr, zip, mysqli coverage: none # variables_order: https://github.com/zephir-lang/zephir/pull/1537 # enable_dl: https://github.com/zephir-lang/zephir/pull/1654 From 403629b5dd4b2166753239bdb857ee86c9b2bdef Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Tue, 13 Apr 2021 09:29:45 +0100 Subject: [PATCH 06/63] #914 - Add TODO --- Library/StaticCall.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Library/StaticCall.php b/Library/StaticCall.php index 21d1fe67c1..a07db26a6a 100644 --- a/Library/StaticCall.php +++ b/Library/StaticCall.php @@ -78,7 +78,7 @@ public function compile(Expression $expr, CompilationContext $compilationContext } } - /* + /** * Include fcall header */ $compilationContext->headersManager->add('kernel/fcall'); @@ -127,10 +127,11 @@ public function compile(Expression $expr, CompilationContext $compilationContext } } - /* + /** * Check if the class implements the method */ if (!$dynamicMethod && !$dynamicClass) { + // TODO: Consider to check instance of ClassDefinitionRuntime and throw another error, telling that class was not found. if (!$classDefinition->hasMethod($methodName)) { $possibleMethod = $classDefinition->getPossibleMethodName($methodName); if ($possibleMethod) { @@ -153,7 +154,7 @@ public function compile(Expression $expr, CompilationContext $compilationContext if (!$classDefinition->hasMethod('__callStatic')) { if ($method instanceof ClassMethod && !$method->isBundled()) { - /* + /** * Try to produce an exception if method is called with a wrong number of parameters */ if (isset($expression['parameters'])) { From a618a5824445c02551599508db058d7556fd2363 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Tue, 13 Apr 2021 22:41:38 +0100 Subject: [PATCH 07/63] Create FUNDING.yml --- .github/FUNDING.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000000..cbe301e530 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [phalcon] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: ['https://opencollective.com/phalcon'] From 603682fa16ae3d1a091e71320e3a6df9111333ab Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Thu, 15 Apr 2021 20:15:03 +0100 Subject: [PATCH 08/63] #1094 - Remove unused variable --- Library/Backends/ZendEngine3/Backend.php | 1 - 1 file changed, 1 deletion(-) diff --git a/Library/Backends/ZendEngine3/Backend.php b/Library/Backends/ZendEngine3/Backend.php index e41be45c0e..550a4229cf 100644 --- a/Library/Backends/ZendEngine3/Backend.php +++ b/Library/Backends/ZendEngine3/Backend.php @@ -1023,7 +1023,6 @@ public function forStatement(Variable $exprVariable, $keyVariable, $variable, $d $codePrinter->output('if (Z_TYPE_P('.$this->getVariableCode($exprVariable).') == IS_ARRAY) {'); $codePrinter->increaseLevel(); - $macro = null; $reverse = $statement['reverse'] ? 'REVERSE_' : ''; if (isset($keyVariable)) { From 0c8523a0fa8a4f38495ce40fe8a1fbb902a62902 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Thu, 15 Apr 2021 20:21:43 +0100 Subject: [PATCH 09/63] #1094 - Fix nullable array declaration --- Library/Backends/ZendEngine3/Backend.php | 16 ++-- Library/ClassMethod.php | 1 - .../Comparison/ComparisonBaseOperator.php | 12 +-- ext/stub/arrayaccesstest.zep.c | 93 +++++++++++++++++++ ext/stub/arrayaccesstest.zep.h | 18 ++++ ext/stub/flow/switchflow.zep.c | 7 +- ext/stub/globals/serverrequestfactory.zep.c | 5 - ext/stub/mcall.zep.c | 1 - tests/Extension/MCallTest.php | 2 +- 9 files changed, 129 insertions(+), 26 deletions(-) diff --git a/Library/Backends/ZendEngine3/Backend.php b/Library/Backends/ZendEngine3/Backend.php index 550a4229cf..de6fa8db5f 100644 --- a/Library/Backends/ZendEngine3/Backend.php +++ b/Library/Backends/ZendEngine3/Backend.php @@ -1073,7 +1073,7 @@ public function forStatement(Variable $exprVariable, $keyVariable, $variable, $d $codePrinter->decreaseLevel(); } - /* + /** * Compile statements in the 'for' block */ if (isset($statement['statements'])) { @@ -1176,29 +1176,31 @@ public function fetchClassEntry($str) * {@inheritdoc} * * @param string $type - * @param CompilationContext $context + * @param CompilationContext $compilationContext * @param bool $isLocal * * @return Variable */ public function getScalarTempVariable( string $type, - CompilationContext $context, + CompilationContext $compilationContext, $isLocal = true ): Variable { - return $context->symbolTable->getTempNonTrackedVariable($type, $context); + return $compilationContext->symbolTable->getTempNonTrackedVariable($type, $compilationContext); } /** - * {@inheritdoc} + * Initialize array + * + * Init empty array or specific size array. * * @param Variable $variable * @param CompilationContext $context - * @param int $size + * @param int|null $size * * @return void */ - public function initArray(Variable $variable, CompilationContext $context, int $size = null) + public function initArray(Variable $variable, CompilationContext $context, ?int $size = null): void { $code = $this->getVariableCode($variable); diff --git a/Library/ClassMethod.php b/Library/ClassMethod.php index f588c7b1db..3a51f95ecc 100644 --- a/Library/ClassMethod.php +++ b/Library/ClassMethod.php @@ -1285,7 +1285,6 @@ public function assignDefaultValue(array $parameter, CompilationContext $compila switch ($parameter['default']['type']) { case 'null': $compilationContext->backend->initVar($paramVariable, $compilationContext); - $compilationContext->backend->initArray($paramVariable, $compilationContext, null); break; case 'empty-array': diff --git a/Library/Operators/Comparison/ComparisonBaseOperator.php b/Library/Operators/Comparison/ComparisonBaseOperator.php index 7d10cf3dec..0fadf8073b 100644 --- a/Library/Operators/Comparison/ComparisonBaseOperator.php +++ b/Library/Operators/Comparison/ComparisonBaseOperator.php @@ -353,12 +353,14 @@ public function compile($expression, CompilationContext $compilationContext) true ); switch ($right->getType()) { - case 'string': case 'null': - $rightStr = 'null' == $right->getType() ? '' : $right->getCode(); + return new CompiledExpression('bool', $this->zvalNullOperator.'('.$variableLeftCode.')', $expression['left']); + break; + + case 'string': $compilationContext->headersManager->add('kernel/operators'); - return new CompiledExpression('bool', $this->zvalStringOperator.'('.$variableLeftCode.', "'.$rightStr.'")', $expression['left']); + return new CompiledExpression('bool', $this->zvalStringOperator.'('.$variableLeftCode.', "'.$right->getCode().'")', $expression['left']); break; case 'variable': @@ -523,9 +525,7 @@ public function compile($expression, CompilationContext $compilationContext) case 'array': switch ($right->getType()) { case 'null': - $compilationContext->headersManager->add('kernel/operators'); - - return new CompiledExpression('bool', $this->zvalStringOperator.'('.$variableCode.', "")', $expression['left']); + return new CompiledExpression('bool', $this->zvalNullOperator.'('.$variableCode.')', $expression['left']); case 'variable': $variableRight = $compilationContext->symbolTable->getVariableForRead($right->getCode(), $compilationContext, $expression['left']); diff --git a/ext/stub/arrayaccesstest.zep.c b/ext/stub/arrayaccesstest.zep.c index 4cc3bf0e31..eb0c587b01 100644 --- a/ext/stub/arrayaccesstest.zep.c +++ b/ext/stub/arrayaccesstest.zep.c @@ -16,6 +16,7 @@ #include "kernel/fcall.h" #include "kernel/array.h" #include "kernel/object.h" +#include "kernel/operators.h" ZEPHIR_INIT_CLASS(Stub_ArrayAccessTest) @@ -122,3 +123,95 @@ PHP_METHOD(Stub_ArrayAccessTest, issue1155) RETURN_MM_BOOL(zephir_fast_in_array(&s, &arr)); } +PHP_METHOD(Stub_ArrayAccessTest, issue1094Test1) +{ + zend_bool isItemsNULL = 0; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *items_param = NULL; + zval items; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&items); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(0, 1) + Z_PARAM_OPTIONAL + Z_PARAM_ARRAY_OR_NULL(items) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 0, 1, &items_param); + if (!items_param) { + ZEPHIR_INIT_VAR(&items); + } else { + zephir_get_arrval(&items, items_param); + } + + + RETURN_MM_BOOL(isItemsNULL); +} + +PHP_METHOD(Stub_ArrayAccessTest, issue1094Test2) +{ + zend_bool isItemsNULL = 0; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *items_param = NULL; + zval items; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&items); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(0, 1) + Z_PARAM_OPTIONAL + Z_PARAM_ARRAY_OR_NULL(items) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 0, 1, &items_param); + if (!items_param) { + ZEPHIR_INIT_VAR(&items); + } else { + zephir_get_arrval(&items, items_param); + } + + + isItemsNULL = ZEPHIR_IS_NULL(&items); + RETURN_MM_BOOL(isItemsNULL); +} + +PHP_METHOD(Stub_ArrayAccessTest, issue1094Test3) +{ + zend_bool isItemsNULL = 0; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *items_param = NULL; + zval items; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&items); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(0, 1) + Z_PARAM_OPTIONAL + Z_PARAM_ARRAY_OR_NULL(items) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 0, 1, &items_param); + if (!items_param) { + ZEPHIR_INIT_VAR(&items); + } else { + zephir_get_arrval(&items, items_param); + } + + + isItemsNULL = Z_TYPE_P(&items) == IS_NULL; + RETURN_MM_BOOL(isItemsNULL); +} + diff --git a/ext/stub/arrayaccesstest.zep.h b/ext/stub/arrayaccesstest.zep.h index e9f6d609af..c127601bb8 100644 --- a/ext/stub/arrayaccesstest.zep.h +++ b/ext/stub/arrayaccesstest.zep.h @@ -7,6 +7,9 @@ PHP_METHOD(Stub_ArrayAccessTest, exits); PHP_METHOD(Stub_ArrayAccessTest, get); PHP_METHOD(Stub_ArrayAccessTest, issue645); PHP_METHOD(Stub_ArrayAccessTest, issue1155); +PHP_METHOD(Stub_ArrayAccessTest, issue1094Test1); +PHP_METHOD(Stub_ArrayAccessTest, issue1094Test2); +PHP_METHOD(Stub_ArrayAccessTest, issue1094Test3); ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayaccesstest_exits, 0, 0, 0) ZEND_END_ARG_INFO() @@ -20,6 +23,18 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccesstest_issue1155, 0, 0, _IS_BOOL, 0) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccesstest_issue1094test1, 0, 0, _IS_BOOL, 0) + ZEND_ARG_ARRAY_INFO(0, items, 1) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccesstest_issue1094test2, 0, 0, _IS_BOOL, 0) + ZEND_ARG_ARRAY_INFO(0, items, 1) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccesstest_issue1094test3, 0, 0, _IS_BOOL, 0) + ZEND_ARG_ARRAY_INFO(0, items, 1) +ZEND_END_ARG_INFO() + ZEPHIR_INIT_FUNCS(stub_arrayaccesstest_method_entry) { #if PHP_VERSION_ID >= 80000 PHP_ME(Stub_ArrayAccessTest, exits, arginfo_stub_arrayaccesstest_exits, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) @@ -33,5 +48,8 @@ ZEPHIR_INIT_FUNCS(stub_arrayaccesstest_method_entry) { #endif PHP_ME(Stub_ArrayAccessTest, issue645, arginfo_stub_arrayaccesstest_issue645, ZEND_ACC_PUBLIC) PHP_ME(Stub_ArrayAccessTest, issue1155, arginfo_stub_arrayaccesstest_issue1155, ZEND_ACC_PUBLIC) + PHP_ME(Stub_ArrayAccessTest, issue1094Test1, arginfo_stub_arrayaccesstest_issue1094test1, ZEND_ACC_PUBLIC) + PHP_ME(Stub_ArrayAccessTest, issue1094Test2, arginfo_stub_arrayaccesstest_issue1094test2, ZEND_ACC_PUBLIC) + PHP_ME(Stub_ArrayAccessTest, issue1094Test3, arginfo_stub_arrayaccesstest_issue1094test3, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/flow/switchflow.zep.c b/ext/stub/flow/switchflow.zep.c index 212c1dd003..eaef800d6e 100644 --- a/ext/stub/flow/switchflow.zep.c +++ b/ext/stub/flow/switchflow.zep.c @@ -301,13 +301,12 @@ PHP_METHOD(Stub_Flow_SwitchFlow, testSwitch13) PHP_METHOD(Stub_Flow_SwitchFlow, testSwitch14) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *result_type = NULL, result_type_sub, ret, _0, _1; + zval *result_type = NULL, result_type_sub, ret, _0; zval *this_ptr = getThis(); ZVAL_UNDEF(&result_type_sub); ZVAL_UNDEF(&ret); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) @@ -329,9 +328,7 @@ PHP_METHOD(Stub_Flow_SwitchFlow, testSwitch14) do { ZEPHIR_INIT_VAR(&_0); ZEPHIR_GET_CONSTANT(&_0, "MYSQL_ASSOC"); - ZEPHIR_INIT_VAR(&_1); - ZEPHIR_GET_CONSTANT(&_1, "MYSQLI_ASSOC"); - if (ZEPHIR_IS_LONG(result_type, 1) || ZEPHIR_IS_EQUAL(result_type, &_0) || ZEPHIR_IS_EQUAL(result_type, &_1)) { + if (ZEPHIR_IS_LONG(result_type, 1) || ZEPHIR_IS_EQUAL(result_type, &_0) || ZEPHIR_IS_LONG(result_type, 1)) { ZEPHIR_INIT_VAR(&ret); ZVAL_STRING(&ret, "aaa"); break; diff --git a/ext/stub/globals/serverrequestfactory.zep.c b/ext/stub/globals/serverrequestfactory.zep.c index 75922d8e6a..5af6bfb50b 100644 --- a/ext/stub/globals/serverrequestfactory.zep.c +++ b/ext/stub/globals/serverrequestfactory.zep.c @@ -80,31 +80,26 @@ PHP_METHOD(Stub_Globals_ServerRequestFactory, load) zephir_fetch_params(1, 0, 5, &server_param, &get_param, &post_param, &cookies_param, &files_param); if (!server_param) { ZEPHIR_INIT_VAR(&server); - array_init(&server); } else { zephir_get_arrval(&server, server_param); } if (!get_param) { ZEPHIR_INIT_VAR(&get); - array_init(&get); } else { zephir_get_arrval(&get, get_param); } if (!post_param) { ZEPHIR_INIT_VAR(&post); - array_init(&post); } else { zephir_get_arrval(&post, post_param); } if (!cookies_param) { ZEPHIR_INIT_VAR(&cookies); - array_init(&cookies); } else { zephir_get_arrval(&cookies, cookies_param); } if (!files_param) { ZEPHIR_INIT_VAR(&files); - array_init(&files); } else { zephir_get_arrval(&files, files_param); } diff --git a/ext/stub/mcall.zep.c b/ext/stub/mcall.zep.c index 12dcf48fa8..1b0f131645 100644 --- a/ext/stub/mcall.zep.c +++ b/ext/stub/mcall.zep.c @@ -1011,7 +1011,6 @@ PHP_METHOD(Stub_Mcall, testArrayParamWithDefaultNullValue) zephir_fetch_params(1, 0, 1, &driverOptions_param); if (!driverOptions_param) { ZEPHIR_INIT_VAR(&driverOptions); - array_init(&driverOptions); } else { zephir_get_arrval(&driverOptions, driverOptions_param); } diff --git a/tests/Extension/MCallTest.php b/tests/Extension/MCallTest.php index 42a7b7728d..48b41d80de 100644 --- a/tests/Extension/MCallTest.php +++ b/tests/Extension/MCallTest.php @@ -114,7 +114,7 @@ public function testArrayParamWithDefaultNullValue(): void $this->assertNumberOfRequiredParameters(0); $this->assertSame('array', $this->getMethodFirstParameter()->getType()->getName()); - $this->assertSame($this->test->testArrayParamWithDefaultNullValue(), []); + $this->assertNull($this->test->testArrayParamWithDefaultNullValue()); $this->assertSame($this->test->testArrayParamWithDefaultNullValue([1]), [1]); } From cddef634b8a4078e9f29a3ba2f5f86e2ed21103c Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Thu, 15 Apr 2021 20:26:16 +0100 Subject: [PATCH 10/63] #1094 - Update CHANGELOG.md --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d1dab3c90e..d6cabf174d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,8 @@ The format based on [Keep a Changelog](http://keepachangelog.com) and this project adheres to [Semantic Versioning](http://semver.org). ## [Unreleased] - +### Fixed +- Fixed nullable array [#1094](https://github.com/zephir-lang/zephir/issues/1094) ## [0.13.2] - 2021-04-10 ### Fixed From 5a47a23883c759efec4232969b6ad7107d0dd093 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Thu, 15 Apr 2021 21:09:02 +0100 Subject: [PATCH 11/63] #774 - Add test case --- ext/config.m4 | 1 + ext/config.w32 | 2 +- ext/stub.c | 2 ++ ext/stub.h | 1 + ext/stub/arraymanipulation.zep.c | 30 +++++++++++++++++++++++ ext/stub/arraymanipulation.zep.h | 5 ++++ stub/arraymanipulation.zep | 16 ++++++++++++ tests/Extension/ArrayManipulationTest.php | 10 ++++++++ 8 files changed, 66 insertions(+), 1 deletion(-) diff --git a/ext/config.m4 b/ext/config.m4 index b23c1f699c..3c85410486 100644 --- a/ext/config.m4 +++ b/ext/config.m4 @@ -101,6 +101,7 @@ if test "$PHP_STUB" = "yes"; then stub/issue1521.zep.c stub/issue2165/issue.zep.c stub/issue663.zep.c + stub/issue914.zep.c stub/issues.zep.c stub/json.zep.c stub/logical.zep.c diff --git a/ext/config.w32 b/ext/config.w32 index bbf89b73ad..7397bc22b1 100644 --- a/ext/config.w32 +++ b/ext/config.w32 @@ -11,7 +11,7 @@ if (PHP_STUB != "no") { } ADD_SOURCES(configure_module_dirname + "/stub/invokes", "abstractprotected.zep.c abstractinvoker.zep.c abstractinvokercomplex.zep.c invokeprotected.zep.c invokeprotectedcomplex.zep.c", "stub"); - ADD_SOURCES(configure_module_dirname + "/stub", "testinterface.zep.c scallparent.zep.c constantsparent.zep.c methodinterface.zep.c arithmetic.zep.c arrayaccessobj.zep.c arrayaccesstest.zep.c arrayiterator.zep.c arrayiteratortest.zep.c arraymanipulation.zep.c arrayobject.zep.c arraysearch.zep.c assign.zep.c bitwise.zep.c branchprediction.zep.c cast.zep.c cblock.zep.c chars.zep.c closures.zep.c compare.zep.c concat.zep.c constants.zep.c constantsinterface.zep.c constantsinterfacea.zep.c constantsinterfaceb.zep.c declaretest.zep.c diinterface.zep.c echoes.zep.c emptytest.zep.c evaltest.zep.c exception.zep.c exceptions.zep.c exists.zep.c exitdie.zep.c extendedinterface.zep.c factorial.zep.c fannkuch.zep.c fasta.zep.c fcall.zep.c fetchtest.zep.c fibonnaci.zep.c flow.zep.c fortytwo.zep.c functional.zep.c functionexists.zep.c functions.zep.c geometry.zep.c globals.zep.c instance.zep.c instanceoff.zep.c internalclasses.zep.c internalinterfaces.zep.c invoke.zep.c issettest.zep.c issue1404.zep.c issue1521.zep.c issue663.zep.c issues.zep.c json.zep.c logical.zep.c mcall.zep.c mcallchained.zep.c mcalldynamic.zep.c mcallinternal.zep.c methodabstract.zep.c methodargs.zep.c nativearray.zep.c oo.zep.c operator.zep.c pdostatement.zep.c pregmatch.zep.c quantum.zep.c range.zep.c references.zep.c reflection.zep.c regexdna.zep.c requires.zep.c resourcetest.zep.c returns.zep.c router.zep.c scall.zep.c scalldynamic.zep.c scallexternal.zep.c scalllateconstruct.zep.c scope.zep.c sort.zep.c spectralnorm.zep.c spl.zep.c spropertyaccess.zep.c statements.zep.c strings.zep.c stubs.zep.c ternary.zep.c trytest.zep.c typeinstances.zep.c typeoff.zep.c unknownclass.zep.c unsettest.zep.c usetest.zep.c vars.zep.c 0__closure.zep.c 1__closure.zep.c 2__closure.zep.c 3__closure.zep.c 4__closure.zep.c 5__closure.zep.c 6__closure.zep.c 7__closure.zep.c 8__closure.zep.c 9__closure.zep.c 10__closure.zep.c 11__closure.zep.c 12__closure.zep.c 13__closure.zep.c", "stub"); + ADD_SOURCES(configure_module_dirname + "/stub", "testinterface.zep.c scallparent.zep.c constantsparent.zep.c methodinterface.zep.c arithmetic.zep.c arrayaccessobj.zep.c arrayaccesstest.zep.c arrayiterator.zep.c arrayiteratortest.zep.c arraymanipulation.zep.c arrayobject.zep.c arraysearch.zep.c assign.zep.c bitwise.zep.c branchprediction.zep.c cast.zep.c cblock.zep.c chars.zep.c closures.zep.c compare.zep.c concat.zep.c constants.zep.c constantsinterface.zep.c constantsinterfacea.zep.c constantsinterfaceb.zep.c declaretest.zep.c diinterface.zep.c echoes.zep.c emptytest.zep.c evaltest.zep.c exception.zep.c exceptions.zep.c exists.zep.c exitdie.zep.c extendedinterface.zep.c factorial.zep.c fannkuch.zep.c fasta.zep.c fcall.zep.c fetchtest.zep.c fibonnaci.zep.c flow.zep.c fortytwo.zep.c functional.zep.c functionexists.zep.c functions.zep.c geometry.zep.c globals.zep.c instance.zep.c instanceoff.zep.c internalclasses.zep.c internalinterfaces.zep.c invoke.zep.c issettest.zep.c issue1404.zep.c issue1521.zep.c issue663.zep.c issue914.zep.c issues.zep.c json.zep.c logical.zep.c mcall.zep.c mcallchained.zep.c mcalldynamic.zep.c mcallinternal.zep.c methodabstract.zep.c methodargs.zep.c nativearray.zep.c oo.zep.c operator.zep.c pdostatement.zep.c pregmatch.zep.c quantum.zep.c range.zep.c references.zep.c reflection.zep.c regexdna.zep.c requires.zep.c resourcetest.zep.c returns.zep.c router.zep.c scall.zep.c scalldynamic.zep.c scallexternal.zep.c scalllateconstruct.zep.c scope.zep.c sort.zep.c spectralnorm.zep.c spl.zep.c spropertyaccess.zep.c statements.zep.c strings.zep.c stubs.zep.c ternary.zep.c trytest.zep.c typeinstances.zep.c typeoff.zep.c unknownclass.zep.c unsettest.zep.c usetest.zep.c vars.zep.c 0__closure.zep.c 1__closure.zep.c 2__closure.zep.c 3__closure.zep.c 4__closure.zep.c 5__closure.zep.c 6__closure.zep.c 7__closure.zep.c 8__closure.zep.c 9__closure.zep.c 10__closure.zep.c 11__closure.zep.c 12__closure.zep.c 13__closure.zep.c", "stub"); ADD_SOURCES(configure_module_dirname + "/stub/oo/extend", "exception.zep.c", "stub"); ADD_SOURCES(configure_module_dirname + "/stub/issue2165", "issueextendinterface.zep.c issueinterface.zep.c issue.zep.c", "stub"); ADD_SOURCES(configure_module_dirname + "/stub/oo/extend/db", "exception.zep.c", "stub"); diff --git a/ext/stub.c b/ext/stub.c index 0104a07513..e1d6d7d6c6 100644 --- a/ext/stub.c +++ b/ext/stub.c @@ -130,6 +130,7 @@ zend_class_entry *stub_issue1404_ce; zend_class_entry *stub_issue1521_ce; zend_class_entry *stub_issue2165_issue_ce; zend_class_entry *stub_issue663_ce; +zend_class_entry *stub_issue914_ce; zend_class_entry *stub_issues_ce; zend_class_entry *stub_json_ce; zend_class_entry *stub_logical_ce; @@ -348,6 +349,7 @@ static PHP_MINIT_FUNCTION(stub) ZEPHIR_INIT(Stub_Issue1521); ZEPHIR_INIT(Stub_Issue2165_Issue); ZEPHIR_INIT(Stub_Issue663); + ZEPHIR_INIT(Stub_Issue914); ZEPHIR_INIT(Stub_Issues); ZEPHIR_INIT(Stub_Json); ZEPHIR_INIT(Stub_Logical); diff --git a/ext/stub.h b/ext/stub.h index 7322b12c89..a253b700ec 100644 --- a/ext/stub.h +++ b/ext/stub.h @@ -96,6 +96,7 @@ #include "stub/issue1521.zep.h" #include "stub/issue2165/issue.zep.h" #include "stub/issue663.zep.h" +#include "stub/issue914.zep.h" #include "stub/issues.zep.h" #include "stub/json.zep.h" #include "stub/logical.zep.h" diff --git a/ext/stub/arraymanipulation.zep.c b/ext/stub/arraymanipulation.zep.c index 314ab425be..ec9179bfdf 100644 --- a/ext/stub/arraymanipulation.zep.c +++ b/ext/stub/arraymanipulation.zep.c @@ -56,6 +56,36 @@ PHP_METHOD(Stub_ArrayManipulation, arrayFillMany) RETURN_MM_MEMBER(getThis(), "arrayFillQueue"); } +/** + * @issue https://github.com/zephir-lang/zephir/issues/774 + */ +PHP_METHOD(Stub_ArrayManipulation, issue774) +{ + zval _1; + zval obj, _0; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&obj); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + + + ZEPHIR_MM_GROW(); + + ZEPHIR_INIT_VAR(&obj); + object_init(&obj); + ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_LONG(&_0, 0); + zephir_update_property_zval(&obj, ZEND_STRL("prop0"), &_0); + ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_LONG(&_0, 1); + zephir_update_property_zval(&obj, ZEND_STRL("prop1"), &_0); + zephir_get_arrval(&_1, &obj); + ZEPHIR_CPY_WRT(&obj, &_1); + RETURN_CCTOR(&obj); +} + zend_object *zephir_init_properties_Stub_ArrayManipulation(zend_class_entry *class_type) { zval _0, _1$$3; diff --git a/ext/stub/arraymanipulation.zep.h b/ext/stub/arraymanipulation.zep.h index 1fc8db053d..72bf53d7c8 100644 --- a/ext/stub/arraymanipulation.zep.h +++ b/ext/stub/arraymanipulation.zep.h @@ -4,15 +4,20 @@ extern zend_class_entry *stub_arraymanipulation_ce; ZEPHIR_INIT_CLASS(Stub_ArrayManipulation); PHP_METHOD(Stub_ArrayManipulation, arrayFillMany); +PHP_METHOD(Stub_ArrayManipulation, issue774); zend_object *zephir_init_properties_Stub_ArrayManipulation(zend_class_entry *class_type); ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arraymanipulation_arrayfillmany, 0, 0, IS_ARRAY, 0) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arraymanipulation_issue774, 0, 0, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arraymanipulation_zephir_init_properties_stub_arraymanipulation, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_arraymanipulation_method_entry) { PHP_ME(Stub_ArrayManipulation, arrayFillMany, arginfo_stub_arraymanipulation_arrayfillmany, ZEND_ACC_PUBLIC) + PHP_ME(Stub_ArrayManipulation, issue774, arginfo_stub_arraymanipulation_issue774, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/stub/arraymanipulation.zep b/stub/arraymanipulation.zep index 05a48170ca..2ec4ebc957 100644 --- a/stub/arraymanipulation.zep +++ b/stub/arraymanipulation.zep @@ -13,4 +13,20 @@ class ArrayManipulation return this->arrayFillQueue; } + + /** + * @issue https://github.com/zephir-lang/zephir/issues/774 + */ + public function issue774() -> array + { + var obj; + + let + obj = new \stdClass(), + obj->prop0 = 0, + obj->prop1 = 1, + obj = (array)obj; + + return obj; + } } diff --git a/tests/Extension/ArrayManipulationTest.php b/tests/Extension/ArrayManipulationTest.php index 83306c00b9..7847d8cff9 100644 --- a/tests/Extension/ArrayManipulationTest.php +++ b/tests/Extension/ArrayManipulationTest.php @@ -26,4 +26,14 @@ public function testArrayFill(): void $this->assertIsArray($array); $this->assertCount(1000000, $array); } + + /** + * @issue https://github.com/zephir-lang/zephir/issues/774 + */ + public function testIssue774(): void + { + $class = new ArrayManipulation(); + + $this->assertSame(['prop0' => 0, 'prop1' => 1], $class->issue774()); + } } From 747a142636901e17dc106c61ed90fbed8b015ea2 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Fri, 16 Apr 2021 08:28:08 +0100 Subject: [PATCH 12/63] #1086 - Add test case --- ext/stub/arrayaccesstest.zep.c | 106 ++++++++++++++++++++++++++++ ext/stub/arrayaccesstest.zep.h | 22 ++++++ stub/arrayaccesstest.zep | 34 +++++++++ tests/Extension/ArrayAccessTest.php | 8 +++ 4 files changed, 170 insertions(+) diff --git a/ext/stub/arrayaccesstest.zep.c b/ext/stub/arrayaccesstest.zep.c index eb0c587b01..ac51446fd8 100644 --- a/ext/stub/arrayaccesstest.zep.c +++ b/ext/stub/arrayaccesstest.zep.c @@ -17,6 +17,8 @@ #include "kernel/array.h" #include "kernel/object.h" #include "kernel/operators.h" +#include "ext/spl/spl_exceptions.h" +#include "kernel/exception.h" ZEPHIR_INIT_CLASS(Stub_ArrayAccessTest) @@ -215,3 +217,107 @@ PHP_METHOD(Stub_ArrayAccessTest, issue1094Test3) RETURN_MM_BOOL(isItemsNULL); } +PHP_METHOD(Stub_ArrayAccessTest, issue1086Test1ArrayStrict) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *params_param = NULL, _0; + zval params; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(¶ms); + ZVAL_UNDEF(&_0); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ARRAY(params) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, ¶ms_param); + ZEPHIR_OBS_COPY_OR_DUP(¶ms, params_param); + + + ZEPHIR_INIT_VAR(&_0); + ZVAL_LONG(&_0, 1234); + zephir_array_update_string(¶ms, SL("test2"), &_0, PH_COPY | PH_SEPARATE); + ZEPHIR_MM_RESTORE(); +} + +PHP_METHOD(Stub_ArrayAccessTest, issue1086TestArrayStrict) +{ + zval _0; + zval params; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(¶ms); + ZVAL_UNDEF(&_0); + + + ZEPHIR_MM_GROW(); + + ZEPHIR_INIT_VAR(¶ms); + array_init(¶ms); + ZEPHIR_INIT_VAR(&_0); + ZVAL_LONG(&_0, 123); + zephir_array_update_string(¶ms, SL("test"), &_0, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_SELF(NULL, "issue1086test1arraystrict", NULL, 0, ¶ms); + zephir_check_call_status(); + RETURN_CTOR(¶ms); +} + +PHP_METHOD(Stub_ArrayAccessTest, issue1086Test1Array) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *params_param = NULL, _0; + zval params; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(¶ms); + ZVAL_UNDEF(&_0); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ARRAY(params) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, ¶ms_param); + zephir_get_arrval(¶ms, params_param); + + + ZEPHIR_INIT_VAR(&_0); + ZVAL_LONG(&_0, 1234); + zephir_array_update_string(¶ms, SL("test2"), &_0, PH_COPY | PH_SEPARATE); + ZEPHIR_MM_RESTORE(); +} + +PHP_METHOD(Stub_ArrayAccessTest, issue1086TestArray) +{ + zval _0; + zval params; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(¶ms); + ZVAL_UNDEF(&_0); + + + ZEPHIR_MM_GROW(); + + ZEPHIR_INIT_VAR(¶ms); + array_init(¶ms); + ZEPHIR_INIT_VAR(&_0); + ZVAL_LONG(&_0, 123); + zephir_array_update_string(¶ms, SL("test"), &_0, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_SELF(NULL, "issue1086test1array", NULL, 0, ¶ms); + zephir_check_call_status(); + RETURN_CTOR(¶ms); +} + diff --git a/ext/stub/arrayaccesstest.zep.h b/ext/stub/arrayaccesstest.zep.h index c127601bb8..f64310019c 100644 --- a/ext/stub/arrayaccesstest.zep.h +++ b/ext/stub/arrayaccesstest.zep.h @@ -10,6 +10,10 @@ PHP_METHOD(Stub_ArrayAccessTest, issue1155); PHP_METHOD(Stub_ArrayAccessTest, issue1094Test1); PHP_METHOD(Stub_ArrayAccessTest, issue1094Test2); PHP_METHOD(Stub_ArrayAccessTest, issue1094Test3); +PHP_METHOD(Stub_ArrayAccessTest, issue1086Test1ArrayStrict); +PHP_METHOD(Stub_ArrayAccessTest, issue1086TestArrayStrict); +PHP_METHOD(Stub_ArrayAccessTest, issue1086Test1Array); +PHP_METHOD(Stub_ArrayAccessTest, issue1086TestArray); ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayaccesstest_exits, 0, 0, 0) ZEND_END_ARG_INFO() @@ -35,6 +39,20 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccesstest_issue1094te ZEND_ARG_ARRAY_INFO(0, items, 1) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayaccesstest_issue1086test1arraystrict, 0, 0, 1) + ZEND_ARG_ARRAY_INFO(0, params, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccesstest_issue1086testarraystrict, 0, 0, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayaccesstest_issue1086test1array, 0, 0, 1) + ZEND_ARG_ARRAY_INFO(0, params, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccesstest_issue1086testarray, 0, 0, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + ZEPHIR_INIT_FUNCS(stub_arrayaccesstest_method_entry) { #if PHP_VERSION_ID >= 80000 PHP_ME(Stub_ArrayAccessTest, exits, arginfo_stub_arrayaccesstest_exits, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) @@ -51,5 +69,9 @@ ZEPHIR_INIT_FUNCS(stub_arrayaccesstest_method_entry) { PHP_ME(Stub_ArrayAccessTest, issue1094Test1, arginfo_stub_arrayaccesstest_issue1094test1, ZEND_ACC_PUBLIC) PHP_ME(Stub_ArrayAccessTest, issue1094Test2, arginfo_stub_arrayaccesstest_issue1094test2, ZEND_ACC_PUBLIC) PHP_ME(Stub_ArrayAccessTest, issue1094Test3, arginfo_stub_arrayaccesstest_issue1094test3, ZEND_ACC_PUBLIC) + PHP_ME(Stub_ArrayAccessTest, issue1086Test1ArrayStrict, arginfo_stub_arrayaccesstest_issue1086test1arraystrict, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + PHP_ME(Stub_ArrayAccessTest, issue1086TestArrayStrict, arginfo_stub_arrayaccesstest_issue1086testarraystrict, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + PHP_ME(Stub_ArrayAccessTest, issue1086Test1Array, arginfo_stub_arrayaccesstest_issue1086test1array, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + PHP_ME(Stub_ArrayAccessTest, issue1086TestArray, arginfo_stub_arrayaccesstest_issue1086testarray, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_FE_END }; diff --git a/stub/arrayaccesstest.zep b/stub/arrayaccesstest.zep index 80171d73e9..bdb0e91d0c 100644 --- a/stub/arrayaccesstest.zep +++ b/stub/arrayaccesstest.zep @@ -71,4 +71,38 @@ class ArrayAccessTest return isItemsNULL; } + + public static function issue1086Test1ArrayStrict(array! params) + { + let params["test2"] = 1234; + } + + public static function issue1086TestArrayStrict() -> array + { + array params; + + let params = []; + let params["test"] = 123; + + self::issue1086Test1ArrayStrict(params); + + return params; + } + + public static function issue1086Test1Array(array params) + { + let params["test2"] = 1234; + } + + public static function issue1086TestArray() -> array + { + array params; + + let params = []; + let params["test"] = 123; + + self::issue1086Test1Array(params); + + return params; + } } diff --git a/tests/Extension/ArrayAccessTest.php b/tests/Extension/ArrayAccessTest.php index e146ec90e5..e1151ccdb3 100644 --- a/tests/Extension/ArrayAccessTest.php +++ b/tests/Extension/ArrayAccessTest.php @@ -61,4 +61,12 @@ public function testIssue1094(): void $this->assertFalse($class->issue1094Test3([])); $this->assertFalse($class->issue1094Test3(['test' => 'ok'])); } + + public function testIssue1086(): void + { + $class = new \Stub\ArrayAccessTest(); + + $this->assertSame(['test' => 123], $class->issue1086TestArrayStrict()); + $this->assertSame(['test' => 123], $class->issue1086TestArray()); + } } From 5492ea2a1182218f089e47654934387a664200af Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Fri, 16 Apr 2021 09:11:58 +0100 Subject: [PATCH 13/63] Review composer requirements --- composer.json | 19 +-- composer.lock | 335 +++++++++++++++++++-------------------------- tests/services.yml | 2 - 3 files changed, 144 insertions(+), 212 deletions(-) diff --git a/composer.json b/composer.json index fca4b66ffc..28c2529017 100644 --- a/composer.json +++ b/composer.json @@ -31,20 +31,11 @@ "ext-zlib": "*", "ocramius/proxy-manager": "^2.10", "oneup/flysystem-bundle": "^1.14 || ^3.0", - "symfony/cache": "3.4.*", - "symfony/config": "3.4.*", - "symfony/console": "3.4.*", - "symfony/dependency-injection": "3.4.*", - "symfony/event-dispatcher": "3.4.*", - "symfony/filesystem": "3.4.*", - "symfony/finder": "3.4.*", - "symfony/framework-bundle": "3.4.*", - "symfony/http-kernel": "3.4.*", - "symfony/monolog-bridge": "3.4.*", - "symfony/monolog-bundle": "3.3.*", - "symfony/proxy-manager-bridge": "3.4.*", - "symfony/routing": "3.4.*", - "symfony/yaml": "3.4.*" + "symfony/console": "^3.4", + "symfony/framework-bundle": "^3.4", + "symfony/monolog-bridge": "^3.4", + "symfony/monolog-bundle": "^2.12", + "symfony/yaml": "^3.4" }, "require-dev": { "ext-gmp": "*", diff --git a/composer.lock b/composer.lock index 1656b13c3f..52978389ba 100644 --- a/composer.lock +++ b/composer.lock @@ -4,93 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "dde851ce9c6000d79a80d6658a0a461f", + "content-hash": "c35c1f2d8b603f856b0a02841bd2fe8a", "packages": [ - { - "name": "composer/package-versions-deprecated", - "version": "1.11.99.1", - "source": { - "type": "git", - "url": "https://github.com/composer/package-versions-deprecated.git", - "reference": "7413f0b55a051e89485c5cb9f765fe24bb02a7b6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/package-versions-deprecated/zipball/7413f0b55a051e89485c5cb9f765fe24bb02a7b6", - "reference": "7413f0b55a051e89485c5cb9f765fe24bb02a7b6", - "shasum": "" - }, - "require": { - "composer-plugin-api": "^1.1.0 || ^2.0", - "php": "^7 || ^8" - }, - "replace": { - "ocramius/package-versions": "1.11.99" - }, - "require-dev": { - "composer/composer": "^1.9.3 || ^2.0@dev", - "ext-zip": "^1.13", - "phpunit/phpunit": "^6.5 || ^7" - }, - "type": "composer-plugin", - "extra": { - "class": "PackageVersions\\Installer", - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "PackageVersions\\": "src/PackageVersions" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com" - }, - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be" - } - ], - "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", - "support": { - "issues": "https://github.com/composer/package-versions-deprecated/issues", - "source": "https://github.com/composer/package-versions-deprecated/tree/1.11.99.1" - }, - "funding": [ - { - "url": "https://packagist.com", - "type": "custom" - }, - { - "url": "https://github.com/composer", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/composer/composer", - "type": "tidelift" - } - ], - "time": "2020-11-11T10:22:58+00:00" - }, { "name": "laminas/laminas-code", - "version": "4.1.0", + "version": "4.2.0", "source": { "type": "git", "url": "https://github.com/laminas/laminas-code.git", - "reference": "5b553c274b94af3f880cbaaf8fbab047f279a31c" + "reference": "e7e8f8a9c267520051d8026ff1da74823a3d8b97" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-code/zipball/5b553c274b94af3f880cbaaf8fbab047f279a31c", - "reference": "5b553c274b94af3f880cbaaf8fbab047f279a31c", + "url": "https://api.github.com/repos/laminas/laminas-code/zipball/e7e8f8a9c267520051d8026ff1da74823a3d8b97", + "reference": "e7e8f8a9c267520051d8026ff1da74823a3d8b97", "shasum": "" }, "require": { @@ -148,7 +75,7 @@ "type": "community_bridge" } ], - "time": "2021-03-27T13:55:31+00:00" + "time": "2021-04-14T22:05:06+00:00" }, { "name": "laminas/laminas-eventmanager", @@ -1444,31 +1371,38 @@ }, { "name": "symfony/event-dispatcher", - "version": "v3.4.47", + "version": "v4.4.20", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "31fde73757b6bad247c54597beef974919ec6860" + "reference": "c352647244bd376bf7d31efbd5401f13f50dad0c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/31fde73757b6bad247c54597beef974919ec6860", - "reference": "31fde73757b6bad247c54597beef974919ec6860", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/c352647244bd376bf7d31efbd5401f13f50dad0c", + "reference": "c352647244bd376bf7d31efbd5401f13f50dad0c", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8" + "php": ">=7.1.3", + "symfony/event-dispatcher-contracts": "^1.1" }, "conflict": { - "symfony/dependency-injection": "<3.3" + "symfony/dependency-injection": "<3.4" + }, + "provide": { + "psr/event-dispatcher-implementation": "1.0", + "symfony/event-dispatcher-implementation": "1.1" }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "~2.8|~3.0|~4.0", - "symfony/debug": "~3.4|~4.4", - "symfony/dependency-injection": "~3.3|~4.0", - "symfony/expression-language": "~2.8|~3.0|~4.0", - "symfony/stopwatch": "~2.8|~3.0|~4.0" + "symfony/config": "^3.4|^4.0|^5.0", + "symfony/dependency-injection": "^3.4|^4.0|^5.0", + "symfony/error-handler": "~3.4|~4.4", + "symfony/expression-language": "^3.4|^4.0|^5.0", + "symfony/http-foundation": "^3.4|^4.0|^5.0", + "symfony/service-contracts": "^1.1|^2", + "symfony/stopwatch": "^3.4|^4.0|^5.0" }, "suggest": { "symfony/dependency-injection": "", @@ -1497,10 +1431,10 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony EventDispatcher Component", + "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/event-dispatcher/tree/v3.4.47" + "source": "https://github.com/symfony/event-dispatcher/tree/v4.4.20" }, "funding": [ { @@ -1516,24 +1450,103 @@ "type": "tidelift" } ], - "time": "2020-10-24T10:57:07+00:00" + "time": "2021-01-27T09:09:26+00:00" + }, + { + "name": "symfony/event-dispatcher-contracts", + "version": "v1.1.9", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher-contracts.git", + "reference": "84e23fdcd2517bf37aecbd16967e83f0caee25a7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/84e23fdcd2517bf37aecbd16967e83f0caee25a7", + "reference": "84e23fdcd2517bf37aecbd16967e83f0caee25a7", + "shasum": "" + }, + "require": { + "php": ">=7.1.3" + }, + "suggest": { + "psr/event-dispatcher": "", + "symfony/event-dispatcher-implementation": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\EventDispatcher\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to dispatching event", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v1.1.9" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-07-06T13:19:58+00:00" }, { "name": "symfony/filesystem", - "version": "v3.4.47", + "version": "v4.4.21", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "e58d7841cddfed6e846829040dca2cca0ebbbbb3" + "reference": "940826c465be2690c9fae91b2793481e5cbd6834" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/e58d7841cddfed6e846829040dca2cca0ebbbbb3", - "reference": "e58d7841cddfed6e846829040dca2cca0ebbbbb3", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/940826c465be2690c9fae91b2793481e5cbd6834", + "reference": "940826c465be2690c9fae91b2793481e5cbd6834", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", + "php": ">=7.1.3", "symfony/polyfill-ctype": "~1.8" }, "type": "library", @@ -1559,10 +1572,10 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Filesystem Component", + "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v3.4.47" + "source": "https://github.com/symfony/filesystem/tree/v4.4.21" }, "funding": [ { @@ -1578,24 +1591,24 @@ "type": "tidelift" } ], - "time": "2020-10-24T10:57:07+00:00" + "time": "2021-03-28T09:59:32+00:00" }, { "name": "symfony/finder", - "version": "v3.4.47", + "version": "v4.4.20", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "b6b6ad3db3edb1b4b1c1896b1975fb684994de6e" + "reference": "2543795ab1570df588b9bbd31e1a2bd7037b94f6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/b6b6ad3db3edb1b4b1c1896b1975fb684994de6e", - "reference": "b6b6ad3db3edb1b4b1c1896b1975fb684994de6e", + "url": "https://api.github.com/repos/symfony/finder/zipball/2543795ab1570df588b9bbd31e1a2bd7037b94f6", + "reference": "2543795ab1570df588b9bbd31e1a2bd7037b94f6", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8" + "php": ">=7.1.3" }, "type": "library", "autoload": { @@ -1620,10 +1633,10 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Finder Component", + "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v3.4.47" + "source": "https://github.com/symfony/finder/tree/v4.4.20" }, "funding": [ { @@ -1639,7 +1652,7 @@ "type": "tidelift" } ], - "time": "2020-11-16T17:02:08+00:00" + "time": "2021-02-12T10:48:09+00:00" }, { "name": "symfony/framework-bundle", @@ -2102,44 +2115,41 @@ }, { "name": "symfony/monolog-bundle", - "version": "v3.3.1", + "version": "v2.12.1", "source": { "type": "git", "url": "https://github.com/symfony/monolog-bundle.git", - "reference": "572e143afc03419a75ab002c80a2fd99299195ff" + "reference": "b0146bdca7ba2a65f3bbe7010423c7393b29ec3f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/monolog-bundle/zipball/572e143afc03419a75ab002c80a2fd99299195ff", - "reference": "572e143afc03419a75ab002c80a2fd99299195ff", + "url": "https://api.github.com/repos/symfony/monolog-bundle/zipball/b0146bdca7ba2a65f3bbe7010423c7393b29ec3f", + "reference": "b0146bdca7ba2a65f3bbe7010423c7393b29ec3f", "shasum": "" }, "require": { - "monolog/monolog": "~1.22", - "php": ">=5.6", - "symfony/config": "~2.7|~3.3|~4.0", - "symfony/dependency-injection": "~2.7|~3.4.10|^4.0.10", - "symfony/http-kernel": "~2.7|~3.3|~4.0", - "symfony/monolog-bridge": "~2.7|~3.3|~4.0" + "monolog/monolog": "~1.18", + "php": ">=5.3.2", + "symfony/config": "~2.3|~3.0", + "symfony/dependency-injection": "~2.3|~3.0", + "symfony/http-kernel": "~2.3|~3.0", + "symfony/monolog-bridge": "~2.3|~3.0" }, "require-dev": { - "symfony/console": "~2.7|~3.3|~4.0", - "symfony/phpunit-bridge": "^3.3|^4.0", - "symfony/yaml": "~2.7|~3.3|~4.0" + "phpunit/phpunit": "^4.8", + "symfony/console": "~2.3|~3.0", + "symfony/yaml": "~2.3|~3.0" }, "type": "symfony-bundle", "extra": { "branch-alias": { - "dev-master": "3.x-dev" + "dev-master": "2.x-dev" } }, "autoload": { "psr-4": { "Symfony\\Bundle\\MonologBundle\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2163,9 +2173,9 @@ ], "support": { "issues": "https://github.com/symfony/monolog-bundle/issues", - "source": "https://github.com/symfony/monolog-bundle/tree/master" + "source": "https://github.com/symfony/monolog-bundle/tree/2.x" }, - "time": "2018-11-04T09:58:13+00:00" + "time": "2017-01-02T19:04:26+00:00" }, { "name": "symfony/polyfill-apcu", @@ -2801,73 +2811,6 @@ ], "time": "2021-01-07T16:49:33+00:00" }, - { - "name": "symfony/proxy-manager-bridge", - "version": "v3.4.47", - "source": { - "type": "git", - "url": "https://github.com/symfony/proxy-manager-bridge.git", - "reference": "25351bb4d5a60cfeddbaf6cf6faebd3a700e2ff4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/proxy-manager-bridge/zipball/25351bb4d5a60cfeddbaf6cf6faebd3a700e2ff4", - "reference": "25351bb4d5a60cfeddbaf6cf6faebd3a700e2ff4", - "shasum": "" - }, - "require": { - "composer/package-versions-deprecated": "^1.8", - "ocramius/proxy-manager": "~0.4|~1.0|~2.0", - "php": "^5.5.9|>=7.0.8", - "symfony/dependency-injection": "~3.4|~4.0" - }, - "require-dev": { - "symfony/config": "~2.8|~3.0|~4.0" - }, - "type": "symfony-bridge", - "autoload": { - "psr-4": { - "Symfony\\Bridge\\ProxyManager\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony ProxyManager Bridge", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/proxy-manager-bridge/tree/v3.4.47" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2020-10-27T11:56:04+00:00" - }, { "name": "symfony/routing", "version": "v3.4.47", diff --git a/tests/services.yml b/tests/services.yml index f7372e93c2..a2a3c3217c 100644 --- a/tests/services.yml +++ b/tests/services.yml @@ -1,6 +1,4 @@ services: - Psr\Log\LoggerInterface: - public: true Zephir\CompilerFile: public: true From a3d82bfd4c0971ae4898d2400e26f0027b8a7e0f Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Fri, 16 Apr 2021 09:42:22 +0100 Subject: [PATCH 14/63] Update stub/arrayaccesstest.zep Co-authored-by: Alexander Andriiako --- stub/arrayaccesstest.zep | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stub/arrayaccesstest.zep b/stub/arrayaccesstest.zep index bdb0e91d0c..116176faf0 100644 --- a/stub/arrayaccesstest.zep +++ b/stub/arrayaccesstest.zep @@ -72,7 +72,7 @@ class ArrayAccessTest return isItemsNULL; } - public static function issue1086Test1ArrayStrict(array! params) + public static function issue1086AddElementToArrayWithStrictParams(array! params) { let params["test2"] = 1234; } From e96ea17cfe3d02785e6aa2d126e75bb2922a6885 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Fri, 16 Apr 2021 09:42:53 +0100 Subject: [PATCH 15/63] Apply suggestions from code review Co-authored-by: Alexander Andriiako --- stub/arrayaccesstest.zep | 10 +++++----- tests/Extension/ArrayAccessTest.php | 10 +++++++--- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/stub/arrayaccesstest.zep b/stub/arrayaccesstest.zep index 116176faf0..7b86287201 100644 --- a/stub/arrayaccesstest.zep +++ b/stub/arrayaccesstest.zep @@ -77,31 +77,31 @@ class ArrayAccessTest let params["test2"] = 1234; } - public static function issue1086TestArrayStrict() -> array + public static function issue1086CanAddAnElementToExistingArrayWithStrictParams() -> array { array params; let params = []; let params["test"] = 123; - self::issue1086Test1ArrayStrict(params); + self::issue1086AddElementToArrayWithStrictParams(params); return params; } - public static function issue1086Test1Array(array params) + public static function issue1086AddElementToArrayWithoutStrictParams(array params) { let params["test2"] = 1234; } - public static function issue1086TestArray() -> array + public static function issue1086CanAddAnElementToExistingArrayWithoutStrictParams() -> array { array params; let params = []; let params["test"] = 123; - self::issue1086Test1Array(params); + self::issue1086AddElementToArrayWithoutStrictParams(params); return params; } diff --git a/tests/Extension/ArrayAccessTest.php b/tests/Extension/ArrayAccessTest.php index e1151ccdb3..a4051ea194 100644 --- a/tests/Extension/ArrayAccessTest.php +++ b/tests/Extension/ArrayAccessTest.php @@ -62,11 +62,15 @@ public function testIssue1094(): void $this->assertFalse($class->issue1094Test3(['test' => 'ok'])); } - public function testIssue1086(): void + public function testIssue1086CanAddAnElementToExistingArray(): void { $class = new \Stub\ArrayAccessTest(); - $this->assertSame(['test' => 123], $class->issue1086TestArrayStrict()); - $this->assertSame(['test' => 123], $class->issue1086TestArray()); + $actual = $class->issue1086CanAddAnElementToExistingArrayWithStrictParams(); + $this->assertSame(['test' => 123], $actual); + $this->assertSame(['test2' => 1234], $actual); + $actual = $class->issue1086CanAddAnElementToExistingArrayWithoutStrictParams(); + $this->assertSame(['test' => 123], $actual); + $this->assertSame(['test2' => 1234], $actual); } } From 53612d78cdc479a06c81fdeed0d48c0743d76961 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Fri, 16 Apr 2021 09:44:43 +0100 Subject: [PATCH 16/63] Bump versions of composer requirements --- composer.json | 12 +- composer.lock | 1495 +++++++++++++++++++++++++++++-------------------- 2 files changed, 898 insertions(+), 609 deletions(-) diff --git a/composer.json b/composer.json index 28c2529017..07a2b0cc53 100644 --- a/composer.json +++ b/composer.json @@ -30,12 +30,12 @@ "ext-xml": "*", "ext-zlib": "*", "ocramius/proxy-manager": "^2.10", - "oneup/flysystem-bundle": "^1.14 || ^3.0", - "symfony/console": "^3.4", - "symfony/framework-bundle": "^3.4", - "symfony/monolog-bridge": "^3.4", - "symfony/monolog-bundle": "^2.12", - "symfony/yaml": "^3.4" + "oneup/flysystem-bundle": "^3.0", + "symfony/console": "^5.2", + "symfony/framework-bundle": "^5.2", + "symfony/monolog-bridge": "^5.2", + "symfony/monolog-bundle": "^3.7", + "symfony/yaml": "^5.2" }, "require-dev": { "ext-gmp": "*", diff --git a/composer.lock b/composer.lock index 52978389ba..6eafadc867 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "c35c1f2d8b603f856b0a02841bd2fe8a", + "content-hash": "262fe080aa48c0757cc0a3a9dd090ca4", "packages": [ { "name": "laminas/laminas-code", @@ -358,21 +358,21 @@ }, { "name": "monolog/monolog", - "version": "1.26.0", + "version": "2.2.0", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "2209ddd84e7ef1256b7af205d0717fb62cfc9c33" + "reference": "1cb1cde8e8dd0f70cc0fe51354a59acad9302084" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/2209ddd84e7ef1256b7af205d0717fb62cfc9c33", - "reference": "2209ddd84e7ef1256b7af205d0717fb62cfc9c33", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/1cb1cde8e8dd0f70cc0fe51354a59acad9302084", + "reference": "1cb1cde8e8dd0f70cc0fe51354a59acad9302084", "shasum": "" }, "require": { - "php": ">=5.3.0", - "psr/log": "~1.0" + "php": ">=7.2", + "psr/log": "^1.0.1" }, "provide": { "psr/log-implementation": "1.0.0" @@ -380,29 +380,39 @@ "require-dev": { "aws/aws-sdk-php": "^2.4.9 || ^3.0", "doctrine/couchdb": "~1.0@dev", - "graylog2/gelf-php": "~1.0", + "elasticsearch/elasticsearch": "^7", + "graylog2/gelf-php": "^1.4.2", + "mongodb/mongodb": "^1.8", "php-amqplib/php-amqplib": "~2.4", "php-console/php-console": "^3.1.3", + "phpspec/prophecy": "^1.6.1", "phpstan/phpstan": "^0.12.59", - "phpunit/phpunit": "~4.5", - "ruflin/elastica": ">=0.90 <3.0", - "sentry/sentry": "^0.13", + "phpunit/phpunit": "^8.5", + "predis/predis": "^1.1", + "rollbar/rollbar": "^1.3", + "ruflin/elastica": ">=0.90 <7.0.1", "swiftmailer/swiftmailer": "^5.3|^6.0" }, "suggest": { "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", "doctrine/couchdb": "Allow sending log messages to a CouchDB server", + "elasticsearch/elasticsearch": "Allow sending log messages to an Elasticsearch server via official client", "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", - "ext-mongo": "Allow sending log messages to a MongoDB server", + "ext-mbstring": "Allow to work properly with unicode symbols", + "ext-mongodb": "Allow sending log messages to a MongoDB server (via driver)", "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", - "mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver", + "mongodb/mongodb": "Allow sending log messages to a MongoDB server (via library)", "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", "php-console/php-console": "Allow sending log messages to Google Chrome", "rollbar/rollbar": "Allow sending log messages to Rollbar", - "ruflin/elastica": "Allow sending log messages to an Elastic Search server", - "sentry/sentry": "Allow sending log messages to a Sentry server" + "ruflin/elastica": "Allow sending log messages to an Elastic Search server" }, "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.x-dev" + } + }, "autoload": { "psr-4": { "Monolog\\": "src/Monolog" @@ -416,11 +426,11 @@ { "name": "Jordi Boggiano", "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" + "homepage": "https://seld.be" } ], "description": "Sends your logs to files, sockets, inboxes, databases and various web services", - "homepage": "http://github.com/Seldaek/monolog", + "homepage": "https://github.com/Seldaek/monolog", "keywords": [ "log", "logging", @@ -428,7 +438,7 @@ ], "support": { "issues": "https://github.com/Seldaek/monolog/issues", - "source": "https://github.com/Seldaek/monolog/tree/1.26.0" + "source": "https://github.com/Seldaek/monolog/tree/2.2.0" }, "funding": [ { @@ -440,7 +450,7 @@ "type": "tidelift" } ], - "time": "2020-12-14T12:56:38+00:00" + "time": "2020-12-14T13:15:25+00:00" }, { "name": "ocramius/proxy-manager", @@ -644,20 +654,20 @@ }, { "name": "psr/cache", - "version": "1.0.1", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/php-fig/cache.git", - "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8" + "reference": "213f9dbc5b9bfbc4f8db86d2838dc968752ce13b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", - "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", + "url": "https://api.github.com/repos/php-fig/cache/zipball/213f9dbc5b9bfbc4f8db86d2838dc968752ce13b", + "reference": "213f9dbc5b9bfbc4f8db86d2838dc968752ce13b", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=8.0.0" }, "type": "library", "extra": { @@ -677,7 +687,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common interface for caching libraries", @@ -687,9 +697,9 @@ "psr-6" ], "support": { - "source": "https://github.com/php-fig/cache/tree/master" + "source": "https://github.com/php-fig/cache/tree/2.0.0" }, - "time": "2016-08-06T20:24:11+00:00" + "time": "2021-02-03T23:23:37+00:00" }, { "name": "psr/container", @@ -740,31 +750,31 @@ "time": "2021-03-05T17:36:06+00:00" }, { - "name": "psr/log", - "version": "1.1.3", + "name": "psr/event-dispatcher", + "version": "1.0.0", "source": { "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc" + "url": "https://github.com/php-fig/event-dispatcher.git", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/0f73288fd15629204f9d42b7055f72dacbe811fc", - "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc", + "url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=7.2.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "1.0.x-dev" } }, "autoload": { "psr-4": { - "Psr\\Log\\": "Psr/Log/" + "Psr\\EventDispatcher\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -777,30 +787,30 @@ "homepage": "http://www.php-fig.org/" } ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", + "description": "Standard interfaces for event handling.", "keywords": [ - "log", + "events", "psr", - "psr-3" + "psr-14" ], "support": { - "source": "https://github.com/php-fig/log/tree/1.1.3" + "issues": "https://github.com/php-fig/event-dispatcher/issues", + "source": "https://github.com/php-fig/event-dispatcher/tree/1.0.0" }, - "time": "2020-03-23T09:12:05+00:00" + "time": "2019-01-08T18:20:26+00:00" }, { - "name": "psr/simple-cache", - "version": "1.0.1", + "name": "psr/log", + "version": "1.1.3", "source": { "type": "git", - "url": "https://github.com/php-fig/simple-cache.git", - "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b" + "url": "https://github.com/php-fig/log.git", + "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", - "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", + "url": "https://api.github.com/repos/php-fig/log/zipball/0f73288fd15629204f9d42b7055f72dacbe811fc", + "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc", "shasum": "" }, "require": { @@ -809,12 +819,12 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.1.x-dev" } }, "autoload": { "psr-4": { - "Psr\\SimpleCache\\": "src/" + "Psr\\Log\\": "Psr/Log/" } }, "notification-url": "https://packagist.org/downloads/", @@ -827,52 +837,64 @@ "homepage": "http://www.php-fig.org/" } ], - "description": "Common interfaces for simple caching", + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", "keywords": [ - "cache", - "caching", + "log", "psr", - "psr-16", - "simple-cache" + "psr-3" ], "support": { - "source": "https://github.com/php-fig/simple-cache/tree/master" + "source": "https://github.com/php-fig/log/tree/1.1.3" }, - "time": "2017-10-23T01:57:42+00:00" + "time": "2020-03-23T09:12:05+00:00" }, { "name": "symfony/cache", - "version": "v3.4.47", + "version": "v5.2.6", "source": { "type": "git", "url": "https://github.com/symfony/cache.git", - "reference": "a7a14c4832760bd1fbd31be2859ffedc9b6ff813" + "reference": "093d69bb10c959553c8beb828b8d4ea250a247dd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/cache/zipball/a7a14c4832760bd1fbd31be2859ffedc9b6ff813", - "reference": "a7a14c4832760bd1fbd31be2859ffedc9b6ff813", + "url": "https://api.github.com/repos/symfony/cache/zipball/093d69bb10c959553c8beb828b8d4ea250a247dd", + "reference": "093d69bb10c959553c8beb828b8d4ea250a247dd", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", - "psr/cache": "~1.0", - "psr/log": "~1.0", - "psr/simple-cache": "^1.0", - "symfony/polyfill-apcu": "~1.1" + "php": ">=7.2.5", + "psr/cache": "^1.0|^2.0", + "psr/log": "^1.1", + "symfony/cache-contracts": "^1.1.7|^2", + "symfony/polyfill-php80": "^1.15", + "symfony/service-contracts": "^1.1|^2", + "symfony/var-exporter": "^4.4|^5.0" }, "conflict": { - "symfony/var-dumper": "<3.3" + "doctrine/dbal": "<2.10", + "symfony/dependency-injection": "<4.4", + "symfony/http-kernel": "<4.4", + "symfony/var-dumper": "<4.4" }, "provide": { - "psr/cache-implementation": "1.0", - "psr/simple-cache-implementation": "1.0" + "psr/cache-implementation": "1.0|2.0", + "psr/simple-cache-implementation": "1.0", + "symfony/cache-implementation": "1.0|2.0" }, "require-dev": { "cache/integration-tests": "dev-master", "doctrine/cache": "^1.6", - "doctrine/dbal": "^2.4|^3.0", - "predis/predis": "^1.0" + "doctrine/dbal": "^2.10|^3.0", + "predis/predis": "^1.1", + "psr/simple-cache": "^1.0", + "symfony/config": "^4.4|^5.0", + "symfony/dependency-injection": "^4.4|^5.0", + "symfony/filesystem": "^4.4|^5.0", + "symfony/http-kernel": "^4.4|^5.0", + "symfony/messenger": "^4.4|^5.0", + "symfony/var-dumper": "^4.4|^5.0" }, "type": "library", "autoload": { @@ -897,14 +919,14 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Cache component with PSR-6, PSR-16, and tags", + "description": "Provides an extended PSR-6, PSR-16 (and tags) implementation", "homepage": "https://symfony.com", "keywords": [ "caching", "psr6" ], "support": { - "source": "https://github.com/symfony/cache/tree/v3.4.47" + "source": "https://github.com/symfony/cache/tree/v5.2.6" }, "funding": [ { @@ -920,40 +942,44 @@ "type": "tidelift" } ], - "time": "2020-10-24T10:57:07+00:00" + "time": "2021-03-16T09:10:13+00:00" }, { - "name": "symfony/class-loader", - "version": "v3.4.47", + "name": "symfony/cache-contracts", + "version": "dev-main", "source": { "type": "git", - "url": "https://github.com/symfony/class-loader.git", - "reference": "a22265a9f3511c0212bf79f54910ca5a77c0e92c" + "url": "https://github.com/symfony/cache-contracts.git", + "reference": "c0446463729b89dd4fa62e9aeecc80287323615d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/class-loader/zipball/a22265a9f3511c0212bf79f54910ca5a77c0e92c", - "reference": "a22265a9f3511c0212bf79f54910ca5a77c0e92c", + "url": "https://api.github.com/repos/symfony/cache-contracts/zipball/c0446463729b89dd4fa62e9aeecc80287323615d", + "reference": "c0446463729b89dd4fa62e9aeecc80287323615d", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8" - }, - "require-dev": { - "symfony/finder": "~2.8|~3.0|~4.0", - "symfony/polyfill-apcu": "~1.1" + "php": ">=7.2.5", + "psr/cache": "^1.0|^2.0|^3.0" }, "suggest": { - "symfony/polyfill-apcu": "For using ApcClassLoader on HHVM" + "symfony/cache-implementation": "" }, + "default-branch": true, "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.4-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, "autoload": { "psr-4": { - "Symfony\\Component\\ClassLoader\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] + "Symfony\\Contracts\\Cache\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -961,18 +987,26 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony ClassLoader Component", + "description": "Generic abstractions related to caching", "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], "support": { - "source": "https://github.com/symfony/class-loader/tree/v3.4.47" + "source": "https://github.com/symfony/cache-contracts/tree/main" }, "funding": [ { @@ -988,36 +1022,38 @@ "type": "tidelift" } ], - "time": "2020-10-24T10:57:07+00:00" + "time": "2021-03-23T23:28:01+00:00" }, { "name": "symfony/config", - "version": "v3.4.47", + "version": "v5.2.4", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "bc6b3fd3930d4b53a60b42fe2ed6fc466b75f03f" + "reference": "212d54675bf203ff8aef7d8cee8eecfb72f4a263" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/bc6b3fd3930d4b53a60b42fe2ed6fc466b75f03f", - "reference": "bc6b3fd3930d4b53a60b42fe2ed6fc466b75f03f", + "url": "https://api.github.com/repos/symfony/config/zipball/212d54675bf203ff8aef7d8cee8eecfb72f4a263", + "reference": "212d54675bf203ff8aef7d8cee8eecfb72f4a263", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/filesystem": "~2.8|~3.0|~4.0", - "symfony/polyfill-ctype": "~1.8" + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1", + "symfony/filesystem": "^4.4|^5.0", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-php80": "^1.15" }, "conflict": { - "symfony/dependency-injection": "<3.3", - "symfony/finder": "<3.3" + "symfony/finder": "<4.4" }, "require-dev": { - "symfony/dependency-injection": "~3.3|~4.0", - "symfony/event-dispatcher": "~3.3|~4.0", - "symfony/finder": "~3.3|~4.0", - "symfony/yaml": "~3.0|~4.0" + "symfony/event-dispatcher": "^4.4|^5.0", + "symfony/finder": "^4.4|^5.0", + "symfony/messenger": "^4.4|^5.0", + "symfony/service-contracts": "^1.1|^2", + "symfony/yaml": "^4.4|^5.0" }, "suggest": { "symfony/yaml": "To use the yaml reference dumper" @@ -1045,10 +1081,10 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Config Component", + "description": "Helps you find, load, combine, autofill and validate configuration values of any kind", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/config/tree/v3.4.47" + "source": "https://github.com/symfony/config/tree/v5.2.4" }, "funding": [ { @@ -1064,41 +1100,48 @@ "type": "tidelift" } ], - "time": "2020-10-24T10:57:07+00:00" + "time": "2021-02-23T23:58:19+00:00" }, { "name": "symfony/console", - "version": "v3.4.47", + "version": "v5.2.6", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "a10b1da6fc93080c180bba7219b5ff5b7518fe81" + "reference": "35f039df40a3b335ebf310f244cb242b3a83ac8d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/a10b1da6fc93080c180bba7219b5ff5b7518fe81", - "reference": "a10b1da6fc93080c180bba7219b5ff5b7518fe81", + "url": "https://api.github.com/repos/symfony/console/zipball/35f039df40a3b335ebf310f244cb242b3a83ac8d", + "reference": "35f039df40a3b335ebf310f244cb242b3a83ac8d", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/debug": "~2.8|~3.0|~4.0", - "symfony/polyfill-mbstring": "~1.0" + "php": ">=7.2.5", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php73": "^1.8", + "symfony/polyfill-php80": "^1.15", + "symfony/service-contracts": "^1.1|^2", + "symfony/string": "^5.1" }, "conflict": { - "symfony/dependency-injection": "<3.4", - "symfony/process": "<3.3" + "symfony/dependency-injection": "<4.4", + "symfony/dotenv": "<5.1", + "symfony/event-dispatcher": "<4.4", + "symfony/lock": "<4.4", + "symfony/process": "<4.4" }, "provide": { "psr/log-implementation": "1.0" }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "~3.3|~4.0", - "symfony/dependency-injection": "~3.4|~4.0", - "symfony/event-dispatcher": "~2.8|~3.0|~4.0", - "symfony/lock": "~3.4|~4.0", - "symfony/process": "~3.3|~4.0" + "symfony/config": "^4.4|^5.0", + "symfony/dependency-injection": "^4.4|^5.0", + "symfony/event-dispatcher": "^4.4|^5.0", + "symfony/lock": "^4.4|^5.0", + "symfony/process": "^4.4|^5.0", + "symfony/var-dumper": "^4.4|^5.0" }, "suggest": { "psr/log": "For using the console logger", @@ -1129,10 +1172,16 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Console Component", + "description": "Eases the creation of beautiful and testable command line interfaces", "homepage": "https://symfony.com", + "keywords": [ + "cli", + "command line", + "console", + "terminal" + ], "support": { - "source": "https://github.com/symfony/console/tree/v3.4.47" + "source": "https://github.com/symfony/console/tree/v5.2.6" }, "funding": [ { @@ -1148,37 +1197,55 @@ "type": "tidelift" } ], - "time": "2020-10-24T10:57:07+00:00" + "time": "2021-03-28T09:42:18+00:00" }, { - "name": "symfony/debug", - "version": "v4.4.20", + "name": "symfony/dependency-injection", + "version": "v5.2.6", "source": { "type": "git", - "url": "https://github.com/symfony/debug.git", - "reference": "157bbec4fd773bae53c5483c50951a5530a2cc16" + "url": "https://github.com/symfony/dependency-injection.git", + "reference": "1e66194bed2a69fa395d26bf1067e5e34483afac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/157bbec4fd773bae53c5483c50951a5530a2cc16", - "reference": "157bbec4fd773bae53c5483c50951a5530a2cc16", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/1e66194bed2a69fa395d26bf1067e5e34483afac", + "reference": "1e66194bed2a69fa395d26bf1067e5e34483afac", "shasum": "" }, "require": { - "php": ">=7.1.3", - "psr/log": "~1.0", - "symfony/polyfill-php80": "^1.15" + "php": ">=7.2.5", + "psr/container": "^1.0", + "symfony/deprecation-contracts": "^2.1", + "symfony/polyfill-php80": "^1.15", + "symfony/service-contracts": "^1.1.6|^2" }, "conflict": { - "symfony/http-kernel": "<3.4" + "symfony/config": "<5.1", + "symfony/finder": "<4.4", + "symfony/proxy-manager-bridge": "<4.4", + "symfony/yaml": "<4.4" + }, + "provide": { + "psr/container-implementation": "1.0", + "symfony/service-implementation": "1.0|2.0" }, "require-dev": { - "symfony/http-kernel": "^3.4|^4.0|^5.0" + "symfony/config": "^5.1", + "symfony/expression-language": "^4.4|^5.0", + "symfony/yaml": "^4.4|^5.0" + }, + "suggest": { + "symfony/config": "", + "symfony/expression-language": "For using expressions in service container configuration", + "symfony/finder": "For using double-star glob patterns or when GLOB_BRACE portability is required", + "symfony/proxy-manager-bridge": "Generate service proxies to lazy load them", + "symfony/yaml": "" }, "type": "library", "autoload": { "psr-4": { - "Symfony\\Component\\Debug\\": "" + "Symfony\\Component\\DependencyInjection\\": "" }, "exclude-from-classmap": [ "/Tests/" @@ -1198,10 +1265,10 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Provides tools to ease debugging PHP code", + "description": "Allows you to standardize and centralize the way objects are constructed in your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/debug/tree/v4.4.20" + "source": "https://github.com/symfony/dependency-injection/tree/v5.2.6" }, "funding": [ { @@ -1217,54 +1284,38 @@ "type": "tidelift" } ], - "time": "2021-01-28T16:54:48+00:00" + "time": "2021-03-22T11:10:24+00:00" }, { - "name": "symfony/dependency-injection", - "version": "v3.4.47", + "name": "symfony/deprecation-contracts", + "version": "v2.2.0", "source": { "type": "git", - "url": "https://github.com/symfony/dependency-injection.git", - "reference": "51d2a2708c6ceadad84393f8581df1dcf9e5e84b" + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "5fa56b4074d1ae755beb55617ddafe6f5d78f665" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/51d2a2708c6ceadad84393f8581df1dcf9e5e84b", - "reference": "51d2a2708c6ceadad84393f8581df1dcf9e5e84b", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/5fa56b4074d1ae755beb55617ddafe6f5d78f665", + "reference": "5fa56b4074d1ae755beb55617ddafe6f5d78f665", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", - "psr/container": "^1.0" - }, - "conflict": { - "symfony/config": "<3.3.7", - "symfony/finder": "<3.3", - "symfony/proxy-manager-bridge": "<3.4", - "symfony/yaml": "<3.4" - }, - "provide": { - "psr/container-implementation": "1.0" - }, - "require-dev": { - "symfony/config": "~3.3|~4.0", - "symfony/expression-language": "~2.8|~3.0|~4.0", - "symfony/yaml": "~3.4|~4.0" - }, - "suggest": { - "symfony/config": "", - "symfony/expression-language": "For using expressions in service container configuration", - "symfony/finder": "For using double-star glob patterns or when GLOB_BRACE portability is required", - "symfony/proxy-manager-bridge": "Generate service proxies to lazy load them", - "symfony/yaml": "" + "php": ">=7.1" }, "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\DependencyInjection\\": "" + "extra": { + "branch-alias": { + "dev-master": "2.2-dev" }, - "exclude-from-classmap": [ - "/Tests/" + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "files": [ + "function.php" ] }, "notification-url": "https://packagist.org/downloads/", @@ -1273,18 +1324,18 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony DependencyInjection Component", + "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/dependency-injection/tree/v3.4.47" + "source": "https://github.com/symfony/deprecation-contracts/tree/master" }, "funding": [ { @@ -1300,38 +1351,40 @@ "type": "tidelift" } ], - "time": "2020-10-24T10:57:07+00:00" + "time": "2020-09-07T11:33:47+00:00" }, { - "name": "symfony/deprecation-contracts", - "version": "v2.2.0", + "name": "symfony/error-handler", + "version": "v5.2.6", "source": { "type": "git", - "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "5fa56b4074d1ae755beb55617ddafe6f5d78f665" + "url": "https://github.com/symfony/error-handler.git", + "reference": "bdb7fb4188da7f4211e4b88350ba0dfdad002b03" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/5fa56b4074d1ae755beb55617ddafe6f5d78f665", - "reference": "5fa56b4074d1ae755beb55617ddafe6f5d78f665", + "url": "https://api.github.com/repos/symfony/error-handler/zipball/bdb7fb4188da7f4211e4b88350ba0dfdad002b03", + "reference": "bdb7fb4188da7f4211e4b88350ba0dfdad002b03", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2.5", + "psr/log": "^1.0", + "symfony/polyfill-php80": "^1.15", + "symfony/var-dumper": "^4.4|^5.0" }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.2-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" - } + "require-dev": { + "symfony/deprecation-contracts": "^2.1", + "symfony/http-kernel": "^4.4|^5.0", + "symfony/serializer": "^4.4|^5.0" }, + "type": "library", "autoload": { - "files": [ - "function.php" + "psr-4": { + "Symfony\\Component\\ErrorHandler\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" ] }, "notification-url": "https://packagist.org/downloads/", @@ -1340,18 +1393,18 @@ ], "authors": [ { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" + "name": "Fabien Potencier", + "email": "fabien@symfony.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "A generic function and convention to trigger deprecation notices", + "description": "Provides tools to manage errors and ease debugging PHP code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/master" + "source": "https://github.com/symfony/error-handler/tree/v5.2.6" }, "funding": [ { @@ -1367,42 +1420,44 @@ "type": "tidelift" } ], - "time": "2020-09-07T11:33:47+00:00" + "time": "2021-03-16T09:07:47+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v4.4.20", + "version": "v5.2.4", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "c352647244bd376bf7d31efbd5401f13f50dad0c" + "reference": "d08d6ec121a425897951900ab692b612a61d6240" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/c352647244bd376bf7d31efbd5401f13f50dad0c", - "reference": "c352647244bd376bf7d31efbd5401f13f50dad0c", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/d08d6ec121a425897951900ab692b612a61d6240", + "reference": "d08d6ec121a425897951900ab692b612a61d6240", "shasum": "" }, "require": { - "php": ">=7.1.3", - "symfony/event-dispatcher-contracts": "^1.1" + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1", + "symfony/event-dispatcher-contracts": "^2", + "symfony/polyfill-php80": "^1.15" }, "conflict": { - "symfony/dependency-injection": "<3.4" + "symfony/dependency-injection": "<4.4" }, "provide": { "psr/event-dispatcher-implementation": "1.0", - "symfony/event-dispatcher-implementation": "1.1" + "symfony/event-dispatcher-implementation": "2.0" }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "^3.4|^4.0|^5.0", - "symfony/dependency-injection": "^3.4|^4.0|^5.0", - "symfony/error-handler": "~3.4|~4.4", - "symfony/expression-language": "^3.4|^4.0|^5.0", - "symfony/http-foundation": "^3.4|^4.0|^5.0", + "symfony/config": "^4.4|^5.0", + "symfony/dependency-injection": "^4.4|^5.0", + "symfony/error-handler": "^4.4|^5.0", + "symfony/expression-language": "^4.4|^5.0", + "symfony/http-foundation": "^4.4|^5.0", "symfony/service-contracts": "^1.1|^2", - "symfony/stopwatch": "^3.4|^4.0|^5.0" + "symfony/stopwatch": "^4.4|^5.0" }, "suggest": { "symfony/dependency-injection": "", @@ -1434,7 +1489,7 @@ "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/event-dispatcher/tree/v4.4.20" + "source": "https://github.com/symfony/event-dispatcher/tree/v5.2.4" }, "funding": [ { @@ -1450,33 +1505,33 @@ "type": "tidelift" } ], - "time": "2021-01-27T09:09:26+00:00" + "time": "2021-02-18T17:12:37+00:00" }, { "name": "symfony/event-dispatcher-contracts", - "version": "v1.1.9", + "version": "v2.2.0", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher-contracts.git", - "reference": "84e23fdcd2517bf37aecbd16967e83f0caee25a7" + "reference": "0ba7d54483095a198fa51781bc608d17e84dffa2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/84e23fdcd2517bf37aecbd16967e83f0caee25a7", - "reference": "84e23fdcd2517bf37aecbd16967e83f0caee25a7", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/0ba7d54483095a198fa51781bc608d17e84dffa2", + "reference": "0ba7d54483095a198fa51781bc608d17e84dffa2", "shasum": "" }, "require": { - "php": ">=7.1.3" + "php": ">=7.2.5", + "psr/event-dispatcher": "^1" }, "suggest": { - "psr/event-dispatcher": "", "symfony/event-dispatcher-implementation": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1-dev" + "dev-master": "2.2-dev" }, "thanks": { "name": "symfony/contracts", @@ -1513,7 +1568,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v1.1.9" + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v2.2.0" }, "funding": [ { @@ -1529,24 +1584,24 @@ "type": "tidelift" } ], - "time": "2020-07-06T13:19:58+00:00" + "time": "2020-09-07T11:33:47+00:00" }, { "name": "symfony/filesystem", - "version": "v4.4.21", + "version": "v5.2.6", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "940826c465be2690c9fae91b2793481e5cbd6834" + "reference": "8c86a82f51658188119e62cff0a050a12d09836f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/940826c465be2690c9fae91b2793481e5cbd6834", - "reference": "940826c465be2690c9fae91b2793481e5cbd6834", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/8c86a82f51658188119e62cff0a050a12d09836f", + "reference": "8c86a82f51658188119e62cff0a050a12d09836f", "shasum": "" }, "require": { - "php": ">=7.1.3", + "php": ">=7.2.5", "symfony/polyfill-ctype": "~1.8" }, "type": "library", @@ -1575,7 +1630,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v4.4.21" + "source": "https://github.com/symfony/filesystem/tree/v5.2.6" }, "funding": [ { @@ -1591,24 +1646,24 @@ "type": "tidelift" } ], - "time": "2021-03-28T09:59:32+00:00" + "time": "2021-03-28T14:30:26+00:00" }, { "name": "symfony/finder", - "version": "v4.4.20", + "version": "v5.2.4", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "2543795ab1570df588b9bbd31e1a2bd7037b94f6" + "reference": "0d639a0943822626290d169965804f79400e6a04" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/2543795ab1570df588b9bbd31e1a2bd7037b94f6", - "reference": "2543795ab1570df588b9bbd31e1a2bd7037b94f6", + "url": "https://api.github.com/repos/symfony/finder/zipball/0d639a0943822626290d169965804f79400e6a04", + "reference": "0d639a0943822626290d169965804f79400e6a04", "shasum": "" }, "require": { - "php": ">=7.1.3" + "php": ">=7.2.5" }, "type": "library", "autoload": { @@ -1636,7 +1691,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v4.4.20" + "source": "https://github.com/symfony/finder/tree/v5.2.4" }, "funding": [ { @@ -1652,80 +1707,102 @@ "type": "tidelift" } ], - "time": "2021-02-12T10:48:09+00:00" + "time": "2021-02-15T18:55:04+00:00" }, { "name": "symfony/framework-bundle", - "version": "v3.4.47", + "version": "v5.2.6", "source": { "type": "git", "url": "https://github.com/symfony/framework-bundle.git", - "reference": "6c95e747b75ddd2af61152ce93bf87299d15710e" + "reference": "8889da18c6faa76c6149a90e6542be4afe723f2f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/framework-bundle/zipball/6c95e747b75ddd2af61152ce93bf87299d15710e", - "reference": "6c95e747b75ddd2af61152ce93bf87299d15710e", + "url": "https://api.github.com/repos/symfony/framework-bundle/zipball/8889da18c6faa76c6149a90e6542be4afe723f2f", + "reference": "8889da18c6faa76c6149a90e6542be4afe723f2f", "shasum": "" }, "require": { "ext-xml": "*", - "php": "^5.5.9|>=7.0.8", - "symfony/cache": "~3.4.31|^4.3.4", - "symfony/class-loader": "~3.2", - "symfony/config": "^3.4.31|^4.3.4", - "symfony/debug": "~2.8|~3.0|~4.0", - "symfony/dependency-injection": "^3.4.24|^4.2.5", - "symfony/event-dispatcher": "~3.4|~4.0", - "symfony/filesystem": "~2.8|~3.0|~4.0", - "symfony/finder": "~2.8|~3.0|~4.0", - "symfony/http-foundation": "^3.4.38|^4.3", - "symfony/http-kernel": "^3.4.44|^4.3.4", + "php": ">=7.2.5", + "symfony/cache": "^5.2", + "symfony/config": "^5.0", + "symfony/dependency-injection": "^5.2", + "symfony/deprecation-contracts": "^2.1", + "symfony/error-handler": "^4.4.1|^5.0.1", + "symfony/event-dispatcher": "^5.1", + "symfony/filesystem": "^4.4|^5.0", + "symfony/finder": "^4.4|^5.0", + "symfony/http-foundation": "^5.2.1", + "symfony/http-kernel": "^5.2.1", "symfony/polyfill-mbstring": "~1.0", - "symfony/routing": "^3.4.5|^4.0.5" + "symfony/polyfill-php80": "^1.15", + "symfony/routing": "^5.2" }, "conflict": { - "phpdocumentor/reflection-docblock": "<3.0", - "phpdocumentor/type-resolver": "<0.2.1", - "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0", - "symfony/asset": "<3.3", - "symfony/console": "<3.4", - "symfony/form": "<3.4", - "symfony/property-info": "<3.3", - "symfony/serializer": "<3.3", - "symfony/stopwatch": "<3.4", - "symfony/translation": "<3.4", - "symfony/validator": "<3.4", - "symfony/workflow": "<3.3" + "doctrine/persistence": "<1.3", + "phpdocumentor/reflection-docblock": "<3.2.2", + "phpdocumentor/type-resolver": "<1.4.0", + "phpunit/phpunit": "<5.4.3", + "symfony/asset": "<5.1", + "symfony/browser-kit": "<4.4", + "symfony/console": "<5.2.5", + "symfony/dom-crawler": "<4.4", + "symfony/dotenv": "<5.1", + "symfony/form": "<5.2", + "symfony/http-client": "<4.4", + "symfony/lock": "<4.4", + "symfony/mailer": "<5.2", + "symfony/messenger": "<4.4", + "symfony/mime": "<4.4", + "symfony/property-access": "<5.2", + "symfony/property-info": "<4.4", + "symfony/serializer": "<5.2", + "symfony/stopwatch": "<4.4", + "symfony/translation": "<5.0", + "symfony/twig-bridge": "<4.4", + "symfony/twig-bundle": "<4.4", + "symfony/validator": "<5.2", + "symfony/web-profiler-bundle": "<4.4", + "symfony/workflow": "<5.2" }, "require-dev": { - "doctrine/annotations": "~1.7", + "doctrine/annotations": "^1.10.4", "doctrine/cache": "~1.0", - "fig/link-util": "^1.0", - "phpdocumentor/reflection-docblock": "^3.0|^4.0", - "symfony/asset": "~3.3|~4.0", - "symfony/browser-kit": "~2.8|~3.0|~4.0", - "symfony/console": "~3.4.31|^4.3.4", - "symfony/css-selector": "~2.8|~3.0|~4.0", - "symfony/dom-crawler": "~2.8|~3.0|~4.0", - "symfony/expression-language": "~2.8|~3.0|~4.0", - "symfony/form": "^3.4.31|^4.3.4", - "symfony/lock": "~3.4|~4.0", + "doctrine/persistence": "^1.3|^2.0", + "paragonie/sodium_compat": "^1.8", + "phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0", + "symfony/asset": "^5.1", + "symfony/browser-kit": "^4.4|^5.0", + "symfony/console": "^5.2", + "symfony/css-selector": "^4.4|^5.0", + "symfony/dom-crawler": "^4.4|^5.0", + "symfony/dotenv": "^5.1", + "symfony/expression-language": "^4.4|^5.0", + "symfony/form": "^5.2", + "symfony/http-client": "^4.4|^5.0", + "symfony/lock": "^4.4|^5.0", + "symfony/mailer": "^5.2", + "symfony/messenger": "^5.2", + "symfony/mime": "^4.4|^5.0", "symfony/polyfill-intl-icu": "~1.0", - "symfony/process": "~2.8|~3.0|~4.0", - "symfony/property-info": "~3.3|~4.0", - "symfony/security-core": "~3.2|~4.0", - "symfony/security-csrf": "^2.8.31|^3.3.13|~4.0", - "symfony/serializer": "~3.3|~4.0", - "symfony/stopwatch": "~3.4|~4.0", - "symfony/templating": "~2.8|~3.0|~4.0", - "symfony/translation": "~3.4|~4.0", - "symfony/validator": "~3.4|~4.0", - "symfony/var-dumper": "~3.3|~4.0", - "symfony/web-link": "~3.3|~4.0", - "symfony/workflow": "~3.3|~4.0", - "symfony/yaml": "~3.2|~4.0", - "twig/twig": "~1.34|~2.4" + "symfony/process": "^4.4|^5.0", + "symfony/property-info": "^4.4|^5.0", + "symfony/security-bundle": "^5.1", + "symfony/security-core": "^4.4|^5.2", + "symfony/security-csrf": "^4.4|^5.0", + "symfony/security-http": "^4.4|^5.0", + "symfony/serializer": "^5.2", + "symfony/stopwatch": "^4.4|^5.0", + "symfony/string": "^5.0", + "symfony/translation": "^5.0", + "symfony/twig-bundle": "^4.4|^5.0", + "symfony/validator": "^5.2", + "symfony/web-link": "^4.4|^5.0", + "symfony/workflow": "^5.2", + "symfony/yaml": "^4.4|^5.0", + "twig/twig": "^2.10|^3.0" }, "suggest": { "ext-apcu": "For best performance of the system caches", @@ -1760,10 +1837,10 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony FrameworkBundle", + "description": "Provides a tight integration between Symfony components and the Symfony full-stack framework", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/framework-bundle/tree/v3.4.47" + "source": "https://github.com/symfony/framework-bundle/tree/v5.2.6" }, "funding": [ { @@ -1779,40 +1856,43 @@ "type": "tidelift" } ], - "time": "2020-10-24T10:57:07+00:00" + "time": "2021-03-22T14:43:01+00:00" }, { - "name": "symfony/http-foundation", - "version": "v4.4.20", + "name": "symfony/http-client-contracts", + "version": "v2.3.1", "source": { "type": "git", - "url": "https://github.com/symfony/http-foundation.git", - "reference": "02d968647fe61b2f419a8dc70c468a9d30a48d3a" + "url": "https://github.com/symfony/http-client-contracts.git", + "reference": "41db680a15018f9c1d4b23516059633ce280ca33" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/02d968647fe61b2f419a8dc70c468a9d30a48d3a", - "reference": "02d968647fe61b2f419a8dc70c468a9d30a48d3a", + "url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/41db680a15018f9c1d4b23516059633ce280ca33", + "reference": "41db680a15018f9c1d4b23516059633ce280ca33", "shasum": "" }, "require": { - "php": ">=7.1.3", - "symfony/mime": "^4.3|^5.0", - "symfony/polyfill-mbstring": "~1.1", - "symfony/polyfill-php80": "^1.15" + "php": ">=7.2.5" }, - "require-dev": { - "predis/predis": "~1.0", - "symfony/expression-language": "^3.4|^4.0|^5.0" + "suggest": { + "symfony/http-client-implementation": "" }, "type": "library", + "extra": { + "branch-version": "2.3", + "branch-alias": { + "dev-main": "2.3-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, "autoload": { "psr-4": { - "Symfony\\Component\\HttpFoundation\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] + "Symfony\\Contracts\\HttpClient\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1820,18 +1900,26 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Defines an object-oriented layer for the HTTP specification", + "description": "Generic abstractions related to HTTP clients", "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], "support": { - "source": "https://github.com/symfony/http-foundation/tree/v4.4.20" + "source": "https://github.com/symfony/http-client-contracts/tree/v2.3.1" }, "funding": [ { @@ -1847,70 +1935,41 @@ "type": "tidelift" } ], - "time": "2021-02-25T17:11:33+00:00" + "time": "2020-10-14T17:08:19+00:00" }, { - "name": "symfony/http-kernel", - "version": "v3.4.47", + "name": "symfony/http-foundation", + "version": "v5.2.4", "source": { "type": "git", - "url": "https://github.com/symfony/http-kernel.git", - "reference": "a98a4c30089e6a2d52a9fa236f718159b539f6f5" + "url": "https://github.com/symfony/http-foundation.git", + "reference": "54499baea7f7418bce7b5ec92770fd0799e8e9bf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/a98a4c30089e6a2d52a9fa236f718159b539f6f5", - "reference": "a98a4c30089e6a2d52a9fa236f718159b539f6f5", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/54499baea7f7418bce7b5ec92770fd0799e8e9bf", + "reference": "54499baea7f7418bce7b5ec92770fd0799e8e9bf", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", - "psr/log": "~1.0", - "symfony/debug": "^3.3.3|~4.0", - "symfony/event-dispatcher": "~2.8|~3.0|~4.0", - "symfony/http-foundation": "~3.4.12|~4.0.12|^4.1.1", - "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-php56": "~1.8" - }, - "conflict": { - "symfony/config": "<2.8", - "symfony/dependency-injection": "<3.4.10|<4.0.10,>=4", - "symfony/var-dumper": "<3.3", - "twig/twig": "<1.34|<2.4,>=2" - }, - "provide": { - "psr/log-implementation": "1.0" + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1", + "symfony/polyfill-mbstring": "~1.1", + "symfony/polyfill-php80": "^1.15" }, "require-dev": { - "psr/cache": "~1.0", - "symfony/browser-kit": "~2.8|~3.0|~4.0", - "symfony/class-loader": "~2.8|~3.0", - "symfony/config": "~2.8|~3.0|~4.0", - "symfony/console": "~2.8|~3.0|~4.0", - "symfony/css-selector": "~2.8|~3.0|~4.0", - "symfony/dependency-injection": "^3.4.10|^4.0.10", - "symfony/dom-crawler": "~2.8|~3.0|~4.0", - "symfony/expression-language": "~2.8|~3.0|~4.0", - "symfony/finder": "~2.8|~3.0|~4.0", - "symfony/process": "~2.8|~3.0|~4.0", - "symfony/routing": "~3.4|~4.0", - "symfony/stopwatch": "~2.8|~3.0|~4.0", - "symfony/templating": "~2.8|~3.0|~4.0", - "symfony/translation": "~2.8|~3.0|~4.0", - "symfony/var-dumper": "~3.3|~4.0" + "predis/predis": "~1.0", + "symfony/cache": "^4.4|^5.0", + "symfony/expression-language": "^4.4|^5.0", + "symfony/mime": "^4.4|^5.0" }, "suggest": { - "symfony/browser-kit": "", - "symfony/config": "", - "symfony/console": "", - "symfony/dependency-injection": "", - "symfony/finder": "", - "symfony/var-dumper": "" + "symfony/mime": "To use the file extension guesser" }, "type": "library", "autoload": { "psr-4": { - "Symfony\\Component\\HttpKernel\\": "" + "Symfony\\Component\\HttpFoundation\\": "" }, "exclude-from-classmap": [ "/Tests/" @@ -1930,10 +1989,10 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony HttpKernel Component", + "description": "Defines an object-oriented layer for the HTTP specification", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-kernel/tree/v3.4.47" + "source": "https://github.com/symfony/http-foundation/tree/v5.2.4" }, "funding": [ { @@ -1949,47 +2008,80 @@ "type": "tidelift" } ], - "time": "2020-11-27T08:42:42+00:00" + "time": "2021-02-25T17:16:57+00:00" }, { - "name": "symfony/mime", + "name": "symfony/http-kernel", "version": "v5.2.6", "source": { "type": "git", - "url": "https://github.com/symfony/mime.git", - "reference": "1b2092244374cbe48ae733673f2ca0818b37197b" + "url": "https://github.com/symfony/http-kernel.git", + "reference": "f34de4c61ca46df73857f7f36b9a3805bdd7e3b2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mime/zipball/1b2092244374cbe48ae733673f2ca0818b37197b", - "reference": "1b2092244374cbe48ae733673f2ca0818b37197b", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/f34de4c61ca46df73857f7f36b9a3805bdd7e3b2", + "reference": "f34de4c61ca46df73857f7f36b9a3805bdd7e3b2", "shasum": "" }, "require": { "php": ">=7.2.5", + "psr/log": "~1.0", "symfony/deprecation-contracts": "^2.1", - "symfony/polyfill-intl-idn": "^1.10", - "symfony/polyfill-mbstring": "^1.0", + "symfony/error-handler": "^4.4|^5.0", + "symfony/event-dispatcher": "^5.0", + "symfony/http-client-contracts": "^1.1|^2", + "symfony/http-foundation": "^4.4|^5.0", + "symfony/polyfill-ctype": "^1.8", + "symfony/polyfill-php73": "^1.9", "symfony/polyfill-php80": "^1.15" }, "conflict": { - "egulias/email-validator": "~3.0.0", - "phpdocumentor/reflection-docblock": "<3.2.2", - "phpdocumentor/type-resolver": "<1.4.0", - "symfony/mailer": "<4.4" + "symfony/browser-kit": "<4.4", + "symfony/cache": "<5.0", + "symfony/config": "<5.0", + "symfony/console": "<4.4", + "symfony/dependency-injection": "<5.1.8", + "symfony/doctrine-bridge": "<5.0", + "symfony/form": "<5.0", + "symfony/http-client": "<5.0", + "symfony/mailer": "<5.0", + "symfony/messenger": "<5.0", + "symfony/translation": "<5.0", + "symfony/twig-bridge": "<5.0", + "symfony/validator": "<5.0", + "twig/twig": "<2.13" + }, + "provide": { + "psr/log-implementation": "1.0" }, "require-dev": { - "egulias/email-validator": "^2.1.10|^3.1", - "phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0", - "symfony/dependency-injection": "^4.4|^5.0", - "symfony/property-access": "^4.4|^5.1", - "symfony/property-info": "^4.4|^5.1", - "symfony/serializer": "^5.2" + "psr/cache": "^1.0|^2.0|^3.0", + "symfony/browser-kit": "^4.4|^5.0", + "symfony/config": "^5.0", + "symfony/console": "^4.4|^5.0", + "symfony/css-selector": "^4.4|^5.0", + "symfony/dependency-injection": "^5.1.8", + "symfony/dom-crawler": "^4.4|^5.0", + "symfony/expression-language": "^4.4|^5.0", + "symfony/finder": "^4.4|^5.0", + "symfony/process": "^4.4|^5.0", + "symfony/routing": "^4.4|^5.0", + "symfony/stopwatch": "^4.4|^5.0", + "symfony/translation": "^4.4|^5.0", + "symfony/translation-contracts": "^1.1|^2", + "twig/twig": "^2.13|^3.0.4" + }, + "suggest": { + "symfony/browser-kit": "", + "symfony/config": "", + "symfony/console": "", + "symfony/dependency-injection": "" }, "type": "library", "autoload": { "psr-4": { - "Symfony\\Component\\Mime\\": "" + "Symfony\\Component\\HttpKernel\\": "" }, "exclude-from-classmap": [ "/Tests/" @@ -2009,14 +2101,10 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Allows manipulating MIME messages", + "description": "Provides a structured process for converting a Request into a Response", "homepage": "https://symfony.com", - "keywords": [ - "mime", - "mime-type" - ], "support": { - "source": "https://github.com/symfony/mime/tree/v5.2.6" + "source": "https://github.com/symfony/http-kernel/tree/v5.2.6" }, "funding": [ { @@ -2032,40 +2120,43 @@ "type": "tidelift" } ], - "time": "2021-03-12T13:18:39+00:00" + "time": "2021-03-29T05:16:58+00:00" }, { "name": "symfony/monolog-bridge", - "version": "v3.4.47", + "version": "v5.2.5", "source": { "type": "git", "url": "https://github.com/symfony/monolog-bridge.git", - "reference": "93915f0d981bc166dfa475698124435327f6ee63" + "reference": "8a330ab86c4bdf3983b26abf64bf85574edf0d52" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/monolog-bridge/zipball/93915f0d981bc166dfa475698124435327f6ee63", - "reference": "93915f0d981bc166dfa475698124435327f6ee63", + "url": "https://api.github.com/repos/symfony/monolog-bridge/zipball/8a330ab86c4bdf3983b26abf64bf85574edf0d52", + "reference": "8a330ab86c4bdf3983b26abf64bf85574edf0d52", "shasum": "" }, "require": { - "monolog/monolog": "~1.19", - "php": "^5.5.9|>=7.0.8", - "symfony/http-kernel": "~2.8|~3.0|~4.0" + "monolog/monolog": "^1.25.1|^2", + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1", + "symfony/http-kernel": "^4.4|^5.0", + "symfony/service-contracts": "^1.1|^2" }, "conflict": { - "symfony/console": "<2.8", - "symfony/http-foundation": "<3.3" + "symfony/console": "<4.4", + "symfony/http-foundation": "<4.4" }, "require-dev": { - "symfony/console": "~2.8|~3.0|~4.0", - "symfony/event-dispatcher": "~2.8|~3.0|~4.0", - "symfony/security-core": "~2.8|~3.0|~4.0", - "symfony/var-dumper": "~3.3|~4.0" + "symfony/console": "^4.4|^5.0", + "symfony/http-client": "^4.4|^5.0", + "symfony/mailer": "^4.4|^5.0", + "symfony/mime": "^4.4|^5.0", + "symfony/security-core": "^4.4|^5.0", + "symfony/var-dumper": "^4.4|^5.0" }, "suggest": { - "symfony/console": "For the possibility to show log messages in console commands depending on verbosity settings. You need version ^2.8 of the console for it.", - "symfony/event-dispatcher": "Needed when using log messages in console commands.", + "symfony/console": "For the possibility to show log messages in console commands depending on verbosity settings.", "symfony/http-kernel": "For using the debugging handlers together with the response life cycle of the HTTP kernel.", "symfony/var-dumper": "For using the debugging handlers like the console handler or the log server handler." }, @@ -2092,10 +2183,10 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Monolog Bridge", + "description": "Provides integration for Monolog with various Symfony components", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/monolog-bridge/tree/v3.4.47" + "source": "https://github.com/symfony/monolog-bridge/tree/v5.2.5" }, "funding": [ { @@ -2111,105 +2202,47 @@ "type": "tidelift" } ], - "time": "2020-10-24T10:57:07+00:00" + "time": "2021-03-06T07:59:01+00:00" }, { "name": "symfony/monolog-bundle", - "version": "v2.12.1", + "version": "v3.7.0", "source": { "type": "git", "url": "https://github.com/symfony/monolog-bundle.git", - "reference": "b0146bdca7ba2a65f3bbe7010423c7393b29ec3f" + "reference": "4054b2e940a25195ae15f0a49ab0c51718922eb4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/monolog-bundle/zipball/b0146bdca7ba2a65f3bbe7010423c7393b29ec3f", - "reference": "b0146bdca7ba2a65f3bbe7010423c7393b29ec3f", + "url": "https://api.github.com/repos/symfony/monolog-bundle/zipball/4054b2e940a25195ae15f0a49ab0c51718922eb4", + "reference": "4054b2e940a25195ae15f0a49ab0c51718922eb4", "shasum": "" }, "require": { - "monolog/monolog": "~1.18", - "php": ">=5.3.2", - "symfony/config": "~2.3|~3.0", - "symfony/dependency-injection": "~2.3|~3.0", - "symfony/http-kernel": "~2.3|~3.0", - "symfony/monolog-bridge": "~2.3|~3.0" + "monolog/monolog": "~1.22 || ~2.0", + "php": ">=7.1.3", + "symfony/config": "~4.4 || ^5.0", + "symfony/dependency-injection": "^4.4 || ^5.0", + "symfony/http-kernel": "~4.4 || ^5.0", + "symfony/monolog-bridge": "~4.4 || ^5.0" }, "require-dev": { - "phpunit/phpunit": "^4.8", - "symfony/console": "~2.3|~3.0", - "symfony/yaml": "~2.3|~3.0" + "symfony/console": "~4.4 || ^5.0", + "symfony/phpunit-bridge": "^5.1", + "symfony/yaml": "~4.4 || ^5.0" }, "type": "symfony-bundle", "extra": { "branch-alias": { - "dev-master": "2.x-dev" + "dev-master": "3.x-dev" } }, "autoload": { "psr-4": { "Symfony\\Bundle\\MonologBundle\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "Symfony MonologBundle", - "homepage": "http://symfony.com", - "keywords": [ - "log", - "logging" - ], - "support": { - "issues": "https://github.com/symfony/monolog-bundle/issues", - "source": "https://github.com/symfony/monolog-bundle/tree/2.x" - }, - "time": "2017-01-02T19:04:26+00:00" - }, - { - "name": "symfony/polyfill-apcu", - "version": "v1.22.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-apcu.git", - "reference": "bc9974e74f8c05f4ceb500b1e0603e36be7d8223" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-apcu/zipball/bc9974e74f8c05f4ceb500b1e0603e36be7d8223", - "reference": "bc9974e74f8c05f4ceb500b1e0603e36be7d8223", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.22-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Apcu\\": "" - }, - "files": [ - "bootstrap.php" + "exclude-from-classmap": [ + "/Tests/" ] }, "notification-url": "https://packagist.org/downloads/", @@ -2218,25 +2251,23 @@ ], "authors": [ { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" + "name": "Fabien Potencier", + "email": "fabien@symfony.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill backporting apcu_* functions to lower PHP versions", + "description": "Symfony MonologBundle", "homepage": "https://symfony.com", "keywords": [ - "apcu", - "compatibility", - "polyfill", - "portable", - "shim" + "log", + "logging" ], "support": { - "source": "https://github.com/symfony/polyfill-apcu/tree/v1.22.1" + "issues": "https://github.com/symfony/monolog-bundle/issues", + "source": "https://github.com/symfony/monolog-bundle/tree/v3.7.0" }, "funding": [ { @@ -2252,7 +2283,7 @@ "type": "tidelift" } ], - "time": "2021-01-22T09:19:47+00:00" + "time": "2021-03-31T07:20:47+00:00" }, { "name": "symfony/polyfill-ctype", @@ -2334,23 +2365,21 @@ "time": "2021-01-07T16:49:33+00:00" }, { - "name": "symfony/polyfill-intl-idn", + "name": "symfony/polyfill-intl-grapheme", "version": "v1.22.1", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-intl-idn.git", - "reference": "2d63434d922daf7da8dd863e7907e67ee3031483" + "url": "https://github.com/symfony/polyfill-intl-grapheme.git", + "reference": "5601e09b69f26c1828b13b6bb87cb07cddba3170" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/2d63434d922daf7da8dd863e7907e67ee3031483", - "reference": "2d63434d922daf7da8dd863e7907e67ee3031483", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/5601e09b69f26c1828b13b6bb87cb07cddba3170", + "reference": "5601e09b69f26c1828b13b6bb87cb07cddba3170", "shasum": "" }, "require": { - "php": ">=7.1", - "symfony/polyfill-intl-normalizer": "^1.10", - "symfony/polyfill-php72": "^1.10" + "php": ">=7.1" }, "suggest": { "ext-intl": "For best performance" @@ -2367,7 +2396,7 @@ }, "autoload": { "psr-4": { - "Symfony\\Polyfill\\Intl\\Idn\\": "" + "Symfony\\Polyfill\\Intl\\Grapheme\\": "" }, "files": [ "bootstrap.php" @@ -2379,30 +2408,26 @@ ], "authors": [ { - "name": "Laurent Bassin", - "email": "laurent@bassin.info" - }, - { - "name": "Trevor Rowbotham", - "email": "trevor.rowbotham@pm.me" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions", + "description": "Symfony polyfill for intl's grapheme_* functions", "homepage": "https://symfony.com", "keywords": [ "compatibility", - "idn", + "grapheme", "intl", "polyfill", "portable", "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.22.1" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.22.1" }, "funding": [ { @@ -2585,32 +2610,43 @@ "time": "2021-01-22T09:19:47+00:00" }, { - "name": "symfony/polyfill-php56", - "version": "v1.20.0", + "name": "symfony/polyfill-php73", + "version": "v1.22.1", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-php56.git", - "reference": "54b8cd7e6c1643d78d011f3be89f3ef1f9f4c675" + "url": "https://github.com/symfony/polyfill-php73.git", + "reference": "a678b42e92f86eca04b7fa4c0f6f19d097fb69e2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php56/zipball/54b8cd7e6c1643d78d011f3be89f3ef1f9f4c675", - "reference": "54b8cd7e6c1643d78d011f3be89f3ef1f9f4c675", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/a678b42e92f86eca04b7fa4c0f6f19d097fb69e2", + "reference": "a678b42e92f86eca04b7fa4c0f6f19d097fb69e2", "shasum": "" }, "require": { "php": ">=7.1" }, - "type": "metapackage", + "type": "library", "extra": { "branch-alias": { - "dev-main": "1.20-dev" + "dev-main": "1.22-dev" }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" } }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php73\\": "" + }, + "files": [ + "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" + ] + }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" @@ -2625,7 +2661,7 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill backporting some PHP 5.6+ features to lower PHP versions", + "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", "homepage": "https://symfony.com", "keywords": [ "compatibility", @@ -2634,7 +2670,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php56/tree/v1.20.0" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.22.1" }, "funding": [ { @@ -2650,20 +2686,20 @@ "type": "tidelift" } ], - "time": "2020-10-23T14:02:19+00:00" + "time": "2021-01-07T16:49:33+00:00" }, { - "name": "symfony/polyfill-php72", + "name": "symfony/polyfill-php80", "version": "v1.22.1", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "cc6e6f9b39fe8075b3dabfbaf5b5f645ae1340c9" + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "dc3063ba22c2a1fd2f45ed856374d79114998f91" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/cc6e6f9b39fe8075b3dabfbaf5b5f645ae1340c9", - "reference": "cc6e6f9b39fe8075b3dabfbaf5b5f645ae1340c9", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/dc3063ba22c2a1fd2f45ed856374d79114998f91", + "reference": "dc3063ba22c2a1fd2f45ed856374d79114998f91", "shasum": "" }, "require": { @@ -2681,10 +2717,13 @@ }, "autoload": { "psr-4": { - "Symfony\\Polyfill\\Php72\\": "" + "Symfony\\Polyfill\\Php80\\": "" }, "files": [ "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" ] }, "notification-url": "https://packagist.org/downloads/", @@ -2692,6 +2731,10 @@ "MIT" ], "authors": [ + { + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, { "name": "Nicolas Grekas", "email": "p@tchwork.com" @@ -2701,7 +2744,7 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", "homepage": "https://symfony.com", "keywords": [ "compatibility", @@ -2710,7 +2753,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php72/tree/v1.22.1" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.22.1" }, "funding": [ { @@ -2729,41 +2772,212 @@ "time": "2021-01-07T16:49:33+00:00" }, { - "name": "symfony/polyfill-php80", - "version": "v1.22.1", + "name": "symfony/routing", + "version": "v5.2.6", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "dc3063ba22c2a1fd2f45ed856374d79114998f91" + "url": "https://github.com/symfony/routing.git", + "reference": "31fba555f178afd04d54fd26953501b2c3f0c6e6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/dc3063ba22c2a1fd2f45ed856374d79114998f91", - "reference": "dc3063ba22c2a1fd2f45ed856374d79114998f91", + "url": "https://api.github.com/repos/symfony/routing/zipball/31fba555f178afd04d54fd26953501b2c3f0c6e6", + "reference": "31fba555f178afd04d54fd26953501b2c3f0c6e6", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1", + "symfony/polyfill-php80": "^1.15" + }, + "conflict": { + "symfony/config": "<5.0", + "symfony/dependency-injection": "<4.4", + "symfony/yaml": "<4.4" + }, + "require-dev": { + "doctrine/annotations": "^1.10.4", + "psr/log": "~1.0", + "symfony/config": "^5.0", + "symfony/dependency-injection": "^4.4|^5.0", + "symfony/expression-language": "^4.4|^5.0", + "symfony/http-foundation": "^4.4|^5.0", + "symfony/yaml": "^4.4|^5.0" + }, + "suggest": { + "doctrine/annotations": "For using the annotation loader", + "symfony/config": "For using the all-in-one router or any loader", + "symfony/expression-language": "For using expression matching", + "symfony/http-foundation": "For using a Symfony Request object", + "symfony/yaml": "For using the YAML loader" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Routing\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Maps an HTTP request to a set of configuration variables", + "homepage": "https://symfony.com", + "keywords": [ + "router", + "routing", + "uri", + "url" + ], + "support": { + "source": "https://github.com/symfony/routing/tree/v5.2.6" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-03-14T13:53:33+00:00" + }, + { + "name": "symfony/service-contracts", + "version": "v2.2.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/service-contracts.git", + "reference": "d15da7ba4957ffb8f1747218be9e1a121fd298a1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/d15da7ba4957ffb8f1747218be9e1a121fd298a1", + "reference": "d15da7ba4957ffb8f1747218be9e1a121fd298a1", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "psr/container": "^1.0" + }, + "suggest": { + "symfony/service-implementation": "" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "1.22-dev" + "dev-master": "2.2-dev" }, "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" } }, "autoload": { "psr-4": { - "Symfony\\Polyfill\\Php80\\": "" + "Symfony\\Contracts\\Service\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to writing services", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/service-contracts/tree/master" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-09-07T11:33:47+00:00" + }, + { + "name": "symfony/string", + "version": "v5.2.6", + "source": { + "type": "git", + "url": "https://github.com/symfony/string.git", + "reference": "ad0bd91bce2054103f5eaa18ebeba8d3bc2a0572" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/string/zipball/ad0bd91bce2054103f5eaa18ebeba8d3bc2a0572", + "reference": "ad0bd91bce2054103f5eaa18ebeba8d3bc2a0572", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-intl-grapheme": "~1.0", + "symfony/polyfill-intl-normalizer": "~1.0", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php80": "~1.15" + }, + "require-dev": { + "symfony/error-handler": "^4.4|^5.0", + "symfony/http-client": "^4.4|^5.0", + "symfony/translation-contracts": "^1.1|^2", + "symfony/var-exporter": "^4.4|^5.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\String\\": "" }, "files": [ - "bootstrap.php" + "Resources/functions.php" ], - "classmap": [ - "Resources/stubs" + "exclude-from-classmap": [ + "/Tests/" ] }, "notification-url": "https://packagist.org/downloads/", @@ -2771,10 +2985,6 @@ "MIT" ], "authors": [ - { - "name": "Ion Bazan", - "email": "ion.bazan@gmail.com" - }, { "name": "Nicolas Grekas", "email": "p@tchwork.com" @@ -2784,16 +2994,18 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "description": "Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way", "homepage": "https://symfony.com", "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" + "grapheme", + "i18n", + "string", + "unicode", + "utf-8", + "utf8" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.22.1" + "source": "https://github.com/symfony/string/tree/v5.2.6" }, "funding": [ { @@ -2809,50 +3021,52 @@ "type": "tidelift" } ], - "time": "2021-01-07T16:49:33+00:00" + "time": "2021-03-17T17:12:15+00:00" }, { - "name": "symfony/routing", - "version": "v3.4.47", + "name": "symfony/var-dumper", + "version": "v5.2.6", "source": { "type": "git", - "url": "https://github.com/symfony/routing.git", - "reference": "3e522ac69cadffd8131cc2b22157fa7662331a6c" + "url": "https://github.com/symfony/var-dumper.git", + "reference": "89412a68ea2e675b4e44f260a5666729f77f668e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/3e522ac69cadffd8131cc2b22157fa7662331a6c", - "reference": "3e522ac69cadffd8131cc2b22157fa7662331a6c", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/89412a68ea2e675b4e44f260a5666729f77f668e", + "reference": "89412a68ea2e675b4e44f260a5666729f77f668e", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8" + "php": ">=7.2.5", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php80": "^1.15" }, "conflict": { - "symfony/config": "<3.3.1", - "symfony/dependency-injection": "<3.3", - "symfony/yaml": "<3.4" + "phpunit/phpunit": "<5.4.3", + "symfony/console": "<4.4" }, "require-dev": { - "doctrine/annotations": "~1.0", - "psr/log": "~1.0", - "symfony/config": "^3.3.1|~4.0", - "symfony/dependency-injection": "~3.3|~4.0", - "symfony/expression-language": "~2.8|~3.0|~4.0", - "symfony/http-foundation": "~2.8|~3.0|~4.0", - "symfony/yaml": "~3.4|~4.0" + "ext-iconv": "*", + "symfony/console": "^4.4|^5.0", + "symfony/process": "^4.4|^5.0", + "twig/twig": "^2.13|^3.0.4" }, "suggest": { - "doctrine/annotations": "For using the annotation loader", - "symfony/config": "For using the all-in-one router or any loader", - "symfony/expression-language": "For using expression matching", - "symfony/http-foundation": "For using a Symfony Request object", - "symfony/yaml": "For using the YAML loader" + "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).", + "ext-intl": "To show region name in time zone dump", + "symfony/console": "To use the ServerDumpCommand and/or the bin/var-dump-server script" }, + "bin": [ + "Resources/bin/var-dump-server" + ], "type": "library", "autoload": { + "files": [ + "Resources/functions/dump.php" + ], "psr-4": { - "Symfony\\Component\\Routing\\": "" + "Symfony\\Component\\VarDumper\\": "" }, "exclude-from-classmap": [ "/Tests/" @@ -2864,24 +3078,95 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Routing Component", + "description": "Provides mechanisms for walking through any arbitrary PHP variable", "homepage": "https://symfony.com", "keywords": [ - "router", - "routing", - "uri", - "url" + "debug", + "dump" + ], + "support": { + "source": "https://github.com/symfony/var-dumper/tree/v5.2.6" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-03-28T09:42:18+00:00" + }, + { + "name": "symfony/var-exporter", + "version": "v5.2.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/var-exporter.git", + "reference": "5aed4875ab514c8cb9b6ff4772baa25fa4c10307" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/var-exporter/zipball/5aed4875ab514c8cb9b6ff4772baa25fa4c10307", + "reference": "5aed4875ab514c8cb9b6ff4772baa25fa4c10307", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/polyfill-php80": "^1.15" + }, + "require-dev": { + "symfony/var-dumper": "^4.4.9|^5.0.9" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\VarExporter\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Allows exporting any serializable PHP data structure to plain PHP code", + "homepage": "https://symfony.com", + "keywords": [ + "clone", + "construct", + "export", + "hydrate", + "instantiate", + "serialize" ], "support": { - "source": "https://github.com/symfony/routing/tree/v3.4.47" + "source": "https://github.com/symfony/var-exporter/tree/v5.2.4" }, "funding": [ { @@ -2897,35 +3182,39 @@ "type": "tidelift" } ], - "time": "2020-10-24T10:57:07+00:00" + "time": "2021-01-27T10:01:46+00:00" }, { "name": "symfony/yaml", - "version": "v3.4.47", + "version": "v5.2.5", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "88289caa3c166321883f67fe5130188ebbb47094" + "reference": "298a08ddda623485208506fcee08817807a251dd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/88289caa3c166321883f67fe5130188ebbb47094", - "reference": "88289caa3c166321883f67fe5130188ebbb47094", + "url": "https://api.github.com/repos/symfony/yaml/zipball/298a08ddda623485208506fcee08817807a251dd", + "reference": "298a08ddda623485208506fcee08817807a251dd", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1", "symfony/polyfill-ctype": "~1.8" }, "conflict": { - "symfony/console": "<3.4" + "symfony/console": "<4.4" }, "require-dev": { - "symfony/console": "~3.4|~4.0" + "symfony/console": "^4.4|^5.0" }, "suggest": { "symfony/console": "For validating YAML files using the lint command" }, + "bin": [ + "Resources/bin/yaml-lint" + ], "type": "library", "autoload": { "psr-4": { @@ -2949,10 +3238,10 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Yaml Component", + "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v3.4.47" + "source": "https://github.com/symfony/yaml/tree/v5.2.5" }, "funding": [ { @@ -2968,7 +3257,7 @@ "type": "tidelift" } ], - "time": "2020-10-24T10:57:07+00:00" + "time": "2021-03-06T07:59:01+00:00" }, { "name": "webimpress/safe-writer", From 0977d4a9828245dcd9a4b1d5c24a9dbf67daeb93 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Fri, 16 Apr 2021 09:45:23 +0100 Subject: [PATCH 17/63] Fix configurations and method signature --- Library/Logger/Formatter/CompilerFormatter.php | 2 +- Library/config/config.yml | 2 +- Library/config/services.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Library/Logger/Formatter/CompilerFormatter.php b/Library/Logger/Formatter/CompilerFormatter.php index 5d66f6b7e0..4d61d7a48c 100644 --- a/Library/Logger/Formatter/CompilerFormatter.php +++ b/Library/Logger/Formatter/CompilerFormatter.php @@ -43,7 +43,7 @@ public function __construct(Config $config) /** * {@inheritdoc} */ - public function format(array $record) + public function format(array $record): string { if ($this->config->get('silent')) { return ''; diff --git a/Library/config/config.yml b/Library/config/config.yml index 0492fd7bb2..060c94329d 100644 --- a/Library/config/config.yml +++ b/Library/config/config.yml @@ -3,7 +3,7 @@ imports: parameters: prototypes_path: "%kernel.project_dir%/prototypes" - optimizers_path: "%kernel.root_dir%/Optimizers" + optimizers_path: "%kernel.project_dir%/Library/Optimizers" kernels_path: "%kernel.project_dir%/kernels" templates_path: "%kernel.project_dir%/templates" local_cache_path: "%kernel.local_cache_dir%" diff --git a/Library/config/services.yml b/Library/config/services.yml index 86f9e49bc7..75cba05844 100644 --- a/Library/config/services.yml +++ b/Library/config/services.yml @@ -36,7 +36,7 @@ services: $templatesPath: '%templates_path%' Zephir\BaseBackend: - factory: 'Zephir\Backends\BackendFactory:createBackend' + factory: ['@Zephir\Backends\BackendFactory', 'createBackend'] public: true Zephir\Compiler: From d8871320753149de3aca7154193dd9ca7630b043 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Fri, 16 Apr 2021 09:49:56 +0100 Subject: [PATCH 18/63] #1086 - Adjust testIssue1086CanAddAnElementToExistingArray() test --- ext/stub/arrayaccesstest.zep.c | 12 ++++++------ ext/stub/arrayaccesstest.zep.h | 24 ++++++++++++------------ tests/Extension/ArrayAccessTest.php | 3 +-- 3 files changed, 19 insertions(+), 20 deletions(-) diff --git a/ext/stub/arrayaccesstest.zep.c b/ext/stub/arrayaccesstest.zep.c index ac51446fd8..a7a1a36a19 100644 --- a/ext/stub/arrayaccesstest.zep.c +++ b/ext/stub/arrayaccesstest.zep.c @@ -217,7 +217,7 @@ PHP_METHOD(Stub_ArrayAccessTest, issue1094Test3) RETURN_MM_BOOL(isItemsNULL); } -PHP_METHOD(Stub_ArrayAccessTest, issue1086Test1ArrayStrict) +PHP_METHOD(Stub_ArrayAccessTest, issue1086AddElementToArrayWithStrictParams) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *params_param = NULL, _0; @@ -245,7 +245,7 @@ PHP_METHOD(Stub_ArrayAccessTest, issue1086Test1ArrayStrict) ZEPHIR_MM_RESTORE(); } -PHP_METHOD(Stub_ArrayAccessTest, issue1086TestArrayStrict) +PHP_METHOD(Stub_ArrayAccessTest, issue1086CanAddAnElementToExistingArrayWithStrictParams) { zval _0; zval params; @@ -264,12 +264,12 @@ PHP_METHOD(Stub_ArrayAccessTest, issue1086TestArrayStrict) ZEPHIR_INIT_VAR(&_0); ZVAL_LONG(&_0, 123); zephir_array_update_string(¶ms, SL("test"), &_0, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_SELF(NULL, "issue1086test1arraystrict", NULL, 0, ¶ms); + ZEPHIR_CALL_SELF(NULL, "issue1086addelementtoarraywithstrictparams", NULL, 0, ¶ms); zephir_check_call_status(); RETURN_CTOR(¶ms); } -PHP_METHOD(Stub_ArrayAccessTest, issue1086Test1Array) +PHP_METHOD(Stub_ArrayAccessTest, issue1086AddElementToArrayWithoutStrictParams) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *params_param = NULL, _0; @@ -297,7 +297,7 @@ PHP_METHOD(Stub_ArrayAccessTest, issue1086Test1Array) ZEPHIR_MM_RESTORE(); } -PHP_METHOD(Stub_ArrayAccessTest, issue1086TestArray) +PHP_METHOD(Stub_ArrayAccessTest, issue1086CanAddAnElementToExistingArrayWithoutStrictParams) { zval _0; zval params; @@ -316,7 +316,7 @@ PHP_METHOD(Stub_ArrayAccessTest, issue1086TestArray) ZEPHIR_INIT_VAR(&_0); ZVAL_LONG(&_0, 123); zephir_array_update_string(¶ms, SL("test"), &_0, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_SELF(NULL, "issue1086test1array", NULL, 0, ¶ms); + ZEPHIR_CALL_SELF(NULL, "issue1086addelementtoarraywithoutstrictparams", NULL, 0, ¶ms); zephir_check_call_status(); RETURN_CTOR(¶ms); } diff --git a/ext/stub/arrayaccesstest.zep.h b/ext/stub/arrayaccesstest.zep.h index f64310019c..2806d46d08 100644 --- a/ext/stub/arrayaccesstest.zep.h +++ b/ext/stub/arrayaccesstest.zep.h @@ -10,10 +10,10 @@ PHP_METHOD(Stub_ArrayAccessTest, issue1155); PHP_METHOD(Stub_ArrayAccessTest, issue1094Test1); PHP_METHOD(Stub_ArrayAccessTest, issue1094Test2); PHP_METHOD(Stub_ArrayAccessTest, issue1094Test3); -PHP_METHOD(Stub_ArrayAccessTest, issue1086Test1ArrayStrict); -PHP_METHOD(Stub_ArrayAccessTest, issue1086TestArrayStrict); -PHP_METHOD(Stub_ArrayAccessTest, issue1086Test1Array); -PHP_METHOD(Stub_ArrayAccessTest, issue1086TestArray); +PHP_METHOD(Stub_ArrayAccessTest, issue1086AddElementToArrayWithStrictParams); +PHP_METHOD(Stub_ArrayAccessTest, issue1086CanAddAnElementToExistingArrayWithStrictParams); +PHP_METHOD(Stub_ArrayAccessTest, issue1086AddElementToArrayWithoutStrictParams); +PHP_METHOD(Stub_ArrayAccessTest, issue1086CanAddAnElementToExistingArrayWithoutStrictParams); ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayaccesstest_exits, 0, 0, 0) ZEND_END_ARG_INFO() @@ -39,18 +39,18 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccesstest_issue1094te ZEND_ARG_ARRAY_INFO(0, items, 1) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayaccesstest_issue1086test1arraystrict, 0, 0, 1) +ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayaccesstest_issue1086addelementtoarraywithstrictparams, 0, 0, 1) ZEND_ARG_ARRAY_INFO(0, params, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccesstest_issue1086testarraystrict, 0, 0, IS_ARRAY, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccesstest_issue1086canaddanelementtoexistingarraywithstrictparams, 0, 0, IS_ARRAY, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayaccesstest_issue1086test1array, 0, 0, 1) +ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayaccesstest_issue1086addelementtoarraywithoutstrictparams, 0, 0, 1) ZEND_ARG_ARRAY_INFO(0, params, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccesstest_issue1086testarray, 0, 0, IS_ARRAY, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccesstest_issue1086canaddanelementtoexistingarraywithoutstrictparams, 0, 0, IS_ARRAY, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_arrayaccesstest_method_entry) { @@ -69,9 +69,9 @@ ZEPHIR_INIT_FUNCS(stub_arrayaccesstest_method_entry) { PHP_ME(Stub_ArrayAccessTest, issue1094Test1, arginfo_stub_arrayaccesstest_issue1094test1, ZEND_ACC_PUBLIC) PHP_ME(Stub_ArrayAccessTest, issue1094Test2, arginfo_stub_arrayaccesstest_issue1094test2, ZEND_ACC_PUBLIC) PHP_ME(Stub_ArrayAccessTest, issue1094Test3, arginfo_stub_arrayaccesstest_issue1094test3, ZEND_ACC_PUBLIC) - PHP_ME(Stub_ArrayAccessTest, issue1086Test1ArrayStrict, arginfo_stub_arrayaccesstest_issue1086test1arraystrict, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) - PHP_ME(Stub_ArrayAccessTest, issue1086TestArrayStrict, arginfo_stub_arrayaccesstest_issue1086testarraystrict, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) - PHP_ME(Stub_ArrayAccessTest, issue1086Test1Array, arginfo_stub_arrayaccesstest_issue1086test1array, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) - PHP_ME(Stub_ArrayAccessTest, issue1086TestArray, arginfo_stub_arrayaccesstest_issue1086testarray, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + PHP_ME(Stub_ArrayAccessTest, issue1086AddElementToArrayWithStrictParams, arginfo_stub_arrayaccesstest_issue1086addelementtoarraywithstrictparams, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + PHP_ME(Stub_ArrayAccessTest, issue1086CanAddAnElementToExistingArrayWithStrictParams, arginfo_stub_arrayaccesstest_issue1086canaddanelementtoexistingarraywithstrictparams, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + PHP_ME(Stub_ArrayAccessTest, issue1086AddElementToArrayWithoutStrictParams, arginfo_stub_arrayaccesstest_issue1086addelementtoarraywithoutstrictparams, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + PHP_ME(Stub_ArrayAccessTest, issue1086CanAddAnElementToExistingArrayWithoutStrictParams, arginfo_stub_arrayaccesstest_issue1086canaddanelementtoexistingarraywithoutstrictparams, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_FE_END }; diff --git a/tests/Extension/ArrayAccessTest.php b/tests/Extension/ArrayAccessTest.php index a4051ea194..f3930b9b32 100644 --- a/tests/Extension/ArrayAccessTest.php +++ b/tests/Extension/ArrayAccessTest.php @@ -68,9 +68,8 @@ public function testIssue1086CanAddAnElementToExistingArray(): void $actual = $class->issue1086CanAddAnElementToExistingArrayWithStrictParams(); $this->assertSame(['test' => 123], $actual); - $this->assertSame(['test2' => 1234], $actual); + $actual = $class->issue1086CanAddAnElementToExistingArrayWithoutStrictParams(); $this->assertSame(['test' => 123], $actual); - $this->assertSame(['test2' => 1234], $actual); } } From 6c21c25e5cf6be2c53255f8e06d51578ef9d8c9a Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Fri, 16 Apr 2021 09:51:29 +0100 Subject: [PATCH 19/63] Update composer.lock from PHP 7.4 --- composer.lock | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/composer.lock b/composer.lock index 6eafadc867..18daf67aae 100644 --- a/composer.lock +++ b/composer.lock @@ -654,20 +654,20 @@ }, { "name": "psr/cache", - "version": "2.0.0", + "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/php-fig/cache.git", - "reference": "213f9dbc5b9bfbc4f8db86d2838dc968752ce13b" + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/cache/zipball/213f9dbc5b9bfbc4f8db86d2838dc968752ce13b", - "reference": "213f9dbc5b9bfbc4f8db86d2838dc968752ce13b", + "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", "shasum": "" }, "require": { - "php": ">=8.0.0" + "php": ">=5.3.0" }, "type": "library", "extra": { @@ -687,7 +687,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" + "homepage": "http://www.php-fig.org/" } ], "description": "Common interface for caching libraries", @@ -697,9 +697,9 @@ "psr-6" ], "support": { - "source": "https://github.com/php-fig/cache/tree/2.0.0" + "source": "https://github.com/php-fig/cache/tree/master" }, - "time": "2021-02-03T23:23:37+00:00" + "time": "2016-08-06T20:24:11+00:00" }, { "name": "psr/container", @@ -946,30 +946,29 @@ }, { "name": "symfony/cache-contracts", - "version": "dev-main", + "version": "v2.2.0", "source": { "type": "git", "url": "https://github.com/symfony/cache-contracts.git", - "reference": "c0446463729b89dd4fa62e9aeecc80287323615d" + "reference": "8034ca0b61d4dd967f3698aaa1da2507b631d0cb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/cache-contracts/zipball/c0446463729b89dd4fa62e9aeecc80287323615d", - "reference": "c0446463729b89dd4fa62e9aeecc80287323615d", + "url": "https://api.github.com/repos/symfony/cache-contracts/zipball/8034ca0b61d4dd967f3698aaa1da2507b631d0cb", + "reference": "8034ca0b61d4dd967f3698aaa1da2507b631d0cb", "shasum": "" }, "require": { "php": ">=7.2.5", - "psr/cache": "^1.0|^2.0|^3.0" + "psr/cache": "^1.0" }, "suggest": { "symfony/cache-implementation": "" }, - "default-branch": true, "type": "library", "extra": { "branch-alias": { - "dev-main": "2.4-dev" + "dev-master": "2.2-dev" }, "thanks": { "name": "symfony/contracts", @@ -1006,7 +1005,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/cache-contracts/tree/main" + "source": "https://github.com/symfony/cache-contracts/tree/v2.2.0" }, "funding": [ { @@ -1022,7 +1021,7 @@ "type": "tidelift" } ], - "time": "2021-03-23T23:28:01+00:00" + "time": "2020-09-07T11:33:47+00:00" }, { "name": "symfony/config", From f10fdcdf786421c73fee533a9cdcd8893d8ed753 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Fri, 16 Apr 2021 22:57:24 +0100 Subject: [PATCH 20/63] Remove 'oneup/flysystem-bundle' package and use league directly --- Library/DependencyInjection/ZephirKernel.php | 2 - Library/config/config.yml | 10 - composer.json | 2 +- composer.lock | 188 ++++--------------- 4 files changed, 35 insertions(+), 167 deletions(-) diff --git a/Library/DependencyInjection/ZephirKernel.php b/Library/DependencyInjection/ZephirKernel.php index cdd35b019f..62ea6851e1 100644 --- a/Library/DependencyInjection/ZephirKernel.php +++ b/Library/DependencyInjection/ZephirKernel.php @@ -14,7 +14,6 @@ namespace Zephir\DependencyInjection; use Exception; -use Oneup\FlysystemBundle\OneupFlysystemBundle; use RuntimeException; use Symfony\Bundle\MonologBundle\MonologBundle; use Symfony\Component\Config\Loader\LoaderInterface; @@ -57,7 +56,6 @@ public function registerBundles(): array { return [ new MonologBundle(), - new OneupFlysystemBundle(), ]; } diff --git a/Library/config/config.yml b/Library/config/config.yml index 060c94329d..e94b79e591 100644 --- a/Library/config/config.yml +++ b/Library/config/config.yml @@ -25,13 +25,3 @@ monolog: level: INFO formatter: compiler_log_formatter -oneup_flysystem: - adapters: - compiler_adapter: - local: - directory: "%local_cache_path%" - filesystems: - compiler_local: - adapter: compiler_adapter - alias: compiler_filesystem - visibility: public diff --git a/composer.json b/composer.json index 07a2b0cc53..bfdcc4a21c 100644 --- a/composer.json +++ b/composer.json @@ -29,8 +29,8 @@ "ext-pcre": "*", "ext-xml": "*", "ext-zlib": "*", + "league/flysystem": "^2.0", "ocramius/proxy-manager": "^2.10", - "oneup/flysystem-bundle": "^3.0", "symfony/console": "^5.2", "symfony/framework-bundle": "^5.2", "symfony/monolog-bridge": "^5.2", diff --git a/composer.lock b/composer.lock index 18daf67aae..af8c93e42b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "262fe080aa48c0757cc0a3a9dd090ca4", + "content-hash": "3d33d184c5b6a70bb1022989f46c5f4f", "packages": [ { "name": "laminas/laminas-code", @@ -207,55 +207,42 @@ }, { "name": "league/flysystem", - "version": "1.1.3", + "version": "2.0.5", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem.git", - "reference": "9be3b16c877d477357c015cec057548cf9b2a14a" + "reference": "27ea64cc9d61ae7b6a5f04bebf062d89dd18e8f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/9be3b16c877d477357c015cec057548cf9b2a14a", - "reference": "9be3b16c877d477357c015cec057548cf9b2a14a", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/27ea64cc9d61ae7b6a5f04bebf062d89dd18e8f7", + "reference": "27ea64cc9d61ae7b6a5f04bebf062d89dd18e8f7", "shasum": "" }, "require": { - "ext-fileinfo": "*", - "league/mime-type-detection": "^1.3", - "php": "^7.2.5 || ^8.0" + "ext-json": "*", + "league/mime-type-detection": "^1.0.0", + "php": "^7.2 || ^8.0" }, "conflict": { - "league/flysystem-sftp": "<1.0.6" + "guzzlehttp/ringphp": "<1.1.1" }, "require-dev": { - "phpspec/prophecy": "^1.11.1", - "phpunit/phpunit": "^8.5.8" - }, - "suggest": { - "ext-fileinfo": "Required for MimeType", - "ext-ftp": "Allows you to use FTP server storage", - "ext-openssl": "Allows you to use FTPS server storage", - "league/flysystem-aws-s3-v2": "Allows you to use S3 storage with AWS SDK v2", - "league/flysystem-aws-s3-v3": "Allows you to use S3 storage with AWS SDK v3", - "league/flysystem-azure": "Allows you to use Windows Azure Blob storage", - "league/flysystem-cached-adapter": "Flysystem adapter decorator for metadata caching", - "league/flysystem-eventable-filesystem": "Allows you to use EventableFilesystem", - "league/flysystem-rackspace": "Allows you to use Rackspace Cloud Files", - "league/flysystem-sftp": "Allows you to use SFTP server storage via phpseclib", - "league/flysystem-webdav": "Allows you to use WebDAV storage", - "league/flysystem-ziparchive": "Allows you to use ZipArchive adapter", - "spatie/flysystem-dropbox": "Allows you to use Dropbox storage", - "srmklive/flysystem-dropbox-v2": "Allows you to use Dropbox storage for PHP 5 applications" + "async-aws/s3": "^1.5", + "async-aws/simple-s3": "^1.0", + "aws/aws-sdk-php": "^3.132.4", + "composer/semver": "^3.0", + "ext-fileinfo": "*", + "friendsofphp/php-cs-fixer": "^2.16", + "google/cloud-storage": "^1.23", + "phpseclib/phpseclib": "^2.0", + "phpstan/phpstan": "^0.12.26", + "phpunit/phpunit": "^8.5 || ^9.4" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } - }, "autoload": { "psr-4": { - "League\\Flysystem\\": "src/" + "League\\Flysystem\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -265,40 +252,42 @@ "authors": [ { "name": "Frank de Jonge", - "email": "info@frenky.net" + "email": "info@frankdejonge.nl" } ], - "description": "Filesystem abstraction: Many filesystems, one API.", + "description": "File storage abstraction for PHP", "keywords": [ - "Cloud Files", "WebDAV", - "abstraction", "aws", "cloud", - "copy.com", - "dropbox", - "file systems", + "file", "files", "filesystem", "filesystems", "ftp", - "rackspace", - "remote", "s3", "sftp", "storage" ], "support": { "issues": "https://github.com/thephpleague/flysystem/issues", - "source": "https://github.com/thephpleague/flysystem/tree/1.x" + "source": "https://github.com/thephpleague/flysystem/tree/2.0.5" }, "funding": [ { "url": "https://offset.earth/frankdejonge", - "type": "other" + "type": "custom" + }, + { + "url": "https://github.com/frankdejonge", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/league/flysystem", + "type": "tidelift" } ], - "time": "2020-08-23T07:39:11+00:00" + "time": "2021-04-11T15:03:35+00:00" }, { "name": "league/mime-type-detection", @@ -543,115 +532,6 @@ ], "time": "2021-01-10T16:12:59+00:00" }, - { - "name": "oneup/flysystem-bundle", - "version": "3.7.0", - "source": { - "type": "git", - "url": "https://github.com/1up-lab/OneupFlysystemBundle.git", - "reference": "de1aa0fa361496b3837da5cac286f029595581da" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/1up-lab/OneupFlysystemBundle/zipball/de1aa0fa361496b3837da5cac286f029595581da", - "reference": "de1aa0fa361496b3837da5cac286f029595581da", - "shasum": "" - }, - "require": { - "league/flysystem": "^1.0.26", - "php": ">=7.1", - "symfony/config": "^3.4 || ^4.0 || ^5.0", - "symfony/dependency-injection": "^3.4 || ^4.0 || ^5.0", - "symfony/http-kernel": "^3.4 || ^4.0 || ^5.0" - }, - "conflict": { - "async-aws/flysystem-s3": "<1.0" - }, - "require-dev": { - "async-aws/flysystem-s3": "^1.0", - "jenko/flysystem-gaufrette": "^1.0", - "league/flysystem-aws-s3-v2": "^1.0", - "league/flysystem-azure-blob-storage": "^0.1", - "league/flysystem-cached-adapter": "^1.0", - "league/flysystem-gridfs": "^1.0", - "league/flysystem-memory": "^1.0", - "league/flysystem-rackspace": "^1.0", - "league/flysystem-replicate-adapter": "^1.0", - "league/flysystem-sftp": "^1.0", - "league/flysystem-webdav": "^1.0", - "league/flysystem-ziparchive": "^1.0", - "litipk/flysystem-fallback-adapter": "^0.1", - "phpunit/phpunit": "^6.5 || ^7.5 || ^8.5", - "spatie/flysystem-dropbox": "^1.0", - "superbalist/flysystem-google-storage": "^4.0", - "symfony/asset": "^3.4 || ^4.0 || ^5.0", - "symfony/browser-kit": "^3.4 || ^4.0 || ^5.0", - "symfony/finder": "^3.4 || ^4.0 || ^5.0", - "symfony/templating": "^3.4 || ^4.0 || ^5.0", - "symfony/translation": "^3.4 || ^4.0 || ^5.0", - "symfony/yaml": "^3.4 || ^4.0 || ^5.0", - "twistor/flysystem-stream-wrapper": "^1.0" - }, - "suggest": { - "ext-fileinfo": "Required for MimeType", - "ext-ftp": "Required for FTP and SFTP", - "jenko/flysystem-gaufrette": "Allows you to use gaufrette adapter", - "league/flysystem-aws-s3-v2": "Use S3 storage with AWS SDK v2", - "league/flysystem-aws-s3-v3": "Use S3 storage with AWS SDK v3", - "league/flysystem-azure-blob-storage": "Allows you to use Azure Blob Storage adapter", - "league/flysystem-cached-adapter": "Flysystem adapter decorator for metadata caching", - "league/flysystem-gridfs": "Allows you to use GridFS adapter", - "league/flysystem-rackspace": "Allows you to use Rackspace Cloud Files", - "league/flysystem-replicate-adapter": "Allows you to use the Replicate adapter from Flysystem", - "league/flysystem-sftp": "Allows SFTP server storage via phpseclib", - "league/flysystem-webdav": "Allows you to use WebDAV storage", - "league/flysystem-ziparchive": "Allows you to use ZipArchive adapter", - "litipk/flysystem-fallback-adapter": "Allows you to use a fallback filesystem", - "spatie/flysystem-dropbox": "Use Dropbox storage", - "superbalist/flysystem-google-storage": "Allows you to use Google Cloud Storage buckets", - "twistor/flysystem-stream-wrapper": "Allows you to use stream wrapper" - }, - "type": "symfony-bundle", - "autoload": { - "psr-4": { - "Oneup\\FlysystemBundle\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jim Schmid", - "email": "js@1up.io", - "homepage": "https://1up.io", - "role": "Developer" - }, - { - "name": "David Greminger", - "email": "dg@1up.io", - "homepage": "https://1up.io", - "role": "Developer" - } - ], - "description": "Integrates Flysystem filesystem abstraction library to your Symfony project.", - "homepage": "https://1up.io", - "keywords": [ - "Flysystem", - "abstraction", - "filesystem", - "symfony" - ], - "support": { - "issues": "https://github.com/1up-lab/OneupFlysystemBundle/issues", - "source": "https://github.com/1up-lab/OneupFlysystemBundle/tree/3.7.0" - }, - "time": "2020-12-22T08:19:35+00:00" - }, { "name": "psr/cache", "version": "1.0.1", From fc178803ede4534493ffa048340a01014de974a9 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Fri, 16 Apr 2021 22:58:23 +0100 Subject: [PATCH 21/63] Refactor HardDisk class to use Flysystem v2 --- Library/Console/Command/CleanCommand.php | 4 + Library/Console/Command/FullCleanCommand.php | 2 +- Library/FileSystem/HardDisk.php | 128 +++++++++---------- Library/config/services.yml | 6 +- 4 files changed, 64 insertions(+), 76 deletions(-) diff --git a/Library/Console/Command/CleanCommand.php b/Library/Console/Command/CleanCommand.php index 6e1578dcf7..b620c1d3ad 100644 --- a/Library/Console/Command/CleanCommand.php +++ b/Library/Console/Command/CleanCommand.php @@ -47,6 +47,10 @@ protected function configure() protected function execute(InputInterface $input, OutputInterface $output) { + if (!$this->filesystem->isInitialized()) { + $this->filesystem->initialize(); + } + $this->filesystem->clean(); $io = new SymfonyStyle($input, $output); diff --git a/Library/Console/Command/FullCleanCommand.php b/Library/Console/Command/FullCleanCommand.php index c4af1b27ea..27effaaf3d 100644 --- a/Library/Console/Command/FullCleanCommand.php +++ b/Library/Console/Command/FullCleanCommand.php @@ -43,7 +43,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $io = new SymfonyStyle($input, $output); - /* + /** * TODO: Do we need a batch file for Windows like "clean" as used below? * TODO: The 'clean' file contains duplicated commands */ diff --git a/Library/FileSystem/HardDisk.php b/Library/FileSystem/HardDisk.php index 855221f2b3..7574b06124 100644 --- a/Library/FileSystem/HardDisk.php +++ b/Library/FileSystem/HardDisk.php @@ -9,47 +9,57 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\FileSystem; -use ErrorException; use League\Flysystem; -use Zephir\Exception\CompilerException; -use Zephir\Exception\FileSystemException; +use League\Flysystem\Filesystem; +use League\Flysystem\Local\LocalFilesystemAdapter; use Zephir\Exception\InvalidArgumentException; use Zephir\Exception\RuntimeException; use Zephir\Zephir; /** - * Zephir\FileSystem\HardDisk. + * Local Hard Disk * * Uses the standard hard-disk as filesystem for temporary operations. */ class HardDisk implements FileSystemInterface { - /** @var Flysystem\FilesystemInterface */ - private $filesystem; + private ?Filesystem $filesystem = null; /** @var string */ - private $localPath; + private string $localPath; - /** @var bool */ - private $initialized = false; + /** + * Initialize checker + * + * @var bool + */ + private bool $initialized = false; - /** @var string|null */ - private $basePath; + /** + * Root or base path + * + * Path to where all cached files and folders are collected. + * + * @var string|null + */ + private ?string $basePath; /** * HardDisk constructor. * - * @param Flysystem\FilesystemInterface $filesystem - * @param string $localPath + * @param string $basePath + * @param string $localPath * * @throws InvalidArgumentException */ - public function __construct(Flysystem\FilesystemInterface $filesystem, $localPath = Zephir::VERSION) + public function __construct(string $basePath, string $localPath = Zephir::VERSION) { - $this->filesystem = $filesystem; - $this->localPath = trim($localPath, '\\/'); + $this->basePath = $this->rightTrimPath($basePath); + $this->localPath = $this->rightTrimPath($localPath); if (empty($this->localPath)) { throw new InvalidArgumentException('The temporary container can not be empty.'); @@ -57,16 +67,15 @@ public function __construct(Flysystem\FilesystemInterface $filesystem, $localPat } /** - * @param string|null $basePath + * @param string $path + * @return string */ - public function setBasePath($basePath) + private function rightTrimPath(string $path): string { - $this->basePath = rtrim($basePath, '\\/'); + return rtrim($path, '\\/'); } /** - * {@inheritdoc} - * * @return bool */ public function isInitialized(): bool @@ -75,19 +84,14 @@ public function isInitialized(): bool } /** - * {@inheritdoc} + * Start File System * * @throws RuntimeException */ public function initialize() { - if ((false === $this->exists($this->localPath)) && false === $this->filesystem->createDir($this->localPath)) { - throw new RuntimeException( - 'Unable to create a local storage for temporary filesystem operations.' - ); - } - $this->initialized = true; + $this->filesystem = new Filesystem(new LocalFilesystemAdapter($this->basePath)); } /** @@ -96,6 +100,7 @@ public function initialize() * @param string $path * * @return bool + * @throws Flysystem\FilesystemException */ public function exists(string $path): bool { @@ -105,7 +110,7 @@ public function exists(string $path): bool $path = "{$this->localPath}/{$path}"; } - return $this->filesystem->has($path); + return $this->filesystem->fileExists($path); } /** @@ -114,6 +119,7 @@ public function exists(string $path): bool * @param string $path * * @return bool + * @throws Flysystem\FilesystemException */ public function makeDirectory(string $path): bool { @@ -123,7 +129,9 @@ public function makeDirectory(string $path): bool $path = "{$this->localPath}/{$path}"; } - return $this->filesystem->createDir($path); + $this->filesystem->createDirectory($path); + + return is_dir($path); } /** @@ -131,19 +139,14 @@ public function makeDirectory(string $path): bool * * @param string $path * - * @throws CompilerException - * * @return array + * @throws Flysystem\FilesystemException */ public function file(string $path): array { - try { - $contents = $this->filesystem->read($this->localPath."/{$path}"); + $contents = $this->filesystem->read($this->localPath."/{$path}"); - return preg_split("/\r\n|\n|\r/", $contents); - } catch (Flysystem\FileNotFoundException $e) { - throw new CompilerException($e->getMessage(), null, $e->getCode(), $e); - } + return preg_split("/\r\n|\n|\r/", $contents); } /** @@ -152,12 +155,11 @@ public function file(string $path): array * @param string $path * * @return int - * - * @throws Flysystem\FileNotFoundException + * @throws Flysystem\FilesystemException */ public function modificationTime(string $path): int { - return (int) $this->filesystem->getTimestamp($this->localPath."/{$path}"); + return $this->filesystem->lastModified($this->localPath."/{$path}"); } /** @@ -165,21 +167,19 @@ public function modificationTime(string $path): int * * @param string $path * - * @throws Flysystem\FileNotFoundException - * * @return string + * @throws Flysystem\FilesystemException */ public function read(string $path): string { - return (string) $this->filesystem->read($this->localPath."/{$path}"); + return $this->filesystem->read($this->localPath."/{$path}"); } /** * {@inheritdoc} * * @param string $path - * - * @throws Flysystem\FileNotFoundException + * @throws Flysystem\FilesystemException */ public function delete(string $path) { @@ -190,13 +190,13 @@ public function delete(string $path) * {@inheritdoc} * * @param string $path - * @param string $contents + * @param string $data * - * @throws Flysystem\FileExistsException + * @throws Flysystem\FilesystemException */ - public function write(string $path, string $contents) + public function write(string $path, string $data) { - $this->filesystem->write($this->localPath."/{$path}", $contents); + $this->filesystem->write($this->localPath."/{$path}", $data); } /** @@ -231,8 +231,7 @@ public function system(string $command, string $descriptor, string $destination) * @param string $path * * @return mixed - * - * @throws Flysystem\FileNotFoundException + * @throws Flysystem\FilesystemException */ public function requireFile(string $path) { @@ -248,20 +247,11 @@ public function requireFile(string $path) /** * {@inheritdoc} * - * @throws FileSystemException - * @throws Flysystem\RootViolationException + * @throws Flysystem\FilesystemException */ public function clean() { - try { - $this->filesystem->deleteDir($this->localPath); - } catch (ErrorException $e) { - // For reasons beyond our control, the actual owner of the directory - // contents may not be the same as the current user. Therefore we need - // to catch ErrorException and throw an expected exception with informing - // the current user. - throw new FileSystemException($e->getMessage(), $e->getCode(), $e); - } + $this->filesystem->deleteDirectory($this->localPath); } /** @@ -272,12 +262,10 @@ public function clean() * * @param string $algorithm * @param string $sourceFile - * @param bool $useCache - * - * @throws Flysystem\FileExistsException - * @throws Flysystem\FileNotFoundException + * @param bool $useCache * * @return string + * @throws Flysystem\FilesystemException */ public function getHashFile(string $algorithm, string $sourceFile, $useCache = false): string { @@ -292,16 +280,16 @@ public function getHashFile(string $algorithm, string $sourceFile, $useCache = f $algorithm ); - if (false === $this->filesystem->has($cacheFile)) { + if (false === $this->filesystem->fileExists($cacheFile)) { $contents = hash_file($algorithm, $sourceFile); $this->filesystem->write($cacheFile, $contents); return $contents; } - if (filemtime($sourceFile) > $this->filesystem->getTimestamp($cacheFile)) { + if (filemtime($sourceFile) > $this->filesystem->lastModified($cacheFile)) { $contents = hash_file($algorithm, $sourceFile); - $this->filesystem->update($cacheFile, $contents); + $this->filesystem->write($cacheFile, $contents); return $contents; } diff --git a/Library/config/services.yml b/Library/config/services.yml index 75cba05844..c9a09b8ae6 100644 --- a/Library/config/services.yml +++ b/Library/config/services.yml @@ -18,11 +18,7 @@ services: public: true lazy: true arguments: - $filesystem: '@compiler_filesystem' - calls: - - method: setBasePath - arguments: - - '%local_cache_path%' + $basePath: '%local_cache_path%' Zephir\Config: factory: 'Zephir\Config::fromServer' From 1597df3e5bdc2e4dcdc292c8f1e6e1a8f47756fc Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Fri, 16 Apr 2021 22:58:39 +0100 Subject: [PATCH 22/63] Minor code refactor --- Library/Compiler.php | 2 +- Library/CompilerFile.php | 17 ++++++++--------- Library/StaticCall.php | 5 +++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Library/Compiler.php b/Library/Compiler.php index 2648f04539..4e4e8d0515 100644 --- a/Library/Compiler.php +++ b/Library/Compiler.php @@ -619,7 +619,7 @@ public function generate(bool $fromGenerate = false): bool } krsort($rankedFiles); - foreach ($rankedFiles as $rank => $rankFiles) { + foreach ($rankedFiles as $rankFiles) { $files = array_merge($files, $rankFiles); } $this->files = $files; diff --git a/Library/CompilerFile.php b/Library/CompilerFile.php index 8c84f719e4..7c83ea8a54 100644 --- a/Library/CompilerFile.php +++ b/Library/CompilerFile.php @@ -792,7 +792,7 @@ public function compile(Compiler $compiler, StringsManager $stringsManager) throw new CompilerException('Unable to locate the intermediate representation of the compiled file'); } - /* + /** * External classes should not be compiled as part of the extension */ if ($this->external) { @@ -804,26 +804,25 @@ public function compile(Compiler $compiler, StringsManager $stringsManager) */ $compilationContext = new CompilationContext(); - /* + /** * Set global compiler in the compilation context */ $compilationContext->compiler = $compiler; - /* + /** * Set global config in the compilation context */ $compilationContext->config = $this->config; - /* + /** * Set global logger in the compilation context */ $compilationContext->logger = $this->logger; - /* + /** * Set global strings manager */ $compilationContext->stringsManager = $stringsManager; - $compilationContext->backend = $compiler->backend; /** @@ -838,7 +837,7 @@ public function compile(Compiler $compiler, StringsManager $stringsManager) $codePrinter = new CodePrinter(); $compilationContext->codePrinter = $codePrinter; - /* + /** * Alias manager */ $compilationContext->aliasManager = $this->aliasManager; @@ -900,7 +899,7 @@ public function compile(Compiler $compiler, StringsManager $stringsManager) } if ($codePrinter) { - /* + /** * If the file does not exists we create it for the first time */ if (!file_exists($filePath)) { @@ -929,7 +928,7 @@ public function compile(Compiler $compiler, StringsManager $stringsManager) } } - /* + /** * Add to file compiled */ $this->compiledFile = $path.'.c'; diff --git a/Library/StaticCall.php b/Library/StaticCall.php index a07db26a6a..3099f93750 100644 --- a/Library/StaticCall.php +++ b/Library/StaticCall.php @@ -64,11 +64,11 @@ public function compile(Expression $expr, CompilationContext $compilationContext } } - /* + /** * Method calls only return zvals so we need to validate the target variable is also a zval */ if ($isExpecting) { - /* + /** * At this point, we don't know the exact dynamic type returned by the static method call */ $symbolVariable->setDynamicTypes('undefined'); @@ -132,6 +132,7 @@ public function compile(Expression $expr, CompilationContext $compilationContext */ if (!$dynamicMethod && !$dynamicClass) { // TODO: Consider to check instance of ClassDefinitionRuntime and throw another error, telling that class was not found. + // TODO: This will give false if external class does not exists! if (!$classDefinition->hasMethod($methodName)) { $possibleMethod = $classDefinition->getPossibleMethodName($methodName); if ($possibleMethod) { From f2a2597f419e007b12b8f7f65643d17b05f2d929 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Fri, 16 Apr 2021 23:01:10 +0100 Subject: [PATCH 23/63] Remove nullable state from HardDisk:$basePath property --- Library/FileSystem/HardDisk.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Library/FileSystem/HardDisk.php b/Library/FileSystem/HardDisk.php index 7574b06124..c09f07c949 100644 --- a/Library/FileSystem/HardDisk.php +++ b/Library/FileSystem/HardDisk.php @@ -44,9 +44,9 @@ class HardDisk implements FileSystemInterface * * Path to where all cached files and folders are collected. * - * @var string|null + * @var string */ - private ?string $basePath; + private string $basePath; /** * HardDisk constructor. From 023d3fcc5474d837109c5803395a1a692fb3172c Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Fri, 16 Apr 2021 23:13:04 +0100 Subject: [PATCH 24/63] #1086 - Rename test case methods --- ext/stub/arrayaccesstest.zep.c | 12 ++++++------ ext/stub/arrayaccesstest.zep.h | 24 ++++++++++++------------ stub/arrayaccesstest.zep | 12 ++++++------ tests/Extension/ArrayAccessTest.php | 6 +++--- 4 files changed, 27 insertions(+), 27 deletions(-) diff --git a/ext/stub/arrayaccesstest.zep.c b/ext/stub/arrayaccesstest.zep.c index a7a1a36a19..b5e1fc5246 100644 --- a/ext/stub/arrayaccesstest.zep.c +++ b/ext/stub/arrayaccesstest.zep.c @@ -217,7 +217,7 @@ PHP_METHOD(Stub_ArrayAccessTest, issue1094Test3) RETURN_MM_BOOL(isItemsNULL); } -PHP_METHOD(Stub_ArrayAccessTest, issue1086AddElementToArrayWithStrictParams) +PHP_METHOD(Stub_ArrayAccessTest, issue1086Strict) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *params_param = NULL, _0; @@ -245,7 +245,7 @@ PHP_METHOD(Stub_ArrayAccessTest, issue1086AddElementToArrayWithStrictParams) ZEPHIR_MM_RESTORE(); } -PHP_METHOD(Stub_ArrayAccessTest, issue1086CanAddAnElementToExistingArrayWithStrictParams) +PHP_METHOD(Stub_ArrayAccessTest, issue1086WontNullArrayAfterPassViaStaticWithStrictParams) { zval _0; zval params; @@ -264,12 +264,12 @@ PHP_METHOD(Stub_ArrayAccessTest, issue1086CanAddAnElementToExistingArrayWithStri ZEPHIR_INIT_VAR(&_0); ZVAL_LONG(&_0, 123); zephir_array_update_string(¶ms, SL("test"), &_0, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_SELF(NULL, "issue1086addelementtoarraywithstrictparams", NULL, 0, ¶ms); + ZEPHIR_CALL_SELF(NULL, "issue1086strict", NULL, 0, ¶ms); zephir_check_call_status(); RETURN_CTOR(¶ms); } -PHP_METHOD(Stub_ArrayAccessTest, issue1086AddElementToArrayWithoutStrictParams) +PHP_METHOD(Stub_ArrayAccessTest, issue1086NotStrictParams) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *params_param = NULL, _0; @@ -297,7 +297,7 @@ PHP_METHOD(Stub_ArrayAccessTest, issue1086AddElementToArrayWithoutStrictParams) ZEPHIR_MM_RESTORE(); } -PHP_METHOD(Stub_ArrayAccessTest, issue1086CanAddAnElementToExistingArrayWithoutStrictParams) +PHP_METHOD(Stub_ArrayAccessTest, issue1086WontNullArrayAfterPassViaStaticWithoutStrictParams) { zval _0; zval params; @@ -316,7 +316,7 @@ PHP_METHOD(Stub_ArrayAccessTest, issue1086CanAddAnElementToExistingArrayWithoutS ZEPHIR_INIT_VAR(&_0); ZVAL_LONG(&_0, 123); zephir_array_update_string(¶ms, SL("test"), &_0, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_SELF(NULL, "issue1086addelementtoarraywithoutstrictparams", NULL, 0, ¶ms); + ZEPHIR_CALL_SELF(NULL, "issue1086notstrictparams", NULL, 0, ¶ms); zephir_check_call_status(); RETURN_CTOR(¶ms); } diff --git a/ext/stub/arrayaccesstest.zep.h b/ext/stub/arrayaccesstest.zep.h index 2806d46d08..c1576e5ddd 100644 --- a/ext/stub/arrayaccesstest.zep.h +++ b/ext/stub/arrayaccesstest.zep.h @@ -10,10 +10,10 @@ PHP_METHOD(Stub_ArrayAccessTest, issue1155); PHP_METHOD(Stub_ArrayAccessTest, issue1094Test1); PHP_METHOD(Stub_ArrayAccessTest, issue1094Test2); PHP_METHOD(Stub_ArrayAccessTest, issue1094Test3); -PHP_METHOD(Stub_ArrayAccessTest, issue1086AddElementToArrayWithStrictParams); -PHP_METHOD(Stub_ArrayAccessTest, issue1086CanAddAnElementToExistingArrayWithStrictParams); -PHP_METHOD(Stub_ArrayAccessTest, issue1086AddElementToArrayWithoutStrictParams); -PHP_METHOD(Stub_ArrayAccessTest, issue1086CanAddAnElementToExistingArrayWithoutStrictParams); +PHP_METHOD(Stub_ArrayAccessTest, issue1086Strict); +PHP_METHOD(Stub_ArrayAccessTest, issue1086WontNullArrayAfterPassViaStaticWithStrictParams); +PHP_METHOD(Stub_ArrayAccessTest, issue1086NotStrictParams); +PHP_METHOD(Stub_ArrayAccessTest, issue1086WontNullArrayAfterPassViaStaticWithoutStrictParams); ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayaccesstest_exits, 0, 0, 0) ZEND_END_ARG_INFO() @@ -39,18 +39,18 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccesstest_issue1094te ZEND_ARG_ARRAY_INFO(0, items, 1) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayaccesstest_issue1086addelementtoarraywithstrictparams, 0, 0, 1) +ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayaccesstest_issue1086strict, 0, 0, 1) ZEND_ARG_ARRAY_INFO(0, params, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccesstest_issue1086canaddanelementtoexistingarraywithstrictparams, 0, 0, IS_ARRAY, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccesstest_issue1086wontnullarrayafterpassviastaticwithstrictparams, 0, 0, IS_ARRAY, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayaccesstest_issue1086addelementtoarraywithoutstrictparams, 0, 0, 1) +ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayaccesstest_issue1086notstrictparams, 0, 0, 1) ZEND_ARG_ARRAY_INFO(0, params, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccesstest_issue1086canaddanelementtoexistingarraywithoutstrictparams, 0, 0, IS_ARRAY, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccesstest_issue1086wontnullarrayafterpassviastaticwithoutstrictparams, 0, 0, IS_ARRAY, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_arrayaccesstest_method_entry) { @@ -69,9 +69,9 @@ ZEPHIR_INIT_FUNCS(stub_arrayaccesstest_method_entry) { PHP_ME(Stub_ArrayAccessTest, issue1094Test1, arginfo_stub_arrayaccesstest_issue1094test1, ZEND_ACC_PUBLIC) PHP_ME(Stub_ArrayAccessTest, issue1094Test2, arginfo_stub_arrayaccesstest_issue1094test2, ZEND_ACC_PUBLIC) PHP_ME(Stub_ArrayAccessTest, issue1094Test3, arginfo_stub_arrayaccesstest_issue1094test3, ZEND_ACC_PUBLIC) - PHP_ME(Stub_ArrayAccessTest, issue1086AddElementToArrayWithStrictParams, arginfo_stub_arrayaccesstest_issue1086addelementtoarraywithstrictparams, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) - PHP_ME(Stub_ArrayAccessTest, issue1086CanAddAnElementToExistingArrayWithStrictParams, arginfo_stub_arrayaccesstest_issue1086canaddanelementtoexistingarraywithstrictparams, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) - PHP_ME(Stub_ArrayAccessTest, issue1086AddElementToArrayWithoutStrictParams, arginfo_stub_arrayaccesstest_issue1086addelementtoarraywithoutstrictparams, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) - PHP_ME(Stub_ArrayAccessTest, issue1086CanAddAnElementToExistingArrayWithoutStrictParams, arginfo_stub_arrayaccesstest_issue1086canaddanelementtoexistingarraywithoutstrictparams, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + PHP_ME(Stub_ArrayAccessTest, issue1086Strict, arginfo_stub_arrayaccesstest_issue1086strict, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + PHP_ME(Stub_ArrayAccessTest, issue1086WontNullArrayAfterPassViaStaticWithStrictParams, arginfo_stub_arrayaccesstest_issue1086wontnullarrayafterpassviastaticwithstrictparams, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + PHP_ME(Stub_ArrayAccessTest, issue1086NotStrictParams, arginfo_stub_arrayaccesstest_issue1086notstrictparams, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + PHP_ME(Stub_ArrayAccessTest, issue1086WontNullArrayAfterPassViaStaticWithoutStrictParams, arginfo_stub_arrayaccesstest_issue1086wontnullarrayafterpassviastaticwithoutstrictparams, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_FE_END }; diff --git a/stub/arrayaccesstest.zep b/stub/arrayaccesstest.zep index 7b86287201..6c8a4b922b 100644 --- a/stub/arrayaccesstest.zep +++ b/stub/arrayaccesstest.zep @@ -72,36 +72,36 @@ class ArrayAccessTest return isItemsNULL; } - public static function issue1086AddElementToArrayWithStrictParams(array! params) + public static function issue1086Strict(array! params) { let params["test2"] = 1234; } - public static function issue1086CanAddAnElementToExistingArrayWithStrictParams() -> array + public static function issue1086WontNullArrayAfterPassViaStaticWithStrictParams() -> array { array params; let params = []; let params["test"] = 123; - self::issue1086AddElementToArrayWithStrictParams(params); + self::issue1086Strict(params); return params; } - public static function issue1086AddElementToArrayWithoutStrictParams(array params) + public static function issue1086NotStrictParams(array params) { let params["test2"] = 1234; } - public static function issue1086CanAddAnElementToExistingArrayWithoutStrictParams() -> array + public static function issue1086WontNullArrayAfterPassViaStaticWithoutStrictParams() -> array { array params; let params = []; let params["test"] = 123; - self::issue1086AddElementToArrayWithoutStrictParams(params); + self::issue1086NotStrictParams(params); return params; } diff --git a/tests/Extension/ArrayAccessTest.php b/tests/Extension/ArrayAccessTest.php index f3930b9b32..b68b38199f 100644 --- a/tests/Extension/ArrayAccessTest.php +++ b/tests/Extension/ArrayAccessTest.php @@ -62,14 +62,14 @@ public function testIssue1094(): void $this->assertFalse($class->issue1094Test3(['test' => 'ok'])); } - public function testIssue1086CanAddAnElementToExistingArray(): void + public function testIssue1086StaticallyCalledFunctionWithArrayAsArgMustReturnArray(): void { $class = new \Stub\ArrayAccessTest(); - $actual = $class->issue1086CanAddAnElementToExistingArrayWithStrictParams(); + $actual = $class->issue1086WontNullArrayAfterPassViaStaticWithStrictParams(); $this->assertSame(['test' => 123], $actual); - $actual = $class->issue1086CanAddAnElementToExistingArrayWithoutStrictParams(); + $actual = $class->issue1086WontNullArrayAfterPassViaStaticWithoutStrictParams(); $this->assertSame(['test' => 123], $actual); } } From 5d40c8db9c39b8f5782dc54d1f10df70c6ab1839 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Fri, 16 Apr 2021 23:14:12 +0100 Subject: [PATCH 25/63] #1086 - Add issue URL --- ext/stub/arrayaccesstest.zep.c | 12 ++++++++++++ stub/arrayaccesstest.zep | 12 ++++++++++++ tests/Extension/ArrayAccessTest.php | 3 +++ 3 files changed, 27 insertions(+) diff --git a/ext/stub/arrayaccesstest.zep.c b/ext/stub/arrayaccesstest.zep.c index b5e1fc5246..18dec81355 100644 --- a/ext/stub/arrayaccesstest.zep.c +++ b/ext/stub/arrayaccesstest.zep.c @@ -217,6 +217,9 @@ PHP_METHOD(Stub_ArrayAccessTest, issue1094Test3) RETURN_MM_BOOL(isItemsNULL); } +/** + * @issue https://github.com/zephir-lang/zephir/issues/1086 + */ PHP_METHOD(Stub_ArrayAccessTest, issue1086Strict) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; @@ -245,6 +248,9 @@ PHP_METHOD(Stub_ArrayAccessTest, issue1086Strict) ZEPHIR_MM_RESTORE(); } +/** + * @issue https://github.com/zephir-lang/zephir/issues/1086 + */ PHP_METHOD(Stub_ArrayAccessTest, issue1086WontNullArrayAfterPassViaStaticWithStrictParams) { zval _0; @@ -269,6 +275,9 @@ PHP_METHOD(Stub_ArrayAccessTest, issue1086WontNullArrayAfterPassViaStaticWithStr RETURN_CTOR(¶ms); } +/** + * @issue https://github.com/zephir-lang/zephir/issues/1086 + */ PHP_METHOD(Stub_ArrayAccessTest, issue1086NotStrictParams) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; @@ -297,6 +306,9 @@ PHP_METHOD(Stub_ArrayAccessTest, issue1086NotStrictParams) ZEPHIR_MM_RESTORE(); } +/** + * @issue https://github.com/zephir-lang/zephir/issues/1086 + */ PHP_METHOD(Stub_ArrayAccessTest, issue1086WontNullArrayAfterPassViaStaticWithoutStrictParams) { zval _0; diff --git a/stub/arrayaccesstest.zep b/stub/arrayaccesstest.zep index 6c8a4b922b..1623871c6b 100644 --- a/stub/arrayaccesstest.zep +++ b/stub/arrayaccesstest.zep @@ -72,11 +72,17 @@ class ArrayAccessTest return isItemsNULL; } + /** + * @issue https://github.com/zephir-lang/zephir/issues/1086 + */ public static function issue1086Strict(array! params) { let params["test2"] = 1234; } + /** + * @issue https://github.com/zephir-lang/zephir/issues/1086 + */ public static function issue1086WontNullArrayAfterPassViaStaticWithStrictParams() -> array { array params; @@ -89,11 +95,17 @@ class ArrayAccessTest return params; } + /** + * @issue https://github.com/zephir-lang/zephir/issues/1086 + */ public static function issue1086NotStrictParams(array params) { let params["test2"] = 1234; } + /** + * @issue https://github.com/zephir-lang/zephir/issues/1086 + */ public static function issue1086WontNullArrayAfterPassViaStaticWithoutStrictParams() -> array { array params; diff --git a/tests/Extension/ArrayAccessTest.php b/tests/Extension/ArrayAccessTest.php index b68b38199f..5544aca45b 100644 --- a/tests/Extension/ArrayAccessTest.php +++ b/tests/Extension/ArrayAccessTest.php @@ -62,6 +62,9 @@ public function testIssue1094(): void $this->assertFalse($class->issue1094Test3(['test' => 'ok'])); } + /** + * @issue https://github.com/zephir-lang/zephir/issues/1086 + */ public function testIssue1086StaticallyCalledFunctionWithArrayAsArgMustReturnArray(): void { $class = new \Stub\ArrayAccessTest(); From d4ae3ee705c7a6bb6ba845bb43e043d81e9beae2 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 18 Apr 2021 12:25:11 +0100 Subject: [PATCH 26/63] #887 - Add test case --- ext/config.m4 | 1 + ext/config.w32 | 2 +- ext/stub.c | 2 + ext/stub.h | 1 + ext/stub/issue887.zep.c | 95 ++++++++++++++++++++++++++++++++ ext/stub/issue887.zep.h | 43 +++++++++++++++ stub/issue887.zep | 29 ++++++++++ tests/Extension/Issue887Test.php | 34 ++++++++++++ 8 files changed, 206 insertions(+), 1 deletion(-) create mode 100644 ext/stub/issue887.zep.c create mode 100644 ext/stub/issue887.zep.h create mode 100644 stub/issue887.zep create mode 100644 tests/Extension/Issue887Test.php diff --git a/ext/config.m4 b/ext/config.m4 index 3c85410486..e682f8784f 100644 --- a/ext/config.m4 +++ b/ext/config.m4 @@ -101,6 +101,7 @@ if test "$PHP_STUB" = "yes"; then stub/issue1521.zep.c stub/issue2165/issue.zep.c stub/issue663.zep.c + stub/issue887.zep.c stub/issue914.zep.c stub/issues.zep.c stub/json.zep.c diff --git a/ext/config.w32 b/ext/config.w32 index 7397bc22b1..128f6ae76f 100644 --- a/ext/config.w32 +++ b/ext/config.w32 @@ -11,7 +11,7 @@ if (PHP_STUB != "no") { } ADD_SOURCES(configure_module_dirname + "/stub/invokes", "abstractprotected.zep.c abstractinvoker.zep.c abstractinvokercomplex.zep.c invokeprotected.zep.c invokeprotectedcomplex.zep.c", "stub"); - ADD_SOURCES(configure_module_dirname + "/stub", "testinterface.zep.c scallparent.zep.c constantsparent.zep.c methodinterface.zep.c arithmetic.zep.c arrayaccessobj.zep.c arrayaccesstest.zep.c arrayiterator.zep.c arrayiteratortest.zep.c arraymanipulation.zep.c arrayobject.zep.c arraysearch.zep.c assign.zep.c bitwise.zep.c branchprediction.zep.c cast.zep.c cblock.zep.c chars.zep.c closures.zep.c compare.zep.c concat.zep.c constants.zep.c constantsinterface.zep.c constantsinterfacea.zep.c constantsinterfaceb.zep.c declaretest.zep.c diinterface.zep.c echoes.zep.c emptytest.zep.c evaltest.zep.c exception.zep.c exceptions.zep.c exists.zep.c exitdie.zep.c extendedinterface.zep.c factorial.zep.c fannkuch.zep.c fasta.zep.c fcall.zep.c fetchtest.zep.c fibonnaci.zep.c flow.zep.c fortytwo.zep.c functional.zep.c functionexists.zep.c functions.zep.c geometry.zep.c globals.zep.c instance.zep.c instanceoff.zep.c internalclasses.zep.c internalinterfaces.zep.c invoke.zep.c issettest.zep.c issue1404.zep.c issue1521.zep.c issue663.zep.c issue914.zep.c issues.zep.c json.zep.c logical.zep.c mcall.zep.c mcallchained.zep.c mcalldynamic.zep.c mcallinternal.zep.c methodabstract.zep.c methodargs.zep.c nativearray.zep.c oo.zep.c operator.zep.c pdostatement.zep.c pregmatch.zep.c quantum.zep.c range.zep.c references.zep.c reflection.zep.c regexdna.zep.c requires.zep.c resourcetest.zep.c returns.zep.c router.zep.c scall.zep.c scalldynamic.zep.c scallexternal.zep.c scalllateconstruct.zep.c scope.zep.c sort.zep.c spectralnorm.zep.c spl.zep.c spropertyaccess.zep.c statements.zep.c strings.zep.c stubs.zep.c ternary.zep.c trytest.zep.c typeinstances.zep.c typeoff.zep.c unknownclass.zep.c unsettest.zep.c usetest.zep.c vars.zep.c 0__closure.zep.c 1__closure.zep.c 2__closure.zep.c 3__closure.zep.c 4__closure.zep.c 5__closure.zep.c 6__closure.zep.c 7__closure.zep.c 8__closure.zep.c 9__closure.zep.c 10__closure.zep.c 11__closure.zep.c 12__closure.zep.c 13__closure.zep.c", "stub"); + ADD_SOURCES(configure_module_dirname + "/stub", "testinterface.zep.c scallparent.zep.c constantsparent.zep.c methodinterface.zep.c arithmetic.zep.c arrayaccessobj.zep.c arrayaccesstest.zep.c arrayiterator.zep.c arrayiteratortest.zep.c arraymanipulation.zep.c arrayobject.zep.c arraysearch.zep.c assign.zep.c bitwise.zep.c branchprediction.zep.c cast.zep.c cblock.zep.c chars.zep.c closures.zep.c compare.zep.c concat.zep.c constants.zep.c constantsinterface.zep.c constantsinterfacea.zep.c constantsinterfaceb.zep.c declaretest.zep.c diinterface.zep.c echoes.zep.c emptytest.zep.c evaltest.zep.c exception.zep.c exceptions.zep.c exists.zep.c exitdie.zep.c extendedinterface.zep.c factorial.zep.c fannkuch.zep.c fasta.zep.c fcall.zep.c fetchtest.zep.c fibonnaci.zep.c flow.zep.c fortytwo.zep.c functional.zep.c functionexists.zep.c functions.zep.c geometry.zep.c globals.zep.c instance.zep.c instanceoff.zep.c internalclasses.zep.c internalinterfaces.zep.c invoke.zep.c issettest.zep.c issue1404.zep.c issue1521.zep.c issue663.zep.c issue887.zep.c issue914.zep.c issues.zep.c json.zep.c logical.zep.c mcall.zep.c mcallchained.zep.c mcalldynamic.zep.c mcallinternal.zep.c methodabstract.zep.c methodargs.zep.c nativearray.zep.c oo.zep.c operator.zep.c pdostatement.zep.c pregmatch.zep.c quantum.zep.c range.zep.c references.zep.c reflection.zep.c regexdna.zep.c requires.zep.c resourcetest.zep.c returns.zep.c router.zep.c scall.zep.c scalldynamic.zep.c scallexternal.zep.c scalllateconstruct.zep.c scope.zep.c sort.zep.c spectralnorm.zep.c spl.zep.c spropertyaccess.zep.c statements.zep.c strings.zep.c stubs.zep.c ternary.zep.c trytest.zep.c typeinstances.zep.c typeoff.zep.c unknownclass.zep.c unsettest.zep.c usetest.zep.c vars.zep.c 0__closure.zep.c 1__closure.zep.c 2__closure.zep.c 3__closure.zep.c 4__closure.zep.c 5__closure.zep.c 6__closure.zep.c 7__closure.zep.c 8__closure.zep.c 9__closure.zep.c 10__closure.zep.c 11__closure.zep.c 12__closure.zep.c 13__closure.zep.c", "stub"); ADD_SOURCES(configure_module_dirname + "/stub/oo/extend", "exception.zep.c", "stub"); ADD_SOURCES(configure_module_dirname + "/stub/issue2165", "issueextendinterface.zep.c issueinterface.zep.c issue.zep.c", "stub"); ADD_SOURCES(configure_module_dirname + "/stub/oo/extend/db", "exception.zep.c", "stub"); diff --git a/ext/stub.c b/ext/stub.c index e1d6d7d6c6..ef42643726 100644 --- a/ext/stub.c +++ b/ext/stub.c @@ -130,6 +130,7 @@ zend_class_entry *stub_issue1404_ce; zend_class_entry *stub_issue1521_ce; zend_class_entry *stub_issue2165_issue_ce; zend_class_entry *stub_issue663_ce; +zend_class_entry *stub_issue887_ce; zend_class_entry *stub_issue914_ce; zend_class_entry *stub_issues_ce; zend_class_entry *stub_json_ce; @@ -349,6 +350,7 @@ static PHP_MINIT_FUNCTION(stub) ZEPHIR_INIT(Stub_Issue1521); ZEPHIR_INIT(Stub_Issue2165_Issue); ZEPHIR_INIT(Stub_Issue663); + ZEPHIR_INIT(Stub_Issue887); ZEPHIR_INIT(Stub_Issue914); ZEPHIR_INIT(Stub_Issues); ZEPHIR_INIT(Stub_Json); diff --git a/ext/stub.h b/ext/stub.h index a253b700ec..d71725554e 100644 --- a/ext/stub.h +++ b/ext/stub.h @@ -96,6 +96,7 @@ #include "stub/issue1521.zep.h" #include "stub/issue2165/issue.zep.h" #include "stub/issue663.zep.h" +#include "stub/issue887.zep.h" #include "stub/issue914.zep.h" #include "stub/issues.zep.h" #include "stub/json.zep.h" diff --git a/ext/stub/issue887.zep.c b/ext/stub/issue887.zep.c new file mode 100644 index 0000000000..1fa818d024 --- /dev/null +++ b/ext/stub/issue887.zep.c @@ -0,0 +1,95 @@ + +#ifdef HAVE_CONFIG_H +#include "../ext_config.h" +#endif + +#include +#include "../php_ext.h" +#include "../ext.h" + +#include +#include +#include + +#include "kernel/main.h" +#include "kernel/memory.h" +#include "kernel/object.h" +#include "kernel/operators.h" + + +/** + * @issue https://github.com/zephir-lang/zephir/issues/887 + */ +ZEPHIR_INIT_CLASS(Stub_Issue887) +{ + ZEPHIR_REGISTER_CLASS(Stub, Issue887, stub, issue887, stub_issue887_method_entry, 0); + + zend_declare_property_null(stub_issue887_ce, SL("data"), ZEND_ACC_PUBLIC); + return SUCCESS; +} + +PHP_METHOD(Stub_Issue887, __construct) +{ + zval _0; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&_0); + + + ZEPHIR_MM_GROW(); + + ZEPHIR_INIT_VAR(&_0); + array_init(&_0); + zephir_update_property_zval(this_ptr, ZEND_STRL("data"), &_0); + ZEPHIR_MM_RESTORE(); +} + +PHP_METHOD(Stub_Issue887, add) +{ + zval *key, key_sub, *value, value_sub; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&key_sub); + ZVAL_UNDEF(&value_sub); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_ZVAL(key) + Z_PARAM_ZVAL(value) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + zephir_fetch_params_without_memory_grow(2, 0, &key, &value); + + + zephir_update_property_array(this_ptr, SL("data"), key, value); +} + +PHP_METHOD(Stub_Issue887, fetch_array) +{ + zval *this_ptr = getThis(); + + + + RETURN_MEMBER(getThis(), "data"); +} + +PHP_METHOD(Stub_Issue887, fetch_object) +{ + zval _0; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&_0); + + + ZEPHIR_MM_GROW(); + + ZEPHIR_OBS_VAR(&_0); + zephir_read_property(&_0, this_ptr, ZEND_STRL("data"), PH_NOISY_CC); + zephir_convert_to_object(&_0); + RETURN_CCTOR(&_0); +} + diff --git a/ext/stub/issue887.zep.h b/ext/stub/issue887.zep.h new file mode 100644 index 0000000000..e83bdd3431 --- /dev/null +++ b/ext/stub/issue887.zep.h @@ -0,0 +1,43 @@ + +extern zend_class_entry *stub_issue887_ce; + +ZEPHIR_INIT_CLASS(Stub_Issue887); + +PHP_METHOD(Stub_Issue887, __construct); +PHP_METHOD(Stub_Issue887, add); +PHP_METHOD(Stub_Issue887, fetch_array); +PHP_METHOD(Stub_Issue887, fetch_object); + +ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_issue887___construct, 0, 0, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_issue887_add, 0, 0, 2) + ZEND_ARG_INFO(0, key) + ZEND_ARG_INFO(0, value) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_issue887_fetch_array, 0, 0, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_issue887_fetch_object, 0, 0, 0) +ZEND_END_ARG_INFO() + +ZEPHIR_INIT_FUNCS(stub_issue887_method_entry) { +#if PHP_VERSION_ID >= 80000 + PHP_ME(Stub_Issue887, __construct, arginfo_stub_issue887___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) +#else + PHP_ME(Stub_Issue887, __construct, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) +#endif + PHP_ME(Stub_Issue887, add, arginfo_stub_issue887_add, ZEND_ACC_PUBLIC) +#if PHP_VERSION_ID >= 80000 + PHP_ME(Stub_Issue887, fetch_array, arginfo_stub_issue887_fetch_array, ZEND_ACC_PUBLIC) +#else + PHP_ME(Stub_Issue887, fetch_array, NULL, ZEND_ACC_PUBLIC) +#endif +#if PHP_VERSION_ID >= 80000 + PHP_ME(Stub_Issue887, fetch_object, arginfo_stub_issue887_fetch_object, ZEND_ACC_PUBLIC) +#else + PHP_ME(Stub_Issue887, fetch_object, NULL, ZEND_ACC_PUBLIC) +#endif + PHP_FE_END +}; diff --git a/stub/issue887.zep b/stub/issue887.zep new file mode 100644 index 0000000000..1dcb140537 --- /dev/null +++ b/stub/issue887.zep @@ -0,0 +1,29 @@ +namespace Stub; + +/** + * @issue https://github.com/zephir-lang/zephir/issues/887 + */ +class Issue887 +{ + public data; + + public function __construct() + { + let this->data = []; + } + + public function add(key, value) + { + let this->data[key] = value; + } + + public function fetch_array() + { + return this->data; + } + + public function fetch_object() + { + return (object) this->data; + } +} diff --git a/tests/Extension/Issue887Test.php b/tests/Extension/Issue887Test.php new file mode 100644 index 0000000000..68728c870a --- /dev/null +++ b/tests/Extension/Issue887Test.php @@ -0,0 +1,34 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Extension; + +use PHPUnit\Framework\TestCase; +use Stub\Issue887; + +/** + * @issue https://github.com/zephir-lang/zephir/issues/887 + */ +final class Issue887Test extends TestCase +{ + public function testPreventPropertyTypeChangeFromPreviousMethodCall(): void + { + $class = new Issue887(); + + $this->assertIsArray($class->data); + $this->assertIsArray($class->fetch_array()); + $this->assertIsObject($class->fetch_object()); + $this->assertIsArray($class->fetch_array()); + $this->assertIsArray($class->data); + } +} From 63f2141f6d96525e1b015f56b28cf084f8bacefe Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 18 Apr 2021 14:19:23 +0100 Subject: [PATCH 27/63] #1803 - Add test case --- ext/config.m4 | 3 +- ext/config.w32 | 1 + ext/stub.c | 2 + ext/stub.h | 1 + ext/stub/constructors/issue1803.zep.c | 44 +++++++++++++++++++ ext/stub/constructors/issue1803.zep.h | 18 ++++++++ stub/constructors/issue1803.zep | 15 +++++++ .../Extension/Constructors/Issue1803Test.php | 35 +++++++++++++++ 8 files changed, 118 insertions(+), 1 deletion(-) create mode 100644 ext/stub/constructors/issue1803.zep.c create mode 100644 ext/stub/constructors/issue1803.zep.h create mode 100644 stub/constructors/issue1803.zep create mode 100644 tests/Extension/Constructors/Issue1803Test.php diff --git a/ext/config.m4 b/ext/config.m4 index e682f8784f..5f807aafcc 100644 --- a/ext/config.m4 +++ b/ext/config.m4 @@ -56,6 +56,7 @@ if test "$PHP_STUB" = "yes"; then stub/constantsinterface.zep.c stub/constantsinterfacea.zep.c stub/constantsinterfaceb.zep.c + stub/constructors/issue1803.zep.c stub/declaretest.zep.c stub/diinterface.zep.c stub/echoes.zep.c @@ -227,7 +228,7 @@ if test "$PHP_STUB" = "yes"; then stub/13__closure.zep.c " PHP_NEW_EXTENSION(stub, $stub_sources, $ext_shared,, ) PHP_ADD_BUILD_DIR([$ext_builddir/kernel/]) - for dir in "stub stub/bench stub/builtin stub/flow stub/globals stub/globals/session stub/integration/psr/http/message stub/interfaces stub/invokes stub/issue2165 stub/mcall stub/namespaces stub/namespaces/a/b stub/oo stub/oo/extend stub/oo/extend/db stub/oo/extend/db/query stub/oo/extend/db/query/placeholder stub/oo/extend/spl stub/oo/scopes stub/ooimpl stub/optimizers stub/properties stub/requires stub/router stub/typehinting"; do + for dir in "stub stub/bench stub/builtin stub/constructors stub/flow stub/globals stub/globals/session stub/integration/psr/http/message stub/interfaces stub/invokes stub/issue2165 stub/mcall stub/namespaces stub/namespaces/a/b stub/oo stub/oo/extend stub/oo/extend/db stub/oo/extend/db/query stub/oo/extend/db/query/placeholder stub/oo/extend/spl stub/oo/scopes stub/ooimpl stub/optimizers stub/properties stub/requires stub/router stub/typehinting"; do PHP_ADD_BUILD_DIR([$ext_builddir/$dir]) done PHP_SUBST(STUB_SHARED_LIBADD) diff --git a/ext/config.w32 b/ext/config.w32 index 128f6ae76f..f76a0fb614 100644 --- a/ext/config.w32 +++ b/ext/config.w32 @@ -24,6 +24,7 @@ if (PHP_STUB != "no") { ADD_SOURCES(configure_module_dirname + "/stub/properties", "publicproperties.zep.c app.zep.c extendspublicproperties.zep.c privateproperties.zep.c propertyarray.zep.c propertyupdate.zep.c protectedproperties.zep.c staticprivateproperties.zep.c staticpropertyarray.zep.c staticprotectedproperties.zep.c staticpublicproperties.zep.c", "stub"); ADD_SOURCES(configure_module_dirname + "/stub/bench", "foo.zep.c", "stub"); ADD_SOURCES(configure_module_dirname + "/stub/builtin", "arraymethods.zep.c charmethods.zep.c intmethods.zep.c stringmethods.zep.c", "stub"); + ADD_SOURCES(configure_module_dirname + "/stub/constructors", "issue1803.zep.c", "stub"); ADD_SOURCES(configure_module_dirname + "/stub/flow", "switchflow.zep.c", "stub"); ADD_SOURCES(configure_module_dirname + "/stub/globals", "env.zep.c post.zep.c server.zep.c serverrequestfactory.zep.c", "stub"); ADD_SOURCES(configure_module_dirname + "/stub/integration/psr/http/message", "messageinterfaceex.zep.c", "stub"); diff --git a/ext/stub.c b/ext/stub.c index ef42643726..77c2e1378a 100644 --- a/ext/stub.c +++ b/ext/stub.c @@ -89,6 +89,7 @@ zend_class_entry *stub_constants_ce; zend_class_entry *stub_constantsinterface_ce; zend_class_entry *stub_constantsinterfacea_ce; zend_class_entry *stub_constantsinterfaceb_ce; +zend_class_entry *stub_constructors_issue1803_ce; zend_class_entry *stub_declaretest_ce; zend_class_entry *stub_echoes_ce; zend_class_entry *stub_emptytest_ce; @@ -309,6 +310,7 @@ static PHP_MINIT_FUNCTION(stub) ZEPHIR_INIT(Stub_ConstantsInterface); ZEPHIR_INIT(Stub_ConstantsInterfaceA); ZEPHIR_INIT(Stub_ConstantsInterfaceB); + ZEPHIR_INIT(Stub_Constructors_Issue1803); ZEPHIR_INIT(Stub_DeclareTest); ZEPHIR_INIT(Stub_Echoes); ZEPHIR_INIT(Stub_EmptyTest); diff --git a/ext/stub.h b/ext/stub.h index d71725554e..ca4fe312d6 100644 --- a/ext/stub.h +++ b/ext/stub.h @@ -51,6 +51,7 @@ #include "stub/constantsinterface.zep.h" #include "stub/constantsinterfacea.zep.h" #include "stub/constantsinterfaceb.zep.h" +#include "stub/constructors/issue1803.zep.h" #include "stub/declaretest.zep.h" #include "stub/diinterface.zep.h" #include "stub/echoes.zep.h" diff --git a/ext/stub/constructors/issue1803.zep.c b/ext/stub/constructors/issue1803.zep.c new file mode 100644 index 0000000000..d23fe3f264 --- /dev/null +++ b/ext/stub/constructors/issue1803.zep.c @@ -0,0 +1,44 @@ + +#ifdef HAVE_CONFIG_H +#include "../../ext_config.h" +#endif + +#include +#include "../../php_ext.h" +#include "../../ext.h" + +#include +#include +#include + +#include "kernel/main.h" +#include "kernel/object.h" +#include "kernel/memory.h" + + +ZEPHIR_INIT_CLASS(Stub_Constructors_Issue1803) +{ + ZEPHIR_REGISTER_CLASS(Stub\\Constructors, Issue1803, stub, constructors_issue1803, stub_constructors_issue1803_method_entry, 0); + + zend_declare_property_string(stub_constructors_issue1803_ce, SL("value"), "Original value", ZEND_ACC_PUBLIC); + return SUCCESS; +} + +PHP_METHOD(Stub_Constructors_Issue1803, Issue1803) +{ + zval _0; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&_0); + + + ZEPHIR_MM_GROW(); + + ZEPHIR_INIT_VAR(&_0); + ZEPHIR_INIT_NVAR(&_0); + ZVAL_STRING(&_0, "Value that won't be updated on class init"); + zephir_update_property_zval(this_ptr, ZEND_STRL("value"), &_0); + ZEPHIR_MM_RESTORE(); +} + diff --git a/ext/stub/constructors/issue1803.zep.h b/ext/stub/constructors/issue1803.zep.h new file mode 100644 index 0000000000..7b90bbfe28 --- /dev/null +++ b/ext/stub/constructors/issue1803.zep.h @@ -0,0 +1,18 @@ + +extern zend_class_entry *stub_constructors_issue1803_ce; + +ZEPHIR_INIT_CLASS(Stub_Constructors_Issue1803); + +PHP_METHOD(Stub_Constructors_Issue1803, Issue1803); + +ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_constructors_issue1803_issue1803, 0, 0, 0) +ZEND_END_ARG_INFO() + +ZEPHIR_INIT_FUNCS(stub_constructors_issue1803_method_entry) { +#if PHP_VERSION_ID >= 80000 + PHP_ME(Stub_Constructors_Issue1803, Issue1803, arginfo_stub_constructors_issue1803_issue1803, ZEND_ACC_PUBLIC) +#else + PHP_ME(Stub_Constructors_Issue1803, Issue1803, NULL, ZEND_ACC_PUBLIC) +#endif + PHP_FE_END +}; diff --git a/stub/constructors/issue1803.zep b/stub/constructors/issue1803.zep new file mode 100644 index 0000000000..5c728449d5 --- /dev/null +++ b/stub/constructors/issue1803.zep @@ -0,0 +1,15 @@ + +namespace Stub\Constructors; + +/** + * @issue https://github.com/zephir-lang/zephir/issues/1803 + */ +class Issue1803 +{ + public value = "Original value"; + + public function Issue1803() + { + let this->value = "Value that won't be updated on class init"; + } +} diff --git a/tests/Extension/Constructors/Issue1803Test.php b/tests/Extension/Constructors/Issue1803Test.php new file mode 100644 index 0000000000..e04461480a --- /dev/null +++ b/tests/Extension/Constructors/Issue1803Test.php @@ -0,0 +1,35 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Extension\Constructors; + +use PHPUnit\Framework\TestCase; +use Stub\Constructors\Issue1803; + +/** + * @issue https://github.com/zephir-lang/zephir/issues/1803 + */ +final class Issue1803Test extends TestCase +{ + public function testOldStyleConstructorThatWontBeCalledOnClassInit(): void + { + $class = new Issue1803(); + + $this->assertInstanceOf(Issue1803::class, $class); + $this->assertSame('Original value', $class->value); + + $class->Issue1803(); + + $this->assertSame("Value that won't be updated on class init", $class->value); + } +} From 278a85f16bcc2d900384ef9cbe223b6f173ecb24 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 18 Apr 2021 14:30:54 +0100 Subject: [PATCH 28/63] #1803 - Add version check --- ext/stub/constructors/issue1803.zep.c | 3 +++ tests/Extension/Constructors/Issue1803Test.php | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ext/stub/constructors/issue1803.zep.c b/ext/stub/constructors/issue1803.zep.c index d23fe3f264..b16eecc55e 100644 --- a/ext/stub/constructors/issue1803.zep.c +++ b/ext/stub/constructors/issue1803.zep.c @@ -16,6 +16,9 @@ #include "kernel/memory.h" +/** + * @issue https://github.com/zephir-lang/zephir/issues/1803 + */ ZEPHIR_INIT_CLASS(Stub_Constructors_Issue1803) { ZEPHIR_REGISTER_CLASS(Stub\\Constructors, Issue1803, stub, constructors_issue1803, stub_constructors_issue1803_method_entry, 0); diff --git a/tests/Extension/Constructors/Issue1803Test.php b/tests/Extension/Constructors/Issue1803Test.php index e04461480a..b15b529742 100644 --- a/tests/Extension/Constructors/Issue1803Test.php +++ b/tests/Extension/Constructors/Issue1803Test.php @@ -26,7 +26,11 @@ public function testOldStyleConstructorThatWontBeCalledOnClassInit(): void $class = new Issue1803(); $this->assertInstanceOf(Issue1803::class, $class); - $this->assertSame('Original value', $class->value); + if (version_compare(PHP_VERSION, '8.0.0', '>=')) { + $this->assertSame('Original value', $class->value); + } else { + $this->assertSame("Value that won't be updated on class init", $class->value); + } $class->Issue1803(); From 459a05d4c56aac3ae141b2d9ec546c3e57e0889a Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 18 Apr 2021 14:57:33 +0100 Subject: [PATCH 29/63] #1536 - Add version check --- .../staticprotectedproperties.zep.c | 24 +++++++++++++ .../staticprotectedproperties.zep.h | 5 +++ stub/constantsparent.zep | 2 -- stub/properties/staticprotectedproperties.zep | 17 ++++++++- .../Properties/StaticPropertyArrayTest.php | 4 +-- .../StaticProtectedPropertiesTest.php | 35 +++++++++++++++++++ .../mocks/TestScopePhpMagicExtending.php | 1 + .../mocks/TestStaticProtectedProperties.php | 19 ++++++++++ 8 files changed, 102 insertions(+), 5 deletions(-) create mode 100644 tests/Extension/Properties/StaticProtectedPropertiesTest.php create mode 100644 tests/fixtures/mocks/TestStaticProtectedProperties.php diff --git a/ext/stub/properties/staticprotectedproperties.zep.c b/ext/stub/properties/staticprotectedproperties.zep.c index a4504c79ff..f943280cae 100644 --- a/ext/stub/properties/staticprotectedproperties.zep.c +++ b/ext/stub/properties/staticprotectedproperties.zep.c @@ -14,6 +14,7 @@ #include "kernel/main.h" #include "kernel/object.h" #include "kernel/memory.h" +#include "kernel/operators.h" ZEPHIR_INIT_CLASS(Stub_Properties_StaticProtectedProperties) @@ -193,3 +194,26 @@ PHP_METHOD(Stub_Properties_StaticProtectedProperties, getSomeString) RETURN_CTORW(&_0); } +PHP_METHOD(Stub_Properties_StaticProtectedProperties, compareStaticNull) +{ + zval someNull, _0; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&someNull); + ZVAL_UNDEF(&_0); + + + ZEPHIR_MM_GROW(); + + ZEPHIR_OBS_VAR(&_0); + zephir_read_static_property_ce(&_0, stub_properties_staticprotectedproperties_ce, SL("someNull"), PH_NOISY_CC); + ZEPHIR_CPY_WRT(&someNull, &_0); + if (Z_TYPE_P(&someNull) == IS_NULL) { + ZEPHIR_INIT_NVAR(&someNull); + ZVAL_BOOL(&someNull, 1); + RETURN_CCTOR(&someNull); + } + RETURN_CCTOR(&someNull); +} + diff --git a/ext/stub/properties/staticprotectedproperties.zep.h b/ext/stub/properties/staticprotectedproperties.zep.h index 4007af9a35..05205678d4 100644 --- a/ext/stub/properties/staticprotectedproperties.zep.h +++ b/ext/stub/properties/staticprotectedproperties.zep.h @@ -13,6 +13,7 @@ PHP_METHOD(Stub_Properties_StaticProtectedProperties, getSomeTrue); PHP_METHOD(Stub_Properties_StaticProtectedProperties, getSomeInteger); PHP_METHOD(Stub_Properties_StaticProtectedProperties, getSomeDouble); PHP_METHOD(Stub_Properties_StaticProtectedProperties, getSomeString); +PHP_METHOD(Stub_Properties_StaticProtectedProperties, compareStaticNull); ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_properties_staticprotectedproperties_setsomevar, 0, 0, 1) ZEND_ARG_INFO(0, someVar) @@ -46,6 +47,9 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_properties_staticprotectedproperties_getsomestring, 0, 0, 0) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_properties_staticprotectedproperties_comparestaticnull, 0, 0, _IS_BOOL, 0) +ZEND_END_ARG_INFO() + ZEPHIR_INIT_FUNCS(stub_properties_staticprotectedproperties_method_entry) { PHP_ME(Stub_Properties_StaticProtectedProperties, setSomeVar, arginfo_stub_properties_staticprotectedproperties_setsomevar, ZEND_ACC_PUBLIC) #if PHP_VERSION_ID >= 80000 @@ -89,5 +93,6 @@ ZEPHIR_INIT_FUNCS(stub_properties_staticprotectedproperties_method_entry) { #else PHP_ME(Stub_Properties_StaticProtectedProperties, getSomeString, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) #endif + PHP_ME(Stub_Properties_StaticProtectedProperties, compareStaticNull, arginfo_stub_properties_staticprotectedproperties_comparestaticnull, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/stub/constantsparent.zep b/stub/constantsparent.zep index 072fcad095..52239ef0b4 100644 --- a/stub/constantsparent.zep +++ b/stub/constantsparent.zep @@ -3,7 +3,6 @@ namespace Stub; class ConstantsParent { - const P1 = null; const P2 = false; @@ -15,5 +14,4 @@ class ConstantsParent const P5 = 10.25; const P6 = "test"; - } diff --git a/stub/properties/staticprotectedproperties.zep b/stub/properties/staticprotectedproperties.zep index d0fdc9ac03..ab4bf8c8ee 100644 --- a/stub/properties/staticprotectedproperties.zep +++ b/stub/properties/staticprotectedproperties.zep @@ -3,7 +3,6 @@ namespace Stub\Properties; class StaticProtectedProperties { - /** * This is a protected property with no initial value */ @@ -81,4 +80,20 @@ class StaticProtectedProperties return self::someString; } + /** + * @issue https://github.com/zephir-lang/zephir/issues/1536 + */ + public function compareStaticNull() -> bool + { + var someNull; + + let someNull = self::someNull; + + if someNull === null { + let someNull = true; + return someNull; + } + + return someNull; + } } diff --git a/tests/Extension/Properties/StaticPropertyArrayTest.php b/tests/Extension/Properties/StaticPropertyArrayTest.php index b2cce1930d..c5255ee231 100644 --- a/tests/Extension/Properties/StaticPropertyArrayTest.php +++ b/tests/Extension/Properties/StaticPropertyArrayTest.php @@ -1,7 +1,5 @@ + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Extension\Properties; + +use PHPUnit\Framework\TestCase; +use Stub\Properties\StaticProtectedProperties; + +/** + * @issue https://github.com/zephir-lang/zephir/issues/1536 + */ +final class StaticProtectedPropertiesTest extends TestCase +{ + public function testCompareStaticNullOnBuiltIn(): void + { + $class = new StaticProtectedProperties(); + $this->assertTrue($class->compareStaticNull()); + } + + public function testCompareStaticNullOnExtending(): void + { + $spp = new \TestStaticProtectedProperties(); + $this->assertTrue($spp->compareStaticNull()); + } +} diff --git a/tests/fixtures/mocks/TestScopePhpMagicExtending.php b/tests/fixtures/mocks/TestScopePhpMagicExtending.php index 600419777e..21f72082c0 100644 --- a/tests/fixtures/mocks/TestScopePhpMagicExtending.php +++ b/tests/fixtures/mocks/TestScopePhpMagicExtending.php @@ -8,6 +8,7 @@ * For the full copyright and license information, please view * the LICENSE file that was distributed with this source code. */ + class TestScopePhpMagicExtending extends TestScopePhpMagic { private $privateProperty2 = 'private2'; diff --git a/tests/fixtures/mocks/TestStaticProtectedProperties.php b/tests/fixtures/mocks/TestStaticProtectedProperties.php new file mode 100644 index 0000000000..05c37616af --- /dev/null +++ b/tests/fixtures/mocks/TestStaticProtectedProperties.php @@ -0,0 +1,19 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +use Stub\Properties\StaticProtectedProperties; + +/** + * @issue https://github.com/zephir-lang/zephir/issues/1536 + */ +class TestStaticProtectedProperties extends StaticProtectedProperties +{ +} From 777943729c7f1aee57cabfdb9969c5661ab8bfef Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Mon, 19 Apr 2021 09:48:14 +0100 Subject: [PATCH 30/63] #1259 - Add failing test case --- ext/stub/arrayaccesstest.zep.c | 88 ++++++++++++++++++- ext/stub/arrayaccesstest.zep.h | 14 +++ .../staticprotectedproperties.zep.c | 3 + stub/arrayaccesstest.zep | 30 +++++++ tests/Extension/ArrayAccessTest.php | 16 ++++ 5 files changed, 150 insertions(+), 1 deletion(-) diff --git a/ext/stub/arrayaccesstest.zep.c b/ext/stub/arrayaccesstest.zep.c index 18dec81355..61e9368f37 100644 --- a/ext/stub/arrayaccesstest.zep.c +++ b/ext/stub/arrayaccesstest.zep.c @@ -26,6 +26,9 @@ ZEPHIR_INIT_CLASS(Stub_ArrayAccessTest) ZEPHIR_REGISTER_CLASS(Stub, ArrayAccessTest, stub, arrayaccesstest, stub_arrayaccesstest_method_entry, 0); zend_declare_property_null(stub_arrayaccesstest_ce, SL("data"), ZEND_ACC_PROTECTED); + zend_declare_property_null(stub_arrayaccesstest_ce, SL("unsetData"), ZEND_ACC_PROTECTED); + stub_arrayaccesstest_ce->create_object = zephir_init_properties_Stub_ArrayAccessTest; + return SUCCESS; } @@ -65,7 +68,7 @@ PHP_METHOD(Stub_ArrayAccessTest, get) object_init_ex(&arr, stub_arrayaccessobj_ce); ZEPHIR_CALL_METHOD(NULL, &arr, "__construct", NULL, 3); zephir_check_call_status(); - zephir_array_fetch_string(&_0, &arr, SL("two"), PH_NOISY | PH_READONLY, "stub/arrayaccesstest.zep", 20); + zephir_array_fetch_string(&_0, &arr, SL("two"), PH_NOISY | PH_READONLY, "stub/arrayaccesstest.zep", 21); RETURN_CTOR(&_0); } @@ -333,3 +336,86 @@ PHP_METHOD(Stub_ArrayAccessTest, issue1086WontNullArrayAfterPassViaStaticWithout RETURN_CTOR(¶ms); } +/** + * @issue https://github.com/zephir-lang/zephir/issues/1259 + */ +PHP_METHOD(Stub_ArrayAccessTest, issue1259UnsetKeyFromArrayInternalVariable) +{ + zval ret, unsetData; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&ret); + ZVAL_UNDEF(&unsetData); + + + ZEPHIR_MM_GROW(); + + ZEPHIR_INIT_VAR(&ret); + array_init(&ret); + ZEPHIR_INIT_VAR(&unsetData); + zephir_create_array(&unsetData, 2, 0); + add_assoc_stringl_ex(&unsetData, SL("key_a"), SL("marcin")); + add_assoc_stringl_ex(&unsetData, SL("key_b"), SL("paula")); + zephir_array_append(&ret, &unsetData, PH_SEPARATE, "stub/arrayaccesstest.zep", 130); + zephir_array_unset_string(&unsetData, SL("key_a"), PH_SEPARATE); + zephir_array_append(&ret, &unsetData, PH_SEPARATE, "stub/arrayaccesstest.zep", 132); + RETURN_CTOR(&ret); +} + +/** + * @issue https://github.com/zephir-lang/zephir/issues/1259 + */ +PHP_METHOD(Stub_ArrayAccessTest, issue1259UnsetKeyFromArrayProperty) +{ + zval _0, _1, _2; + zval ret; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&ret); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + + + ZEPHIR_MM_GROW(); + + ZEPHIR_INIT_VAR(&ret); + array_init(&ret); + zephir_read_property(&_0, this_ptr, ZEND_STRL("unsetData"), PH_NOISY_CC | PH_READONLY); + zephir_array_append(&ret, &_0, PH_SEPARATE, "stub/arrayaccesstest.zep", 144); + zephir_read_property(&_1, this_ptr, ZEND_STRL("unsetData"), PH_NOISY_CC | PH_READONLY); + zephir_array_unset_string(&_1, SL("key_a"), PH_SEPARATE); + zephir_read_property(&_2, this_ptr, ZEND_STRL("unsetData"), PH_NOISY_CC | PH_READONLY); + zephir_array_append(&ret, &_2, PH_SEPARATE, "stub/arrayaccesstest.zep", 146); + RETURN_CTOR(&ret); +} + +zend_object *zephir_init_properties_Stub_ArrayAccessTest(zend_class_entry *class_type) +{ + zval _1$$3; + zval _0; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1$$3); + + + ZEPHIR_MM_GROW(); + + { + zval local_this_ptr, *this_ptr = &local_this_ptr; + ZEPHIR_CREATE_OBJECT(this_ptr, class_type); + zephir_read_property_ex(&_0, this_ptr, ZEND_STRL("unsetData"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_0) == IS_NULL) { + ZEPHIR_INIT_VAR(&_1$$3); + zephir_create_array(&_1$$3, 2, 0); + add_assoc_stringl_ex(&_1$$3, SL("key_a"), SL("marcin")); + add_assoc_stringl_ex(&_1$$3, SL("key_b"), SL("paula")); + zephir_update_property_zval_ex(this_ptr, ZEND_STRL("unsetData"), &_1$$3); + } + ZEPHIR_MM_RESTORE(); + return Z_OBJ_P(this_ptr); + } +} + diff --git a/ext/stub/arrayaccesstest.zep.h b/ext/stub/arrayaccesstest.zep.h index c1576e5ddd..653472e86a 100644 --- a/ext/stub/arrayaccesstest.zep.h +++ b/ext/stub/arrayaccesstest.zep.h @@ -14,6 +14,9 @@ PHP_METHOD(Stub_ArrayAccessTest, issue1086Strict); PHP_METHOD(Stub_ArrayAccessTest, issue1086WontNullArrayAfterPassViaStaticWithStrictParams); PHP_METHOD(Stub_ArrayAccessTest, issue1086NotStrictParams); PHP_METHOD(Stub_ArrayAccessTest, issue1086WontNullArrayAfterPassViaStaticWithoutStrictParams); +PHP_METHOD(Stub_ArrayAccessTest, issue1259UnsetKeyFromArrayInternalVariable); +PHP_METHOD(Stub_ArrayAccessTest, issue1259UnsetKeyFromArrayProperty); +zend_object *zephir_init_properties_Stub_ArrayAccessTest(zend_class_entry *class_type); ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayaccesstest_exits, 0, 0, 0) ZEND_END_ARG_INFO() @@ -53,6 +56,15 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccesstest_issue1086wontnullarrayafterpassviastaticwithoutstrictparams, 0, 0, IS_ARRAY, 0) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccesstest_issue1259unsetkeyfromarrayinternalvariable, 0, 0, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccesstest_issue1259unsetkeyfromarrayproperty, 0, 0, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayaccesstest_zephir_init_properties_stub_arrayaccesstest, 0, 0, 0) +ZEND_END_ARG_INFO() + ZEPHIR_INIT_FUNCS(stub_arrayaccesstest_method_entry) { #if PHP_VERSION_ID >= 80000 PHP_ME(Stub_ArrayAccessTest, exits, arginfo_stub_arrayaccesstest_exits, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) @@ -73,5 +85,7 @@ ZEPHIR_INIT_FUNCS(stub_arrayaccesstest_method_entry) { PHP_ME(Stub_ArrayAccessTest, issue1086WontNullArrayAfterPassViaStaticWithStrictParams, arginfo_stub_arrayaccesstest_issue1086wontnullarrayafterpassviastaticwithstrictparams, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_ME(Stub_ArrayAccessTest, issue1086NotStrictParams, arginfo_stub_arrayaccesstest_issue1086notstrictparams, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_ME(Stub_ArrayAccessTest, issue1086WontNullArrayAfterPassViaStaticWithoutStrictParams, arginfo_stub_arrayaccesstest_issue1086wontnullarrayafterpassviastaticwithoutstrictparams, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + PHP_ME(Stub_ArrayAccessTest, issue1259UnsetKeyFromArrayInternalVariable, arginfo_stub_arrayaccesstest_issue1259unsetkeyfromarrayinternalvariable, ZEND_ACC_PUBLIC) + PHP_ME(Stub_ArrayAccessTest, issue1259UnsetKeyFromArrayProperty, arginfo_stub_arrayaccesstest_issue1259unsetkeyfromarrayproperty, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/properties/staticprotectedproperties.zep.c b/ext/stub/properties/staticprotectedproperties.zep.c index f943280cae..0b3a75a4be 100644 --- a/ext/stub/properties/staticprotectedproperties.zep.c +++ b/ext/stub/properties/staticprotectedproperties.zep.c @@ -194,6 +194,9 @@ PHP_METHOD(Stub_Properties_StaticProtectedProperties, getSomeString) RETURN_CTORW(&_0); } +/** + * @issue https://github.com/zephir-lang/zephir/issues/1536 + */ PHP_METHOD(Stub_Properties_StaticProtectedProperties, compareStaticNull) { zval someNull, _0; diff --git a/stub/arrayaccesstest.zep b/stub/arrayaccesstest.zep index 1623871c6b..64513d9582 100644 --- a/stub/arrayaccesstest.zep +++ b/stub/arrayaccesstest.zep @@ -3,6 +3,7 @@ namespace Stub; class ArrayAccessTest { protected data; + protected unsetData = ["key_a": "marcin", "key_b": "paula"]; public static function exits() { @@ -117,4 +118,33 @@ class ArrayAccessTest return params; } + + /** + * @issue https://github.com/zephir-lang/zephir/issues/1259 + */ + public function issue1259UnsetKeyFromArrayInternalVariable() -> array + { + array ret = []; + array unsetData = ["key_a": "marcin", "key_b": "paula"]; + + let ret[] = unsetData; + unset(unsetData["key_a"]); + let ret[] = unsetData; + + return ret; + } + + /** + * @issue https://github.com/zephir-lang/zephir/issues/1259 + */ + public function issue1259UnsetKeyFromArrayProperty() -> array + { + array ret = []; + + let ret[] = this->unsetData; + unset(this->unsetData["key_a"]); + let ret[] = this->unsetData; + + return ret; + } } diff --git a/tests/Extension/ArrayAccessTest.php b/tests/Extension/ArrayAccessTest.php index 5544aca45b..a5e46f983a 100644 --- a/tests/Extension/ArrayAccessTest.php +++ b/tests/Extension/ArrayAccessTest.php @@ -75,4 +75,20 @@ public function testIssue1086StaticallyCalledFunctionWithArrayAsArgMustReturnArr $actual = $class->issue1086WontNullArrayAfterPassViaStaticWithoutStrictParams(); $this->assertSame(['test' => 123], $actual); } + + /** + * @issue https://github.com/zephir-lang/zephir/issues/1259 + */ + public function testIssue1259CheckUnsetKeyFromArray(): void + { + $class = new \Stub\ArrayAccessTest(); + + $expected = [ + ['key_a' => 'marcin', 'key_b' => 'paula'], + ['key_b' => 'paula'], + ]; + + $this->assertSame($expected, $class->issue1259UnsetKeyFromArrayInternalVariable()); + $this->assertSame($expected, $class->issue1259UnsetKeyFromArrayProperty()); + } } From 1449610f13d72ca6a3206b34d8ed0aefc73fdcc3 Mon Sep 17 00:00:00 2001 From: Stanislav Kiryukhin Date: Tue, 29 Sep 2015 20:55:30 +0300 Subject: [PATCH 31/63] Added tests --- stub/assign.zep | 50 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/stub/assign.zep b/stub/assign.zep index fe5057124f..bae8d7ff0f 100644 --- a/stub/assign.zep +++ b/stub/assign.zep @@ -956,4 +956,54 @@ class Assign return s; } } + + public function testAssignBitwiseX(string! op, int a, int b) + { + var i, j; + int r; + array result = []; + + switch op { + case "or": + let a |= b; + break; + case "and": + let a &= b; + break; + case "xor": + let a ^= b; + break; + case "shiftleft": + let a <<= b; + break; + case "shiftright": + let a >>= b; + break; + + default: + throw new \InvalidArgumentException("First argument must have: or, and, xor, shiftleft, shiftright"); + } + + for i in [0, 1] { + for j in [0, 1] { + let r = i; + switch op { + case "or": + let r |= j; + break; + case "and": + let r &= j; + break; + case "xor": + let r ^= j; + break; + } + + let result[] = r; + } + } + + let a += array_sum(result); + return a; + } } From 481a61992d9d3017fd2056e4bffb06bde18a7a90 Mon Sep 17 00:00:00 2001 From: Stanislav Kiryukhin Date: Fri, 2 Oct 2015 20:46:01 +0300 Subject: [PATCH 32/63] Added compiling for operator assign-bitwise only "assign-type: variable" --- .../Operators/AssignVariableOperator.php | 17 ++++++ Library/Statements/LetStatement.php | 57 +++++++++++++++++++ 2 files changed, 74 insertions(+) diff --git a/Library/Expression/Builder/Operators/AssignVariableOperator.php b/Library/Expression/Builder/Operators/AssignVariableOperator.php index c3b205b041..c60386a10d 100644 --- a/Library/Expression/Builder/Operators/AssignVariableOperator.php +++ b/Library/Expression/Builder/Operators/AssignVariableOperator.php @@ -39,6 +39,23 @@ class AssignVariableOperator extends AbstractOperator // %= const OPERATOR_MOD = 'mod-assign'; + // &= + const OPERATOR_BITWISE_AND = 'bitwise-and-assign'; + + // |= + const OPERATOR_BITWISE_OR = 'bitwise-or-assign'; + + // ^= + const OPERATOR_BITWISE_XOR = 'bitwise-xor-assign'; + + // <<= + const OPERATOR_BITWISE_SHIFTLEFT = 'bitwise-shiftleft-assign'; + + // >>= + const OPERATOR_BITWISE_SHIFTRIGHT = 'bitwise-shiftright-assign'; + + + private $variable; private $operator = self::OPERATOR_ASSIGN; private $expression; diff --git a/Library/Statements/LetStatement.php b/Library/Statements/LetStatement.php index 79bccd7f70..50baa21b82 100644 --- a/Library/Statements/LetStatement.php +++ b/Library/Statements/LetStatement.php @@ -37,6 +37,9 @@ use Zephir\Statements\Let\StaticPropertySub as LetStaticPropertySub; use Zephir\Statements\Let\Variable as LetVariable; use Zephir\Statements\Let\VariableAppend as LetVariableAppend; +use Zephir\Expression\Builder\BuilderFactory; +use Zephir\Expression\Builder\Operators\AssignVariableOperator; +use Zephir\Expression\Builder\Operators\BinaryOperator; /** * LetStatement. @@ -88,6 +91,12 @@ public function compile(CompilationContext $compilationContext) * Incr/Decr assignments don't require an expression */ if (isset($assignment['expr'])) { + /** + * Replace on direct-assignment if this bitwise-assignment + * @Todo: Replace on supported native bitwise-assignment + */ + $assignment = $this->replaceAssignBitwiseOnDirect($assignment); + $expr = new Expression($assignment['expr']); switch ($assignment['assign-type']) { @@ -256,4 +265,52 @@ public function compile(CompilationContext $compilationContext) } } } + + /** + * @param $assignment + * @return mixed + * @throws CompilerException + */ + protected function replaceAssignBitwiseOnDirect($assignment) + { + switch ($assignment['operator']) { + case AssignVariableOperator::OPERATOR_BITWISE_AND: + $operator = BinaryOperator::OPERATOR_BITWISE_AND; + break; + + case AssignVariableOperator::OPERATOR_BITWISE_OR: + $operator = BinaryOperator::OPERATOR_BITWISE_OR; + break; + + case AssignVariableOperator::OPERATOR_BITWISE_XOR: + $operator = BinaryOperator::OPERATOR_BITWISE_XOR; + break; + + case AssignVariableOperator::OPERATOR_BITWISE_SHIFTLEFT: + $operator = BinaryOperator::OPERATOR_BITWISE_SHIFT_LEFT; + break; + + case AssignVariableOperator::OPERATOR_BITWISE_SHIFTRIGHT: + $operator = BinaryOperator::OPERATOR_BITWISE_SHIFT_RIGHT; + break; + + default: + return $assignment; + } + + if ($assignment['assign-type'] != 'variable') { + throw new CompilerException("Operator '" . $assignment['operator'] . "' is not supported assign-type: " . $assignment['assign-type']); + } + + $builderExpr = BuilderFactory::getInstance(); + + $leftExpression = $builderExpr->variable($assignment['variable']); + + $assignment['expr'] = $builderExpr->operators() + ->binary($operator, $leftExpression, $builderExpr->raw($assignment['expr'])) + ->build(); + + $assignment['operator'] = AssignVariableOperator::OPERATOR_ASSIGN; + return $assignment; + } } From 61d39a342dc9dc594bf3baf217eb58ed6eb8e5a6 Mon Sep 17 00:00:00 2001 From: JellyBrick Date: Mon, 19 Apr 2021 21:58:20 +0900 Subject: [PATCH 33/63] Add: assign test --- CHANGELOG.md | 3 + stub/assign.zep | 100 +++++++++++++-------------------- tests/Extension/AssignTest.php | 1 + 3 files changed, 44 insertions(+), 60 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d6cabf174d..e6359704f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](http://semver.org). ### Fixed - Fixed nullable array [#1094](https://github.com/zephir-lang/zephir/issues/1094) +### Added +- Added support syntax assign-bitwise operators [#1103](https://github.com/zephir-lang/zephir/issues/1103) + ## [0.13.2] - 2021-04-10 ### Fixed - Fixed default value of nullable string parameter [#2180](https://github.com/zephir-lang/zephir/issues/2180) diff --git a/stub/assign.zep b/stub/assign.zep index bae8d7ff0f..4a26650399 100644 --- a/stub/assign.zep +++ b/stub/assign.zep @@ -911,6 +911,36 @@ class Assign return this->myArray; } + public function testAssignBitwiseX(int a, int b) + { + var op, i; + var result = []; + + for op in ["or", "and", "xor", "shiftleft", "shiftright"] { + let i = a; + switch op { + case "or": + let i |= b; + break; + case "and": + let i &= b; + break; + case "xor": + let i ^= b; + break; + case "shiftleft": + let i <<= b; + break; + case "shiftright": + let i >>= b; + break; + } + let result[op] = i; + } + + return result; + } + /** * @link https://github.com/zephir-lang/zephir/issues/725 */ @@ -942,68 +972,18 @@ class Assign public function issue597() { - if isset _POST["a"] { - if isset _GET["r"] { - // Nothing here - } - } - - if isset _GET["s"] { - var s; - let s = _GET["s"] * 5; - let _GET["s"] = s; - - return s; - } - } - - public function testAssignBitwiseX(string! op, int a, int b) - { - var i, j; - int r; - array result = []; - - switch op { - case "or": - let a |= b; - break; - case "and": - let a &= b; - break; - case "xor": - let a ^= b; - break; - case "shiftleft": - let a <<= b; - break; - case "shiftright": - let a >>= b; - break; - - default: - throw new \InvalidArgumentException("First argument must have: or, and, xor, shiftleft, shiftright"); - } - - for i in [0, 1] { - for j in [0, 1] { - let r = i; - switch op { - case "or": - let r |= j; - break; - case "and": - let r &= j; - break; - case "xor": - let r ^= j; - break; - } - - let result[] = r; + if isset _POST["a"] { + if isset _GET["r"] { + // Nothing here } } - let a += array_sum(result); - return a; + if isset _GET["s"] { + var s; + let s = _GET["s"] * 5; + let _GET["s"] = s; + + return s; + } } } diff --git a/tests/Extension/AssignTest.php b/tests/Extension/AssignTest.php index c23b804ef4..de5a00ee89 100644 --- a/tests/Extension/AssignTest.php +++ b/tests/Extension/AssignTest.php @@ -140,6 +140,7 @@ public function propertyAssignProvider(): array [$arry, 'testStaticPropertyArrayMulti4'], [['test', 1, 1.5, false, []], 'testStaticPropertyArrayAppend'], [['a' => true, 'b' => false], 'testArrayBoolExpressionAssign'], + [['or' => 901, 'and' => 4, 'xor' => 897, 'shiftleft' => 28800, 'shiftright' => 28], 'testAssignBitwiseX', [900, 5]], ]; } From c38d4b38f075a40c51a0031a890af580b63c1cff Mon Sep 17 00:00:00 2001 From: JellyBrick Date: Mon, 19 Apr 2021 22:23:23 +0900 Subject: [PATCH 34/63] Apply suggestion --- Library/Statements/LetStatement.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Library/Statements/LetStatement.php b/Library/Statements/LetStatement.php index 50baa21b82..ddfefd9a30 100644 --- a/Library/Statements/LetStatement.php +++ b/Library/Statements/LetStatement.php @@ -93,7 +93,7 @@ public function compile(CompilationContext $compilationContext) if (isset($assignment['expr'])) { /** * Replace on direct-assignment if this bitwise-assignment - * @Todo: Replace on supported native bitwise-assignment + * TODO: Replace on supported native bitwise-assignment */ $assignment = $this->replaceAssignBitwiseOnDirect($assignment); @@ -267,11 +267,11 @@ public function compile(CompilationContext $compilationContext) } /** - * @param $assignment - * @return mixed + * @param array $assignment + * @return array * @throws CompilerException */ - protected function replaceAssignBitwiseOnDirect($assignment) + protected function replaceAssignBitwiseOnDirect(array $assignment): array { switch ($assignment['operator']) { case AssignVariableOperator::OPERATOR_BITWISE_AND: @@ -298,7 +298,7 @@ protected function replaceAssignBitwiseOnDirect($assignment) return $assignment; } - if ($assignment['assign-type'] != 'variable') { + if ($assignment['assign-type'] !== 'variable') { throw new CompilerException("Operator '" . $assignment['operator'] . "' is not supported assign-type: " . $assignment['assign-type']); } From 0ca773732565c68025c9e8750d699802f0547b68 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Mon, 19 Apr 2021 21:47:49 +0100 Subject: [PATCH 35/63] #1259 - Change macro SEPARATE_ZVAL_IF_NOT_REF() to SEPARATE_ZVAL_NOREF() and SEPARATE_ARRAY() In PHP8.1 this macro will be removed - https://github.com/php/php-src/commit/ec58a6f1b062a0c09cd1ef4097f257d5c1bb5e4e --- Library/Backends/ZendEngine3/StringsManager.php | 2 +- Library/Statements/Let/StaticProperty.php | 6 +----- ext/kernel/array.c | 17 ++++++++--------- ext/kernel/concat.c | 2 +- ext/kernel/object.c | 2 +- ext/kernel/operators.c | 6 +++--- ext/stub/concat.zep.c | 2 +- kernels/ZendEngine3/array.c | 17 ++++++++--------- kernels/ZendEngine3/object.c | 2 +- kernels/ZendEngine3/operators.c | 6 +++--- 10 files changed, 28 insertions(+), 34 deletions(-) diff --git a/Library/Backends/ZendEngine3/StringsManager.php b/Library/Backends/ZendEngine3/StringsManager.php index 9f322037ad..ee396da7ef 100644 --- a/Library/Backends/ZendEngine3/StringsManager.php +++ b/Library/Backends/ZendEngine3/StringsManager.php @@ -179,7 +179,7 @@ public function genConcatCode() void zephir_concat_function(zval *result, zval *op1, zval *op2) { zval tmp; - SEPARATE_ZVAL_IF_NOT_REF(result); + SEPARATE_ZVAL_NOREF(result); /* res == op1 == op2: won't leak diff --git a/Library/Statements/Let/StaticProperty.php b/Library/Statements/Let/StaticProperty.php index 0f9f4880d9..0e0dc83bbe 100644 --- a/Library/Statements/Let/StaticProperty.php +++ b/Library/Statements/Let/StaticProperty.php @@ -281,11 +281,7 @@ public function assignStatic( $variableVariableCode = $compilationContext->backend->getVariableCode($variableVariable); $tempVariableCode = $compilationContext->backend->getVariableCode($tempVariable); - if ('&' === substr($variableVariableCode, 0, 1)) { - $compilationContext->codePrinter->output('SEPARATE_ZVAL_IF_NOT_REF('.$variableVariableCode.');'); - } else { - $compilationContext->codePrinter->output('SEPARATE_ZVAL_IF_NOT_REF(&'.$variableVariableCode.');'); - } + $compilationContext->codePrinter->output('SEPARATE_ZVAL('.$variableVariableCode.');'); $compilationContext->codePrinter->output('zephir_concat_function('.$variableVariableCode.', '.$tempVariableCode.', '.$variableVariableCode.');'); // no break case 'assign': diff --git a/ext/kernel/array.c b/ext/kernel/array.c index 0f64755a20..91ac475d2b 100644 --- a/ext/kernel/array.c +++ b/ext/kernel/array.c @@ -338,7 +338,7 @@ int ZEPHIR_FASTCALL zephir_array_unset(zval *arr, zval *index, int flags) } if ((flags & PH_SEPARATE) == PH_SEPARATE) { - SEPARATE_ZVAL_IF_NOT_REF(arr); + SEPARATE_ARRAY(arr); } ht = Z_ARRVAL_P(arr); @@ -387,7 +387,7 @@ int ZEPHIR_FASTCALL zephir_array_unset_string(zval *arr, const char *index, uint } if ((flags & PH_SEPARATE) == PH_SEPARATE) { - SEPARATE_ZVAL_IF_NOT_REF(arr); + SEPARATE_ARRAY(arr); } return zend_hash_str_del(Z_ARRVAL_P(arr), index, index_length); @@ -411,7 +411,7 @@ int ZEPHIR_FASTCALL zephir_array_unset_long(zval *arr, unsigned long index, int } if ((flags & PH_SEPARATE) == PH_SEPARATE) { - SEPARATE_ZVAL_IF_NOT_REF(arr); + SEPARATE_ARRAY(arr); } return zend_hash_index_del(Z_ARRVAL_P(arr), index); @@ -425,7 +425,7 @@ int zephir_array_append(zval *arr, zval *value, int flags ZEPHIR_DEBUG_PARAMS) } if ((flags & PH_SEPARATE) == PH_SEPARATE) { - SEPARATE_ZVAL_IF_NOT_REF(arr); + SEPARATE_ARRAY(arr); } Z_TRY_ADDREF_P(value); @@ -658,7 +658,7 @@ int zephir_array_update_zval(zval *arr, zval *index, zval *value, int flags) } if ((flags & PH_SEPARATE) == PH_SEPARATE) { - SEPARATE_ZVAL_IF_NOT_REF(arr); + SEPARATE_ARRAY(arr); } if ((flags & PH_COPY) == PH_COPY) { @@ -700,7 +700,6 @@ int zephir_array_update_zval(zval *arr, zval *index, zval *value, int flags) int zephir_array_update_string(zval *arr, const char *index, uint32_t index_length, zval *value, int flags) { - if (UNEXPECTED(Z_TYPE_P(arr) == IS_OBJECT && zephir_instance_of_ev(arr, (const zend_class_entry *)zend_ce_arrayaccess))) { zend_long ZEPHIR_LAST_CALL_STATUS; zval offset; @@ -727,7 +726,7 @@ int zephir_array_update_string(zval *arr, const char *index, uint32_t index_leng } if ((flags & PH_SEPARATE) == PH_SEPARATE) { - SEPARATE_ZVAL_IF_NOT_REF(arr); + SEPARATE_ARRAY(arr); } return zend_hash_str_update(Z_ARRVAL_P(arr), index, index_length, value) ? SUCCESS : FAILURE; @@ -760,7 +759,7 @@ int zephir_array_update_long(zval *arr, unsigned long index, zval *value, int fl } if ((flags & PH_SEPARATE) == PH_SEPARATE) { - SEPARATE_ZVAL_IF_NOT_REF(arr); + SEPARATE_ARRAY(arr); } return zend_hash_index_update(Z_ARRVAL_P(arr), index, value) ? SUCCESS : FAILURE; @@ -990,7 +989,7 @@ int zephir_array_update_multi(zval *arr, zval *value, const char *types, int typ { va_list ap; va_start(ap, types_count); - SEPARATE_ZVAL_IF_NOT_REF(arr); + SEPARATE_ZVAL(arr); zephir_array_update_multi_ex(arr, value, types, types_length, types_count, ap); va_end(ap); diff --git a/ext/kernel/concat.c b/ext/kernel/concat.c index 03cbaa5862..e77a07b9c5 100644 --- a/ext/kernel/concat.c +++ b/ext/kernel/concat.c @@ -628,7 +628,7 @@ void zephir_concat_vvv(zval *result, zval *op1, zval *op2, zval *op3, int self_v void zephir_concat_function(zval *result, zval *op1, zval *op2) { zval tmp; - SEPARATE_ZVAL_IF_NOT_REF(result); + SEPARATE_ZVAL(result); /* res == op1 == op2: won't leak diff --git a/ext/kernel/object.c b/ext/kernel/object.c index 935435773e..bbe87a668f 100644 --- a/ext/kernel/object.c +++ b/ext/kernel/object.c @@ -1152,7 +1152,7 @@ int zephir_update_static_property_array_multi_ce( } va_start(ap, types_count); - SEPARATE_ZVAL_IF_NOT_REF(&tmp_arr); + SEPARATE_ZVAL_NOREF(&tmp_arr); zephir_array_update_multi_ex(&tmp_arr, value, types, types_length, types_count, ap); va_end(ap); diff --git a/ext/kernel/operators.c b/ext/kernel/operators.c index 7b7749e934..c7ceb083ca 100644 --- a/ext/kernel/operators.c +++ b/ext/kernel/operators.c @@ -59,7 +59,7 @@ void zephir_concat_self(zval *left, zval *right) } } - SEPARATE_ZVAL_IF_NOT_REF(left); + SEPARATE_ZVAL_NOREF(left); left_length = Z_STRLEN_P(left); right_length = Z_STRLEN_P(right); @@ -103,7 +103,7 @@ void zephir_concat_self_char(zval *left, unsigned char right) } } - SEPARATE_ZVAL_IF_NOT_REF(left); + SEPARATE_ZVAL_NOREF(left); length = Z_STRLEN_P(left) + 1; target = zend_string_extend(Z_STR_P(left), length, 0); @@ -138,7 +138,7 @@ void zephir_concat_self_str(zval *left, const char *right, int right_length) } } - SEPARATE_ZVAL_IF_NOT_REF(left); + SEPARATE_ZVAL_NOREF(left); left_length = Z_STRLEN_P(left); length = left_length + right_length; target = zend_string_extend(Z_STR_P(left), length, 0); diff --git a/ext/stub/concat.zep.c b/ext/stub/concat.zep.c index faeac602f3..24f1583fe5 100644 --- a/ext/stub/concat.zep.c +++ b/ext/stub/concat.zep.c @@ -63,7 +63,7 @@ PHP_METHOD(Stub_Concat, testConcatBySelfProperty) ZEPHIR_OBS_NVAR(&_0); zephir_read_static_property_ce(&_0, stub_concat_ce, SL("testProperty"), PH_NOISY_CC); - SEPARATE_ZVAL_IF_NOT_REF(&title); + SEPARATE_ZVAL(&title); zephir_concat_function(&title, &_0, &title); zephir_update_static_property_ce(stub_concat_ce, ZEND_STRL("testProperty"), &title); ZEPHIR_MM_RESTORE(); diff --git a/kernels/ZendEngine3/array.c b/kernels/ZendEngine3/array.c index 0f64755a20..91ac475d2b 100755 --- a/kernels/ZendEngine3/array.c +++ b/kernels/ZendEngine3/array.c @@ -338,7 +338,7 @@ int ZEPHIR_FASTCALL zephir_array_unset(zval *arr, zval *index, int flags) } if ((flags & PH_SEPARATE) == PH_SEPARATE) { - SEPARATE_ZVAL_IF_NOT_REF(arr); + SEPARATE_ARRAY(arr); } ht = Z_ARRVAL_P(arr); @@ -387,7 +387,7 @@ int ZEPHIR_FASTCALL zephir_array_unset_string(zval *arr, const char *index, uint } if ((flags & PH_SEPARATE) == PH_SEPARATE) { - SEPARATE_ZVAL_IF_NOT_REF(arr); + SEPARATE_ARRAY(arr); } return zend_hash_str_del(Z_ARRVAL_P(arr), index, index_length); @@ -411,7 +411,7 @@ int ZEPHIR_FASTCALL zephir_array_unset_long(zval *arr, unsigned long index, int } if ((flags & PH_SEPARATE) == PH_SEPARATE) { - SEPARATE_ZVAL_IF_NOT_REF(arr); + SEPARATE_ARRAY(arr); } return zend_hash_index_del(Z_ARRVAL_P(arr), index); @@ -425,7 +425,7 @@ int zephir_array_append(zval *arr, zval *value, int flags ZEPHIR_DEBUG_PARAMS) } if ((flags & PH_SEPARATE) == PH_SEPARATE) { - SEPARATE_ZVAL_IF_NOT_REF(arr); + SEPARATE_ARRAY(arr); } Z_TRY_ADDREF_P(value); @@ -658,7 +658,7 @@ int zephir_array_update_zval(zval *arr, zval *index, zval *value, int flags) } if ((flags & PH_SEPARATE) == PH_SEPARATE) { - SEPARATE_ZVAL_IF_NOT_REF(arr); + SEPARATE_ARRAY(arr); } if ((flags & PH_COPY) == PH_COPY) { @@ -700,7 +700,6 @@ int zephir_array_update_zval(zval *arr, zval *index, zval *value, int flags) int zephir_array_update_string(zval *arr, const char *index, uint32_t index_length, zval *value, int flags) { - if (UNEXPECTED(Z_TYPE_P(arr) == IS_OBJECT && zephir_instance_of_ev(arr, (const zend_class_entry *)zend_ce_arrayaccess))) { zend_long ZEPHIR_LAST_CALL_STATUS; zval offset; @@ -727,7 +726,7 @@ int zephir_array_update_string(zval *arr, const char *index, uint32_t index_leng } if ((flags & PH_SEPARATE) == PH_SEPARATE) { - SEPARATE_ZVAL_IF_NOT_REF(arr); + SEPARATE_ARRAY(arr); } return zend_hash_str_update(Z_ARRVAL_P(arr), index, index_length, value) ? SUCCESS : FAILURE; @@ -760,7 +759,7 @@ int zephir_array_update_long(zval *arr, unsigned long index, zval *value, int fl } if ((flags & PH_SEPARATE) == PH_SEPARATE) { - SEPARATE_ZVAL_IF_NOT_REF(arr); + SEPARATE_ARRAY(arr); } return zend_hash_index_update(Z_ARRVAL_P(arr), index, value) ? SUCCESS : FAILURE; @@ -990,7 +989,7 @@ int zephir_array_update_multi(zval *arr, zval *value, const char *types, int typ { va_list ap; va_start(ap, types_count); - SEPARATE_ZVAL_IF_NOT_REF(arr); + SEPARATE_ZVAL(arr); zephir_array_update_multi_ex(arr, value, types, types_length, types_count, ap); va_end(ap); diff --git a/kernels/ZendEngine3/object.c b/kernels/ZendEngine3/object.c index 935435773e..bbe87a668f 100755 --- a/kernels/ZendEngine3/object.c +++ b/kernels/ZendEngine3/object.c @@ -1152,7 +1152,7 @@ int zephir_update_static_property_array_multi_ce( } va_start(ap, types_count); - SEPARATE_ZVAL_IF_NOT_REF(&tmp_arr); + SEPARATE_ZVAL_NOREF(&tmp_arr); zephir_array_update_multi_ex(&tmp_arr, value, types, types_length, types_count, ap); va_end(ap); diff --git a/kernels/ZendEngine3/operators.c b/kernels/ZendEngine3/operators.c index 7b7749e934..c7ceb083ca 100755 --- a/kernels/ZendEngine3/operators.c +++ b/kernels/ZendEngine3/operators.c @@ -59,7 +59,7 @@ void zephir_concat_self(zval *left, zval *right) } } - SEPARATE_ZVAL_IF_NOT_REF(left); + SEPARATE_ZVAL_NOREF(left); left_length = Z_STRLEN_P(left); right_length = Z_STRLEN_P(right); @@ -103,7 +103,7 @@ void zephir_concat_self_char(zval *left, unsigned char right) } } - SEPARATE_ZVAL_IF_NOT_REF(left); + SEPARATE_ZVAL_NOREF(left); length = Z_STRLEN_P(left) + 1; target = zend_string_extend(Z_STR_P(left), length, 0); @@ -138,7 +138,7 @@ void zephir_concat_self_str(zval *left, const char *right, int right_length) } } - SEPARATE_ZVAL_IF_NOT_REF(left); + SEPARATE_ZVAL_NOREF(left); left_length = Z_STRLEN_P(left); length = left_length + right_length; target = zend_string_extend(Z_STR_P(left), length, 0); From 7cd41f6d10697e29e417ec5cfccb9a4698ad7a0f Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Tue, 20 Apr 2021 19:18:09 +0100 Subject: [PATCH 36/63] #1259 - Change `SEPARATE_ARRAY` to `SEPARATE_ZVAL` --- kernels/ZendEngine3/array.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernels/ZendEngine3/array.c b/kernels/ZendEngine3/array.c index 91ac475d2b..2cd2cb1cad 100755 --- a/kernels/ZendEngine3/array.c +++ b/kernels/ZendEngine3/array.c @@ -387,7 +387,7 @@ int ZEPHIR_FASTCALL zephir_array_unset_string(zval *arr, const char *index, uint } if ((flags & PH_SEPARATE) == PH_SEPARATE) { - SEPARATE_ARRAY(arr); + SEPARATE_ZVAL(arr); } return zend_hash_str_del(Z_ARRVAL_P(arr), index, index_length); From 06b5b8021f4d9afaaf0bfe890264c55d9fad6b86 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Tue, 20 Apr 2021 19:18:35 +0100 Subject: [PATCH 37/63] #1259 - Update error message of `zend_error()` call --- kernels/ZendEngine3/array.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernels/ZendEngine3/array.c b/kernels/ZendEngine3/array.c index 2cd2cb1cad..e1dfbdc700 100755 --- a/kernels/ZendEngine3/array.c +++ b/kernels/ZendEngine3/array.c @@ -364,7 +364,7 @@ int ZEPHIR_FASTCALL zephir_array_unset(zval *arr, zval *index, int flags) return (zend_symtable_del(ht, Z_STR_P(index)) == SUCCESS); default: - zend_error(E_WARNING, "Illegal offset type"); + zend_error(E_WARNING, "Passed index has illegal offset type (check zephir_array_unset())"); return 0; } } From af0fc614d5e897eb0d775ad8c7a0bc2f93feedba Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Tue, 20 Apr 2021 19:29:28 +0100 Subject: [PATCH 38/63] #1245 - Add test case for `get_object_vars()` --- ext/config.m4 | 1 + ext/config.w32 | 2 +- ext/stub.c | 2 + ext/stub.h | 1 + ext/stub/properties/getobjectvars.zep.c | 47 +++++++++++++++++++ ext/stub/properties/getobjectvars.zep.h | 14 ++++++ .../staticprotectedproperties.zep.c | 3 ++ stub/properties/getobjectvars.zep | 17 +++++++ .../Properties/GetObjectVarsTest.php | 30 ++++++++++++ 9 files changed, 116 insertions(+), 1 deletion(-) create mode 100644 ext/stub/properties/getobjectvars.zep.c create mode 100644 ext/stub/properties/getobjectvars.zep.h create mode 100644 stub/properties/getobjectvars.zep create mode 100644 tests/Extension/Properties/GetObjectVarsTest.php diff --git a/ext/config.m4 b/ext/config.m4 index 5f807aafcc..b8c7612f46 100644 --- a/ext/config.m4 +++ b/ext/config.m4 @@ -171,6 +171,7 @@ if test "$PHP_STUB" = "yes"; then stub/pregmatch.zep.c stub/properties/app.zep.c stub/properties/extendspublicproperties.zep.c + stub/properties/getobjectvars.zep.c stub/properties/privateproperties.zep.c stub/properties/propertyarray.zep.c stub/properties/propertyupdate.zep.c diff --git a/ext/config.w32 b/ext/config.w32 index f76a0fb614..c4d27f4d34 100644 --- a/ext/config.w32 +++ b/ext/config.w32 @@ -21,7 +21,7 @@ if (PHP_STUB != "no") { ADD_SOURCES(configure_module_dirname + "/stub/oo/extend/db/query", "exception.zep.c", "stub"); ADD_SOURCES(configure_module_dirname + "/stub/oo/scopes", "hasprivatemethod.zep.c scopetesterinterface.zep.c abstractclass.zep.c abstractclassmagic.zep.c privatescopetester.zep.c", "stub"); ADD_SOURCES(configure_module_dirname + "/stub/ooimpl", "zbeginning.zep.c abeginning.zep.c", "stub"); - ADD_SOURCES(configure_module_dirname + "/stub/properties", "publicproperties.zep.c app.zep.c extendspublicproperties.zep.c privateproperties.zep.c propertyarray.zep.c propertyupdate.zep.c protectedproperties.zep.c staticprivateproperties.zep.c staticpropertyarray.zep.c staticprotectedproperties.zep.c staticpublicproperties.zep.c", "stub"); + ADD_SOURCES(configure_module_dirname + "/stub/properties", "publicproperties.zep.c app.zep.c extendspublicproperties.zep.c getobjectvars.zep.c privateproperties.zep.c propertyarray.zep.c propertyupdate.zep.c protectedproperties.zep.c staticprivateproperties.zep.c staticpropertyarray.zep.c staticprotectedproperties.zep.c staticpublicproperties.zep.c", "stub"); ADD_SOURCES(configure_module_dirname + "/stub/bench", "foo.zep.c", "stub"); ADD_SOURCES(configure_module_dirname + "/stub/builtin", "arraymethods.zep.c charmethods.zep.c intmethods.zep.c stringmethods.zep.c", "stub"); ADD_SOURCES(configure_module_dirname + "/stub/constructors", "issue1803.zep.c", "stub"); diff --git a/ext/stub.c b/ext/stub.c index 77c2e1378a..2e2efc2070 100644 --- a/ext/stub.c +++ b/ext/stub.c @@ -199,6 +199,7 @@ zend_class_entry *stub_pdostatement_ce; zend_class_entry *stub_pregmatch_ce; zend_class_entry *stub_properties_app_ce; zend_class_entry *stub_properties_extendspublicproperties_ce; +zend_class_entry *stub_properties_getobjectvars_ce; zend_class_entry *stub_properties_privateproperties_ce; zend_class_entry *stub_properties_propertyarray_ce; zend_class_entry *stub_properties_propertyupdate_ce; @@ -420,6 +421,7 @@ static PHP_MINIT_FUNCTION(stub) ZEPHIR_INIT(Stub_Pregmatch); ZEPHIR_INIT(Stub_Properties_App); ZEPHIR_INIT(Stub_Properties_ExtendsPublicProperties); + ZEPHIR_INIT(Stub_Properties_GetObjectVars); ZEPHIR_INIT(Stub_Properties_PrivateProperties); ZEPHIR_INIT(Stub_Properties_PropertyArray); ZEPHIR_INIT(Stub_Properties_PropertyUpdate); diff --git a/ext/stub.h b/ext/stub.h index ca4fe312d6..15cdb8ae03 100644 --- a/ext/stub.h +++ b/ext/stub.h @@ -166,6 +166,7 @@ #include "stub/pregmatch.zep.h" #include "stub/properties/app.zep.h" #include "stub/properties/extendspublicproperties.zep.h" +#include "stub/properties/getobjectvars.zep.h" #include "stub/properties/privateproperties.zep.h" #include "stub/properties/propertyarray.zep.h" #include "stub/properties/propertyupdate.zep.h" diff --git a/ext/stub/properties/getobjectvars.zep.c b/ext/stub/properties/getobjectvars.zep.c new file mode 100644 index 0000000000..13921dda95 --- /dev/null +++ b/ext/stub/properties/getobjectvars.zep.c @@ -0,0 +1,47 @@ + +#ifdef HAVE_CONFIG_H +#include "../../ext_config.h" +#endif + +#include +#include "../../php_ext.h" +#include "../../ext.h" + +#include +#include +#include + +#include "kernel/main.h" +#include "kernel/fcall.h" +#include "kernel/object.h" +#include "kernel/memory.h" + + +ZEPHIR_INIT_CLASS(Stub_Properties_GetObjectVars) +{ + ZEPHIR_REGISTER_CLASS(Stub\\Properties, GetObjectVars, stub, properties_getobjectvars, stub_properties_getobjectvars_method_entry, 0); + + zend_declare_property_long(stub_properties_getobjectvars_ce, SL("a"), 1, ZEND_ACC_PUBLIC); + zend_declare_property_long(stub_properties_getobjectvars_ce, SL("b"), 2, ZEND_ACC_PROTECTED); + zend_declare_property_long(stub_properties_getobjectvars_ce, SL("c"), 3, ZEND_ACC_PRIVATE); + return SUCCESS; +} + +/** + * @issue https://github.com/zephir-lang/zephir/issues/1245 + */ +PHP_METHOD(Stub_Properties_GetObjectVars, issue1245) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *this_ptr = getThis(); + + + + ZEPHIR_MM_GROW(); + + ZEPHIR_RETURN_CALL_FUNCTION("get_object_vars", NULL, 73, this_ptr); + zephir_check_call_status(); + RETURN_MM(); +} + diff --git a/ext/stub/properties/getobjectvars.zep.h b/ext/stub/properties/getobjectvars.zep.h new file mode 100644 index 0000000000..ee7ad309d7 --- /dev/null +++ b/ext/stub/properties/getobjectvars.zep.h @@ -0,0 +1,14 @@ + +extern zend_class_entry *stub_properties_getobjectvars_ce; + +ZEPHIR_INIT_CLASS(Stub_Properties_GetObjectVars); + +PHP_METHOD(Stub_Properties_GetObjectVars, issue1245); + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_properties_getobjectvars_issue1245, 0, 0, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +ZEPHIR_INIT_FUNCS(stub_properties_getobjectvars_method_entry) { + PHP_ME(Stub_Properties_GetObjectVars, issue1245, arginfo_stub_properties_getobjectvars_issue1245, ZEND_ACC_PUBLIC) + PHP_FE_END +}; diff --git a/ext/stub/properties/staticprotectedproperties.zep.c b/ext/stub/properties/staticprotectedproperties.zep.c index f943280cae..0b3a75a4be 100644 --- a/ext/stub/properties/staticprotectedproperties.zep.c +++ b/ext/stub/properties/staticprotectedproperties.zep.c @@ -194,6 +194,9 @@ PHP_METHOD(Stub_Properties_StaticProtectedProperties, getSomeString) RETURN_CTORW(&_0); } +/** + * @issue https://github.com/zephir-lang/zephir/issues/1536 + */ PHP_METHOD(Stub_Properties_StaticProtectedProperties, compareStaticNull) { zval someNull, _0; diff --git a/stub/properties/getobjectvars.zep b/stub/properties/getobjectvars.zep new file mode 100644 index 0000000000..b1666700a7 --- /dev/null +++ b/stub/properties/getobjectvars.zep @@ -0,0 +1,17 @@ + +namespace Stub\Properties; + +class GetObjectVars +{ + public a = 1; + protected b = 2; + private c = 3; + + /** + * @issue https://github.com/zephir-lang/zephir/issues/1245 + */ + public function issue1245() -> array + { + return get_object_vars(this); + } +} diff --git a/tests/Extension/Properties/GetObjectVarsTest.php b/tests/Extension/Properties/GetObjectVarsTest.php new file mode 100644 index 0000000000..aae03c5dc4 --- /dev/null +++ b/tests/Extension/Properties/GetObjectVarsTest.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Extension\Properties; + +use PHPUnit\Framework\TestCase; +use Stub\Properties\GetObjectVars; + +final class GetObjectVarsTest extends TestCase +{ + /** + * @issue https://github.com/zephir-lang/zephir/issues/1245 + */ + public function testIssue1245ShouldReturnAllVisibilityProperties(): void + { + $test = new GetObjectVars(); + + $this->assertSame(['a' => 1, 'b' => 2, 'c' => 3], $test->issue1245()); + } +} From 01ed29dfc786b8581c08c148744216046620c3f3 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Tue, 20 Apr 2021 19:47:23 +0100 Subject: [PATCH 39/63] #893 - Add test case --- ext/config.m4 | 1 + ext/config.w32 | 2 +- ext/stub.c | 2 ++ ext/stub.h | 1 + ext/stub/issue893.zep.c | 26 ++++++++++++++++ ext/stub/issue893.zep.h | 5 ++++ .../staticprotectedproperties.zep.c | 3 ++ stub/issue893.zep | 9 ++++++ tests/Extension/Issue893Test.php | 30 +++++++++++++++++++ 9 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 ext/stub/issue893.zep.c create mode 100644 ext/stub/issue893.zep.h create mode 100644 stub/issue893.zep create mode 100644 tests/Extension/Issue893Test.php diff --git a/ext/config.m4 b/ext/config.m4 index 5f807aafcc..e7440a91b0 100644 --- a/ext/config.m4 +++ b/ext/config.m4 @@ -103,6 +103,7 @@ if test "$PHP_STUB" = "yes"; then stub/issue2165/issue.zep.c stub/issue663.zep.c stub/issue887.zep.c + stub/issue893.zep.c stub/issue914.zep.c stub/issues.zep.c stub/json.zep.c diff --git a/ext/config.w32 b/ext/config.w32 index f76a0fb614..b7da3c6d1d 100644 --- a/ext/config.w32 +++ b/ext/config.w32 @@ -11,7 +11,7 @@ if (PHP_STUB != "no") { } ADD_SOURCES(configure_module_dirname + "/stub/invokes", "abstractprotected.zep.c abstractinvoker.zep.c abstractinvokercomplex.zep.c invokeprotected.zep.c invokeprotectedcomplex.zep.c", "stub"); - ADD_SOURCES(configure_module_dirname + "/stub", "testinterface.zep.c scallparent.zep.c constantsparent.zep.c methodinterface.zep.c arithmetic.zep.c arrayaccessobj.zep.c arrayaccesstest.zep.c arrayiterator.zep.c arrayiteratortest.zep.c arraymanipulation.zep.c arrayobject.zep.c arraysearch.zep.c assign.zep.c bitwise.zep.c branchprediction.zep.c cast.zep.c cblock.zep.c chars.zep.c closures.zep.c compare.zep.c concat.zep.c constants.zep.c constantsinterface.zep.c constantsinterfacea.zep.c constantsinterfaceb.zep.c declaretest.zep.c diinterface.zep.c echoes.zep.c emptytest.zep.c evaltest.zep.c exception.zep.c exceptions.zep.c exists.zep.c exitdie.zep.c extendedinterface.zep.c factorial.zep.c fannkuch.zep.c fasta.zep.c fcall.zep.c fetchtest.zep.c fibonnaci.zep.c flow.zep.c fortytwo.zep.c functional.zep.c functionexists.zep.c functions.zep.c geometry.zep.c globals.zep.c instance.zep.c instanceoff.zep.c internalclasses.zep.c internalinterfaces.zep.c invoke.zep.c issettest.zep.c issue1404.zep.c issue1521.zep.c issue663.zep.c issue887.zep.c issue914.zep.c issues.zep.c json.zep.c logical.zep.c mcall.zep.c mcallchained.zep.c mcalldynamic.zep.c mcallinternal.zep.c methodabstract.zep.c methodargs.zep.c nativearray.zep.c oo.zep.c operator.zep.c pdostatement.zep.c pregmatch.zep.c quantum.zep.c range.zep.c references.zep.c reflection.zep.c regexdna.zep.c requires.zep.c resourcetest.zep.c returns.zep.c router.zep.c scall.zep.c scalldynamic.zep.c scallexternal.zep.c scalllateconstruct.zep.c scope.zep.c sort.zep.c spectralnorm.zep.c spl.zep.c spropertyaccess.zep.c statements.zep.c strings.zep.c stubs.zep.c ternary.zep.c trytest.zep.c typeinstances.zep.c typeoff.zep.c unknownclass.zep.c unsettest.zep.c usetest.zep.c vars.zep.c 0__closure.zep.c 1__closure.zep.c 2__closure.zep.c 3__closure.zep.c 4__closure.zep.c 5__closure.zep.c 6__closure.zep.c 7__closure.zep.c 8__closure.zep.c 9__closure.zep.c 10__closure.zep.c 11__closure.zep.c 12__closure.zep.c 13__closure.zep.c", "stub"); + ADD_SOURCES(configure_module_dirname + "/stub", "testinterface.zep.c scallparent.zep.c constantsparent.zep.c methodinterface.zep.c arithmetic.zep.c arrayaccessobj.zep.c arrayaccesstest.zep.c arrayiterator.zep.c arrayiteratortest.zep.c arraymanipulation.zep.c arrayobject.zep.c arraysearch.zep.c assign.zep.c bitwise.zep.c branchprediction.zep.c cast.zep.c cblock.zep.c chars.zep.c closures.zep.c compare.zep.c concat.zep.c constants.zep.c constantsinterface.zep.c constantsinterfacea.zep.c constantsinterfaceb.zep.c declaretest.zep.c diinterface.zep.c echoes.zep.c emptytest.zep.c evaltest.zep.c exception.zep.c exceptions.zep.c exists.zep.c exitdie.zep.c extendedinterface.zep.c factorial.zep.c fannkuch.zep.c fasta.zep.c fcall.zep.c fetchtest.zep.c fibonnaci.zep.c flow.zep.c fortytwo.zep.c functional.zep.c functionexists.zep.c functions.zep.c geometry.zep.c globals.zep.c instance.zep.c instanceoff.zep.c internalclasses.zep.c internalinterfaces.zep.c invoke.zep.c issettest.zep.c issue1404.zep.c issue1521.zep.c issue663.zep.c issue887.zep.c issue893.zep.c issue914.zep.c issues.zep.c json.zep.c logical.zep.c mcall.zep.c mcallchained.zep.c mcalldynamic.zep.c mcallinternal.zep.c methodabstract.zep.c methodargs.zep.c nativearray.zep.c oo.zep.c operator.zep.c pdostatement.zep.c pregmatch.zep.c quantum.zep.c range.zep.c references.zep.c reflection.zep.c regexdna.zep.c requires.zep.c resourcetest.zep.c returns.zep.c router.zep.c scall.zep.c scalldynamic.zep.c scallexternal.zep.c scalllateconstruct.zep.c scope.zep.c sort.zep.c spectralnorm.zep.c spl.zep.c spropertyaccess.zep.c statements.zep.c strings.zep.c stubs.zep.c ternary.zep.c trytest.zep.c typeinstances.zep.c typeoff.zep.c unknownclass.zep.c unsettest.zep.c usetest.zep.c vars.zep.c 0__closure.zep.c 1__closure.zep.c 2__closure.zep.c 3__closure.zep.c 4__closure.zep.c 5__closure.zep.c 6__closure.zep.c 7__closure.zep.c 8__closure.zep.c 9__closure.zep.c 10__closure.zep.c 11__closure.zep.c 12__closure.zep.c 13__closure.zep.c", "stub"); ADD_SOURCES(configure_module_dirname + "/stub/oo/extend", "exception.zep.c", "stub"); ADD_SOURCES(configure_module_dirname + "/stub/issue2165", "issueextendinterface.zep.c issueinterface.zep.c issue.zep.c", "stub"); ADD_SOURCES(configure_module_dirname + "/stub/oo/extend/db", "exception.zep.c", "stub"); diff --git a/ext/stub.c b/ext/stub.c index 77c2e1378a..2017c80415 100644 --- a/ext/stub.c +++ b/ext/stub.c @@ -132,6 +132,7 @@ zend_class_entry *stub_issue1521_ce; zend_class_entry *stub_issue2165_issue_ce; zend_class_entry *stub_issue663_ce; zend_class_entry *stub_issue887_ce; +zend_class_entry *stub_issue893_ce; zend_class_entry *stub_issue914_ce; zend_class_entry *stub_issues_ce; zend_class_entry *stub_json_ce; @@ -353,6 +354,7 @@ static PHP_MINIT_FUNCTION(stub) ZEPHIR_INIT(Stub_Issue2165_Issue); ZEPHIR_INIT(Stub_Issue663); ZEPHIR_INIT(Stub_Issue887); + ZEPHIR_INIT(Stub_Issue893); ZEPHIR_INIT(Stub_Issue914); ZEPHIR_INIT(Stub_Issues); ZEPHIR_INIT(Stub_Json); diff --git a/ext/stub.h b/ext/stub.h index ca4fe312d6..675de167cf 100644 --- a/ext/stub.h +++ b/ext/stub.h @@ -98,6 +98,7 @@ #include "stub/issue2165/issue.zep.h" #include "stub/issue663.zep.h" #include "stub/issue887.zep.h" +#include "stub/issue893.zep.h" #include "stub/issue914.zep.h" #include "stub/issues.zep.h" #include "stub/json.zep.h" diff --git a/ext/stub/issue893.zep.c b/ext/stub/issue893.zep.c new file mode 100644 index 0000000000..09a600a342 --- /dev/null +++ b/ext/stub/issue893.zep.c @@ -0,0 +1,26 @@ + +#ifdef HAVE_CONFIG_H +#include "../ext_config.h" +#endif + +#include +#include "../php_ext.h" +#include "../ext.h" + +#include +#include +#include + +#include "kernel/main.h" + + +/** + * @issue https://github.com/zephir-lang/zephir/issues/893 + */ +ZEPHIR_INIT_CLASS(Stub_Issue893) +{ + ZEPHIR_REGISTER_CLASS_EX(Stub, Issue893, stub, issue893, zephir_get_internal_ce(SL("domdocument")), NULL, 0); + + return SUCCESS; +} + diff --git a/ext/stub/issue893.zep.h b/ext/stub/issue893.zep.h new file mode 100644 index 0000000000..dfeb48bf05 --- /dev/null +++ b/ext/stub/issue893.zep.h @@ -0,0 +1,5 @@ + +extern zend_class_entry *stub_issue893_ce; + +ZEPHIR_INIT_CLASS(Stub_Issue893); + diff --git a/ext/stub/properties/staticprotectedproperties.zep.c b/ext/stub/properties/staticprotectedproperties.zep.c index f943280cae..0b3a75a4be 100644 --- a/ext/stub/properties/staticprotectedproperties.zep.c +++ b/ext/stub/properties/staticprotectedproperties.zep.c @@ -194,6 +194,9 @@ PHP_METHOD(Stub_Properties_StaticProtectedProperties, getSomeString) RETURN_CTORW(&_0); } +/** + * @issue https://github.com/zephir-lang/zephir/issues/1536 + */ PHP_METHOD(Stub_Properties_StaticProtectedProperties, compareStaticNull) { zval someNull, _0; diff --git a/stub/issue893.zep b/stub/issue893.zep new file mode 100644 index 0000000000..4d1ef69ef1 --- /dev/null +++ b/stub/issue893.zep @@ -0,0 +1,9 @@ + +namespace Stub; + +/** + * @issue https://github.com/zephir-lang/zephir/issues/893 + */ +class Issue893 extends \DOMDocument +{ +} diff --git a/tests/Extension/Issue893Test.php b/tests/Extension/Issue893Test.php new file mode 100644 index 0000000000..fa4dc8919e --- /dev/null +++ b/tests/Extension/Issue893Test.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Extension; + +use PHPUnit\Framework\TestCase; +use Stub\Issue893; + +/** + * @issue https://github.com/zephir-lang/zephir/issues/893 + */ +final class Issue893Test extends TestCase +{ + public function testExtendsDOMClassShouldBeInstanceOfDOMNodeList(): void + { + $DOM = new Issue893(); + + $this->assertInstanceOf(\DOMNodeList::class, $DOM->childNodes); + } +} From 038cf26b4ed33523a150a9c6ad87247a0ab9a83b Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Tue, 20 Apr 2021 22:16:36 +0100 Subject: [PATCH 40/63] #1134 - Change `ZEND_ARG_ARRAY_INFO` to `ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE` When there is default value --- Library/ArgInfoDefinition.php | 47 +++++++++++++++++++++++++++++------ 1 file changed, 39 insertions(+), 8 deletions(-) diff --git a/Library/ArgInfoDefinition.php b/Library/ArgInfoDefinition.php index 81796cc5ff..c7a8fa828b 100644 --- a/Library/ArgInfoDefinition.php +++ b/Library/ArgInfoDefinition.php @@ -228,14 +228,26 @@ private function renderEnd(): void switch ("{$flag}:".$parameter['data-type']) { case '0:array': case '1:array': - $this->codePrinter->output( - sprintf( - "\tZEND_ARG_ARRAY_INFO(%d, %s, %d)", - $this->passByReference($parameter), - $parameter['name'], - (int) $this->allowNull($parameter) - ) - ); + if (!isset($parameter['default'])) { + $this->codePrinter->output( + sprintf( + "\tZEND_ARG_ARRAY_INFO(%d, %s, %d)", + $this->passByReference($parameter), + $parameter['name'], + (int) $this->allowNull($parameter) + ) + ); + } else { + $this->codePrinter->output( + sprintf( + "\tZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(%d, %s, IS_ARRAY, %d, %s)", + $this->passByReference($parameter), + $parameter['name'], + (int) $this->allowNull($parameter), + $this->defaultArrayValue($parameter), + ) + ); + } break; case '0:variable': case '1:variable': @@ -333,6 +345,25 @@ private function hasParameters(): bool return null !== $this->parameters && \count($this->parameters->getParameters()) > 0; } + private function defaultArrayValue(array $parameter): string + { + if ($parameter['default']['type'] === 'empty-array') { + return '"[]"'; + } + + // TODO: Come back later + /** + * It seems that it is impossible to pass default array with some data inside. + * Only empty array, even if manually specify not empty array - it will be ignored, + * for example: + * + * `ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, someDefaultData, IS_ARRAY, 0, "[\"key\" => \"value\"]")` + * + * Output of default value will be `[]` during method call. + */ + return '"[]"'; + } + private function allowNull(array $parameter): bool { if (!isset($parameter['default']) || !\is_array($parameter['default'])) { From 9a5469fdd2350cde6e44cec327965a4952356710 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Tue, 20 Apr 2021 22:17:04 +0100 Subject: [PATCH 41/63] #1134 - Simplify condition --- Library/ArgInfoDefinition.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/ArgInfoDefinition.php b/Library/ArgInfoDefinition.php index c7a8fa828b..8aea3d694e 100644 --- a/Library/ArgInfoDefinition.php +++ b/Library/ArgInfoDefinition.php @@ -379,7 +379,7 @@ private function allowNull(array $parameter): bool private function passByReference(array $parameter) { - return isset($parameter['reference']) ? $parameter['reference'] : 0; + return $parameter['reference'] ?? 0; } private function getReturnType(): string From c6f532f6ebf188ee4737c884d036dfd94248b735 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Tue, 20 Apr 2021 22:18:12 +0100 Subject: [PATCH 42/63] #1134 - Update arg info headers --- ext/stub/arrayaccesstest.zep.h | 6 +++--- ext/stub/globals/serverrequestfactory.zep.h | 10 +++++----- ext/stub/issue2165/issue.zep.h | 4 ++-- ext/stub/mcall.zep.h | 4 ++-- ext/stub/oo/ooparams.zep.h | 2 +- ext/stub/properties/staticprotectedproperties.zep.c | 3 +++ ext/stub/typehinting/testabstract.zep.h | 2 +- ext/stub/vars.zep.h | 2 +- 8 files changed, 18 insertions(+), 15 deletions(-) diff --git a/ext/stub/arrayaccesstest.zep.h b/ext/stub/arrayaccesstest.zep.h index c1576e5ddd..6b404f5bc9 100644 --- a/ext/stub/arrayaccesstest.zep.h +++ b/ext/stub/arrayaccesstest.zep.h @@ -28,15 +28,15 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccesstest_issue1155, ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccesstest_issue1094test1, 0, 0, _IS_BOOL, 0) - ZEND_ARG_ARRAY_INFO(0, items, 1) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, items, IS_ARRAY, 1, "[]") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccesstest_issue1094test2, 0, 0, _IS_BOOL, 0) - ZEND_ARG_ARRAY_INFO(0, items, 1) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, items, IS_ARRAY, 1, "[]") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccesstest_issue1094test3, 0, 0, _IS_BOOL, 0) - ZEND_ARG_ARRAY_INFO(0, items, 1) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, items, IS_ARRAY, 1, "[]") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayaccesstest_issue1086strict, 0, 0, 1) diff --git a/ext/stub/globals/serverrequestfactory.zep.h b/ext/stub/globals/serverrequestfactory.zep.h index 7f2ea8985d..bea7792778 100644 --- a/ext/stub/globals/serverrequestfactory.zep.h +++ b/ext/stub/globals/serverrequestfactory.zep.h @@ -7,11 +7,11 @@ PHP_METHOD(Stub_Globals_ServerRequestFactory, load); PHP_METHOD(Stub_Globals_ServerRequestFactory, checkNullArray); ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_globals_serverrequestfactory_load, 0, 0, IS_ARRAY, 0) - ZEND_ARG_ARRAY_INFO(0, server, 1) - ZEND_ARG_ARRAY_INFO(0, get, 1) - ZEND_ARG_ARRAY_INFO(0, post, 1) - ZEND_ARG_ARRAY_INFO(0, cookies, 1) - ZEND_ARG_ARRAY_INFO(0, files, 1) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, server, IS_ARRAY, 1, "[]") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, get, IS_ARRAY, 1, "[]") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, post, IS_ARRAY, 1, "[]") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, cookies, IS_ARRAY, 1, "[]") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, files, IS_ARRAY, 1, "[]") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_globals_serverrequestfactory_checknullarray, 0, 2, IS_ARRAY, 0) diff --git a/ext/stub/issue2165/issue.zep.h b/ext/stub/issue2165/issue.zep.h index fda5752362..e29de724a5 100644 --- a/ext/stub/issue2165/issue.zep.h +++ b/ext/stub/issue2165/issue.zep.h @@ -12,7 +12,7 @@ PHP_METHOD(Stub_Issue2165_Issue, reciprocal); PHP_METHOD(Stub_Issue2165_Issue, divideMatrix); ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_stub_issue2165_issue_build, 0, 0, Stub\\Issue2165\\Issue, 0) - ZEND_ARG_ARRAY_INFO(0, a, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, a, IS_ARRAY, 0, "[]") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_issue2165_issue___construct, 0, 0, 1) @@ -21,7 +21,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_issue2165_issue___construct, 0, 0, 1) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_stub_issue2165_issue_quick, 0, 0, Stub\\Issue2165\\Issue, 0) - ZEND_ARG_ARRAY_INFO(0, a, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, a, IS_ARRAY, 0, "[]") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_stub_issue2165_issue_ones, 0, 2, Stub\\Issue2165\\Issue, 0) diff --git a/ext/stub/mcall.zep.h b/ext/stub/mcall.zep.h index fb89796b0a..c73a73a36e 100644 --- a/ext/stub/mcall.zep.h +++ b/ext/stub/mcall.zep.h @@ -212,11 +212,11 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_mcall_optionalparameterbooleannull, 0, 0, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_mcall_testarrayparamwithdefaultemptyarray, 0, 0, 0) - ZEND_ARG_ARRAY_INFO(0, driverOptions, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, driverOptions, IS_ARRAY, 0, "[]") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_mcall_testarrayparamwithdefaultnullvalue, 0, 0, 0) - ZEND_ARG_ARRAY_INFO(0, driverOptions, 1) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, driverOptions, IS_ARRAY, 1, "[]") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_mcall_testarrayparam, 0, 0, 1) diff --git a/ext/stub/oo/ooparams.zep.h b/ext/stub/oo/ooparams.zep.h index 42b764a2c7..cc002c4925 100644 --- a/ext/stub/oo/ooparams.zep.h +++ b/ext/stub/oo/ooparams.zep.h @@ -94,7 +94,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_oo_ooparams_setenableddefault, 0, 0, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_oo_ooparams_setlistdefault, 0, 0, 0) - ZEND_ARG_ARRAY_INFO(0, someList, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, someList, IS_ARRAY, 0, "[]") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_oo_ooparams_setconstage, 0, 0, 1) diff --git a/ext/stub/properties/staticprotectedproperties.zep.c b/ext/stub/properties/staticprotectedproperties.zep.c index f943280cae..0b3a75a4be 100644 --- a/ext/stub/properties/staticprotectedproperties.zep.c +++ b/ext/stub/properties/staticprotectedproperties.zep.c @@ -194,6 +194,9 @@ PHP_METHOD(Stub_Properties_StaticProtectedProperties, getSomeString) RETURN_CTORW(&_0); } +/** + * @issue https://github.com/zephir-lang/zephir/issues/1536 + */ PHP_METHOD(Stub_Properties_StaticProtectedProperties, compareStaticNull) { zval someNull, _0; diff --git a/ext/stub/typehinting/testabstract.zep.h b/ext/stub/typehinting/testabstract.zep.h index 5814bdac46..7c45f3a9ab 100644 --- a/ext/stub/typehinting/testabstract.zep.h +++ b/ext/stub/typehinting/testabstract.zep.h @@ -15,7 +15,7 @@ PHP_METHOD(Stub_TypeHinting_TestAbstract, returnBoolean); PHP_METHOD(Stub_TypeHinting_TestAbstract, returnChar); ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_typehinting_testabstract_testfunc, 0, 0, 0) - ZEND_ARG_ARRAY_INFO(0, text, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, text, IS_ARRAY, 0, "[]") ZEND_ARG_TYPE_INFO(0, text2, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, flag, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, optional, IS_LONG, 1) diff --git a/ext/stub/vars.zep.h b/ext/stub/vars.zep.h index eb1e2008ef..e6ee949907 100644 --- a/ext/stub/vars.zep.h +++ b/ext/stub/vars.zep.h @@ -58,7 +58,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_vars_testcountoptimizervardumpandexport, 0, ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_vars_testarraytypevardumpandexport, 0, 0, 0) - ZEND_ARG_ARRAY_INFO(0, testVar, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, testVar, IS_ARRAY, 0, "[]") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_vars_testintvardump, 0, 0, 0) From 2f7c8ad435a96e6786f3ca4e74bc79f052bd2db1 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Tue, 20 Apr 2021 22:19:02 +0100 Subject: [PATCH 43/63] #1134 - Add test case with Reflection `isDefaultValueAvailable()` check --- ext/config.m4 | 1 + ext/config.w32 | 2 +- ext/stub.c | 2 + ext/stub.h | 1 + ext/stub/issue1134.zep.c | 91 +++++++++++++++++++++++++++++++ ext/stub/issue1134.zep.h | 21 +++++++ stub/issue1134.zep | 20 +++++++ tests/Extension/Issue1134Test.php | 49 +++++++++++++++++ 8 files changed, 186 insertions(+), 1 deletion(-) create mode 100644 ext/stub/issue1134.zep.c create mode 100644 ext/stub/issue1134.zep.h create mode 100644 stub/issue1134.zep create mode 100644 tests/Extension/Issue1134Test.php diff --git a/ext/config.m4 b/ext/config.m4 index 5f807aafcc..0a273e78c8 100644 --- a/ext/config.m4 +++ b/ext/config.m4 @@ -98,6 +98,7 @@ if test "$PHP_STUB" = "yes"; then stub/invokes/invokeprotected.zep.c stub/invokes/invokeprotectedcomplex.zep.c stub/issettest.zep.c + stub/issue1134.zep.c stub/issue1404.zep.c stub/issue1521.zep.c stub/issue2165/issue.zep.c diff --git a/ext/config.w32 b/ext/config.w32 index f76a0fb614..b80eb32b9e 100644 --- a/ext/config.w32 +++ b/ext/config.w32 @@ -11,7 +11,7 @@ if (PHP_STUB != "no") { } ADD_SOURCES(configure_module_dirname + "/stub/invokes", "abstractprotected.zep.c abstractinvoker.zep.c abstractinvokercomplex.zep.c invokeprotected.zep.c invokeprotectedcomplex.zep.c", "stub"); - ADD_SOURCES(configure_module_dirname + "/stub", "testinterface.zep.c scallparent.zep.c constantsparent.zep.c methodinterface.zep.c arithmetic.zep.c arrayaccessobj.zep.c arrayaccesstest.zep.c arrayiterator.zep.c arrayiteratortest.zep.c arraymanipulation.zep.c arrayobject.zep.c arraysearch.zep.c assign.zep.c bitwise.zep.c branchprediction.zep.c cast.zep.c cblock.zep.c chars.zep.c closures.zep.c compare.zep.c concat.zep.c constants.zep.c constantsinterface.zep.c constantsinterfacea.zep.c constantsinterfaceb.zep.c declaretest.zep.c diinterface.zep.c echoes.zep.c emptytest.zep.c evaltest.zep.c exception.zep.c exceptions.zep.c exists.zep.c exitdie.zep.c extendedinterface.zep.c factorial.zep.c fannkuch.zep.c fasta.zep.c fcall.zep.c fetchtest.zep.c fibonnaci.zep.c flow.zep.c fortytwo.zep.c functional.zep.c functionexists.zep.c functions.zep.c geometry.zep.c globals.zep.c instance.zep.c instanceoff.zep.c internalclasses.zep.c internalinterfaces.zep.c invoke.zep.c issettest.zep.c issue1404.zep.c issue1521.zep.c issue663.zep.c issue887.zep.c issue914.zep.c issues.zep.c json.zep.c logical.zep.c mcall.zep.c mcallchained.zep.c mcalldynamic.zep.c mcallinternal.zep.c methodabstract.zep.c methodargs.zep.c nativearray.zep.c oo.zep.c operator.zep.c pdostatement.zep.c pregmatch.zep.c quantum.zep.c range.zep.c references.zep.c reflection.zep.c regexdna.zep.c requires.zep.c resourcetest.zep.c returns.zep.c router.zep.c scall.zep.c scalldynamic.zep.c scallexternal.zep.c scalllateconstruct.zep.c scope.zep.c sort.zep.c spectralnorm.zep.c spl.zep.c spropertyaccess.zep.c statements.zep.c strings.zep.c stubs.zep.c ternary.zep.c trytest.zep.c typeinstances.zep.c typeoff.zep.c unknownclass.zep.c unsettest.zep.c usetest.zep.c vars.zep.c 0__closure.zep.c 1__closure.zep.c 2__closure.zep.c 3__closure.zep.c 4__closure.zep.c 5__closure.zep.c 6__closure.zep.c 7__closure.zep.c 8__closure.zep.c 9__closure.zep.c 10__closure.zep.c 11__closure.zep.c 12__closure.zep.c 13__closure.zep.c", "stub"); + ADD_SOURCES(configure_module_dirname + "/stub", "testinterface.zep.c scallparent.zep.c constantsparent.zep.c methodinterface.zep.c arithmetic.zep.c arrayaccessobj.zep.c arrayaccesstest.zep.c arrayiterator.zep.c arrayiteratortest.zep.c arraymanipulation.zep.c arrayobject.zep.c arraysearch.zep.c assign.zep.c bitwise.zep.c branchprediction.zep.c cast.zep.c cblock.zep.c chars.zep.c closures.zep.c compare.zep.c concat.zep.c constants.zep.c constantsinterface.zep.c constantsinterfacea.zep.c constantsinterfaceb.zep.c declaretest.zep.c diinterface.zep.c echoes.zep.c emptytest.zep.c evaltest.zep.c exception.zep.c exceptions.zep.c exists.zep.c exitdie.zep.c extendedinterface.zep.c factorial.zep.c fannkuch.zep.c fasta.zep.c fcall.zep.c fetchtest.zep.c fibonnaci.zep.c flow.zep.c fortytwo.zep.c functional.zep.c functionexists.zep.c functions.zep.c geometry.zep.c globals.zep.c instance.zep.c instanceoff.zep.c internalclasses.zep.c internalinterfaces.zep.c invoke.zep.c issettest.zep.c issue1134.zep.c issue1404.zep.c issue1521.zep.c issue663.zep.c issue887.zep.c issue914.zep.c issues.zep.c json.zep.c logical.zep.c mcall.zep.c mcallchained.zep.c mcalldynamic.zep.c mcallinternal.zep.c methodabstract.zep.c methodargs.zep.c nativearray.zep.c oo.zep.c operator.zep.c pdostatement.zep.c pregmatch.zep.c quantum.zep.c range.zep.c references.zep.c reflection.zep.c regexdna.zep.c requires.zep.c resourcetest.zep.c returns.zep.c router.zep.c scall.zep.c scalldynamic.zep.c scallexternal.zep.c scalllateconstruct.zep.c scope.zep.c sort.zep.c spectralnorm.zep.c spl.zep.c spropertyaccess.zep.c statements.zep.c strings.zep.c stubs.zep.c ternary.zep.c trytest.zep.c typeinstances.zep.c typeoff.zep.c unknownclass.zep.c unsettest.zep.c usetest.zep.c vars.zep.c 0__closure.zep.c 1__closure.zep.c 2__closure.zep.c 3__closure.zep.c 4__closure.zep.c 5__closure.zep.c 6__closure.zep.c 7__closure.zep.c 8__closure.zep.c 9__closure.zep.c 10__closure.zep.c 11__closure.zep.c 12__closure.zep.c 13__closure.zep.c", "stub"); ADD_SOURCES(configure_module_dirname + "/stub/oo/extend", "exception.zep.c", "stub"); ADD_SOURCES(configure_module_dirname + "/stub/issue2165", "issueextendinterface.zep.c issueinterface.zep.c issue.zep.c", "stub"); ADD_SOURCES(configure_module_dirname + "/stub/oo/extend/db", "exception.zep.c", "stub"); diff --git a/ext/stub.c b/ext/stub.c index 77c2e1378a..e7d4acb06d 100644 --- a/ext/stub.c +++ b/ext/stub.c @@ -127,6 +127,7 @@ zend_class_entry *stub_invoke_ce; zend_class_entry *stub_invokes_invokeprotected_ce; zend_class_entry *stub_invokes_invokeprotectedcomplex_ce; zend_class_entry *stub_issettest_ce; +zend_class_entry *stub_issue1134_ce; zend_class_entry *stub_issue1404_ce; zend_class_entry *stub_issue1521_ce; zend_class_entry *stub_issue2165_issue_ce; @@ -348,6 +349,7 @@ static PHP_MINIT_FUNCTION(stub) ZEPHIR_INIT(Stub_Invokes_InvokeProtected); ZEPHIR_INIT(Stub_Invokes_InvokeProtectedComplex); ZEPHIR_INIT(Stub_IssetTest); + ZEPHIR_INIT(Stub_Issue1134); ZEPHIR_INIT(Stub_Issue1404); ZEPHIR_INIT(Stub_Issue1521); ZEPHIR_INIT(Stub_Issue2165_Issue); diff --git a/ext/stub.h b/ext/stub.h index ca4fe312d6..bbdf46b610 100644 --- a/ext/stub.h +++ b/ext/stub.h @@ -93,6 +93,7 @@ #include "stub/invokes/invokeprotected.zep.h" #include "stub/invokes/invokeprotectedcomplex.zep.h" #include "stub/issettest.zep.h" +#include "stub/issue1134.zep.h" #include "stub/issue1404.zep.h" #include "stub/issue1521.zep.h" #include "stub/issue2165/issue.zep.h" diff --git a/ext/stub/issue1134.zep.c b/ext/stub/issue1134.zep.c new file mode 100644 index 0000000000..829e666c58 --- /dev/null +++ b/ext/stub/issue1134.zep.c @@ -0,0 +1,91 @@ + +#ifdef HAVE_CONFIG_H +#include "../ext_config.h" +#endif + +#include +#include "../php_ext.h" +#include "../ext.h" + +#include +#include +#include + +#include "kernel/main.h" +#include "kernel/object.h" +#include "kernel/memory.h" +#include "kernel/operators.h" + + +/** + * @issue https://github.com/zephir-lang/zephir/issues/1134 + */ +ZEPHIR_INIT_CLASS(Stub_Issue1134) +{ + ZEPHIR_REGISTER_CLASS(Stub, Issue1134, stub, issue1134, stub_issue1134_method_entry, 0); + + zend_declare_property_null(stub_issue1134_ce, SL("data"), ZEND_ACC_PRIVATE); + return SUCCESS; +} + +PHP_METHOD(Stub_Issue1134, __construct) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *config_param = NULL; + zval config; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&config); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(0, 1) + Z_PARAM_OPTIONAL + Z_PARAM_ARRAY(config) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 0, 1, &config_param); + if (!config_param) { + ZEPHIR_INIT_VAR(&config); + array_init(&config); + } else { + zephir_get_arrval(&config, config_param); + } + + + zephir_update_property_zval(this_ptr, ZEND_STRL("data"), &config); + ZEPHIR_MM_RESTORE(); +} + +PHP_METHOD(Stub_Issue1134, arrayWithFilledDefaultValue) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *someDefaultData_param = NULL; + zval someDefaultData; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&someDefaultData); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(0, 1) + Z_PARAM_OPTIONAL + Z_PARAM_ARRAY(someDefaultData) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 0, 1, &someDefaultData_param); + if (!someDefaultData_param) { + ZEPHIR_INIT_VAR(&someDefaultData); + array_init(&someDefaultData); + } else { + zephir_get_arrval(&someDefaultData, someDefaultData_param); + } + + + RETURN_CTOR(&someDefaultData); +} + diff --git a/ext/stub/issue1134.zep.h b/ext/stub/issue1134.zep.h new file mode 100644 index 0000000000..f7d10428a1 --- /dev/null +++ b/ext/stub/issue1134.zep.h @@ -0,0 +1,21 @@ + +extern zend_class_entry *stub_issue1134_ce; + +ZEPHIR_INIT_CLASS(Stub_Issue1134); + +PHP_METHOD(Stub_Issue1134, __construct); +PHP_METHOD(Stub_Issue1134, arrayWithFilledDefaultValue); + +ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_issue1134___construct, 0, 0, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, config, IS_ARRAY, 0, "[]") +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_issue1134_arraywithfilleddefaultvalue, 0, 0, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, someDefaultData, IS_ARRAY, 0, "[]") +ZEND_END_ARG_INFO() + +ZEPHIR_INIT_FUNCS(stub_issue1134_method_entry) { + PHP_ME(Stub_Issue1134, __construct, arginfo_stub_issue1134___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) + PHP_ME(Stub_Issue1134, arrayWithFilledDefaultValue, arginfo_stub_issue1134_arraywithfilleddefaultvalue, ZEND_ACC_PUBLIC) + PHP_FE_END +}; diff --git a/stub/issue1134.zep b/stub/issue1134.zep new file mode 100644 index 0000000000..e695c5201a --- /dev/null +++ b/stub/issue1134.zep @@ -0,0 +1,20 @@ + +namespace Stub; + +/** + * @issue https://github.com/zephir-lang/zephir/issues/1134 + */ +class Issue1134 +{ + private data; + + public function __construct(array config = []) + { + let this->data = config; + } + + public function arrayWithFilledDefaultValue(array someDefaultData = ["key": "val"]) + { + return someDefaultData; + } +} diff --git a/tests/Extension/Issue1134Test.php b/tests/Extension/Issue1134Test.php new file mode 100644 index 0000000000..f482738d9d --- /dev/null +++ b/tests/Extension/Issue1134Test.php @@ -0,0 +1,49 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Extension; + +use PHPUnit\Framework\TestCase; +use ReflectionClass; +use ReflectionException; +use Stub\Issue1134; + +/** + * @issue https://github.com/zephir-lang/zephir/issues/1134 + */ +final class Issue1134Test extends TestCase +{ + /** + * @throws ReflectionException + */ + public function testIssue914(): void + { + $ref = new ReflectionClass(Issue1134::class); + $constructor = $ref->getConstructor(); + $params = $constructor->getParameters(); + + $this->assertSame('config', $params[0]->getName()); + $this->assertTrue($params[0]->isOptional()); + $this->assertTrue($params[0]->isDefaultValueAvailable()); + + $arrayWithFilledDefaultValueParam = $ref->getMethod('arrayWithFilledDefaultValue'); + $params2 = $arrayWithFilledDefaultValueParam->getParameters(); + + $this->assertSame('someDefaultData', $params2[0]->getName()); + $this->assertTrue($params2[0]->isOptional()); + $this->assertTrue($params2[0]->isDefaultValueAvailable()); + + $class = new Issue1134(); + $this->assertSame([], $class->arrayWithFilledDefaultValue()); + } +} From 1ad0ef3046748609682e438ad84513d95e2b583e Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Tue, 20 Apr 2021 22:29:46 +0100 Subject: [PATCH 44/63] #1134 - Add specific rule for PHP 7.4 --- Library/ArgInfoDefinition.php | 12 ++++++++++++ ext/stub/arrayaccesstest.zep.h | 12 ++++++++++++ ext/stub/globals/serverrequestfactory.zep.h | 20 ++++++++++++++++++++ ext/stub/issue1134.zep.h | 8 ++++++++ ext/stub/issue2165/issue.zep.h | 8 ++++++++ ext/stub/mcall.zep.h | 8 ++++++++ ext/stub/oo/ooparams.zep.h | 4 ++++ ext/stub/typehinting/testabstract.zep.h | 4 ++++ ext/stub/vars.zep.h | 4 ++++ tests/Extension/Issue1134Test.php | 8 ++++++-- 10 files changed, 86 insertions(+), 2 deletions(-) diff --git a/Library/ArgInfoDefinition.php b/Library/ArgInfoDefinition.php index 8aea3d694e..d5d1e63c44 100644 --- a/Library/ArgInfoDefinition.php +++ b/Library/ArgInfoDefinition.php @@ -238,6 +238,7 @@ private function renderEnd(): void ) ); } else { + $this->codePrinter->output('#if PHP_VERSION_ID >= 80000'); $this->codePrinter->output( sprintf( "\tZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(%d, %s, IS_ARRAY, %d, %s)", @@ -247,6 +248,17 @@ private function renderEnd(): void $this->defaultArrayValue($parameter), ) ); + $this->codePrinter->output('#else'); + // `ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE` does not exist in PHP 7.4 + $this->codePrinter->output( + sprintf( + "\tZEND_ARG_ARRAY_INFO(%d, %s, %d)", + $this->passByReference($parameter), + $parameter['name'], + (int) $this->allowNull($parameter) + ) + ); + $this->codePrinter->output('#endif'); } break; case '0:variable': diff --git a/ext/stub/arrayaccesstest.zep.h b/ext/stub/arrayaccesstest.zep.h index 6b404f5bc9..a0df52596b 100644 --- a/ext/stub/arrayaccesstest.zep.h +++ b/ext/stub/arrayaccesstest.zep.h @@ -28,15 +28,27 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccesstest_issue1155, ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccesstest_issue1094test1, 0, 0, _IS_BOOL, 0) +#if PHP_VERSION_ID >= 80000 ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, items, IS_ARRAY, 1, "[]") +#else + ZEND_ARG_ARRAY_INFO(0, items, 1) +#endif ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccesstest_issue1094test2, 0, 0, _IS_BOOL, 0) +#if PHP_VERSION_ID >= 80000 ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, items, IS_ARRAY, 1, "[]") +#else + ZEND_ARG_ARRAY_INFO(0, items, 1) +#endif ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccesstest_issue1094test3, 0, 0, _IS_BOOL, 0) +#if PHP_VERSION_ID >= 80000 ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, items, IS_ARRAY, 1, "[]") +#else + ZEND_ARG_ARRAY_INFO(0, items, 1) +#endif ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayaccesstest_issue1086strict, 0, 0, 1) diff --git a/ext/stub/globals/serverrequestfactory.zep.h b/ext/stub/globals/serverrequestfactory.zep.h index bea7792778..ad22f9b253 100644 --- a/ext/stub/globals/serverrequestfactory.zep.h +++ b/ext/stub/globals/serverrequestfactory.zep.h @@ -7,11 +7,31 @@ PHP_METHOD(Stub_Globals_ServerRequestFactory, load); PHP_METHOD(Stub_Globals_ServerRequestFactory, checkNullArray); ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_globals_serverrequestfactory_load, 0, 0, IS_ARRAY, 0) +#if PHP_VERSION_ID >= 80000 ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, server, IS_ARRAY, 1, "[]") +#else + ZEND_ARG_ARRAY_INFO(0, server, 1) +#endif +#if PHP_VERSION_ID >= 80000 ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, get, IS_ARRAY, 1, "[]") +#else + ZEND_ARG_ARRAY_INFO(0, get, 1) +#endif +#if PHP_VERSION_ID >= 80000 ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, post, IS_ARRAY, 1, "[]") +#else + ZEND_ARG_ARRAY_INFO(0, post, 1) +#endif +#if PHP_VERSION_ID >= 80000 ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, cookies, IS_ARRAY, 1, "[]") +#else + ZEND_ARG_ARRAY_INFO(0, cookies, 1) +#endif +#if PHP_VERSION_ID >= 80000 ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, files, IS_ARRAY, 1, "[]") +#else + ZEND_ARG_ARRAY_INFO(0, files, 1) +#endif ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_globals_serverrequestfactory_checknullarray, 0, 2, IS_ARRAY, 0) diff --git a/ext/stub/issue1134.zep.h b/ext/stub/issue1134.zep.h index f7d10428a1..6c44ebc836 100644 --- a/ext/stub/issue1134.zep.h +++ b/ext/stub/issue1134.zep.h @@ -7,11 +7,19 @@ PHP_METHOD(Stub_Issue1134, __construct); PHP_METHOD(Stub_Issue1134, arrayWithFilledDefaultValue); ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_issue1134___construct, 0, 0, 0) +#if PHP_VERSION_ID >= 80000 ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, config, IS_ARRAY, 0, "[]") +#else + ZEND_ARG_ARRAY_INFO(0, config, 0) +#endif ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_issue1134_arraywithfilleddefaultvalue, 0, 0, 0) +#if PHP_VERSION_ID >= 80000 ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, someDefaultData, IS_ARRAY, 0, "[]") +#else + ZEND_ARG_ARRAY_INFO(0, someDefaultData, 0) +#endif ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_issue1134_method_entry) { diff --git a/ext/stub/issue2165/issue.zep.h b/ext/stub/issue2165/issue.zep.h index e29de724a5..350ac1d298 100644 --- a/ext/stub/issue2165/issue.zep.h +++ b/ext/stub/issue2165/issue.zep.h @@ -12,7 +12,11 @@ PHP_METHOD(Stub_Issue2165_Issue, reciprocal); PHP_METHOD(Stub_Issue2165_Issue, divideMatrix); ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_stub_issue2165_issue_build, 0, 0, Stub\\Issue2165\\Issue, 0) +#if PHP_VERSION_ID >= 80000 ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, a, IS_ARRAY, 0, "[]") +#else + ZEND_ARG_ARRAY_INFO(0, a, 0) +#endif ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_issue2165_issue___construct, 0, 0, 1) @@ -21,7 +25,11 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_issue2165_issue___construct, 0, 0, 1) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_stub_issue2165_issue_quick, 0, 0, Stub\\Issue2165\\Issue, 0) +#if PHP_VERSION_ID >= 80000 ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, a, IS_ARRAY, 0, "[]") +#else + ZEND_ARG_ARRAY_INFO(0, a, 0) +#endif ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_stub_issue2165_issue_ones, 0, 2, Stub\\Issue2165\\Issue, 0) diff --git a/ext/stub/mcall.zep.h b/ext/stub/mcall.zep.h index c73a73a36e..7b2ab78dfb 100644 --- a/ext/stub/mcall.zep.h +++ b/ext/stub/mcall.zep.h @@ -212,11 +212,19 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_mcall_optionalparameterbooleannull, 0, 0, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_mcall_testarrayparamwithdefaultemptyarray, 0, 0, 0) +#if PHP_VERSION_ID >= 80000 ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, driverOptions, IS_ARRAY, 0, "[]") +#else + ZEND_ARG_ARRAY_INFO(0, driverOptions, 0) +#endif ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_mcall_testarrayparamwithdefaultnullvalue, 0, 0, 0) +#if PHP_VERSION_ID >= 80000 ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, driverOptions, IS_ARRAY, 1, "[]") +#else + ZEND_ARG_ARRAY_INFO(0, driverOptions, 1) +#endif ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_mcall_testarrayparam, 0, 0, 1) diff --git a/ext/stub/oo/ooparams.zep.h b/ext/stub/oo/ooparams.zep.h index cc002c4925..61d77c2103 100644 --- a/ext/stub/oo/ooparams.zep.h +++ b/ext/stub/oo/ooparams.zep.h @@ -94,7 +94,11 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_oo_ooparams_setenableddefault, 0, 0, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_oo_ooparams_setlistdefault, 0, 0, 0) +#if PHP_VERSION_ID >= 80000 ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, someList, IS_ARRAY, 0, "[]") +#else + ZEND_ARG_ARRAY_INFO(0, someList, 0) +#endif ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_oo_ooparams_setconstage, 0, 0, 1) diff --git a/ext/stub/typehinting/testabstract.zep.h b/ext/stub/typehinting/testabstract.zep.h index 7c45f3a9ab..8ce152d978 100644 --- a/ext/stub/typehinting/testabstract.zep.h +++ b/ext/stub/typehinting/testabstract.zep.h @@ -15,7 +15,11 @@ PHP_METHOD(Stub_TypeHinting_TestAbstract, returnBoolean); PHP_METHOD(Stub_TypeHinting_TestAbstract, returnChar); ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_typehinting_testabstract_testfunc, 0, 0, 0) +#if PHP_VERSION_ID >= 80000 ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, text, IS_ARRAY, 0, "[]") +#else + ZEND_ARG_ARRAY_INFO(0, text, 0) +#endif ZEND_ARG_TYPE_INFO(0, text2, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, flag, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, optional, IS_LONG, 1) diff --git a/ext/stub/vars.zep.h b/ext/stub/vars.zep.h index e6ee949907..f8473e514e 100644 --- a/ext/stub/vars.zep.h +++ b/ext/stub/vars.zep.h @@ -58,7 +58,11 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_vars_testcountoptimizervardumpandexport, 0, ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_vars_testarraytypevardumpandexport, 0, 0, 0) +#if PHP_VERSION_ID >= 80000 ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, testVar, IS_ARRAY, 0, "[]") +#else + ZEND_ARG_ARRAY_INFO(0, testVar, 0) +#endif ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_vars_testintvardump, 0, 0, 0) diff --git a/tests/Extension/Issue1134Test.php b/tests/Extension/Issue1134Test.php index f482738d9d..5835ebdf90 100644 --- a/tests/Extension/Issue1134Test.php +++ b/tests/Extension/Issue1134Test.php @@ -34,14 +34,18 @@ public function testIssue914(): void $this->assertSame('config', $params[0]->getName()); $this->assertTrue($params[0]->isOptional()); - $this->assertTrue($params[0]->isDefaultValueAvailable()); + if (version_compare(PHP_VERSION, '8.0.0', '>=')) { + $this->assertTrue($params[0]->isDefaultValueAvailable()); + } $arrayWithFilledDefaultValueParam = $ref->getMethod('arrayWithFilledDefaultValue'); $params2 = $arrayWithFilledDefaultValueParam->getParameters(); $this->assertSame('someDefaultData', $params2[0]->getName()); $this->assertTrue($params2[0]->isOptional()); - $this->assertTrue($params2[0]->isDefaultValueAvailable()); + if (version_compare(PHP_VERSION, '8.0.0', '>=')) { + $this->assertTrue($params2[0]->isDefaultValueAvailable()); + } $class = new Issue1134(); $this->assertSame([], $class->arrayWithFilledDefaultValue()); From 62634f5b5f9f417d4577d3a852dc8fb0d1591568 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Tue, 20 Apr 2021 22:32:51 +0100 Subject: [PATCH 45/63] #1134 - Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d6cabf174d..51adf2bad2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org). ## [Unreleased] ### Fixed - Fixed nullable array [#1094](https://github.com/zephir-lang/zephir/issues/1094) +- Fixed default value detection with Reflection (only PHP 8.0) [#1134](https://github.com/zephir-lang/zephir/issues/1134) ## [0.13.2] - 2021-04-10 ### Fixed From ac8409c077704a09cc279dbb8e92e3bab099aef0 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Tue, 20 Apr 2021 22:34:20 +0100 Subject: [PATCH 46/63] #1134 - Update ext/config.w32 --- ext/config.w32 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/config.w32 b/ext/config.w32 index 54a758d714..b99c96d649 100644 --- a/ext/config.w32 +++ b/ext/config.w32 @@ -11,7 +11,7 @@ if (PHP_STUB != "no") { } ADD_SOURCES(configure_module_dirname + "/stub/invokes", "abstractprotected.zep.c abstractinvoker.zep.c abstractinvokercomplex.zep.c invokeprotected.zep.c invokeprotectedcomplex.zep.c", "stub"); - ADD_SOURCES(configure_module_dirname + "/stub", "testinterface.zep.c scallparent.zep.c constantsparent.zep.c methodinterface.zep.c arithmetic.zep.c arrayaccessobj.zep.c arrayaccesstest.zep.c arrayiterator.zep.c arrayiteratortest.zep.c arraymanipulation.zep.c arrayobject.zep.c arraysearch.zep.c assign.zep.c bitwise.zep.c branchprediction.zep.c cast.zep.c cblock.zep.c chars.zep.c closures.zep.c compare.zep.c concat.zep.c constants.zep.c constantsinterface.zep.c constantsinterfacea.zep.c constantsinterfaceb.zep.c declaretest.zep.c diinterface.zep.c echoes.zep.c emptytest.zep.c evaltest.zep.c exception.zep.c exceptions.zep.c exists.zep.c exitdie.zep.c extendedinterface.zep.c factorial.zep.c fannkuch.zep.c fasta.zep.c fcall.zep.c fetchtest.zep.c fibonnaci.zep.c flow.zep.c fortytwo.zep.c functional.zep.c functionexists.zep.c functions.zep.c geometry.zep.c globals.zep.c instance.zep.c instanceoff.zep.c internalclasses.zep.c internalinterfaces.zep.c invoke.zep.c issettest.zep.c issue1404.zep.c issue1521.zep.c issue663.zep.c issue887.zep.c issue893.zep.c issue914.zep.c issues.zep.c json.zep.c logical.zep.c mcall.zep.c mcallchained.zep.c mcalldynamic.zep.c mcallinternal.zep.c methodabstract.zep.c methodargs.zep.c nativearray.zep.c oo.zep.c operator.zep.c pdostatement.zep.c pregmatch.zep.c quantum.zep.c range.zep.c references.zep.c reflection.zep.c regexdna.zep.c requires.zep.c resourcetest.zep.c returns.zep.c router.zep.c scall.zep.c scalldynamic.zep.c scallexternal.zep.c scalllateconstruct.zep.c scope.zep.c sort.zep.c spectralnorm.zep.c spl.zep.c spropertyaccess.zep.c statements.zep.c strings.zep.c stubs.zep.c ternary.zep.c trytest.zep.c typeinstances.zep.c typeoff.zep.c unknownclass.zep.c unsettest.zep.c usetest.zep.c vars.zep.c 0__closure.zep.c 1__closure.zep.c 2__closure.zep.c 3__closure.zep.c 4__closure.zep.c 5__closure.zep.c 6__closure.zep.c 7__closure.zep.c 8__closure.zep.c 9__closure.zep.c 10__closure.zep.c 11__closure.zep.c 12__closure.zep.c 13__closure.zep.c", "stub"); + ADD_SOURCES(configure_module_dirname + "/stub", "testinterface.zep.c scallparent.zep.c constantsparent.zep.c methodinterface.zep.c arithmetic.zep.c arrayaccessobj.zep.c arrayaccesstest.zep.c arrayiterator.zep.c arrayiteratortest.zep.c arraymanipulation.zep.c arrayobject.zep.c arraysearch.zep.c assign.zep.c bitwise.zep.c branchprediction.zep.c cast.zep.c cblock.zep.c chars.zep.c closures.zep.c compare.zep.c concat.zep.c constants.zep.c constantsinterface.zep.c constantsinterfacea.zep.c constantsinterfaceb.zep.c declaretest.zep.c diinterface.zep.c echoes.zep.c emptytest.zep.c evaltest.zep.c exception.zep.c exceptions.zep.c exists.zep.c exitdie.zep.c extendedinterface.zep.c factorial.zep.c fannkuch.zep.c fasta.zep.c fcall.zep.c fetchtest.zep.c fibonnaci.zep.c flow.zep.c fortytwo.zep.c functional.zep.c functionexists.zep.c functions.zep.c geometry.zep.c globals.zep.c instance.zep.c instanceoff.zep.c internalclasses.zep.c internalinterfaces.zep.c invoke.zep.c issettest.zep.c issue1134.zep.c issue1404.zep.c issue1521.zep.c issue663.zep.c issue887.zep.c issue893.zep.c issue914.zep.c issues.zep.c json.zep.c logical.zep.c mcall.zep.c mcallchained.zep.c mcalldynamic.zep.c mcallinternal.zep.c methodabstract.zep.c methodargs.zep.c nativearray.zep.c oo.zep.c operator.zep.c pdostatement.zep.c pregmatch.zep.c quantum.zep.c range.zep.c references.zep.c reflection.zep.c regexdna.zep.c requires.zep.c resourcetest.zep.c returns.zep.c router.zep.c scall.zep.c scalldynamic.zep.c scallexternal.zep.c scalllateconstruct.zep.c scope.zep.c sort.zep.c spectralnorm.zep.c spl.zep.c spropertyaccess.zep.c statements.zep.c strings.zep.c stubs.zep.c ternary.zep.c trytest.zep.c typeinstances.zep.c typeoff.zep.c unknownclass.zep.c unsettest.zep.c usetest.zep.c vars.zep.c 0__closure.zep.c 1__closure.zep.c 2__closure.zep.c 3__closure.zep.c 4__closure.zep.c 5__closure.zep.c 6__closure.zep.c 7__closure.zep.c 8__closure.zep.c 9__closure.zep.c 10__closure.zep.c 11__closure.zep.c 12__closure.zep.c 13__closure.zep.c", "stub"); ADD_SOURCES(configure_module_dirname + "/stub/oo/extend", "exception.zep.c", "stub"); ADD_SOURCES(configure_module_dirname + "/stub/issue2165", "issueextendinterface.zep.c issueinterface.zep.c issue.zep.c", "stub"); ADD_SOURCES(configure_module_dirname + "/stub/oo/extend/db", "exception.zep.c", "stub"); From fae1b2e83a5e9a24e0fb38e247c7d17a25a099b6 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Tue, 20 Apr 2021 23:19:32 +0100 Subject: [PATCH 47/63] #1134 - Rename test case method --- tests/Extension/Issue1134Test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Extension/Issue1134Test.php b/tests/Extension/Issue1134Test.php index 5835ebdf90..bad9995745 100644 --- a/tests/Extension/Issue1134Test.php +++ b/tests/Extension/Issue1134Test.php @@ -26,7 +26,7 @@ final class Issue1134Test extends TestCase /** * @throws ReflectionException */ - public function testIssue914(): void + public function testIssue914ReflectionParamDefaultValueShouldReturnTrue(): void { $ref = new ReflectionClass(Issue1134::class); $constructor = $ref->getConstructor(); From 873e8f431271fdc2f72f4406ad53390a82142d2b Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Wed, 21 Apr 2021 08:59:33 +0100 Subject: [PATCH 48/63] Remove redundant property initializer --- Library/ArgInfoDefinition.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/ArgInfoDefinition.php b/Library/ArgInfoDefinition.php index d5d1e63c44..e8165bcca4 100644 --- a/Library/ArgInfoDefinition.php +++ b/Library/ArgInfoDefinition.php @@ -36,7 +36,7 @@ class ArgInfoDefinition /** * @var ClassMethodParameters|null */ - private ?ClassMethodParameters $parameters = null; + private ?ClassMethodParameters $parameters; /** * @var CodePrinter From b8ea75cacb81c06ea4c3925a8cbb3dc2e8ae2eff Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Thu, 22 Apr 2021 23:53:32 +0100 Subject: [PATCH 49/63] #2226 - Update list of class entries for PHP extension 'date' --- Library/ClassDefinition.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Library/ClassDefinition.php b/Library/ClassDefinition.php index 25d6cd7739..591ad82e36 100644 --- a/Library/ClassDefinition.php +++ b/Library/ClassDefinition.php @@ -1912,16 +1912,39 @@ public function getClassEntryByClassName( $classEntry = 'php_pdo_get_exception()'; break; + /** + * PHP Ext Date + */ + case 'datetimeinterface': + $compilationContext->headersManager->add('ext/date/php_date'); + $classEntry = 'php_date_get_interface_ce()'; + break; + case 'datetime': $compilationContext->headersManager->add('ext/date/php_date'); $classEntry = 'php_date_get_date_ce()'; break; + case 'datetimeimmutable': + $compilationContext->headersManager->add('ext/date/php_date'); + $classEntry = 'php_date_get_immutable_ce()'; + break; + case 'datetimezone': $compilationContext->headersManager->add('ext/date/php_date'); $classEntry = 'php_date_get_timezone_ce()'; break; + case 'dateinterval': + $compilationContext->headersManager->add('ext/date/php_date'); + $classEntry = 'php_date_get_interval_ce()'; + break; + + case 'dateperiod': + $compilationContext->headersManager->add('ext/date/php_date'); + $classEntry = 'php_date_get_period_ce()'; + break; + /** * PHP Ext session */ From 6415a47569c53ef830685faf8187fcd433468080 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Thu, 22 Apr 2021 23:55:20 +0100 Subject: [PATCH 50/63] #2226 - Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b77753e7a9..d8bf26300d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](http://semver.org). ### Fixed - Fixed nullable array [#1094](https://github.com/zephir-lang/zephir/issues/1094) - Fixed default value detection with Reflection (only PHP 8.0) [#1134](https://github.com/zephir-lang/zephir/issues/1134) +- Updated supported list of class entries for PHP date extension [#2226](https://github.com/zephir-lang/zephir/issues/2226) ### Added - Added support syntax assign-bitwise operators [#1103](https://github.com/zephir-lang/zephir/issues/1103) From f1edf742bcb82767b3441f43843fae89ecd09d43 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sat, 24 Apr 2021 09:13:02 +0100 Subject: [PATCH 51/63] #1259 - Add TODO --- kernels/ZendEngine3/object.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernels/ZendEngine3/object.c b/kernels/ZendEngine3/object.c index bbe87a668f..3fb2e006c6 100755 --- a/kernels/ZendEngine3/object.c +++ b/kernels/ZendEngine3/object.c @@ -956,6 +956,8 @@ int zephir_unset_property(zval* object, const char* name) /** * Unsets an index in an array property + * + * TODO: This only works with zephir_read_property() + zephir_array_unset_string(), which might be incorrect */ int zephir_unset_property_array(zval *object, char *property, unsigned int property_length, zval *index) { From 13d2e3771466061ea79ce5b525ff5df89f01c543 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sat, 24 Apr 2021 11:40:14 +0100 Subject: [PATCH 52/63] #1259 - Remove unexisted variables calls in arrayUnset() method --- Library/Backends/ZendEngine2/Backend.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Library/Backends/ZendEngine2/Backend.php b/Library/Backends/ZendEngine2/Backend.php index f7a1ee8752..8f05bc4cc2 100644 --- a/Library/Backends/ZendEngine2/Backend.php +++ b/Library/Backends/ZendEngine2/Backend.php @@ -554,12 +554,12 @@ public function arrayUnset(Variable $variable, $exprIndex, $flags, CompilationCo break; default: - throw new CompilerException('Variable type: '.$variableIndex->getType().' cannot be used as array index without cast', $expression['right']); + throw new CompilerException('Variable type: '.$variableIndex->getType().' cannot be used as array index without cast'); } break; default: - throw new CompilerException('Cannot use expression: '.$exprIndex->getType().' as array index without cast', $expression['right']); + throw new CompilerException('Cannot use expression: '.$exprIndex->getType().' as array index without cast'); } } From be2aa170aa0021fbe99138eafdcd46d61d91eb84 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sat, 24 Apr 2021 11:52:00 +0100 Subject: [PATCH 53/63] #1259 - Implement unset key from object property --- Library/Statements/UnsetStatement.php | 68 +++++++++++++++++++++++---- 1 file changed, 60 insertions(+), 8 deletions(-) diff --git a/Library/Statements/UnsetStatement.php b/Library/Statements/UnsetStatement.php index 7c1eceb6f2..1a734c03e3 100644 --- a/Library/Statements/UnsetStatement.php +++ b/Library/Statements/UnsetStatement.php @@ -9,35 +9,47 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Statements; use Zephir\CompilationContext; +use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; +use function in_array; + /** - * Class UnsetStatement. + * unset() statement */ class UnsetStatement extends StatementAbstract { /** * @param CompilationContext $compilationContext * - * @throws CompilerException + * @throws Exception */ - public function compile(CompilationContext $compilationContext) + public function compile(CompilationContext $compilationContext): void { + $flags = 'PH_SEPARATE'; + $compilationContext->headersManager->add('kernel/array'); $expression = $this->statement['expr']; - $flags = 'PH_SEPARATE'; - - if ('list' == $expression['type']) { + if ('list' === $expression['type']) { $expression = $expression['left']; } switch ($expression['type']) { case 'array-access': + /** + * Unset of object property + */ + if (isset($expression['left']['type']) && $expression['left']['type'] === 'property-access') { + $compilationContext = $this->generateUnsetPropertyFromObject($expression, $compilationContext); + } + $expr = new Expression($expression['left']); $expr->setReadOnly(true); $exprVar = $expr->compile($compilationContext); @@ -58,7 +70,7 @@ public function compile(CompilationContext $compilationContext) $compilationContext->headersManager->add('kernel/object'); $compilationContext->codePrinter->output('zephir_unset_property('.$variableCode.', "'.$expression['right']['value'].'");'); - return true; + return; case 'property-dynamic-access': //TODO: fix it @@ -67,7 +79,7 @@ public function compile(CompilationContext $compilationContext) throw new CompilerException('Cannot use expression type: '.$expression['type'].' in "unset"', $expression); } - if (!\in_array($variable->getType(), ['variable', 'array'])) { + if (!in_array($variable->getType(), ['variable', 'array'])) { throw new CompilerException('Cannot use variable type: '.$variable->gettype().' in "unset"', $expression['left']); } @@ -80,4 +92,44 @@ public function compile(CompilationContext $compilationContext) $compilationContext->backend->arrayUnset($variable, $exprIndex, $flags, $compilationContext); } + + /** + * @param array $expression + * @param CompilationContext $compilationContext + * @return CompilationContext + * @throws Exception + */ + private function generateUnsetPropertyFromObject(array $expression, CompilationContext $compilationContext): CompilationContext + { + $expr = new Expression($expression['left']); + $expr->setReadOnly(true); + $exprVar = $expr->compile($compilationContext); + $variable = $compilationContext->symbolTable->getVariableForWrite($exprVar->getCode(), $compilationContext, $this->statement); + + $temporaryVariableRef = $compilationContext->backend->getVariableCode($variable); + + // TODO: Add more types check when parser will support them, see ArrayAccessTest.zep + switch ($expression['right']['type']) { + case 'string': + $compilationContext->codePrinter->output('ZVAL_STR('.$temporaryVariableRef.', "'.$expression['right']['value'].'");'); + break; + + case 'int': + $compilationContext->codePrinter->output('ZVAL_LONG('.$temporaryVariableRef.', '.$expression['right']['value'].');'); + break; + } + + $expr = new Expression($expression['left']['left']); + $expr->setReadOnly(true); + $exprVar = $expr->compile($compilationContext); + $variable = $compilationContext->symbolTable->getVariableForWrite($exprVar->getCode(), $compilationContext, $this->statement); + $variableCode = $compilationContext->backend->getVariableCode($variable); + + $compilationContext->headersManager->add('kernel/object'); + $compilationContext->codePrinter->output( + 'zephir_unset_property_array('.$variableCode.', ZEND_STRL("'.$expression['left']['right']['value'].'"), '.$temporaryVariableRef.');' + ); + + return $compilationContext; + } } From fa2d22ed72c1ee9740030dd8eb7fd3be2d40ca30 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sat, 24 Apr 2021 11:52:36 +0100 Subject: [PATCH 54/63] #1259 - Add more test cases for unset from property --- stub/arrayaccesstest.zep | 61 ++++++++++++++++++++++++++++- tests/Extension/ArrayAccessTest.php | 48 ++++++++++++++++++++++- 2 files changed, 106 insertions(+), 3 deletions(-) diff --git a/stub/arrayaccesstest.zep b/stub/arrayaccesstest.zep index 64513d9582..82b4fbd841 100644 --- a/stub/arrayaccesstest.zep +++ b/stub/arrayaccesstest.zep @@ -3,7 +3,14 @@ namespace Stub; class ArrayAccessTest { protected data; - protected unsetData = ["key_a": "marcin", "key_b": "paula"]; + protected unsetData = [ + "key_a": "marcin", + "key_b": "paula", + 3: "long value" + //3.14: "double value", // Syntax error + //false: "bool value", // Syntax error + //null: "null value" // Syntax error + ]; public static function exits() { @@ -137,7 +144,7 @@ class ArrayAccessTest /** * @issue https://github.com/zephir-lang/zephir/issues/1259 */ - public function issue1259UnsetKeyFromArrayProperty() -> array + public function issue1259UnsetStringKeyFromArrayProperty() -> array { array ret = []; @@ -147,4 +154,54 @@ class ArrayAccessTest return ret; } + + public function issue1259UnsetLongKeyFromArrayProperty() -> array + { + array ret = []; + + let ret[] = this->unsetData; + unset(this->unsetData[3]); + let ret[] = this->unsetData; + + return ret; + } + + /* + public function issue1259UnsetDoubleKeyFromArrayProperty() -> array + { + array ret = []; + + let ret[] = this->unsetData; + unset(this->unsetData[3.14]); + let ret[] = this->unsetData; + + return ret; + } + */ + + /* + public function issue1259UnsetBoolKeyFromArrayProperty() -> array + { + array ret = []; + + let ret[] = this->unsetData; + unset(this->unsetData[false]); + let ret[] = this->unsetData; + + return ret; + } + */ + + /* + public function issue1259UnsetNullKeyFromArrayProperty() -> array + { + array ret = []; + + let ret[] = this->unsetData; + unset(this->unsetData[null]); + let ret[] = this->unsetData; + + return ret; + } + */ } diff --git a/tests/Extension/ArrayAccessTest.php b/tests/Extension/ArrayAccessTest.php index a5e46f983a..ff8f562b0a 100644 --- a/tests/Extension/ArrayAccessTest.php +++ b/tests/Extension/ArrayAccessTest.php @@ -17,6 +17,15 @@ final class ArrayAccessTest extends TestCase { + private array $defaultUnsetData = [ + 'key_a' => 'marcin', + 'key_b' => 'paula', + 3 => 'long value', + //3.14 => 'double value', // Not supported yet + //false => 'bool value', // Not supported yet + //null => 'null value', // Not supported yet + ]; + public function testTest(): void { $class = new \Stub\ArrayAccessTest(); @@ -89,6 +98,43 @@ public function testIssue1259CheckUnsetKeyFromArray(): void ]; $this->assertSame($expected, $class->issue1259UnsetKeyFromArrayInternalVariable()); - $this->assertSame($expected, $class->issue1259UnsetKeyFromArrayProperty()); + } + + /** + * @issue https://github.com/zephir-lang/zephir/issues/1259 + */ + public function testIssue1259CheckUnsetStringKeyFromArrayProperty(): void + { + $class = new \Stub\ArrayAccessTest(); + + $this->assertSame( + [ + $this->defaultUnsetData, + [ + 'key_b' => 'paula', + 3 => 'long value', + ], + ], + $class->issue1259UnsetStringKeyFromArrayProperty() + ); + } + + /** + * @issue https://github.com/zephir-lang/zephir/issues/1259 + */ + public function testIssue1259CheckUnsetLongKeyFromArrayProperty(): void + { + $class = new \Stub\ArrayAccessTest(); + + $this->assertSame( + [ + $this->defaultUnsetData, + [ + 'key_a' => 'marcin', + 'key_b' => 'paula', + ], + ], + $class->issue1259UnsetLongKeyFromArrayProperty() + ); } } From ffc3d78bada4984ce906370d1452fb6fa9e6f16a Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sat, 24 Apr 2021 11:53:01 +0100 Subject: [PATCH 55/63] #1259 - Add TODO note --- ext/kernel/object.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ext/kernel/object.c b/ext/kernel/object.c index bbe87a668f..3fb2e006c6 100644 --- a/ext/kernel/object.c +++ b/ext/kernel/object.c @@ -956,6 +956,8 @@ int zephir_unset_property(zval* object, const char* name) /** * Unsets an index in an array property + * + * TODO: This only works with zephir_read_property() + zephir_array_unset_string(), which might be incorrect */ int zephir_unset_property_array(zval *object, char *property, unsigned int property_length, zval *index) { From 87d85a9f141419f6a610f3f5cf4453f3ed3812ad Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sat, 24 Apr 2021 11:53:35 +0100 Subject: [PATCH 56/63] #1259 - Update code in ext/ directory --- ext/kernel/array.c | 4 +- ext/kernel/concat.c | 2 +- ext/stub/arrayaccessobj.zep.c | 7 +- ext/stub/arrayaccesstest.zep.c | 53 ++++++++++-- ext/stub/arrayaccesstest.zep.h | 11 ++- ext/stub/assign.zep.c | 149 ++++++++++++++++++++++++++++++++- ext/stub/assign.zep.h | 7 ++ ext/stub/unsettest.zep.c | 7 +- 8 files changed, 220 insertions(+), 20 deletions(-) diff --git a/ext/kernel/array.c b/ext/kernel/array.c index 91ac475d2b..e1dfbdc700 100644 --- a/ext/kernel/array.c +++ b/ext/kernel/array.c @@ -364,7 +364,7 @@ int ZEPHIR_FASTCALL zephir_array_unset(zval *arr, zval *index, int flags) return (zend_symtable_del(ht, Z_STR_P(index)) == SUCCESS); default: - zend_error(E_WARNING, "Illegal offset type"); + zend_error(E_WARNING, "Passed index has illegal offset type (check zephir_array_unset())"); return 0; } } @@ -387,7 +387,7 @@ int ZEPHIR_FASTCALL zephir_array_unset_string(zval *arr, const char *index, uint } if ((flags & PH_SEPARATE) == PH_SEPARATE) { - SEPARATE_ARRAY(arr); + SEPARATE_ZVAL(arr); } return zend_hash_str_del(Z_ARRVAL_P(arr), index, index_length); diff --git a/ext/kernel/concat.c b/ext/kernel/concat.c index e77a07b9c5..65f5cf09aa 100644 --- a/ext/kernel/concat.c +++ b/ext/kernel/concat.c @@ -628,7 +628,7 @@ void zephir_concat_vvv(zval *result, zval *op1, zval *op2, zval *op3, int self_v void zephir_concat_function(zval *result, zval *op1, zval *op2) { zval tmp; - SEPARATE_ZVAL(result); + SEPARATE_ZVAL_NOREF(result); /* res == op1 == op2: won't leak diff --git a/ext/stub/arrayaccessobj.zep.c b/ext/stub/arrayaccessobj.zep.c index 56936b2a72..900a9de412 100644 --- a/ext/stub/arrayaccessobj.zep.c +++ b/ext/stub/arrayaccessobj.zep.c @@ -96,11 +96,12 @@ PHP_METHOD(Stub_ArrayAccessObj, offsetExists) PHP_METHOD(Stub_ArrayAccessObj, offsetUnset) { - zval *offset, offset_sub, _0; + zval *offset, offset_sub, _0, _1; zval *this_ptr = getThis(); ZVAL_UNDEF(&offset_sub); ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) @@ -113,7 +114,9 @@ PHP_METHOD(Stub_ArrayAccessObj, offsetUnset) zephir_read_property(&_0, this_ptr, ZEND_STRL("test"), PH_NOISY_CC | PH_READONLY); - zephir_array_unset(&_0, offset, PH_SEPARATE); + zephir_unset_property_array(this_ptr, ZEND_STRL("test"), &_0); + zephir_read_property(&_1, this_ptr, ZEND_STRL("test"), PH_NOISY_CC | PH_READONLY); + zephir_array_unset(&_1, offset, PH_SEPARATE); } PHP_METHOD(Stub_ArrayAccessObj, offsetGet) diff --git a/ext/stub/arrayaccesstest.zep.c b/ext/stub/arrayaccesstest.zep.c index 61e9368f37..510ee5b3a6 100644 --- a/ext/stub/arrayaccesstest.zep.c +++ b/ext/stub/arrayaccesstest.zep.c @@ -68,7 +68,7 @@ PHP_METHOD(Stub_ArrayAccessTest, get) object_init_ex(&arr, stub_arrayaccessobj_ce); ZEPHIR_CALL_METHOD(NULL, &arr, "__construct", NULL, 3); zephir_check_call_status(); - zephir_array_fetch_string(&_0, &arr, SL("two"), PH_NOISY | PH_READONLY, "stub/arrayaccesstest.zep", 21); + zephir_array_fetch_string(&_0, &arr, SL("two"), PH_NOISY | PH_READONLY, "stub/arrayaccesstest.zep", 28); RETURN_CTOR(&_0); } @@ -357,18 +357,18 @@ PHP_METHOD(Stub_ArrayAccessTest, issue1259UnsetKeyFromArrayInternalVariable) zephir_create_array(&unsetData, 2, 0); add_assoc_stringl_ex(&unsetData, SL("key_a"), SL("marcin")); add_assoc_stringl_ex(&unsetData, SL("key_b"), SL("paula")); - zephir_array_append(&ret, &unsetData, PH_SEPARATE, "stub/arrayaccesstest.zep", 130); + zephir_array_append(&ret, &unsetData, PH_SEPARATE, "stub/arrayaccesstest.zep", 137); zephir_array_unset_string(&unsetData, SL("key_a"), PH_SEPARATE); - zephir_array_append(&ret, &unsetData, PH_SEPARATE, "stub/arrayaccesstest.zep", 132); + zephir_array_append(&ret, &unsetData, PH_SEPARATE, "stub/arrayaccesstest.zep", 139); RETURN_CTOR(&ret); } /** * @issue https://github.com/zephir-lang/zephir/issues/1259 */ -PHP_METHOD(Stub_ArrayAccessTest, issue1259UnsetKeyFromArrayProperty) +PHP_METHOD(Stub_ArrayAccessTest, issue1259UnsetStringKeyFromArrayProperty) { - zval _0, _1, _2; + zval _0, _1, _2, _3; zval ret; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *this_ptr = getThis(); @@ -377,6 +377,7 @@ PHP_METHOD(Stub_ArrayAccessTest, issue1259UnsetKeyFromArrayProperty) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3); ZEPHIR_MM_GROW(); @@ -384,11 +385,44 @@ PHP_METHOD(Stub_ArrayAccessTest, issue1259UnsetKeyFromArrayProperty) ZEPHIR_INIT_VAR(&ret); array_init(&ret); zephir_read_property(&_0, this_ptr, ZEND_STRL("unsetData"), PH_NOISY_CC | PH_READONLY); - zephir_array_append(&ret, &_0, PH_SEPARATE, "stub/arrayaccesstest.zep", 144); + zephir_array_append(&ret, &_0, PH_SEPARATE, "stub/arrayaccesstest.zep", 151); zephir_read_property(&_1, this_ptr, ZEND_STRL("unsetData"), PH_NOISY_CC | PH_READONLY); - zephir_array_unset_string(&_1, SL("key_a"), PH_SEPARATE); + ZVAL_STR(&_1, "key_a"); + zephir_unset_property_array(this_ptr, ZEND_STRL("unsetData"), &_1); zephir_read_property(&_2, this_ptr, ZEND_STRL("unsetData"), PH_NOISY_CC | PH_READONLY); - zephir_array_append(&ret, &_2, PH_SEPARATE, "stub/arrayaccesstest.zep", 146); + zephir_array_unset_string(&_2, SL("key_a"), PH_SEPARATE); + zephir_read_property(&_3, this_ptr, ZEND_STRL("unsetData"), PH_NOISY_CC | PH_READONLY); + zephir_array_append(&ret, &_3, PH_SEPARATE, "stub/arrayaccesstest.zep", 153); + RETURN_CTOR(&ret); +} + +PHP_METHOD(Stub_ArrayAccessTest, issue1259UnsetLongKeyFromArrayProperty) +{ + zval _0, _1, _2, _3; + zval ret; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&ret); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3); + + + ZEPHIR_MM_GROW(); + + ZEPHIR_INIT_VAR(&ret); + array_init(&ret); + zephir_read_property(&_0, this_ptr, ZEND_STRL("unsetData"), PH_NOISY_CC | PH_READONLY); + zephir_array_append(&ret, &_0, PH_SEPARATE, "stub/arrayaccesstest.zep", 162); + zephir_read_property(&_1, this_ptr, ZEND_STRL("unsetData"), PH_NOISY_CC | PH_READONLY); + ZVAL_LONG(&_1, 3); + zephir_unset_property_array(this_ptr, ZEND_STRL("unsetData"), &_1); + zephir_read_property(&_2, this_ptr, ZEND_STRL("unsetData"), PH_NOISY_CC | PH_READONLY); + zephir_array_unset_long(&_2, 3, PH_SEPARATE); + zephir_read_property(&_3, this_ptr, ZEND_STRL("unsetData"), PH_NOISY_CC | PH_READONLY); + zephir_array_append(&ret, &_3, PH_SEPARATE, "stub/arrayaccesstest.zep", 164); RETURN_CTOR(&ret); } @@ -409,9 +443,10 @@ zend_object *zephir_init_properties_Stub_ArrayAccessTest(zend_class_entry *class zephir_read_property_ex(&_0, this_ptr, ZEND_STRL("unsetData"), PH_NOISY_CC | PH_READONLY); if (Z_TYPE_P(&_0) == IS_NULL) { ZEPHIR_INIT_VAR(&_1$$3); - zephir_create_array(&_1$$3, 2, 0); + zephir_create_array(&_1$$3, 3, 0); add_assoc_stringl_ex(&_1$$3, SL("key_a"), SL("marcin")); add_assoc_stringl_ex(&_1$$3, SL("key_b"), SL("paula")); + add_index_stringl(&_1$$3, 3, SL("long value")); zephir_update_property_zval_ex(this_ptr, ZEND_STRL("unsetData"), &_1$$3); } ZEPHIR_MM_RESTORE(); diff --git a/ext/stub/arrayaccesstest.zep.h b/ext/stub/arrayaccesstest.zep.h index fbd4e2e0c2..830e2881ed 100644 --- a/ext/stub/arrayaccesstest.zep.h +++ b/ext/stub/arrayaccesstest.zep.h @@ -15,7 +15,8 @@ PHP_METHOD(Stub_ArrayAccessTest, issue1086WontNullArrayAfterPassViaStaticWithStr PHP_METHOD(Stub_ArrayAccessTest, issue1086NotStrictParams); PHP_METHOD(Stub_ArrayAccessTest, issue1086WontNullArrayAfterPassViaStaticWithoutStrictParams); PHP_METHOD(Stub_ArrayAccessTest, issue1259UnsetKeyFromArrayInternalVariable); -PHP_METHOD(Stub_ArrayAccessTest, issue1259UnsetKeyFromArrayProperty); +PHP_METHOD(Stub_ArrayAccessTest, issue1259UnsetStringKeyFromArrayProperty); +PHP_METHOD(Stub_ArrayAccessTest, issue1259UnsetLongKeyFromArrayProperty); zend_object *zephir_init_properties_Stub_ArrayAccessTest(zend_class_entry *class_type); ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayaccesstest_exits, 0, 0, 0) @@ -71,7 +72,10 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccesstest_issue1259unsetkeyfromarrayinternalvariable, 0, 0, IS_ARRAY, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccesstest_issue1259unsetkeyfromarrayproperty, 0, 0, IS_ARRAY, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccesstest_issue1259unsetstringkeyfromarrayproperty, 0, 0, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccesstest_issue1259unsetlongkeyfromarrayproperty, 0, 0, IS_ARRAY, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayaccesstest_zephir_init_properties_stub_arrayaccesstest, 0, 0, 0) @@ -98,6 +102,7 @@ ZEPHIR_INIT_FUNCS(stub_arrayaccesstest_method_entry) { PHP_ME(Stub_ArrayAccessTest, issue1086NotStrictParams, arginfo_stub_arrayaccesstest_issue1086notstrictparams, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_ME(Stub_ArrayAccessTest, issue1086WontNullArrayAfterPassViaStaticWithoutStrictParams, arginfo_stub_arrayaccesstest_issue1086wontnullarrayafterpassviastaticwithoutstrictparams, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_ME(Stub_ArrayAccessTest, issue1259UnsetKeyFromArrayInternalVariable, arginfo_stub_arrayaccesstest_issue1259unsetkeyfromarrayinternalvariable, ZEND_ACC_PUBLIC) - PHP_ME(Stub_ArrayAccessTest, issue1259UnsetKeyFromArrayProperty, arginfo_stub_arrayaccesstest_issue1259unsetkeyfromarrayproperty, ZEND_ACC_PUBLIC) + PHP_ME(Stub_ArrayAccessTest, issue1259UnsetStringKeyFromArrayProperty, arginfo_stub_arrayaccesstest_issue1259unsetstringkeyfromarrayproperty, ZEND_ACC_PUBLIC) + PHP_ME(Stub_ArrayAccessTest, issue1259UnsetLongKeyFromArrayProperty, arginfo_stub_arrayaccesstest_issue1259unsetlongkeyfromarrayproperty, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/assign.zep.c b/ext/stub/assign.zep.c index 6afd37a016..bb7cae62a4 100644 --- a/ext/stub/assign.zep.c +++ b/ext/stub/assign.zep.c @@ -16,6 +16,7 @@ #include "kernel/memory.h" #include "kernel/array.h" #include "kernel/operators.h" +#include "kernel/fcall.h" /** @@ -2406,6 +2407,152 @@ PHP_METHOD(Stub_Assign, testArrayBoolExpressionAssign) RETURN_MM_MEMBER(getThis(), "myArray"); } +PHP_METHOD(Stub_Assign, testAssignBitwiseX) +{ + zval _0; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *a_param = NULL, *b_param = NULL, op, i, result, _1, *_2, _3; + zend_long a, b, ZEPHIR_LAST_CALL_STATUS, _4$$4, _5$$5, _6$$6, _7$$7, _8$$8, _9$$10, _10$$11, _11$$12, _12$$13, _13$$14; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&op); + ZVAL_UNDEF(&i); + ZVAL_UNDEF(&result); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_0); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_LONG(a) + Z_PARAM_LONG(b) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &a_param, &b_param); + a = zephir_get_intval(a_param); + b = zephir_get_intval(b_param); + + + ZEPHIR_INIT_VAR(&result); + array_init(&result); + ZEPHIR_INIT_VAR(&_0); + zephir_create_array(&_0, 5, 0); + ZEPHIR_INIT_VAR(&_1); + ZVAL_STRING(&_1, "or"); + zephir_array_fast_append(&_0, &_1); + ZEPHIR_INIT_NVAR(&_1); + ZVAL_STRING(&_1, "and"); + zephir_array_fast_append(&_0, &_1); + ZEPHIR_INIT_NVAR(&_1); + ZVAL_STRING(&_1, "xor"); + zephir_array_fast_append(&_0, &_1); + ZEPHIR_INIT_NVAR(&_1); + ZVAL_STRING(&_1, "shiftleft"); + zephir_array_fast_append(&_0, &_1); + ZEPHIR_INIT_NVAR(&_1); + ZVAL_STRING(&_1, "shiftright"); + zephir_array_fast_append(&_0, &_1); + zephir_is_iterable(&_0, 0, "stub/assign.zep", 941); + if (Z_TYPE_P(&_0) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&_0), _2) + { + ZEPHIR_INIT_NVAR(&op); + ZVAL_COPY(&op, _2); + ZEPHIR_INIT_NVAR(&i); + ZVAL_LONG(&i, a); + do { + if (ZEPHIR_IS_STRING(&op, "or")) { + _4$$4 = ((int) (zephir_get_numberval(&i)) | b); + ZEPHIR_INIT_NVAR(&i); + ZVAL_LONG(&i, _4$$4); + break; + } + if (ZEPHIR_IS_STRING(&op, "and")) { + _5$$5 = ((int) (zephir_get_numberval(&i)) & b); + ZEPHIR_INIT_NVAR(&i); + ZVAL_LONG(&i, _5$$5); + break; + } + if (ZEPHIR_IS_STRING(&op, "xor")) { + _6$$6 = ((int) (zephir_get_numberval(&i)) ^ b); + ZEPHIR_INIT_NVAR(&i); + ZVAL_LONG(&i, _6$$6); + break; + } + if (ZEPHIR_IS_STRING(&op, "shiftleft")) { + _7$$7 = ((int) (zephir_get_numberval(&i)) << b); + ZEPHIR_INIT_NVAR(&i); + ZVAL_LONG(&i, _7$$7); + break; + } + if (ZEPHIR_IS_STRING(&op, "shiftright")) { + _8$$8 = ((int) (zephir_get_numberval(&i)) >> b); + ZEPHIR_INIT_NVAR(&i); + ZVAL_LONG(&i, _8$$8); + break; + } + } while(0); + + zephir_array_update_zval(&result, &op, &i, PH_COPY | PH_SEPARATE); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &_0, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_3, &_0, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_3)) { + break; + } + ZEPHIR_CALL_METHOD(&op, &_0, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&i); + ZVAL_LONG(&i, a); + do { + if (ZEPHIR_IS_STRING(&op, "or")) { + _9$$10 = ((int) (zephir_get_numberval(&i)) | b); + ZEPHIR_INIT_NVAR(&i); + ZVAL_LONG(&i, _9$$10); + break; + } + if (ZEPHIR_IS_STRING(&op, "and")) { + _10$$11 = ((int) (zephir_get_numberval(&i)) & b); + ZEPHIR_INIT_NVAR(&i); + ZVAL_LONG(&i, _10$$11); + break; + } + if (ZEPHIR_IS_STRING(&op, "xor")) { + _11$$12 = ((int) (zephir_get_numberval(&i)) ^ b); + ZEPHIR_INIT_NVAR(&i); + ZVAL_LONG(&i, _11$$12); + break; + } + if (ZEPHIR_IS_STRING(&op, "shiftleft")) { + _12$$13 = ((int) (zephir_get_numberval(&i)) << b); + ZEPHIR_INIT_NVAR(&i); + ZVAL_LONG(&i, _12$$13); + break; + } + if (ZEPHIR_IS_STRING(&op, "shiftright")) { + _13$$14 = ((int) (zephir_get_numberval(&i)) >> b); + ZEPHIR_INIT_NVAR(&i); + ZVAL_LONG(&i, _13$$14); + break; + } + } while(0); + + zephir_array_update_zval(&result, &op, &i, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_METHOD(NULL, &_0, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&op); + RETURN_CCTOR(&result); +} + /** * @link https://github.com/zephir-lang/zephir/issues/725 */ @@ -2521,7 +2668,7 @@ PHP_METHOD(Stub_Assign, issue597) } } if (zephir_array_isset_string(&_GET, SL("s"))) { - zephir_array_fetch_string(&_0$$4, &_GET, SL("s"), PH_NOISY | PH_READONLY, "stub/assign.zep", 953); + zephir_array_fetch_string(&_0$$4, &_GET, SL("s"), PH_NOISY | PH_READONLY, "stub/assign.zep", 983); ZEPHIR_INIT_VAR(&s$$4); ZVAL_LONG(&s$$4, (zephir_get_numberval(&_0$$4) * 5)); zephir_array_update_string(&_GET, SL("s"), &s$$4, PH_COPY | PH_SEPARATE); diff --git a/ext/stub/assign.zep.h b/ext/stub/assign.zep.h index 6a14d3c155..9a46eec1ef 100644 --- a/ext/stub/assign.zep.h +++ b/ext/stub/assign.zep.h @@ -92,6 +92,7 @@ PHP_METHOD(Stub_Assign, testArrayProperty); PHP_METHOD(Stub_Assign, testGlobalVarAssign); PHP_METHOD(Stub_Assign, testConstantKeyAssign); PHP_METHOD(Stub_Assign, testArrayBoolExpressionAssign); +PHP_METHOD(Stub_Assign, testAssignBitwiseX); PHP_METHOD(Stub_Assign, testAssignSuperGlobals); PHP_METHOD(Stub_Assign, testAssignSuperGlobalsSERVER); PHP_METHOD(Stub_Assign, testAssignSuperGlobalsGET); @@ -387,6 +388,11 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_assign_testarrayboolexpressionassign, 0, 0, 0) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_assign_testassignbitwisex, 0, 0, 2) + ZEND_ARG_TYPE_INFO(0, a, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(0, b, IS_LONG, 0) +ZEND_END_ARG_INFO() + ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_assign_testassignsuperglobals, 0, 0, 0) ZEND_END_ARG_INFO() @@ -613,6 +619,7 @@ ZEPHIR_INIT_FUNCS(stub_assign_method_entry) { #else PHP_ME(Stub_Assign, testArrayBoolExpressionAssign, NULL, ZEND_ACC_PUBLIC) #endif + PHP_ME(Stub_Assign, testAssignBitwiseX, arginfo_stub_assign_testassignbitwisex, ZEND_ACC_PUBLIC) #if PHP_VERSION_ID >= 80000 PHP_ME(Stub_Assign, testAssignSuperGlobals, arginfo_stub_assign_testassignsuperglobals, ZEND_ACC_PUBLIC) #else diff --git a/ext/stub/unsettest.zep.c b/ext/stub/unsettest.zep.c index d61ab6951b..a5faf439c2 100644 --- a/ext/stub/unsettest.zep.c +++ b/ext/stub/unsettest.zep.c @@ -84,11 +84,12 @@ PHP_METHOD(Stub_Unsettest, addValueToProperty) PHP_METHOD(Stub_Unsettest, testUnsetValueFromProperty) { - zval *key, key_sub, _0; + zval *key, key_sub, _0, _1; zval *this_ptr = getThis(); ZVAL_UNDEF(&key_sub); ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) @@ -101,7 +102,9 @@ PHP_METHOD(Stub_Unsettest, testUnsetValueFromProperty) zephir_read_property(&_0, this_ptr, ZEND_STRL("property"), PH_NOISY_CC | PH_READONLY); - zephir_array_unset(&_0, key, PH_SEPARATE); + zephir_unset_property_array(this_ptr, ZEND_STRL("property"), &_0); + zephir_read_property(&_1, this_ptr, ZEND_STRL("property"), PH_NOISY_CC | PH_READONLY); + zephir_array_unset(&_1, key, PH_SEPARATE); } PHP_METHOD(Stub_Unsettest, testUnsetFromArray) From cb7a9fc077fb6f53af0f549b20c0121a0dc7733f Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sat, 24 Apr 2021 11:55:26 +0100 Subject: [PATCH 57/63] #1259 - Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d8bf26300d..0bd4914115 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org). - Fixed nullable array [#1094](https://github.com/zephir-lang/zephir/issues/1094) - Fixed default value detection with Reflection (only PHP 8.0) [#1134](https://github.com/zephir-lang/zephir/issues/1134) - Updated supported list of class entries for PHP date extension [#2226](https://github.com/zephir-lang/zephir/issues/2226) +- Fixed unset from class property [#1259](https://github.com/zephir-lang/zephir/issues/1259) ### Added - Added support syntax assign-bitwise operators [#1103](https://github.com/zephir-lang/zephir/issues/1103) From 133407bd10305c36abac9a64e6e9208a2d528c95 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sat, 24 Apr 2021 19:32:57 +0100 Subject: [PATCH 58/63] Bump Zephir version to 0.13.3 --- CHANGELOG.md | 8 ++++++-- Library/Zephir.php | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0bd4914115..aa44093ad1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ The format based on [Keep a Changelog](http://keepachangelog.com) and this project adheres to [Semantic Versioning](http://semver.org). ## [Unreleased] + + +## [0.13.3] - 2021-04-24 ### Fixed - Fixed nullable array [#1094](https://github.com/zephir-lang/zephir/issues/1094) - Fixed default value detection with Reflection (only PHP 8.0) [#1134](https://github.com/zephir-lang/zephir/issues/1134) @@ -462,8 +465,9 @@ and this project adheres to [Semantic Versioning](http://semver.org). - Fixed casting resource to int (only ZendEngine 3) [#1524](https://github.com/zephir-lang/zephir/issues/1524) -[Unreleased]: https://github.com/zephir-lang/zephir/compare/0.13.2...HEAD -[0.13.2]: https://github.com/zephir-lang/zephir/compare/0.13.0...0.13.2 +[Unreleased]: https://github.com/zephir-lang/zephir/compare/0.13.3...HEAD +[0.13.3]: https://github.com/zephir-lang/zephir/compare/0.13.2...0.13.3 +[0.13.2]: https://github.com/zephir-lang/zephir/compare/0.13.1...0.13.2 [0.13.1]: https://github.com/zephir-lang/zephir/compare/0.13.0...0.13.1 [0.13.0]: https://github.com/zephir-lang/zephir/compare/0.12.21...0.13.0 [0.12.21]: https://github.com/zephir-lang/zephir/compare/0.12.20...0.12.21 diff --git a/Library/Zephir.php b/Library/Zephir.php index 264f331045..7d89eca9f2 100644 --- a/Library/Zephir.php +++ b/Library/Zephir.php @@ -16,7 +16,7 @@ */ final class Zephir { - const VERSION = '0.13.2-$Id$'; + const VERSION = '0.13.3-$Id$'; const LOGO = <<<'ASCII' _____ __ _ From 4a29beabe22bc1333c20c54143f9fe32468c838e Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sat, 24 Apr 2021 19:34:29 +0100 Subject: [PATCH 59/63] Regenerate ext/ directory --- ext/php_stub.h | 2 +- ext/stub/issue914.zep.c | 41 +++++++++++++++++++++++++++++++++++++++++ ext/stub/issue914.zep.h | 18 ++++++++++++++++++ 3 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 ext/stub/issue914.zep.c create mode 100644 ext/stub/issue914.zep.h diff --git a/ext/php_stub.h b/ext/php_stub.h index de15cd0674..705e07188f 100644 --- a/ext/php_stub.h +++ b/ext/php_stub.h @@ -14,7 +14,7 @@ #define PHP_STUB_VERSION "1.0.0" #define PHP_STUB_EXTNAME "stub" #define PHP_STUB_AUTHOR "Phalcon Team and contributors" -#define PHP_STUB_ZEPVERSION "0.13.2-$Id$" +#define PHP_STUB_ZEPVERSION "0.13.3-$Id$" #define PHP_STUB_DESCRIPTION "Description test for
Test Extension." typedef struct _zephir_struct_db { diff --git a/ext/stub/issue914.zep.c b/ext/stub/issue914.zep.c new file mode 100644 index 0000000000..8dc74b582e --- /dev/null +++ b/ext/stub/issue914.zep.c @@ -0,0 +1,41 @@ + +#ifdef HAVE_CONFIG_H +#include "../ext_config.h" +#endif + +#include +#include "../php_ext.h" +#include "../ext.h" + +#include +#include +#include + +#include "kernel/main.h" +#include "kernel/fcall.h" +#include "kernel/object.h" +#include "kernel/memory.h" + + +ZEPHIR_INIT_CLASS(Stub_Issue914) +{ + ZEPHIR_REGISTER_CLASS_EX(Stub, Issue914, stub, issue914, zephir_get_internal_ce(SL("mysqli")), stub_issue914_method_entry, 0); + + return SUCCESS; +} + +PHP_METHOD(Stub_Issue914, __construct) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *this_ptr = getThis(); + + + + ZEPHIR_MM_GROW(); + + ZEPHIR_CALL_PARENT(NULL, stub_issue914_ce, getThis(), "__construct", NULL, 0); + zephir_check_call_status(); + ZEPHIR_MM_RESTORE(); +} + diff --git a/ext/stub/issue914.zep.h b/ext/stub/issue914.zep.h new file mode 100644 index 0000000000..6d7521eca8 --- /dev/null +++ b/ext/stub/issue914.zep.h @@ -0,0 +1,18 @@ + +extern zend_class_entry *stub_issue914_ce; + +ZEPHIR_INIT_CLASS(Stub_Issue914); + +PHP_METHOD(Stub_Issue914, __construct); + +ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_issue914___construct, 0, 0, 0) +ZEND_END_ARG_INFO() + +ZEPHIR_INIT_FUNCS(stub_issue914_method_entry) { +#if PHP_VERSION_ID >= 80000 + PHP_ME(Stub_Issue914, __construct, arginfo_stub_issue914___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) +#else + PHP_ME(Stub_Issue914, __construct, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) +#endif + PHP_FE_END +}; From a30708a8910a28800c00e350095f5565fec9cf54 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 25 Apr 2021 00:27:33 +0100 Subject: [PATCH 60/63] #1259 - Fix unset of property when key is variable --- Library/Statements/UnsetStatement.php | 36 +++++++++++++++++++-------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/Library/Statements/UnsetStatement.php b/Library/Statements/UnsetStatement.php index 1a734c03e3..023b26b952 100644 --- a/Library/Statements/UnsetStatement.php +++ b/Library/Statements/UnsetStatement.php @@ -101,22 +101,36 @@ public function compile(CompilationContext $compilationContext): void */ private function generateUnsetPropertyFromObject(array $expression, CompilationContext $compilationContext): CompilationContext { - $expr = new Expression($expression['left']); + $expr = new Expression($expression['right']); $expr->setReadOnly(true); $exprVar = $expr->compile($compilationContext); - $variable = $compilationContext->symbolTable->getVariableForWrite($exprVar->getCode(), $compilationContext, $this->statement); - - $temporaryVariableRef = $compilationContext->backend->getVariableCode($variable); - // TODO: Add more types check when parser will support them, see ArrayAccessTest.zep - switch ($expression['right']['type']) { - case 'string': - $compilationContext->codePrinter->output('ZVAL_STR('.$temporaryVariableRef.', "'.$expression['right']['value'].'");'); + switch ($exprVar->getType()) { + case 'variable': + $variable = $compilationContext->symbolTable->getVariableForRead($exprVar->getCode(), $compilationContext, $this->statement); + $variableRef = $compilationContext->backend->getVariableCode($variable); break; - case 'int': - $compilationContext->codePrinter->output('ZVAL_LONG('.$temporaryVariableRef.', '.$expression['right']['value'].');'); + default: + $expr = new Expression($expression['left']); + $expr->setReadOnly(true); + $exprVar = $expr->compile($compilationContext); + $variable = $compilationContext->symbolTable->getVariableForWrite($exprVar->getCode(), $compilationContext, $this->statement); + + $variableRef = $compilationContext->backend->getVariableCode($variable); + + // TODO: Add more types check when parser will support them, see ArrayAccessTest.zep + switch ($expression['right']['type']) { + case 'string': + $compilationContext->codePrinter->output('ZVAL_STR('.$variableRef.', "'.$expression['right']['value'].'");'); + break; + + case 'int': + $compilationContext->codePrinter->output('ZVAL_LONG('.$variableRef.', '.$expression['right']['value'].');'); + break; + } break; + } $expr = new Expression($expression['left']['left']); @@ -127,7 +141,7 @@ private function generateUnsetPropertyFromObject(array $expression, CompilationC $compilationContext->headersManager->add('kernel/object'); $compilationContext->codePrinter->output( - 'zephir_unset_property_array('.$variableCode.', ZEND_STRL("'.$expression['left']['right']['value'].'"), '.$temporaryVariableRef.');' + 'zephir_unset_property_array('.$variableCode.', ZEND_STRL("'.$expression['left']['right']['value'].'"), '.$variableRef.');' ); return $compilationContext; From 1c637ee0637a39ee99df3e589b8df3315fc4195e Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 25 Apr 2021 00:29:00 +0100 Subject: [PATCH 61/63] #1259 - Add test case --- ext/stub/arrayaccessobj.zep.c | 8 +-- ext/stub/arrayaccesstest.zep.c | 97 ++++++++++++++++++++++++++--- ext/stub/arrayaccesstest.zep.h | 14 +++++ ext/stub/unsettest.zep.c | 8 +-- stub/arrayaccesstest.zep | 17 +++++ tests/Extension/ArrayAccessTest.php | 16 +++++ 6 files changed, 142 insertions(+), 18 deletions(-) diff --git a/ext/stub/arrayaccessobj.zep.c b/ext/stub/arrayaccessobj.zep.c index 900a9de412..9c6ea823ca 100644 --- a/ext/stub/arrayaccessobj.zep.c +++ b/ext/stub/arrayaccessobj.zep.c @@ -96,12 +96,11 @@ PHP_METHOD(Stub_ArrayAccessObj, offsetExists) PHP_METHOD(Stub_ArrayAccessObj, offsetUnset) { - zval *offset, offset_sub, _0, _1; + zval *offset, offset_sub, _0; zval *this_ptr = getThis(); ZVAL_UNDEF(&offset_sub); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) @@ -113,10 +112,9 @@ PHP_METHOD(Stub_ArrayAccessObj, offsetUnset) zephir_fetch_params_without_memory_grow(1, 0, &offset); + zephir_unset_property_array(this_ptr, ZEND_STRL("test"), offset); zephir_read_property(&_0, this_ptr, ZEND_STRL("test"), PH_NOISY_CC | PH_READONLY); - zephir_unset_property_array(this_ptr, ZEND_STRL("test"), &_0); - zephir_read_property(&_1, this_ptr, ZEND_STRL("test"), PH_NOISY_CC | PH_READONLY); - zephir_array_unset(&_1, offset, PH_SEPARATE); + zephir_array_unset(&_0, offset, PH_SEPARATE); } PHP_METHOD(Stub_ArrayAccessObj, offsetGet) diff --git a/ext/stub/arrayaccesstest.zep.c b/ext/stub/arrayaccesstest.zep.c index 510ee5b3a6..35f2f3e1f3 100644 --- a/ext/stub/arrayaccesstest.zep.c +++ b/ext/stub/arrayaccesstest.zep.c @@ -16,9 +16,9 @@ #include "kernel/fcall.h" #include "kernel/array.h" #include "kernel/object.h" -#include "kernel/operators.h" #include "ext/spl/spl_exceptions.h" #include "kernel/exception.h" +#include "kernel/operators.h" ZEPHIR_INIT_CLASS(Stub_ArrayAccessTest) @@ -26,6 +26,7 @@ ZEPHIR_INIT_CLASS(Stub_ArrayAccessTest) ZEPHIR_REGISTER_CLASS(Stub, ArrayAccessTest, stub, arrayaccesstest, stub_arrayaccesstest_method_entry, 0); zend_declare_property_null(stub_arrayaccesstest_ce, SL("data"), ZEND_ACC_PROTECTED); + zend_declare_property_null(stub_arrayaccesstest_ce, SL("assigedFromMethod"), ZEND_ACC_PROTECTED); zend_declare_property_null(stub_arrayaccesstest_ce, SL("unsetData"), ZEND_ACC_PROTECTED); stub_arrayaccesstest_ce->create_object = zephir_init_properties_Stub_ArrayAccessTest; @@ -68,10 +69,90 @@ PHP_METHOD(Stub_ArrayAccessTest, get) object_init_ex(&arr, stub_arrayaccessobj_ce); ZEPHIR_CALL_METHOD(NULL, &arr, "__construct", NULL, 3); zephir_check_call_status(); - zephir_array_fetch_string(&_0, &arr, SL("two"), PH_NOISY | PH_READONLY, "stub/arrayaccesstest.zep", 28); + zephir_array_fetch_string(&_0, &arr, SL("two"), PH_NOISY | PH_READONLY, "stub/arrayaccesstest.zep", 29); RETURN_CTOR(&_0); } +PHP_METHOD(Stub_ArrayAccessTest, unsetByKeyFromArray) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval data; + zval *key_param = NULL, *data_param = NULL; + zval key; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&key); + ZVAL_UNDEF(&data); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_STR(key) + Z_PARAM_ARRAY(data) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &key_param, &data_param); + if (UNEXPECTED(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(key_param) == IS_STRING)) { + zephir_get_strval(&key, key_param); + } else { + ZEPHIR_INIT_VAR(&key); + ZVAL_EMPTY_STRING(&key); + } + zephir_get_arrval(&data, data_param); + + + zephir_array_unset(&data, &key, PH_SEPARATE); + RETURN_CTOR(&data); +} + +PHP_METHOD(Stub_ArrayAccessTest, unsetByKeyFromProperty) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval dataFromProperty; + zval *key_param = NULL, *dataFromProperty_param = NULL, _0; + zval key; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&key); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&dataFromProperty); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_STR(key) + Z_PARAM_ARRAY(dataFromProperty) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &key_param, &dataFromProperty_param); + if (UNEXPECTED(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(key_param) == IS_STRING)) { + zephir_get_strval(&key, key_param); + } else { + ZEPHIR_INIT_VAR(&key); + ZVAL_EMPTY_STRING(&key); + } + zephir_get_arrval(&dataFromProperty, dataFromProperty_param); + + + zephir_update_property_zval(this_ptr, ZEND_STRL("assigedFromMethod"), &dataFromProperty); + zephir_unset_property_array(this_ptr, ZEND_STRL("assigedFromMethod"), &key); + zephir_read_property(&_0, this_ptr, ZEND_STRL("assigedFromMethod"), PH_NOISY_CC | PH_READONLY); + zephir_array_unset(&_0, &key, PH_SEPARATE); + RETURN_MM_MEMBER(getThis(), "assigedFromMethod"); +} + /** * @issue https://github.com/zephir-lang/zephir/issues/645 */ @@ -357,9 +438,9 @@ PHP_METHOD(Stub_ArrayAccessTest, issue1259UnsetKeyFromArrayInternalVariable) zephir_create_array(&unsetData, 2, 0); add_assoc_stringl_ex(&unsetData, SL("key_a"), SL("marcin")); add_assoc_stringl_ex(&unsetData, SL("key_b"), SL("paula")); - zephir_array_append(&ret, &unsetData, PH_SEPARATE, "stub/arrayaccesstest.zep", 137); + zephir_array_append(&ret, &unsetData, PH_SEPARATE, "stub/arrayaccesstest.zep", 154); zephir_array_unset_string(&unsetData, SL("key_a"), PH_SEPARATE); - zephir_array_append(&ret, &unsetData, PH_SEPARATE, "stub/arrayaccesstest.zep", 139); + zephir_array_append(&ret, &unsetData, PH_SEPARATE, "stub/arrayaccesstest.zep", 156); RETURN_CTOR(&ret); } @@ -385,14 +466,14 @@ PHP_METHOD(Stub_ArrayAccessTest, issue1259UnsetStringKeyFromArrayProperty) ZEPHIR_INIT_VAR(&ret); array_init(&ret); zephir_read_property(&_0, this_ptr, ZEND_STRL("unsetData"), PH_NOISY_CC | PH_READONLY); - zephir_array_append(&ret, &_0, PH_SEPARATE, "stub/arrayaccesstest.zep", 151); + zephir_array_append(&ret, &_0, PH_SEPARATE, "stub/arrayaccesstest.zep", 168); zephir_read_property(&_1, this_ptr, ZEND_STRL("unsetData"), PH_NOISY_CC | PH_READONLY); ZVAL_STR(&_1, "key_a"); zephir_unset_property_array(this_ptr, ZEND_STRL("unsetData"), &_1); zephir_read_property(&_2, this_ptr, ZEND_STRL("unsetData"), PH_NOISY_CC | PH_READONLY); zephir_array_unset_string(&_2, SL("key_a"), PH_SEPARATE); zephir_read_property(&_3, this_ptr, ZEND_STRL("unsetData"), PH_NOISY_CC | PH_READONLY); - zephir_array_append(&ret, &_3, PH_SEPARATE, "stub/arrayaccesstest.zep", 153); + zephir_array_append(&ret, &_3, PH_SEPARATE, "stub/arrayaccesstest.zep", 170); RETURN_CTOR(&ret); } @@ -415,14 +496,14 @@ PHP_METHOD(Stub_ArrayAccessTest, issue1259UnsetLongKeyFromArrayProperty) ZEPHIR_INIT_VAR(&ret); array_init(&ret); zephir_read_property(&_0, this_ptr, ZEND_STRL("unsetData"), PH_NOISY_CC | PH_READONLY); - zephir_array_append(&ret, &_0, PH_SEPARATE, "stub/arrayaccesstest.zep", 162); + zephir_array_append(&ret, &_0, PH_SEPARATE, "stub/arrayaccesstest.zep", 179); zephir_read_property(&_1, this_ptr, ZEND_STRL("unsetData"), PH_NOISY_CC | PH_READONLY); ZVAL_LONG(&_1, 3); zephir_unset_property_array(this_ptr, ZEND_STRL("unsetData"), &_1); zephir_read_property(&_2, this_ptr, ZEND_STRL("unsetData"), PH_NOISY_CC | PH_READONLY); zephir_array_unset_long(&_2, 3, PH_SEPARATE); zephir_read_property(&_3, this_ptr, ZEND_STRL("unsetData"), PH_NOISY_CC | PH_READONLY); - zephir_array_append(&ret, &_3, PH_SEPARATE, "stub/arrayaccesstest.zep", 164); + zephir_array_append(&ret, &_3, PH_SEPARATE, "stub/arrayaccesstest.zep", 181); RETURN_CTOR(&ret); } diff --git a/ext/stub/arrayaccesstest.zep.h b/ext/stub/arrayaccesstest.zep.h index 830e2881ed..4a4542a78e 100644 --- a/ext/stub/arrayaccesstest.zep.h +++ b/ext/stub/arrayaccesstest.zep.h @@ -5,6 +5,8 @@ ZEPHIR_INIT_CLASS(Stub_ArrayAccessTest); PHP_METHOD(Stub_ArrayAccessTest, exits); PHP_METHOD(Stub_ArrayAccessTest, get); +PHP_METHOD(Stub_ArrayAccessTest, unsetByKeyFromArray); +PHP_METHOD(Stub_ArrayAccessTest, unsetByKeyFromProperty); PHP_METHOD(Stub_ArrayAccessTest, issue645); PHP_METHOD(Stub_ArrayAccessTest, issue1155); PHP_METHOD(Stub_ArrayAccessTest, issue1094Test1); @@ -25,6 +27,16 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayaccesstest_get, 0, 0, 0) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccesstest_unsetbykeyfromarray, 0, 2, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0) + ZEND_ARG_ARRAY_INFO(0, data, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccesstest_unsetbykeyfromproperty, 0, 2, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0) + ZEND_ARG_ARRAY_INFO(0, dataFromProperty, 0) +ZEND_END_ARG_INFO() + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccesstest_issue645, 0, 0, IS_ARRAY, 0) ZEND_END_ARG_INFO() @@ -92,6 +104,8 @@ ZEPHIR_INIT_FUNCS(stub_arrayaccesstest_method_entry) { #else PHP_ME(Stub_ArrayAccessTest, get, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) #endif + PHP_ME(Stub_ArrayAccessTest, unsetByKeyFromArray, arginfo_stub_arrayaccesstest_unsetbykeyfromarray, ZEND_ACC_PUBLIC) + PHP_ME(Stub_ArrayAccessTest, unsetByKeyFromProperty, arginfo_stub_arrayaccesstest_unsetbykeyfromproperty, ZEND_ACC_PUBLIC) PHP_ME(Stub_ArrayAccessTest, issue645, arginfo_stub_arrayaccesstest_issue645, ZEND_ACC_PUBLIC) PHP_ME(Stub_ArrayAccessTest, issue1155, arginfo_stub_arrayaccesstest_issue1155, ZEND_ACC_PUBLIC) PHP_ME(Stub_ArrayAccessTest, issue1094Test1, arginfo_stub_arrayaccesstest_issue1094test1, ZEND_ACC_PUBLIC) diff --git a/ext/stub/unsettest.zep.c b/ext/stub/unsettest.zep.c index a5faf439c2..c638e61dc0 100644 --- a/ext/stub/unsettest.zep.c +++ b/ext/stub/unsettest.zep.c @@ -84,12 +84,11 @@ PHP_METHOD(Stub_Unsettest, addValueToProperty) PHP_METHOD(Stub_Unsettest, testUnsetValueFromProperty) { - zval *key, key_sub, _0, _1; + zval *key, key_sub, _0; zval *this_ptr = getThis(); ZVAL_UNDEF(&key_sub); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) @@ -101,10 +100,9 @@ PHP_METHOD(Stub_Unsettest, testUnsetValueFromProperty) zephir_fetch_params_without_memory_grow(1, 0, &key); + zephir_unset_property_array(this_ptr, ZEND_STRL("property"), key); zephir_read_property(&_0, this_ptr, ZEND_STRL("property"), PH_NOISY_CC | PH_READONLY); - zephir_unset_property_array(this_ptr, ZEND_STRL("property"), &_0); - zephir_read_property(&_1, this_ptr, ZEND_STRL("property"), PH_NOISY_CC | PH_READONLY); - zephir_array_unset(&_1, key, PH_SEPARATE); + zephir_array_unset(&_0, key, PH_SEPARATE); } PHP_METHOD(Stub_Unsettest, testUnsetFromArray) diff --git a/stub/arrayaccesstest.zep b/stub/arrayaccesstest.zep index 82b4fbd841..4ddc9ab1bf 100644 --- a/stub/arrayaccesstest.zep +++ b/stub/arrayaccesstest.zep @@ -3,6 +3,7 @@ namespace Stub; class ArrayAccessTest { protected data; + protected assigedFromMethod; protected unsetData = [ "key_a": "marcin", "key_b": "paula", @@ -28,6 +29,22 @@ class ArrayAccessTest return arr["two"]; } + public function unsetByKeyFromArray(string! key, array data) -> array + { + unset data[key]; + + return data; + } + + public function unsetByKeyFromProperty(string! key, array dataFromProperty) -> array + { + let this->assigedFromMethod = dataFromProperty; + + unset this->assigedFromMethod[key]; + + return this->assigedFromMethod; + } + /** * @issue https://github.com/zephir-lang/zephir/issues/645 */ diff --git a/tests/Extension/ArrayAccessTest.php b/tests/Extension/ArrayAccessTest.php index ff8f562b0a..97a40d729e 100644 --- a/tests/Extension/ArrayAccessTest.php +++ b/tests/Extension/ArrayAccessTest.php @@ -34,6 +34,22 @@ public function testTest(): void $this->assertSame(2, $class->get()); } + public function testUnsetByKeyFromArray(): void + { + $class = new \Stub\ArrayAccessTest(); + + $this->assertSame([], $class->unsetByKeyFromArray('not-exist', [])); + } + + public function testUnsetByKeyFromProperty(): void + { + $class = new \Stub\ArrayAccessTest(); + + $this->assertSame([], $class->unsetByKeyFromProperty('ok', ['ok' => true])); + $this->assertSame(['another' => 'value'], $class->unsetByKeyFromProperty('ok', ['ok' => true, 'another' => 'value'])); + $this->assertSame([], $class->unsetByKeyFromProperty('not-exist', [])); + } + /** * @issue https://github.com/zephir-lang/zephir/issues/645 */ From 660dd4bb3b07fcaa1544e7a99c802c5c54b55841 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 25 Apr 2021 00:31:04 +0100 Subject: [PATCH 62/63] #1259 - Fix code style --- Library/Statements/UnsetStatement.php | 1 - 1 file changed, 1 deletion(-) diff --git a/Library/Statements/UnsetStatement.php b/Library/Statements/UnsetStatement.php index 023b26b952..18922c8315 100644 --- a/Library/Statements/UnsetStatement.php +++ b/Library/Statements/UnsetStatement.php @@ -130,7 +130,6 @@ private function generateUnsetPropertyFromObject(array $expression, CompilationC break; } break; - } $expr = new Expression($expression['left']['left']); From 8b9c91483d2e413032f3666b25ba1c8f04f23cc2 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 25 Apr 2021 10:14:56 +0100 Subject: [PATCH 63/63] Update release date --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aa44093ad1..1af8ac9f1b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org). ## [Unreleased] -## [0.13.3] - 2021-04-24 +## [0.13.3] - 2021-04-25 ### Fixed - Fixed nullable array [#1094](https://github.com/zephir-lang/zephir/issues/1094) - Fixed default value detection with Reflection (only PHP 8.0) [#1134](https://github.com/zephir-lang/zephir/issues/1134)