Hello community, here is the log from the commit of package php7-phalcon for openSUSE:Factory checked in at 2017-08-22 11:11:17 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/php7-phalcon (Old) and /work/SRC/openSUSE:Factory/.php7-phalcon.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "php7-phalcon" Tue Aug 22 11:11:17 2017 rev:5 rq:518033 version:3.2.2 Changes: -------- --- /work/SRC/openSUSE:Factory/php7-phalcon/php7-phalcon.changes 2017-08-12 20:26:11.324552449 +0200 +++ /work/SRC/openSUSE:Factory/.php7-phalcon.new/php7-phalcon.changes 2017-08-22 11:11:18.714154014 +0200 @@ -1,0 +2,6 @@ +Fri Aug 18 20:44:41 UTC 2017 - [email protected] + +- Update Phalcon to 3.2.2 and use zephir 0.9.11: + * Bug fix release. + +------------------------------------------------------------------- Old: ---- cphalcon-3.2.1.tar.gz zephir-0.9.9.tar.gz New: ---- cphalcon-3.2.2.tar.gz zephir-0.9.11.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ php7-phalcon.spec ++++++ --- /var/tmp/diff_new_pack.qbyEej/_old 2017-08-22 11:11:19.662020548 +0200 +++ /var/tmp/diff_new_pack.qbyEej/_new 2017-08-22 11:11:19.666019985 +0200 @@ -19,11 +19,11 @@ %define _name phalcon %define _cname cphalcon %define _zname zephir -%define _zversion 0.9.9 +%define _zversion 0.9.11 %define _php php7 Name: %{_php}-phalcon -Version: 3.2.1 +Version: 3.2.2 Release: 0 Summary: PHP7 Extension Module License: BSD-3-Clause ++++++ cphalcon-3.2.1.tar.gz -> cphalcon-3.2.2.tar.gz ++++++ /work/SRC/openSUSE:Factory/php7-phalcon/cphalcon-3.2.1.tar.gz /work/SRC/openSUSE:Factory/.php7-phalcon.new/cphalcon-3.2.2.tar.gz differ: char 12, line 1 ++++++ zephir-0.9.9.tar.gz -> zephir-0.9.11.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zephir-0.9.9/Library/Backends/ZendEngine2/Backend.php new/zephir-0.9.11/Library/Backends/ZendEngine2/Backend.php --- old/zephir-0.9.9/Library/Backends/ZendEngine2/Backend.php 2017-06-20 23:05:59.000000000 +0200 +++ new/zephir-0.9.11/Library/Backends/ZendEngine2/Backend.php 2017-08-02 18:42:58.000000000 +0200 @@ -55,12 +55,14 @@ return $output; } + /** + * {@inheritdoc} + */ public function getStringsManager() { return new StringsManager(); } - public function getFcallManager() { if (!$this->fcallManager) { @@ -175,6 +177,9 @@ * @param string $operator * @param string $value * @param CompilationContext $context + * @return string + * + * @throws CompilerException */ public function getTypeofCondition(Variable $variableVariable, $operator, $value, CompilationContext $context) { @@ -356,7 +361,7 @@ if ($variable->getName() != 'this_ptr' && $variable->getName() != 'return_value' && $variable->getName() != 'return_value_ptr') { $defaultValue = $variable->getDefaultInitValue(); if (is_array($defaultValue)) { - $symbolTable->mustGrownStack(true); + $compilationContext->symbolTable->mustGrownStack(true); $compilationContext->backend->initVar($variable, $compilationContext); switch ($defaultValue['type']) { case 'int': @@ -414,7 +419,7 @@ if ($variable->getNumberUses() > 0) { $defaultValue = $variable->getDefaultInitValue(); if (is_array($defaultValue)) { - $symbolTable->mustGrownStack(true); + $compilationContext->symbolTable->mustGrownStack(true); $compilationContext->backend->initVar($variable, $compilationContext); switch ($defaultValue['type']) { case 'string': @@ -440,7 +445,7 @@ if ($variable->getNumberUses() > 0) { $defaultValue = $variable->getDefaultInitValue(); if (is_array($defaultValue)) { - $symbolTable->mustGrownStack(true); + $compilationContext->symbolTable->mustGrownStack(true); $compilationContext->backend->initVar($variable, $compilationContext); switch ($defaultValue['type']) { case 'null': diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zephir-0.9.9/Library/Backends/ZendEngine3/Backend.php new/zephir-0.9.11/Library/Backends/ZendEngine3/Backend.php --- old/zephir-0.9.9/Library/Backends/ZendEngine3/Backend.php 2017-06-20 23:05:59.000000000 +0200 +++ new/zephir-0.9.11/Library/Backends/ZendEngine3/Backend.php 2017-08-02 18:42:58.000000000 +0200 @@ -1,6 +1,7 @@ <?php namespace Zephir\Backends\ZendEngine3; +use Zephir\ClassDefinition; use Zephir\Variable; use Zephir\CompiledExpression; use Zephir\Compiler; @@ -55,6 +56,9 @@ return $code; } + /** + * {@inheritdoc} + */ public function getStringsManager() { return new StringsManager(); @@ -420,7 +424,7 @@ break; } - if (!$type) { + if ($type === null) { throw new CompilerException("Unknown type mapping: " . $value->getType()); } @@ -494,7 +498,8 @@ $context->codePrinter->output('zephir_array_unset_string(' . $variableCode . ', SL("' . $exprIndex->getCode() . '"), ' . $flags . ');'); return; } - return parent::arrayUnset($variable, $exprIndex, $flags, $context); + + parent::arrayUnset($variable, $exprIndex, $flags, $context); } public function fetchGlobal(Variable $globalVar, CompilationContext $compilationContext, $useCodePrinter = true) @@ -542,20 +547,35 @@ } } + /** + * @param Variable $symbolVariable + * @param ClassDefinition $classDefinition + * @param $property + * @param bool $readOnly + * @param CompilationContext $context + */ public function fetchStaticProperty(Variable $symbolVariable, $classDefinition, $property, $readOnly, CompilationContext $context) { - $flags = 'PH_NOISY_CC'; - if ($readOnly) { - $flags .= ' | PH_READONLY'; - } - //TODO: maybe optimizations as well as above - if ($symbolVariable->isDoublePointer()) { - $context->codePrinter->output('zephir_read_static_property_ce(' . $symbolVariable->getName() . ', ' . $classDefinition->getClassEntry() . ', SL("' . $property . '"), ' . $flags . ');'); - } else { - $context->codePrinter->output('zephir_read_static_property_ce(&' . $symbolVariable->getName() . ', ' . $classDefinition->getClassEntry() . ', SL("' . $property . '"), ' . $flags . ');'); - } + // TODO: maybe optimizations as well as above + $context->codePrinter->output( + sprintf( + 'zephir_read_static_property_ce(%s%s, %s, SL("%s"), PH_NOISY_CC%s);', + $symbolVariable->isDoublePointer() ? '' : '&', + $symbolVariable->getName(), + $classDefinition->getClassEntry(), + $property, + $readOnly ? ' | PH_READONLY' : '' + ) + ); } + /** + * @param $value + * @param CompilationContext $context + * @param bool $usePointer + * @return bool|string|Variable + * @throws CompilerException + */ public function resolveValue($value, CompilationContext $context, $usePointer = false) { if ($value instanceof GlobalConstant) { @@ -570,7 +590,9 @@ $value = 'false'; break; default: - throw new CompilerException('ZE3: Unknown constant '.$value->getName()); + throw new CompilerException( + $this->name . ': Unknown constant ' . $value->getName() + ); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zephir-0.9.9/Library/BaseBackend.php new/zephir-0.9.11/Library/BaseBackend.php --- old/zephir-0.9.9/Library/BaseBackend.php 2017-06-20 23:05:59.000000000 +0200 +++ new/zephir-0.9.11/Library/BaseBackend.php 2017-08-02 18:42:58.000000000 +0200 @@ -1,6 +1,26 @@ <?php + +/* + +--------------------------------------------------------------------------+ + | Zephir Language | + +--------------------------------------------------------------------------+ + | Copyright (c) 2013-2017 Zephir Team and contributors | + +--------------------------------------------------------------------------+ + | This source file is subject the MIT license, that is bundled with | + | this package in the file LICENSE, and is available through the | + | world-wide-web at the following url: | + | http://zephir-lang.com/license.html | + | | + | If you did not receive a copy of the MIT license and are unable | + | to obtain it through the world-wide-web, please send a note to | + | [email protected] so we can mail you a copy immediately. | + +--------------------------------------------------------------------------+ +*/ + namespace Zephir; +use Zephir\StringsManager; + abstract class BaseBackend { /** @@ -50,6 +70,8 @@ /** * Resolves the path to the source template file of the backend + * + * @param string $filename * @return string Absolute path to template file */ public function getTemplateFileContents($filename) @@ -61,7 +83,11 @@ return file_get_contents($filepath); } + /** + * @return StringsManager + */ abstract public function getStringsManager(); + abstract public function getTypeDefinition($type); abstract public function getTypeofCondition(Variable $variableVariable, $operator, $value, CompilationContext $context); abstract public function generateInitCode(&$groupVariables, $type, $pointer, Variable $variable); @@ -152,6 +178,8 @@ */ abstract public function getVariableCodePointer(Variable $variable); + abstract public function resolveValue($value, CompilationContext $context, $usePointer = false); + public static function getActiveBackend() { if (version_compare(phpversion(), '7.0', '>=')) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zephir-0.9.9/Library/Call.php new/zephir-0.9.11/Library/Call.php --- old/zephir-0.9.9/Library/Call.php 2017-06-20 23:05:59.000000000 +0200 +++ new/zephir-0.9.11/Library/Call.php 2017-08-02 18:42:58.000000000 +0200 @@ -44,13 +44,13 @@ protected $_reflection; - protected $_resolvedTypes = array(); + protected $_resolvedTypes = []; - protected $_resolvedDynamicTypes = array(); + protected $_resolvedDynamicTypes = []; - protected $_temporalVariables = array(); + protected $_temporalVariables = []; - protected $_mustCheckForCopy = array(); + protected $_mustCheckForCopy = []; /** * Processes the symbol variable that will be used to return @@ -72,7 +72,7 @@ if ($isExpecting) { $symbolVariable = $expr->getExpectingVariable(); if (is_object($symbolVariable)) { - $readDetector = new ReadDetector($expression); + $readDetector = new ReadDetector(); if ($readDetector->detect($symbolVariable->getName(), $expression)) { $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite( 'variable', @@ -112,7 +112,7 @@ if ($isExpecting) { $symbolVariable = $expr->getExpectingVariable(); if (is_object($symbolVariable)) { - $readDetector = new ReadDetector($expression); + $readDetector = new ReadDetector(); if ($readDetector->detect($symbolVariable->getName(), $expression)) { $symbolVariable = $compilationContext->symbolTable->getTempVariableForObserveOrNullify('variable', $compilationContext, $expression); } else { @@ -148,7 +148,7 @@ if ($isExpecting) { $symbolVariable = $expr->getExpectingVariable(); if (is_object($symbolVariable)) { - $readDetector = new ReadDetector($expression); + $readDetector = new ReadDetector(); if ($readDetector->detect($symbolVariable->getName(), $expression)) { $symbolVariable = $compilationContext->symbolTable->getTempComplexLiteralVariableForWrite('variable', $compilationContext, $expression); } else { @@ -305,6 +305,8 @@ * @param array $expression * @param array $calleeDefinition * @return array + * + * @throws CompilerException */ public function getResolvedParams($parameters, CompilationContext $compilationContext, array $expression, $calleeDefinition = null) { @@ -664,7 +666,7 @@ { if (!$compilationContext->symbolTable->hasVariable('ZEPHIR_LAST_CALL_STATUS')) { $callStatus = new Variable('int', 'ZEPHIR_LAST_CALL_STATUS', $compilationContext->currentBranch); - $callStatus->setIsInitialized(true, $compilationContext, array()); + $callStatus->setIsInitialized(true, $compilationContext); $callStatus->increaseUses(); $callStatus->setReadOnly(true); $compilationContext->symbolTable->addRawVariable($callStatus); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zephir-0.9.9/Library/ClassDefinition.php new/zephir-0.9.11/Library/ClassDefinition.php --- old/zephir-0.9.9/Library/ClassDefinition.php 2017-06-20 23:05:59.000000000 +0200 +++ new/zephir-0.9.11/Library/ClassDefinition.php 2017-08-02 18:42:58.000000000 +0200 @@ -19,7 +19,6 @@ namespace Zephir; -use Zephir\HeadersManager; use Zephir\Documentation\Docblock; use Zephir\Documentation\DocblockParser; @@ -101,7 +100,7 @@ protected $methods = array(); /** - * @var array + * @var string */ protected $docBlock; @@ -492,7 +491,7 @@ /** * Sets the class/interface docBlock * - * @param array $docBlock + * @param string $docBlock */ public function setDocBlock($docBlock) { @@ -502,7 +501,7 @@ /** * Returns the class/interface docBlock * - * @return array + * @return string */ public function getDocBlock() { @@ -512,18 +511,19 @@ /** * Returns the parsed docBlock * - * @return DocBlock + * @return DocBlock|null */ public function getParsedDocBlock() { if (!$this->parsedDocblock) { if (strlen($this->docBlock) > 0) { - $parser = new DocblockParser("/" . $this->docBlock ."/"); + $parser = new DocblockParser("/" . $this->docBlock . "/"); $this->parsedDocblock = $parser->parse(); } else { return null; } } + return $this->parsedDocblock; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zephir-0.9.9/Library/Compiler.php new/zephir-0.9.11/Library/Compiler.php --- old/zephir-0.9.9/Library/Compiler.php 2017-06-20 23:05:59.000000000 +0200 +++ new/zephir-0.9.11/Library/Compiler.php 2017-08-02 18:42:58.000000000 +0200 @@ -32,7 +32,7 @@ */ class Compiler { - const VERSION = '0.9.9'; + const VERSION = '0.9.11'; public $parserCompiled = false; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zephir-0.9.9/Library/Expression/NativeArrayAccess.php new/zephir-0.9.11/Library/Expression/NativeArrayAccess.php --- old/zephir-0.9.9/Library/Expression/NativeArrayAccess.php 2017-06-20 23:05:59.000000000 +0200 +++ new/zephir-0.9.11/Library/Expression/NativeArrayAccess.php 2017-08-02 18:42:58.000000000 +0200 @@ -143,9 +143,12 @@ } /** - * @param array $expression - * @param Variable $variableVariable + * @param array $expression + * @param Variable $variableVariable * @param CompilationContext $compilationContext + * @return CompiledExpression + * + * @throws CompilerException */ protected function _accessDimensionArray($expression, Variable $variableVariable, CompilationContext $compilationContext) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zephir-0.9.9/Library/FunctionCall.php new/zephir-0.9.11/Library/FunctionCall.php --- old/zephir-0.9.9/Library/FunctionCall.php 2017-06-20 23:05:59.000000000 +0200 +++ new/zephir-0.9.11/Library/FunctionCall.php 2017-08-02 18:42:58.000000000 +0200 @@ -207,6 +207,9 @@ * @param array $expression * @param Call $call * @param CompilationContext $compilationContext + * @return bool|mixed + * + * @throws \Exception */ protected function optimize($funcName, array $expression, Call $call, CompilationContext $compilationContext) { @@ -218,6 +221,7 @@ if (!isset(self::$_optimizers[$funcName])) { $camelizeFunctionName = Utils::camelize($funcName); + /** * Check every optimizer directory for an optimizer */ @@ -257,6 +261,7 @@ * Checks if the function is a built-in provided by Zephir * * @param string $functionName + * @return bool */ public function isBuiltInFunction($functionName) { @@ -309,8 +314,11 @@ } /** - * @param array $expression + * @param array $expression * @param CompilationContext $compilationContext + * @return CompiledExpression + * + * @throws CompilerException */ protected function _callNormal(array $expression, CompilationContext $compilationContext) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zephir-0.9.9/Library/Optimizers/FunctionCall/FunctionExistsOptimizer.php new/zephir-0.9.11/Library/Optimizers/FunctionCall/FunctionExistsOptimizer.php --- old/zephir-0.9.9/Library/Optimizers/FunctionCall/FunctionExistsOptimizer.php 2017-06-20 23:05:59.000000000 +0200 +++ new/zephir-0.9.11/Library/Optimizers/FunctionCall/FunctionExistsOptimizer.php 2017-08-02 18:42:58.000000000 +0200 @@ -21,7 +21,6 @@ use Zephir\Call; use Zephir\CompilationContext; -use Zephir\CompilerException; use Zephir\CompiledExpression; use Zephir\Optimizers\OptimizerAbstract; use Zephir\Utils; @@ -41,11 +40,7 @@ */ public function optimize(array $expression, Call $call, CompilationContext $context) { - if (!isset($expression['parameters'])) { - return false; - } - - if (count($expression['parameters']) != 1) { + if (!isset($expression['parameters']) || count($expression['parameters']) != 1) { return false; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zephir-0.9.9/Library/Statements/Let/ObjectPropertyArrayIndex.php new/zephir-0.9.11/Library/Statements/Let/ObjectPropertyArrayIndex.php --- old/zephir-0.9.9/Library/Statements/Let/ObjectPropertyArrayIndex.php 2017-06-20 23:05:59.000000000 +0200 +++ new/zephir-0.9.11/Library/Statements/Let/ObjectPropertyArrayIndex.php 2017-08-02 18:42:58.000000000 +0200 @@ -302,6 +302,8 @@ * @param CompiledExpression $resolvedExpr * @param CompilationContext $compilationContext, * @param array $statement + * + * @throws CompilerException */ public function assign($variable, ZephirVariable $symbolVariable, CompiledExpression $resolvedExpr, CompilationContext $compilationContext, $statement) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zephir-0.9.9/appveyor.yml new/zephir-0.9.11/appveyor.yml --- old/zephir-0.9.9/appveyor.yml 2017-06-20 23:05:59.000000000 +0200 +++ new/zephir-0.9.11/appveyor.yml 2017-08-02 18:42:58.000000000 +0200 @@ -1,6 +1,22 @@ -version: 0.9.9-{build} +#---------------------------------# +# general configuration # +#---------------------------------# -build: false +# version format +version: 0.9.11-{build} + +# branches to build +branches: + # whitelist + only: + - master + - development + +#---------------------------------# +# environment configuration # +#---------------------------------# + +# environment variables environment: matrix: - PHP_TARGET: 5.6 @@ -8,14 +24,13 @@ PHP_SDK: c:\projects\php-sdk PHP_DEVPACK: c:\projects\php-devpack +# clone entire repository history if not defined clone_depth: 1 -clone_folder: c:\projects\zephir -branches: - only: - - master - - development +# clone directory +clone_folder: c:\projects\zephir +# scripts that are called at very beginning, before repo cloning init: - SET ANSICON=121x90 (121x90) - SET COMPOSER_NO_INTERACTION=1 @@ -23,31 +38,51 @@ - SET PARSER_VERSION=1.0.3-258 - ps: IF ($env:APPVEYOR_REPO_BRANCH -eq "development") {$env:APPVEYOR_CACHE_SKIP_SAVE = "true"} +# build cache to preserve files/folders between builds cache: - vendor -> composer.json - composer.phar -> composer.json +matrix: + # immediately finish build once one of the jobs fails + fast_finish: true + +# Operating system (build VM template) os: Windows Server 2012 R2 + +#---------------------------------# +# build configuration # +#---------------------------------# + +# add platforms to build matrix (i.e. x86, x64, AnyCPU): platform: - x86 -matrix: - fast_finish: true +# disable automatic builds +build: false +# scripts that run after cloning repository install: # ================================================== - echo Setting PHP version... # ================================================== - appveyor DownloadFile http://windows.php.net/downloads/releases/sha1sum.txt - - ps: $env:PHP_VERSION=type sha1sum.txt | where { $_ -match "php-(${env:PHP_TARGET}\.\d+)-src" } | foreach { $matches[1] } + - ps: | + $matched_versions = type sha1sum.txt | where { $_ -match "php-(${env:PHP_TARGET}\.\d+)-src" } | foreach { $matches[1] } + $cleaned_version = $matched_versions.Split(' ')[-1] + $env:PHP_VERSION=${cleaned_version} - ps: $env:PARSER_DOWNLOAD_URL="https://github.com/phalcon/php-zephir-parser/releases/download/v${env:PARSER_RELEASE}/zephir_parser_${env:PLATFORM}_vc${env:PHP_VC}_php${env:PHP_TARGET}_${env:PARSER_VERSION}.zip" + # ================================================== - echo Initializing Build... + # ================================================== - cd %APPVEYOR_BUILD_FOLDER% - git submodule update --init --recursive - echo Preparing zephir win32 build... - - echo Downloading PHP source code [%PHP_VERSION%] + # ================================================== + - echo Downloading PHP source code [http://windows.php.net/downloads/releases/php-%PHP_VERSION%-Win32-VC%PHP_VC%-%PLATFORM%.zip] + # ================================================== - ps: (new-object net.webclient).DownloadFile('http://windows.php.net/downloads/releases/php-' + ${env:PHP_VERSION} + '-Win32-VC' + ${env:PHP_VC} + '-' + ${env:PLATFORM} + '.zip', ${env:APPVEYOR_BUILD_FOLDER} + '\..\php.zip') - cd .. - 'mkdir php && mv php.zip php\php.zip && cd php' @@ -82,23 +117,38 @@ - 'set PATH=%cd%;%PATH%' - php --ri "Zephir Parser" - # ================================================== - - echo Download tests dependencies... - # ================================================== +#---------------------------------# +# tests configuration # +#---------------------------------# + +# disable automatic tests +test: off + +# scripts to run before tests +before_test: + - ps: Write-Host "Download tests dependencies.." - cd %APPVEYOR_BUILD_FOLDER% - if not exist vendor (php -r "readfile('https://getcomposer.org/installer');" | php && php composer.phar --version) - if not exist vendor (php composer.phar update --quiet --no-ansi --no-interaction --no-progress --optimize-autoloader --dev --prefer-dist --no-suggest) + - php composer.phar dump-autoload -build_script: + - ps: Write-Host "Start custom build.." + - cd %APPVEYOR_BUILD_FOLDER% + - 'bin\zephir build -Wnonexistent-function -Wnonexistent-class -Wunused-variable' - 'cd %APPVEYOR_BUILD_FOLDER%\..\php' - 'echo extension=%APPVEYOR_BUILD_FOLDER%\ext\Release_TS\php_test.dll >> php.ini' - - cd %APPVEYOR_BUILD_FOLDER% - - 'bin\zephir build' +# run custom scripts instead of automatic tests test_script: + - ps: Write-Host "Start unit test.." - cd %APPVEYOR_BUILD_FOLDER% - 'php unit-tests/phpunit -c phpunit.xml.dist --not-exit --debug' +#---------------------------------# +# global handlers # +#---------------------------------# + +# on build failure on_failure: - 'dir' - ps: >- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zephir-0.9.9/kernels/ZendEngine2/debug.c new/zephir-0.9.11/kernels/ZendEngine2/debug.c --- old/zephir-0.9.9/kernels/ZendEngine2/debug.c 2017-06-20 23:05:59.000000000 +0200 +++ new/zephir-0.9.11/kernels/ZendEngine2/debug.c 2017-08-02 18:42:58.000000000 +0200 @@ -39,11 +39,6 @@ */ int zephir_start_debug(){ if(!zephir_log){ - /*//zephir_log = fopen("/home/gutierrezandresfelipe/phalcon-debug.a", "w"); - zephir_log = fopen("/tmp/phalcon-debug.a", "w"); - if(!zephir_log){ - fprintf(stderr, "Can't open debug log\n"); - }*/ zephir_log = stderr; } return SUCCESS; @@ -60,7 +55,7 @@ ptr = ptr->prev; efree(this_entry); } - //fclose(zephir_log); + zephir_log = NULL; return SUCCESS; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zephir-0.9.9/kernels/ZendEngine2/main.h new/zephir-0.9.11/kernels/ZendEngine2/main.h --- old/zephir-0.9.9/kernels/ZendEngine2/main.h 2017-06-20 23:05:59.000000000 +0200 +++ new/zephir-0.9.11/kernels/ZendEngine2/main.h 2017-08-02 18:42:58.000000000 +0200 @@ -383,7 +383,7 @@ } /** Get current hash key copying the iterator if needed */ - +// TODO: Deprecated. Will be removed in future #if PHP_VERSION_ID < 50500 #define ZEPHIR_GET_IMKEY(var, it) \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zephir-0.9.9/kernels/ZendEngine3/main.c new/zephir-0.9.11/kernels/ZendEngine3/main.c --- old/zephir-0.9.9/kernels/ZendEngine3/main.c 2017-06-20 23:05:59.000000000 +0200 +++ new/zephir-0.9.11/kernels/ZendEngine3/main.c 2017-08-02 18:42:58.000000000 +0200 @@ -254,11 +254,13 @@ } /** - * Check if a function exists using explicit char param (using precomputed hash key) + * Check if a function exists using explicit function length + * + * TODO: Deprecated. Will be removed in future */ -int zephir_function_quick_exists_ex(const char *method_name, unsigned int method_len) +int zephir_function_quick_exists_ex(const char *function_name, size_t function_len) { - if (zend_hash_str_exists(CG(function_table), method_name, method_len)) { + if (zend_hash_str_exists(CG(function_table), function_name, function_len)) { return SUCCESS; } @@ -267,19 +269,23 @@ /** * Check if a function exists + * + * @param function_name + * @return */ int zephir_function_exists(const zval *function_name) { + if (zend_hash_str_exists(CG(function_table), Z_STRVAL_P(function_name), Z_STRLEN_P(function_name))) { + return SUCCESS; + } - return zephir_function_quick_exists_ex( - Z_STRVAL_P(function_name), - Z_STRLEN_P(function_name) + 1 - ); + return FAILURE; } /** - * Check if a function exists using explicit char param + * Check if a function exists using explicit function length * + * TODO: Deprecated. Will be removed in future * @param function_name * @param function_len strlen(function_name) + 1 */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zephir-0.9.9/kernels/ZendEngine3/operators.c new/zephir-0.9.11/kernels/ZendEngine3/operators.c --- old/zephir-0.9.9/kernels/ZendEngine3/operators.c 2017-06-20 23:05:59.000000000 +0200 +++ new/zephir-0.9.11/kernels/ZendEngine3/operators.c 2017-08-02 18:42:58.000000000 +0200 @@ -528,6 +528,15 @@ return Z_TYPE(result) == IS_TRUE; } +int zephir_less_double(zval *op1, double op2) +{ + zval result, op2_zval; + ZVAL_DOUBLE(&op2_zval, op2); + + is_smaller_function(&result, op1, &op2_zval); + return Z_TYPE(result) == IS_TRUE; +} + int zephir_less_equal_long(zval *op1, long op2) { zval result, op2_zval; @@ -547,6 +556,15 @@ is_smaller_or_equal_function(&result, op1, &op2_zval); return Z_TYPE(result) == IS_FALSE; +} + +int zephir_greater_double(zval *op1, double op2) +{ + zval result, op2_zval; + ZVAL_DOUBLE(&op2_zval, op2); + + is_smaller_or_equal_function(&result, op1, &op2_zval); + return Z_TYPE(result) == IS_FALSE; } /** diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zephir-0.9.9/templates/ZendEngine2/project.c new/zephir-0.9.11/templates/ZendEngine2/project.c --- old/zephir-0.9.9/templates/ZendEngine2/project.c 2017-06-20 23:05:59.000000000 +0200 +++ new/zephir-0.9.11/templates/ZendEngine2/project.c 2017-08-02 18:42:58.000000000 +0200 @@ -7,6 +7,7 @@ #include <php.h> +// TODO: Deprecated. Will be removed in future #if PHP_VERSION_ID < 50500 #include <locale.h> #endif @@ -37,6 +38,7 @@ static PHP_MINIT_FUNCTION(%PROJECT_LOWER%) { +// TODO: Deprecated. Will be removed in future #if PHP_VERSION_ID < 50500 char* old_lc_all = setlocale(LC_ALL, NULL); if (old_lc_all) { @@ -55,6 +57,7 @@ REGISTER_INI_ENTRIES(); %CLASS_INITS% +// TODO: Deprecated. Will be removed in future #if PHP_VERSION_ID < 50500 setlocale(LC_ALL, old_lc_all); free(old_lc_all); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zephir-0.9.9/test/functionexists.zep new/zephir-0.9.11/test/functionexists.zep --- old/zephir-0.9.9/test/functionexists.zep 1970-01-01 01:00:00.000000000 +0100 +++ new/zephir-0.9.11/test/functionexists.zep 2017-08-02 18:42:58.000000000 +0200 @@ -0,0 +1,38 @@ + +namespace Test; + +class FunctionExists +{ + public function testWithPassedName(string func) -> bool + { + return function_exists(func); + } + + public function testBuiltInFunctions() -> array + { + var func; + array result = []; + + array functions = [ + "substr", + "cubstr", + "ucfirst", + "bcfirst", + "stripos", + "ktripos", + "trim", + "prim" + ]; + + for func in functions { + let result[func] = function_exists(func); + } + + return result; + } + + public function testWithString() -> bool + { + return function_exists("substr"); + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zephir-0.9.9/unit-tests/Extension/FunctionExistsTest.php new/zephir-0.9.11/unit-tests/Extension/FunctionExistsTest.php --- old/zephir-0.9.9/unit-tests/Extension/FunctionExistsTest.php 1970-01-01 01:00:00.000000000 +0100 +++ new/zephir-0.9.11/unit-tests/Extension/FunctionExistsTest.php 2017-08-02 18:42:58.000000000 +0200 @@ -0,0 +1,83 @@ +<?php + +/* + +--------------------------------------------------------------------------+ + | Zephir Language | + +--------------------------------------------------------------------------+ + | Copyright (c) 2013-2017 Zephir Team and contributors | + +--------------------------------------------------------------------------+ + | This source file is subject the MIT license, that is bundled with | + | this package in the file LICENSE, and is available through the | + | world-wide-web at the following url: | + | https://zephir-lang.com/license.html | + | | + | If you did not receive a copy of the MIT license and are unable | + | to obtain it through the world-wide-web, please send a note to | + | [email protected] so we can mail you a copy immediately. | + +--------------------------------------------------------------------------+ +*/ + +namespace Extension; + +use Test\FunctionExists; + +class FunctionExistsTest extends \PHPUnit_Framework_TestCase +{ + /** + * @test + * @dataProvider providerInternalFunctions + * @issue 1547 + * @param string $func The internal (built-in) function name + */ + public function shouldCorrectDetectestExistenceWithPassedName($func) + { + $t = new FunctionExists(); + $this->assertTrue($t->testWithPassedName($func)); + } + + /** + * @test + * @issue 1547 + */ + public function shouldCorrectDetectestExistenceInsideTheZephirCode() + { + $t = new FunctionExists(); + $expected = [ + "substr" => true, + "cubstr" => false, + "ucfirst" => true, + "bcfirst" => false, + "stripos" => true, + "ktripos" => false, + "trim" => true, + "prim" => false, + ]; + + $this->assertSame($expected, $t->testBuiltInFunctions()); + } + + /** + * @test + * @issue 1547 + */ + public function shouldCorrectDetectestExistenceByUsingString() + { + $t = new FunctionExists(); + $this->assertTrue($t->testWithString()); + } + + public function providerInternalFunctions() + { + $allFunctions = get_defined_functions(); + shuffle($allFunctions['internal']); + + $functions = array_map( + function ($value) { + return [$value]; + }, + $allFunctions['internal'] + ); + + return array_slice($functions, 0, 10); + } +}
