Skip to content

Commit

Permalink
Merge pull request #2078 from phalcon/fix/2057
Browse files Browse the repository at this point in the history
Fixed property visibility
  • Loading branch information
sergeyklay authored Apr 23, 2020
2 parents 7d5486b + e59a146 commit c770f3c
Show file tree
Hide file tree
Showing 52 changed files with 1,246 additions and 466 deletions.
4 changes: 4 additions & 0 deletions .codacy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ engines:
enabled: true
config:
rulesets: "phpmd.xml.dist"

exclude_paths:
- 'ext/**'
- 'prototypes/**'
25 changes: 18 additions & 7 deletions .dir-locals.el
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
;;; Directory Local Variables
;; For more information see (info "(emacs) Directory Variables")

((zephir-mode . ((fill-column . 120)
(indent-tabs-mode . nil)))
(c-mode . ((fill-column . 80)
(c-file-style . "k&r")
(tab-width . 4)
(c-basic-offset . 4)
(indent-tabs-mode . t))))
((nil
(indent-tabs-mode . nil))
(zephir-mode
(fill-column . 120))
(c-mode
(fill-column . 80)
(c-file-style . "k&r")
(tab-width . 4)
(c-basic-offset . 4)
(indent-tabs-mode . t)
(flycheck-checker . c/c++-gcc)
(flycheck-disabled-checkers . (c/c++-clang))
(flycheck-gcc-language-standard . "gnu99"))
(php-mode
(fill-column . 120)
(c-file-style . nil)
(indent-tabs-mode . nil)
(flycheck-disabled-checkers . (php-phpmd php-phpcs))))
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
# Directories to ignore (do not add trailing '/'s, they skip symlinks).
.zephir
.libs
.phpunit
ide
doc
vendor
Expand All @@ -28,11 +27,13 @@ compile.log
compile-errors.log

# Test and build configurations.
phpunit.xml
phpcs.xml
.php_cs
.php_cs.cache
.phpunit
box.json
phpcs.xml
phpmd.xml
phpunit.xml

# Build artefact
zephir.phar
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ and this project adheres to [Semantic Versioning](http://semver.org).
### Fixed
- In some cases for C "control characters" aren't properly escaped
[#2065](https://github.com/phalcon/zephir/issues/2065)
- Zephir ignored property visibility and has not thrown error when setting
private/protected properties in scope that shouldn't intened for it
[#2078](https://github.com/phalcon/zephir/pull/2078),
[phalcon/cphalcon#14810](https://github.com/phalcon/cphalcon/issues/14810),
[phalcon/cphalcon#14766](https://github.com/phalcon/cphalcon/issues/14766)

## [0.12.17] - 2020-02-14
### Fixed
Expand Down
29 changes: 16 additions & 13 deletions Library/Backends/ZendEngine2/Backend.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public function generateInitCode(&$groupVariables, $type, $pointer, Variable $va
/**
* {@inheritdoc}
*/
public function initializeVariableDefaults($variables, CompilationContext $compilationContext): string
public function initializeVariableDefaults(array $variables, CompilationContext $context): string
{
throw new CompilerException(
'ZendEngine2 backend is no longer supported'
Expand Down Expand Up @@ -274,18 +274,11 @@ public function concatSelf(Variable $variable, Variable $itemVariable, Compilati
$context->codePrinter->output('zephir_concat_self('.$variable.', '.$itemVariable.');');
}

public function initArray(Variable $variable, CompilationContext $context, $size = null, $useCodePrinter = true)
public function initArray(Variable $variable, CompilationContext $context, int $size = null)
{
if (!isset($size)) {
$output = 'array_init('.$this->getVariableCode($variable).');';
} else {
$output = 'zephir_create_array('.$this->getVariableCode($variable).', '.$size.', 0);';
}
if ($useCodePrinter) {
$context->codePrinter->output($output);
}

return $output;
throw new CompilerException(
'ZendEngine2 backend is no longer supported'
);
}

public function createClosure(Variable $variable, $classDefinition, CompilationContext $context)
Expand Down Expand Up @@ -690,7 +683,17 @@ public function resolveValue($value, CompilationContext $context, $usePointer =
return $value;
}

public function updateProperty(Variable $symbolVariable, $propertyName, $value, CompilationContext $context)
/**
* {@inheritdoc}
*
* @param Variable $variable
* @param string|Variable $property
* @param mixed $value
* @param CompilationContext $context
*
* @return void
*/
public function updateProperty(Variable $variable, $property, $value, CompilationContext $context)
{
throw new CompilerException(
'ZendEngine2 backend is no longer supported'
Expand Down
Loading

0 comments on commit c770f3c

Please sign in to comment.