diff --git a/CHANGELOG.md b/CHANGELOG.md index dfe2893cfb..57b7d9c686 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,9 +6,17 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] +## [0.11.12] - 2019-03-24 +### Fixed +- Compilation error for instanceof [#1828](https://github.com/phalcon/zephir/issues/1828) +- Fixed `array_shift` behavior to mimicry PHP's "change by reference" + [#1831](https://github.com/phalcon/zephir/issues/1831) +- Fixed reference counting while changing object's properties that are arrays + [#1833](https://github.com/phalcon/zephir/pull/1833) + ## [0.11.11] - 2019-02-26 ### Fixed -- Objects are not traversable with foreach +- Objects are not traversable with `foreach` [#1818](https://github.com/phalcon/zephir/issues/1818) [#1595](https://github.com/phalcon/zephir/issues/1595) - Recursion for array_push on PHP 7 [#1140](https://github.com/phalcon/zephir/issues/1140) @@ -143,8 +151,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/). [5deb64a](https://github.com/phalcon/zephir/commit/5deb64a8a1c7c18d45ce1a5a55667c499e2c284f) - Fixed casting resource to int (only ZendEngine 3) [#1524](https://github.com/phalcon/zephir/issues/1524) - -[Unreleased]: https://github.com/phalcon/zephir/compare/0.11.11...HEAD + +[Unreleased]: https://github.com/phalcon/zephir/compare/0.11.12...HEAD +[0.11.12]: https://github.com/phalcon/zephir/compare/0.11.11...0.11.12 [0.11.11]: https://github.com/phalcon/zephir/compare/0.11.10...0.11.11 [0.11.10]: https://github.com/phalcon/zephir/compare/0.11.9...0.11.10 [0.11.9]: https://github.com/phalcon/zephir/compare/0.11.8...0.11.9 diff --git a/Library/Operators/Other/InstanceOfOperator.php b/Library/Operators/Other/InstanceOfOperator.php index 8d5c7ab5b8..1b3a2ef47e 100644 --- a/Library/Operators/Other/InstanceOfOperator.php +++ b/Library/Operators/Other/InstanceOfOperator.php @@ -5,8 +5,8 @@ * * (c) Zephir Team * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. */ namespace Zephir\Operators\Other; @@ -107,7 +107,7 @@ public function compile($expression, CompilationContext $context) } } } else { - $code = 'Z_STRVAL_P('.$resolvedVariable.'), Z_STRLEN_P('.$resolvedVariable.')'; + $code = $this->prepareBackendSpecificCode($resolvedVariable, $context); } break; @@ -118,7 +118,7 @@ public function compile($expression, CompilationContext $context) $tempVariable->setMustInitNull(true); $tempVariableName = $tempVariable->getName(); $context->codePrinter->output('zephir_get_strval('.$tempVariableName.', '.$resolvedVariable.');'); - $code = 'Z_STRVAL_P('.$tempVariableName.'), Z_STRLEN_P('.$tempVariableName.')'; + $code = $this->prepareBackendSpecificCode($tempVariableName, $context); break; default: @@ -135,4 +135,12 @@ public function compile($expression, CompilationContext $context) return new CompiledExpression('bool', 'zephir_instance_of_ev('.$symbol.', '.$classEntry.' TSRMLS_CC)', $expression); } + + private function prepareBackendSpecificCode($variable, CompilationContext $context) + { + return strtr('Z_STRVAL_P(:p:name), Z_STRLEN_P(:p:name)', [ + ':name' => $variable, + ':p' => $context->backend->isZE3() ? '&' : '', + ]); + } } diff --git a/Library/Zephir.php b/Library/Zephir.php index 2c90b46d55..9a302674bb 100644 --- a/Library/Zephir.php +++ b/Library/Zephir.php @@ -5,8 +5,8 @@ * * (c) Zephir Team * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. */ namespace Zephir; @@ -16,7 +16,7 @@ */ final class Zephir { - const VERSION = '0.11.11-$Id$'; + const VERSION = '0.11.12-$Id$'; const RELEASE_DATE = '$release-date$'; diff --git a/appveyor.yml b/appveyor.yml index 0961f7e501..34ebd473b4 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -version: 0.11.11-{build} +version: 0.11.12-{build} environment: matrix: diff --git a/ext/config.m4 b/ext/config.m4 index 52c0911b79..26f6f41f3e 100644 --- a/ext/config.m4 +++ b/ext/config.m4 @@ -26,6 +26,8 @@ if test "$PHP_TEST" = "yes"; then test/arithmetic.zep.c test/arrayaccessobj.zep.c test/arrayaccesstest.zep.c + test/arrayiterator.zep.c + test/arrayiteratortest.zep.c test/arrayobject.zep.c test/arraysearch.zep.c test/assign.zep.c diff --git a/ext/config.w32 b/ext/config.w32 index f7ff4e11a6..c5b51b35dd 100644 --- a/ext/config.w32 +++ b/ext/config.w32 @@ -10,7 +10,7 @@ if (PHP_TEST != "no") { AC_DEFINE("ZEPHIR_USE_PHP_JSON", 1, "Whether PHP json extension is present at compile time"); } - ADD_SOURCES(configure_module_dirname + "/test", "testinterface.zep.c scallparent.zep.c constantsparent.zep.c methodinterface.zep.c arithmetic.zep.c arrayaccessobj.zep.c arrayaccesstest.zep.c arrayobject.zep.c arraysearch.zep.c assign.zep.c bitwise.zep.c branchprediction.zep.c cast.zep.c cblock.zep.c chars.zep.c closures.zep.c compare.zep.c concat.zep.c constants.zep.c constantsinterface.zep.c constantsinterfacea.zep.c constantsinterfaceb.zep.c declaretest.zep.c diinterface.zep.c echoes.zep.c emptytest.zep.c evaltest.zep.c exception.zep.c exceptions.zep.c exists.zep.c exitdie.zep.c extendedinterface.zep.c factorial.zep.c fannkuch.zep.c fasta.zep.c fcall.zep.c fetchtest.zep.c fibonnaci.zep.c flow.zep.c fortytwo.zep.c functional.zep.c functionexists.zep.c geometry.zep.c globals.zep.c instance.zep.c instanceoff.zep.c internalclasses.zep.c internalinterfaces.zep.c invoke.zep.c issettest.zep.c issue1404.zep.c issue1521.zep.c issues.zep.c json.zep.c logical.zep.c mcall.zep.c mcallchained.zep.c mcalldynamic.zep.c mcallinternal.zep.c methodabstract.zep.c methodargs.zep.c nativearray.zep.c oo.zep.c operator.zep.c pdostatement.zep.c pregmatch.zep.c quantum.zep.c range.zep.c references.zep.c regexdna.zep.c requires.zep.c resourcetest.zep.c returns.zep.c router.zep.c scall.zep.c scalldynamic.zep.c scallexternal.zep.c scope.zep.c sort.zep.c spectralnorm.zep.c spropertyaccess.zep.c statements.zep.c strings.zep.c stubs.zep.c ternary.zep.c trytest.zep.c typeinstances.zep.c typeoff.zep.c unknownclass.zep.c unsettest.zep.c usetest.zep.c vars.zep.c 0__closure.zep.c 1__closure.zep.c 2__closure.zep.c 3__closure.zep.c 4__closure.zep.c 5__closure.zep.c 6__closure.zep.c 7__closure.zep.c 8__closure.zep.c 9__closure.zep.c 10__closure.zep.c", "test"); + ADD_SOURCES(configure_module_dirname + "/test", "testinterface.zep.c scallparent.zep.c constantsparent.zep.c methodinterface.zep.c arithmetic.zep.c arrayaccessobj.zep.c arrayaccesstest.zep.c arrayiterator.zep.c arrayiteratortest.zep.c arrayobject.zep.c arraysearch.zep.c assign.zep.c bitwise.zep.c branchprediction.zep.c cast.zep.c cblock.zep.c chars.zep.c closures.zep.c compare.zep.c concat.zep.c constants.zep.c constantsinterface.zep.c constantsinterfacea.zep.c constantsinterfaceb.zep.c declaretest.zep.c diinterface.zep.c echoes.zep.c emptytest.zep.c evaltest.zep.c exception.zep.c exceptions.zep.c exists.zep.c exitdie.zep.c extendedinterface.zep.c factorial.zep.c fannkuch.zep.c fasta.zep.c fcall.zep.c fetchtest.zep.c fibonnaci.zep.c flow.zep.c fortytwo.zep.c functional.zep.c functionexists.zep.c geometry.zep.c globals.zep.c instance.zep.c instanceoff.zep.c internalclasses.zep.c internalinterfaces.zep.c invoke.zep.c issettest.zep.c issue1404.zep.c issue1521.zep.c issues.zep.c json.zep.c logical.zep.c mcall.zep.c mcallchained.zep.c mcalldynamic.zep.c mcallinternal.zep.c methodabstract.zep.c methodargs.zep.c nativearray.zep.c oo.zep.c operator.zep.c pdostatement.zep.c pregmatch.zep.c quantum.zep.c range.zep.c references.zep.c regexdna.zep.c requires.zep.c resourcetest.zep.c returns.zep.c router.zep.c scall.zep.c scalldynamic.zep.c scallexternal.zep.c scope.zep.c sort.zep.c spectralnorm.zep.c spropertyaccess.zep.c statements.zep.c strings.zep.c stubs.zep.c ternary.zep.c trytest.zep.c typeinstances.zep.c typeoff.zep.c unknownclass.zep.c unsettest.zep.c usetest.zep.c vars.zep.c 0__closure.zep.c 1__closure.zep.c 2__closure.zep.c 3__closure.zep.c 4__closure.zep.c 5__closure.zep.c 6__closure.zep.c 7__closure.zep.c 8__closure.zep.c 9__closure.zep.c 10__closure.zep.c", "test"); ADD_SOURCES(configure_module_dirname + "/test/oo/extend", "exception.zep.c", "test"); ADD_SOURCES(configure_module_dirname + "/test/oo/extend/db", "exception.zep.c", "test"); ADD_SOURCES(configure_module_dirname + "/test/globals/session", "base.zep.c child.zep.c", "test"); diff --git a/ext/kernel/main.c b/ext/kernel/main.c index 2d896d7803..bb0d0115d9 100644 --- a/ext/kernel/main.c +++ b/ext/kernel/main.c @@ -23,6 +23,7 @@ #include "kernel/main.h" #include "kernel/memory.h" #include "kernel/fcall.h" +#include "kernel/object.h" #include "kernel/exception.h" @@ -32,7 +33,9 @@ zend_string* i_self = NULL; int zephir_is_iterable_ex(zval *arr, int duplicate) { - if (UNEXPECTED(Z_TYPE_P(arr) != IS_ARRAY)) { + if (UNEXPECTED(Z_TYPE_P(arr) == IS_OBJECT && zephir_instance_of_ev(arr, (const zend_class_entry *)zend_ce_iterator))) { + return 1; + } else if (UNEXPECTED(Z_TYPE_P(arr) != IS_ARRAY)) { return 0; } //TODO: duplicate diff --git a/ext/php_test.h b/ext/php_test.h index ab6db72ec4..fdca6c27e2 100644 --- a/ext/php_test.h +++ b/ext/php_test.h @@ -14,7 +14,7 @@ #define PHP_TEST_VERSION "1.0.0" #define PHP_TEST_EXTNAME "test" #define PHP_TEST_AUTHOR "Zephir Team and contributors" -#define PHP_TEST_ZEPVERSION "0.11.10-$Id$" +#define PHP_TEST_ZEPVERSION "0.11.11-$Id$" #define PHP_TEST_DESCRIPTION "Description test for
Test Extension." typedef struct _zephir_struct_db { diff --git a/ext/test.c b/ext/test.c index 5c0426620e..a683b6ba6e 100644 --- a/ext/test.c +++ b/ext/test.c @@ -55,6 +55,8 @@ zend_class_entry *test_9__closure_ce; zend_class_entry *test_arithmetic_ce; zend_class_entry *test_arrayaccessobj_ce; zend_class_entry *test_arrayaccesstest_ce; +zend_class_entry *test_arrayiterator_ce; +zend_class_entry *test_arrayiteratortest_ce; zend_class_entry *test_arrayobject_ce; zend_class_entry *test_arraysearch_ce; zend_class_entry *test_assign_ce; @@ -244,6 +246,8 @@ static PHP_MINIT_FUNCTION(test) ZEPHIR_INIT(Test_Arithmetic); ZEPHIR_INIT(Test_ArrayAccessObj); ZEPHIR_INIT(Test_ArrayAccessTest); + ZEPHIR_INIT(Test_ArrayIterator); + ZEPHIR_INIT(Test_ArrayIteratorTest); ZEPHIR_INIT(Test_ArrayObject); ZEPHIR_INIT(Test_ArraySearch); ZEPHIR_INIT(Test_Assign); diff --git a/ext/test.h b/ext/test.h index 2684e34ae6..25ae34ada3 100644 --- a/ext/test.h +++ b/ext/test.h @@ -21,6 +21,8 @@ #include "test/arithmetic.zep.h" #include "test/arrayaccessobj.zep.h" #include "test/arrayaccesstest.zep.h" +#include "test/arrayiterator.zep.h" +#include "test/arrayiteratortest.zep.h" #include "test/arrayobject.zep.h" #include "test/arraysearch.zep.h" #include "test/assign.zep.h" diff --git a/ext/test/arrayaccessobj.zep.c b/ext/test/arrayaccessobj.zep.c index af83b76d41..d4fdc30b3f 100644 --- a/ext/test/arrayaccessobj.zep.c +++ b/ext/test/arrayaccessobj.zep.c @@ -60,9 +60,9 @@ PHP_METHOD(Test_ArrayAccessObj, offsetSet) { if (Z_TYPE_P(offset) == IS_NULL) { - zephir_update_property_array_append(this_ptr, SL("test"), value TSRMLS_CC); + zephir_update_property_array_append(this_ptr, SL("test"), value); } else { - zephir_update_property_array(this_ptr, SL("test"), offset, value TSRMLS_CC); + zephir_update_property_array(this_ptr, SL("test"), offset, value); } } diff --git a/ext/test/arrayiterator.zep.c b/ext/test/arrayiterator.zep.c new file mode 100644 index 0000000000..a06abf465c --- /dev/null +++ b/ext/test/arrayiterator.zep.c @@ -0,0 +1,129 @@ + +#ifdef HAVE_CONFIG_H +#include "../ext_config.h" +#endif + +#include +#include "../php_ext.h" +#include "../ext.h" + +#include +#include +#include + +#include "kernel/main.h" +#include "kernel/memory.h" +#include "kernel/array.h" +#include "kernel/object.h" + + +ZEPHIR_INIT_CLASS(Test_ArrayIterator) { + + ZEPHIR_REGISTER_CLASS(Test, ArrayIterator, test, arrayiterator, test_arrayiterator_method_entry, 0); + + zend_declare_property_long(test_arrayiterator_ce, SL("position"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_declare_property_null(test_arrayiterator_ce, SL("test"), ZEND_ACC_PROTECTED TSRMLS_CC); + + zend_class_implements(test_arrayiterator_ce TSRMLS_CC, 1, zend_ce_iterator); + return SUCCESS; + +} + +PHP_METHOD(Test_ArrayIterator, __construct) { + + zval _1, _2; + zval _0; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + + ZEPHIR_MM_GROW(); + + ZEPHIR_INIT_VAR(&_0); + zephir_create_array(&_0, 3, 0 TSRMLS_CC); + ZEPHIR_INIT_VAR(&_1); + ZVAL_STRING(&_1, "one"); + zephir_array_fast_append(&_0, &_1); + ZEPHIR_INIT_NVAR(&_1); + ZVAL_STRING(&_1, "two"); + zephir_array_fast_append(&_0, &_1); + ZEPHIR_INIT_NVAR(&_1); + ZVAL_STRING(&_1, "three"); + zephir_array_fast_append(&_0, &_1); + zephir_update_property_zval(this_ptr, SL("test"), &_0); + ZEPHIR_INIT_ZVAL_NREF(_2); + ZVAL_LONG(&_2, 0); + zephir_update_property_zval(this_ptr, SL("position"), &_2); + ZEPHIR_MM_RESTORE(); + +} + +PHP_METHOD(Test_ArrayIterator, rewind) { + + zval _0; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&_0); + + + ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_LONG(&_0, 0); + zephir_update_property_zval(this_ptr, SL("position"), &_0); + +} + +PHP_METHOD(Test_ArrayIterator, current) { + + zval _0, _1, _2; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + + ZEPHIR_MM_GROW(); + + zephir_read_property(&_0, this_ptr, SL("test"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_OBS_VAR(&_2); + zephir_read_property(&_2, this_ptr, SL("position"), PH_NOISY_CC); + zephir_array_fetch(&_1, &_0, &_2, PH_NOISY | PH_READONLY, "test/arrayiterator.zep", 22 TSRMLS_CC); + RETURN_CTOR(&_1); + +} + +PHP_METHOD(Test_ArrayIterator, key) { + + zval *this_ptr = getThis(); + + + RETURN_MEMBER(getThis(), "position"); + +} + +PHP_METHOD(Test_ArrayIterator, next) { + + zval *this_ptr = getThis(); + + + RETURN_ON_FAILURE(zephir_property_incr(this_ptr, SL("position") TSRMLS_CC)); + +} + +PHP_METHOD(Test_ArrayIterator, valid) { + + zval _0, _1; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + + + zephir_read_property(&_0, this_ptr, SL("test"), PH_NOISY_CC | PH_READONLY); + zephir_read_property(&_1, this_ptr, SL("position"), PH_NOISY_CC | PH_READONLY); + RETURN_BOOL(zephir_array_isset(&_0, &_1)); + +} + diff --git a/ext/test/arrayiterator.zep.h b/ext/test/arrayiterator.zep.h new file mode 100644 index 0000000000..4beaa8ff7f --- /dev/null +++ b/ext/test/arrayiterator.zep.h @@ -0,0 +1,21 @@ + +extern zend_class_entry *test_arrayiterator_ce; + +ZEPHIR_INIT_CLASS(Test_ArrayIterator); + +PHP_METHOD(Test_ArrayIterator, __construct); +PHP_METHOD(Test_ArrayIterator, rewind); +PHP_METHOD(Test_ArrayIterator, current); +PHP_METHOD(Test_ArrayIterator, key); +PHP_METHOD(Test_ArrayIterator, next); +PHP_METHOD(Test_ArrayIterator, valid); + +ZEPHIR_INIT_FUNCS(test_arrayiterator_method_entry) { + PHP_ME(Test_ArrayIterator, __construct, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) + PHP_ME(Test_ArrayIterator, rewind, NULL, ZEND_ACC_PUBLIC) + PHP_ME(Test_ArrayIterator, current, NULL, ZEND_ACC_PUBLIC) + PHP_ME(Test_ArrayIterator, key, NULL, ZEND_ACC_PUBLIC) + PHP_ME(Test_ArrayIterator, next, NULL, ZEND_ACC_PUBLIC) + PHP_ME(Test_ArrayIterator, valid, NULL, ZEND_ACC_PUBLIC) + PHP_FE_END +}; diff --git a/ext/test/arrayiteratortest.zep.c b/ext/test/arrayiteratortest.zep.c new file mode 100644 index 0000000000..ce4e65e74e --- /dev/null +++ b/ext/test/arrayiteratortest.zep.c @@ -0,0 +1,85 @@ + +#ifdef HAVE_CONFIG_H +#include "../ext_config.h" +#endif + +#include +#include "../php_ext.h" +#include "../ext.h" + +#include +#include +#include + +#include "kernel/main.h" +#include "kernel/memory.h" +#include "kernel/fcall.h" +#include "kernel/concat.h" + + +ZEPHIR_INIT_CLASS(Test_ArrayIteratorTest) { + + ZEPHIR_REGISTER_CLASS(Test, ArrayIteratorTest, test, arrayiteratortest, test_arrayiteratortest_method_entry, 0); + + return SUCCESS; + +} + +PHP_METHOD(Test_ArrayIteratorTest, test) { + + zend_string *_3; + zend_ulong _2; + zval arr, k, v, *_0, _1; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&arr); + ZVAL_UNDEF(&k); + ZVAL_UNDEF(&v); + ZVAL_UNDEF(&_1); + + ZEPHIR_MM_GROW(); + + ZEPHIR_INIT_VAR(&arr); + object_init_ex(&arr, test_arrayiterator_ce); + ZEPHIR_CALL_METHOD(NULL, &arr, "__construct", NULL, 4); + zephir_check_call_status(); + zephir_is_iterable(&arr, 0, "test/arrayiteratortest.zep", 12); + if (Z_TYPE_P(&arr) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&arr), _2, _3, _0) + { + ZEPHIR_INIT_NVAR(&k); + if (_3 != NULL) { + ZVAL_STR_COPY(&k, _3); + } else { + ZVAL_LONG(&k, _2); + } + ZEPHIR_INIT_NVAR(&v); + ZVAL_COPY(&v, _0); + ZEPHIR_CONCAT_VV(return_value, &k, &v); + RETURN_MM(); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &arr, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_1, &arr, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_1)) { + break; + } + ZEPHIR_CALL_METHOD(&k, &arr, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&v, &arr, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CONCAT_VV(return_value, &k, &v); + RETURN_MM(); + ZEPHIR_CALL_METHOD(NULL, &arr, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&v); + ZEPHIR_INIT_NVAR(&k); + +} + diff --git a/ext/test/arrayiteratortest.zep.h b/ext/test/arrayiteratortest.zep.h new file mode 100644 index 0000000000..df50394337 --- /dev/null +++ b/ext/test/arrayiteratortest.zep.h @@ -0,0 +1,11 @@ + +extern zend_class_entry *test_arrayiteratortest_ce; + +ZEPHIR_INIT_CLASS(Test_ArrayIteratorTest); + +PHP_METHOD(Test_ArrayIteratorTest, test); + +ZEPHIR_INIT_FUNCS(test_arrayiteratortest_method_entry) { + PHP_ME(Test_ArrayIteratorTest, test, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + PHP_FE_END +}; diff --git a/ext/test/arraysearch.zep.c b/ext/test/arraysearch.zep.c index 20f482b8f4..94107e1b26 100644 --- a/ext/test/arraysearch.zep.c +++ b/ext/test/arraysearch.zep.c @@ -51,7 +51,7 @@ PHP_METHOD(Test_ArraySearch, simpleSearch) { ZVAL_BOOL(&_0, (strict ? 1 : 0)); - ZEPHIR_RETURN_CALL_FUNCTION("array_search", NULL, 4, needle, &haystack, &_0); + ZEPHIR_RETURN_CALL_FUNCTION("array_search", NULL, 5, needle, &haystack, &_0); zephir_check_call_status(); RETURN_MM(); @@ -102,7 +102,7 @@ PHP_METHOD(Test_ArraySearch, searchUsingArrayInsideZephir) { zephir_array_fast_append(&itoA64, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "value"); - ZEPHIR_CALL_FUNCTION(&pos, "array_search", NULL, 4, &_0, &itoA64); + ZEPHIR_CALL_FUNCTION(&pos, "array_search", NULL, 5, &_0, &itoA64); zephir_check_call_status(); RETURN_CCTOR(&pos); diff --git a/ext/test/assign.zep.c b/ext/test/assign.zep.c index 9ad8a67877..1c8d46a9b4 100644 --- a/ext/test/assign.zep.c +++ b/ext/test/assign.zep.c @@ -516,16 +516,17 @@ PHP_METHOD(Test_Assign, testAssign36) { PHP_METHOD(Test_Assign, testAssign37) { - zval _0, _3; - zval v, arr, _1, _2; + zval _1, _4; + zval v, arr, _0, _2, _3; zval *this_ptr = getThis(); ZVAL_UNDEF(&v); ZVAL_UNDEF(&arr); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_4); ZEPHIR_MM_GROW(); @@ -533,34 +534,35 @@ PHP_METHOD(Test_Assign, testAssign37) { ZVAL_STRING(&v, "abc"); ZEPHIR_INIT_VAR(&arr); array_init(&arr); - ZEPHIR_INIT_NVAR(&arr); - zephir_create_array(&arr, 1, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(&_0); - zephir_create_array(&_0, 2, 0 TSRMLS_CC); - add_assoc_stringl_ex(&_0, SL("b_key"), SL("b_val")); + zephir_create_array(&_0, 1, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(&_1); - array_init(&_1); - zephir_array_update_string(&_0, SL("b"), &_1, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&arr, SL("a"), &_0, PH_COPY | PH_SEPARATE); - ZEPHIR_INIT_NVAR(&_1); - ZVAL_STRING(&_1, "d_val"); - zephir_array_update_multi(&arr, &_1 TSRMLS_CC, SL("sss"), 6, SL("a"), SL("b"), SL("d_key")); - ZEPHIR_INIT_NVAR(&_1); - ZVAL_LONG(&_1, 1); - zephir_array_update_string(&arr, SL("s"), &_1, PH_COPY | PH_SEPARATE); + zephir_create_array(&_1, 2, 0 TSRMLS_CC); + add_assoc_stringl_ex(&_1, SL("b_key"), SL("b_val")); ZEPHIR_INIT_VAR(&_2); - ZVAL_STRING(&_2, "f"); - zephir_array_update_multi(&arr, &_2 TSRMLS_CC, SL("sssss"), 10, SL("a"), SL("b"), SL("c"), SL("d"), SL("e")); - ZEPHIR_INIT_NVAR(&_0); - zephir_create_array(&_0, 1, 0 TSRMLS_CC); - ZEPHIR_INIT_VAR(&_3); - zephir_create_array(&_3, 1, 0 TSRMLS_CC); - add_index_long(&_3, 3, 4); - zephir_array_update_long(&_0, 2, &_3, PH_COPY ZEPHIR_DEBUG_PARAMS_DUMMY); - zephir_array_update_long(&arr, 1, &_0, PH_COPY | PH_SEPARATE ZEPHIR_DEBUG_PARAMS_DUMMY); + array_init(&_2); + zephir_array_update_string(&_1, SL("b"), &_2, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&_0, SL("a"), &_1, PH_COPY | PH_SEPARATE); + ZEPHIR_CPY_WRT(&arr, &_0); ZEPHIR_INIT_NVAR(&_2); - ZVAL_LONG(&_2, 6); - zephir_array_update_multi(&arr, &_2 TSRMLS_CC, SL("lll"), 3, 1, 2, 5); + ZVAL_STRING(&_2, "d_val"); + zephir_array_update_multi(&arr, &_2 TSRMLS_CC, SL("sss"), 6, SL("a"), SL("b"), SL("d_key")); + ZEPHIR_INIT_NVAR(&_2); + ZVAL_LONG(&_2, 1); + zephir_array_update_string(&arr, SL("s"), &_2, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_VAR(&_3); + ZVAL_STRING(&_3, "f"); + zephir_array_update_multi(&arr, &_3 TSRMLS_CC, SL("sssss"), 10, SL("a"), SL("b"), SL("c"), SL("d"), SL("e")); + ZEPHIR_INIT_NVAR(&_1); + zephir_create_array(&_1, 1, 0 TSRMLS_CC); + ZEPHIR_INIT_VAR(&_4); + zephir_create_array(&_4, 1, 0 TSRMLS_CC); + add_index_long(&_4, 3, 4); + zephir_array_update_long(&_1, 2, &_4, PH_COPY ZEPHIR_DEBUG_PARAMS_DUMMY); + zephir_array_update_long(&arr, 1, &_1, PH_COPY | PH_SEPARATE ZEPHIR_DEBUG_PARAMS_DUMMY); + ZEPHIR_INIT_NVAR(&_3); + ZVAL_LONG(&_3, 6); + zephir_array_update_multi(&arr, &_3 TSRMLS_CC, SL("lll"), 3, 1, 2, 5); zephir_array_update_multi(&arr, &v TSRMLS_CC, SL("llz"), 3, 1, 2, &v); RETURN_CCTOR(&arr); @@ -1027,30 +1029,35 @@ PHP_METHOD(Test_Assign, testPropertyArray1) { zephir_update_property_zval(this_ptr, SL("myArray"), &_0); ZEPHIR_INIT_ZVAL_NREF(_1); ZVAL_LONG(&_1, 1); - zephir_update_property_array_append(this_ptr, SL("myArray"), &_1 TSRMLS_CC); + zephir_update_property_array_append(this_ptr, SL("myArray"), &_1); + ZEPHIR_INIT_VAR(&_1); ZEPHIR_INIT_ZVAL_NREF(_1); ZVAL_DOUBLE(&_1, 1.5); - zephir_update_property_array_append(this_ptr, SL("myArray"), &_1 TSRMLS_CC); - zephir_update_property_array_append(this_ptr, SL("myArray"), &__$null TSRMLS_CC); + zephir_update_property_array_append(this_ptr, SL("myArray"), &_1); + ZEPHIR_INIT_NVAR(&_1); + zephir_update_property_array_append(this_ptr, SL("myArray"), &__$null); if (0) { - zephir_update_property_array_append(this_ptr, SL("myArray"), &__$true TSRMLS_CC); + zephir_update_property_array_append(this_ptr, SL("myArray"), &__$true); } else { - zephir_update_property_array_append(this_ptr, SL("myArray"), &__$false TSRMLS_CC); + zephir_update_property_array_append(this_ptr, SL("myArray"), &__$false); } if (1) { - zephir_update_property_array_append(this_ptr, SL("myArray"), &__$true TSRMLS_CC); + zephir_update_property_array_append(this_ptr, SL("myArray"), &__$true); } else { - zephir_update_property_array_append(this_ptr, SL("myArray"), &__$false TSRMLS_CC); + zephir_update_property_array_append(this_ptr, SL("myArray"), &__$false); } ZEPHIR_INIT_ZVAL_NREF(_1); ZVAL_LONG(&_1, 'A'); - zephir_update_property_array_append(this_ptr, SL("myArray"), &_1 TSRMLS_CC); + zephir_update_property_array_append(this_ptr, SL("myArray"), &_1); + ZEPHIR_INIT_NVAR(&_1); ZEPHIR_INIT_ZVAL_NREF(_1); ZVAL_STRING(&_1, "hello"); - zephir_update_property_array_append(this_ptr, SL("myArray"), &_1 TSRMLS_CC); + zephir_update_property_array_append(this_ptr, SL("myArray"), &_1); + ZEPHIR_INIT_NVAR(&_1); ZEPHIR_INIT_VAR(&_2); array_init(&_2); - zephir_update_property_array_append(this_ptr, SL("myArray"), &_2 TSRMLS_CC); + zephir_update_property_array_append(this_ptr, SL("myArray"), &_2); + ZEPHIR_INIT_NVAR(&_2); RETURN_MM_MEMBER(getThis(), "myArray"); } @@ -1085,18 +1092,22 @@ PHP_METHOD(Test_Assign, testPropertyArray2) { zephir_update_property_zval(this_ptr, SL("myArray"), &_0); ZEPHIR_INIT_ZVAL_NREF(_1); ZVAL_LONG(&_1, a); - zephir_update_property_array_append(this_ptr, SL("myArray"), &_1 TSRMLS_CC); + zephir_update_property_array_append(this_ptr, SL("myArray"), &_1); + ZEPHIR_INIT_VAR(&_1); ZEPHIR_INIT_ZVAL_NREF(_1); ZVAL_DOUBLE(&_1, b); - zephir_update_property_array_append(this_ptr, SL("myArray"), &_1 TSRMLS_CC); - zephir_update_property_array_append(this_ptr, SL("myArray"), &c TSRMLS_CC); + zephir_update_property_array_append(this_ptr, SL("myArray"), &_1); + ZEPHIR_INIT_NVAR(&_1); + zephir_update_property_array_append(this_ptr, SL("myArray"), &c); ZEPHIR_INIT_ZVAL_NREF(_1); ZVAL_BOOL(&_1, d); - zephir_update_property_array_append(this_ptr, SL("myArray"), &_1 TSRMLS_CC); + zephir_update_property_array_append(this_ptr, SL("myArray"), &_1); + ZEPHIR_INIT_NVAR(&_1); ZEPHIR_INIT_ZVAL_NREF(_1); ZVAL_LONG(&_1, e); - zephir_update_property_array_append(this_ptr, SL("myArray"), &_1 TSRMLS_CC); - zephir_update_property_array_append(this_ptr, SL("myArray"), &f TSRMLS_CC); + zephir_update_property_array_append(this_ptr, SL("myArray"), &_1); + ZEPHIR_INIT_NVAR(&_1); + zephir_update_property_array_append(this_ptr, SL("myArray"), &f); RETURN_MM_MEMBER(getThis(), "myArray"); } @@ -1131,31 +1142,35 @@ PHP_METHOD(Test_Assign, testPropertyArray3) { ZVAL_LONG(&_1, 0); ZEPHIR_INIT_VAR(&_2); ZVAL_LONG(&_2, 1); - zephir_update_property_array(this_ptr, SL("myArray"), &_1, &_2 TSRMLS_CC); + zephir_update_property_array(this_ptr, SL("myArray"), &_1, &_2); + ZEPHIR_INIT_NVAR(&_2); ZEPHIR_INIT_VAR(&_3); ZVAL_LONG(&_3, 0); ZEPHIR_INIT_VAR(&_4); ZVAL_DOUBLE(&_4, 1.5); - zephir_update_property_array(this_ptr, SL("myArray"), &_3, &_4 TSRMLS_CC); + zephir_update_property_array(this_ptr, SL("myArray"), &_3, &_4); + ZEPHIR_INIT_NVAR(&_4); ZEPHIR_INIT_VAR(&_5); ZVAL_LONG(&_5, 0); - zephir_update_property_array(this_ptr, SL("myArray"), &_5, &__$null TSRMLS_CC); + zephir_update_property_array(this_ptr, SL("myArray"), &_5, &__$null); ZEPHIR_INIT_VAR(&_6); ZVAL_LONG(&_6, 0); - zephir_update_property_array(this_ptr, SL("myArray"), &_6, &__$false TSRMLS_CC); + zephir_update_property_array(this_ptr, SL("myArray"), &_6, &__$false); ZEPHIR_INIT_VAR(&_7); ZVAL_LONG(&_7, 0); - zephir_update_property_array(this_ptr, SL("myArray"), &_7, &__$true TSRMLS_CC); + zephir_update_property_array(this_ptr, SL("myArray"), &_7, &__$true); ZEPHIR_INIT_VAR(&_8); ZVAL_LONG(&_8, 0); ZEPHIR_INIT_VAR(&_9); ZVAL_LONG(&_9, 'A'); - zephir_update_property_array(this_ptr, SL("myArray"), &_8, &_9 TSRMLS_CC); + zephir_update_property_array(this_ptr, SL("myArray"), &_8, &_9); + ZEPHIR_INIT_NVAR(&_9); ZEPHIR_INIT_VAR(&_10); array_init(&_10); ZEPHIR_INIT_VAR(&_11); ZVAL_LONG(&_11, 0); - zephir_update_property_array(this_ptr, SL("myArray"), &_11, &_10 TSRMLS_CC); + zephir_update_property_array(this_ptr, SL("myArray"), &_11, &_10); + ZEPHIR_INIT_NVAR(&_10); RETURN_MM_MEMBER(getThis(), "myArray"); } @@ -1185,19 +1200,23 @@ PHP_METHOD(Test_Assign, testPropertyArray4) { zephir_update_property_zval(this_ptr, SL("myArray"), &_0); ZEPHIR_INIT_VAR(&_1); ZVAL_LONG(&_1, 1); - zephir_update_property_array(this_ptr, SL("myArray"), index, &_1 TSRMLS_CC); + zephir_update_property_array(this_ptr, SL("myArray"), index, &_1); + ZEPHIR_INIT_NVAR(&_1); ZEPHIR_INIT_VAR(&_2); ZVAL_DOUBLE(&_2, 1.5); - zephir_update_property_array(this_ptr, SL("myArray"), index, &_2 TSRMLS_CC); - zephir_update_property_array(this_ptr, SL("myArray"), index, &__$null TSRMLS_CC); - zephir_update_property_array(this_ptr, SL("myArray"), index, &__$false TSRMLS_CC); - zephir_update_property_array(this_ptr, SL("myArray"), index, &__$true TSRMLS_CC); + zephir_update_property_array(this_ptr, SL("myArray"), index, &_2); + ZEPHIR_INIT_NVAR(&_2); + zephir_update_property_array(this_ptr, SL("myArray"), index, &__$null); + zephir_update_property_array(this_ptr, SL("myArray"), index, &__$false); + zephir_update_property_array(this_ptr, SL("myArray"), index, &__$true); ZEPHIR_INIT_VAR(&_3); ZVAL_LONG(&_3, 'A'); - zephir_update_property_array(this_ptr, SL("myArray"), index, &_3 TSRMLS_CC); + zephir_update_property_array(this_ptr, SL("myArray"), index, &_3); + ZEPHIR_INIT_NVAR(&_3); ZEPHIR_INIT_VAR(&_4); array_init(&_4); - zephir_update_property_array(this_ptr, SL("myArray"), index, &_4 TSRMLS_CC); + zephir_update_property_array(this_ptr, SL("myArray"), index, &_4); + ZEPHIR_INIT_NVAR(&_4); RETURN_MM_MEMBER(getThis(), "myArray"); } @@ -1229,19 +1248,23 @@ PHP_METHOD(Test_Assign, testPropertyArray5) { zephir_update_property_zval(this_ptr, SL("myArray"), &_0); ZEPHIR_INIT_VAR(&_1); ZVAL_LONG(&_1, 1); - zephir_update_property_array(this_ptr, SL("myArray"), &index, &_1 TSRMLS_CC); + zephir_update_property_array(this_ptr, SL("myArray"), &index, &_1); + ZEPHIR_INIT_NVAR(&_1); ZEPHIR_INIT_VAR(&_2); ZVAL_DOUBLE(&_2, 1.5); - zephir_update_property_array(this_ptr, SL("myArray"), &index, &_2 TSRMLS_CC); - zephir_update_property_array(this_ptr, SL("myArray"), &index, &__$null TSRMLS_CC); - zephir_update_property_array(this_ptr, SL("myArray"), &index, &__$false TSRMLS_CC); - zephir_update_property_array(this_ptr, SL("myArray"), &index, &__$true TSRMLS_CC); + zephir_update_property_array(this_ptr, SL("myArray"), &index, &_2); + ZEPHIR_INIT_NVAR(&_2); + zephir_update_property_array(this_ptr, SL("myArray"), &index, &__$null); + zephir_update_property_array(this_ptr, SL("myArray"), &index, &__$false); + zephir_update_property_array(this_ptr, SL("myArray"), &index, &__$true); ZEPHIR_INIT_VAR(&_3); ZVAL_LONG(&_3, 'A'); - zephir_update_property_array(this_ptr, SL("myArray"), &index, &_3 TSRMLS_CC); + zephir_update_property_array(this_ptr, SL("myArray"), &index, &_3); + ZEPHIR_INIT_NVAR(&_3); ZEPHIR_INIT_VAR(&_4); array_init(&_4); - zephir_update_property_array(this_ptr, SL("myArray"), &index, &_4 TSRMLS_CC); + zephir_update_property_array(this_ptr, SL("myArray"), &index, &_4); + ZEPHIR_INIT_NVAR(&_4); RETURN_MM_MEMBER(getThis(), "myArray"); } @@ -1640,12 +1663,14 @@ PHP_METHOD(Test_Assign, testPropertyArray14) { zephir_array_update_long(&_1, 2, &_3, PH_COPY ZEPHIR_DEBUG_PARAMS_DUMMY); ZEPHIR_INIT_NVAR(&_2); ZVAL_LONG(&_2, 1); - zephir_update_property_array(this_ptr, SL("myArray"), &_2, &_1 TSRMLS_CC); + zephir_update_property_array(this_ptr, SL("myArray"), &_2, &_1); + ZEPHIR_INIT_NVAR(&_1); ZEPHIR_INIT_VAR(&_4); ZVAL_STRING(&_4, "s"); ZEPHIR_INIT_VAR(&_5); ZVAL_LONG(&_5, 1); - zephir_update_property_array(this_ptr, SL("myArray"), &_4, &_5 TSRMLS_CC); + zephir_update_property_array(this_ptr, SL("myArray"), &_4, &_5); + ZEPHIR_INIT_NVAR(&_5); ZEPHIR_INIT_VAR(&_6); ZVAL_STRING(&_6, "f"); zephir_update_property_array_multi(this_ptr, SL("myArray"), &_6 TSRMLS_CC, SL("sssss"), 10, SL("a"), SL("b"), SL("c"), SL("d"), SL("e")); @@ -2254,12 +2279,14 @@ PHP_METHOD(Test_Assign, testArrayBoolExpressionAssign) { ZVAL_STRING(&_1, "a"); ZEPHIR_INIT_VAR(&_2); ZVAL_BOOL(&_2, ZEPHIR_IS_STRING(&str, "abc")); - zephir_update_property_array(this_ptr, SL("myArray"), &_1, &_2 TSRMLS_CC); + zephir_update_property_array(this_ptr, SL("myArray"), &_1, &_2); + ZEPHIR_INIT_NVAR(&_2); ZEPHIR_INIT_VAR(&_3); ZVAL_STRING(&_3, "b"); ZEPHIR_INIT_VAR(&_4); ZVAL_BOOL(&_4, !ZEPHIR_IS_STRING(&str, "abc")); - zephir_update_property_array(this_ptr, SL("myArray"), &_3, &_4 TSRMLS_CC); + zephir_update_property_array(this_ptr, SL("myArray"), &_3, &_4); + ZEPHIR_INIT_NVAR(&_4); RETURN_MM_MEMBER(getThis(), "myArray"); } diff --git a/ext/test/builtin/arraymethods.zep.c b/ext/test/builtin/arraymethods.zep.c index fe28e64b71..684f491a32 100644 --- a/ext/test/builtin/arraymethods.zep.c +++ b/ext/test/builtin/arraymethods.zep.c @@ -79,7 +79,7 @@ PHP_METHOD(Test_BuiltIn_ArrayMethods, getReversed1) { ZEPHIR_INIT_NVAR(&_1); ZVAL_LONG(&_1, 3); zephir_array_fast_append(&_0, &_1); - ZEPHIR_CALL_FUNCTION(&_2, "array_reverse", NULL, 5, &_0); + ZEPHIR_CALL_FUNCTION(&_2, "array_reverse", NULL, 6, &_0); zephir_check_call_status(); RETURN_CCTOR(&_2); @@ -112,7 +112,7 @@ PHP_METHOD(Test_BuiltIn_ArrayMethods, getMap1) { ZEPHIR_INIT_NVAR(&_1); ZEPHIR_INIT_NVAR(&_1); zephir_create_closure_ex(&_1, NULL, test_0__closure_ce, SL("__invoke")); - ZEPHIR_CALL_FUNCTION(&_2, "array_map", NULL, 6, &_1, &_0); + ZEPHIR_CALL_FUNCTION(&_2, "array_map", NULL, 7, &_1, &_0); zephir_check_call_status(); RETURN_CCTOR(&_2); diff --git a/ext/test/builtin/intmethods.zep.c b/ext/test/builtin/intmethods.zep.c index 1cfdde5a9f..6f12b0e659 100644 --- a/ext/test/builtin/intmethods.zep.c +++ b/ext/test/builtin/intmethods.zep.c @@ -42,7 +42,7 @@ PHP_METHOD(Test_BuiltIn_IntMethods, getAbs) { ZVAL_LONG(&_0, num); - ZEPHIR_CALL_FUNCTION(&_1, "abs", NULL, 7, &_0); + ZEPHIR_CALL_FUNCTION(&_1, "abs", NULL, 8, &_0); zephir_check_call_status(); RETURN_CCTOR(&_1); @@ -60,7 +60,7 @@ PHP_METHOD(Test_BuiltIn_IntMethods, getAbs1) { ZEPHIR_MM_GROW(); ZVAL_LONG(&_0, -5); - ZEPHIR_CALL_FUNCTION(&_1, "abs", NULL, 7, &_0); + ZEPHIR_CALL_FUNCTION(&_1, "abs", NULL, 8, &_0); zephir_check_call_status(); RETURN_CCTOR(&_1); @@ -82,7 +82,7 @@ PHP_METHOD(Test_BuiltIn_IntMethods, getBinary) { ZVAL_LONG(&_0, num); - ZEPHIR_CALL_FUNCTION(&_1, "decbin", NULL, 8, &_0); + ZEPHIR_CALL_FUNCTION(&_1, "decbin", NULL, 9, &_0); zephir_check_call_status(); RETURN_CCTOR(&_1); @@ -104,7 +104,7 @@ PHP_METHOD(Test_BuiltIn_IntMethods, getHex) { ZVAL_LONG(&_0, num); - ZEPHIR_CALL_FUNCTION(&_1, "dechex", NULL, 9, &_0); + ZEPHIR_CALL_FUNCTION(&_1, "dechex", NULL, 10, &_0); zephir_check_call_status(); RETURN_CCTOR(&_1); @@ -126,7 +126,7 @@ PHP_METHOD(Test_BuiltIn_IntMethods, getOctal) { ZVAL_LONG(&_0, num); - ZEPHIR_CALL_FUNCTION(&_1, "decoct", NULL, 10, &_0); + ZEPHIR_CALL_FUNCTION(&_1, "decoct", NULL, 11, &_0); zephir_check_call_status(); RETURN_CCTOR(&_1); @@ -267,7 +267,7 @@ PHP_METHOD(Test_BuiltIn_IntMethods, getAsin) { ZVAL_LONG(&_0, num); - ZEPHIR_CALL_FUNCTION(&_1, "asin", NULL, 11, &_0); + ZEPHIR_CALL_FUNCTION(&_1, "asin", NULL, 12, &_0); zephir_check_call_status(); RETURN_CCTOR(&_1); @@ -289,7 +289,7 @@ PHP_METHOD(Test_BuiltIn_IntMethods, getAcos) { ZVAL_LONG(&_0, num); - ZEPHIR_CALL_FUNCTION(&_1, "acos", NULL, 12, &_0); + ZEPHIR_CALL_FUNCTION(&_1, "acos", NULL, 13, &_0); zephir_check_call_status(); RETURN_CCTOR(&_1); @@ -311,7 +311,7 @@ PHP_METHOD(Test_BuiltIn_IntMethods, getAtan) { ZVAL_LONG(&_0, num); - ZEPHIR_CALL_FUNCTION(&_1, "atan", NULL, 13, &_0); + ZEPHIR_CALL_FUNCTION(&_1, "atan", NULL, 14, &_0); zephir_check_call_status(); RETURN_CCTOR(&_1); @@ -342,13 +342,13 @@ PHP_METHOD(Test_BuiltIn_IntMethods, getLog) { if (base == -1) { ZVAL_LONG(&_0$$3, num); - ZEPHIR_CALL_FUNCTION(&_1$$3, "log", NULL, 14, &_0$$3); + ZEPHIR_CALL_FUNCTION(&_1$$3, "log", NULL, 15, &_0$$3); zephir_check_call_status(); RETURN_CCTOR(&_1$$3); } ZVAL_LONG(&_2, num); ZVAL_LONG(&_3, base); - ZEPHIR_CALL_FUNCTION(&_4, "log", NULL, 14, &_2, &_3); + ZEPHIR_CALL_FUNCTION(&_4, "log", NULL, 15, &_2, &_3); zephir_check_call_status(); RETURN_CCTOR(&_4); diff --git a/ext/test/builtin/stringmethods.zep.c b/ext/test/builtin/stringmethods.zep.c index 8e840d84a5..84757ff511 100644 --- a/ext/test/builtin/stringmethods.zep.c +++ b/ext/test/builtin/stringmethods.zep.c @@ -354,7 +354,7 @@ PHP_METHOD(Test_BuiltIn_StringMethods, getLowerFirst) { zephir_get_strval(&str, str_param); - ZEPHIR_CALL_FUNCTION(&_0, "lcfirst", NULL, 15, &str); + ZEPHIR_CALL_FUNCTION(&_0, "lcfirst", NULL, 16, &str); zephir_check_call_status(); RETURN_CCTOR(&_0); @@ -400,7 +400,7 @@ PHP_METHOD(Test_BuiltIn_StringMethods, getFormatted) { ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "hello %s!"); - ZEPHIR_CALL_FUNCTION(&_1, "sprintf", NULL, 16, &_0, &str); + ZEPHIR_CALL_FUNCTION(&_1, "sprintf", NULL, 17, &_0, &str); zephir_check_call_status(); RETURN_CCTOR(&_1); @@ -443,7 +443,7 @@ PHP_METHOD(Test_BuiltIn_StringMethods, getSha1) { zephir_get_strval(&str, str_param); - ZEPHIR_CALL_FUNCTION(&_0, "sha1", NULL, 17, &str); + ZEPHIR_CALL_FUNCTION(&_0, "sha1", NULL, 18, &str); zephir_check_call_status(); RETURN_CCTOR(&_0); @@ -465,7 +465,7 @@ PHP_METHOD(Test_BuiltIn_StringMethods, getNl2br) { zephir_get_strval(&str, str_param); - ZEPHIR_CALL_FUNCTION(&_0, "nl2br", NULL, 18, &str); + ZEPHIR_CALL_FUNCTION(&_0, "nl2br", NULL, 19, &str); zephir_check_call_status(); RETURN_CCTOR(&_0); @@ -487,7 +487,7 @@ PHP_METHOD(Test_BuiltIn_StringMethods, getParsedCsv) { zephir_get_strval(&str, str_param); - ZEPHIR_CALL_FUNCTION(&_0, "str_getcsv", NULL, 19, &str); + ZEPHIR_CALL_FUNCTION(&_0, "str_getcsv", NULL, 20, &str); zephir_check_call_status(); RETURN_CCTOR(&_0); @@ -541,7 +541,7 @@ PHP_METHOD(Test_BuiltIn_StringMethods, getRepeatted) { ZVAL_LONG(&_0, count); - ZEPHIR_CALL_FUNCTION(&_1, "str_repeat", NULL, 20, &str, &_0); + ZEPHIR_CALL_FUNCTION(&_1, "str_repeat", NULL, 21, &str, &_0); zephir_check_call_status(); RETURN_CCTOR(&_1); @@ -563,7 +563,7 @@ PHP_METHOD(Test_BuiltIn_StringMethods, getShuffled) { zephir_get_strval(&str, str_param); - ZEPHIR_CALL_FUNCTION(&_0, "str_shuffle", NULL, 21, &str); + ZEPHIR_CALL_FUNCTION(&_0, "str_shuffle", NULL, 22, &str); zephir_check_call_status(); RETURN_CCTOR(&_0); @@ -587,7 +587,7 @@ PHP_METHOD(Test_BuiltIn_StringMethods, getSplited) { zephir_get_strval(&del, del_param); - ZEPHIR_CALL_FUNCTION(&_0, "str_split", NULL, 22, &str, &del); + ZEPHIR_CALL_FUNCTION(&_0, "str_split", NULL, 23, &str, &del); zephir_check_call_status(); RETURN_CCTOR(&_0); @@ -611,7 +611,7 @@ PHP_METHOD(Test_BuiltIn_StringMethods, getCompare) { zephir_get_strval(&right, right_param); - ZEPHIR_CALL_FUNCTION(&_0, "strcmp", NULL, 23, &left, &right); + ZEPHIR_CALL_FUNCTION(&_0, "strcmp", NULL, 24, &left, &right); zephir_check_call_status(); RETURN_CCTOR(&_0); @@ -635,7 +635,7 @@ PHP_METHOD(Test_BuiltIn_StringMethods, getCompareLocale) { zephir_get_strval(&right, right_param); - ZEPHIR_CALL_FUNCTION(&_0, "strcoll", NULL, 24, &left, &right); + ZEPHIR_CALL_FUNCTION(&_0, "strcoll", NULL, 25, &left, &right); zephir_check_call_status(); RETURN_CCTOR(&_0); @@ -657,7 +657,7 @@ PHP_METHOD(Test_BuiltIn_StringMethods, getReversed) { zephir_get_strval(&str, str_param); - ZEPHIR_CALL_FUNCTION(&_0, "strrev", NULL, 25, &str); + ZEPHIR_CALL_FUNCTION(&_0, "strrev", NULL, 26, &str); zephir_check_call_status(); RETURN_CCTOR(&_0); @@ -679,7 +679,7 @@ PHP_METHOD(Test_BuiltIn_StringMethods, getHtmlSpecialChars) { zephir_get_strval(&str, str_param); - ZEPHIR_CALL_FUNCTION(&_0, "htmlspecialchars", NULL, 26, &str); + ZEPHIR_CALL_FUNCTION(&_0, "htmlspecialchars", NULL, 27, &str); zephir_check_call_status(); RETURN_CCTOR(&_0); diff --git a/ext/test/exceptions.zep.c b/ext/test/exceptions.zep.c index cd4eaa7fcd..87557a560c 100644 --- a/ext/test/exceptions.zep.c +++ b/ext/test/exceptions.zep.c @@ -67,7 +67,7 @@ PHP_METHOD(Test_Exceptions, testException2) { ZVAL_STRING(&msg, "hello2"); ZEPHIR_INIT_VAR(&_0); object_init_ex(&_0, test_exception_ce); - ZEPHIR_CALL_METHOD(NULL, &_0, "__construct", NULL, 27, &msg); + ZEPHIR_CALL_METHOD(NULL, &_0, "__construct", NULL, 28, &msg); zephir_check_call_status(); zephir_throw_exception_debug(&_0, "test/exceptions.zep", 23 TSRMLS_CC); ZEPHIR_MM_RESTORE(); @@ -90,7 +90,7 @@ PHP_METHOD(Test_Exceptions, testException3) { ZVAL_STRING(&msg, "hello3"); ZEPHIR_INIT_VAR(&ex); object_init_ex(&ex, test_exception_ce); - ZEPHIR_CALL_METHOD(NULL, &ex, "__construct", NULL, 27, &msg); + ZEPHIR_CALL_METHOD(NULL, &ex, "__construct", NULL, 28, &msg); zephir_check_call_status(); zephir_throw_exception_debug(&ex, "test/exceptions.zep", 31 TSRMLS_CC); ZEPHIR_MM_RESTORE(); @@ -111,7 +111,7 @@ PHP_METHOD(Test_Exceptions, getException) { object_init_ex(return_value, test_exception_ce); ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "hello4"); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 27, &_0); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 28, &_0); zephir_check_call_status(); RETURN_MM(); @@ -150,7 +150,7 @@ PHP_METHOD(Test_Exceptions, testException5) { object_init_ex(&exception, test_exception_ce); ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "hello5"); - ZEPHIR_CALL_METHOD(NULL, &exception, "__construct", NULL, 27, &_0); + ZEPHIR_CALL_METHOD(NULL, &exception, "__construct", NULL, 28, &_0); zephir_check_call_status(); zephir_throw_exception_debug(&exception, "test/exceptions.zep", 49 TSRMLS_CC); ZEPHIR_MM_RESTORE(); @@ -214,7 +214,7 @@ PHP_METHOD(Test_Exceptions, testExceptionSprintf) { ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "Hello, %s"); - ZEPHIR_CALL_FUNCTION(&_1, "sprintf", NULL, 16, &_0, &name); + ZEPHIR_CALL_FUNCTION(&_1, "sprintf", NULL, 17, &_0, &name); zephir_check_call_status(); zephir_throw_exception_debug(&_1, "test/exceptions.zep", 68 TSRMLS_CC); ZEPHIR_MM_RESTORE(); @@ -411,7 +411,7 @@ PHP_METHOD(Test_Exceptions, issue1325) { /* try_start_1: */ - ZEPHIR_CALL_METHOD(&status, this_ptr, "donoopexception", NULL, 28); + ZEPHIR_CALL_METHOD(&status, this_ptr, "donoopexception", NULL, 29); zephir_check_call_status_or_jump(try_end_1); try_end_1: diff --git a/ext/test/factorial.zep.c b/ext/test/factorial.zep.c index 18cef20a04..a231865bb7 100644 --- a/ext/test/factorial.zep.c +++ b/ext/test/factorial.zep.c @@ -87,7 +87,7 @@ PHP_METHOD(Test_Factorial, intRecursiveFactorial) { ZVAL_LONG(&_0, 1); } else { ZVAL_LONG(&_3, (num - 1)); - ZEPHIR_CALL_METHOD(&_2, this_ptr, "intrecursivefactorial", NULL, 29, &_3); + ZEPHIR_CALL_METHOD(&_2, this_ptr, "intrecursivefactorial", NULL, 30, &_3); zephir_check_call_status(); ZVAL_LONG(&_0, (num * zephir_get_numberval(&_2))); } diff --git a/ext/test/fcall.zep.c b/ext/test/fcall.zep.c index 34cc5b88b9..e105a662ca 100644 --- a/ext/test/fcall.zep.c +++ b/ext/test/fcall.zep.c @@ -94,18 +94,18 @@ PHP_METHOD(Test_Fcall, testCall3) { ZVAL_STRING(&_0, "inputfile.txt"); ZEPHIR_INIT_VAR(&_1); ZVAL_STRING(&_1, "r"); - ZEPHIR_CALL_FUNCTION(&handle, "fopen", &_2, 30, &_0, &_1); + ZEPHIR_CALL_FUNCTION(&handle, "fopen", &_2, 31, &_0, &_1); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "outputfile.txt"); ZEPHIR_INIT_NVAR(&_1); ZVAL_STRING(&_1, "w"); - ZEPHIR_CALL_FUNCTION(&handle2, "fopen", &_2, 30, &_0, &_1); + ZEPHIR_CALL_FUNCTION(&handle2, "fopen", &_2, 31, &_0, &_1); zephir_check_call_status(); if (zephir_is_true(&handle)) { while (1) { ZVAL_LONG(&_3$$4, 4096); - ZEPHIR_CALL_FUNCTION(&buffer, "fgets", &_4, 31, &handle, &_3$$4); + ZEPHIR_CALL_FUNCTION(&buffer, "fgets", &_4, 32, &handle, &_3$$4); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(&buffer)) { break; @@ -139,18 +139,18 @@ PHP_METHOD(Test_Fcall, testCall4) { ZVAL_STRING(&_0, "r"); ZEPHIR_INIT_VAR(&_1); ZVAL_STRING(&_1, "inputfile.txt"); - ZEPHIR_CALL_FUNCTION(&handle, "fopen", &_2, 30, &_0, &_1); + ZEPHIR_CALL_FUNCTION(&handle, "fopen", &_2, 31, &_0, &_1); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "outputfile.txt"); ZEPHIR_INIT_NVAR(&_1); ZVAL_STRING(&_1, "w"); - ZEPHIR_CALL_FUNCTION(&handle2, "fopen", &_2, 30, &_0, &_1); + ZEPHIR_CALL_FUNCTION(&handle2, "fopen", &_2, 31, &_0, &_1); zephir_check_call_status(); if (zephir_is_true(&handle)) { while (1) { ZVAL_LONG(&_3$$4, 4096); - ZEPHIR_CALL_FUNCTION(&buffer, "fgets", &_4, 31, &handle, &_3$$4); + ZEPHIR_CALL_FUNCTION(&buffer, "fgets", &_4, 32, &handle, &_3$$4); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(&buffer)) { break; @@ -178,7 +178,7 @@ PHP_METHOD(Test_Fcall, testCall5) { - ZEPHIR_RETURN_CALL_FUNCTION("str_repeat", NULL, 20, a, b); + ZEPHIR_RETURN_CALL_FUNCTION("str_repeat", NULL, 21, a, b); zephir_check_call_status(); RETURN_MM(); @@ -192,7 +192,7 @@ PHP_METHOD(Test_Fcall, testCall6) { ZEPHIR_MM_GROW(); - ZEPHIR_RETURN_CALL_FUNCTION("rand", NULL, 32); + ZEPHIR_RETURN_CALL_FUNCTION("rand", NULL, 33); zephir_check_call_status(); RETURN_MM(); @@ -206,7 +206,7 @@ PHP_METHOD(Test_Fcall, testCall7) { ZEPHIR_MM_GROW(); - ZEPHIR_CALL_FUNCTION(NULL, "memory_get_usage", NULL, 33); + ZEPHIR_CALL_FUNCTION(NULL, "memory_get_usage", NULL, 34); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); @@ -252,7 +252,7 @@ PHP_METHOD(Test_Fcall, testCall8) { - ZEPHIR_CALL_FUNCTION(&x, "str_repeat", NULL, 20, a, b); + ZEPHIR_CALL_FUNCTION(&x, "str_repeat", NULL, 21, a, b); zephir_check_call_status(); RETURN_CCTOR(&x); @@ -307,7 +307,7 @@ PHP_METHOD(Test_Fcall, testStrtokVarBySlash) { ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "/"); - ZEPHIR_RETURN_CALL_FUNCTION("strtok", NULL, 34, value, &_0); + ZEPHIR_RETURN_CALL_FUNCTION("strtok", NULL, 35, value, &_0); zephir_check_call_status(); RETURN_MM(); @@ -446,13 +446,13 @@ PHP_METHOD(Test_Fcall, testArrayFill) { ZVAL_LONG(&_1, 5); ZEPHIR_INIT_VAR(&_2); ZVAL_STRING(&_2, "?"); - ZEPHIR_CALL_FUNCTION(&v1, "array_fill", &_3, 35, &_0, &_1, &_2); + ZEPHIR_CALL_FUNCTION(&v1, "array_fill", &_3, 36, &_0, &_1, &_2); zephir_check_call_status(); ZVAL_LONG(&_0, 0); ZVAL_LONG(&_1, 6); ZEPHIR_INIT_NVAR(&_2); ZVAL_STRING(&_2, "?"); - ZEPHIR_CALL_FUNCTION(&v2, "array_fill", &_3, 35, &_0, &_1, &_2); + ZEPHIR_CALL_FUNCTION(&v2, "array_fill", &_3, 36, &_0, &_1, &_2); zephir_check_call_status(); zephir_create_array(return_value, 2, 0 TSRMLS_CC); zephir_array_fast_append(return_value, &v1); @@ -478,7 +478,7 @@ PHP_FUNCTION(g_test_zephir_global_method_test) { ZEPHIR_CALL_METHOD(NULL, &_0, "__construct", NULL, 0); zephir_check_call_status(); } - ZEPHIR_RETURN_CALL_METHOD(&_0, "teststrtokvarbyslash", NULL, 36, str); + ZEPHIR_RETURN_CALL_METHOD(&_0, "teststrtokvarbyslash", NULL, 37, str); zephir_check_call_status(); RETURN_MM(); @@ -516,7 +516,7 @@ PHP_FUNCTION(f_Test_zephir_namespaced_method_test) { zephir_check_call_status(); } ZVAL_LONG(&_1, 5); - ZEPHIR_RETURN_CALL_METHOD(&_0, "testcall5", NULL, 37, str, &_1); + ZEPHIR_RETURN_CALL_METHOD(&_0, "testcall5", NULL, 38, str, &_1); zephir_check_call_status(); RETURN_MM(); diff --git a/ext/test/fibonnaci.zep.c b/ext/test/fibonnaci.zep.c index 6ad723c8c0..92eca99849 100644 --- a/ext/test/fibonnaci.zep.c +++ b/ext/test/fibonnaci.zep.c @@ -12,8 +12,8 @@ #include #include "kernel/main.h" -#include "kernel/memory.h" #include "kernel/array.h" +#include "kernel/memory.h" #include "kernel/operators.h" #include "kernel/fcall.h" @@ -176,10 +176,10 @@ PHP_METHOD(Test_Fibonnaci, fibonacciRecursive) { RETURN_MM_LONG(1); } else { ZVAL_LONG(&_1$$6, (n - 1)); - ZEPHIR_CALL_METHOD(&_0$$6, this_ptr, "fibonaccirecursive", &_2, 38, &_1$$6); + ZEPHIR_CALL_METHOD(&_0$$6, this_ptr, "fibonaccirecursive", &_2, 39, &_1$$6); zephir_check_call_status(); ZVAL_LONG(&_1$$6, (n - 2)); - ZEPHIR_CALL_METHOD(&_3$$6, this_ptr, "fibonaccirecursive", &_2, 38, &_1$$6); + ZEPHIR_CALL_METHOD(&_3$$6, this_ptr, "fibonaccirecursive", &_2, 39, &_1$$6); zephir_check_call_status(); zephir_add_function(return_value, &_0$$6, &_3$$6); RETURN_MM(); @@ -212,10 +212,10 @@ PHP_METHOD(Test_Fibonnaci, fibonacciFinalRecursive) { RETURN_MM_LONG(1); } else { ZVAL_LONG(&_1$$6, (n - 1)); - ZEPHIR_CALL_METHOD(&_0$$6, this_ptr, "fibonaccifinalrecursive", &_2, 39, &_1$$6); + ZEPHIR_CALL_METHOD(&_0$$6, this_ptr, "fibonaccifinalrecursive", &_2, 40, &_1$$6); zephir_check_call_status(); ZVAL_LONG(&_1$$6, (n - 2)); - ZEPHIR_CALL_METHOD(&_3$$6, this_ptr, "fibonaccifinalrecursive", &_2, 39, &_1$$6); + ZEPHIR_CALL_METHOD(&_3$$6, this_ptr, "fibonaccifinalrecursive", &_2, 40, &_1$$6); zephir_check_call_status(); zephir_add_function(return_value, &_0$$6, &_3$$6); RETURN_MM(); diff --git a/ext/test/flow.zep.c b/ext/test/flow.zep.c index 4128d67adb..9f5b23b9fb 100644 --- a/ext/test/flow.zep.c +++ b/ext/test/flow.zep.c @@ -743,13 +743,13 @@ PHP_METHOD(Test_Flow, testWhileNextTest) { array_init(&returnValue); while (1) { ZEPHIR_MAKE_REF(variable); - ZEPHIR_CALL_FUNCTION(&_0, "next", &_1, 40, variable); + ZEPHIR_CALL_FUNCTION(&_0, "next", &_1, 41, variable); ZEPHIR_UNREF(variable); zephir_check_call_status(); if (!(zephir_is_true(&_0))) { break; } - ZEPHIR_CALL_FUNCTION(&_2$$3, "current", &_3, 41, variable); + ZEPHIR_CALL_FUNCTION(&_2$$3, "current", &_3, 42, variable); zephir_check_call_status(); zephir_array_append(&returnValue, &_2$$3, PH_SEPARATE, "test/flow.zep", 420); } @@ -777,11 +777,11 @@ PHP_METHOD(Test_Flow, testWhileDoNextTest) { ZEPHIR_INIT_VAR(&returnValue); array_init(&returnValue); do { - ZEPHIR_CALL_FUNCTION(&_0$$3, "current", &_1, 41, variable); + ZEPHIR_CALL_FUNCTION(&_0$$3, "current", &_1, 42, variable); zephir_check_call_status(); zephir_array_append(&returnValue, &_0$$3, PH_SEPARATE, "test/flow.zep", 430); ZEPHIR_MAKE_REF(variable); - ZEPHIR_CALL_FUNCTION(&_2, "next", &_3, 40, variable); + ZEPHIR_CALL_FUNCTION(&_2, "next", &_3, 41, variable); ZEPHIR_UNREF(variable); zephir_check_call_status(); } while (zephir_is_true(&_2)); @@ -791,13 +791,14 @@ PHP_METHOD(Test_Flow, testWhileDoNextTest) { PHP_METHOD(Test_Flow, testFor1) { - zend_long c = 0; - zval v, b, _0, *_1; + zval v, b, _0, *_1, _2; + zend_long ZEPHIR_LAST_CALL_STATUS, c = 0; zval *this_ptr = getThis(); ZVAL_UNDEF(&v); ZVAL_UNDEF(&b); ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_2); ZEPHIR_MM_GROW(); @@ -817,12 +818,29 @@ PHP_METHOD(Test_Flow, testFor1) { ZVAL_LONG(&_0, 4); zephir_array_fast_append(&b, &_0); zephir_is_iterable(&b, 0, "test/flow.zep", 443); - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&b), _1) - { - ZEPHIR_INIT_NVAR(&v); - ZVAL_COPY(&v, _1); - c += zephir_get_numberval(&v); - } ZEND_HASH_FOREACH_END(); + if (Z_TYPE_P(&b) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&b), _1) + { + ZEPHIR_INIT_NVAR(&v); + ZVAL_COPY(&v, _1); + c += zephir_get_numberval(&v); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &b, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_2, &b, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_2)) { + break; + } + ZEPHIR_CALL_METHOD(&v, &b, "current", NULL, 0); + zephir_check_call_status(); + c += zephir_get_numberval(&v); + ZEPHIR_CALL_METHOD(NULL, &b, "next", NULL, 0); + zephir_check_call_status(); + } + } ZEPHIR_INIT_NVAR(&v); RETURN_MM_LONG(c); @@ -830,16 +848,18 @@ PHP_METHOD(Test_Flow, testFor1) { PHP_METHOD(Test_Flow, testFor2) { - zend_string *_3; - zend_ulong _2; + zend_string *_4; + zend_ulong _3; double c = 0; - zval v, k, b, _0, *_1; + zval v, k, b, _0, *_1, _2; + zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); ZVAL_UNDEF(&v); ZVAL_UNDEF(&k); ZVAL_UNDEF(&b); ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_2); ZEPHIR_MM_GROW(); @@ -859,18 +879,37 @@ PHP_METHOD(Test_Flow, testFor2) { ZVAL_LONG(&_0, 4); zephir_array_fast_append(&b, &_0); zephir_is_iterable(&b, 0, "test/flow.zep", 453); - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&b), _2, _3, _1) - { - ZEPHIR_INIT_NVAR(&k); - if (_3 != NULL) { - ZVAL_STR_COPY(&k, _3); - } else { - ZVAL_LONG(&k, _2); + if (Z_TYPE_P(&b) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&b), _3, _4, _1) + { + ZEPHIR_INIT_NVAR(&k); + if (_4 != NULL) { + ZVAL_STR_COPY(&k, _4); + } else { + ZVAL_LONG(&k, _3); + } + ZEPHIR_INIT_NVAR(&v); + ZVAL_COPY(&v, _1); + c += zephir_get_numberval(&k); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &b, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_2, &b, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_2)) { + break; + } + ZEPHIR_CALL_METHOD(&k, &b, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&v, &b, "current", NULL, 0); + zephir_check_call_status(); + c += zephir_get_numberval(&k); + ZEPHIR_CALL_METHOD(NULL, &b, "next", NULL, 0); + zephir_check_call_status(); } - ZEPHIR_INIT_NVAR(&v); - ZVAL_COPY(&v, _1); - c += zephir_get_numberval(&k); - } ZEND_HASH_FOREACH_END(); + } ZEPHIR_INIT_NVAR(&v); ZEPHIR_INIT_NVAR(&k); RETURN_MM_DOUBLE(c); @@ -879,13 +918,15 @@ PHP_METHOD(Test_Flow, testFor2) { PHP_METHOD(Test_Flow, testFor3) { - zval v, b, c, _0, *_1; + zval v, b, c, _0, *_1, _2; + zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); ZVAL_UNDEF(&v); ZVAL_UNDEF(&b); ZVAL_UNDEF(&c); ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_2); ZEPHIR_MM_GROW(); @@ -906,12 +947,29 @@ PHP_METHOD(Test_Flow, testFor3) { ZVAL_LONG(&_0, 4); zephir_array_fast_append(&b, &_0); zephir_is_iterable(&b, 0, "test/flow.zep", 464); - ZEND_HASH_REVERSE_FOREACH_VAL(Z_ARRVAL_P(&b), _1) - { - ZEPHIR_INIT_NVAR(&v); - ZVAL_COPY(&v, _1); - zephir_array_append(&c, &v, PH_SEPARATE, "test/flow.zep", 462); - } ZEND_HASH_FOREACH_END(); + if (Z_TYPE_P(&b) == IS_ARRAY) { + ZEND_HASH_REVERSE_FOREACH_VAL(Z_ARRVAL_P(&b), _1) + { + ZEPHIR_INIT_NVAR(&v); + ZVAL_COPY(&v, _1); + zephir_array_append(&c, &v, PH_SEPARATE, "test/flow.zep", 462); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &b, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_2, &b, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_2)) { + break; + } + ZEPHIR_CALL_METHOD(&v, &b, "current", NULL, 0); + zephir_check_call_status(); + zephir_array_append(&c, &v, PH_SEPARATE, "test/flow.zep", 462); + ZEPHIR_CALL_METHOD(NULL, &b, "next", NULL, 0); + zephir_check_call_status(); + } + } ZEPHIR_INIT_NVAR(&v); RETURN_CCTOR(&c); @@ -1634,11 +1692,13 @@ PHP_METHOD(Test_Flow, testFor24) { zval _0; zval b; - zval a, _1, *_2; + zval a, _1, *_2, _3; + zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_3); ZVAL_UNDEF(&b); ZVAL_UNDEF(&_0); @@ -1661,12 +1721,29 @@ PHP_METHOD(Test_Flow, testFor24) { ZVAL_LONG(&_1, 'd'); zephir_array_fast_append(&_0, &_1); zephir_is_iterable(&_0, 0, "test/flow.zep", 674); - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&_0), _2) - { - ZEPHIR_INIT_NVAR(&a); - ZVAL_COPY(&a, _2); - zephir_concat_self(&b, &a TSRMLS_CC); - } ZEND_HASH_FOREACH_END(); + if (Z_TYPE_P(&_0) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&_0), _2) + { + ZEPHIR_INIT_NVAR(&a); + ZVAL_COPY(&a, _2); + zephir_concat_self(&b, &a TSRMLS_CC); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &_0, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_3, &_0, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_3)) { + break; + } + ZEPHIR_CALL_METHOD(&a, &_0, "current", NULL, 0); + zephir_check_call_status(); + zephir_concat_self(&b, &a TSRMLS_CC); + ZEPHIR_CALL_METHOD(NULL, &_0, "next", NULL, 0); + zephir_check_call_status(); + } + } ZEPHIR_INIT_NVAR(&a); RETURN_CTOR(&b); @@ -1732,11 +1809,13 @@ PHP_METHOD(Test_Flow, testFor31) { PHP_METHOD(Test_Flow, testFor32) { long sum; - zval *e, e_sub, v, *_0; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *e, e_sub, v, *_0, _1; zval *this_ptr = getThis(); ZVAL_UNDEF(&e_sub); ZVAL_UNDEF(&v); + ZVAL_UNDEF(&_1); ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &e); @@ -1745,12 +1824,29 @@ PHP_METHOD(Test_Flow, testFor32) { sum = 0; zephir_is_iterable(e, 0, "test/flow.zep", 703); - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(e), _0) - { - ZEPHIR_INIT_NVAR(&v); - ZVAL_COPY(&v, _0); - sum += zephir_get_numberval(&v); - } ZEND_HASH_FOREACH_END(); + if (Z_TYPE_P(e) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(e), _0) + { + ZEPHIR_INIT_NVAR(&v); + ZVAL_COPY(&v, _0); + sum += zephir_get_numberval(&v); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, e, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_1, e, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_1)) { + break; + } + ZEPHIR_CALL_METHOD(&v, e, "current", NULL, 0); + zephir_check_call_status(); + sum += zephir_get_numberval(&v); + ZEPHIR_CALL_METHOD(NULL, e, "next", NULL, 0); + zephir_check_call_status(); + } + } ZEPHIR_INIT_NVAR(&v); RETURN_MM_LONG(sum); diff --git a/ext/test/fortytwo.zep.c b/ext/test/fortytwo.zep.c index eca2979741..6fd134f188 100644 --- a/ext/test/fortytwo.zep.c +++ b/ext/test/fortytwo.zep.c @@ -12,8 +12,9 @@ #include #include "kernel/main.h" -#include "kernel/memory.h" #include "kernel/array.h" +#include "kernel/memory.h" +#include "kernel/fcall.h" #include "kernel/operators.h" #include "kernel/exception.h" @@ -31,16 +32,18 @@ ZEPHIR_INIT_CLASS(Test_FortyTwo) { PHP_METHOD(Test_FortyTwo, proof) { - zend_bool _3$$3; + zend_bool _4$$3, _8$$6; zval _0; - zend_long i = 0, j = 0, _4$$3, _5$$3; - zval box, side, _1, *_2, _6$$4; + zval box, side, _1, *_2, _3, _7$$4, _11$$7; + zend_long ZEPHIR_LAST_CALL_STATUS, i = 0, j = 0, _5$$3, _6$$3, _9$$6, _10$$6; zval *this_ptr = getThis(); ZVAL_UNDEF(&box); ZVAL_UNDEF(&side); ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_6$$4); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_7$$4); + ZVAL_UNDEF(&_11$$7); ZVAL_UNDEF(&_0); ZEPHIR_MM_GROW(); @@ -228,34 +231,73 @@ PHP_METHOD(Test_FortyTwo, proof) { zephir_array_fast_append(&_0, &_1); zephir_array_fast_append(&box, &_0); zephir_is_iterable(&box, 0, "test/fortytwo.zep", 32); - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&box), _2) - { - ZEPHIR_INIT_NVAR(&side); - ZVAL_COPY(&side, _2); - j = 0; - _5$$3 = 2; - _4$$3 = 0; - _3$$3 = 0; - if (_4$$3 <= _5$$3) { - while (1) { - if (_3$$3) { - _4$$3++; - if (!(_4$$3 <= _5$$3)) { - break; + if (Z_TYPE_P(&box) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&box), _2) + { + ZEPHIR_INIT_NVAR(&side); + ZVAL_COPY(&side, _2); + j = 0; + _6$$3 = 2; + _5$$3 = 0; + _4$$3 = 0; + if (_5$$3 <= _6$$3) { + while (1) { + if (_4$$3) { + _5$$3++; + if (!(_5$$3 <= _6$$3)) { + break; + } + } else { + _4$$3 = 1; } - } else { - _3$$3 = 1; + i = _5$$3; + zephir_array_fetch_long(&_7$$4, &side, i, PH_NOISY | PH_READONLY, "test/fortytwo.zep", 26 TSRMLS_CC); + j += zephir_get_numberval(&_7$$4); } - i = _4$$3; - zephir_array_fetch_long(&_6$$4, &side, i, PH_NOISY | PH_READONLY, "test/fortytwo.zep", 26 TSRMLS_CC); - j += zephir_get_numberval(&_6$$4); } + if (j != 42) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(test_exception_ce, "not true", "test/fortytwo.zep", 29); + return; + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &box, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_3, &box, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_3)) { + break; + } + ZEPHIR_CALL_METHOD(&side, &box, "current", NULL, 0); + zephir_check_call_status(); + j = 0; + _10$$6 = 2; + _9$$6 = 0; + _8$$6 = 0; + if (_9$$6 <= _10$$6) { + while (1) { + if (_8$$6) { + _9$$6++; + if (!(_9$$6 <= _10$$6)) { + break; + } + } else { + _8$$6 = 1; + } + i = _9$$6; + zephir_array_fetch_long(&_11$$7, &side, i, PH_NOISY | PH_READONLY, "test/fortytwo.zep", 26 TSRMLS_CC); + j += zephir_get_numberval(&_11$$7); + } + } + if (j != 42) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(test_exception_ce, "not true", "test/fortytwo.zep", 29); + return; + } + ZEPHIR_CALL_METHOD(NULL, &box, "next", NULL, 0); + zephir_check_call_status(); } - if (j != 42) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(test_exception_ce, "not true", "test/fortytwo.zep", 29); - return; - } - } ZEND_HASH_FOREACH_END(); + } ZEPHIR_INIT_NVAR(&side); ZEPHIR_MM_RESTORE(); diff --git a/ext/test/functional.zep.c b/ext/test/functional.zep.c index be3d2c9ed4..f405f63e4d 100644 --- a/ext/test/functional.zep.c +++ b/ext/test/functional.zep.c @@ -46,7 +46,7 @@ PHP_METHOD(Test_Functional, map1) { ZEPHIR_INIT_VAR(&_0); ZEPHIR_INIT_NVAR(&_0); zephir_create_closure_ex(&_0, NULL, test_8__closure_ce, SL("__invoke")); - ZEPHIR_CALL_FUNCTION(&_1, "array_map", NULL, 6, &_0, &a); + ZEPHIR_CALL_FUNCTION(&_1, "array_map", NULL, 7, &_0, &a); zephir_check_call_status(); RETURN_CCTOR(&_1); @@ -69,7 +69,7 @@ PHP_METHOD(Test_Functional, map2) { zephir_get_arrval(&a, a_param); - ZEPHIR_CALL_FUNCTION(&_0, "array_map", NULL, 6, b, &a); + ZEPHIR_CALL_FUNCTION(&_0, "array_map", NULL, 7, b, &a); zephir_check_call_status(); RETURN_CCTOR(&_0); diff --git a/ext/test/functionexists.zep.c b/ext/test/functionexists.zep.c index 45c4e2c7e7..c4a764bf9e 100644 --- a/ext/test/functionexists.zep.c +++ b/ext/test/functionexists.zep.c @@ -16,6 +16,7 @@ #include "kernel/operators.h" #include "kernel/memory.h" #include "kernel/array.h" +#include "kernel/fcall.h" ZEPHIR_INIT_CLASS(Test_FunctionExists) { @@ -47,12 +48,15 @@ PHP_METHOD(Test_FunctionExists, testWithPassedName) { PHP_METHOD(Test_FunctionExists, testBuiltInFunctions) { zval result, functions; - zval func, _0, *_1, _2$$3; + zval func, _0, *_1, _2, _3$$3, _4$$4; + zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); ZVAL_UNDEF(&func); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_2$$3); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3$$3); + ZVAL_UNDEF(&_4$$4); ZVAL_UNDEF(&result); ZVAL_UNDEF(&functions); @@ -87,14 +91,33 @@ PHP_METHOD(Test_FunctionExists, testBuiltInFunctions) { ZVAL_STRING(&_0, "prim"); zephir_array_fast_append(&functions, &_0); zephir_is_iterable(&functions, 0, "test/functionexists.zep", 31); - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&functions), _1) - { - ZEPHIR_INIT_NVAR(&func); - ZVAL_COPY(&func, _1); - ZEPHIR_INIT_NVAR(&_2$$3); - ZVAL_BOOL(&_2$$3, (zephir_function_exists(&func TSRMLS_CC) == SUCCESS)); - zephir_array_update_zval(&result, &func, &_2$$3, PH_COPY | PH_SEPARATE); - } ZEND_HASH_FOREACH_END(); + if (Z_TYPE_P(&functions) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&functions), _1) + { + ZEPHIR_INIT_NVAR(&func); + ZVAL_COPY(&func, _1); + ZEPHIR_INIT_NVAR(&_3$$3); + ZVAL_BOOL(&_3$$3, (zephir_function_exists(&func TSRMLS_CC) == SUCCESS)); + zephir_array_update_zval(&result, &func, &_3$$3, PH_COPY | PH_SEPARATE); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &functions, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_2, &functions, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_2)) { + break; + } + ZEPHIR_CALL_METHOD(&func, &functions, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_4$$4); + ZVAL_BOOL(&_4$$4, (zephir_function_exists(&func TSRMLS_CC) == SUCCESS)); + zephir_array_update_zval(&result, &func, &_4$$4, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_METHOD(NULL, &functions, "next", NULL, 0); + zephir_check_call_status(); + } + } ZEPHIR_INIT_NVAR(&func); RETURN_CTOR(&result); diff --git a/ext/test/globals/session/base.zep.c b/ext/test/globals/session/base.zep.c index be7cfbebda..f3c88d972e 100644 --- a/ext/test/globals/session/base.zep.c +++ b/ext/test/globals/session/base.zep.c @@ -115,32 +115,53 @@ PHP_METHOD(Test_Globals_Session_Base, __unset) { PHP_METHOD(Test_Globals_Session_Base, removeSessionData) { - zend_string *_3; - zend_ulong _2; - zval _SESSION, key, _0, *_1; + zend_string *_4; + zend_ulong _3; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval _SESSION, key, _0, *_1, _2; zval *this_ptr = getThis(); ZVAL_UNDEF(&_SESSION); ZVAL_UNDEF(&key); ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_2); ZEPHIR_MM_GROW(); zephir_get_global(&_SESSION, SL("_SESSION")); ZEPHIR_INIT_VAR(&_0); zephir_is_iterable(&_SESSION, 1, "test/globals/session/base.zep", 36); - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&_SESSION), _2, _3, _1) - { - ZEPHIR_INIT_NVAR(&key); - if (_3 != NULL) { - ZVAL_STR_COPY(&key, _3); - } else { - ZVAL_LONG(&key, _2); + if (Z_TYPE_P(&_SESSION) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&_SESSION), _3, _4, _1) + { + ZEPHIR_INIT_NVAR(&key); + if (_4 != NULL) { + ZVAL_STR_COPY(&key, _4); + } else { + ZVAL_LONG(&key, _3); + } + ZEPHIR_INIT_NVAR(&_0); + ZVAL_COPY(&_0, _1); + zephir_array_unset(&_SESSION, &key, PH_SEPARATE); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &_SESSION, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_2, &_SESSION, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_2)) { + break; + } + ZEPHIR_CALL_METHOD(&key, &_SESSION, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_0, &_SESSION, "current", NULL, 0); + zephir_check_call_status(); + zephir_array_unset(&_SESSION, &key, PH_SEPARATE); + ZEPHIR_CALL_METHOD(NULL, &_SESSION, "next", NULL, 0); + zephir_check_call_status(); } - ZEPHIR_INIT_NVAR(&_0); - ZVAL_COPY(&_0, _1); - zephir_array_unset(&_SESSION, &key, PH_SEPARATE); - } ZEND_HASH_FOREACH_END(); + } ZEPHIR_INIT_NVAR(&_0); ZEPHIR_INIT_NVAR(&key); RETVAL_ZVAL(&_SESSION, 1, 0); diff --git a/ext/test/instance.zep.c b/ext/test/instance.zep.c index 9ca37fd0d0..b9be4800aa 100644 --- a/ext/test/instance.zep.c +++ b/ext/test/instance.zep.c @@ -76,7 +76,7 @@ PHP_METHOD(Test_Instance, testIssue1339) { zephir_array_fast_append(¶meters, &_0); ZEPHIR_INIT_NVAR(&_0); object_init_ex(&_0, test_arrayobject_ce); - ZEPHIR_CALL_METHOD(NULL, &_0, "__construct", NULL, 42); + ZEPHIR_CALL_METHOD(NULL, &_0, "__construct", NULL, 43); zephir_check_call_status(); zephir_array_fast_append(¶meters, &_0); ZEPHIR_INIT_NVAR(&_0); diff --git a/ext/test/instanceoff.zep.c b/ext/test/instanceoff.zep.c index 7d981cc624..557e5158c5 100644 --- a/ext/test/instanceoff.zep.c +++ b/ext/test/instanceoff.zep.c @@ -15,6 +15,7 @@ #include "kernel/memory.h" #include "kernel/object.h" #include "kernel/fcall.h" +#include "kernel/operators.h" /** @@ -134,3 +135,63 @@ PHP_METHOD(Test_Instanceoff, testInstanceOf6) { } +PHP_METHOD(Test_Instanceoff, testInstanceOf7) { + + zval *test, test_sub; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&test_sub); + + zephir_fetch_params(0, 1, 0, &test); + + + + RETURN_BOOL(zephir_instance_of_ev(test, test_instanceoff_ce TSRMLS_CC)); + +} + +PHP_METHOD(Test_Instanceoff, testInstanceOf8) { + + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *test_param = NULL, a; + zval test; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&test); + ZVAL_UNDEF(&a); + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &test_param); + + zephir_get_strval(&test, test_param); + + + ZEPHIR_INIT_VAR(&a); + object_init_ex(&a, test_instanceoff_ce); + if (zephir_has_constructor(&a TSRMLS_CC)) { + ZEPHIR_CALL_METHOD(NULL, &a, "__construct", NULL, 0); + zephir_check_call_status(); + } + RETURN_MM_BOOL(zephir_is_instance_of(&a, Z_STRVAL_P(&test), Z_STRLEN_P(&test) TSRMLS_CC)); + +} + +PHP_METHOD(Test_Instanceoff, testInstanceOf9) { + + zval test; + zval *a, a_sub, *test_param = NULL; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&a_sub); + ZVAL_UNDEF(&test); + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &a, &test_param); + + zephir_get_strval(&test, test_param); + + + RETURN_MM_BOOL(zephir_is_instance_of(a, Z_STRVAL_P(&test), Z_STRLEN_P(&test) TSRMLS_CC)); + +} + diff --git a/ext/test/instanceoff.zep.h b/ext/test/instanceoff.zep.h index b9dd1a3066..1a1dd23360 100644 --- a/ext/test/instanceoff.zep.h +++ b/ext/test/instanceoff.zep.h @@ -9,21 +9,96 @@ PHP_METHOD(Test_Instanceoff, testInstanceOf3); PHP_METHOD(Test_Instanceoff, testInstanceOf4); PHP_METHOD(Test_Instanceoff, testInstanceOf5); PHP_METHOD(Test_Instanceoff, testInstanceOf6); +PHP_METHOD(Test_Instanceoff, testInstanceOf7); +PHP_METHOD(Test_Instanceoff, testInstanceOf8); +PHP_METHOD(Test_Instanceoff, testInstanceOf9); -ZEND_BEGIN_ARG_INFO_EX(arginfo_test_instanceoff_testinstanceof4, 0, 0, 1) +#if PHP_VERSION_ID >= 70200 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_test_instanceoff_testinstanceof1, 0, 0, _IS_BOOL, 0) +#else +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_test_instanceoff_testinstanceof1, 0, 0, _IS_BOOL, NULL, 0) +#endif +ZEND_END_ARG_INFO() + +#if PHP_VERSION_ID >= 70200 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_test_instanceoff_testinstanceof2, 0, 0, _IS_BOOL, 0) +#else +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_test_instanceoff_testinstanceof2, 0, 0, _IS_BOOL, NULL, 0) +#endif +ZEND_END_ARG_INFO() + +#if PHP_VERSION_ID >= 70200 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_test_instanceoff_testinstanceof3, 0, 0, _IS_BOOL, 0) +#else +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_test_instanceoff_testinstanceof3, 0, 0, _IS_BOOL, NULL, 0) +#endif +ZEND_END_ARG_INFO() + +#if PHP_VERSION_ID >= 70200 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_test_instanceoff_testinstanceof4, 0, 1, _IS_BOOL, 0) +#else +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_test_instanceoff_testinstanceof4, 0, 1, _IS_BOOL, NULL, 0) +#endif ZEND_ARG_INFO(0, a) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_test_instanceoff_testinstanceof5, 0, 0, 1) +#if PHP_VERSION_ID >= 70200 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_test_instanceoff_testinstanceof5, 0, 1, _IS_BOOL, 0) +#else +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_test_instanceoff_testinstanceof5, 0, 1, _IS_BOOL, NULL, 0) +#endif + ZEND_ARG_INFO(0, a) +ZEND_END_ARG_INFO() + +#if PHP_VERSION_ID >= 70200 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_test_instanceoff_testinstanceof6, 0, 0, _IS_BOOL, 0) +#else +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_test_instanceoff_testinstanceof6, 0, 0, _IS_BOOL, NULL, 0) +#endif +ZEND_END_ARG_INFO() + +#if PHP_VERSION_ID >= 70200 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_test_instanceoff_testinstanceof7, 0, 1, _IS_BOOL, 0) +#else +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_test_instanceoff_testinstanceof7, 0, 1, _IS_BOOL, NULL, 0) +#endif + ZEND_ARG_INFO(0, test) +ZEND_END_ARG_INFO() + +#if PHP_VERSION_ID >= 70200 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_test_instanceoff_testinstanceof8, 0, 1, _IS_BOOL, 0) +#else +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_test_instanceoff_testinstanceof8, 0, 1, _IS_BOOL, NULL, 0) +#endif +#if PHP_VERSION_ID >= 70200 + ZEND_ARG_TYPE_INFO(0, test, IS_STRING, 0) +#else + ZEND_ARG_INFO(0, test) +#endif +ZEND_END_ARG_INFO() + +#if PHP_VERSION_ID >= 70200 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_test_instanceoff_testinstanceof9, 0, 2, _IS_BOOL, 0) +#else +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_test_instanceoff_testinstanceof9, 0, 2, _IS_BOOL, NULL, 0) +#endif ZEND_ARG_INFO(0, a) +#if PHP_VERSION_ID >= 70200 + ZEND_ARG_TYPE_INFO(0, test, IS_STRING, 0) +#else + ZEND_ARG_INFO(0, test) +#endif ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(test_instanceoff_method_entry) { - PHP_ME(Test_Instanceoff, testInstanceOf1, NULL, ZEND_ACC_PUBLIC) - PHP_ME(Test_Instanceoff, testInstanceOf2, NULL, ZEND_ACC_PUBLIC) - PHP_ME(Test_Instanceoff, testInstanceOf3, NULL, ZEND_ACC_PUBLIC) + PHP_ME(Test_Instanceoff, testInstanceOf1, arginfo_test_instanceoff_testinstanceof1, ZEND_ACC_PUBLIC) + PHP_ME(Test_Instanceoff, testInstanceOf2, arginfo_test_instanceoff_testinstanceof2, ZEND_ACC_PUBLIC) + PHP_ME(Test_Instanceoff, testInstanceOf3, arginfo_test_instanceoff_testinstanceof3, ZEND_ACC_PUBLIC) PHP_ME(Test_Instanceoff, testInstanceOf4, arginfo_test_instanceoff_testinstanceof4, ZEND_ACC_PUBLIC) PHP_ME(Test_Instanceoff, testInstanceOf5, arginfo_test_instanceoff_testinstanceof5, ZEND_ACC_PUBLIC) - PHP_ME(Test_Instanceoff, testInstanceOf6, NULL, ZEND_ACC_PUBLIC) + PHP_ME(Test_Instanceoff, testInstanceOf6, arginfo_test_instanceoff_testinstanceof6, ZEND_ACC_PUBLIC) + PHP_ME(Test_Instanceoff, testInstanceOf7, arginfo_test_instanceoff_testinstanceof7, ZEND_ACC_PUBLIC) + PHP_ME(Test_Instanceoff, testInstanceOf8, arginfo_test_instanceoff_testinstanceof8, ZEND_ACC_PUBLIC) + PHP_ME(Test_Instanceoff, testInstanceOf9, arginfo_test_instanceoff_testinstanceof9, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/test/invoke.zep.c b/ext/test/invoke.zep.c index 036a8ff6e4..0d1b648592 100644 --- a/ext/test/invoke.zep.c +++ b/ext/test/invoke.zep.c @@ -70,7 +70,7 @@ PHP_METHOD(Test_Invoke, test) { ZEPHIR_INIT_VAR(&func); object_init_ex(&func, test_invoke_ce); - ZEPHIR_CALL_METHOD(NULL, &func, "__construct", NULL, 43); + ZEPHIR_CALL_METHOD(NULL, &func, "__construct", NULL, 44); zephir_check_call_status(); ZEPHIR_RETURN_CALL_ZVAL_FUNCTION(&func, NULL, 0); zephir_check_call_status(); diff --git a/ext/test/json.zep.c b/ext/test/json.zep.c index 13f6207f0a..e1e448765a 100644 --- a/ext/test/json.zep.c +++ b/ext/test/json.zep.c @@ -12,8 +12,8 @@ #include #include "kernel/main.h" -#include "kernel/memory.h" #include "kernel/array.h" +#include "kernel/memory.h" #include "kernel/string.h" #include "kernel/operators.h" diff --git a/ext/test/mcall.zep.c b/ext/test/mcall.zep.c index 3010518135..a05445747c 100644 --- a/ext/test/mcall.zep.c +++ b/ext/test/mcall.zep.c @@ -156,7 +156,7 @@ PHP_METHOD(Test_Mcall, testCall3) { ZEPHIR_MM_GROW(); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "testmethod3", NULL, 44); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "testmethod3", NULL, 45); zephir_check_call_status(); RETURN_MM(); @@ -216,7 +216,7 @@ PHP_METHOD(Test_Mcall, testCall6) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "testmethod6", NULL, 45, a, b); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "testmethod6", NULL, 46, a, b); zephir_check_call_status(); RETURN_MM(); @@ -290,7 +290,7 @@ PHP_METHOD(Test_Mcall, testCall9) { - ZEPHIR_CALL_METHOD(&_0, this_ptr, "testmethod6", NULL, 45, a, b); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "testmethod6", NULL, 46, a, b); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_1, this_ptr, "testmethod5", NULL, 0, a, b); zephir_check_call_status(); @@ -335,7 +335,7 @@ PHP_METHOD(Test_Mcall, testCall12) { ZEPHIR_MM_GROW(); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "testmethod3", NULL, 44); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "testmethod3", NULL, 45); zephir_check_call_status(); RETURN_MM(); @@ -395,7 +395,7 @@ PHP_METHOD(Test_Mcall, testCall15) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "testmethod6", NULL, 45, a, b); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "testmethod6", NULL, 46, a, b); zephir_check_call_status(); RETURN_MM(); @@ -449,7 +449,7 @@ PHP_METHOD(Test_Mcall, testCall18) { ZEPHIR_MM_GROW(); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "testmethod7", NULL, 46); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "testmethod7", NULL, 47); zephir_check_call_status(); RETURN_MM(); @@ -564,7 +564,7 @@ PHP_METHOD(Test_Mcall, testCall22) { _0 = 1; } i = _1; - ZEPHIR_CALL_METHOD(&_3$$3, this_ptr, "testmethod21", &_4, 47, p, p); + ZEPHIR_CALL_METHOD(&_3$$3, this_ptr, "testmethod21", &_4, 48, p, p); zephir_check_call_status(); j += zephir_get_numberval(&_3$$3); } @@ -903,7 +903,7 @@ PHP_METHOD(Test_Mcall, testCallablePass) { ZEPHIR_INIT_VAR(&_0); ZEPHIR_INIT_NVAR(&_0); zephir_create_closure_ex(&_0, NULL, test_9__closure_ce, SL("__invoke")); - ZEPHIR_RETURN_CALL_METHOD(&a, "setcallable", NULL, 48, &_0); + ZEPHIR_RETURN_CALL_METHOD(&a, "setcallable", NULL, 49, &_0); zephir_check_call_status(); RETURN_MM(); @@ -934,7 +934,7 @@ PHP_METHOD(Test_Mcall, testCallableArrayThisMethodPass) { ZEPHIR_INIT_VAR(&_1); ZVAL_STRING(&_1, "bb"); zephir_array_fast_append(&_0, &_1); - ZEPHIR_RETURN_CALL_METHOD(&a, "setcallable", NULL, 48, &_0); + ZEPHIR_RETURN_CALL_METHOD(&a, "setcallable", NULL, 49, &_0); zephir_check_call_status(); RETURN_MM(); @@ -956,7 +956,7 @@ PHP_METHOD(Test_Mcall, aa) { ZEPHIR_CALL_METHOD(NULL, &a, "__construct", NULL, 0); zephir_check_call_status(); } - ZEPHIR_RETURN_CALL_METHOD(&a, "bb", NULL, 49); + ZEPHIR_RETURN_CALL_METHOD(&a, "bb", NULL, 50); zephir_check_call_status(); RETURN_MM(); diff --git a/ext/test/mcallchained.zep.c b/ext/test/mcallchained.zep.c index 51df2604b2..f34988ef88 100644 --- a/ext/test/mcallchained.zep.c +++ b/ext/test/mcallchained.zep.c @@ -107,7 +107,7 @@ PHP_METHOD(Test_McallChained, testChained3) { ZEPHIR_MM_GROW(); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "testmethod3", NULL, 50); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "testmethod3", NULL, 51); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_1, &_0, "testmethod2", NULL, 0); zephir_check_call_status(); diff --git a/ext/test/nativearray.zep.c b/ext/test/nativearray.zep.c index e71313a5d2..61129b920b 100644 --- a/ext/test/nativearray.zep.c +++ b/ext/test/nativearray.zep.c @@ -17,12 +17,16 @@ #include "kernel/operators.h" #include "kernel/string.h" #include "kernel/fcall.h" +#include "kernel/object.h" ZEPHIR_INIT_CLASS(Test_NativeArray) { ZEPHIR_REGISTER_CLASS(Test, NativeArray, test, nativearray, test_nativearray_method_entry, 0); + zend_declare_property_null(test_nativearray_ce, SL("prefixes"), ZEND_ACC_PROTECTED TSRMLS_CC); + + test_nativearray_ce->create_object = zephir_init_properties_Test_NativeArray; return SUCCESS; } @@ -738,7 +742,7 @@ PHP_METHOD(Test_NativeArray, testArrayAccess1) { ZEPHIR_INIT_NVAR(&_0); ZVAL_LONG(&_0, 3); zephir_array_fast_append(&a, &_0); - zephir_array_fetch_long(&b, &a, 0, PH_NOISY | PH_READONLY, "test/nativearray.zep", 243 TSRMLS_CC); + zephir_array_fetch_long(&b, &a, 0, PH_NOISY | PH_READONLY, "test/nativearray.zep", 245 TSRMLS_CC); RETURN_CTOR(&b); } @@ -758,7 +762,7 @@ PHP_METHOD(Test_NativeArray, testArrayAccess2) { add_assoc_long_ex(&a, SL("a"), 1); add_assoc_long_ex(&a, SL("b"), 2); add_assoc_long_ex(&a, SL("c"), 3); - zephir_array_fetch_string(&b, &a, SL("a"), PH_NOISY | PH_READONLY, "test/nativearray.zep", 253 TSRMLS_CC); + zephir_array_fetch_string(&b, &a, SL("a"), PH_NOISY | PH_READONLY, "test/nativearray.zep", 255 TSRMLS_CC); RETURN_CTOR(&b); } @@ -787,7 +791,7 @@ PHP_METHOD(Test_NativeArray, testArrayAccess3) { ZVAL_LONG(&_0, 3); zephir_array_fast_append(&a, &_0); c = 0; - zephir_array_fetch_long(&b, &a, c, PH_NOISY | PH_READONLY, "test/nativearray.zep", 265 TSRMLS_CC); + zephir_array_fetch_long(&b, &a, c, PH_NOISY | PH_READONLY, "test/nativearray.zep", 267 TSRMLS_CC); RETURN_CTOR(&b); } @@ -811,7 +815,7 @@ PHP_METHOD(Test_NativeArray, testArrayAccess4) { add_assoc_long_ex(&a, SL("c"), 3); ZEPHIR_INIT_VAR(&c); ZVAL_STRING(&c, "a"); - zephir_array_fetch(&b, &a, &c, PH_NOISY | PH_READONLY, "test/nativearray.zep", 277 TSRMLS_CC); + zephir_array_fetch(&b, &a, &c, PH_NOISY | PH_READONLY, "test/nativearray.zep", 279 TSRMLS_CC); RETURN_CTOR(&b); } @@ -834,7 +838,7 @@ PHP_METHOD(Test_NativeArray, testArrayAccess5) { add_assoc_long_ex(&a, SL("c"), 3); ZEPHIR_INIT_VAR(&c); ZVAL_STRING(&c, "a"); - zephir_array_fetch(&b, &a, &c, PH_NOISY | PH_READONLY, "test/nativearray.zep", 288 TSRMLS_CC); + zephir_array_fetch(&b, &a, &c, PH_NOISY | PH_READONLY, "test/nativearray.zep", 290 TSRMLS_CC); RETURN_CTOR(&b); } @@ -856,8 +860,8 @@ PHP_METHOD(Test_NativeArray, testArrayAccess6) { add_assoc_long_ex(&a, SL("a"), 1); add_assoc_long_ex(&a, SL("b"), 2); add_assoc_long_ex(&a, SL("c"), 3); - zephir_array_fetch_string(&_0, &a, SL("a"), PH_NOISY | PH_READONLY, "test/nativearray.zep", 298 TSRMLS_CC); - zephir_array_fetch_string(&_1, &a, SL("b"), PH_NOISY | PH_READONLY, "test/nativearray.zep", 298 TSRMLS_CC); + zephir_array_fetch_string(&_0, &a, SL("a"), PH_NOISY | PH_READONLY, "test/nativearray.zep", 300 TSRMLS_CC); + zephir_array_fetch_string(&_1, &a, SL("b"), PH_NOISY | PH_READONLY, "test/nativearray.zep", 300 TSRMLS_CC); ZEPHIR_INIT_VAR(&b); zephir_add_function(&b, &_0, &_1); RETURN_CCTOR(&b); @@ -884,8 +888,8 @@ PHP_METHOD(Test_NativeArray, testArrayMultipleAccess1) { add_index_stringl(&_0, 0, SL("a")); add_index_stringl(&_0, 1, SL("b")); zephir_array_update_long(&a, 0, &_0, PH_COPY ZEPHIR_DEBUG_PARAMS_DUMMY); - zephir_array_fetch_long(&_1, &a, 0, PH_NOISY | PH_READONLY, "test/nativearray.zep", 308 TSRMLS_CC); - zephir_array_fetch_long(&b, &_1, 0, PH_NOISY | PH_READONLY, "test/nativearray.zep", 308 TSRMLS_CC); + zephir_array_fetch_long(&_1, &a, 0, PH_NOISY | PH_READONLY, "test/nativearray.zep", 310 TSRMLS_CC); + zephir_array_fetch_long(&b, &_1, 0, PH_NOISY | PH_READONLY, "test/nativearray.zep", 310 TSRMLS_CC); RETURN_CTOR(&b); } @@ -915,8 +919,8 @@ PHP_METHOD(Test_NativeArray, testArrayMultipleAccess2) { ZVAL_STRING(&_1, "b"); zephir_array_fast_append(&_0, &_1); zephir_array_fast_append(&a, &_0); - zephir_array_fetch_long(&_2, &a, 0, PH_NOISY | PH_READONLY, "test/nativearray.zep", 318 TSRMLS_CC); - zephir_array_fetch_long(&b, &_2, 1, PH_NOISY | PH_READONLY, "test/nativearray.zep", 318 TSRMLS_CC); + zephir_array_fetch_long(&_2, &a, 0, PH_NOISY | PH_READONLY, "test/nativearray.zep", 320 TSRMLS_CC); + zephir_array_fetch_long(&b, &_2, 1, PH_NOISY | PH_READONLY, "test/nativearray.zep", 320 TSRMLS_CC); RETURN_CTOR(&b); } @@ -951,9 +955,9 @@ PHP_METHOD(Test_NativeArray, testArrayMultipleAccess3) { zephir_array_fast_append(&_1, &_2); zephir_array_fast_append(&_0, &_1); zephir_array_fast_append(&a, &_0); - zephir_array_fetch_long(&_3, &a, 0, PH_NOISY | PH_READONLY, "test/nativearray.zep", 328 TSRMLS_CC); - zephir_array_fetch_long(&_4, &_3, 0, PH_NOISY | PH_READONLY, "test/nativearray.zep", 328 TSRMLS_CC); - zephir_array_fetch_long(&b, &_4, 1, PH_NOISY | PH_READONLY, "test/nativearray.zep", 328 TSRMLS_CC); + zephir_array_fetch_long(&_3, &a, 0, PH_NOISY | PH_READONLY, "test/nativearray.zep", 330 TSRMLS_CC); + zephir_array_fetch_long(&_4, &_3, 0, PH_NOISY | PH_READONLY, "test/nativearray.zep", 330 TSRMLS_CC); + zephir_array_fetch_long(&b, &_4, 1, PH_NOISY | PH_READONLY, "test/nativearray.zep", 330 TSRMLS_CC); RETURN_CTOR(&b); } @@ -988,9 +992,9 @@ PHP_METHOD(Test_NativeArray, testArrayMultipleAccess4) { zephir_array_fast_append(&_1, &_2); zephir_array_fast_append(&_0, &_1); zephir_array_fast_append(&a, &_0); - zephir_array_fetch_long(&_3, &a, 0, PH_NOISY | PH_READONLY, "test/nativearray.zep", 338 TSRMLS_CC); - zephir_array_fetch_long(&_4, &_3, 0, PH_NOISY | PH_READONLY, "test/nativearray.zep", 338 TSRMLS_CC); - zephir_array_fetch_long(&b, &_4, 1, PH_NOISY | PH_READONLY, "test/nativearray.zep", 338 TSRMLS_CC); + zephir_array_fetch_long(&_3, &a, 0, PH_NOISY | PH_READONLY, "test/nativearray.zep", 340 TSRMLS_CC); + zephir_array_fetch_long(&_4, &_3, 0, PH_NOISY | PH_READONLY, "test/nativearray.zep", 340 TSRMLS_CC); + zephir_array_fetch_long(&b, &_4, 1, PH_NOISY | PH_READONLY, "test/nativearray.zep", 340 TSRMLS_CC); RETURN_CTOR(&b); } @@ -1020,9 +1024,9 @@ PHP_METHOD(Test_NativeArray, testArrayMultipleAccess5) { add_assoc_long_ex(&_1, SL("d"), 1); zephir_array_update_string(&_0, SL("b"), &_1, PH_COPY | PH_SEPARATE); zephir_array_update_string(&a, SL("a"), &_0, PH_COPY | PH_SEPARATE); - zephir_array_fetch_string(&_2, &a, SL("a"), PH_NOISY | PH_READONLY, "test/nativearray.zep", 348 TSRMLS_CC); - zephir_array_fetch_string(&_3, &_2, SL("b"), PH_NOISY | PH_READONLY, "test/nativearray.zep", 348 TSRMLS_CC); - zephir_array_fetch_string(&b, &_3, SL("c"), PH_NOISY | PH_READONLY, "test/nativearray.zep", 348 TSRMLS_CC); + zephir_array_fetch_string(&_2, &a, SL("a"), PH_NOISY | PH_READONLY, "test/nativearray.zep", 350 TSRMLS_CC); + zephir_array_fetch_string(&_3, &_2, SL("b"), PH_NOISY | PH_READONLY, "test/nativearray.zep", 350 TSRMLS_CC); + zephir_array_fetch_string(&b, &_3, SL("c"), PH_NOISY | PH_READONLY, "test/nativearray.zep", 350 TSRMLS_CC); RETURN_CTOR(&b); } @@ -1224,17 +1228,17 @@ PHP_METHOD(Test_NativeArray, testArrayAppend1) { array_init(&a); ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "hello"); - zephir_array_append(&a, &_0, PH_SEPARATE, "test/nativearray.zep", 400); - zephir_array_append(&a, &__$null, PH_SEPARATE, "test/nativearray.zep", 400); + zephir_array_append(&a, &_0, PH_SEPARATE, "test/nativearray.zep", 402); + zephir_array_append(&a, &__$null, PH_SEPARATE, "test/nativearray.zep", 402); ZEPHIR_INIT_NVAR(&_0); ZVAL_BOOL(&_0, 0); - zephir_array_append(&a, &_0, PH_SEPARATE, "test/nativearray.zep", 400); + zephir_array_append(&a, &_0, PH_SEPARATE, "test/nativearray.zep", 402); ZEPHIR_INIT_NVAR(&_0); ZVAL_DOUBLE(&_0, 1.10); - zephir_array_append(&a, &_0, PH_SEPARATE, "test/nativearray.zep", 400); + zephir_array_append(&a, &_0, PH_SEPARATE, "test/nativearray.zep", 402); ZEPHIR_INIT_NVAR(&_0); ZVAL_LONG(&_0, 5); - zephir_array_append(&a, &_0, PH_SEPARATE, "test/nativearray.zep", 400); + zephir_array_append(&a, &_0, PH_SEPARATE, "test/nativearray.zep", 402); ZEPHIR_INIT_VAR(&_1); zephir_create_array(&_1, 3, 0 TSRMLS_CC); ZEPHIR_INIT_NVAR(&_0); @@ -1246,7 +1250,7 @@ PHP_METHOD(Test_NativeArray, testArrayAppend1) { ZEPHIR_INIT_NVAR(&_0); ZVAL_LONG(&_0, 3); zephir_array_fast_append(&_1, &_0); - zephir_array_append(&a, &_1, PH_SEPARATE, "test/nativearray.zep", 400); + zephir_array_append(&a, &_1, PH_SEPARATE, "test/nativearray.zep", 402); RETURN_CCTOR(&a); } @@ -1288,18 +1292,18 @@ PHP_METHOD(Test_NativeArray, testArrayAppend2) { zephir_array_fast_append(&g, &_0); ZEPHIR_INIT_VAR(&a); array_init(&a); - zephir_array_append(&a, &b, PH_SEPARATE, "test/nativearray.zep", 407); - zephir_array_append(&a, &c, PH_SEPARATE, "test/nativearray.zep", 407); + zephir_array_append(&a, &b, PH_SEPARATE, "test/nativearray.zep", 409); + zephir_array_append(&a, &c, PH_SEPARATE, "test/nativearray.zep", 409); ZEPHIR_INIT_NVAR(&_0); ZVAL_BOOL(&_0, d); - zephir_array_append(&a, &_0, PH_SEPARATE, "test/nativearray.zep", 407); + zephir_array_append(&a, &_0, PH_SEPARATE, "test/nativearray.zep", 409); ZEPHIR_INIT_NVAR(&_0); ZVAL_DOUBLE(&_0, e); - zephir_array_append(&a, &_0, PH_SEPARATE, "test/nativearray.zep", 407); + zephir_array_append(&a, &_0, PH_SEPARATE, "test/nativearray.zep", 409); ZEPHIR_INIT_NVAR(&_0); ZVAL_LONG(&_0, f); - zephir_array_append(&a, &_0, PH_SEPARATE, "test/nativearray.zep", 407); - zephir_array_append(&a, &g, PH_SEPARATE, "test/nativearray.zep", 407); + zephir_array_append(&a, &_0, PH_SEPARATE, "test/nativearray.zep", 409); + zephir_array_append(&a, &g, PH_SEPARATE, "test/nativearray.zep", 409); RETURN_CCTOR(&a); } @@ -1863,9 +1867,9 @@ PHP_METHOD(Test_NativeArray, issue709) { ZEPHIR_INIT_NVAR(&_3$$3); ZVAL_LONG(&_3$$3, 2); zephir_array_fast_append(&arr, &_3$$3); - ZEPHIR_CALL_FUNCTION(&_5$$3, "array_rand", &_6, 51, &arr); + ZEPHIR_CALL_FUNCTION(&_5$$3, "array_rand", &_6, 52, &arr); zephir_check_call_status(); - zephir_array_fetch(&_4$$3, &arr, &_5$$3, PH_NOISY | PH_READONLY, "test/nativearray.zep", 624 TSRMLS_CC); + zephir_array_fetch(&_4$$3, &arr, &_5$$3, PH_NOISY | PH_READONLY, "test/nativearray.zep", 626 TSRMLS_CC); ZEPHIR_CPY_WRT(&arr, &_4$$3); _7$$3 = ZEPHIR_LT_LONG(&arr, 0); if (!(_7$$3)) { @@ -1880,3 +1884,84 @@ PHP_METHOD(Test_NativeArray, issue709) { } +PHP_METHOD(Test_NativeArray, Issue1140) { + + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *prefix_param = NULL, *baseDir_param = NULL, _0, _2, _3, _1$$3; + zval prefix, baseDir; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&prefix); + ZVAL_UNDEF(&baseDir); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_1$$3); + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &prefix_param, &baseDir_param); + + zephir_get_strval(&prefix, prefix_param); + zephir_get_strval(&baseDir, baseDir_param); + + + zephir_read_property(&_0, this_ptr, SL("prefixes"), PH_NOISY_CC | PH_READONLY); + if (!(zephir_array_isset(&_0, &prefix))) { + ZEPHIR_INIT_VAR(&_1$$3); + array_init(&_1$$3); + zephir_update_property_array(this_ptr, SL("prefixes"), &prefix, &_1$$3); + ZEPHIR_INIT_NVAR(&_1$$3); + } + zephir_read_property(&_2, this_ptr, SL("prefixes"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch(&_3, &_2, &prefix, PH_NOISY | PH_READONLY, "test/nativearray.zep", 639 TSRMLS_CC); + ZEPHIR_MAKE_REF(&_3); + ZEPHIR_CALL_FUNCTION(NULL, "array_push", NULL, 53, &_3, &baseDir); + ZEPHIR_UNREF(&_3); + zephir_check_call_status(); + RETURN_MM_MEMBER(getThis(), "prefixes"); + +} + +PHP_METHOD(Test_NativeArray, Issue1159) { + + zval myvar, _0; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&myvar); + ZVAL_UNDEF(&_0); + + ZEPHIR_MM_GROW(); + + ZEPHIR_INIT_VAR(&myvar); + ZVAL_LONG(&myvar, 1); + ZEPHIR_INIT_VAR(&_0); + zephir_create_array(&_0, 1, 0 TSRMLS_CC); + zephir_array_fast_append(&_0, &myvar); + ZEPHIR_CPY_WRT(&myvar, &_0); + RETURN_CCTOR(&myvar); + +} + +zend_object *zephir_init_properties_Test_NativeArray(zend_class_entry *class_type TSRMLS_DC) { + + zval _0, _1$$3; + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1$$3); + + ZEPHIR_MM_GROW(); + + { + zval local_this_ptr, *this_ptr = &local_this_ptr; + ZEPHIR_CREATE_OBJECT(this_ptr, class_type); + zephir_read_property(&_0, this_ptr, SL("prefixes"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_0) == IS_NULL) { + ZEPHIR_INIT_VAR(&_1$$3); + array_init(&_1$$3); + zephir_update_property_zval(this_ptr, SL("prefixes"), &_1$$3); + } + ZEPHIR_MM_RESTORE(); + return Z_OBJ_P(this_ptr); + } + +} + diff --git a/ext/test/nativearray.zep.h b/ext/test/nativearray.zep.h index ed45f1dcab..3b029007c9 100644 --- a/ext/test/nativearray.zep.h +++ b/ext/test/nativearray.zep.h @@ -75,6 +75,9 @@ PHP_METHOD(Test_NativeArray, issue743a); PHP_METHOD(Test_NativeArray, issue743b); PHP_METHOD(Test_NativeArray, issue743c); PHP_METHOD(Test_NativeArray, issue709); +PHP_METHOD(Test_NativeArray, Issue1140); +PHP_METHOD(Test_NativeArray, Issue1159); +zend_object *zephir_init_properties_Test_NativeArray(zend_class_entry *class_type TSRMLS_DC); #if PHP_VERSION_ID >= 70200 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_test_nativearray_testarray1, 0, 0, IS_ARRAY, 0) @@ -586,6 +589,19 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_test_nativearray_issue709, 0, 0, #endif ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_INFO_EX(arginfo_test_nativearray_issue1140, 0, 0, 2) +#if PHP_VERSION_ID >= 70200 + ZEND_ARG_TYPE_INFO(0, prefix, IS_STRING, 0) +#else + ZEND_ARG_INFO(0, prefix) +#endif +#if PHP_VERSION_ID >= 70200 + ZEND_ARG_TYPE_INFO(0, baseDir, IS_STRING, 0) +#else + ZEND_ARG_INFO(0, baseDir) +#endif +ZEND_END_ARG_INFO() + ZEPHIR_INIT_FUNCS(test_nativearray_method_entry) { PHP_ME(Test_NativeArray, testArray1, arginfo_test_nativearray_testarray1, ZEND_ACC_PUBLIC) PHP_ME(Test_NativeArray, testArray2, arginfo_test_nativearray_testarray2, ZEND_ACC_PUBLIC) @@ -659,5 +675,7 @@ ZEPHIR_INIT_FUNCS(test_nativearray_method_entry) { PHP_ME(Test_NativeArray, issue743b, arginfo_test_nativearray_issue743b, ZEND_ACC_PUBLIC) PHP_ME(Test_NativeArray, issue743c, arginfo_test_nativearray_issue743c, ZEND_ACC_PUBLIC) PHP_ME(Test_NativeArray, issue709, arginfo_test_nativearray_issue709, ZEND_ACC_PUBLIC) + PHP_ME(Test_NativeArray, Issue1140, arginfo_test_nativearray_issue1140, ZEND_ACC_PUBLIC) + PHP_ME(Test_NativeArray, Issue1159, NULL, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/test/oo.zep.c b/ext/test/oo.zep.c index 6f7f531b26..935d9ebfab 100644 --- a/ext/test/oo.zep.c +++ b/ext/test/oo.zep.c @@ -57,7 +57,7 @@ PHP_METHOD(Test_Oo, testInstance2) { ZEPHIR_INIT_VAR(&o); object_init_ex(&o, test_oo_ooconstruct_ce); - ZEPHIR_CALL_METHOD(NULL, &o, "__construct", NULL, 52); + ZEPHIR_CALL_METHOD(NULL, &o, "__construct", NULL, 54); zephir_check_call_status(); RETURN_CCTOR(&o); @@ -101,7 +101,7 @@ PHP_METHOD(Test_Oo, testInstance4) { ZVAL_STRING(&b, "b"); ZEPHIR_INIT_VAR(&o); object_init_ex(&o, test_oo_ooconstructparams_ce); - ZEPHIR_CALL_METHOD(NULL, &o, "__construct", NULL, 53, &a, &b); + ZEPHIR_CALL_METHOD(NULL, &o, "__construct", NULL, 55, &a, &b); zephir_check_call_status(); RETURN_CCTOR(&o); @@ -125,7 +125,7 @@ PHP_METHOD(Test_Oo, testInstance5) { ZVAL_STRING(&_0, "a"); ZEPHIR_INIT_VAR(&_1); ZVAL_STRING(&_1, "b"); - ZEPHIR_CALL_METHOD(NULL, &o, "__construct", NULL, 53, &_0, &_1); + ZEPHIR_CALL_METHOD(NULL, &o, "__construct", NULL, 55, &_0, &_1); zephir_check_call_status(); RETURN_CCTOR(&o); @@ -147,7 +147,7 @@ PHP_METHOD(Test_Oo, testInstance6) { object_init_ex(&o, test_oo_ooconstructparams_ce); ZVAL_LONG(&_0, 1); ZVAL_LONG(&_1, 2); - ZEPHIR_CALL_METHOD(NULL, &o, "__construct", NULL, 53, &_0, &_1); + ZEPHIR_CALL_METHOD(NULL, &o, "__construct", NULL, 55, &_0, &_1); zephir_check_call_status(); RETURN_CCTOR(&o); @@ -169,7 +169,7 @@ PHP_METHOD(Test_Oo, testInstance7) { object_init_ex(&o, test_oo_ooconstructparams_ce); ZVAL_BOOL(&_0, 0); ZVAL_BOOL(&_1, 1); - ZEPHIR_CALL_METHOD(NULL, &o, "__construct", NULL, 53, &_0, &_1); + ZEPHIR_CALL_METHOD(NULL, &o, "__construct", NULL, 55, &_0, &_1); zephir_check_call_status(); RETURN_CCTOR(&o); @@ -191,7 +191,7 @@ PHP_METHOD(Test_Oo, testInstance8) { object_init_ex(&o, test_oo_ooconstructparams_ce); ZVAL_DOUBLE(&_0, 1.2); ZVAL_DOUBLE(&_1, 7.30); - ZEPHIR_CALL_METHOD(NULL, &o, "__construct", NULL, 53, &_0, &_1); + ZEPHIR_CALL_METHOD(NULL, &o, "__construct", NULL, 55, &_0, &_1); zephir_check_call_status(); RETURN_CCTOR(&o); @@ -247,7 +247,7 @@ PHP_METHOD(Test_Oo, testInstance11) { object_init_ex(&o, test_oo_ooconstructparams_ce); ZVAL_LONG(&_0, 1); ZVAL_LONG(&_1, 2); - ZEPHIR_CALL_METHOD(NULL, &o, "__construct", NULL, 53, &_0, &_1); + ZEPHIR_CALL_METHOD(NULL, &o, "__construct", NULL, 55, &_0, &_1); zephir_check_call_status(); RETURN_CCTOR(&o); @@ -272,9 +272,9 @@ PHP_METHOD(Test_Oo, testInstance12) { PHP_METHOD(Test_Oo, createInstancesInLoop) { - zend_class_entry *_4$$3; + zend_class_entry *_5$$3, *_9$$4; zval result, _0; - zval className, instance, fqcn, _1, *_2, _3$$3, _5$$3, _6$$3; + zval className, instance, fqcn, _1, *_2, _3, _4$$3, _6$$3, _7$$3, _8$$4, _10$$4, _11$$4; zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); @@ -282,9 +282,13 @@ PHP_METHOD(Test_Oo, createInstancesInLoop) { ZVAL_UNDEF(&instance); ZVAL_UNDEF(&fqcn); ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_3$$3); - ZVAL_UNDEF(&_5$$3); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_4$$3); ZVAL_UNDEF(&_6$$3); + ZVAL_UNDEF(&_7$$3); + ZVAL_UNDEF(&_8$$4); + ZVAL_UNDEF(&_10$$4); + ZVAL_UNDEF(&_11$$4); ZVAL_UNDEF(&result); ZVAL_UNDEF(&_0); @@ -301,27 +305,59 @@ PHP_METHOD(Test_Oo, createInstancesInLoop) { ZVAL_STRING(&_1, "OoDynamicB"); zephir_array_fast_append(&_0, &_1); zephir_is_iterable(&_0, 0, "test/oo.zep", 112); - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&_0), _2) - { - ZEPHIR_INIT_NVAR(&className); - ZVAL_COPY(&className, _2); - ZEPHIR_INIT_NVAR(&fqcn); - ZEPHIR_CONCAT_SV(&fqcn, "Test\\Oo\\", &className); - ZEPHIR_INIT_NVAR(&instance); - zephir_fetch_safe_class(&_3$$3, &fqcn); - _4$$3 = zephir_fetch_class_str_ex(Z_STRVAL_P(&_3$$3), Z_STRLEN_P(&_3$$3), ZEND_FETCH_CLASS_AUTO); - object_init_ex(&instance, _4$$3); - if (zephir_has_constructor(&instance TSRMLS_CC)) { - ZEPHIR_CALL_METHOD(NULL, &instance, "__construct", NULL, 0); + if (Z_TYPE_P(&_0) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&_0), _2) + { + ZEPHIR_INIT_NVAR(&className); + ZVAL_COPY(&className, _2); + ZEPHIR_INIT_NVAR(&fqcn); + ZEPHIR_CONCAT_SV(&fqcn, "Test\\Oo\\", &className); + ZEPHIR_INIT_NVAR(&instance); + zephir_fetch_safe_class(&_4$$3, &fqcn); + _5$$3 = zephir_fetch_class_str_ex(Z_STRVAL_P(&_4$$3), Z_STRLEN_P(&_4$$3), ZEND_FETCH_CLASS_AUTO); + object_init_ex(&instance, _5$$3); + if (zephir_has_constructor(&instance TSRMLS_CC)) { + ZEPHIR_CALL_METHOD(NULL, &instance, "__construct", NULL, 0); + zephir_check_call_status(); + } + ZEPHIR_CALL_METHOD(&_6$$3, &instance, "execute", NULL, 0); zephir_check_call_status(); - } - ZEPHIR_CALL_METHOD(&_5$$3, &instance, "execute", NULL, 0); - zephir_check_call_status(); - zephir_array_append(&result, &_5$$3, PH_SEPARATE, "test/oo.zep", 108); - ZEPHIR_CALL_METHOD(&_6$$3, &instance, "execute2", NULL, 0); + zephir_array_append(&result, &_6$$3, PH_SEPARATE, "test/oo.zep", 108); + ZEPHIR_CALL_METHOD(&_7$$3, &instance, "execute2", NULL, 0); + zephir_check_call_status(); + zephir_array_append(&result, &_7$$3, PH_SEPARATE, "test/oo.zep", 109); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &_0, "rewind", NULL, 0); zephir_check_call_status(); - zephir_array_append(&result, &_6$$3, PH_SEPARATE, "test/oo.zep", 109); - } ZEND_HASH_FOREACH_END(); + while (1) { + ZEPHIR_CALL_METHOD(&_3, &_0, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_3)) { + break; + } + ZEPHIR_CALL_METHOD(&className, &_0, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&fqcn); + ZEPHIR_CONCAT_SV(&fqcn, "Test\\Oo\\", &className); + ZEPHIR_INIT_NVAR(&instance); + zephir_fetch_safe_class(&_8$$4, &fqcn); + _9$$4 = zephir_fetch_class_str_ex(Z_STRVAL_P(&_8$$4), Z_STRLEN_P(&_8$$4), ZEND_FETCH_CLASS_AUTO); + object_init_ex(&instance, _9$$4); + if (zephir_has_constructor(&instance TSRMLS_CC)) { + ZEPHIR_CALL_METHOD(NULL, &instance, "__construct", NULL, 0); + zephir_check_call_status(); + } + ZEPHIR_CALL_METHOD(&_10$$4, &instance, "execute", NULL, 0); + zephir_check_call_status(); + zephir_array_append(&result, &_10$$4, PH_SEPARATE, "test/oo.zep", 108); + ZEPHIR_CALL_METHOD(&_11$$4, &instance, "execute2", NULL, 0); + zephir_check_call_status(); + zephir_array_append(&result, &_11$$4, PH_SEPARATE, "test/oo.zep", 109); + ZEPHIR_CALL_METHOD(NULL, &_0, "next", NULL, 0); + zephir_check_call_status(); + } + } ZEPHIR_INIT_NVAR(&className); RETURN_CTOR(&result); diff --git a/ext/test/oo/deprecatedmethods.zep.c b/ext/test/oo/deprecatedmethods.zep.c index ab01002ee0..ddc0656db8 100644 --- a/ext/test/oo/deprecatedmethods.zep.c +++ b/ext/test/oo/deprecatedmethods.zep.c @@ -41,7 +41,7 @@ PHP_METHOD(Test_Oo_DeprecatedMethods, normalMethod) { ZEPHIR_MM_GROW(); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "privatedeprecated", NULL, 54); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "privatedeprecated", NULL, 56); zephir_check_call_status(); RETURN_MM(); diff --git a/ext/test/optimizers/acos.zep.c b/ext/test/optimizers/acos.zep.c index 554d4d1972..0017427292 100644 --- a/ext/test/optimizers/acos.zep.c +++ b/ext/test/optimizers/acos.zep.c @@ -37,7 +37,7 @@ PHP_METHOD(Test_Optimizers_ACos, testInt) { a = 1; ZVAL_LONG(&_0, a); - ZEPHIR_RETURN_CALL_FUNCTION("acos", NULL, 12, &_0); + ZEPHIR_RETURN_CALL_FUNCTION("acos", NULL, 13, &_0); zephir_check_call_status(); RETURN_MM(); @@ -55,7 +55,7 @@ PHP_METHOD(Test_Optimizers_ACos, testVar) { a = 1; ZVAL_LONG(&_0, a); - ZEPHIR_RETURN_CALL_FUNCTION("acos", NULL, 12, &_0); + ZEPHIR_RETURN_CALL_FUNCTION("acos", NULL, 13, &_0); zephir_check_call_status(); RETURN_MM(); @@ -72,7 +72,7 @@ PHP_METHOD(Test_Optimizers_ACos, testIntValue1) { ZEPHIR_MM_GROW(); ZVAL_LONG(&_0, 0); - ZEPHIR_RETURN_CALL_FUNCTION("acos", NULL, 12, &_0); + ZEPHIR_RETURN_CALL_FUNCTION("acos", NULL, 13, &_0); zephir_check_call_status(); RETURN_MM(); @@ -93,7 +93,7 @@ PHP_METHOD(Test_Optimizers_ACos, testIntParameter) { ZVAL_LONG(&_0, a); - ZEPHIR_RETURN_CALL_FUNCTION("acos", NULL, 12, &_0); + ZEPHIR_RETURN_CALL_FUNCTION("acos", NULL, 13, &_0); zephir_check_call_status(); RETURN_MM(); @@ -112,7 +112,7 @@ PHP_METHOD(Test_Optimizers_ACos, testVarParameter) { - ZEPHIR_RETURN_CALL_FUNCTION("acos", NULL, 12, a); + ZEPHIR_RETURN_CALL_FUNCTION("acos", NULL, 13, a); zephir_check_call_status(); RETURN_MM(); diff --git a/ext/test/optimizers/asin.zep.c b/ext/test/optimizers/asin.zep.c index c4d1a96188..a424df1d19 100644 --- a/ext/test/optimizers/asin.zep.c +++ b/ext/test/optimizers/asin.zep.c @@ -37,7 +37,7 @@ PHP_METHOD(Test_Optimizers_ASin, testInt) { a = 1; ZVAL_LONG(&_0, a); - ZEPHIR_RETURN_CALL_FUNCTION("asin", NULL, 11, &_0); + ZEPHIR_RETURN_CALL_FUNCTION("asin", NULL, 12, &_0); zephir_check_call_status(); RETURN_MM(); @@ -55,7 +55,7 @@ PHP_METHOD(Test_Optimizers_ASin, testVar) { a = 1; ZVAL_LONG(&_0, a); - ZEPHIR_RETURN_CALL_FUNCTION("asin", NULL, 11, &_0); + ZEPHIR_RETURN_CALL_FUNCTION("asin", NULL, 12, &_0); zephir_check_call_status(); RETURN_MM(); @@ -72,7 +72,7 @@ PHP_METHOD(Test_Optimizers_ASin, testIntValue1) { ZEPHIR_MM_GROW(); ZVAL_LONG(&_0, 0); - ZEPHIR_RETURN_CALL_FUNCTION("asin", NULL, 11, &_0); + ZEPHIR_RETURN_CALL_FUNCTION("asin", NULL, 12, &_0); zephir_check_call_status(); RETURN_MM(); @@ -93,7 +93,7 @@ PHP_METHOD(Test_Optimizers_ASin, testIntParameter) { ZVAL_LONG(&_0, a); - ZEPHIR_RETURN_CALL_FUNCTION("asin", NULL, 11, &_0); + ZEPHIR_RETURN_CALL_FUNCTION("asin", NULL, 12, &_0); zephir_check_call_status(); RETURN_MM(); @@ -112,7 +112,7 @@ PHP_METHOD(Test_Optimizers_ASin, testVarParameter) { - ZEPHIR_RETURN_CALL_FUNCTION("asin", NULL, 11, a); + ZEPHIR_RETURN_CALL_FUNCTION("asin", NULL, 12, a); zephir_check_call_status(); RETURN_MM(); diff --git a/ext/test/optimizers/strreplace.zep.c b/ext/test/optimizers/strreplace.zep.c index f4520aac47..222dad2feb 100644 --- a/ext/test/optimizers/strreplace.zep.c +++ b/ext/test/optimizers/strreplace.zep.c @@ -204,7 +204,7 @@ PHP_METHOD(Test_Optimizers_StrReplace, issue732B) { zephir_array_fast_append(&replacements, &_0); ZEPHIR_INIT_VAR(&subject); ZVAL_STRING(&subject, "The quick brown fox jumped over the lazy dog."); - ZEPHIR_RETURN_CALL_FUNCTION("preg_replace", NULL, 55, &patterns, &replacements, &subject); + ZEPHIR_RETURN_CALL_FUNCTION("preg_replace", NULL, 57, &patterns, &replacements, &subject); zephir_check_call_status(); RETURN_MM(); diff --git a/ext/test/quantum.zep.c b/ext/test/quantum.zep.c index 49fa71fbc1..185611e595 100644 --- a/ext/test/quantum.zep.c +++ b/ext/test/quantum.zep.c @@ -13,8 +13,8 @@ #include "kernel/main.h" #include "kernel/operators.h" -#include "kernel/memory.h" #include "kernel/array.h" +#include "kernel/memory.h" #include "kernel/fcall.h" #include "math.h" @@ -133,7 +133,7 @@ PHP_METHOD(Test_Quantum, harmos) { ZVAL_STRING(&_0, "harmos.txt"); ZEPHIR_INIT_VAR(&_1); ZVAL_STRING(&_1, "w"); - ZEPHIR_CALL_FUNCTION(&fp, "fopen", NULL, 30, &_0, &_1); + ZEPHIR_CALL_FUNCTION(&fp, "fopen", NULL, 31, &_0, &_1); zephir_check_call_status(); if (!(zephir_is_true(&fp))) { RETURN_MM_LONG(1); @@ -338,13 +338,13 @@ PHP_METHOD(Test_Quantum, harmos) { ZVAL_STRING(&_52$$9, "%16.8lf %16.8lf %16.8lf \n"); ZVAL_DOUBLE(&_53$$9, ((double) i * dx)); ZVAL_DOUBLE(&_54$$9, ((double) n * dt)); - ZEPHIR_CALL_FUNCTION(NULL, "fprintf", &_55, 56, &fp, &_52$$9, &_53$$9, &_54$$9, &_51$$9); + ZEPHIR_CALL_FUNCTION(NULL, "fprintf", &_55, 58, &fp, &_52$$9, &_53$$9, &_54$$9, &_51$$9); zephir_check_call_status(); i = (i + 10); } ZEPHIR_INIT_NVAR(&_56$$8); ZVAL_STRING(&_56$$8, "\n"); - ZEPHIR_CALL_FUNCTION(NULL, "fprintf", &_55, 56, &fp, &_56$$8); + ZEPHIR_CALL_FUNCTION(NULL, "fprintf", &_55, 58, &fp, &_56$$8); zephir_check_call_status(); } j = 1; diff --git a/ext/test/range.zep.c b/ext/test/range.zep.c index 5e7e95b047..b07deca526 100644 --- a/ext/test/range.zep.c +++ b/ext/test/range.zep.c @@ -44,7 +44,7 @@ PHP_METHOD(Test_Range, inclusive1) { ZVAL_LONG(&_0, 0); ZVAL_LONG(&_1, 10); - ZEPHIR_CALL_FUNCTION(&_2, "range", NULL, 57, &_0, &_1); + ZEPHIR_CALL_FUNCTION(&_2, "range", NULL, 59, &_0, &_1); zephir_check_call_status(); zephir_get_arrval(&_3, &_2); RETURN_CTOR(&_3); @@ -67,7 +67,7 @@ PHP_METHOD(Test_Range, exclusive1) { ZVAL_LONG(&_0, 0); ZVAL_LONG(&_1, 10); - ZEPHIR_CALL_FUNCTION(&_2, "range", NULL, 57, &_0, &_1); + ZEPHIR_CALL_FUNCTION(&_2, "range", NULL, 59, &_0, &_1); zephir_check_call_status(); zephir_get_arrval(&_3, &_2); RETURN_CTOR(&_3); diff --git a/ext/test/regexdna.zep.c b/ext/test/regexdna.zep.c index bc6f0a1951..74d4bbae84 100644 --- a/ext/test/regexdna.zep.c +++ b/ext/test/regexdna.zep.c @@ -37,7 +37,7 @@ PHP_METHOD(Test_RegexDNA, process) { zend_long ZEPHIR_LAST_CALL_STATUS; zephir_fcall_cache_entry *_3 = NULL; - zval *path, path_sub, variants, vIUB, vIUBnew, stuffToRemove, contents, initialLength, regex, codeLength, discard, _0, _1, _2, *_4, _5$$3, _6$$3; + zval *path, path_sub, variants, vIUB, vIUBnew, stuffToRemove, contents, initialLength, regex, codeLength, discard, _0, _1, _2, *_4, _5, _6$$3, _7$$3, _8$$4, _9$$4; zval *this_ptr = getThis(); ZVAL_UNDEF(&path_sub); @@ -53,8 +53,11 @@ PHP_METHOD(Test_RegexDNA, process) { ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_5$$3); + ZVAL_UNDEF(&_5); ZVAL_UNDEF(&_6$$3); + ZVAL_UNDEF(&_7$$3); + ZVAL_UNDEF(&_8$$4); + ZVAL_UNDEF(&_9$$4); ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &path); @@ -174,27 +177,51 @@ PHP_METHOD(Test_RegexDNA, process) { ZEPHIR_CONCAT_SVS(&_1, "/", &stuffToRemove, "/mS"); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, ""); - ZEPHIR_CALL_FUNCTION(&_2, "preg_replace", &_3, 55, &_1, &_0, &contents); + ZEPHIR_CALL_FUNCTION(&_2, "preg_replace", &_3, 57, &_1, &_0, &contents); zephir_check_call_status(); ZEPHIR_CPY_WRT(&contents, &_2); ZEPHIR_INIT_VAR(&codeLength); ZVAL_LONG(&codeLength, zephir_fast_strlen_ev(&contents)); zephir_is_iterable(&variants, 0, "test/regexdna.zep", 59); - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&variants), _4) - { - ZEPHIR_INIT_NVAR(®ex); - ZVAL_COPY(®ex, _4); - zend_print_zval(®ex, 0); - php_printf("%s", " "); - ZEPHIR_INIT_LNVAR(_5$$3); - ZEPHIR_CONCAT_SVS(&_5$$3, "/", ®ex, "/iS"); - ZEPHIR_INIT_NVAR(&_6$$3); - zephir_preg_match(&_6$$3, &_5$$3, &contents, &discard, 1, 0 , 0 TSRMLS_CC); - zend_print_zval(&_6$$3, 0); - php_printf("%c", '\n'); - } ZEND_HASH_FOREACH_END(); + if (Z_TYPE_P(&variants) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&variants), _4) + { + ZEPHIR_INIT_NVAR(®ex); + ZVAL_COPY(®ex, _4); + zend_print_zval(®ex, 0); + php_printf("%s", " "); + ZEPHIR_INIT_LNVAR(_6$$3); + ZEPHIR_CONCAT_SVS(&_6$$3, "/", ®ex, "/iS"); + ZEPHIR_INIT_NVAR(&_7$$3); + zephir_preg_match(&_7$$3, &_6$$3, &contents, &discard, 1, 0 , 0 TSRMLS_CC); + zend_print_zval(&_7$$3, 0); + php_printf("%c", '\n'); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &variants, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_5, &variants, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_5)) { + break; + } + ZEPHIR_CALL_METHOD(®ex, &variants, "current", NULL, 0); + zephir_check_call_status(); + zend_print_zval(®ex, 0); + php_printf("%s", " "); + ZEPHIR_INIT_LNVAR(_8$$4); + ZEPHIR_CONCAT_SVS(&_8$$4, "/", ®ex, "/iS"); + ZEPHIR_INIT_NVAR(&_9$$4); + zephir_preg_match(&_9$$4, &_8$$4, &contents, &discard, 1, 0 , 0 TSRMLS_CC); + zend_print_zval(&_9$$4, 0); + php_printf("%c", '\n'); + ZEPHIR_CALL_METHOD(NULL, &variants, "next", NULL, 0); + zephir_check_call_status(); + } + } ZEPHIR_INIT_NVAR(®ex); - ZEPHIR_CALL_FUNCTION(&_2, "preg_replace", &_3, 55, &vIUB, &vIUBnew, &contents); + ZEPHIR_CALL_FUNCTION(&_2, "preg_replace", &_3, 57, &vIUB, &vIUBnew, &contents); zephir_check_call_status(); ZEPHIR_CPY_WRT(&contents, &_2); php_printf("%c", '\n'); diff --git a/ext/test/requires.zep.c b/ext/test/requires.zep.c index c8cab15053..583338b70d 100644 --- a/ext/test/requires.zep.c +++ b/ext/test/requires.zep.c @@ -94,7 +94,7 @@ PHP_METHOD(Test_Requires, requireExternal3) { ZEPHIR_CALL_METHOD(NULL, &external3, "__construct", NULL, 0); zephir_check_call_status(); } - ZEPHIR_CALL_METHOD(NULL, &external3, "req", NULL, 58, path, this_ptr); + ZEPHIR_CALL_METHOD(NULL, &external3, "req", NULL, 60, path, this_ptr); zephir_check_call_status(); RETURN_MM_MEMBER(getThis(), "content"); @@ -117,9 +117,10 @@ PHP_METHOD(Test_Requires, setContent) { PHP_METHOD(Test_Requires, renderTemplate) { - zend_string *_3$$3; - zend_ulong _2$$3; - zval *templatePath_param = NULL, *params, params_sub, _0, key, value, _5, *_1$$3, _4$$4; + zend_string *_4$$3; + zend_ulong _3$$3; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *templatePath_param = NULL, *params, params_sub, _0, key, value, _7, *_1$$3, _2$$3, _5$$4, _6$$5; zval templatePath; zval *this_ptr = getThis(); @@ -128,8 +129,10 @@ PHP_METHOD(Test_Requires, renderTemplate) { ZVAL_UNDEF(&_0); ZVAL_UNDEF(&key); ZVAL_UNDEF(&value); - ZVAL_UNDEF(&_5); - ZVAL_UNDEF(&_4$$4); + ZVAL_UNDEF(&_7); + ZVAL_UNDEF(&_2$$3); + ZVAL_UNDEF(&_5$$4); + ZVAL_UNDEF(&_6$$5); ZEPHIR_MM_GROW(); zephir_fetch_params(1, 2, 0, &templatePath_param, ¶ms); @@ -151,29 +154,51 @@ PHP_METHOD(Test_Requires, renderTemplate) { if (Z_TYPE_P(params) == IS_ARRAY) { zephir_is_iterable(params, 0, "test/requires.zep", 47); - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(params), _2$$3, _3$$3, _1$$3) - { - ZEPHIR_INIT_NVAR(&key); - if (_3$$3 != NULL) { - ZVAL_STR_COPY(&key, _3$$3); - } else { - ZVAL_LONG(&key, _2$$3); - } - ZEPHIR_INIT_NVAR(&value); - ZVAL_COPY(&value, _1$$3); - ZEPHIR_CPY_WRT(&_4$$4, &value); - if (zephir_set_symbol(&key, &_4$$4 TSRMLS_CC) == FAILURE) { - return; + if (Z_TYPE_P(params) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(params), _3$$3, _4$$3, _1$$3) + { + ZEPHIR_INIT_NVAR(&key); + if (_4$$3 != NULL) { + ZVAL_STR_COPY(&key, _4$$3); + } else { + ZVAL_LONG(&key, _3$$3); + } + ZEPHIR_INIT_NVAR(&value); + ZVAL_COPY(&value, _1$$3); + ZEPHIR_CPY_WRT(&_5$$4, &value); + if (zephir_set_symbol(&key, &_5$$4 TSRMLS_CC) == FAILURE) { + return; + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, params, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_2$$3, params, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_2$$3)) { + break; + } + ZEPHIR_CALL_METHOD(&key, params, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&value, params, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&_6$$5, &value); + if (zephir_set_symbol(&key, &_6$$5 TSRMLS_CC) == FAILURE) { + return; + } + ZEPHIR_CALL_METHOD(NULL, params, "next", NULL, 0); + zephir_check_call_status(); } - } ZEND_HASH_FOREACH_END(); + } ZEPHIR_INIT_NVAR(&value); ZEPHIR_INIT_NVAR(&key); } - ZEPHIR_OBSERVE_OR_NULLIFY_PPZV(&_5); - if (zephir_require_zval_ret(&_5, &templatePath TSRMLS_CC) == FAILURE) { + ZEPHIR_OBSERVE_OR_NULLIFY_PPZV(&_7); + if (zephir_require_zval_ret(&_7, &templatePath TSRMLS_CC) == FAILURE) { RETURN_MM_NULL(); } - RETURN_CCTOR(&_5); + RETURN_CCTOR(&_7); } diff --git a/ext/test/requires/external3.zep.c b/ext/test/requires/external3.zep.c index b90ee6bd5b..c5edf6dac6 100644 --- a/ext/test/requires/external3.zep.c +++ b/ext/test/requires/external3.zep.c @@ -45,12 +45,12 @@ PHP_METHOD(Test_Requires_External3, req) { - ZEPHIR_CALL_FUNCTION(NULL, "ob_clean", NULL, 59); + ZEPHIR_CALL_FUNCTION(NULL, "ob_clean", NULL, 61); zephir_check_call_status(); if (zephir_require_zval(path TSRMLS_CC) == FAILURE) { RETURN_MM_NULL(); } - ZEPHIR_CALL_FUNCTION(&_0, "ob_get_contents", NULL, 60); + ZEPHIR_CALL_FUNCTION(&_0, "ob_get_contents", NULL, 62); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, requires, "setcontent", NULL, 0, &_0); zephir_check_call_status(); diff --git a/ext/test/resourcetest.zep.c b/ext/test/resourcetest.zep.c index b38f7237d9..e9f2e69283 100644 --- a/ext/test/resourcetest.zep.c +++ b/ext/test/resourcetest.zep.c @@ -116,7 +116,7 @@ PHP_METHOD(Test_ResourceTest, testFunctionsForSTDIN) { ZEPHIR_INIT_VAR(&a); ZEPHIR_GET_CONSTANT(&a, "STDIN"); ZVAL_LONG(&_0, 1); - ZEPHIR_CALL_FUNCTION(NULL, "stream_set_blocking", NULL, 61, &a, &_0); + ZEPHIR_CALL_FUNCTION(NULL, "stream_set_blocking", NULL, 63, &a, &_0); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); diff --git a/ext/test/router.zep.c b/ext/test/router.zep.c index 4e3f4275a4..3abf51121c 100644 --- a/ext/test/router.zep.c +++ b/ext/test/router.zep.c @@ -138,7 +138,7 @@ PHP_METHOD(Test_Router, __construct) { add_assoc_long_ex(&_1$$3, SL("controller"), 1); ZEPHIR_INIT_VAR(&_2$$3); ZVAL_STRING(&_2$$3, "#^/([a-zA-Z0-9\\_\\-]+)[/]{0,1}$#"); - ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", &_3, 62, &_2$$3, &_1$$3); + ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", &_3, 64, &_2$$3, &_1$$3); zephir_check_call_status(); zephir_array_append(&routes, &_0$$3, PH_SEPARATE, "test/router.zep", 89); ZEPHIR_INIT_NVAR(&_2$$3); @@ -150,7 +150,7 @@ PHP_METHOD(Test_Router, __construct) { add_assoc_long_ex(&_4$$3, SL("params"), 3); ZEPHIR_INIT_VAR(&_5$$3); ZVAL_STRING(&_5$$3, "#^/([a-zA-Z0-9\\_\\-]+)/([a-zA-Z0-9\\.\\_]+)(/.*)*$#"); - ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", &_3, 62, &_5$$3, &_4$$3); + ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", &_3, 64, &_5$$3, &_4$$3); zephir_check_call_status(); zephir_array_append(&routes, &_2$$3, PH_SEPARATE, "test/router.zep", 95); } @@ -463,10 +463,10 @@ PHP_METHOD(Test_Router, doRemoveExtraSlashes) { */ PHP_METHOD(Test_Router, handle) { - zend_string *_10$$28; - zend_ulong _9$$28; + zend_string *_12$$28, *_21$$62; + zend_ulong _11$$28, _20$$62; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *uri = NULL, uri_sub, __$true, __$false, __$null, realUri, request, currentHostName, routeFound, parts, params, matches, notFoundPaths, vnamespace, module, controller, action, paramsStr, strParams, paramsMerge, route, methods, dependencyInjector, hostname, regexHostName, matched, pattern, handledUri, beforeMatch, paths, converters, part, position, matchPosition, _0, _1, *_2, _3$$9, _4$$9, _5$$8, _6$$13, _7$$17, *_8$$28, _11$$42, _12$$45, _13$$48, _14$$51, _15$$52, _16$$56, _17$$56, _18$$56, _19$$56, _20$$56; + zval *uri = NULL, uri_sub, __$true, __$false, __$null, realUri, request, currentHostName, routeFound, parts, params, matches, notFoundPaths, vnamespace, module, controller, action, paramsStr, strParams, paramsMerge, route, methods, dependencyInjector, hostname, regexHostName, matched, pattern, handledUri, beforeMatch, paths, converters, part, position, matchPosition, _0, _1, *_2, _3, _4$$9, _5$$9, _6$$8, _7$$13, _8$$17, *_9$$28, _10$$28, _13$$43, _14$$43, _15$$42, _16$$47, _17$$51, *_18$$62, _19$$62, _22$$82, _23$$85, _24$$88, _25$$91, _26$$92, _27$$96, _28$$96, _29$$96, _30$$96, _31$$96; zval *this_ptr = getThis(); ZVAL_UNDEF(&uri_sub); @@ -504,21 +504,29 @@ PHP_METHOD(Test_Router, handle) { ZVAL_UNDEF(&matchPosition); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_3$$9); + ZVAL_UNDEF(&_3); ZVAL_UNDEF(&_4$$9); - ZVAL_UNDEF(&_5$$8); - ZVAL_UNDEF(&_6$$13); - ZVAL_UNDEF(&_7$$17); - ZVAL_UNDEF(&_11$$42); - ZVAL_UNDEF(&_12$$45); - ZVAL_UNDEF(&_13$$48); - ZVAL_UNDEF(&_14$$51); - ZVAL_UNDEF(&_15$$52); - ZVAL_UNDEF(&_16$$56); - ZVAL_UNDEF(&_17$$56); - ZVAL_UNDEF(&_18$$56); - ZVAL_UNDEF(&_19$$56); - ZVAL_UNDEF(&_20$$56); + ZVAL_UNDEF(&_5$$9); + ZVAL_UNDEF(&_6$$8); + ZVAL_UNDEF(&_7$$13); + ZVAL_UNDEF(&_8$$17); + ZVAL_UNDEF(&_10$$28); + ZVAL_UNDEF(&_13$$43); + ZVAL_UNDEF(&_14$$43); + ZVAL_UNDEF(&_15$$42); + ZVAL_UNDEF(&_16$$47); + ZVAL_UNDEF(&_17$$51); + ZVAL_UNDEF(&_19$$62); + ZVAL_UNDEF(&_22$$82); + ZVAL_UNDEF(&_23$$85); + ZVAL_UNDEF(&_24$$88); + ZVAL_UNDEF(&_25$$91); + ZVAL_UNDEF(&_26$$92); + ZVAL_UNDEF(&_27$$96); + ZVAL_UNDEF(&_28$$96); + ZVAL_UNDEF(&_29$$96); + ZVAL_UNDEF(&_30$$96); + ZVAL_UNDEF(&_31$$96); ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 1, &uri); @@ -562,131 +570,331 @@ PHP_METHOD(Test_Router, handle) { zephir_update_property_zval(this_ptr, SL("_matchedRoute"), &__$null); zephir_read_property(&_1, this_ptr, SL("_routes"), PH_NOISY_CC | PH_READONLY); zephir_is_iterable(&_1, 0, "test/router.zep", 474); - ZEND_HASH_REVERSE_FOREACH_VAL(Z_ARRVAL_P(&_1), _2) - { - ZEPHIR_INIT_NVAR(&route); - ZVAL_COPY(&route, _2); - ZEPHIR_CALL_METHOD(&methods, &route, "gethttpmethods", NULL, 0); - zephir_check_call_status(); - if (Z_TYPE_P(&methods) != IS_NULL) { - if (Z_TYPE_P(&request) == IS_NULL) { - zephir_read_property(&_3$$9, this_ptr, SL("_dependencyInjector"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&dependencyInjector, &_3$$9); - if (Z_TYPE_P(&dependencyInjector) != IS_OBJECT) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(test_router_exception_ce, "A dependency injection container is required to access the 'request' service", "test/router.zep", 342); - return; + if (Z_TYPE_P(&_1) == IS_ARRAY) { + ZEND_HASH_REVERSE_FOREACH_VAL(Z_ARRVAL_P(&_1), _2) + { + ZEPHIR_INIT_NVAR(&route); + ZVAL_COPY(&route, _2); + ZEPHIR_CALL_METHOD(&methods, &route, "gethttpmethods", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(&methods) != IS_NULL) { + if (Z_TYPE_P(&request) == IS_NULL) { + zephir_read_property(&_4$$9, this_ptr, SL("_dependencyInjector"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&dependencyInjector, &_4$$9); + if (Z_TYPE_P(&dependencyInjector) != IS_OBJECT) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(test_router_exception_ce, "A dependency injection container is required to access the 'request' service", "test/router.zep", 342); + return; + } + ZEPHIR_INIT_NVAR(&_5$$9); + ZVAL_STRING(&_5$$9, "request"); + ZEPHIR_CALL_METHOD(&request, &dependencyInjector, "getshared", NULL, 0, &_5$$9); + zephir_check_call_status(); } - ZEPHIR_INIT_NVAR(&_4$$9); - ZVAL_STRING(&_4$$9, "request"); - ZEPHIR_CALL_METHOD(&request, &dependencyInjector, "getshared", NULL, 0, &_4$$9); + ZEPHIR_CALL_METHOD(&_6$$8, &request, "ismethod", NULL, 0, &methods); zephir_check_call_status(); + if (ZEPHIR_IS_FALSE_IDENTICAL(&_6$$8)) { + continue; + } } - ZEPHIR_CALL_METHOD(&_5$$8, &request, "ismethod", NULL, 0, &methods); + ZEPHIR_CALL_METHOD(&hostname, &route, "gethostname", NULL, 0); zephir_check_call_status(); - if (ZEPHIR_IS_FALSE_IDENTICAL(&_5$$8)) { - continue; - } - } - ZEPHIR_CALL_METHOD(&hostname, &route, "gethostname", NULL, 0); - zephir_check_call_status(); - if (Z_TYPE_P(&hostname) != IS_NULL) { - if (Z_TYPE_P(&request) == IS_NULL) { - ZEPHIR_OBS_NVAR(&dependencyInjector); - zephir_read_property(&dependencyInjector, this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); - if (Z_TYPE_P(&dependencyInjector) != IS_OBJECT) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(test_router_exception_ce, "A dependency injection container is required to access the 'request' service", "test/router.zep", 363); - return; + if (Z_TYPE_P(&hostname) != IS_NULL) { + if (Z_TYPE_P(&request) == IS_NULL) { + ZEPHIR_OBS_NVAR(&dependencyInjector); + zephir_read_property(&dependencyInjector, this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); + if (Z_TYPE_P(&dependencyInjector) != IS_OBJECT) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(test_router_exception_ce, "A dependency injection container is required to access the 'request' service", "test/router.zep", 363); + return; + } + ZEPHIR_INIT_NVAR(&_7$$13); + ZVAL_STRING(&_7$$13, "request"); + ZEPHIR_CALL_METHOD(&request, &dependencyInjector, "getshared", NULL, 0, &_7$$13); + zephir_check_call_status(); } - ZEPHIR_INIT_NVAR(&_6$$13); - ZVAL_STRING(&_6$$13, "request"); - ZEPHIR_CALL_METHOD(&request, &dependencyInjector, "getshared", NULL, 0, &_6$$13); - zephir_check_call_status(); - } - if (Z_TYPE_P(¤tHostName) != IS_OBJECT) { - ZEPHIR_CALL_METHOD(¤tHostName, &request, "gethttphost", NULL, 0); - zephir_check_call_status(); - } - if (Z_TYPE_P(¤tHostName) != IS_NULL) { - continue; - } - if (zephir_memnstr_str(&hostname, SL("("), "test/router.zep", 380)) { - if (zephir_memnstr_str(&hostname, SL("#"), "test/router.zep", 381)) { - ZEPHIR_INIT_NVAR(®exHostName); - ZEPHIR_CONCAT_SVS(®exHostName, "#^", &hostname, "$#"); + if (Z_TYPE_P(¤tHostName) != IS_OBJECT) { + ZEPHIR_CALL_METHOD(¤tHostName, &request, "gethttphost", NULL, 0); + zephir_check_call_status(); + } + if (Z_TYPE_P(¤tHostName) != IS_NULL) { + continue; + } + if (zephir_memnstr_str(&hostname, SL("("), "test/router.zep", 380)) { + if (zephir_memnstr_str(&hostname, SL("#"), "test/router.zep", 381)) { + ZEPHIR_INIT_NVAR(®exHostName); + ZEPHIR_CONCAT_SVS(®exHostName, "#^", &hostname, "$#"); + } else { + ZEPHIR_CPY_WRT(®exHostName, &hostname); + } + ZEPHIR_INIT_NVAR(&_8$$17); + ZEPHIR_INIT_NVAR(&matched); + zephir_preg_match(&matched, ®exHostName, ¤tHostName, &_8$$17, 0, 0 , 0 TSRMLS_CC); } else { - ZEPHIR_CPY_WRT(®exHostName, &hostname); + ZEPHIR_INIT_NVAR(&matched); + ZVAL_BOOL(&matched, ZEPHIR_IS_EQUAL(¤tHostName, &hostname)); } - ZEPHIR_INIT_NVAR(&_7$$17); - ZEPHIR_INIT_NVAR(&matched); - zephir_preg_match(&matched, ®exHostName, ¤tHostName, &_7$$17, 0, 0 , 0 TSRMLS_CC); + if (!(zephir_is_true(&matched))) { + continue; + } + } + ZEPHIR_CALL_METHOD(&pattern, &route, "getcompiledpattern", NULL, 0); + zephir_check_call_status(); + if (zephir_memnstr_str(&pattern, SL("^"), "test/router.zep", 399)) { + ZEPHIR_INIT_NVAR(&routeFound); + zephir_preg_match(&routeFound, &pattern, &handledUri, &matches, 0, 0 , 0 TSRMLS_CC); } else { - ZEPHIR_INIT_NVAR(&matched); - ZVAL_BOOL(&matched, ZEPHIR_IS_EQUAL(¤tHostName, &hostname)); + ZEPHIR_INIT_NVAR(&routeFound); + ZVAL_BOOL(&routeFound, ZEPHIR_IS_EQUAL(&pattern, &handledUri)); } - if (!(zephir_is_true(&matched))) { - continue; + if (zephir_is_true(&routeFound)) { + ZEPHIR_CALL_METHOD(&beforeMatch, &route, "getbeforematch", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(&beforeMatch) != IS_NULL) { + if (zephir_is_callable(&beforeMatch TSRMLS_CC)) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(test_router_exception_ce, "Before-Match callback is not callable in matched route", "test/router.zep", 413); + return; + } + } } - } - ZEPHIR_CALL_METHOD(&pattern, &route, "getcompiledpattern", NULL, 0); + if (zephir_is_true(&routeFound)) { + ZEPHIR_CALL_METHOD(&paths, &route, "getpaths", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&parts, &paths); + if (Z_TYPE_P(&matches) == IS_ARRAY) { + ZEPHIR_CALL_METHOD(&converters, &route, "getconverters", NULL, 0); + zephir_check_call_status(); + zephir_is_iterable(&paths, 0, "test/router.zep", 465); + if (Z_TYPE_P(&paths) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&paths), _11$$28, _12$$28, _9$$28) + { + ZEPHIR_INIT_NVAR(&part); + if (_12$$28 != NULL) { + ZVAL_STR_COPY(&part, _12$$28); + } else { + ZVAL_LONG(&part, _11$$28); + } + ZEPHIR_INIT_NVAR(&position); + ZVAL_COPY(&position, _9$$28); + ZEPHIR_OBS_NVAR(&matchPosition); + if (zephir_array_isset_fetch(&matchPosition, &matches, &position, 0 TSRMLS_CC)) { + if (Z_TYPE_P(&converters) == IS_ARRAY) { + if (zephir_array_isset(&converters, &part)) { + continue; + } + } + zephir_array_update_zval(&parts, &part, &matchPosition, PH_COPY | PH_SEPARATE); + } else { + if (Z_TYPE_P(&converters) == IS_ARRAY) { + if (zephir_array_isset(&converters, &part)) { + } + } + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &paths, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_10$$28, &paths, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_10$$28)) { + break; + } + ZEPHIR_CALL_METHOD(&part, &paths, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&position, &paths, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_OBS_NVAR(&matchPosition); + if (zephir_array_isset_fetch(&matchPosition, &matches, &position, 0 TSRMLS_CC)) { + if (Z_TYPE_P(&converters) == IS_ARRAY) { + if (zephir_array_isset(&converters, &part)) { + continue; + } + } + zephir_array_update_zval(&parts, &part, &matchPosition, PH_COPY | PH_SEPARATE); + } else { + if (Z_TYPE_P(&converters) == IS_ARRAY) { + if (zephir_array_isset(&converters, &part)) { + } + } + } + ZEPHIR_CALL_METHOD(NULL, &paths, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&position); + ZEPHIR_INIT_NVAR(&part); + zephir_update_property_zval(this_ptr, SL("_matches"), &matches); + } + zephir_update_property_zval(this_ptr, SL("_matchedRoute"), &route); + break; + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &_1, "rewind", NULL, 0); zephir_check_call_status(); - if (zephir_memnstr_str(&pattern, SL("^"), "test/router.zep", 399)) { - ZEPHIR_INIT_NVAR(&routeFound); - zephir_preg_match(&routeFound, &pattern, &handledUri, &matches, 0, 0 , 0 TSRMLS_CC); - } else { - ZEPHIR_INIT_NVAR(&routeFound); - ZVAL_BOOL(&routeFound, ZEPHIR_IS_EQUAL(&pattern, &handledUri)); - } - if (zephir_is_true(&routeFound)) { - ZEPHIR_CALL_METHOD(&beforeMatch, &route, "getbeforematch", NULL, 0); + while (1) { + ZEPHIR_CALL_METHOD(&_3, &_1, "valid", NULL, 0); zephir_check_call_status(); - if (Z_TYPE_P(&beforeMatch) != IS_NULL) { - if (zephir_is_callable(&beforeMatch TSRMLS_CC)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(test_router_exception_ce, "Before-Match callback is not callable in matched route", "test/router.zep", 413); - return; - } + if (!zend_is_true(&_3)) { + break; } - } - if (zephir_is_true(&routeFound)) { - ZEPHIR_CALL_METHOD(&paths, &route, "getpaths", NULL, 0); + ZEPHIR_CALL_METHOD(&route, &_1, "current", NULL, 0); zephir_check_call_status(); - ZEPHIR_CPY_WRT(&parts, &paths); - if (Z_TYPE_P(&matches) == IS_ARRAY) { - ZEPHIR_CALL_METHOD(&converters, &route, "getconverters", NULL, 0); + ZEPHIR_CALL_METHOD(&methods, &route, "gethttpmethods", NULL, 0); zephir_check_call_status(); - zephir_is_iterable(&paths, 0, "test/router.zep", 465); - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&paths), _9$$28, _10$$28, _8$$28) - { - ZEPHIR_INIT_NVAR(&part); - if (_10$$28 != NULL) { - ZVAL_STR_COPY(&part, _10$$28); - } else { - ZVAL_LONG(&part, _9$$28); + if (Z_TYPE_P(&methods) != IS_NULL) { + if (Z_TYPE_P(&request) == IS_NULL) { + zephir_read_property(&_13$$43, this_ptr, SL("_dependencyInjector"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&dependencyInjector, &_13$$43); + if (Z_TYPE_P(&dependencyInjector) != IS_OBJECT) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(test_router_exception_ce, "A dependency injection container is required to access the 'request' service", "test/router.zep", 342); + return; + } + ZEPHIR_INIT_NVAR(&_14$$43); + ZVAL_STRING(&_14$$43, "request"); + ZEPHIR_CALL_METHOD(&request, &dependencyInjector, "getshared", NULL, 0, &_14$$43); + zephir_check_call_status(); } - ZEPHIR_INIT_NVAR(&position); - ZVAL_COPY(&position, _8$$28); - ZEPHIR_OBS_NVAR(&matchPosition); - if (zephir_array_isset_fetch(&matchPosition, &matches, &position, 0 TSRMLS_CC)) { - if (Z_TYPE_P(&converters) == IS_ARRAY) { - if (zephir_array_isset(&converters, &part)) { - continue; - } + ZEPHIR_CALL_METHOD(&_15$$42, &request, "ismethod", NULL, 0, &methods); + zephir_check_call_status(); + if (ZEPHIR_IS_FALSE_IDENTICAL(&_15$$42)) { + continue; + } + } + ZEPHIR_CALL_METHOD(&hostname, &route, "gethostname", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(&hostname) != IS_NULL) { + if (Z_TYPE_P(&request) == IS_NULL) { + ZEPHIR_OBS_NVAR(&dependencyInjector); + zephir_read_property(&dependencyInjector, this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); + if (Z_TYPE_P(&dependencyInjector) != IS_OBJECT) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(test_router_exception_ce, "A dependency injection container is required to access the 'request' service", "test/router.zep", 363); + return; } - zephir_array_update_zval(&parts, &part, &matchPosition, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(&_16$$47); + ZVAL_STRING(&_16$$47, "request"); + ZEPHIR_CALL_METHOD(&request, &dependencyInjector, "getshared", NULL, 0, &_16$$47); + zephir_check_call_status(); + } + if (Z_TYPE_P(¤tHostName) != IS_OBJECT) { + ZEPHIR_CALL_METHOD(¤tHostName, &request, "gethttphost", NULL, 0); + zephir_check_call_status(); + } + if (Z_TYPE_P(¤tHostName) != IS_NULL) { + continue; + } + if (zephir_memnstr_str(&hostname, SL("("), "test/router.zep", 380)) { + if (zephir_memnstr_str(&hostname, SL("#"), "test/router.zep", 381)) { + ZEPHIR_INIT_NVAR(®exHostName); + ZEPHIR_CONCAT_SVS(®exHostName, "#^", &hostname, "$#"); + } else { + ZEPHIR_CPY_WRT(®exHostName, &hostname); + } + ZEPHIR_INIT_NVAR(&_17$$51); + ZEPHIR_INIT_NVAR(&matched); + zephir_preg_match(&matched, ®exHostName, ¤tHostName, &_17$$51, 0, 0 , 0 TSRMLS_CC); } else { - if (Z_TYPE_P(&converters) == IS_ARRAY) { - if (zephir_array_isset(&converters, &part)) { + ZEPHIR_INIT_NVAR(&matched); + ZVAL_BOOL(&matched, ZEPHIR_IS_EQUAL(¤tHostName, &hostname)); + } + if (!(zephir_is_true(&matched))) { + continue; + } + } + ZEPHIR_CALL_METHOD(&pattern, &route, "getcompiledpattern", NULL, 0); + zephir_check_call_status(); + if (zephir_memnstr_str(&pattern, SL("^"), "test/router.zep", 399)) { + ZEPHIR_INIT_NVAR(&routeFound); + zephir_preg_match(&routeFound, &pattern, &handledUri, &matches, 0, 0 , 0 TSRMLS_CC); + } else { + ZEPHIR_INIT_NVAR(&routeFound); + ZVAL_BOOL(&routeFound, ZEPHIR_IS_EQUAL(&pattern, &handledUri)); + } + if (zephir_is_true(&routeFound)) { + ZEPHIR_CALL_METHOD(&beforeMatch, &route, "getbeforematch", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(&beforeMatch) != IS_NULL) { + if (zephir_is_callable(&beforeMatch TSRMLS_CC)) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(test_router_exception_ce, "Before-Match callback is not callable in matched route", "test/router.zep", 413); + return; + } + } + } + if (zephir_is_true(&routeFound)) { + ZEPHIR_CALL_METHOD(&paths, &route, "getpaths", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&parts, &paths); + if (Z_TYPE_P(&matches) == IS_ARRAY) { + ZEPHIR_CALL_METHOD(&converters, &route, "getconverters", NULL, 0); + zephir_check_call_status(); + zephir_is_iterable(&paths, 0, "test/router.zep", 465); + if (Z_TYPE_P(&paths) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&paths), _20$$62, _21$$62, _18$$62) + { + ZEPHIR_INIT_NVAR(&part); + if (_21$$62 != NULL) { + ZVAL_STR_COPY(&part, _21$$62); + } else { + ZVAL_LONG(&part, _20$$62); + } + ZEPHIR_INIT_NVAR(&position); + ZVAL_COPY(&position, _18$$62); + ZEPHIR_OBS_NVAR(&matchPosition); + if (zephir_array_isset_fetch(&matchPosition, &matches, &position, 0 TSRMLS_CC)) { + if (Z_TYPE_P(&converters) == IS_ARRAY) { + if (zephir_array_isset(&converters, &part)) { + continue; + } + } + zephir_array_update_zval(&parts, &part, &matchPosition, PH_COPY | PH_SEPARATE); + } else { + if (Z_TYPE_P(&converters) == IS_ARRAY) { + if (zephir_array_isset(&converters, &part)) { + } + } + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &paths, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_19$$62, &paths, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_19$$62)) { + break; + } + ZEPHIR_CALL_METHOD(&part, &paths, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&position, &paths, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_OBS_NVAR(&matchPosition); + if (zephir_array_isset_fetch(&matchPosition, &matches, &position, 0 TSRMLS_CC)) { + if (Z_TYPE_P(&converters) == IS_ARRAY) { + if (zephir_array_isset(&converters, &part)) { + continue; + } + } + zephir_array_update_zval(&parts, &part, &matchPosition, PH_COPY | PH_SEPARATE); + } else { + if (Z_TYPE_P(&converters) == IS_ARRAY) { + if (zephir_array_isset(&converters, &part)) { + } + } + } + ZEPHIR_CALL_METHOD(NULL, &paths, "next", NULL, 0); + zephir_check_call_status(); } } + ZEPHIR_INIT_NVAR(&position); + ZEPHIR_INIT_NVAR(&part); + zephir_update_property_zval(this_ptr, SL("_matches"), &matches); } - } ZEND_HASH_FOREACH_END(); - ZEPHIR_INIT_NVAR(&position); - ZEPHIR_INIT_NVAR(&part); - zephir_update_property_zval(this_ptr, SL("_matches"), &matches); - } - zephir_update_property_zval(this_ptr, SL("_matchedRoute"), &route); - break; + zephir_update_property_zval(this_ptr, SL("_matchedRoute"), &route); + break; + } + ZEPHIR_CALL_METHOD(NULL, &_1, "next", NULL, 0); + zephir_check_call_status(); } - } ZEND_HASH_FOREACH_END(); + } ZEPHIR_INIT_NVAR(&route); if (zephir_is_true(&routeFound)) { if (1) { @@ -718,8 +926,8 @@ PHP_METHOD(Test_Router, handle) { } zephir_array_unset_string(&parts, SL("namespace"), PH_SEPARATE); } else { - zephir_read_property(&_11$$42, this_ptr, SL("_defaultNamespace"), PH_NOISY_CC | PH_READONLY); - zephir_update_property_zval(this_ptr, SL("_namespace"), &_11$$42); + zephir_read_property(&_22$$82, this_ptr, SL("_defaultNamespace"), PH_NOISY_CC | PH_READONLY); + zephir_update_property_zval(this_ptr, SL("_namespace"), &_22$$82); } ZEPHIR_OBS_VAR(&module); if (zephir_array_isset_string_fetch(&module, &parts, SL("module"), 0)) { @@ -728,8 +936,8 @@ PHP_METHOD(Test_Router, handle) { } zephir_array_unset_string(&parts, SL("module"), PH_SEPARATE); } else { - zephir_read_property(&_12$$45, this_ptr, SL("_defaultModule"), PH_NOISY_CC | PH_READONLY); - zephir_update_property_zval(this_ptr, SL("_module"), &_12$$45); + zephir_read_property(&_23$$85, this_ptr, SL("_defaultModule"), PH_NOISY_CC | PH_READONLY); + zephir_update_property_zval(this_ptr, SL("_module"), &_23$$85); } ZEPHIR_OBS_VAR(&controller); if (zephir_array_isset_string_fetch(&controller, &parts, SL("controller"), 0)) { @@ -738,8 +946,8 @@ PHP_METHOD(Test_Router, handle) { } zephir_array_unset_string(&parts, SL("controller"), PH_SEPARATE); } else { - zephir_read_property(&_13$$48, this_ptr, SL("_defaultController"), PH_NOISY_CC | PH_READONLY); - zephir_update_property_zval(this_ptr, SL("_controller"), &_13$$48); + zephir_read_property(&_24$$88, this_ptr, SL("_defaultController"), PH_NOISY_CC | PH_READONLY); + zephir_update_property_zval(this_ptr, SL("_controller"), &_24$$88); } ZEPHIR_OBS_VAR(&action); if (zephir_array_isset_string_fetch(&action, &parts, SL("action"), 0)) { @@ -748,12 +956,12 @@ PHP_METHOD(Test_Router, handle) { } zephir_array_unset_string(&parts, SL("action"), PH_SEPARATE); } else { - zephir_read_property(&_14$$51, this_ptr, SL("_defaultAction"), PH_NOISY_CC | PH_READONLY); - zephir_update_property_zval(this_ptr, SL("_action"), &_14$$51); + zephir_read_property(&_25$$91, this_ptr, SL("_defaultAction"), PH_NOISY_CC | PH_READONLY); + zephir_update_property_zval(this_ptr, SL("_action"), &_25$$91); } ZEPHIR_OBS_VAR(¶msStr); if (zephir_array_isset_string_fetch(¶msStr, &parts, SL("params"), 0)) { - ZVAL_LONG(&_15$$52, 1); + ZVAL_LONG(&_26$$92, 1); ZEPHIR_INIT_VAR(&strParams); zephir_substr(&strParams, ¶msStr, 1 , 0, ZEPHIR_SUBSTR_NO_LENGTH); if (zephir_is_true(&strParams)) { @@ -770,16 +978,16 @@ PHP_METHOD(Test_Router, handle) { } zephir_update_property_zval(this_ptr, SL("_params"), ¶msMerge); } else { - zephir_read_property(&_16$$56, this_ptr, SL("_defaultNamespace"), PH_NOISY_CC | PH_READONLY); - zephir_update_property_zval(this_ptr, SL("_namespace"), &_16$$56); - zephir_read_property(&_17$$56, this_ptr, SL("_defaultModule"), PH_NOISY_CC | PH_READONLY); - zephir_update_property_zval(this_ptr, SL("_module"), &_17$$56); - zephir_read_property(&_18$$56, this_ptr, SL("_defaultController"), PH_NOISY_CC | PH_READONLY); - zephir_update_property_zval(this_ptr, SL("_controller"), &_18$$56); - zephir_read_property(&_19$$56, this_ptr, SL("_defaultAction"), PH_NOISY_CC | PH_READONLY); - zephir_update_property_zval(this_ptr, SL("_action"), &_19$$56); - zephir_read_property(&_20$$56, this_ptr, SL("_defaultParams"), PH_NOISY_CC | PH_READONLY); - zephir_update_property_zval(this_ptr, SL("_params"), &_20$$56); + zephir_read_property(&_27$$96, this_ptr, SL("_defaultNamespace"), PH_NOISY_CC | PH_READONLY); + zephir_update_property_zval(this_ptr, SL("_namespace"), &_27$$96); + zephir_read_property(&_28$$96, this_ptr, SL("_defaultModule"), PH_NOISY_CC | PH_READONLY); + zephir_update_property_zval(this_ptr, SL("_module"), &_28$$96); + zephir_read_property(&_29$$96, this_ptr, SL("_defaultController"), PH_NOISY_CC | PH_READONLY); + zephir_update_property_zval(this_ptr, SL("_controller"), &_29$$96); + zephir_read_property(&_30$$96, this_ptr, SL("_defaultAction"), PH_NOISY_CC | PH_READONLY); + zephir_update_property_zval(this_ptr, SL("_action"), &_30$$96); + zephir_read_property(&_31$$96, this_ptr, SL("_defaultParams"), PH_NOISY_CC | PH_READONLY); + zephir_update_property_zval(this_ptr, SL("_params"), &_31$$96); } ZEPHIR_MM_RESTORE(); @@ -824,9 +1032,9 @@ PHP_METHOD(Test_Router, add) { ZEPHIR_INIT_VAR(&route); object_init_ex(&route, test_router_route_ce); - ZEPHIR_CALL_METHOD(NULL, &route, "__construct", NULL, 62, pattern, paths, httpMethods); + ZEPHIR_CALL_METHOD(NULL, &route, "__construct", NULL, 64, pattern, paths, httpMethods); zephir_check_call_status(); - zephir_update_property_array_append(this_ptr, SL("_routes"), &route TSRMLS_CC); + zephir_update_property_array_append(this_ptr, SL("_routes"), &route); RETURN_CCTOR(&route); } @@ -1085,7 +1293,7 @@ PHP_METHOD(Test_Router, addHead) { PHP_METHOD(Test_Router, mount) { zend_long ZEPHIR_LAST_CALL_STATUS; - zval *group, group_sub, groupRoutes, beforeMatch, hostname, routes, route, *_0$$5, *_1$$7, _2$$9; + zval *group, group_sub, groupRoutes, beforeMatch, hostname, routes, route, *_0$$5, _1$$5, *_2$$8, _3$$8, _4$$11; zval *this_ptr = getThis(); ZVAL_UNDEF(&group_sub); @@ -1094,7 +1302,9 @@ PHP_METHOD(Test_Router, mount) { ZVAL_UNDEF(&hostname); ZVAL_UNDEF(&routes); ZVAL_UNDEF(&route); - ZVAL_UNDEF(&_2$$9); + ZVAL_UNDEF(&_1$$5); + ZVAL_UNDEF(&_3$$8); + ZVAL_UNDEF(&_4$$11); ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &group); @@ -1115,34 +1325,70 @@ PHP_METHOD(Test_Router, mount) { zephir_check_call_status(); if (Z_TYPE_P(&beforeMatch) != IS_NULL) { zephir_is_iterable(&groupRoutes, 0, "test/router.zep", 692); - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&groupRoutes), _0$$5) - { - ZEPHIR_INIT_NVAR(&route); - ZVAL_COPY(&route, _0$$5); - ZEPHIR_CALL_METHOD(NULL, &route, "beforematch", NULL, 0, &beforeMatch); + if (Z_TYPE_P(&groupRoutes) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&groupRoutes), _0$$5) + { + ZEPHIR_INIT_NVAR(&route); + ZVAL_COPY(&route, _0$$5); + ZEPHIR_CALL_METHOD(NULL, &route, "beforematch", NULL, 0, &beforeMatch); + zephir_check_call_status(); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &groupRoutes, "rewind", NULL, 0); zephir_check_call_status(); - } ZEND_HASH_FOREACH_END(); + while (1) { + ZEPHIR_CALL_METHOD(&_1$$5, &groupRoutes, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_1$$5)) { + break; + } + ZEPHIR_CALL_METHOD(&route, &groupRoutes, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &route, "beforematch", NULL, 0, &beforeMatch); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &groupRoutes, "next", NULL, 0); + zephir_check_call_status(); + } + } ZEPHIR_INIT_NVAR(&route); } ZEPHIR_CALL_METHOD(&hostname, group, "gethostname", NULL, 0); zephir_check_call_status(); if (Z_TYPE_P(&hostname) != IS_NULL) { zephir_is_iterable(&groupRoutes, 0, "test/router.zep", 701); - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&groupRoutes), _1$$7) - { - ZEPHIR_INIT_NVAR(&route); - ZVAL_COPY(&route, _1$$7); - ZEPHIR_CALL_METHOD(NULL, &route, "sethostname", NULL, 0, &hostname); + if (Z_TYPE_P(&groupRoutes) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&groupRoutes), _2$$8) + { + ZEPHIR_INIT_NVAR(&route); + ZVAL_COPY(&route, _2$$8); + ZEPHIR_CALL_METHOD(NULL, &route, "sethostname", NULL, 0, &hostname); + zephir_check_call_status(); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &groupRoutes, "rewind", NULL, 0); zephir_check_call_status(); - } ZEND_HASH_FOREACH_END(); + while (1) { + ZEPHIR_CALL_METHOD(&_3$$8, &groupRoutes, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_3$$8)) { + break; + } + ZEPHIR_CALL_METHOD(&route, &groupRoutes, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &route, "sethostname", NULL, 0, &hostname); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &groupRoutes, "next", NULL, 0); + zephir_check_call_status(); + } + } ZEPHIR_INIT_NVAR(&route); } ZEPHIR_OBS_VAR(&routes); zephir_read_property(&routes, this_ptr, SL("_routes"), PH_NOISY_CC); if (Z_TYPE_P(&routes) == IS_ARRAY) { - ZEPHIR_INIT_VAR(&_2$$9); - zephir_fast_array_merge(&_2$$9, &routes, &groupRoutes TSRMLS_CC); - zephir_update_property_zval(this_ptr, SL("_routes"), &_2$$9); + ZEPHIR_INIT_VAR(&_4$$11); + zephir_fast_array_merge(&_4$$11, &routes, &groupRoutes TSRMLS_CC); + zephir_update_property_zval(this_ptr, SL("_routes"), &_4$$11); } else { zephir_update_property_zval(this_ptr, SL("_routes"), &groupRoutes); } @@ -1332,13 +1578,15 @@ PHP_METHOD(Test_Router, getRoutes) { PHP_METHOD(Test_Router, getRouteById) { zend_long ZEPHIR_LAST_CALL_STATUS; - zval *id, id_sub, route, _0, *_1, _2$$3; + zval *id, id_sub, route, _0, *_1, _2, _3$$3, _4$$5; zval *this_ptr = getThis(); ZVAL_UNDEF(&id_sub); ZVAL_UNDEF(&route); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_2$$3); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3$$3); + ZVAL_UNDEF(&_4$$5); ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &id); @@ -1347,16 +1595,37 @@ PHP_METHOD(Test_Router, getRouteById) { zephir_read_property(&_0, this_ptr, SL("_routes"), PH_NOISY_CC | PH_READONLY); zephir_is_iterable(&_0, 0, "test/router.zep", 844); - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&_0), _1) - { - ZEPHIR_INIT_NVAR(&route); - ZVAL_COPY(&route, _1); - ZEPHIR_CALL_METHOD(&_2$$3, &route, "getrouteid", NULL, 0); + if (Z_TYPE_P(&_0) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&_0), _1) + { + ZEPHIR_INIT_NVAR(&route); + ZVAL_COPY(&route, _1); + ZEPHIR_CALL_METHOD(&_3$$3, &route, "getrouteid", NULL, 0); + zephir_check_call_status(); + if (ZEPHIR_IS_EQUAL(&_3$$3, id)) { + RETURN_CCTOR(&route); + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &_0, "rewind", NULL, 0); zephir_check_call_status(); - if (ZEPHIR_IS_EQUAL(&_2$$3, id)) { - RETURN_CCTOR(&route); + while (1) { + ZEPHIR_CALL_METHOD(&_2, &_0, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_2)) { + break; + } + ZEPHIR_CALL_METHOD(&route, &_0, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_4$$5, &route, "getrouteid", NULL, 0); + zephir_check_call_status(); + if (ZEPHIR_IS_EQUAL(&_4$$5, id)) { + RETURN_CCTOR(&route); + } + ZEPHIR_CALL_METHOD(NULL, &_0, "next", NULL, 0); + zephir_check_call_status(); } - } ZEND_HASH_FOREACH_END(); + } ZEPHIR_INIT_NVAR(&route); RETURN_MM_BOOL(0); @@ -1371,13 +1640,15 @@ PHP_METHOD(Test_Router, getRouteById) { PHP_METHOD(Test_Router, getRouteByName) { zend_long ZEPHIR_LAST_CALL_STATUS; - zval *name, name_sub, route, _0, *_1, _2$$3; + zval *name, name_sub, route, _0, *_1, _2, _3$$3, _4$$5; zval *this_ptr = getThis(); ZVAL_UNDEF(&name_sub); ZVAL_UNDEF(&route); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_2$$3); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3$$3); + ZVAL_UNDEF(&_4$$5); ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &name); @@ -1386,16 +1657,37 @@ PHP_METHOD(Test_Router, getRouteByName) { zephir_read_property(&_0, this_ptr, SL("_routes"), PH_NOISY_CC | PH_READONLY); zephir_is_iterable(&_0, 0, "test/router.zep", 862); - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&_0), _1) - { - ZEPHIR_INIT_NVAR(&route); - ZVAL_COPY(&route, _1); - ZEPHIR_CALL_METHOD(&_2$$3, &route, "getname", NULL, 0); + if (Z_TYPE_P(&_0) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&_0), _1) + { + ZEPHIR_INIT_NVAR(&route); + ZVAL_COPY(&route, _1); + ZEPHIR_CALL_METHOD(&_3$$3, &route, "getname", NULL, 0); + zephir_check_call_status(); + if (ZEPHIR_IS_EQUAL(&_3$$3, name)) { + RETURN_CCTOR(&route); + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &_0, "rewind", NULL, 0); zephir_check_call_status(); - if (ZEPHIR_IS_EQUAL(&_2$$3, name)) { - RETURN_CCTOR(&route); + while (1) { + ZEPHIR_CALL_METHOD(&_2, &_0, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_2)) { + break; + } + ZEPHIR_CALL_METHOD(&route, &_0, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_4$$5, &route, "getname", NULL, 0); + zephir_check_call_status(); + if (ZEPHIR_IS_EQUAL(&_4$$5, name)) { + RETURN_CCTOR(&route); + } + ZEPHIR_CALL_METHOD(NULL, &_0, "next", NULL, 0); + zephir_check_call_status(); } - } ZEND_HASH_FOREACH_END(); + } ZEPHIR_INIT_NVAR(&route); RETURN_MM_BOOL(0); diff --git a/ext/test/router/route.zep.c b/ext/test/router/route.zep.c index 2988217032..d2e5ef3d4d 100644 --- a/ext/test/router/route.zep.c +++ b/ext/test/router/route.zep.c @@ -731,15 +731,17 @@ PHP_METHOD(Test_Router_Route, getPaths) { */ PHP_METHOD(Test_Router_Route, getReversedPaths) { - zend_string *_3; - zend_ulong _2; - zval reversed, path, position, _0, *_1; + zend_string *_4; + zend_ulong _3; + zval reversed, path, position, _0, *_1, _2; + zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); ZVAL_UNDEF(&reversed); ZVAL_UNDEF(&path); ZVAL_UNDEF(&position); ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_2); ZEPHIR_MM_GROW(); @@ -747,18 +749,37 @@ PHP_METHOD(Test_Router_Route, getReversedPaths) { array_init(&reversed); zephir_read_property(&_0, this_ptr, SL("_paths"), PH_NOISY_CC | PH_READONLY); zephir_is_iterable(&_0, 0, "test/router/route.zep", 478); - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&_0), _2, _3, _1) - { - ZEPHIR_INIT_NVAR(&path); - if (_3 != NULL) { - ZVAL_STR_COPY(&path, _3); - } else { - ZVAL_LONG(&path, _2); + if (Z_TYPE_P(&_0) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&_0), _3, _4, _1) + { + ZEPHIR_INIT_NVAR(&path); + if (_4 != NULL) { + ZVAL_STR_COPY(&path, _4); + } else { + ZVAL_LONG(&path, _3); + } + ZEPHIR_INIT_NVAR(&position); + ZVAL_COPY(&position, _1); + zephir_array_update_zval(&reversed, &position, &path, PH_COPY | PH_SEPARATE); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &_0, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_2, &_0, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_2)) { + break; + } + ZEPHIR_CALL_METHOD(&path, &_0, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&position, &_0, "current", NULL, 0); + zephir_check_call_status(); + zephir_array_update_zval(&reversed, &position, &path, PH_COPY | PH_SEPARATE); + ZEPHIR_CALL_METHOD(NULL, &_0, "next", NULL, 0); + zephir_check_call_status(); } - ZEPHIR_INIT_NVAR(&position); - ZVAL_COPY(&position, _1); - zephir_array_update_zval(&reversed, &position, &path, PH_COPY | PH_SEPARATE); - } ZEND_HASH_FOREACH_END(); + } ZEPHIR_INIT_NVAR(&position); ZEPHIR_INIT_NVAR(&path); RETURN_CCTOR(&reversed); @@ -865,7 +886,7 @@ PHP_METHOD(Test_Router_Route, convert) { - zephir_update_property_array(this_ptr, SL("_converters"), name, converter TSRMLS_CC); + zephir_update_property_array(this_ptr, SL("_converters"), name, converter); RETURN_THISW(); } diff --git a/ext/test/scall.zep.c b/ext/test/scall.zep.c index 583e20b047..af2cc828b2 100644 --- a/ext/test/scall.zep.c +++ b/ext/test/scall.zep.c @@ -154,7 +154,7 @@ PHP_METHOD(Test_Scall, testCall3) { ZEPHIR_MM_GROW(); - ZEPHIR_RETURN_CALL_SELF("testmethod3", &_0, 63); + ZEPHIR_RETURN_CALL_SELF("testmethod3", &_0, 65); zephir_check_call_status(); RETURN_MM(); @@ -215,7 +215,7 @@ PHP_METHOD(Test_Scall, testCall6) { - ZEPHIR_RETURN_CALL_SELF("testmethod6", &_0, 64, a, b); + ZEPHIR_RETURN_CALL_SELF("testmethod6", &_0, 66, a, b); zephir_check_call_status(); RETURN_MM(); @@ -258,7 +258,7 @@ PHP_METHOD(Test_Scall, testCall9) { ZEPHIR_MM_GROW(); - ZEPHIR_RETURN_CALL_SELF("testmethod3", &_0, 63); + ZEPHIR_RETURN_CALL_SELF("testmethod3", &_0, 65); zephir_check_call_status(); RETURN_MM(); @@ -319,7 +319,7 @@ PHP_METHOD(Test_Scall, testCall12) { - ZEPHIR_RETURN_CALL_SELF("testmethod6", &_0, 64, a, b); + ZEPHIR_RETURN_CALL_SELF("testmethod6", &_0, 66, a, b); zephir_check_call_status(); RETURN_MM(); diff --git a/ext/test/scope.zep.c b/ext/test/scope.zep.c index 649cd5c950..7f732045f7 100644 --- a/ext/test/scope.zep.c +++ b/ext/test/scope.zep.c @@ -71,7 +71,7 @@ PHP_METHOD(Test_Scope, test1) { ZEPHIR_INIT_VAR(&ret); ZVAL_STRING(&ret, ""); - ZEPHIR_CALL_SELF(&k, "getstr", &_0, 65); + ZEPHIR_CALL_SELF(&k, "getstr", &_0, 67); zephir_check_call_status(); r = 1; if (r == 1) { @@ -165,7 +165,7 @@ PHP_METHOD(Test_Scope, test3) { } ZEPHIR_INIT_NVAR(&c); ZVAL_LONG(&c, _1); - ZEPHIR_CALL_SELF(&str$$3, "getdystr", &_3, 66, &c); + ZEPHIR_CALL_SELF(&str$$3, "getdystr", &_3, 68, &c); zephir_check_call_status(); zephir_concat_self(&k, &str$$3 TSRMLS_CC); } diff --git a/ext/test/sort.zep.c b/ext/test/sort.zep.c index f57a9a177a..785e3fd557 100644 --- a/ext/test/sort.zep.c +++ b/ext/test/sort.zep.c @@ -92,16 +92,16 @@ PHP_METHOD(Test_Sort, quick) { } } } - ZEPHIR_CALL_METHOD(&_7, this_ptr, "quick", &_8, 67, &left); + ZEPHIR_CALL_METHOD(&_7, this_ptr, "quick", &_8, 69, &left); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_9); zephir_create_array(&_9, 1, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(&_10); ZVAL_LONG(&_10, pivot); zephir_array_fast_append(&_9, &_10); - ZEPHIR_CALL_METHOD(&_11, this_ptr, "quick", &_8, 67, &right); + ZEPHIR_CALL_METHOD(&_11, this_ptr, "quick", &_8, 69, &right); zephir_check_call_status(); - ZEPHIR_RETURN_CALL_FUNCTION("array_merge", NULL, 68, &_7, &_9, &_11); + ZEPHIR_RETURN_CALL_FUNCTION("array_merge", NULL, 70, &_7, &_9, &_11); zephir_check_call_status(); RETURN_MM(); diff --git a/ext/test/spectralnorm.zep.c b/ext/test/spectralnorm.zep.c index 8204de450f..292b022757 100644 --- a/ext/test/spectralnorm.zep.c +++ b/ext/test/spectralnorm.zep.c @@ -110,7 +110,7 @@ PHP_METHOD(Test_SpectralNorm, Au) { j = _4$$3; ZVAL_LONG(&_7$$4, i); ZVAL_LONG(&_8$$4, j); - ZEPHIR_CALL_METHOD(&_6$$4, this_ptr, "ax", &_9, 69, &_7$$4, &_8$$4); + ZEPHIR_CALL_METHOD(&_6$$4, this_ptr, "ax", &_9, 71, &_7$$4, &_8$$4); zephir_check_call_status(); ZVAL_LONG(&_7$$4, j); ZEPHIR_CALL_METHOD(&_10$$4, u, "offsetget", &_11, 0, &_7$$4); @@ -185,7 +185,7 @@ PHP_METHOD(Test_SpectralNorm, Atu) { j = _4$$3; ZVAL_LONG(&_7$$4, j); ZVAL_LONG(&_8$$4, i); - ZEPHIR_CALL_METHOD(&_6$$4, this_ptr, "ax", &_9, 69, &_7$$4, &_8$$4); + ZEPHIR_CALL_METHOD(&_6$$4, this_ptr, "ax", &_9, 71, &_7$$4, &_8$$4); zephir_check_call_status(); ZVAL_LONG(&_7$$4, j); ZEPHIR_CALL_METHOD(&_10$$4, u, "offsetget", &_11, 0, &_7$$4); @@ -221,9 +221,9 @@ PHP_METHOD(Test_SpectralNorm, AtAu) { - ZEPHIR_CALL_METHOD(NULL, this_ptr, "au", NULL, 70, n, u, w); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "au", NULL, 72, n, u, w); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "atu", NULL, 71, n, w, v); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "atu", NULL, 73, n, w, v); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); @@ -261,17 +261,17 @@ PHP_METHOD(Test_SpectralNorm, process) { ZEPHIR_INIT_VAR(&u); object_init_ex(&u, spl_ce_SplFixedArray); ZVAL_LONG(&_0, n); - ZEPHIR_CALL_METHOD(NULL, &u, "__construct", NULL, 72, &_0); + ZEPHIR_CALL_METHOD(NULL, &u, "__construct", NULL, 74, &_0); zephir_check_call_status(); ZEPHIR_INIT_VAR(&v); object_init_ex(&v, spl_ce_SplFixedArray); ZVAL_LONG(&_0, n); - ZEPHIR_CALL_METHOD(NULL, &v, "__construct", NULL, 72, &_0); + ZEPHIR_CALL_METHOD(NULL, &v, "__construct", NULL, 74, &_0); zephir_check_call_status(); ZEPHIR_INIT_VAR(&w); object_init_ex(&w, spl_ce_SplFixedArray); ZVAL_LONG(&_0, n); - ZEPHIR_CALL_METHOD(NULL, &w, "__construct", NULL, 72, &_0); + ZEPHIR_CALL_METHOD(NULL, &w, "__construct", NULL, 74, &_0); zephir_check_call_status(); _3 = (n - 1); _2 = 0; @@ -289,15 +289,15 @@ PHP_METHOD(Test_SpectralNorm, process) { i = _2; ZVAL_LONG(&_4$$3, i); ZVAL_LONG(&_5$$3, 1); - ZEPHIR_CALL_METHOD(NULL, &u, "offsetset", &_6, 73, &_4$$3, &_5$$3); + ZEPHIR_CALL_METHOD(NULL, &u, "offsetset", &_6, 75, &_4$$3, &_5$$3); zephir_check_call_status(); ZVAL_LONG(&_4$$3, i); ZVAL_LONG(&_5$$3, 1); - ZEPHIR_CALL_METHOD(NULL, &v, "offsetset", &_6, 73, &_4$$3, &_5$$3); + ZEPHIR_CALL_METHOD(NULL, &v, "offsetset", &_6, 75, &_4$$3, &_5$$3); zephir_check_call_status(); ZVAL_LONG(&_4$$3, i); ZVAL_LONG(&_5$$3, 1); - ZEPHIR_CALL_METHOD(NULL, &w, "offsetset", &_6, 73, &_4$$3, &_5$$3); + ZEPHIR_CALL_METHOD(NULL, &w, "offsetset", &_6, 75, &_4$$3, &_5$$3); zephir_check_call_status(); } } @@ -316,10 +316,10 @@ PHP_METHOD(Test_SpectralNorm, process) { } i = _8; ZVAL_LONG(&_10$$4, n); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "atau", &_11, 74, &_10$$4, &u, &v, &w); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "atau", &_11, 76, &_10$$4, &u, &v, &w); zephir_check_call_status(); ZVAL_LONG(&_10$$4, n); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "atau", &_11, 74, &_10$$4, &v, &u, &w); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "atau", &_11, 76, &_10$$4, &v, &u, &w); zephir_check_call_status(); } } @@ -338,19 +338,19 @@ PHP_METHOD(Test_SpectralNorm, process) { } i = _13; ZVAL_LONG(&_16$$5, i); - ZEPHIR_CALL_METHOD(&_15$$5, &u, "offsetget", &_17, 75, &_16$$5); + ZEPHIR_CALL_METHOD(&_15$$5, &u, "offsetget", &_17, 77, &_16$$5); zephir_check_call_status(); ZVAL_LONG(&_16$$5, i); - ZEPHIR_CALL_METHOD(&_18$$5, &v, "offsetget", &_17, 75, &_16$$5); + ZEPHIR_CALL_METHOD(&_18$$5, &v, "offsetget", &_17, 77, &_16$$5); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_19$$5); mul_function(&_19$$5, &_15$$5, &_18$$5 TSRMLS_CC); vBv += zephir_get_numberval(&_19$$5); ZVAL_LONG(&_16$$5, i); - ZEPHIR_CALL_METHOD(&_15$$5, &v, "offsetget", &_17, 75, &_16$$5); + ZEPHIR_CALL_METHOD(&_15$$5, &v, "offsetget", &_17, 77, &_16$$5); zephir_check_call_status(); ZVAL_LONG(&_16$$5, i); - ZEPHIR_CALL_METHOD(&_18$$5, &v, "offsetget", &_17, 75, &_16$$5); + ZEPHIR_CALL_METHOD(&_18$$5, &v, "offsetget", &_17, 77, &_16$$5); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_20$$5); mul_function(&_20$$5, &_15$$5, &_18$$5 TSRMLS_CC); diff --git a/ext/test/statements.zep.c b/ext/test/statements.zep.c index 417282b1e2..2275eb9da9 100644 --- a/ext/test/statements.zep.c +++ b/ext/test/statements.zep.c @@ -200,25 +200,25 @@ PHP_METHOD(Test_Statements, test544Issue) { unfilledWidth = (((zephir_get_numberval(&_4$$3) - 1)) - filledWidth); zephir_read_property(&_5$$3, this_ptr, SL("filledChar"), PH_NOISY_CC | PH_READONLY); ZVAL_LONG(&_6$$3, filledWidth); - ZEPHIR_CALL_FUNCTION(&_7$$3, "str_repeat", &_8, 20, &_5$$3, &_6$$3); + ZEPHIR_CALL_FUNCTION(&_7$$3, "str_repeat", &_8, 21, &_5$$3, &_6$$3); zephir_check_call_status(); zephir_read_property(&_6$$3, this_ptr, SL("arrow"), PH_NOISY_CC | PH_READONLY); zephir_read_property(&_9$$3, this_ptr, SL("unfilledChar"), PH_NOISY_CC | PH_READONLY); ZVAL_LONG(&_10$$3, unfilledWidth); - ZEPHIR_CALL_FUNCTION(&_11$$3, "str_repeat", &_8, 20, &_9$$3, &_10$$3); + ZEPHIR_CALL_FUNCTION(&_11$$3, "str_repeat", &_8, 21, &_9$$3, &_10$$3); zephir_check_call_status(); ZEPHIR_CONCAT_VVV(return_value, &_7$$3, &_6$$3, &_11$$3); RETURN_MM(); } else if (ZEPHIR_IS_LONG_IDENTICAL(&_1, step)) { zephir_read_property(&_12$$4, this_ptr, SL("filledChar"), PH_NOISY_CC | PH_READONLY); zephir_read_property(&_13$$4, this_ptr, SL("width"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_RETURN_CALL_FUNCTION("str_repeat", &_8, 20, &_12$$4, &_13$$4); + ZEPHIR_RETURN_CALL_FUNCTION("str_repeat", &_8, 21, &_12$$4, &_13$$4); zephir_check_call_status(); RETURN_MM(); } else { zephir_read_property(&_14$$5, this_ptr, SL("unfilledChar"), PH_NOISY_CC | PH_READONLY); zephir_read_property(&_15$$5, this_ptr, SL("width"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_RETURN_CALL_FUNCTION("str_repeat", &_8, 20, &_14$$5, &_15$$5); + ZEPHIR_RETURN_CALL_FUNCTION("str_repeat", &_8, 21, &_14$$5, &_15$$5); zephir_check_call_status(); RETURN_MM(); } @@ -265,25 +265,25 @@ PHP_METHOD(Test_Statements, test544IssueWithVariable) { unfilledWidth = (((zephir_get_numberval(&_2$$3) - 1)) - filledWidth); zephir_read_property(&_3$$3, this_ptr, SL("filledChar"), PH_NOISY_CC | PH_READONLY); ZVAL_LONG(&_4$$3, filledWidth); - ZEPHIR_CALL_FUNCTION(&_5$$3, "str_repeat", &_6, 20, &_3$$3, &_4$$3); + ZEPHIR_CALL_FUNCTION(&_5$$3, "str_repeat", &_6, 21, &_3$$3, &_4$$3); zephir_check_call_status(); zephir_read_property(&_4$$3, this_ptr, SL("arrow"), PH_NOISY_CC | PH_READONLY); zephir_read_property(&_7$$3, this_ptr, SL("unfilledChar"), PH_NOISY_CC | PH_READONLY); ZVAL_LONG(&_8$$3, unfilledWidth); - ZEPHIR_CALL_FUNCTION(&_9$$3, "str_repeat", &_6, 20, &_7$$3, &_8$$3); + ZEPHIR_CALL_FUNCTION(&_9$$3, "str_repeat", &_6, 21, &_7$$3, &_8$$3); zephir_check_call_status(); ZEPHIR_CONCAT_VVV(return_value, &_5$$3, &_4$$3, &_9$$3); RETURN_MM(); } else if (step == totalSteps) { zephir_read_property(&_10$$4, this_ptr, SL("filledChar"), PH_NOISY_CC | PH_READONLY); zephir_read_property(&_11$$4, this_ptr, SL("width"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_RETURN_CALL_FUNCTION("str_repeat", &_6, 20, &_10$$4, &_11$$4); + ZEPHIR_RETURN_CALL_FUNCTION("str_repeat", &_6, 21, &_10$$4, &_11$$4); zephir_check_call_status(); RETURN_MM(); } else { zephir_read_property(&_12$$5, this_ptr, SL("unfilledChar"), PH_NOISY_CC | PH_READONLY); zephir_read_property(&_13$$5, this_ptr, SL("width"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_RETURN_CALL_FUNCTION("str_repeat", &_6, 20, &_12$$5, &_13$$5); + ZEPHIR_RETURN_CALL_FUNCTION("str_repeat", &_6, 21, &_12$$5, &_13$$5); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/test/strings.zep.c b/ext/test/strings.zep.c index 3fe6f8b7b2..9fa23b8cf6 100644 --- a/ext/test/strings.zep.c +++ b/ext/test/strings.zep.c @@ -538,9 +538,9 @@ PHP_METHOD(Test_Strings, strToHex) { _1$$3 = ZEPHIR_STRING_OFFSET(&value, i); ZEPHIR_INIT_NVAR(&_2$$3); ZVAL_STRINGL(&_2$$3, &_1$$3, 1); - ZEPHIR_CALL_FUNCTION(&_3$$3, "ord", &_4, 76, &_2$$3); + ZEPHIR_CALL_FUNCTION(&_3$$3, "ord", &_4, 78, &_2$$3); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&_5$$3, "dechex", &_6, 9, &_3$$3); + ZEPHIR_CALL_FUNCTION(&_5$$3, "dechex", &_6, 10, &_3$$3); zephir_check_call_status(); zephir_concat_self(&ret, &_5$$3 TSRMLS_CC); i++; @@ -590,17 +590,17 @@ PHP_METHOD(Test_Strings, issue1267) { zephir_fast_str_replace(&_0, &_1, &_2, value TSRMLS_CC); ZEPHIR_CPY_WRT(value, &_0); ZVAL_LONG(&_3, 513); - ZEPHIR_CALL_FUNCTION(&_4, "filter_var", NULL, 77, value, &_3); + ZEPHIR_CALL_FUNCTION(&_4, "filter_var", NULL, 79, value, &_3); zephir_check_call_status(); ZEPHIR_CPY_WRT(value, &_4); ZEPHIR_INIT_NVAR(&_0); - ZEPHIR_CALL_FUNCTION(&_4, "strip_tags", &_5, 78, value); + ZEPHIR_CALL_FUNCTION(&_4, "strip_tags", &_5, 80, value); zephir_check_call_status(); zephir_stripslashes(&_0, &_4); ZEPHIR_INIT_VAR(&x); zephir_fast_trim(&x, &_0, NULL , ZEPHIR_TRIM_BOTH TSRMLS_CC); ZEPHIR_INIT_VAR(&_6); - ZEPHIR_CALL_FUNCTION(&_7, "strip_tags", &_5, 78, value); + ZEPHIR_CALL_FUNCTION(&_7, "strip_tags", &_5, 80, value); zephir_check_call_status(); zephir_stripcslashes(&_6, &_7); zephir_fast_trim(return_value, &_6, NULL , ZEPHIR_TRIM_BOTH TSRMLS_CC); diff --git a/ext/test/trytest.zep.c b/ext/test/trytest.zep.c index 5bba8769ba..ce7c77135f 100644 --- a/ext/test/trytest.zep.c +++ b/ext/test/trytest.zep.c @@ -53,7 +53,7 @@ PHP_METHOD(Test_TryTest, testThrow2) { ZVAL_STRING(&message, "error"); ZEPHIR_INIT_VAR(&_0); object_init_ex(&_0, zend_exception_get_default(TSRMLS_C)); - ZEPHIR_CALL_METHOD(NULL, &_0, "__construct", NULL, 27, &message); + ZEPHIR_CALL_METHOD(NULL, &_0, "__construct", NULL, 28, &message); zephir_check_call_status(); zephir_throw_exception_debug(&_0, "test/trytest.zep", 16 TSRMLS_CC); ZEPHIR_MM_RESTORE(); @@ -94,7 +94,7 @@ PHP_METHOD(Test_TryTest, testTry2) { object_init_ex(&_0$$3, zend_exception_get_default(TSRMLS_C)); ZEPHIR_INIT_VAR(&_1$$3); ZVAL_STRING(&_1$$3, "error!"); - ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", NULL, 27, &_1$$3); + ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", NULL, 28, &_1$$3); zephir_check_call_status_or_jump(try_end_1); zephir_throw_exception_debug(&_0$$3, "test/trytest.zep", 27 TSRMLS_CC); goto try_end_1; @@ -126,7 +126,7 @@ PHP_METHOD(Test_TryTest, testTry3) { object_init_ex(&_0$$3, zend_exception_get_default(TSRMLS_C)); ZEPHIR_INIT_VAR(&_1$$3); ZVAL_STRING(&_1$$3, "error!"); - ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", NULL, 27, &_1$$3); + ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", NULL, 28, &_1$$3); zephir_check_call_status_or_jump(try_end_1); zephir_throw_exception_debug(&_0$$3, "test/trytest.zep", 34 TSRMLS_CC); goto try_end_1; @@ -178,7 +178,7 @@ PHP_METHOD(Test_TryTest, testTry4) { object_init_ex(&_0$$4, zend_exception_get_default(TSRMLS_C)); ZEPHIR_INIT_VAR(&_1$$4); ZVAL_STRING(&_1$$4, "error!"); - ZEPHIR_CALL_METHOD(NULL, &_0$$4, "__construct", NULL, 27, &_1$$4); + ZEPHIR_CALL_METHOD(NULL, &_0$$4, "__construct", NULL, 28, &_1$$4); zephir_check_call_status_or_jump(try_end_1); zephir_throw_exception_debug(&_0$$4, "test/trytest.zep", 46 TSRMLS_CC); goto try_end_1; @@ -188,7 +188,7 @@ PHP_METHOD(Test_TryTest, testTry4) { object_init_ex(&_2$$5, spl_ce_RuntimeException); ZEPHIR_INIT_VAR(&_3$$5); ZVAL_STRING(&_3$$5, "error!"); - ZEPHIR_CALL_METHOD(NULL, &_2$$5, "__construct", NULL, 79, &_3$$5); + ZEPHIR_CALL_METHOD(NULL, &_2$$5, "__construct", NULL, 81, &_3$$5); zephir_check_call_status_or_jump(try_end_1); zephir_throw_exception_debug(&_2$$5, "test/trytest.zep", 48 TSRMLS_CC); goto try_end_1; @@ -247,7 +247,7 @@ PHP_METHOD(Test_TryTest, testTry5) { object_init_ex(&_0$$4, zend_exception_get_default(TSRMLS_C)); ZEPHIR_INIT_VAR(&_1$$4); ZVAL_STRING(&_1$$4, "error!"); - ZEPHIR_CALL_METHOD(NULL, &_0$$4, "__construct", NULL, 27, &_1$$4); + ZEPHIR_CALL_METHOD(NULL, &_0$$4, "__construct", NULL, 28, &_1$$4); zephir_check_call_status_or_jump(try_end_1); zephir_throw_exception_debug(&_0$$4, "test/trytest.zep", 63 TSRMLS_CC); goto try_end_1; @@ -257,7 +257,7 @@ PHP_METHOD(Test_TryTest, testTry5) { object_init_ex(&_2$$5, spl_ce_RuntimeException); ZEPHIR_INIT_VAR(&_3$$5); ZVAL_STRING(&_3$$5, "error!"); - ZEPHIR_CALL_METHOD(NULL, &_2$$5, "__construct", NULL, 79, &_3$$5); + ZEPHIR_CALL_METHOD(NULL, &_2$$5, "__construct", NULL, 81, &_3$$5); zephir_check_call_status_or_jump(try_end_1); zephir_throw_exception_debug(&_2$$5, "test/trytest.zep", 65 TSRMLS_CC); goto try_end_1; @@ -315,7 +315,7 @@ PHP_METHOD(Test_TryTest, testTry6) { object_init_ex(&_0$$4, zend_exception_get_default(TSRMLS_C)); ZEPHIR_INIT_VAR(&_1$$4); ZVAL_STRING(&_1$$4, "error!"); - ZEPHIR_CALL_METHOD(NULL, &_0$$4, "__construct", NULL, 27, &_1$$4); + ZEPHIR_CALL_METHOD(NULL, &_0$$4, "__construct", NULL, 28, &_1$$4); zephir_check_call_status_or_jump(try_end_1); zephir_throw_exception_debug(&_0$$4, "test/trytest.zep", 80 TSRMLS_CC); goto try_end_1; @@ -325,7 +325,7 @@ PHP_METHOD(Test_TryTest, testTry6) { object_init_ex(&_2$$5, spl_ce_RuntimeException); ZEPHIR_INIT_VAR(&_3$$5); ZVAL_STRING(&_3$$5, "error!"); - ZEPHIR_CALL_METHOD(NULL, &_2$$5, "__construct", NULL, 79, &_3$$5); + ZEPHIR_CALL_METHOD(NULL, &_2$$5, "__construct", NULL, 81, &_3$$5); zephir_check_call_status_or_jump(try_end_1); zephir_throw_exception_debug(&_2$$5, "test/trytest.zep", 82 TSRMLS_CC); goto try_end_1; @@ -382,7 +382,7 @@ PHP_METHOD(Test_TryTest, testTry7) { object_init_ex(&_0$$4, zend_exception_get_default(TSRMLS_C)); ZEPHIR_INIT_VAR(&_1$$4); ZVAL_STRING(&_1$$4, "error!"); - ZEPHIR_CALL_METHOD(NULL, &_0$$4, "__construct", NULL, 27, &_1$$4); + ZEPHIR_CALL_METHOD(NULL, &_0$$4, "__construct", NULL, 28, &_1$$4); zephir_check_call_status_or_jump(try_end_1); zephir_throw_exception_debug(&_0$$4, "test/trytest.zep", 99 TSRMLS_CC); goto try_end_1; @@ -392,7 +392,7 @@ PHP_METHOD(Test_TryTest, testTry7) { object_init_ex(&_2$$5, spl_ce_RuntimeException); ZEPHIR_INIT_VAR(&_3$$5); ZVAL_STRING(&_3$$5, "error!"); - ZEPHIR_CALL_METHOD(NULL, &_2$$5, "__construct", NULL, 79, &_3$$5); + ZEPHIR_CALL_METHOD(NULL, &_2$$5, "__construct", NULL, 81, &_3$$5); zephir_check_call_status_or_jump(try_end_1); zephir_throw_exception_debug(&_2$$5, "test/trytest.zep", 101 TSRMLS_CC); goto try_end_1; @@ -438,7 +438,7 @@ PHP_METHOD(Test_TryTest, testTry8) { object_init_ex(&_0$$3, zend_exception_get_default(TSRMLS_C)); ZEPHIR_INIT_VAR(&_1$$3); ZVAL_STRING(&_1$$3, "error 1!"); - ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", NULL, 27, &_1$$3); + ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", NULL, 28, &_1$$3); zephir_check_call_status_or_jump(try_end_1); zephir_throw_exception_debug(&_0$$3, "test/trytest.zep", 111 TSRMLS_CC); goto try_end_1; @@ -486,7 +486,7 @@ PHP_METHOD(Test_TryTest, testTry9) { /* try_start_1: */ - ZEPHIR_CALL_METHOD(NULL, this_ptr, "somemethod1", NULL, 80); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "somemethod1", NULL, 82); zephir_check_call_status_or_jump(try_end_1); RETURN_MM_STRING("not catched"); @@ -520,7 +520,7 @@ PHP_METHOD(Test_TryTest, testTry10) { /* try_start_1: */ - ZEPHIR_CALL_METHOD(NULL, this_ptr, "somemethod2", NULL, 81); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "somemethod2", NULL, 83); zephir_check_call_status_or_jump(try_end_1); RETURN_MM_STRING("not catched"); diff --git a/ext/test/unsettest.zep.c b/ext/test/unsettest.zep.c index 3b2849a8f2..86b3f57907 100644 --- a/ext/test/unsettest.zep.c +++ b/ext/test/unsettest.zep.c @@ -69,7 +69,7 @@ PHP_METHOD(Test_Unsettest, addValueToProperty) { - zephir_update_property_array(this_ptr, SL("property"), key, value TSRMLS_CC); + zephir_update_property_array(this_ptr, SL("property"), key, value); } diff --git a/kernels/ZendEngine3/fcall.c b/kernels/ZendEngine3/fcall.c index 1a2f273c3a..60e589927c 100644 --- a/kernels/ZendEngine3/fcall.c +++ b/kernels/ZendEngine3/fcall.c @@ -421,6 +421,8 @@ int zephir_call_user_function(zval *object_pp, zend_class_entry *obj_ce, zephir_ } else if (FAILURE == status || EG(exception)) { ZVAL_NULL(retval_ptr); + } else if (Z_TYPE_P(retval_ptr) == IS_ARRAY) { + SEPARATE_ARRAY(retval_ptr); } return status; diff --git a/kernels/ZendEngine3/object.c b/kernels/ZendEngine3/object.c index 0153f5017c..3b5e86937c 100644 --- a/kernels/ZendEngine3/object.c +++ b/kernels/ZendEngine3/object.c @@ -570,6 +570,10 @@ int zephir_update_property_zval(zval *object, const char *property_name, unsigne ZVAL_STRINGL(&property, property_name, property_length); + if (Z_TYPE_P(value) == IS_ARRAY) { + SEPARATE_ARRAY(value); + } + /* write_property will add 1 to refcount, so no Z_TRY_ADDREF_P(value); is necessary */ Z_OBJ_HT_P(object)->write_property(object, &property, value, 0); zval_ptr_dtor(&property); diff --git a/test/instanceoff.zep b/test/instanceoff.zep index ecd4cc8136..1469e658c0 100644 --- a/test/instanceoff.zep +++ b/test/instanceoff.zep @@ -7,28 +7,28 @@ namespace Test; class Instanceoff { - public function testInstanceOf1() + public function testInstanceOf1() -> bool { var a; let a = new \stdClass(); return a instanceof \stdClass; } - public function testInstanceOf2() + public function testInstanceOf2() -> bool { var a; let a = new self(); return a instanceof Instanceoff; } - public function testInstanceOf3() + public function testInstanceOf3() -> bool { var a; let a = new \stdClass(); return a instanceof UnknownClass; } - public function testInstanceOf4(var a) + public function testInstanceOf4(var a) -> bool { if a instanceof \Traversable { return true; @@ -37,7 +37,7 @@ class Instanceoff return false; } - public function testInstanceOf5(var a) + public function testInstanceOf5(var a) -> bool { if a instanceof this { return true; @@ -46,10 +46,27 @@ class Instanceoff return false; } - public function testInstanceOf6() + public function testInstanceOf6() -> bool { var a; let a = new static(); return a instanceof Instanceoff; } + + public function testInstanceOf7(object test) -> bool + { + return test instanceof Instanceoff; + } + + public function testInstanceOf8(string test) -> bool + { + var a; + let a = new static(); + return a instanceof test; + } + + public function testInstanceOf9(object a, string test) -> bool + { + return a instanceof test; + } } diff --git a/test/properties/propertyarray.zep b/test/properties/propertyarray.zep index 870205ac89..3913aa40bb 100644 --- a/test/properties/propertyarray.zep +++ b/test/properties/propertyarray.zep @@ -16,8 +16,41 @@ class PropertyArray */ public someArray = [1, 2, 3, 4]; + /** + * This is a protected property with an initial empty-array value + */ + protected otherArray = []; + public function __construct() { let this->someArray = [1]; } + + public function setOtherArray(arr){ + let this->otherArray = arr; + } + + public function getOtherArray(){ + return this->otherArray; + } + + public function testIssues1831(){ + var info; + var headers; + + let headers = []; + while( true ){ + let info = array_shift(this->otherArray); + + if( stripos(info, "header") !== false ){ + let headers[] = info; + continue; + } else { + array_unshift(this->otherArray, info); + break; + } + } + + return headers; + } } \ No newline at end of file diff --git a/unit-tests/Extension/InstanceOffTest.php b/unit-tests/Extension/InstanceOffTest.php index a67cf0c949..abfb6be25c 100644 --- a/unit-tests/Extension/InstanceOffTest.php +++ b/unit-tests/Extension/InstanceOffTest.php @@ -47,7 +47,7 @@ public function testInstanceOf4() $this->assertFalse($t->testInstanceOf4(false)); $this->assertFalse($t->testInstanceOf4('test')); $this->assertFalse($t->testInstanceOf4([])); - $this->assertFalse($t->testInstanceOf4(new \StdClass())); + $this->assertFalse($t->testInstanceOf4(new \stdClass())); } /** @@ -64,6 +64,49 @@ public function testInstanceOf5() * @link https://github.com/phalcon/zephir/issues/822 */ - $this->assertFalse($t->testInstanceOf5(new \StdClass())); + $this->assertFalse($t->testInstanceOf5(new \stdClass())); + } + + public function testInstanceOf6() + { + $t = new InstanceOff(); + + $this->assertTrue($t->testInstanceOf6()); + } + + /** + * @see https://github.com/phalcon/zephir/issues/1828 + * @test + */ + public function instanceOf7() + { + $t = new InstanceOff(); + + $this->assertTrue($t->testInstanceOf7($t)); + $this->assertFalse($t->testInstanceOf7(new \stdClass())); + } + + /** + * @see https://github.com/phalcon/zephir/issues/1828 + * @test + */ + public function instanceOf8() + { + $t = new InstanceOff(); + + $this->assertTrue($t->testInstanceOf8('\\Test\\InstanceOff')); + $this->assertFalse($t->testInstanceOf8('\\stdClass')); + } + + /** + * @see https://github.com/phalcon/zephir/issues/1828 + * @test + */ + public function instanceOf9() + { + $t = new InstanceOff(); + + $this->assertTrue($t->testInstanceOf9($t, '\\Test\\InstanceOff')); + $this->assertFalse($t->testInstanceOf9($t, '\\stdClass')); } } diff --git a/unit-tests/Extension/Properties/PropertyArrayTest.php b/unit-tests/Extension/Properties/PropertyArrayTest.php index 3c99a99945..3bfbdbfab3 100644 --- a/unit-tests/Extension/Properties/PropertyArrayTest.php +++ b/unit-tests/Extension/Properties/PropertyArrayTest.php @@ -21,4 +21,31 @@ public function testAssertations() $t = new PropertyArray(); $this->assertSame([1], $t->someArray); } + + public function testIssues1831() + { + $header = [ + 'header 1', + 'header 2', + 'header 3', + ]; + + $data = [ + 'header 1', + 'header 2', + 'header 3', + 'data 1', + 'data 2', + 'data 3', + 'data 4', + 'data 5', + 'data 6', + 'data 7', + 'data 8', + ]; + + $t = new PropertyArray(); + $t->setOtherArray($data); + $this->assertSame($header, $t->testIssues1831()); + } }