Skip to content

Commit

Permalink
Merge pull request #1836 from phalcon/development
Browse files Browse the repository at this point in the history
0.11.12
  • Loading branch information
sergeyklay authored Mar 24, 2019
2 parents d6861da + 942c616 commit 1e3bafd
Show file tree
Hide file tree
Showing 65 changed files with 1,890 additions and 641 deletions.
15 changes: 12 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
16 changes: 12 additions & 4 deletions Library/Operators/Other/InstanceOfOperator.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
*
* (c) Zephir Team <[email protected]>
*
* 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;
Expand Down Expand Up @@ -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;

Expand All @@ -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:
Expand All @@ -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() ? '&' : '',
]);
}
}
6 changes: 3 additions & 3 deletions Library/Zephir.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
*
* (c) Zephir Team <[email protected]>
*
* 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;
Expand All @@ -16,7 +16,7 @@
*/
final class Zephir
{
const VERSION = '0.11.11-$Id$';
const VERSION = '0.11.12-$Id$';

const RELEASE_DATE = '$release-date$';

Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: 0.11.11-{build}
version: 0.11.12-{build}

environment:
matrix:
Expand Down
2 changes: 2 additions & 0 deletions ext/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ext/config.w32
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
5 changes: 4 additions & 1 deletion ext/kernel/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "kernel/main.h"
#include "kernel/memory.h"
#include "kernel/fcall.h"
#include "kernel/object.h"
#include "kernel/exception.h"


Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ext/php_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <b>test</b> for<br/>Test Extension."

typedef struct _zephir_struct_db {
Expand Down
4 changes: 4 additions & 0 deletions ext/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions ext/test.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions ext/test/arrayaccessobj.zep.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

129 changes: 129 additions & 0 deletions ext/test/arrayiterator.zep.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions ext/test/arrayiterator.zep.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1e3bafd

Please sign in to comment.