From 8b2e5cf835846d5f7ff0a01306a68286673499d6 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sat, 7 Aug 2021 10:48:08 +0100 Subject: [PATCH 01/39] #2254 - Add composer token --- .github/workflows/build-unix.yml | 2 ++ .github/workflows/build-windows.yml | 1 + 2 files changed, 3 insertions(+) diff --git a/.github/workflows/build-unix.yml b/.github/workflows/build-unix.yml index f2d137781..42e8dfa19 100644 --- a/.github/workflows/build-unix.yml +++ b/.github/workflows/build-unix.yml @@ -62,6 +62,8 @@ jobs: memory_limit=1G, date.timezone=UTC, xdebug.max_nesting_level=256 + env: + COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Checkout Code uses: actions/checkout@v2 diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index 3cfc84433..243aa0f0b 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -67,6 +67,7 @@ jobs: xdebug.max_nesting_level=256 env: PHPTS: ${{ matrix.build_type }} + COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Set Environment Variables run: | From d06c905e1a12372019e4ba5e6df16f3b8d20baef Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sat, 7 Aug 2021 11:08:58 +0100 Subject: [PATCH 02/39] #2254 - Remove deprecated option `--no-suggest` --- .github/workflows/build-unix.yml | 2 +- .github/workflows/build-windows.yml | 2 +- .github/workflows/release.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-unix.yml b/.github/workflows/build-unix.yml index 42e8dfa19..a51c311d4 100644 --- a/.github/workflows/build-unix.yml +++ b/.github/workflows/build-unix.yml @@ -127,7 +127,7 @@ jobs: ${{ runner.os }}-composer- - name: Install Project Dependencies for PHP - run: composer install --prefer-dist --no-interaction --no-ansi --no-progress --no-suggest + run: composer install --prefer-dist --no-interaction --no-ansi --no-progress - name: Prepare Zephir Executable run: sudo ln -s "$(pwd)/zephir" /usr/local/bin/zephir diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index 243aa0f0b..a131d4cd3 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -158,7 +158,7 @@ jobs: fi - name: Install Project Dependencies - run: composer install --prefer-dist --no-interaction --no-ansi --no-progress --no-suggest + run: composer install --prefer-dist --no-interaction --no-ansi --no-progress - name: Initialize Release Variables run: | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 03cc64f2b..2d6caf8b7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -39,7 +39,7 @@ jobs: ${{ runner.os }}-composer- - name: Install Project Dependencies - run: composer install --prefer-dist --no-interaction --no-ansi --no-progress --no-suggest + run: composer install --prefer-dist --no-interaction --no-ansi --no-progress - name: Install Box run: | From fd10b8c3acc59ca4e350234a2bd476a94ce26595 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sat, 7 Aug 2021 11:10:59 +0100 Subject: [PATCH 03/39] #2254 - Fix composer token --- .github/workflows/build-unix.yml | 2 +- .github/workflows/build-windows.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-unix.yml b/.github/workflows/build-unix.yml index a51c311d4..922d14bc9 100644 --- a/.github/workflows/build-unix.yml +++ b/.github/workflows/build-unix.yml @@ -63,7 +63,7 @@ jobs: date.timezone=UTC, xdebug.max_nesting_level=256 env: - COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} + COMPOSER_TOKEN: ${{ secrets.COMPOSER_TOKEN }} - name: Checkout Code uses: actions/checkout@v2 diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index a131d4cd3..353bdb3b2 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -67,7 +67,7 @@ jobs: xdebug.max_nesting_level=256 env: PHPTS: ${{ matrix.build_type }} - COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} + COMPOSER_TOKEN: ${{ secrets.COMPOSER_TOKEN }} - name: Set Environment Variables run: | From 479cce51a52b02bd0945be3ac6797b7805fe25b2 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sat, 7 Aug 2021 11:52:06 +0100 Subject: [PATCH 04/39] #2254 - Change to `GITHUB_TOKEN` --- .github/workflows/build-unix.yml | 2 +- .github/workflows/build-windows.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-unix.yml b/.github/workflows/build-unix.yml index 922d14bc9..a51c311d4 100644 --- a/.github/workflows/build-unix.yml +++ b/.github/workflows/build-unix.yml @@ -63,7 +63,7 @@ jobs: date.timezone=UTC, xdebug.max_nesting_level=256 env: - COMPOSER_TOKEN: ${{ secrets.COMPOSER_TOKEN }} + COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Checkout Code uses: actions/checkout@v2 diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index 353bdb3b2..a131d4cd3 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -67,7 +67,7 @@ jobs: xdebug.max_nesting_level=256 env: PHPTS: ${{ matrix.build_type }} - COMPOSER_TOKEN: ${{ secrets.COMPOSER_TOKEN }} + COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Set Environment Variables run: | From 0c710168d563b04e0e77b31ebfc4056dfaf11050 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sat, 7 Aug 2021 12:18:34 +0100 Subject: [PATCH 05/39] #2254 - Remove 'Setup GitHub Token' step --- .github/workflows/build-windows.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index a131d4cd3..6f9c912ca 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -149,14 +149,6 @@ jobs: restore-keys: | ${{ runner.os }}-composer- - - name: Setup GitHub Token - shell: bash - run: | - # To increase the GitHub rate limit we're use GitHub authentication - if [ ! -z '${{ secrets.COMPOSER_TOKEN }}' ]; then - composer config github-oauth.github.com ${{ secrets.COMPOSER_TOKEN }} - fi - - name: Install Project Dependencies run: composer install --prefer-dist --no-interaction --no-ansi --no-progress From 9983df53e1e66211598663ab61d7434c91adfae3 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Wed, 11 Aug 2021 21:32:13 +0100 Subject: [PATCH 06/39] #2253 - Add `RequireOnceStatement` class --- Library/Statements/RequireOnceStatement.php | 46 +++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 Library/Statements/RequireOnceStatement.php diff --git a/Library/Statements/RequireOnceStatement.php b/Library/Statements/RequireOnceStatement.php new file mode 100644 index 000000000..b6046c355 --- /dev/null +++ b/Library/Statements/RequireOnceStatement.php @@ -0,0 +1,46 @@ + + * + * For the full copyright and license information, please view + * 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\Expression; + +/** + * RequireOnceStatement. + * + * Require once statement is used to execute PHP scripts in a given path + */ +class RequireOnceStatement extends StatementAbstract +{ + /** + * @param CompilationContext $compilationContext + * + * @throws Exception + */ + public function compile(CompilationContext $compilationContext) + { + $expression = [ + 'type' => 'require_once', + 'left' => $this->statement['expr'], + 'file' => $this->statement['file'], + 'line' => $this->statement['line'], + 'char' => $this->statement['char'], + ]; + + $expr = new Expression($expression); + $expr->setExpectReturn(false, null); + $expr->compile($compilationContext); + } +} From f4264d83ca507e7ac36d0c75ccc9223441247ae3 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Wed, 11 Aug 2021 21:41:25 +0100 Subject: [PATCH 07/39] #2253 - Add `RequireOnceOperator` class --- Library/Expression.php | 8 +- .../Operators/Other/RequireOnceOperator.php | 86 +++++++++++++++++++ 2 files changed, 91 insertions(+), 3 deletions(-) create mode 100644 Library/Operators/Other/RequireOnceOperator.php diff --git a/Library/Expression.php b/Library/Expression.php index bea5ddc12..b9fd3f0aa 100644 --- a/Library/Expression.php +++ b/Library/Expression.php @@ -55,6 +55,7 @@ use Zephir\Operators\Other\NewInstanceTypeOperator; use Zephir\Operators\Other\RangeExclusiveOperator; use Zephir\Operators\Other\RangeInclusiveOperator; +use Zephir\Operators\Other\RequireOnceOperator; use Zephir\Operators\Other\RequireOperator; use Zephir\Operators\Other\ShortTernaryOperator; use Zephir\Operators\Other\TernaryOperator; @@ -575,6 +576,10 @@ public function compile(CompilationContext $compilationContext): CompiledExpress $compilableExpression = new RequireOperator(); break; + case 'require_once': + $compilableExpression = new RequireOnceOperator(); + break; + case 'closure': $compilableExpression = new Closure(); break; @@ -591,9 +596,6 @@ public function compile(CompilationContext $compilationContext): CompiledExpress throw new CompilerException('Unknown expression: '.$type, $expression); } - if (!$compilableExpression) { - throw new CompilerException('Unknown expression passed as compilableExpression', $expression); - } $compilableExpression->setReadOnly($this->isReadOnly()); $compilableExpression->setExpectReturn($this->expecting, $this->expectingVariable); diff --git a/Library/Operators/Other/RequireOnceOperator.php b/Library/Operators/Other/RequireOnceOperator.php new file mode 100644 index 000000000..b1f89cd1b --- /dev/null +++ b/Library/Operators/Other/RequireOnceOperator.php @@ -0,0 +1,86 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Operators\Other; + +use Zephir\CompilationContext; +use Zephir\CompiledExpression; +use Zephir\Exception; +use Zephir\Expression; +use Zephir\Operators\BaseOperator; + +/** + * Require once. + * + * Includes once a plain PHP file + */ +class RequireOnceOperator extends BaseOperator +{ + /** + * @param array $expression + * @param CompilationContext $compilationContext + * + * @return CompiledExpression + * @throws Exception + */ + public function compile(array $expression, CompilationContext $compilationContext): CompiledExpression + { + $expr = new Expression($expression['left']); + $expr->setReadOnly(true); + $expr->setExpectReturn(true); + + $exprPath = $expr->compile($compilationContext); + if ('variable' === $exprPath->getType()) { + $exprVariable = $compilationContext->symbolTable->getVariableForRead($exprPath->getCode(), $compilationContext, $expression); + $exprVar = $compilationContext->backend->getVariableCode($exprVariable); + if ('variable' === $exprVariable->getType()) { + if ($exprVariable->hasDifferentDynamicType(['undefined', 'string'])) { + $compilationContext->logger->warning( + 'Possible attempt to use invalid type as path in "require_once" operator', + ['non-valid-require-once', $expression] + ); + } + } + } else { + $exprVar = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext, $expression); + $compilationContext->backend->assignString($exprVar, $exprPath->getCode(), $compilationContext); + $exprVar = $compilationContext->backend->getVariableCode($exprVar); + } + + $symbolVariable = false; + if ($this->isExpecting()) { + $symbolVariable = $compilationContext->symbolTable->getTempVariableForObserveOrNullify('variable', $compilationContext, $expression); + } + + $compilationContext->headersManager->add('kernel/memory'); + $compilationContext->headersManager->add('kernel/require'); + + $codePrinter = $compilationContext->codePrinter; + + if ($symbolVariable) { + $codePrinter->output('ZEPHIR_OBSERVE_OR_NULLIFY_PPZV(&'.$symbolVariable->getName().');'); + $symbol = $compilationContext->backend->getVariableCodePointer($symbolVariable); + $codePrinter->output('if (zephir_require_zval_ret('.$symbol.', '.$exprVar.') == FAILURE) {'); + } else { + $codePrinter->output('if (zephir_require_zval('.$exprVar.') == FAILURE) {'); + } + $codePrinter->output("\t".'RETURN_MM_NULL();'); + $codePrinter->output('}'); + + if ($symbolVariable) { + return new CompiledExpression('variable', $symbolVariable->getName(), $expression); + } + + return new CompiledExpression('null', null, $expression); + } +} From 785ed7034508e29fa192ead2ab69b226fe50d50d Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Fri, 13 Aug 2021 23:08:31 +0100 Subject: [PATCH 08/39] #2253 - Bump `ZEPHIR_PARSER_VERSION` to v1.3.7 --- .github/workflows/build-unix.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-unix.yml b/.github/workflows/build-unix.yml index a51c311d4..b9e8b8ef8 100644 --- a/.github/workflows/build-unix.yml +++ b/.github/workflows/build-unix.yml @@ -11,7 +11,7 @@ on: - development env: - ZEPHIR_PARSER_VERSION: v1.3.6 + ZEPHIR_PARSER_VERSION: v1.3.7 jobs: linux: From e254f4da666f4517008b5c1350fc8db2cf978445 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Fri, 13 Aug 2021 23:30:27 +0100 Subject: [PATCH 09/39] #2253 - Remove declaration of unused function `zephir_require` --- kernels/ZendEngine3/require.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/kernels/ZendEngine3/require.h b/kernels/ZendEngine3/require.h index 30a2bca86..5be631730 100755 --- a/kernels/ZendEngine3/require.h +++ b/kernels/ZendEngine3/require.h @@ -16,11 +16,6 @@ int zephir_require_ret(zval *return_value_ptr, const char *require_path) ZEPHIR_ATTR_NONNULL1(2); -ZEPHIR_ATTR_NONNULL static inline int zephir_require(const char *require_path) -{ - return zephir_require_ret(NULL, require_path); -} - ZEPHIR_ATTR_NONNULL static inline int zephir_require_zval(const zval *require_path) { return zephir_require_ret(NULL, Z_TYPE_P(require_path) == IS_STRING ? Z_STRVAL_P(require_path) : ""); From 1fd00d7caf12779477228b2178a4c172442da169 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sat, 14 Aug 2021 20:59:22 +0100 Subject: [PATCH 10/39] #2253 - Implement `zephir_require_once_ret()` function --- kernels/ZendEngine3/require.c | 73 +++++++++++++++++++++++++++++++++++ kernels/ZendEngine3/require.h | 11 ++++++ 2 files changed, 84 insertions(+) diff --git a/kernels/ZendEngine3/require.c b/kernels/ZendEngine3/require.c index 2bab5554c..731156f27 100755 --- a/kernels/ZendEngine3/require.c +++ b/kernels/ZendEngine3/require.c @@ -89,3 +89,76 @@ int zephir_require_ret(zval *return_value_ptr, const char *require_path) return FAILURE; } + +/** + * Do an internal require once to a plain php file taking care of the value returned by the file + */ +int zephir_require_once_ret(zval *return_value_ptr, const char *require_path) +{ + zend_file_handle file_handle; + zend_op_array *new_op_array; + zval dummy, local_retval; + zend_string *resolved_path; + int ret; + + ZVAL_UNDEF(&local_retval); + +#ifndef ZEPHIR_RELEASE + if (return_value_ptr != NULL && Z_TYPE_P(return_value_ptr) > IS_NULL) { + fprintf(stderr, "%s: *return_value_ptr is expected to be NULL", __func__); + zephir_print_backtrace(); + abort(); + } +#endif + + resolved_path = zend_resolve_path(require_path, SL(require_path)); + if (EXPECTED(resolved_path)) { + if (zend_hash_exists(&EG(included_files), resolved_path)) { + zend_string_release_ex(resolved_path, 0); + return SUCCESS; + } + } + + ret = php_stream_open_for_zend_ex(require_path, &file_handle, USE_PATH|STREAM_OPEN_FOR_INCLUDE); + if (ret != SUCCESS) { + return FAILURE; + } + + new_op_array = zend_compile_file(&file_handle, ZEND_INCLUDE); + if (new_op_array) { + if (file_handle.handle.stream.handle) { + ZVAL_NULL(&dummy); + if (!file_handle.opened_path) { + file_handle.opened_path = zend_string_init(require_path, strlen(require_path), 0); + } + + zend_hash_add_empty_element(&EG(included_files), file_handle.opened_path); + zend_destroy_file_handle(&file_handle); + } + + new_op_array->scope = EG(fake_scope) ? EG(fake_scope) : zend_get_executed_scope(); + zend_execute(new_op_array, &local_retval); + + if (return_value_ptr) { + zval_ptr_dtor(return_value_ptr); + ZVAL_COPY_VALUE(return_value_ptr, &local_retval); + } else { + zval_ptr_dtor(&local_retval); + } + + destroy_op_array(new_op_array); + efree_size(new_op_array, sizeof(zend_op_array)); + + if (EG(exception)) { + ret = FAILURE; + } else { + ret = SUCCESS; + } + + return ret; + } else { + zend_destroy_file_handle(&file_handle); + } + + return FAILURE; +} diff --git a/kernels/ZendEngine3/require.h b/kernels/ZendEngine3/require.h index 5be631730..293eb1c55 100755 --- a/kernels/ZendEngine3/require.h +++ b/kernels/ZendEngine3/require.h @@ -15,6 +15,7 @@ #include "php_ext.h" int zephir_require_ret(zval *return_value_ptr, const char *require_path) ZEPHIR_ATTR_NONNULL1(2); +int zephir_require_once_ret(zval *return_value_ptr, const char *require_path) ZEPHIR_ATTR_NONNULL1(2); ZEPHIR_ATTR_NONNULL static inline int zephir_require_zval(const zval *require_path) { @@ -26,4 +27,14 @@ ZEPHIR_ATTR_NONNULL static inline int zephir_require_zval_ret(zval *return_value return zephir_require_ret(return_value_ptr, Z_TYPE_P(require_path) == IS_STRING ? Z_STRVAL_P(require_path) : ""); } +ZEPHIR_ATTR_NONNULL static inline int zephir_require_once_zval(const zval *require_path) +{ + return zephir_require_once_ret(NULL, Z_TYPE_P(require_path) == IS_STRING ? Z_STRVAL_P(require_path) : ""); +} + +ZEPHIR_ATTR_NONNULL static inline int zephir_require_once_zval_ret(zval *return_value_ptr, const zval *require_path) +{ + return zephir_require_once_ret(return_value_ptr, Z_TYPE_P(require_path) == IS_STRING ? Z_STRVAL_P(require_path) : ""); +} + #endif /* ZEPHIR_KERNEL_REQUIRE_H */ From dc5d7674022aaabc3ab3a18e084cba7884507ecb Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sat, 14 Aug 2021 21:00:14 +0100 Subject: [PATCH 11/39] #2253 - Add support of `require_once` in Zephir --- Library/Detectors/WriteDetector.php | 2 ++ Library/Expression/Builder/Operators/UnaryOperator.php | 3 +++ Library/Passes/CallGathererPass.php | 2 ++ Library/Passes/LocalContextPass.php | 3 +++ Library/Passes/MutateGathererPass.php | 2 ++ Library/Passes/StaticTypeInference.php | 2 ++ Library/StatementsBlock.php | 7 +++++++ 7 files changed, 21 insertions(+) diff --git a/Library/Detectors/WriteDetector.php b/Library/Detectors/WriteDetector.php index d2e93c8e1..05a5e1ebd 100644 --- a/Library/Detectors/WriteDetector.php +++ b/Library/Detectors/WriteDetector.php @@ -280,6 +280,7 @@ public function passExpression(array $expression) case 'empty': case 'instanceof': case 'require': + case 'require_once': case 'clone': case 'likely': case 'unlikely': @@ -432,6 +433,7 @@ public function passStatementBlock(array $statements) case 'scall': case 'fcall': case 'require': + case 'require_once': $this->passCall($statement['expr']); break; diff --git a/Library/Expression/Builder/Operators/UnaryOperator.php b/Library/Expression/Builder/Operators/UnaryOperator.php index a4b5d04c7..a0f6168a3 100644 --- a/Library/Expression/Builder/Operators/UnaryOperator.php +++ b/Library/Expression/Builder/Operators/UnaryOperator.php @@ -41,6 +41,9 @@ class UnaryOperator extends AbstractOperator // y = require a const OPERATOR_REQUIRE = 'require'; + // y = require_once a + const OPERATOR_REQUIRE_ONCE = 'require_once'; + // y = clone a const OPERATOR_CLONE = 'clone'; diff --git a/Library/Passes/CallGathererPass.php b/Library/Passes/CallGathererPass.php index 2f09d48b3..b9f848b77 100644 --- a/Library/Passes/CallGathererPass.php +++ b/Library/Passes/CallGathererPass.php @@ -299,6 +299,7 @@ public function passExpression(array $expression) case 'clone': case 'require': + case 'require_once': $this->passExpression($expression['left']); break; @@ -426,6 +427,7 @@ public function passStatementBlock(array $statements) break; case 'require': + case 'require_once': if (isset($statement['expr'])) { $this->passExpression($statement['expr']); } diff --git a/Library/Passes/LocalContextPass.php b/Library/Passes/LocalContextPass.php index d09296eb6..3640e8412 100644 --- a/Library/Passes/LocalContextPass.php +++ b/Library/Passes/LocalContextPass.php @@ -211,6 +211,7 @@ public function passLetStatement(array $statement) case 'concat': case 'clone': case 'require': + case 'require_once': case 'type-hint': case 'minus': case 'new': @@ -415,6 +416,7 @@ public function passExpression(array $expression) case 'empty': case 'instanceof': case 'require': + case 'require_once': case 'clone': case 'likely': case 'unlikely' @@ -570,6 +572,7 @@ public function passStatementBlock(array $statements) case 'scall': case 'fcall': case 'require': + case 'require_once': if ('mcall' == $statement['expr']['type']) { if (isset($statement['expr']['variable'])) { if ('variable' == $statement['expr']['variable']['type']) { diff --git a/Library/Passes/MutateGathererPass.php b/Library/Passes/MutateGathererPass.php index 5758518cf..e7cdc4a21 100644 --- a/Library/Passes/MutateGathererPass.php +++ b/Library/Passes/MutateGathererPass.php @@ -227,6 +227,7 @@ public function passExpression(array $expression) case 'empty': case 'instanceof': case 'require': + case 'require_once': case 'clone': case 'likely': case 'unlikely': @@ -382,6 +383,7 @@ public function passStatementBlock(array $statements) case 'scall': case 'fcall': case 'require': + case 'require_once': $this->passCall($statement['expr']); break; diff --git a/Library/Passes/StaticTypeInference.php b/Library/Passes/StaticTypeInference.php index bcdeac24f..1861012de 100644 --- a/Library/Passes/StaticTypeInference.php +++ b/Library/Passes/StaticTypeInference.php @@ -468,6 +468,7 @@ public function passExpression(array $expression) case 'clone': case 'require': + case 'require_once': return 'variable'; case 'ternary': @@ -592,6 +593,7 @@ public function passStatementBlock(array $statements) case 'scall': case 'fcall': case 'require': + case 'require_once': $this->passCall($statement['expr']); break; diff --git a/Library/StatementsBlock.php b/Library/StatementsBlock.php index 60e3d86dc..8f1a1a86a 100644 --- a/Library/StatementsBlock.php +++ b/Library/StatementsBlock.php @@ -11,6 +11,7 @@ namespace Zephir; +use Zephir\Operators\Other\RequireOnceOperator; use Zephir\Passes\MutateGathererPass; use Zephir\Statements\BreakStatement; use Zephir\Statements\ContinueStatement; @@ -21,6 +22,7 @@ use Zephir\Statements\IfStatement; use Zephir\Statements\LetStatement; use Zephir\Statements\LoopStatement; +use Zephir\Statements\RequireOnceStatement; use Zephir\Statements\RequireStatement; use Zephir\Statements\ReturnStatement; use Zephir\Statements\SwitchStatement; @@ -256,6 +258,11 @@ public function compile(CompilationContext $compilationContext, $unreachable = f $requireStatement->compile($compilationContext); break; + case 'require_once': + $requireOnceStatement = new RequireOnceStatement($statement); + $requireOnceStatement->compile($compilationContext); + break; + case 'loop': $loopStatement = new LoopStatement($statement); $loopStatement->compile($compilationContext); From 78dece55e0b4e96a379d9300b0db96618373db0b Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sat, 14 Aug 2021 21:01:33 +0100 Subject: [PATCH 12/39] #2253 - Add test case for `require_once` --- stub/requires.zep | 5 +++++ tests/Extension/RequiresTest.php | 24 ++++++++++++++++++++---- tests/fixtures/require-me-once.php | 11 +++++++++++ 3 files changed, 36 insertions(+), 4 deletions(-) create mode 100644 tests/fixtures/require-me-once.php diff --git a/stub/requires.zep b/stub/requires.zep index cc5bd2610..061c1c57d 100644 --- a/stub/requires.zep +++ b/stub/requires.zep @@ -48,4 +48,9 @@ class Requires return require templatePath; } + + public function requireOnce(string path) -> var + { + return require_once path; + } } diff --git a/tests/Extension/RequiresTest.php b/tests/Extension/RequiresTest.php index e6d85e045..0038b6143 100644 --- a/tests/Extension/RequiresTest.php +++ b/tests/Extension/RequiresTest.php @@ -1,7 +1,5 @@ test->requireExternal1(__DIR__.'/../fixtures/require-me-1.php') ); - $this->assertFalse(\defined('REQUIRE_ME')); + $this->assertFalse(defined('REQUIRE_ME')); $this->test->requireExternal1(__DIR__.'/../fixtures/require-me-2.php'); - $this->assertTrue(\defined('REQUIRE_ME')); + $this->assertTrue(defined('REQUIRE_ME')); } /** @@ -74,4 +76,18 @@ public function testShouldRequirePhar(): void $this->test->requireExternal1('phar://'.__DIR__.'/../fixtures/requires/myapp.phar/index.php') ); } + + public function testRequireOnce(): void + { + $this->assertSame( + [1, 2, 3], + $this->test->requireOnce(__DIR__.'/../fixtures/require-me-1.php') + ); + + $this->assertFalse(defined('REQUIRE_ONCE_ME')); + $this->test->requireOnce(__DIR__.'/../fixtures/require-me-once.php'); + $this->assertTrue(defined('REQUIRE_ONCE_ME')); + $this->test->requireOnce(__DIR__.'/../fixtures/require-me-once.php'); + $this->assertTrue(defined('REQUIRE_ONCE_ME')); + } } diff --git a/tests/fixtures/require-me-once.php b/tests/fixtures/require-me-once.php new file mode 100644 index 000000000..2668034bd --- /dev/null +++ b/tests/fixtures/require-me-once.php @@ -0,0 +1,11 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +const REQUIRE_ONCE_ME = 43; From c0c09d3f26e942703c6e9be5bf369bbbe3e63b15 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 15 Aug 2021 12:59:59 +0100 Subject: [PATCH 13/39] #2253 - Equalize behavior of `require_once` as in PHP world --- .../Operators/Other/RequireOnceOperator.php | 6 ++--- kernels/ZendEngine3/require.c | 24 ++++++++++++------- tests/Extension/RequiresTest.php | 7 +++++- tests/fixtures/require-me-before-once.php | 12 ++++++++++ 4 files changed, 36 insertions(+), 13 deletions(-) create mode 100644 tests/fixtures/require-me-before-once.php diff --git a/Library/Operators/Other/RequireOnceOperator.php b/Library/Operators/Other/RequireOnceOperator.php index b1f89cd1b..65acfc610 100644 --- a/Library/Operators/Other/RequireOnceOperator.php +++ b/Library/Operators/Other/RequireOnceOperator.php @@ -59,7 +59,7 @@ public function compile(array $expression, CompilationContext $compilationContex $symbolVariable = false; if ($this->isExpecting()) { - $symbolVariable = $compilationContext->symbolTable->getTempVariableForObserveOrNullify('variable', $compilationContext, $expression); + $symbolVariable = $compilationContext->symbolTable->getTempVariableForObserveOrNullify('variable', $compilationContext); } $compilationContext->headersManager->add('kernel/memory'); @@ -70,9 +70,9 @@ public function compile(array $expression, CompilationContext $compilationContex if ($symbolVariable) { $codePrinter->output('ZEPHIR_OBSERVE_OR_NULLIFY_PPZV(&'.$symbolVariable->getName().');'); $symbol = $compilationContext->backend->getVariableCodePointer($symbolVariable); - $codePrinter->output('if (zephir_require_zval_ret('.$symbol.', '.$exprVar.') == FAILURE) {'); + $codePrinter->output('if (zephir_require_once_zval_ret('.$symbol.', '.$exprVar.') == FAILURE) {'); } else { - $codePrinter->output('if (zephir_require_zval('.$exprVar.') == FAILURE) {'); + $codePrinter->output('if (zephir_require_once_zval('.$exprVar.') == FAILURE) {'); } $codePrinter->output("\t".'RETURN_MM_NULL();'); $codePrinter->output('}'); diff --git a/kernels/ZendEngine3/require.c b/kernels/ZendEngine3/require.c index 731156f27..96160ba4e 100755 --- a/kernels/ZendEngine3/require.c +++ b/kernels/ZendEngine3/require.c @@ -98,7 +98,6 @@ int zephir_require_once_ret(zval *return_value_ptr, const char *require_path) zend_file_handle file_handle; zend_op_array *new_op_array; zval dummy, local_retval; - zend_string *resolved_path; int ret; ZVAL_UNDEF(&local_retval); @@ -111,19 +110,26 @@ int zephir_require_once_ret(zval *return_value_ptr, const char *require_path) } #endif - resolved_path = zend_resolve_path(require_path, SL(require_path)); - if (EXPECTED(resolved_path)) { - if (zend_hash_exists(&EG(included_files), resolved_path)) { - zend_string_release_ex(resolved_path, 0); - return SUCCESS; - } - } - ret = php_stream_open_for_zend_ex(require_path, &file_handle, USE_PATH|STREAM_OPEN_FOR_INCLUDE); if (ret != SUCCESS) { return FAILURE; } + if (zend_hash_exists(&EG(included_files), file_handle.opened_path)) { + zend_destroy_file_handle(&file_handle); + + if (return_value_ptr) { + ZVAL_TRUE(&local_retval); + + zval_ptr_dtor(return_value_ptr); + ZVAL_COPY_VALUE(return_value_ptr, &local_retval); + } else { + zval_ptr_dtor(&local_retval); + } + + return SUCCESS; + } + new_op_array = zend_compile_file(&file_handle, ZEND_INCLUDE); if (new_op_array) { if (file_handle.handle.stream.handle) { diff --git a/tests/Extension/RequiresTest.php b/tests/Extension/RequiresTest.php index 0038b6143..7178c6594 100644 --- a/tests/Extension/RequiresTest.php +++ b/tests/Extension/RequiresTest.php @@ -81,7 +81,12 @@ public function testRequireOnce(): void { $this->assertSame( [1, 2, 3], - $this->test->requireOnce(__DIR__.'/../fixtures/require-me-1.php') + $this->test->requireOnce(__DIR__.'/../fixtures/require-me-before-once.php') + ); + + $this->assertSame( + true, + $this->test->requireOnce(__DIR__.'/../fixtures/require-me-before-once.php') ); $this->assertFalse(defined('REQUIRE_ONCE_ME')); diff --git a/tests/fixtures/require-me-before-once.php b/tests/fixtures/require-me-before-once.php new file mode 100644 index 000000000..b7a0e0899 --- /dev/null +++ b/tests/fixtures/require-me-before-once.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return [1, 2, 3]; From 3bf478dc5dd2ee7239845d3d18f747789a07949f Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Fri, 20 Aug 2021 18:12:48 +0100 Subject: [PATCH 14/39] #2253 - Bump `PARSER_VERSION` to 1.3.7 --- .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 6f9c912ca..948264480 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -13,7 +13,7 @@ on: - development env: - PARSER_VERSION: 1.3.6 + PARSER_VERSION: 1.3.7 PARSER_RELEASE: 559 PHP_SDK_VERSION: 2.2.0 PHP_DEVPACK: C:\tools\php-devpack From f4282d54c3c32f22b015e4bed014358459ceb283 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Fri, 20 Aug 2021 18:17:28 +0100 Subject: [PATCH 15/39] #2253 - Update CHANGELOG.md [ci skip] --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f277cc06..9cf0d5ddf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format based on [Keep a Changelog](http://keepachangelog.com) and this project adheres to [Semantic Versioning](http://semver.org). ## [Unreleased] +### Added +- Added support for `require_once` [#2253](https://github.com/zephir-lang/zephir/issues/2253) ## [0.14.0-beta.3] - 2021-08-06 ### Fixed From 234514cfbcb135b3a4d5f08aeaa8bd0c25bb5d62 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Tue, 7 Sep 2021 23:35:26 +0100 Subject: [PATCH 16/39] Remove `ocramius/proxy-manager` package --- composer.json | 1 - composer.lock | 420 ++++++++++++-------------------------------------- 2 files changed, 102 insertions(+), 319 deletions(-) diff --git a/composer.json b/composer.json index bfdcc4a21..1243fa701 100644 --- a/composer.json +++ b/composer.json @@ -30,7 +30,6 @@ "ext-xml": "*", "ext-zlib": "*", "league/flysystem": "^2.0", - "ocramius/proxy-manager": "^2.10", "symfony/console": "^5.2", "symfony/framework-bundle": "^5.2", "symfony/monolog-bridge": "^5.2", diff --git a/composer.lock b/composer.lock index 7b1c5f4e5..c550e3055 100644 --- a/composer.lock +++ b/composer.lock @@ -4,87 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "3d33d184c5b6a70bb1022989f46c5f4f", + "content-hash": "5cb6946fb71ae057a80b67d33af6ec1d", "packages": [ - { - "name": "laminas/laminas-code", - "version": "4.4.2", - "source": { - "type": "git", - "url": "https://github.com/laminas/laminas-code.git", - "reference": "54251ab2b16c41c6980387839496b235f5f6e10b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-code/zipball/54251ab2b16c41c6980387839496b235f5f6e10b", - "reference": "54251ab2b16c41c6980387839496b235f5f6e10b", - "shasum": "" - }, - "require": { - "php": "^7.4 || ~8.0.0" - }, - "conflict": { - "phpspec/prophecy": "<1.9.0" - }, - "require-dev": { - "doctrine/annotations": "^1.10.4", - "ext-phar": "*", - "laminas/laminas-coding-standard": "^2.1.4", - "laminas/laminas-stdlib": "^3.3.0", - "phpunit/phpunit": "^9.4.2", - "psalm/plugin-phpunit": "^0.14.0", - "vimeo/psalm": "^4.3.1" - }, - "suggest": { - "doctrine/annotations": "Doctrine\\Common\\Annotations >=1.0 for annotation features", - "laminas/laminas-stdlib": "Laminas\\Stdlib component", - "laminas/laminas-zendframework-bridge": "A bridge with Zend Framework" - }, - "type": "library", - "autoload": { - "psr-4": { - "Laminas\\Code\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "description": "Extensions to the PHP Reflection API, static code scanning, and code generation", - "homepage": "https://laminas.dev", - "keywords": [ - "code", - "laminas", - "laminasframework" - ], - "support": { - "chat": "https://laminas.dev/chat", - "docs": "https://docs.laminas.dev/laminas-code/", - "forum": "https://discourse.laminas.dev", - "issues": "https://github.com/laminas/laminas-code/issues", - "rss": "https://github.com/laminas/laminas-code/releases.atom", - "source": "https://github.com/laminas/laminas-code" - }, - "funding": [ - { - "url": "https://funding.communitybridge.org/projects/laminas-project", - "type": "community_bridge" - } - ], - "time": "2021-07-09T11:58:40+00:00" - }, { "name": "league/flysystem", - "version": "2.2.0", + "version": "2.2.3", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem.git", - "reference": "29a3ba148287db3142412ef34f6fdcbc22c957cd" + "reference": "811bdc2d52a07eafbb6cb68a7b368b0668b362c8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/29a3ba148287db3142412ef34f6fdcbc22c957cd", - "reference": "29a3ba148287db3142412ef34f6fdcbc22c957cd", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/811bdc2d52a07eafbb6cb68a7b368b0668b362c8", + "reference": "811bdc2d52a07eafbb6cb68a7b368b0668b362c8", "shasum": "" }, "require": { @@ -140,7 +73,7 @@ ], "support": { "issues": "https://github.com/thephpleague/flysystem/issues", - "source": "https://github.com/thephpleague/flysystem/tree/2.2.0" + "source": "https://github.com/thephpleague/flysystem/tree/2.2.3" }, "funding": [ { @@ -156,7 +89,7 @@ "type": "tidelift" } ], - "time": "2021-07-20T16:54:08+00:00" + "time": "2021-08-18T19:59:31+00:00" }, { "name": "league/mime-type-detection", @@ -310,98 +243,6 @@ ], "time": "2021-07-23T07:42:52+00:00" }, - { - "name": "ocramius/proxy-manager", - "version": "2.12.0", - "source": { - "type": "git", - "url": "https://github.com/Ocramius/ProxyManager.git", - "reference": "6046a5730a8d329d7f3d9c5239bc1c806512a854" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Ocramius/ProxyManager/zipball/6046a5730a8d329d7f3d9c5239bc1c806512a854", - "reference": "6046a5730a8d329d7f3d9c5239bc1c806512a854", - "shasum": "" - }, - "require": { - "composer-runtime-api": "^2.0.0", - "laminas/laminas-code": "^4.3.0", - "php": "~7.4.1 || ~8.0.0", - "webimpress/safe-writer": "^2.2.0" - }, - "conflict": { - "composer/composer": "<2.0.14", - "doctrine/annotations": "<1.6.1", - "laminas/laminas-stdlib": "<3.2.1", - "thecodingmachine/safe": "<1.3.3", - "zendframework/zend-stdlib": "<3.2.1" - }, - "require-dev": { - "codelicia/xulieta": "^0.1.6", - "doctrine/coding-standard": "^8.2.1", - "ext-phar": "*", - "infection/infection": "^0.21.5", - "nikic/php-parser": "^4.10.5", - "phpbench/phpbench": "^0.17.1 || 1.0.0-alpha2", - "phpunit/phpunit": "^9.5.4", - "slevomat/coding-standard": "^6.3.10", - "squizlabs/php_codesniffer": "^3.6.0", - "vimeo/psalm": "^4.4.1" - }, - "suggest": { - "laminas/laminas-json": "To have the JsonRpc adapter (Remote Object feature)", - "laminas/laminas-soap": "To have the Soap adapter (Remote Object feature)", - "laminas/laminas-xmlrpc": "To have the XmlRpc adapter (Remote Object feature)", - "ocramius/generated-hydrator": "To have very fast object to array to object conversion for ghost objects" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "ProxyManager\\": "src/ProxyManager" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "http://ocramius.github.io/" - } - ], - "description": "A library providing utilities to generate, instantiate and generally operate with Object Proxies", - "homepage": "https://github.com/Ocramius/ProxyManager", - "keywords": [ - "aop", - "lazy loading", - "proxy", - "proxy pattern", - "service proxies" - ], - "support": { - "issues": "https://github.com/Ocramius/ProxyManager/issues", - "source": "https://github.com/Ocramius/ProxyManager/tree/2.12.0" - }, - "funding": [ - { - "url": "https://github.com/Ocramius", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/ocramius/proxy-manager", - "type": "tidelift" - } - ], - "time": "2021-05-25T11:42:44+00:00" - }, { "name": "psr/cache", "version": "1.0.1", @@ -601,16 +442,16 @@ }, { "name": "symfony/cache", - "version": "v5.3.4", + "version": "v5.3.7", "source": { "type": "git", "url": "https://github.com/symfony/cache.git", - "reference": "944db6004fc374fbe032d18e07cce51cc4e1e661" + "reference": "864867b13bd67347497ce956f4b253f8fe18b80c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/cache/zipball/944db6004fc374fbe032d18e07cce51cc4e1e661", - "reference": "944db6004fc374fbe032d18e07cce51cc4e1e661", + "url": "https://api.github.com/repos/symfony/cache/zipball/864867b13bd67347497ce956f4b253f8fe18b80c", + "reference": "864867b13bd67347497ce956f4b253f8fe18b80c", "shasum": "" }, "require": { @@ -619,6 +460,7 @@ "psr/log": "^1.1|^2|^3", "symfony/cache-contracts": "^1.1.7|^2", "symfony/deprecation-contracts": "^2.1", + "symfony/polyfill-php73": "^1.9", "symfony/polyfill-php80": "^1.16", "symfony/service-contracts": "^1.1|^2", "symfony/var-exporter": "^4.4|^5.0" @@ -677,7 +519,7 @@ "psr6" ], "support": { - "source": "https://github.com/symfony/cache/tree/v5.3.4" + "source": "https://github.com/symfony/cache/tree/v5.3.7" }, "funding": [ { @@ -693,7 +535,7 @@ "type": "tidelift" } ], - "time": "2021-07-23T15:55:36+00:00" + "time": "2021-08-29T15:08:21+00:00" }, { "name": "symfony/cache-contracts", @@ -855,16 +697,16 @@ }, { "name": "symfony/console", - "version": "v5.3.6", + "version": "v5.3.7", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "51b71afd6d2dc8f5063199357b9880cea8d8bfe2" + "reference": "8b1008344647462ae6ec57559da166c2bfa5e16a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/51b71afd6d2dc8f5063199357b9880cea8d8bfe2", - "reference": "51b71afd6d2dc8f5063199357b9880cea8d8bfe2", + "url": "https://api.github.com/repos/symfony/console/zipball/8b1008344647462ae6ec57559da166c2bfa5e16a", + "reference": "8b1008344647462ae6ec57559da166c2bfa5e16a", "shasum": "" }, "require": { @@ -934,7 +776,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.3.6" + "source": "https://github.com/symfony/console/tree/v5.3.7" }, "funding": [ { @@ -950,20 +792,20 @@ "type": "tidelift" } ], - "time": "2021-07-27T19:10:22+00:00" + "time": "2021-08-25T20:02:16+00:00" }, { "name": "symfony/dependency-injection", - "version": "v5.3.4", + "version": "v5.3.7", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "5a825e4b386066167a8b55487091cb62beec74c2" + "reference": "a665946279f566d94ed5eb98999cfa65c6fa5a78" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/5a825e4b386066167a8b55487091cb62beec74c2", - "reference": "5a825e4b386066167a8b55487091cb62beec74c2", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/a665946279f566d94ed5eb98999cfa65c6fa5a78", + "reference": "a665946279f566d94ed5eb98999cfa65c6fa5a78", "shasum": "" }, "require": { @@ -1022,7 +864,7 @@ "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/dependency-injection/tree/v5.3.4" + "source": "https://github.com/symfony/dependency-injection/tree/v5.3.7" }, "funding": [ { @@ -1038,7 +880,7 @@ "type": "tidelift" } ], - "time": "2021-07-23T15:55:36+00:00" + "time": "2021-08-02T16:16:27+00:00" }, { "name": "symfony/deprecation-contracts", @@ -1109,16 +951,16 @@ }, { "name": "symfony/error-handler", - "version": "v5.3.4", + "version": "v5.3.7", "source": { "type": "git", "url": "https://github.com/symfony/error-handler.git", - "reference": "281f6c4660bcf5844bb0346fe3a4664722fe4c73" + "reference": "3bc60d0fba00ae8d1eaa9eb5ab11a2bbdd1fc321" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/error-handler/zipball/281f6c4660bcf5844bb0346fe3a4664722fe4c73", - "reference": "281f6c4660bcf5844bb0346fe3a4664722fe4c73", + "url": "https://api.github.com/repos/symfony/error-handler/zipball/3bc60d0fba00ae8d1eaa9eb5ab11a2bbdd1fc321", + "reference": "3bc60d0fba00ae8d1eaa9eb5ab11a2bbdd1fc321", "shasum": "" }, "require": { @@ -1157,7 +999,7 @@ "description": "Provides tools to manage errors and ease debugging PHP code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/error-handler/tree/v5.3.4" + "source": "https://github.com/symfony/error-handler/tree/v5.3.7" }, "funding": [ { @@ -1173,20 +1015,20 @@ "type": "tidelift" } ], - "time": "2021-07-23T15:55:36+00:00" + "time": "2021-08-28T15:07:08+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v5.3.4", + "version": "v5.3.7", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "f2fd2208157553874560f3645d4594303058c4bd" + "reference": "ce7b20d69c66a20939d8952b617506a44d102130" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/f2fd2208157553874560f3645d4594303058c4bd", - "reference": "f2fd2208157553874560f3645d4594303058c4bd", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/ce7b20d69c66a20939d8952b617506a44d102130", + "reference": "ce7b20d69c66a20939d8952b617506a44d102130", "shasum": "" }, "require": { @@ -1242,7 +1084,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/v5.3.4" + "source": "https://github.com/symfony/event-dispatcher/tree/v5.3.7" }, "funding": [ { @@ -1258,7 +1100,7 @@ "type": "tidelift" } ], - "time": "2021-07-23T15:55:36+00:00" + "time": "2021-08-04T21:20:46+00:00" }, { "name": "symfony/event-dispatcher-contracts", @@ -1404,16 +1246,16 @@ }, { "name": "symfony/finder", - "version": "v5.3.4", + "version": "v5.3.7", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "17f50e06018baec41551a71a15731287dbaab186" + "reference": "a10000ada1e600d109a6c7632e9ac42e8bf2fb93" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/17f50e06018baec41551a71a15731287dbaab186", - "reference": "17f50e06018baec41551a71a15731287dbaab186", + "url": "https://api.github.com/repos/symfony/finder/zipball/a10000ada1e600d109a6c7632e9ac42e8bf2fb93", + "reference": "a10000ada1e600d109a6c7632e9ac42e8bf2fb93", "shasum": "" }, "require": { @@ -1446,7 +1288,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v5.3.4" + "source": "https://github.com/symfony/finder/tree/v5.3.7" }, "funding": [ { @@ -1462,20 +1304,20 @@ "type": "tidelift" } ], - "time": "2021-07-23T15:54:19+00:00" + "time": "2021-08-04T21:20:46+00:00" }, { "name": "symfony/framework-bundle", - "version": "v5.3.4", + "version": "v5.3.7", "source": { "type": "git", "url": "https://github.com/symfony/framework-bundle.git", - "reference": "2c5ed14a5992a2d04dfdb238a5f9589bab0a68d8" + "reference": "5d4fcef02a42ea86280afcbacedf8de7a039032c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/framework-bundle/zipball/2c5ed14a5992a2d04dfdb238a5f9589bab0a68d8", - "reference": "2c5ed14a5992a2d04dfdb238a5f9589bab0a68d8", + "url": "https://api.github.com/repos/symfony/framework-bundle/zipball/5d4fcef02a42ea86280afcbacedf8de7a039032c", + "reference": "5d4fcef02a42ea86280afcbacedf8de7a039032c", "shasum": "" }, "require": { @@ -1534,7 +1376,7 @@ "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/dom-crawler": "^4.4.30|^5.3.7", "symfony/dotenv": "^5.1", "symfony/expression-language": "^4.4|^5.0", "symfony/form": "^5.2", @@ -1597,7 +1439,7 @@ "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/v5.3.4" + "source": "https://github.com/symfony/framework-bundle/tree/v5.3.7" }, "funding": [ { @@ -1613,7 +1455,7 @@ "type": "tidelift" } ], - "time": "2021-07-25T09:39:16+00:00" + "time": "2021-08-26T08:37:07+00:00" }, { "name": "symfony/http-client-contracts", @@ -1695,16 +1537,16 @@ }, { "name": "symfony/http-foundation", - "version": "v5.3.6", + "version": "v5.3.7", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "a8388f7b7054a7401997008ce9cd8c6b0ab7ac75" + "reference": "e36c8e5502b4f3f0190c675f1c1f1248a64f04e5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/a8388f7b7054a7401997008ce9cd8c6b0ab7ac75", - "reference": "a8388f7b7054a7401997008ce9cd8c6b0ab7ac75", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/e36c8e5502b4f3f0190c675f1c1f1248a64f04e5", + "reference": "e36c8e5502b4f3f0190c675f1c1f1248a64f04e5", "shasum": "" }, "require": { @@ -1748,7 +1590,7 @@ "description": "Defines an object-oriented layer for the HTTP specification", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-foundation/tree/v5.3.6" + "source": "https://github.com/symfony/http-foundation/tree/v5.3.7" }, "funding": [ { @@ -1764,20 +1606,20 @@ "type": "tidelift" } ], - "time": "2021-07-27T17:08:17+00:00" + "time": "2021-08-27T11:20:35+00:00" }, { "name": "symfony/http-kernel", - "version": "v5.3.6", + "version": "v5.3.7", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "60030f209018356b3b553b9dbd84ad2071c1b7e0" + "reference": "a3a78e37935a527b50376c22ac1cec35b57fe787" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/60030f209018356b3b553b9dbd84ad2071c1b7e0", - "reference": "60030f209018356b3b553b9dbd84ad2071c1b7e0", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/a3a78e37935a527b50376c22ac1cec35b57fe787", + "reference": "a3a78e37935a527b50376c22ac1cec35b57fe787", "shasum": "" }, "require": { @@ -1787,7 +1629,7 @@ "symfony/error-handler": "^4.4|^5.0", "symfony/event-dispatcher": "^5.0", "symfony/http-client-contracts": "^1.1|^2", - "symfony/http-foundation": "^5.3", + "symfony/http-foundation": "^5.3.7", "symfony/polyfill-ctype": "^1.8", "symfony/polyfill-php73": "^1.9", "symfony/polyfill-php80": "^1.16" @@ -1860,7 +1702,7 @@ "description": "Provides a structured process for converting a Request into a Response", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-kernel/tree/v5.3.6" + "source": "https://github.com/symfony/http-kernel/tree/v5.3.7" }, "funding": [ { @@ -1876,20 +1718,20 @@ "type": "tidelift" } ], - "time": "2021-07-29T07:06:27+00:00" + "time": "2021-08-30T12:37:19+00:00" }, { "name": "symfony/monolog-bridge", - "version": "v5.3.4", + "version": "v5.3.7", "source": { "type": "git", "url": "https://github.com/symfony/monolog-bridge.git", - "reference": "a0d881165b902a04f41e873426aa52a068064ac4" + "reference": "4ace41087254f099b6743333155071438bfb12c3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/monolog-bridge/zipball/a0d881165b902a04f41e873426aa52a068064ac4", - "reference": "a0d881165b902a04f41e873426aa52a068064ac4", + "url": "https://api.github.com/repos/symfony/monolog-bridge/zipball/4ace41087254f099b6743333155071438bfb12c3", + "reference": "4ace41087254f099b6743333155071438bfb12c3", "shasum": "" }, "require": { @@ -1944,7 +1786,7 @@ "description": "Provides integration for Monolog with various Symfony components", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/monolog-bridge/tree/v5.3.4" + "source": "https://github.com/symfony/monolog-bridge/tree/v5.3.7" }, "funding": [ { @@ -1960,7 +1802,7 @@ "type": "tidelift" } ], - "time": "2021-07-23T15:55:36+00:00" + "time": "2021-08-13T15:54:02+00:00" }, { "name": "symfony/monolog-bundle", @@ -2610,16 +2452,16 @@ }, { "name": "symfony/routing", - "version": "v5.3.4", + "version": "v5.3.7", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "0a35d2f57d73c46ab6d042ced783b81d09a624c4" + "reference": "be865017746fe869007d94220ad3f5297951811b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/0a35d2f57d73c46ab6d042ced783b81d09a624c4", - "reference": "0a35d2f57d73c46ab6d042ced783b81d09a624c4", + "url": "https://api.github.com/repos/symfony/routing/zipball/be865017746fe869007d94220ad3f5297951811b", + "reference": "be865017746fe869007d94220ad3f5297951811b", "shasum": "" }, "require": { @@ -2680,7 +2522,7 @@ "url" ], "support": { - "source": "https://github.com/symfony/routing/tree/v5.3.4" + "source": "https://github.com/symfony/routing/tree/v5.3.7" }, "funding": [ { @@ -2696,7 +2538,7 @@ "type": "tidelift" } ], - "time": "2021-07-23T15:55:36+00:00" + "time": "2021-08-04T21:42:42+00:00" }, { "name": "symfony/service-contracts", @@ -2779,16 +2621,16 @@ }, { "name": "symfony/string", - "version": "v5.3.3", + "version": "v5.3.7", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "bd53358e3eccec6a670b5f33ab680d8dbe1d4ae1" + "reference": "8d224396e28d30f81969f083a58763b8b9ceb0a5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/bd53358e3eccec6a670b5f33ab680d8dbe1d4ae1", - "reference": "bd53358e3eccec6a670b5f33ab680d8dbe1d4ae1", + "url": "https://api.github.com/repos/symfony/string/zipball/8d224396e28d30f81969f083a58763b8b9ceb0a5", + "reference": "8d224396e28d30f81969f083a58763b8b9ceb0a5", "shasum": "" }, "require": { @@ -2842,7 +2684,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.3.3" + "source": "https://github.com/symfony/string/tree/v5.3.7" }, "funding": [ { @@ -2858,20 +2700,20 @@ "type": "tidelift" } ], - "time": "2021-06-27T11:44:38+00:00" + "time": "2021-08-26T08:00:08+00:00" }, { "name": "symfony/var-dumper", - "version": "v5.3.6", + "version": "v5.3.7", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "3dd8ddd1e260e58ecc61bb78da3b6584b3bfcba0" + "reference": "3ad5af4aed07d0a0201bbcfc42658fe6c5b2fb8f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/3dd8ddd1e260e58ecc61bb78da3b6584b3bfcba0", - "reference": "3dd8ddd1e260e58ecc61bb78da3b6584b3bfcba0", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/3ad5af4aed07d0a0201bbcfc42658fe6c5b2fb8f", + "reference": "3ad5af4aed07d0a0201bbcfc42658fe6c5b2fb8f", "shasum": "" }, "require": { @@ -2930,7 +2772,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v5.3.6" + "source": "https://github.com/symfony/var-dumper/tree/v5.3.7" }, "funding": [ { @@ -2946,20 +2788,20 @@ "type": "tidelift" } ], - "time": "2021-07-27T01:56:02+00:00" + "time": "2021-08-04T23:19:25+00:00" }, { "name": "symfony/var-exporter", - "version": "v5.3.4", + "version": "v5.3.7", "source": { "type": "git", "url": "https://github.com/symfony/var-exporter.git", - "reference": "b7898a65fc91e7c41de7a88c7db9aee9c0d432f0" + "reference": "2ded877ab0574d8b646f4eb3f716f8ed7ee7f392" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-exporter/zipball/b7898a65fc91e7c41de7a88c7db9aee9c0d432f0", - "reference": "b7898a65fc91e7c41de7a88c7db9aee9c0d432f0", + "url": "https://api.github.com/repos/symfony/var-exporter/zipball/2ded877ab0574d8b646f4eb3f716f8ed7ee7f392", + "reference": "2ded877ab0574d8b646f4eb3f716f8ed7ee7f392", "shasum": "" }, "require": { @@ -3003,7 +2845,7 @@ "serialize" ], "support": { - "source": "https://github.com/symfony/var-exporter/tree/v5.3.4" + "source": "https://github.com/symfony/var-exporter/tree/v5.3.7" }, "funding": [ { @@ -3019,7 +2861,7 @@ "type": "tidelift" } ], - "time": "2021-07-21T12:38:00+00:00" + "time": "2021-08-04T22:42:42+00:00" }, { "name": "symfony/yaml", @@ -3095,65 +2937,6 @@ } ], "time": "2021-07-29T06:20:01+00:00" - }, - { - "name": "webimpress/safe-writer", - "version": "2.2.0", - "source": { - "type": "git", - "url": "https://github.com/webimpress/safe-writer.git", - "reference": "9d37cc8bee20f7cb2f58f6e23e05097eab5072e6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webimpress/safe-writer/zipball/9d37cc8bee20f7cb2f58f6e23e05097eab5072e6", - "reference": "9d37cc8bee20f7cb2f58f6e23e05097eab5072e6", - "shasum": "" - }, - "require": { - "php": "^7.3 || ^8.0" - }, - "require-dev": { - "phpunit/phpunit": "^9.5.4", - "vimeo/psalm": "^4.7", - "webimpress/coding-standard": "^1.2.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.2.x-dev", - "dev-develop": "2.3.x-dev", - "dev-release-1.0": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Webimpress\\SafeWriter\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-2-Clause" - ], - "description": "Tool to write files safely, to avoid race conditions", - "keywords": [ - "concurrent write", - "file writer", - "race condition", - "safe writer", - "webimpress" - ], - "support": { - "issues": "https://github.com/webimpress/safe-writer/issues", - "source": "https://github.com/webimpress/safe-writer/tree/2.2.0" - }, - "funding": [ - { - "url": "https://github.com/michalbundyra", - "type": "github" - } - ], - "time": "2021-04-19T16:34:45+00:00" } ], "packages-dev": [ @@ -3996,16 +3779,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.8", + "version": "9.5.9", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "191768ccd5c85513b4068bdbe99bb6390c7d54fb" + "reference": "ea8c2dfb1065eb35a79b3681eee6e6fb0a6f273b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/191768ccd5c85513b4068bdbe99bb6390c7d54fb", - "reference": "191768ccd5c85513b4068bdbe99bb6390c7d54fb", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/ea8c2dfb1065eb35a79b3681eee6e6fb0a6f273b", + "reference": "ea8c2dfb1065eb35a79b3681eee6e6fb0a6f273b", "shasum": "" }, "require": { @@ -4083,7 +3866,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.8" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.9" }, "funding": [ { @@ -4095,7 +3878,7 @@ "type": "github" } ], - "time": "2021-07-31T15:17:34+00:00" + "time": "2021-08-31T06:47:40+00:00" }, { "name": "sebastian/cli-parser", @@ -4950,6 +4733,7 @@ "type": "github" } ], + "abandoned": true, "time": "2020-09-28T06:45:17+00:00" }, { @@ -5191,5 +4975,5 @@ "ext-pdo_sqlite": "*", "ext-zip": "*" }, - "plugin-api-version": "2.0.0" + "plugin-api-version": "2.1.0" } From 04907ebc26b5c9b1608d2ad421771d10da1005ce Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Thu, 9 Sep 2021 18:04:02 +0100 Subject: [PATCH 17/39] #2253 - Bump `ZEPHIR_PARSER_VERSION` to `v1.3.8` --- .github/workflows/build-unix.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-unix.yml b/.github/workflows/build-unix.yml index b9e8b8ef8..ea504b409 100644 --- a/.github/workflows/build-unix.yml +++ b/.github/workflows/build-unix.yml @@ -11,7 +11,7 @@ on: - development env: - ZEPHIR_PARSER_VERSION: v1.3.7 + ZEPHIR_PARSER_VERSION: v1.3.8 jobs: linux: From c82641f1ce3e5ea8153a2cdc8823061a5dddf12c Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Thu, 9 Sep 2021 18:07:16 +0100 Subject: [PATCH 18/39] #2253 - Bump `ZEPHIR_PARSER_VERSION` to `v1.3.8` in Win builds --- .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 948264480..4f3b8a2da 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -13,7 +13,7 @@ on: - development env: - PARSER_VERSION: 1.3.7 + PARSER_VERSION: 1.3.8 PARSER_RELEASE: 559 PHP_SDK_VERSION: 2.2.0 PHP_DEVPACK: C:\tools\php-devpack From e2b64b007c52b1f4c8ca44ba16b1e29025c0b17f Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Thu, 9 Sep 2021 18:20:31 +0100 Subject: [PATCH 19/39] #2253 - Update Zephir Parser destination URL asset --- .ci/win-ci-tools.psm1 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.ci/win-ci-tools.psm1 b/.ci/win-ci-tools.psm1 index 962e18b5e..c515b98fc 100644 --- a/.ci/win-ci-tools.psm1 +++ b/.ci/win-ci-tools.psm1 @@ -92,13 +92,13 @@ function InstallZephirParser { Download and install Zephir parser PHP extension #> - $BaseUri = "https://github.com/phalcon/php-zephir-parser/releases/download" - $LocalPart = "zephir_parser_${env:PHP_ARCH}_vc${env:VC_VERSION}_php${env:PHP_MINOR}" + $BaseUri = "https://github.com/zephir/php-zephir-parser/releases/download" + $LocalPart = "zephir-parser-php-${env:PHP_MINOR}-${TS}-win32-vc${env:VC_VERSION}-${env:PHP_ARCH}.zip" $TS = Get-ThreadSafety - $RemoteUrl = "${BaseUri}/v${env:PARSER_VERSION}/${LocalPart}${TS}_${env:PARSER_VERSION}-${env:PARSER_RELEASE}.zip" - $DestinationPath = "C:\Downloads\${LocalPart}${TS}_${env:PARSER_VERSION}-${env:PARSER_RELEASE}.zip" + $RemoteUrl = "${BaseUri}/v${env:PARSER_VERSION}/${LocalPart}" + $DestinationPath = "C:\Downloads\${LocalPart}" if (-not (Test-Path "${env:PHPROOT}\ext\php_zephir_parser.dll")) { if (-not [System.IO.File]::Exists($DestinationPath)) { From b9759f4b6242302047519a7d40ac5301c2bc09e6 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Thu, 9 Sep 2021 18:28:42 +0100 Subject: [PATCH 20/39] #2253 - Update Zephir Parser destination URL asset --- .ci/win-ci-tools.psm1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.ci/win-ci-tools.psm1 b/.ci/win-ci-tools.psm1 index c515b98fc..e9dcfbaab 100644 --- a/.ci/win-ci-tools.psm1 +++ b/.ci/win-ci-tools.psm1 @@ -92,11 +92,11 @@ function InstallZephirParser { Download and install Zephir parser PHP extension #> + $TS = Get-ThreadSafety + $BaseUri = "https://github.com/zephir/php-zephir-parser/releases/download" $LocalPart = "zephir-parser-php-${env:PHP_MINOR}-${TS}-win32-vc${env:VC_VERSION}-${env:PHP_ARCH}.zip" - $TS = Get-ThreadSafety - $RemoteUrl = "${BaseUri}/v${env:PARSER_VERSION}/${LocalPart}" $DestinationPath = "C:\Downloads\${LocalPart}" From 2acda802331a331615ca0bfae1173cfee6fa8a27 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Thu, 9 Sep 2021 18:35:16 +0100 Subject: [PATCH 21/39] #2253 - Update Zephir Parser destination URL asset --- .ci/win-ci-tools.psm1 | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.ci/win-ci-tools.psm1 b/.ci/win-ci-tools.psm1 index e9dcfbaab..741c65003 100644 --- a/.ci/win-ci-tools.psm1 +++ b/.ci/win-ci-tools.psm1 @@ -92,10 +92,8 @@ function InstallZephirParser { Download and install Zephir parser PHP extension #> - $TS = Get-ThreadSafety - $BaseUri = "https://github.com/zephir/php-zephir-parser/releases/download" - $LocalPart = "zephir-parser-php-${env:PHP_MINOR}-${TS}-win32-vc${env:VC_VERSION}-${env:PHP_ARCH}.zip" + $LocalPart = "zephir-parser-php-${env:PHP_MINOR}-${env:BUILD_TYPE}-win32-vc${env:VC_VERSION}-${env:PHP_ARCH}.zip" $RemoteUrl = "${BaseUri}/v${env:PARSER_VERSION}/${LocalPart}" $DestinationPath = "C:\Downloads\${LocalPart}" From c613be907970dc2198f10d9103ecc1c42fae957f Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Thu, 9 Sep 2021 18:39:23 +0100 Subject: [PATCH 22/39] #2253 - Update Zephir Parser destination URL asset --- .ci/win-ci-tools.psm1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/win-ci-tools.psm1 b/.ci/win-ci-tools.psm1 index 741c65003..c55fcdffe 100644 --- a/.ci/win-ci-tools.psm1 +++ b/.ci/win-ci-tools.psm1 @@ -92,7 +92,7 @@ function InstallZephirParser { Download and install Zephir parser PHP extension #> - $BaseUri = "https://github.com/zephir/php-zephir-parser/releases/download" + $BaseUri = "https://github.com/zephir-lang/php-zephir-parser/releases/download" $LocalPart = "zephir-parser-php-${env:PHP_MINOR}-${env:BUILD_TYPE}-win32-vc${env:VC_VERSION}-${env:PHP_ARCH}.zip" $RemoteUrl = "${BaseUri}/v${env:PARSER_VERSION}/${LocalPart}" From a1d7d1d6ec490a7f60a53a25dc1ece1940cf2f6a Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Fri, 10 Sep 2021 19:24:37 +0100 Subject: [PATCH 23/39] #1932 - Add test case for nullable string return type --- stub/strings.zep | 12 ++++++++++++ tests/Extension/StringTest.php | 10 ++++++++++ 2 files changed, 22 insertions(+) diff --git a/stub/strings.zep b/stub/strings.zep index 6e5a4b875..2990e0cc9 100644 --- a/stub/strings.zep +++ b/stub/strings.zep @@ -228,4 +228,16 @@ class Strings { return val; } + + /** + * @issue https://github.com/zephir-lang/zephir/issues/1932 + */ + public function nullableStringReturnType(string! val = null) -> string | null + { + if (val !== null) { + return val; + } + + return null; + } } diff --git a/tests/Extension/StringTest.php b/tests/Extension/StringTest.php index aa2ac5316..8c60826a8 100644 --- a/tests/Extension/StringTest.php +++ b/tests/Extension/StringTest.php @@ -320,6 +320,16 @@ public function testIssue2186(): void $this->assertSame('ok all ok', $this->test->issue2186SegFaultCall('ok')); } + /** + * @issue https://github.com/zephir-lang/zephir/issues/1932 + */ + public function testNullableStringReturnType(): void + { + $this->assertNull($this->test->nullableStringReturnType()); + $this->assertNull($this->test->nullableStringReturnType(null)); + $this->assertSame('string', $this->test->nullableStringReturnType('string')); + } + public function providerHashEquals(): array { return [ From 43f3012232597bdb37c9817851fe84daa5b27cd6 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sat, 11 Sep 2021 23:16:06 +0100 Subject: [PATCH 24/39] Adjust EOL --- .ci/run-tests.sh | 1 - stub/strings.zep | 1 + tests/Extension/StringTest.php | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.ci/run-tests.sh b/.ci/run-tests.sh index fea8f7b3a..0f472f3be 100755 --- a/.ci/run-tests.sh +++ b/.ci/run-tests.sh @@ -14,7 +14,6 @@ set -eu php \ -d extension=ext/modules/stub.so \ vendor/bin/phpunit \ - --colors=always \ --bootstrap tests/ext-bootstrap.php \ --testsuite Extension diff --git a/stub/strings.zep b/stub/strings.zep index 2990e0cc9..59ddae79e 100644 --- a/stub/strings.zep +++ b/stub/strings.zep @@ -1,3 +1,4 @@ + namespace Stub; class Strings diff --git a/tests/Extension/StringTest.php b/tests/Extension/StringTest.php index 8c60826a8..9336a41b5 100644 --- a/tests/Extension/StringTest.php +++ b/tests/Extension/StringTest.php @@ -20,7 +20,7 @@ final class StringTest extends TestCase { - private Strings $test; + private ?Strings $test = null; protected function setUp(): void { From b1f458629cba340a18d75d0cb824bdd957abbecf Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 12 Sep 2021 10:14:31 +0100 Subject: [PATCH 25/39] #2278 - Add mini documentation about class entries in class-entries.php --- config/class-entries.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/config/class-entries.php b/config/class-entries.php index 837819d1a..71a0160a4 100644 --- a/config/class-entries.php +++ b/config/class-entries.php @@ -12,6 +12,25 @@ declare(strict_types=1); /** + * List of Class Entries and respective headers. + * + * These Class Entries can't be detected dynamically and must be + * specified with exact class entry name and its header where it + * has been declared. + * Most or near all of them are from bundled PHP extensions. + * + * Full list of bundled PHP extensions can be found here: + * @link https://github.com/php/php-src/tree/master/ext + * + * If Class is not located in this list, or it is from an external + * extension, then Zephir will generate Zend C code for dynamic CE + * detection via full namespace class name. + * + * Example: + * ``` + * Z_PARAM_OBJECT_OF_CLASS(link, zephir_get_internal_ce(SL("psr\\link\\linkinterface"))) + * ``` + * * PHP Class Name => [Zend Class Entry, header-file-path (optional)] */ return [ From a0871f1bee69e83a30012edb7f90f2a501760f86 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 12 Sep 2021 11:09:03 +0100 Subject: [PATCH 26/39] #2278 - Update list of Class Entries --- config/class-entries.php | 90 +++++++++++++++++++++++++++++++++++----- 1 file changed, 80 insertions(+), 10 deletions(-) diff --git a/config/class-entries.php b/config/class-entries.php index 71a0160a4..b234e8e76 100644 --- a/config/class-entries.php +++ b/config/class-entries.php @@ -34,6 +34,86 @@ * PHP Class Name => [Zend Class Entry, header-file-path (optional)] */ return [ + /** + * cURL + * + * @link https://github.com/php/php-src/tree/master/ext/curl + */ + 'CurlHandle' => ['curl_ce', 'ext/curl/php_curl'], + 'CurlShareHandle' => ['curl_share_ce', 'ext/curl/php_curl'], + 'CurlMultiHandle' => ['curl_multi_ce', 'ext/curl/php_curl'], + 'CURLFile' => ['curl_CURLFile_class', 'ext/curl/php_curl'], + 'CURLStringFile' => ['curl_CURLStringFile_class', 'ext/curl/php_curl'], + + /** + * Date + * + * @link https://github.com/php/php-src/tree/master/ext/date + */ + 'DateTimeInterface' => ['php_date_get_interface_ce()', 'ext/date/php_date'], + 'DateTime' => ['php_date_get_date_ce()', 'ext/date/php_date'], + 'DateTimeImmutable' => ['php_date_get_immutable_ce()', 'ext/date/php_date'], + 'DateTimezone' => ['php_date_get_timezone_ce()', 'ext/date/php_date'], + 'DateInterval' => ['php_date_get_interval_ce()', 'ext/date/php_date'], + 'DatePeriod' => ['php_date_get_period_ce()', 'ext/date/php_date'], + + /** + * DOM + * + * @link https://github.com/php/php-src/tree/master/ext/dom + */ + 'DOMNode' => ['dom_node_class_entry', 'ext/dom/xml_common'], + + /** + * GMP + * + * @link https://github.com/php/php-src/tree/master/ext/gmp + */ + 'GMP' => ['php_gmp_class_entry()', 'ext/gmp/php_gmp_int'], + + /** + * Hash + * + * @link https://github.com/php/php-src/tree/master/ext/hash + */ + 'HashContext' => ['php_hashcontext_ce', 'ext/hash/php_hash'], + + /** + * Intl + * + * @link https://github.com/php/php-src/tree/master/ext/intl + */ + 'IntlException' => ['IntlException_ce_ptr', 'ext/intl/intl_common'], + + 'IntlBreakIterator' => ['BreakIterator_ce_ptr', 'ext/intl/breakiterator/breakiterator_class'], + 'IntlRuleBasedBreakIterator' => ['RuleBasedBreakIterator_ce_ptr', 'ext/intl/breakiterator/breakiterator_class'], + + 'IntlCalendar' => ['Calendar_ce_ptr', 'ext/intl/calendar/calendar_class'], + 'IntlGregorianCalendar' => ['GregorianCalendar_ce_ptr', 'ext/intl/calendar/calendar_class'], + + 'Collator' => ['GregorianCalendar_ce_ptr', 'ext/intl/collator/collator_class'], + + 'IntlIterator' => ['IntlIterator_ce_ptr', 'ext/intl/common/collator_enum'], + + 'IntlDateFormatter' => ['IntlDateFormatter_ce_ptr', 'ext/intl/dateformat/dateformat_class'], + 'IntlDatePatternGenerator' => ['IntlDatePatternGenerator_ce_ptr', 'ext/intl/dateformat/datepatterngenerator_class'], + + 'NumberFormatter' => ['NumberFormatter_ce_ptr', 'ext/intl/formatter/formatter_class'], + + 'Locale' => ['Locale_ce_ptr', 'ext/intl/locale/locale_class'], + + 'MessageFormatter' => ['MessageFormatter_ce_ptr', 'ext/intl/locale/msgformat/msgformat_class'], + + 'Normalizer' => ['Normalizer_ce_ptr', 'ext/intl/locale/normalizer/normalizer_class'], + + 'ResourceBundle' => ['ResourceBundle_ce_ptr', 'ext/intl/resourcebundle/resourcebundle_class'], + + 'Spoofchecker' => ['Spoofchecker_ce_ptr', 'ext/intl/spoofchecker/spoofchecker_class'], + + 'IntlTimeZone' => ['TimeZone_ce_ptr', 'ext/intl/timezone/timezone_class'], + + 'Transliterator' => ['Transliterator_ce_ptr', 'ext/intl/transliterator/transliterator_class'], + /** * SPL */ @@ -105,16 +185,6 @@ */ 'SessionHandlerInterface' => ['php_session_iface_entry', 'ext/session/php_session'], - /** - * Date - */ - 'DateTimeInterface' => ['php_date_get_interface_ce()', 'ext/date/php_date'], - 'DateTime' => ['php_date_get_date_ce()', 'ext/date/php_date'], - 'DateTimeImmutable' => ['php_date_get_immutable_ce()', 'ext/date/php_date'], - 'DateTimezone' => ['php_date_get_timezone_ce()', 'ext/date/php_date'], - 'DateInterval' => ['php_date_get_interval_ce()', 'ext/date/php_date'], - 'DatePeriod' => ['php_date_get_period_ce()', 'ext/date/php_date'], - /** * Closures */ From 88bf5b30e2e4519044fb2305ddca8eb7901bbf25 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 12 Sep 2021 11:59:47 +0100 Subject: [PATCH 27/39] #2278 - Update list of Class Entries --- config/class-entries.php | 339 +++++++++++++++++++++++++-------------- 1 file changed, 217 insertions(+), 122 deletions(-) diff --git a/config/class-entries.php b/config/class-entries.php index b234e8e76..a3e8e128c 100644 --- a/config/class-entries.php +++ b/config/class-entries.php @@ -39,189 +39,284 @@ * * @link https://github.com/php/php-src/tree/master/ext/curl */ - 'CurlHandle' => ['curl_ce', 'ext/curl/php_curl'], - 'CurlShareHandle' => ['curl_share_ce', 'ext/curl/php_curl'], - 'CurlMultiHandle' => ['curl_multi_ce', 'ext/curl/php_curl'], - 'CURLFile' => ['curl_CURLFile_class', 'ext/curl/php_curl'], - 'CURLStringFile' => ['curl_CURLStringFile_class', 'ext/curl/php_curl'], + 'CurlHandle' => ['curl_ce', 'ext/curl/php_curl'], + 'CurlShareHandle' => ['curl_share_ce', 'ext/curl/php_curl'], + 'CurlMultiHandle' => ['curl_multi_ce', 'ext/curl/php_curl'], + 'CURLFile' => ['curl_CURLFile_class', 'ext/curl/php_curl'], + 'CURLStringFile' => ['curl_CURLStringFile_class', 'ext/curl/php_curl'], /** * Date * * @link https://github.com/php/php-src/tree/master/ext/date */ - 'DateTimeInterface' => ['php_date_get_interface_ce()', 'ext/date/php_date'], - 'DateTime' => ['php_date_get_date_ce()', 'ext/date/php_date'], - 'DateTimeImmutable' => ['php_date_get_immutable_ce()', 'ext/date/php_date'], - 'DateTimezone' => ['php_date_get_timezone_ce()', 'ext/date/php_date'], - 'DateInterval' => ['php_date_get_interval_ce()', 'ext/date/php_date'], - 'DatePeriod' => ['php_date_get_period_ce()', 'ext/date/php_date'], + 'DateTimeInterface' => ['php_date_get_interface_ce()', 'ext/date/php_date'], + 'DateTime' => ['php_date_get_date_ce()', 'ext/date/php_date'], + 'DateTimeImmutable' => ['php_date_get_immutable_ce()', 'ext/date/php_date'], + 'DateTimezone' => ['php_date_get_timezone_ce()', 'ext/date/php_date'], + 'DateInterval' => ['php_date_get_interval_ce()', 'ext/date/php_date'], + 'DatePeriod' => ['php_date_get_period_ce()', 'ext/date/php_date'], /** * DOM * * @link https://github.com/php/php-src/tree/master/ext/dom */ - 'DOMNode' => ['dom_node_class_entry', 'ext/dom/xml_common'], + 'DOMNode' => ['dom_node_class_entry', 'ext/dom/xml_common'], /** * GMP * * @link https://github.com/php/php-src/tree/master/ext/gmp */ - 'GMP' => ['php_gmp_class_entry()', 'ext/gmp/php_gmp_int'], + 'GMP' => ['php_gmp_class_entry()', 'ext/gmp/php_gmp_int'], /** * Hash * * @link https://github.com/php/php-src/tree/master/ext/hash */ - 'HashContext' => ['php_hashcontext_ce', 'ext/hash/php_hash'], + 'HashContext' => ['php_hashcontext_ce', 'ext/hash/php_hash'], /** * Intl * * @link https://github.com/php/php-src/tree/master/ext/intl */ - 'IntlException' => ['IntlException_ce_ptr', 'ext/intl/intl_common'], + 'IntlException' => ['IntlException_ce_ptr', 'ext/intl/intl_common'], - 'IntlBreakIterator' => ['BreakIterator_ce_ptr', 'ext/intl/breakiterator/breakiterator_class'], - 'IntlRuleBasedBreakIterator' => ['RuleBasedBreakIterator_ce_ptr', 'ext/intl/breakiterator/breakiterator_class'], + 'IntlBreakIterator' => ['BreakIterator_ce_ptr', 'ext/intl/breakiterator/breakiterator_class'], + 'IntlRuleBasedBreakIterator' => ['RuleBasedBreakIterator_ce_ptr', 'ext/intl/breakiterator/breakiterator_class'], - 'IntlCalendar' => ['Calendar_ce_ptr', 'ext/intl/calendar/calendar_class'], - 'IntlGregorianCalendar' => ['GregorianCalendar_ce_ptr', 'ext/intl/calendar/calendar_class'], + 'IntlCalendar' => ['Calendar_ce_ptr', 'ext/intl/calendar/calendar_class'], + 'IntlGregorianCalendar' => ['GregorianCalendar_ce_ptr', 'ext/intl/calendar/calendar_class'], - 'Collator' => ['GregorianCalendar_ce_ptr', 'ext/intl/collator/collator_class'], + 'Collator' => ['GregorianCalendar_ce_ptr', 'ext/intl/collator/collator_class'], - 'IntlIterator' => ['IntlIterator_ce_ptr', 'ext/intl/common/collator_enum'], + 'IntlIterator' => ['IntlIterator_ce_ptr', 'ext/intl/common/collator_enum'], - 'IntlDateFormatter' => ['IntlDateFormatter_ce_ptr', 'ext/intl/dateformat/dateformat_class'], - 'IntlDatePatternGenerator' => ['IntlDatePatternGenerator_ce_ptr', 'ext/intl/dateformat/datepatterngenerator_class'], + 'IntlDateFormatter' => ['IntlDateFormatter_ce_ptr', 'ext/intl/dateformat/dateformat_class'], + 'IntlDatePatternGenerator' => ['IntlDatePatternGenerator_ce_ptr', 'ext/intl/dateformat/datepatterngenerator_class'], - 'NumberFormatter' => ['NumberFormatter_ce_ptr', 'ext/intl/formatter/formatter_class'], + 'NumberFormatter' => ['NumberFormatter_ce_ptr', 'ext/intl/formatter/formatter_class'], - 'Locale' => ['Locale_ce_ptr', 'ext/intl/locale/locale_class'], + 'Locale' => ['Locale_ce_ptr', 'ext/intl/locale/locale_class'], - 'MessageFormatter' => ['MessageFormatter_ce_ptr', 'ext/intl/locale/msgformat/msgformat_class'], + 'MessageFormatter' => ['MessageFormatter_ce_ptr', 'ext/intl/locale/msgformat/msgformat_class'], - 'Normalizer' => ['Normalizer_ce_ptr', 'ext/intl/locale/normalizer/normalizer_class'], + 'Normalizer' => ['Normalizer_ce_ptr', 'ext/intl/locale/normalizer/normalizer_class'], - 'ResourceBundle' => ['ResourceBundle_ce_ptr', 'ext/intl/resourcebundle/resourcebundle_class'], + 'ResourceBundle' => ['ResourceBundle_ce_ptr', 'ext/intl/resourcebundle/resourcebundle_class'], - 'Spoofchecker' => ['Spoofchecker_ce_ptr', 'ext/intl/spoofchecker/spoofchecker_class'], + 'Spoofchecker' => ['Spoofchecker_ce_ptr', 'ext/intl/spoofchecker/spoofchecker_class'], - 'IntlTimeZone' => ['TimeZone_ce_ptr', 'ext/intl/timezone/timezone_class'], + 'IntlTimeZone' => ['TimeZone_ce_ptr', 'ext/intl/timezone/timezone_class'], - 'Transliterator' => ['Transliterator_ce_ptr', 'ext/intl/transliterator/transliterator_class'], + 'Transliterator' => ['Transliterator_ce_ptr', 'ext/intl/transliterator/transliterator_class'], /** - * SPL + * JSON + * + * @link https://github.com/php/php-src/tree/master/ext/json + */ + 'JsonSerializable' => ['php_json_serializable_ce', 'ext/json/php_json'], + + /** + * MySQLi + * + * @link https://github.com/php/php-src/tree/master/ext/mysqli + */ + 'mysqli' => ['mysqli_link_class_entry', 'ext/mysqli/php_mysqli_structs'], + 'mysqli_stmt' => ['mysqli_stmt_class_entry', 'ext/mysqli/php_mysqli_structs'], + 'mysqli_result' => ['mysqli_result_class_entry', 'ext/mysqli/php_mysqli_structs'], + 'mysqli_driver' => ['mysqli_driver_class_entry', 'ext/mysqli/php_mysqli_structs'], + 'mysqli_warning' => ['mysqli_warning_class_entry', 'ext/mysqli/php_mysqli_structs'], + 'mysqli_sql_exception' => ['mysqli_exception_class_entry', 'ext/mysqli/php_mysqli_structs'], + + /** + * OCI8 + * + * @link https://github.com/php/php-src/tree/master/ext/oci8 + */ + 'OCILob' => ['oci_lob_class_entry_ptr', 'ext/oci8/php_oci8_int'], + 'OCICollection' => ['oci_coll_class_entry_ptr', 'ext/oci8/php_oci8_int'], + + /** + * OpenSSL + * + * @link https://github.com/php/php-src/tree/master/ext/openssl + */ + 'OpenSSLCertificate' => ['php_openssl_certificate_ce', 'ext/openssl/php_openssl'], + + /** + * PDO + * + * @link https://github.com/php/php-src/tree/master/ext/pdo + */ + 'PDO' => ['php_pdo_get_dbh_ce()', 'ext/pdo/php_pdo_driver'], + 'PDOException' => ['php_pdo_get_exception()', 'ext/pdo/php_pdo_driver'], + + /** + * Reflection + * + * @link https://github.com/php/php-src/tree/master/ext/reflection */ - 'ArrayObject' => ['spl_ce_ArrayObject', 'ext/spl/spl_array'], - 'ArrayIterator' => ['spl_ce_ArrayIterator', 'ext/spl/spl_array'], - 'RecursiveArrayIterator' => ['spl_ce_RecursiveArrayIterator', 'ext/spl/spl_array'], - - 'SplFileInfo' => ['spl_ce_SplFileInfo', 'ext/spl/spl_directory'], - 'DirectoryIterator' => ['spl_ce_DirectoryIterator', 'ext/spl/spl_directory'], - 'FilesystemIterator' => ['spl_ce_FilesystemIterator', 'ext/spl/spl_directory'], - 'RecursiveDirectoryIterator' => ['spl_ce_RecursiveDirectoryIterator', 'ext/spl/spl_directory'], - 'GlobIterator' => ['spl_ce_GlobIterator', 'ext/spl/spl_directory'], - 'SplFileObject' => ['spl_ce_SplFileObject', 'ext/spl/spl_directory'], - 'SplTempFileObject' => ['spl_ce_SplTempFileObject', 'ext/spl/spl_directory'], - - 'SplDoublyLinkedList' => ['spl_ce_SplDoublyLinkedList', 'ext/spl/spl_dllist'], - 'SplQueue' => ['spl_ce_SplQueue', 'ext/spl/spl_dllist'], - 'SplStack' => ['spl_ce_SplStack', 'ext/spl/spl_dllist'], - - 'LogicException' => ['spl_ce_LogicException', 'ext/spl/spl_exceptions'], - 'BadFunctionCallException' => ['spl_ce_BadFunctionCallException', 'ext/spl/spl_exceptions'], - 'BadMethodCallException' => ['spl_ce_BadMethodCallException', 'ext/spl/spl_exceptions'], - 'DomainException' => ['spl_ce_DomainException', 'ext/spl/spl_exceptions'], - 'InvalidArgumentException' => ['spl_ce_InvalidArgumentException', 'ext/spl/spl_exceptions'], - 'LengthException' => ['spl_ce_LengthException', 'ext/spl/spl_exceptions'], - 'OutOfRangeException' => ['spl_ce_OutOfRangeException', 'ext/spl/spl_exceptions'], - 'RuntimeException' => ['spl_ce_RuntimeException', 'ext/spl/spl_exceptions'], - 'OutOfBoundsException' => ['spl_ce_OutOfBoundsException', 'ext/spl/spl_exceptions'], - 'OverflowException' => ['spl_ce_OverflowException', 'ext/spl/spl_exceptions'], - 'RangeException' => ['spl_ce_RangeException', 'ext/spl/spl_exceptions'], - 'UnderflowException' => ['spl_ce_UnderflowException', 'ext/spl/spl_exceptions'], - 'UnexpectedValueException' => ['spl_ce_UnexpectedValueException', 'ext/spl/spl_exceptions'], - - 'SplFixedArray' => ['spl_ce_SplFixedArray', 'ext/spl/spl_fixedarray'], - - 'SplHeap' => ['spl_ce_SplHeap', 'ext/spl/spl_heap'], - 'SplMinHeap' => ['spl_ce_SplMinHeap', 'ext/spl/spl_heap'], - 'SplMaxHeap' => ['spl_ce_SplMaxHeap', 'ext/spl/spl_heap'], - 'SplPriorityQueue' => ['spl_ce_SplPriorityQueue', 'ext/spl/spl_heap'], - - 'AppendIterator' => ['spl_ce_AppendIterator', 'ext/spl/spl_iterators'], - 'CachingIterator' => ['spl_ce_CachingIterator', 'ext/spl/spl_iterators'], - 'CallbackFilterIterator' => ['spl_ce_CallbackFilterIterator', 'ext/spl/spl_iterators'], - 'EmptyIterator' => ['spl_ce_EmptyIterator', 'ext/spl/spl_iterators'], - 'FilterIterator' => ['spl_ce_FilterIterator', 'ext/spl/spl_iterators'], - 'InfiniteIterator' => ['spl_ce_InfiniteIterator', 'ext/spl/spl_iterators'], - 'IteratorIterator' => ['spl_ce_IteratorIterator', 'ext/spl/spl_iterators'], - 'LimitIterator' => ['spl_ce_LimitIterator', 'ext/spl/spl_iterators'], - 'NoRewindIterator' => ['spl_ce_NoRewindIterator', 'ext/spl/spl_iterators'], - 'OuterIterator' => ['spl_ce_OuterIterator', 'ext/spl/spl_iterators'], - 'ParentIterator' => ['spl_ce_ParentIterator', 'ext/spl/spl_iterators'], - 'RecursiveCachingIterator' => ['spl_ce_RecursiveCachingIterator', 'ext/spl/spl_iterators'], - 'RecursiveCallbackFilterIterator' => ['spl_ce_RecursiveCallbackFilterIterator', 'ext/spl/spl_iterators'], - 'RecursiveFilterIterator' => ['spl_ce_RecursiveFilterIterator', 'ext/spl/spl_iterators'], - 'RecursiveIterator' => ['spl_ce_RecursiveIterator', 'ext/spl/spl_iterators'], - 'RecursiveIteratorIterator' => ['spl_ce_RecursiveIteratorIterator', 'ext/spl/spl_iterators'], - 'RecursiveRegexIterator' => ['spl_ce_RecursiveRegexIterator', 'ext/spl/spl_iterators'], - 'RecursiveTreeIterator' => ['spl_ce_RecursiveTreeIterator', 'ext/spl/spl_iterators'], - 'RegexIterator' => ['spl_ce_RegexIterator', 'ext/spl/spl_iterators'], - 'SeekableIterator' => ['spl_ce_SeekableIterator', 'ext/spl/spl_iterators'], - - 'SplObserver' => ['spl_ce_SplObserver', 'ext/spl/spl_observer'], - 'SplSubject' => ['spl_ce_SplSubject', 'ext/spl/spl_observer'], - 'SplObjectStorage' => ['spl_ce_SplObjectStorage', 'ext/spl/spl_observer'], - 'MultipleIterator' => ['spl_ce_MultipleIterator', 'ext/spl/spl_observer'], + 'Reflector' => ['reflector_ptr', 'ext/reflection/php_reflection'], + 'ReflectionException' => ['reflection_exception_ptr', 'ext/reflection/php_reflection'], + 'Reflection' => ['reflection_ptr', 'ext/reflection/php_reflection'], + 'ReflectionFunctionAbstract' => ['reflection_function_abstract_ptr', 'ext/reflection/php_reflection'], + 'ReflectionFunction' => ['reflection_function_ptr', 'ext/reflection/php_reflection'], + 'ReflectionParameter' => ['reflection_parameter_ptr', 'ext/reflection/php_reflection'], + 'ReflectionType' => ['reflection_type_ptr', 'ext/reflection/php_reflection'], + 'ReflectionNamedType' => ['reflection_named_type_ptr', 'ext/reflection/php_reflection'], + 'ReflectionClass' => ['reflection_class_ptr', 'ext/reflection/php_reflection'], + 'ReflectionObject' => ['reflection_object_ptr', 'ext/reflection/php_reflection'], + 'ReflectionMethod' => ['reflection_method_ptr', 'ext/reflection/php_reflection'], + 'ReflectionProperty' => ['reflection_property_ptr', 'ext/reflection/php_reflection'], + 'ReflectionExtension' => ['reflection_extension_ptr', 'ext/reflection/php_reflection'], + 'ReflectionZendExtension' => ['reflection_zend_extension_ptr', 'ext/reflection/php_reflection'], + 'ReflectionReference' => ['reflection_reference_ptr', 'ext/reflection/php_reflection'], + 'ReflectionAttribute' => ['reflection_attribute_ptr', 'ext/reflection/php_reflection'], + 'ReflectionEnum' => ['reflection_enum_ptr', 'ext/reflection/php_reflection'], + 'ReflectionEnumUnitCase' => ['reflection_enum_unit_case_ptr', 'ext/reflection/php_reflection'], + 'ReflectionEnumBackedCase' => ['reflection_enum_backed_case_ptr', 'ext/reflection/php_reflection'], + 'ReflectionFiber' => ['reflection_fiber_ptr', 'ext/reflection/php_reflection'], /** * Session + * + * @link https://github.com/php/php-src/tree/master/ext/session */ - 'SessionHandlerInterface' => ['php_session_iface_entry', 'ext/session/php_session'], + 'SessionHandler' => ['php_session_class_entry', 'ext/session/php_session'], + 'SessionHandlerInterface' => ['php_session_iface_entry', 'ext/session/php_session'], + 'SessionIdInterface' => ['php_session_id_iface_entry', 'ext/session/php_session'], + 'SessionUpdateTimestampHandlerInterface' => ['php_session_update_timestamp_iface_entry', 'ext/session/php_session'], /** - * Closures + * SimpleXML + * + * @link https://github.com/php/php-src/tree/master/ext/simplexml */ - 'Closure' => ['zend_ce_closure', 'Zend/zend_closures'], + 'SimpleXMLIterator' => ['ce_SimpleXMLIterator', 'ext/simplexml/php_simplexml'], + 'SimpleXMLElement' => ['ce_SimpleXMLElement', 'ext/simplexml/php_simplexml'], /** - * Zend exceptions + * SOAP + * + * @link https://github.com/php/php-src/tree/master/ext/soap */ - 'Throwable' => ['zend_ce_throwable'], - 'Exception' => ['zend_ce_exception'], - 'ErrorException' => ['zend_ce_error_exception'], - 'Error' => ['zend_ce_error'], - 'CompileError' => ['zend_ce_compile_error'], - 'ParseError' => ['zend_ce_parse_error'], - 'TypeError' => ['zend_ce_type_error'], - 'ArgumentCountError' => ['zend_ce_argument_count_error'], - 'ValueError' => ['zend_ce_value_error'], - 'ArithmeticError' => ['zend_ce_arithmetic_error'], - 'DivisionByZeroError' => ['zend_ce_division_by_zero_error'], - 'UnhandledMatchError' => ['zend_ce_unhandled_match_error'], + 'SoapClient' => ['soap_class_entry', 'ext/soap/php_soap'], + 'SoapVar' => ['soap_var_class_entry', 'ext/soap/php_soap'], /** - * Zend interfaces (Zend/zend_interfaces.h) + * Sockets */ - 'Traversable' => ['zend_ce_traversable'], - 'IteratorAggregate' => ['zend_ce_aggregate'], - 'Iterator' => ['zend_ce_iterator'], - 'ArrayAccess' => ['zend_ce_arrayaccess'], - 'Serializable' => ['zend_ce_serializable'], - 'Countable' => ['zend_ce_countable'], - 'Stringable' => ['zend_ce_stringable'], + 'Socket' => ['socket_ce', 'ext/sockets/php_sockets'], /** - * PDO + * SPL + */ + 'ArrayObject' => ['spl_ce_ArrayObject', 'ext/spl/spl_array'], + 'ArrayIterator' => ['spl_ce_ArrayIterator', 'ext/spl/spl_array'], + 'RecursiveArrayIterator' => ['spl_ce_RecursiveArrayIterator', 'ext/spl/spl_array'], + + 'SplFileInfo' => ['spl_ce_SplFileInfo', 'ext/spl/spl_directory'], + 'DirectoryIterator' => ['spl_ce_DirectoryIterator', 'ext/spl/spl_directory'], + 'FilesystemIterator' => ['spl_ce_FilesystemIterator', 'ext/spl/spl_directory'], + 'RecursiveDirectoryIterator' => ['spl_ce_RecursiveDirectoryIterator', 'ext/spl/spl_directory'], + 'GlobIterator' => ['spl_ce_GlobIterator', 'ext/spl/spl_directory'], + 'SplFileObject' => ['spl_ce_SplFileObject', 'ext/spl/spl_directory'], + 'SplTempFileObject' => ['spl_ce_SplTempFileObject', 'ext/spl/spl_directory'], + + 'SplDoublyLinkedList' => ['spl_ce_SplDoublyLinkedList', 'ext/spl/spl_dllist'], + 'SplQueue' => ['spl_ce_SplQueue', 'ext/spl/spl_dllist'], + 'SplStack' => ['spl_ce_SplStack', 'ext/spl/spl_dllist'], + + 'LogicException' => ['spl_ce_LogicException', 'ext/spl/spl_exceptions'], + 'BadFunctionCallException' => ['spl_ce_BadFunctionCallException', 'ext/spl/spl_exceptions'], + 'BadMethodCallException' => ['spl_ce_BadMethodCallException', 'ext/spl/spl_exceptions'], + 'DomainException' => ['spl_ce_DomainException', 'ext/spl/spl_exceptions'], + 'InvalidArgumentException' => ['spl_ce_InvalidArgumentException', 'ext/spl/spl_exceptions'], + 'LengthException' => ['spl_ce_LengthException', 'ext/spl/spl_exceptions'], + 'OutOfRangeException' => ['spl_ce_OutOfRangeException', 'ext/spl/spl_exceptions'], + 'RuntimeException' => ['spl_ce_RuntimeException', 'ext/spl/spl_exceptions'], + 'OutOfBoundsException' => ['spl_ce_OutOfBoundsException', 'ext/spl/spl_exceptions'], + 'OverflowException' => ['spl_ce_OverflowException', 'ext/spl/spl_exceptions'], + 'RangeException' => ['spl_ce_RangeException', 'ext/spl/spl_exceptions'], + 'UnderflowException' => ['spl_ce_UnderflowException', 'ext/spl/spl_exceptions'], + 'UnexpectedValueException' => ['spl_ce_UnexpectedValueException', 'ext/spl/spl_exceptions'], + + 'SplFixedArray' => ['spl_ce_SplFixedArray', 'ext/spl/spl_fixedarray'], + + 'SplHeap' => ['spl_ce_SplHeap', 'ext/spl/spl_heap'], + 'SplMinHeap' => ['spl_ce_SplMinHeap', 'ext/spl/spl_heap'], + 'SplMaxHeap' => ['spl_ce_SplMaxHeap', 'ext/spl/spl_heap'], + 'SplPriorityQueue' => ['spl_ce_SplPriorityQueue', 'ext/spl/spl_heap'], + + 'AppendIterator' => ['spl_ce_AppendIterator', 'ext/spl/spl_iterators'], + 'CachingIterator' => ['spl_ce_CachingIterator', 'ext/spl/spl_iterators'], + 'CallbackFilterIterator' => ['spl_ce_CallbackFilterIterator', 'ext/spl/spl_iterators'], + 'EmptyIterator' => ['spl_ce_EmptyIterator', 'ext/spl/spl_iterators'], + 'FilterIterator' => ['spl_ce_FilterIterator', 'ext/spl/spl_iterators'], + 'InfiniteIterator' => ['spl_ce_InfiniteIterator', 'ext/spl/spl_iterators'], + 'IteratorIterator' => ['spl_ce_IteratorIterator', 'ext/spl/spl_iterators'], + 'LimitIterator' => ['spl_ce_LimitIterator', 'ext/spl/spl_iterators'], + 'NoRewindIterator' => ['spl_ce_NoRewindIterator', 'ext/spl/spl_iterators'], + 'OuterIterator' => ['spl_ce_OuterIterator', 'ext/spl/spl_iterators'], + 'ParentIterator' => ['spl_ce_ParentIterator', 'ext/spl/spl_iterators'], + 'RecursiveCachingIterator' => ['spl_ce_RecursiveCachingIterator', 'ext/spl/spl_iterators'], + 'RecursiveCallbackFilterIterator' => ['spl_ce_RecursiveCallbackFilterIterator', 'ext/spl/spl_iterators'], + 'RecursiveFilterIterator' => ['spl_ce_RecursiveFilterIterator', 'ext/spl/spl_iterators'], + 'RecursiveIterator' => ['spl_ce_RecursiveIterator', 'ext/spl/spl_iterators'], + 'RecursiveIteratorIterator' => ['spl_ce_RecursiveIteratorIterator', 'ext/spl/spl_iterators'], + 'RecursiveRegexIterator' => ['spl_ce_RecursiveRegexIterator', 'ext/spl/spl_iterators'], + 'RecursiveTreeIterator' => ['spl_ce_RecursiveTreeIterator', 'ext/spl/spl_iterators'], + 'RegexIterator' => ['spl_ce_RegexIterator', 'ext/spl/spl_iterators'], + 'SeekableIterator' => ['spl_ce_SeekableIterator', 'ext/spl/spl_iterators'], + + 'SplObserver' => ['spl_ce_SplObserver', 'ext/spl/spl_observer'], + 'SplSubject' => ['spl_ce_SplSubject', 'ext/spl/spl_observer'], + 'SplObjectStorage' => ['spl_ce_SplObjectStorage', 'ext/spl/spl_observer'], + 'MultipleIterator' => ['spl_ce_MultipleIterator', 'ext/spl/spl_observer'], + + /** + * Standard */ - 'PDO' => ['php_pdo_get_dbh_ce()', 'ext/pdo/php_pdo_driver'], - 'PDOException' => ['php_pdo_get_exception()', 'ext/pdo/php_pdo_driver'], + 'AssertionError' => ['assertion_error_ce', 'ext/standard/php_assert'], + + '__PHP_Incomplete_Class' => ['php_ce_incomplete_class', 'ext/standard/php_incomplete_class'], - 'stdClass' => ['zend_standard_class_def'], + /** + * Closures + */ + 'Closure' => ['zend_ce_closure', 'Zend/zend_closures'], + + /** + * Zend exceptions + */ + 'Throwable' => ['zend_ce_throwable'], + 'Exception' => ['zend_ce_exception'], + 'ErrorException' => ['zend_ce_error_exception'], + 'Error' => ['zend_ce_error'], + 'CompileError' => ['zend_ce_compile_error'], + 'ParseError' => ['zend_ce_parse_error'], + 'TypeError' => ['zend_ce_type_error'], + 'ArgumentCountError' => ['zend_ce_argument_count_error'], + 'ValueError' => ['zend_ce_value_error'], + 'ArithmeticError' => ['zend_ce_arithmetic_error'], + 'DivisionByZeroError' => ['zend_ce_division_by_zero_error'], + 'UnhandledMatchError' => ['zend_ce_unhandled_match_error'], + + /** + * Zend interfaces (Zend/zend_interfaces.h) + */ + 'Traversable' => ['zend_ce_traversable'], + 'IteratorAggregate' => ['zend_ce_aggregate'], + 'Iterator' => ['zend_ce_iterator'], + 'ArrayAccess' => ['zend_ce_arrayaccess'], + 'Serializable' => ['zend_ce_serializable'], + 'Countable' => ['zend_ce_countable'], + 'Stringable' => ['zend_ce_stringable'], + + 'stdClass' => ['zend_standard_class_def'], ]; From 2e911d4b6e7824254ec9ca6f5cd33277874a9834 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 12 Sep 2021 12:15:36 +0100 Subject: [PATCH 28/39] #2278 - Disable MySQLi Class Entries --- config/class-entries.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/config/class-entries.php b/config/class-entries.php index a3e8e128c..461b8a0ff 100644 --- a/config/class-entries.php +++ b/config/class-entries.php @@ -126,12 +126,12 @@ * * @link https://github.com/php/php-src/tree/master/ext/mysqli */ - 'mysqli' => ['mysqli_link_class_entry', 'ext/mysqli/php_mysqli_structs'], - 'mysqli_stmt' => ['mysqli_stmt_class_entry', 'ext/mysqli/php_mysqli_structs'], - 'mysqli_result' => ['mysqli_result_class_entry', 'ext/mysqli/php_mysqli_structs'], - 'mysqli_driver' => ['mysqli_driver_class_entry', 'ext/mysqli/php_mysqli_structs'], - 'mysqli_warning' => ['mysqli_warning_class_entry', 'ext/mysqli/php_mysqli_structs'], - 'mysqli_sql_exception' => ['mysqli_exception_class_entry', 'ext/mysqli/php_mysqli_structs'], +// 'mysqli' => ['mysqli_link_class_entry', 'ext/mysqli/php_mysqli_structs'], +// 'mysqli_stmt' => ['mysqli_stmt_class_entry', 'ext/mysqli/php_mysqli_structs'], +// 'mysqli_result' => ['mysqli_result_class_entry', 'ext/mysqli/php_mysqli_structs'], +// 'mysqli_driver' => ['mysqli_driver_class_entry', 'ext/mysqli/php_mysqli_structs'], +// 'mysqli_warning' => ['mysqli_warning_class_entry', 'ext/mysqli/php_mysqli_structs'], +// 'mysqli_sql_exception' => ['mysqli_exception_class_entry', 'ext/mysqli/php_mysqli_structs'], /** * OCI8 From 1471303a222d5549705016cf37947654d7e6cc0b Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 12 Sep 2021 12:23:28 +0100 Subject: [PATCH 29/39] #2278 - Disable Reflection Class Entries --- config/class-entries.php | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/config/class-entries.php b/config/class-entries.php index 461b8a0ff..738699c2a 100644 --- a/config/class-entries.php +++ b/config/class-entries.php @@ -161,26 +161,26 @@ * * @link https://github.com/php/php-src/tree/master/ext/reflection */ - 'Reflector' => ['reflector_ptr', 'ext/reflection/php_reflection'], - 'ReflectionException' => ['reflection_exception_ptr', 'ext/reflection/php_reflection'], - 'Reflection' => ['reflection_ptr', 'ext/reflection/php_reflection'], - 'ReflectionFunctionAbstract' => ['reflection_function_abstract_ptr', 'ext/reflection/php_reflection'], - 'ReflectionFunction' => ['reflection_function_ptr', 'ext/reflection/php_reflection'], - 'ReflectionParameter' => ['reflection_parameter_ptr', 'ext/reflection/php_reflection'], - 'ReflectionType' => ['reflection_type_ptr', 'ext/reflection/php_reflection'], - 'ReflectionNamedType' => ['reflection_named_type_ptr', 'ext/reflection/php_reflection'], - 'ReflectionClass' => ['reflection_class_ptr', 'ext/reflection/php_reflection'], - 'ReflectionObject' => ['reflection_object_ptr', 'ext/reflection/php_reflection'], - 'ReflectionMethod' => ['reflection_method_ptr', 'ext/reflection/php_reflection'], - 'ReflectionProperty' => ['reflection_property_ptr', 'ext/reflection/php_reflection'], - 'ReflectionExtension' => ['reflection_extension_ptr', 'ext/reflection/php_reflection'], - 'ReflectionZendExtension' => ['reflection_zend_extension_ptr', 'ext/reflection/php_reflection'], - 'ReflectionReference' => ['reflection_reference_ptr', 'ext/reflection/php_reflection'], - 'ReflectionAttribute' => ['reflection_attribute_ptr', 'ext/reflection/php_reflection'], - 'ReflectionEnum' => ['reflection_enum_ptr', 'ext/reflection/php_reflection'], - 'ReflectionEnumUnitCase' => ['reflection_enum_unit_case_ptr', 'ext/reflection/php_reflection'], - 'ReflectionEnumBackedCase' => ['reflection_enum_backed_case_ptr', 'ext/reflection/php_reflection'], - 'ReflectionFiber' => ['reflection_fiber_ptr', 'ext/reflection/php_reflection'], +// 'Reflector' => ['reflector_ptr', 'ext/reflection/php_reflection'], +// 'ReflectionException' => ['reflection_exception_ptr', 'ext/reflection/php_reflection'], +// 'Reflection' => ['reflection_ptr', 'ext/reflection/php_reflection'], +// 'ReflectionFunctionAbstract' => ['reflection_function_abstract_ptr', 'ext/reflection/php_reflection'], +// 'ReflectionFunction' => ['reflection_function_ptr', 'ext/reflection/php_reflection'], +// 'ReflectionParameter' => ['reflection_parameter_ptr', 'ext/reflection/php_reflection'], +// 'ReflectionType' => ['reflection_type_ptr', 'ext/reflection/php_reflection'], +// 'ReflectionNamedType' => ['reflection_named_type_ptr', 'ext/reflection/php_reflection'], +// 'ReflectionClass' => ['reflection_class_ptr', 'ext/reflection/php_reflection'], +// 'ReflectionObject' => ['reflection_object_ptr', 'ext/reflection/php_reflection'], +// 'ReflectionMethod' => ['reflection_method_ptr', 'ext/reflection/php_reflection'], +// 'ReflectionProperty' => ['reflection_property_ptr', 'ext/reflection/php_reflection'], +// 'ReflectionExtension' => ['reflection_extension_ptr', 'ext/reflection/php_reflection'], +// 'ReflectionZendExtension' => ['reflection_zend_extension_ptr', 'ext/reflection/php_reflection'], +// 'ReflectionReference' => ['reflection_reference_ptr', 'ext/reflection/php_reflection'], +// 'ReflectionAttribute' => ['reflection_attribute_ptr', 'ext/reflection/php_reflection'], +// 'ReflectionEnum' => ['reflection_enum_ptr', 'ext/reflection/php_reflection'], +// 'ReflectionEnumUnitCase' => ['reflection_enum_unit_case_ptr', 'ext/reflection/php_reflection'], +// 'ReflectionEnumBackedCase' => ['reflection_enum_backed_case_ptr', 'ext/reflection/php_reflection'], +// 'ReflectionFiber' => ['reflection_fiber_ptr', 'ext/reflection/php_reflection'], /** * Session From 32180357b69b74c4f511addb088c6c37e8f23755 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sat, 18 Sep 2021 16:29:40 +0100 Subject: [PATCH 30/39] #2284 - Update Dockerfiles --- docker/7.4/Dockerfile | 22 +++------------------- docker/8.0/Dockerfile | 22 +++------------------- 2 files changed, 6 insertions(+), 38 deletions(-) diff --git a/docker/7.4/Dockerfile b/docker/7.4/Dockerfile index 6dd0d38a9..b3fb2bc67 100644 --- a/docker/7.4/Dockerfile +++ b/docker/7.4/Dockerfile @@ -1,4 +1,4 @@ -FROM composer:2.0.8 as composer +FROM composer:latest as composer FROM php:7.4-fpm RUN CPU_CORES="$(getconf _NPROCESSORS_ONLN)"; @@ -13,26 +13,10 @@ RUN apt update -y && apt install -y \ libicu-dev \ libgmp-dev \ libzip-dev && \ - pecl install psr + pecl install psr zephir_parser RUN docker-php-ext-install zip gmp intl mysqli && \ - docker-php-ext-enable psr - -# Install Zephir parser -RUN PHP_INI_DIR="$(dirname "$(php -i | grep /.+/conf.d/.+.ini -oE | head -n 1)")" && \ - cd /opt && \ - git clone -b "development" \ - --depth 1 \ - -q https://github.com/phalcon/php-zephir-parser \ - php-zephir-parser && \ - cd php-zephir-parser || exit 1 && \ - phpize && \ - ./configure --with-php-config="$(command -v php-config)" --enable-zephir_parser && \ - make -j"$(getconf _NPROCESSORS_ONLN)" && \ - sudo make install && \ - echo 'extension="zephir_parser.so"' |\ - sudo tee "$PHP_INI_DIR/zephir_parser.ini" && \ - php --ri "Zephir Parser" + docker-php-ext-enable psr zephir_parser COPY --from=composer /usr/bin/composer /usr/local/bin/composer diff --git a/docker/8.0/Dockerfile b/docker/8.0/Dockerfile index e96b89880..642980835 100644 --- a/docker/8.0/Dockerfile +++ b/docker/8.0/Dockerfile @@ -1,4 +1,4 @@ -FROM composer:2.0.8 as composer +FROM composer:latest as composer FROM php:8.0-fpm RUN CPU_CORES="$(getconf _NPROCESSORS_ONLN)"; @@ -13,26 +13,10 @@ RUN apt update -y && apt install -y \ libicu-dev \ libgmp-dev \ libzip-dev && \ - pecl install psr + pecl install psr zephir_parser RUN docker-php-ext-install zip gmp intl mysqli && \ - docker-php-ext-enable psr - -# Install Zephir parser -RUN PHP_INI_DIR="$(dirname "$(php -i | grep /.+/conf.d/.+.ini -oE | head -n 1)")" && \ - cd /opt && \ - git clone -b "development" \ - --depth 1 \ - -q https://github.com/phalcon/php-zephir-parser \ - php-zephir-parser && \ - cd php-zephir-parser || exit 1 && \ - phpize && \ - ./configure --with-php-config="$(command -v php-config)" --enable-zephir_parser && \ - make -j"$(getconf _NPROCESSORS_ONLN)" && \ - sudo make install && \ - echo 'extension="zephir_parser.so"' |\ - sudo tee "$PHP_INI_DIR/zephir_parser.ini" && \ - php --ri "Zephir Parser" + docker-php-ext-enable psr zephir_parser COPY --from=composer /usr/bin/composer /usr/local/bin/composer From a8c8d93d4c03659340e49872a37f97f541baea34 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sat, 18 Sep 2021 16:30:04 +0100 Subject: [PATCH 31/39] #2284 - Review Win builds --- .github/workflows/build-windows.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index 4f3b8a2da..1cfb1619a 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -13,7 +13,7 @@ on: - development env: - PARSER_VERSION: 1.3.8 + PARSER_VERSION: 1.4.1 PARSER_RELEASE: 559 PHP_SDK_VERSION: 2.2.0 PHP_DEVPACK: C:\tools\php-devpack @@ -120,10 +120,10 @@ jobs: InstallZephirParser - name: Enable Zephir Parser - run: Enable-PhpExtension -Extension 'Zephir Parser' -Path "${env:PHPROOT}" + run: Enable-PhpExtension -Extension zephir_parser -Path "${env:PHPROOT}" - name: Minimal Zephir Parser Load Test - run: php --ri 'Zephir Parser' + run: php --ri zephir_parser - name: "Setup Visual Studio Command Line for PHP SDK ${{ matrix.arch }}" run: .ci\vsenv.bat -arch=${{ matrix.arch }} -host_arch=${{ matrix.arch }} From 371b4a85a653c3a2d07a1bb24fb785ea8e48224a Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sat, 18 Sep 2021 16:30:19 +0100 Subject: [PATCH 32/39] #2284 - Simplify unix builds --- .github/workflows/build-unix.yml | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build-unix.yml b/.github/workflows/build-unix.yml index ea504b409..cb90141c3 100644 --- a/.github/workflows/build-unix.yml +++ b/.github/workflows/build-unix.yml @@ -11,7 +11,7 @@ on: - development env: - ZEPHIR_PARSER_VERSION: v1.3.8 + ZEPHIR_PARSER_VERSION: 1.4.1 jobs: linux: @@ -47,7 +47,7 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} - extensions: gmp, pdo_sqlite, psr, zip + extensions: gmp, pdo_sqlite, psr, zip, zephir_parser-${{ env.ZEPHIR_PARSER_VERSION }} tools: phpize, php-config coverage: xdebug # variables_order: https://github.com/zephir-lang/zephir/pull/1537 @@ -100,20 +100,6 @@ jobs: sudo apt-get update --quiet --yes 1>/dev/null sudo apt-get install --no-install-recommends -q -y re2c - - name: Get Zephir Parser Cache Key - id: pcache - run: echo ::set-output name=key::$(echo -n ${ZEPHIR_PARSER_VERSION}_${CPUHASH}) - - - name: Cache Zephir Parser - uses: actions/cache@v1 - with: - path: ~/php-zephir-parser - key: ${{ runner.os }}-${{ matrix.php }}-zephir-parser-${{ steps.pcache.outputs.key }} - restore-keys: ${{ runner.os }}-${{ matrix.php }}-zephir-parser- - - - name: Install Zephir Parser - run: .ci/install-zephir-parser.sh - - name: Get Composer Cache Directory id: composer-cache run: echo ::set-output name=dir::$(composer config cache-files-dir) From cf96cfdf96846cecc92f33b37f643bb2b86c6db1 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sat, 18 Sep 2021 16:30:36 +0100 Subject: [PATCH 33/39] #2284 - Remove install-zephir-parser.sh --- .ci/install-zephir-parser.sh | 37 ------------------------------------ 1 file changed, 37 deletions(-) delete mode 100755 .ci/install-zephir-parser.sh diff --git a/.ci/install-zephir-parser.sh b/.ci/install-zephir-parser.sh deleted file mode 100755 index fc653997a..000000000 --- a/.ci/install-zephir-parser.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env bash -# -# This file is part of the Zephir. -# -# (c) Zephir Team -# -# For the full copyright and license information, please view the -# LICENSE file that was distributed with this source code. - -# -e Exit immediately if a command exits with a non-zero status. -# -u Treat unset variables as an error when substituting. -set -eu - -: "${ZEPHIR_PARSER_VERSION:=development}" - -echo "Install Zephir Parser using version: $ZEPHIR_PARSER_VERSION" - -PHP_INI_DIR="$(dirname "$(php -i | grep /.+/conf.d/.+.ini -oE | head -n 1)")" - -if [ ! -d "php-zephir-parser" ]; then - git clone -b "$ZEPHIR_PARSER_VERSION" \ - --depth 1 \ - -q https://github.com/phalcon/php-zephir-parser \ - php-zephir-parser -fi - -cd php-zephir-parser || exit 1 - -phpize -./configure --with-php-config="$(command -v php-config)" --enable-zephir_parser -make -j"$(getconf _NPROCESSORS_ONLN)" -sudo make install - -echo 'extension="zephir_parser.so"' |\ - sudo tee "$PHP_INI_DIR/zephir_parser.ini" - -php --ri "Zephir Parser" From 2e0fc9047a6655d44da57828e115bc787a3c6410 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sat, 18 Sep 2021 16:35:50 +0100 Subject: [PATCH 34/39] #2284 - Refactor Parser class --- Library/Parser/Parser.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/Library/Parser/Parser.php b/Library/Parser/Parser.php index aa18bb66c..722ab6b7b 100644 --- a/Library/Parser/Parser.php +++ b/Library/Parser/Parser.php @@ -9,12 +9,16 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Parser; use Zephir\Exception\IllegalStateException; use Zephir\Exception\InvalidArgumentException; use Zephir\Exception\ParseException; +use function function_exists; + class Parser { /** @@ -22,9 +26,9 @@ class Parser * * @return bool */ - public function isAvailable() + public function isAvailable(): bool { - return \function_exists('zephir_parse_file'); + return function_exists('zephir_parse_file'); } /** @@ -32,9 +36,9 @@ public function isAvailable() * * @return string|null */ - public function getVersion() + public function getVersion(): ?string { - return phpversion('Zephir Parser') ?: null; + return phpversion('zephir_parser') ?: null; } /** @@ -42,13 +46,13 @@ public function getVersion() * * @param string $filePath Absolute path to the *.zep file * - * @throws IllegalStateException + * @return array * @throws InvalidArgumentException * @throws ParseException * - * @return array + * @throws IllegalStateException */ - public function parse($filePath) + public function parse(string $filePath): array { if (!$this->isAvailable()) { throw new IllegalStateException("Zephir Parser extension couldn't be loaded."); From dcad12c3b1e48a406fd2e17f53be02aad82c959a Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sat, 18 Sep 2021 18:20:51 +0100 Subject: [PATCH 35/39] Update composer.lock --- composer.lock | 69 +++++++++++++++++++++++++++------------------------ 1 file changed, 36 insertions(+), 33 deletions(-) diff --git a/composer.lock b/composer.lock index c550e3055..c5cae939f 100644 --- a/composer.lock +++ b/composer.lock @@ -149,24 +149,24 @@ }, { "name": "monolog/monolog", - "version": "2.3.2", + "version": "2.3.4", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "71312564759a7db5b789296369c1a264efc43aad" + "reference": "437e7a1c50044b92773b361af77620efb76fff59" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/71312564759a7db5b789296369c1a264efc43aad", - "reference": "71312564759a7db5b789296369c1a264efc43aad", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/437e7a1c50044b92773b361af77620efb76fff59", + "reference": "437e7a1c50044b92773b361af77620efb76fff59", "shasum": "" }, "require": { "php": ">=7.2", - "psr/log": "^1.0.1" + "psr/log": "^1.0.1 || ^2.0 || ^3.0" }, "provide": { - "psr/log-implementation": "1.0.0" + "psr/log-implementation": "1.0.0 || 2.0.0 || 3.0.0" }, "require-dev": { "aws/aws-sdk-php": "^2.4.9 || ^3.0", @@ -181,7 +181,7 @@ "phpunit/phpunit": "^8.5", "predis/predis": "^1.1", "rollbar/rollbar": "^1.3", - "ruflin/elastica": ">=0.90 <7.0.1", + "ruflin/elastica": ">=0.90@dev", "swiftmailer/swiftmailer": "^5.3|^6.0" }, "suggest": { @@ -189,8 +189,11 @@ "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-curl": "Required to send log messages using the IFTTTHandler, the LogglyHandler, the SendGridHandler, the SlackWebhookHandler or the TelegramBotHandler", "ext-mbstring": "Allow to work properly with unicode symbols", "ext-mongodb": "Allow sending log messages to a MongoDB server (via driver)", + "ext-openssl": "Required to send log messages using SSL", + "ext-sockets": "Allow sending log messages to a Syslog server (via UDP driver)", "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", "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", @@ -229,7 +232,7 @@ ], "support": { "issues": "https://github.com/Seldaek/monolog/issues", - "source": "https://github.com/Seldaek/monolog/tree/2.3.2" + "source": "https://github.com/Seldaek/monolog/tree/2.3.4" }, "funding": [ { @@ -241,7 +244,7 @@ "type": "tidelift" } ], - "time": "2021-07-23T07:42:52+00:00" + "time": "2021-09-15T11:27:21+00:00" }, { "name": "psr/cache", @@ -3345,16 +3348,16 @@ }, { "name": "phpdocumentor/type-resolver", - "version": "1.4.0", + "version": "1.5.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0" + "reference": "30f38bffc6f24293dadd1823936372dfa9e86e2f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", - "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/30f38bffc6f24293dadd1823936372dfa9e86e2f", + "reference": "30f38bffc6f24293dadd1823936372dfa9e86e2f", "shasum": "" }, "require": { @@ -3362,7 +3365,8 @@ "phpdocumentor/reflection-common": "^2.0" }, "require-dev": { - "ext-tokenizer": "*" + "ext-tokenizer": "*", + "psalm/phar": "^4.8" }, "type": "library", "extra": { @@ -3388,39 +3392,39 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.4.0" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.5.0" }, - "time": "2020-09-17T18:55:26+00:00" + "time": "2021-09-17T15:28:14+00:00" }, { "name": "phpspec/prophecy", - "version": "1.13.0", + "version": "1.14.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "be1996ed8adc35c3fd795488a653f4b518be70ea" + "reference": "d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/be1996ed8adc35c3fd795488a653f4b518be70ea", - "reference": "be1996ed8adc35c3fd795488a653f4b518be70ea", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e", + "reference": "d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e", "shasum": "" }, "require": { "doctrine/instantiator": "^1.2", - "php": "^7.2 || ~8.0, <8.1", + "php": "^7.2 || ~8.0, <8.2", "phpdocumentor/reflection-docblock": "^5.2", "sebastian/comparator": "^3.0 || ^4.0", "sebastian/recursion-context": "^3.0 || ^4.0" }, "require-dev": { - "phpspec/phpspec": "^6.0", + "phpspec/phpspec": "^6.0 || ^7.0", "phpunit/phpunit": "^8.0 || ^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.11.x-dev" + "dev-master": "1.x-dev" } }, "autoload": { @@ -3455,29 +3459,29 @@ ], "support": { "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/1.13.0" + "source": "https://github.com/phpspec/prophecy/tree/1.14.0" }, - "time": "2021-03-17T13:42:18+00:00" + "time": "2021-09-10T09:02:12+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "9.2.6", + "version": "9.2.7", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "f6293e1b30a2354e8428e004689671b83871edde" + "reference": "d4c798ed8d51506800b441f7a13ecb0f76f12218" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/f6293e1b30a2354e8428e004689671b83871edde", - "reference": "f6293e1b30a2354e8428e004689671b83871edde", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/d4c798ed8d51506800b441f7a13ecb0f76f12218", + "reference": "d4c798ed8d51506800b441f7a13ecb0f76f12218", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.10.2", + "nikic/php-parser": "^4.12.0", "php": ">=7.3", "phpunit/php-file-iterator": "^3.0.3", "phpunit/php-text-template": "^2.0.2", @@ -3526,7 +3530,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.6" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.7" }, "funding": [ { @@ -3534,7 +3538,7 @@ "type": "github" } ], - "time": "2021-03-28T07:26:59+00:00" + "time": "2021-09-17T05:39:03+00:00" }, { "name": "phpunit/php-file-iterator", @@ -4733,7 +4737,6 @@ "type": "github" } ], - "abandoned": true, "time": "2020-09-28T06:45:17+00:00" }, { From 7245ec02ffac71483ae362572bf5335d50c666b4 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sat, 18 Sep 2021 18:24:39 +0100 Subject: [PATCH 36/39] Update CHANGELOG.md --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9cf0d5ddf..4362b3663 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,9 +5,14 @@ The format based on [Keep a Changelog](http://keepachangelog.com) and this project adheres to [Semantic Versioning](http://semver.org). ## [Unreleased] + +## [0.14.0] - 2021-09-18 ### Added - Added support for `require_once` [#2253](https://github.com/zephir-lang/zephir/issues/2253) +### Changed +- Bumped minimal version of Zephir Parser to `1.4.1`. [#2284](https://github.com/zephir-lang/zephir/issues/2284) + ## [0.14.0-beta.3] - 2021-08-06 ### Fixed - Fixed class entry generation of external class [#2261](https://github.com/zephir-lang/zephir/issues/2261) From 52c3e01a7890a0b8a33acc36e3de0980dd7c8d89 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sat, 18 Sep 2021 18:25:09 +0100 Subject: [PATCH 37/39] Update CHANGELOG.md --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4362b3663..a2e6245a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -541,7 +541,8 @@ and this project adheres to [Semantic Versioning](http://semver.org). [#1524](https://github.com/zephir-lang/zephir/issues/1524) -[Unreleased]: https://github.com/zephir-lang/zephir/compare/0.14.0-beta.3...HEAD +[Unreleased]: https://github.com/zephir-lang/zephir/compare/0.14.0...HEAD +[0.14.0]: https://github.com/zephir-lang/zephir/compare/0.14.0-beta.3...0.14.0 [0.14.0-beta.3]: https://github.com/zephir-lang/zephir/compare/0.14.0-beta.2...0.14.0-beta.3 [0.14.0-beta.2]: https://github.com/zephir-lang/zephir/compare/0.14.0-beta.1...0.14.0-beta.2 [0.14.0-beta.1]: https://github.com/zephir-lang/zephir/compare/0.13.5...0.14.0-beta.1 From d3c2302880f0b02e8144768946b6cbdf4fcbb9cb Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sat, 18 Sep 2021 18:26:45 +0100 Subject: [PATCH 38/39] Bump version to `0.14.0` --- Library/Zephir.php | 2 +- ext/php_stub.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Library/Zephir.php b/Library/Zephir.php index c8b6ea166..a8cee23a2 100644 --- a/Library/Zephir.php +++ b/Library/Zephir.php @@ -16,7 +16,7 @@ */ final class Zephir { - public const VERSION = '0.14.0-beta.3-$Id$'; + public const VERSION = '0.14.0-$Id$'; public const LOGO = <<<'ASCII' _____ __ _ diff --git a/ext/php_stub.h b/ext/php_stub.h index 88d35ca30..46805732a 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.14.0-beta.3-$Id$" +#define PHP_STUB_ZEPVERSION "0.14.0-$Id$" #define PHP_STUB_DESCRIPTION "Description test for
Test Extension." typedef struct _zephir_struct_db { From e1b0dd10570e781c9408bd26d0f53107bfdff500 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sat, 18 Sep 2021 18:30:58 +0100 Subject: [PATCH 39/39] Regenerate ext/ directory --- ext/kernel/require.c | 79 +++++++++++++++++++++++++++++++++++++++++ ext/kernel/require.h | 16 ++++++--- ext/php_stub.h | 8 ++--- ext/stub/mcall.zep.c | 7 ++-- ext/stub/requires.zep.c | 29 +++++++++++++++ ext/stub/requires.zep.h | 6 ++++ ext/stub/strings.zep.c | 43 ++++++++++++++++++++++ ext/stub/strings.zep.h | 6 ++++ 8 files changed, 183 insertions(+), 11 deletions(-) diff --git a/ext/kernel/require.c b/ext/kernel/require.c index 2bab5554c..96160ba4e 100644 --- a/ext/kernel/require.c +++ b/ext/kernel/require.c @@ -89,3 +89,82 @@ int zephir_require_ret(zval *return_value_ptr, const char *require_path) return FAILURE; } + +/** + * Do an internal require once to a plain php file taking care of the value returned by the file + */ +int zephir_require_once_ret(zval *return_value_ptr, const char *require_path) +{ + zend_file_handle file_handle; + zend_op_array *new_op_array; + zval dummy, local_retval; + int ret; + + ZVAL_UNDEF(&local_retval); + +#ifndef ZEPHIR_RELEASE + if (return_value_ptr != NULL && Z_TYPE_P(return_value_ptr) > IS_NULL) { + fprintf(stderr, "%s: *return_value_ptr is expected to be NULL", __func__); + zephir_print_backtrace(); + abort(); + } +#endif + + ret = php_stream_open_for_zend_ex(require_path, &file_handle, USE_PATH|STREAM_OPEN_FOR_INCLUDE); + if (ret != SUCCESS) { + return FAILURE; + } + + if (zend_hash_exists(&EG(included_files), file_handle.opened_path)) { + zend_destroy_file_handle(&file_handle); + + if (return_value_ptr) { + ZVAL_TRUE(&local_retval); + + zval_ptr_dtor(return_value_ptr); + ZVAL_COPY_VALUE(return_value_ptr, &local_retval); + } else { + zval_ptr_dtor(&local_retval); + } + + return SUCCESS; + } + + new_op_array = zend_compile_file(&file_handle, ZEND_INCLUDE); + if (new_op_array) { + if (file_handle.handle.stream.handle) { + ZVAL_NULL(&dummy); + if (!file_handle.opened_path) { + file_handle.opened_path = zend_string_init(require_path, strlen(require_path), 0); + } + + zend_hash_add_empty_element(&EG(included_files), file_handle.opened_path); + zend_destroy_file_handle(&file_handle); + } + + new_op_array->scope = EG(fake_scope) ? EG(fake_scope) : zend_get_executed_scope(); + zend_execute(new_op_array, &local_retval); + + if (return_value_ptr) { + zval_ptr_dtor(return_value_ptr); + ZVAL_COPY_VALUE(return_value_ptr, &local_retval); + } else { + zval_ptr_dtor(&local_retval); + } + + destroy_op_array(new_op_array); + efree_size(new_op_array, sizeof(zend_op_array)); + + if (EG(exception)) { + ret = FAILURE; + } else { + ret = SUCCESS; + } + + return ret; + } else { + zend_destroy_file_handle(&file_handle); + } + + return FAILURE; +} diff --git a/ext/kernel/require.h b/ext/kernel/require.h index 30a2bca86..293eb1c55 100644 --- a/ext/kernel/require.h +++ b/ext/kernel/require.h @@ -15,11 +15,7 @@ #include "php_ext.h" int zephir_require_ret(zval *return_value_ptr, const char *require_path) ZEPHIR_ATTR_NONNULL1(2); - -ZEPHIR_ATTR_NONNULL static inline int zephir_require(const char *require_path) -{ - return zephir_require_ret(NULL, require_path); -} +int zephir_require_once_ret(zval *return_value_ptr, const char *require_path) ZEPHIR_ATTR_NONNULL1(2); ZEPHIR_ATTR_NONNULL static inline int zephir_require_zval(const zval *require_path) { @@ -31,4 +27,14 @@ ZEPHIR_ATTR_NONNULL static inline int zephir_require_zval_ret(zval *return_value return zephir_require_ret(return_value_ptr, Z_TYPE_P(require_path) == IS_STRING ? Z_STRVAL_P(require_path) : ""); } +ZEPHIR_ATTR_NONNULL static inline int zephir_require_once_zval(const zval *require_path) +{ + return zephir_require_once_ret(NULL, Z_TYPE_P(require_path) == IS_STRING ? Z_STRVAL_P(require_path) : ""); +} + +ZEPHIR_ATTR_NONNULL static inline int zephir_require_once_zval_ret(zval *return_value_ptr, const zval *require_path) +{ + return zephir_require_once_ret(return_value_ptr, Z_TYPE_P(require_path) == IS_STRING ? Z_STRVAL_P(require_path) : ""); +} + #endif /* ZEPHIR_KERNEL_REQUIRE_H */ diff --git a/ext/php_stub.h b/ext/php_stub.h index 46805732a..28fcad82c 100644 --- a/ext/php_stub.h +++ b/ext/php_stub.h @@ -17,18 +17,18 @@ #define PHP_STUB_ZEPVERSION "0.14.0-$Id$" #define PHP_STUB_DESCRIPTION "Description test for
Test Extension." -typedef struct _zephir_struct_db { +typedef struct _zephir_struct_db { zend_bool my_setting_1; int my_setting_2; double my_setting_3; } zephir_struct_db; -typedef struct _zephir_struct_orm { +typedef struct _zephir_struct_orm { int cache_level; zend_bool cache_enable; } zephir_struct_orm; -typedef struct _zephir_struct_extension { +typedef struct _zephir_struct_extension { zend_bool test_ini_variable; } zephir_struct_extension; @@ -49,7 +49,7 @@ ZEND_BEGIN_MODULE_GLOBALS(stub) /* Max recursion control */ unsigned int recursive_lock; - + zephir_struct_db db; zephir_struct_orm orm; diff --git a/ext/stub/mcall.zep.c b/ext/stub/mcall.zep.c index 4c277c33e..bc706450c 100644 --- a/ext/stub/mcall.zep.c +++ b/ext/stub/mcall.zep.c @@ -1208,8 +1208,11 @@ PHP_METHOD(Stub_Mcall, issue1136) if (zephir_is_true(&_3)) { ZEPHIR_INIT_VAR(&_finfo); object_init_ex(&_finfo, zephir_get_internal_ce(SL("finfo"))); - ZEPHIR_CALL_METHOD(NULL, &_finfo, "__construct", NULL, 0); - zephir_check_call_status(); + if (zephir_has_constructor(&_finfo)) { + ZEPHIR_CALL_METHOD(NULL, &_finfo, "__construct", NULL, 0); + zephir_check_call_status(); + } + } else { ZEPHIR_CALL_FUNCTION(&_finfo, "finfo_open", NULL, 59); zephir_check_call_status(); diff --git a/ext/stub/requires.zep.c b/ext/stub/requires.zep.c index c38d225bd..3f249a343 100644 --- a/ext/stub/requires.zep.c +++ b/ext/stub/requires.zep.c @@ -229,3 +229,32 @@ PHP_METHOD(Stub_Requires, renderTemplate) RETURN_CCTOR(&_7); } +PHP_METHOD(Stub_Requires, requireOnce) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *path_param = NULL, _0; + zval path; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&path); + ZVAL_UNDEF(&_0); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(path) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &path_param); + zephir_get_strval(&path, path_param); + + + ZEPHIR_OBSERVE_OR_NULLIFY_PPZV(&_0); + if (zephir_require_once_zval_ret(&_0, &path) == FAILURE) { + RETURN_MM_NULL(); + } + RETURN_CCTOR(&_0); +} + diff --git a/ext/stub/requires.zep.h b/ext/stub/requires.zep.h index 8c5c95593..2a631e9de 100644 --- a/ext/stub/requires.zep.h +++ b/ext/stub/requires.zep.h @@ -8,6 +8,7 @@ PHP_METHOD(Stub_Requires, requireExternal2); PHP_METHOD(Stub_Requires, requireExternal3); PHP_METHOD(Stub_Requires, setContent); PHP_METHOD(Stub_Requires, renderTemplate); +PHP_METHOD(Stub_Requires, requireOnce); ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_requires_requireexternal1, 0, 0, 1) ZEND_ARG_INFO(0, path) @@ -31,11 +32,16 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_requires_rendertemplate, 0, 0, 2) ZEND_ARG_INFO(0, params) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_requires_requireonce, 0, 0, 1) + ZEND_ARG_TYPE_INFO(0, path, IS_STRING, 0) +ZEND_END_ARG_INFO() + ZEPHIR_INIT_FUNCS(stub_requires_method_entry) { PHP_ME(Stub_Requires, requireExternal1, arginfo_stub_requires_requireexternal1, ZEND_ACC_PUBLIC) PHP_ME(Stub_Requires, requireExternal2, arginfo_stub_requires_requireexternal2, ZEND_ACC_PUBLIC) PHP_ME(Stub_Requires, requireExternal3, arginfo_stub_requires_requireexternal3, ZEND_ACC_PUBLIC) PHP_ME(Stub_Requires, setContent, arginfo_stub_requires_setcontent, ZEND_ACC_PUBLIC) PHP_ME(Stub_Requires, renderTemplate, arginfo_stub_requires_rendertemplate, ZEND_ACC_PUBLIC) + PHP_ME(Stub_Requires, requireOnce, arginfo_stub_requires_requireonce, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/strings.zep.c b/ext/stub/strings.zep.c index dc24fee9a..eb862bf39 100644 --- a/ext/stub/strings.zep.c +++ b/ext/stub/strings.zep.c @@ -1040,3 +1040,46 @@ PHP_METHOD(Stub_Strings, issue2234StrictChild) RETURN_CTOR(&val); } +/** + * @issue https://github.com/zephir-lang/zephir/issues/1932 + */ +PHP_METHOD(Stub_Strings, nullableStringReturnType) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *val_param = NULL; + zval val; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&val); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(0, 1) + Z_PARAM_OPTIONAL + Z_PARAM_STR_OR_NULL(val) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 0, 1, &val_param); + if (!val_param) { + ZEPHIR_INIT_VAR(&val); + } else { + if (UNEXPECTED(Z_TYPE_P(val_param) != IS_STRING && Z_TYPE_P(val_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'val' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(val_param) == IS_STRING)) { + zephir_get_strval(&val, val_param); + } else { + ZEPHIR_INIT_VAR(&val); + } + } + + + if (!ZEPHIR_IS_NULL(&val)) { + RETURN_CTOR(&val); + } + RETURN_MM_NULL(); +} + diff --git a/ext/stub/strings.zep.h b/ext/stub/strings.zep.h index d3136a9c6..8b665b3b1 100644 --- a/ext/stub/strings.zep.h +++ b/ext/stub/strings.zep.h @@ -41,6 +41,7 @@ PHP_METHOD(Stub_Strings, issue2186Child2); PHP_METHOD(Stub_Strings, issue2234Strict); PHP_METHOD(Stub_Strings, issue2234StrictParent); PHP_METHOD(Stub_Strings, issue2234StrictChild); +PHP_METHOD(Stub_Strings, nullableStringReturnType); ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_strings_camelize, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0) @@ -203,6 +204,10 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_strings_issue2234strictchild, 0, 0, 0) ZEND_ARG_TYPE_INFO(0, val, IS_STRING, 1) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_strings_nullablestringreturntype, 0, 0, IS_STRING, 1) + ZEND_ARG_TYPE_INFO(0, val, IS_STRING, 1) +ZEND_END_ARG_INFO() + ZEPHIR_INIT_FUNCS(stub_strings_method_entry) { PHP_ME(Stub_Strings, camelize, arginfo_stub_strings_camelize, ZEND_ACC_PUBLIC) PHP_ME(Stub_Strings, uncamelize, arginfo_stub_strings_uncamelize, ZEND_ACC_PUBLIC) @@ -266,5 +271,6 @@ ZEPHIR_INIT_FUNCS(stub_strings_method_entry) { PHP_ME(Stub_Strings, issue2234Strict, arginfo_stub_strings_issue2234strict, ZEND_ACC_PUBLIC) PHP_ME(Stub_Strings, issue2234StrictParent, arginfo_stub_strings_issue2234strictparent, ZEND_ACC_PUBLIC) PHP_ME(Stub_Strings, issue2234StrictChild, arginfo_stub_strings_issue2234strictchild, ZEND_ACC_PROTECTED) + PHP_ME(Stub_Strings, nullableStringReturnType, arginfo_stub_strings_nullablestringreturntype, ZEND_ACC_PUBLIC) PHP_FE_END };