Hello community, here is the log from the commit of package php5-phalcon for openSUSE:Factory checked in at 2016-06-19 10:49:56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/php5-phalcon (Old) and /work/SRC/openSUSE:Factory/.php5-phalcon.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "php5-phalcon" Changes: -------- --- /work/SRC/openSUSE:Factory/php5-phalcon/php5-phalcon.changes 2016-06-09 16:06:16.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.php5-phalcon.new/php5-phalcon.changes 2016-06-19 10:49:58.000000000 +0200 @@ -1,0 +2,11 @@ +Mon Jun 6 08:51:31 UTC 2016 - m...@poczta.onet.pl + +- Phalcon 2.0.13 + * Restored Phalcon\Text::camelize behavior #11767 + * Used Zephir v0.9.2 to maintain backwards compatibility + +- Phalcon 2.0.12 + * Fixed regression changes for Phalcon\Mvc\View\Engine\Volt::callMacro #11745 + * Fixed the argument type of Phalcon\Flash::success #11764 + +------------------------------------------------------------------- Old: ---- phalcon-v2.0.11.tar.gz New: ---- phalcon-v2.0.13.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ php5-phalcon.spec ++++++ --- /var/tmp/diff_new_pack.hbQpnG/_old 2016-06-19 10:49:59.000000000 +0200 +++ /var/tmp/diff_new_pack.hbQpnG/_new 2016-06-19 10:49:59.000000000 +0200 @@ -21,7 +21,7 @@ %define _name phalcon Name: %{_php}-%{_name} -Version: 2.0.11 +Version: 2.0.13 Release: 0 Summary: PHP5 Extension Module License: BSD-3-Clause ++++++ phalcon-v2.0.11.tar.gz -> phalcon-v2.0.13.tar.gz ++++++ ++++ 10478 lines of diff (skipped) ++++++ zephir-master.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zephir-master/.gitattributes new/zephir-master/.gitattributes --- old/zephir-master/.gitattributes 1970-01-01 01:00:00.000000000 +0100 +++ new/zephir-master/.gitattributes 2016-05-27 18:50:25.000000000 +0200 @@ -0,0 +1 @@ +*.html ident diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zephir-master/.travis.yml new/zephir-master/.travis.yml --- old/zephir-master/.travis.yml 2016-05-09 13:14:56.000000000 +0200 +++ new/zephir-master/.travis.yml 2016-05-27 18:50:25.000000000 +0200 @@ -11,8 +11,17 @@ - 5.6 - 7.0 +git: + depth: 1 + cache: - - apt + apt: true + ccache: true + timeout: 691200 + directories: + - vendor + - $HOME/.ccache + - $HOME/.composer/cache before_install: - if [[ "$TRAVIS_PULL_REQUEST" == "false" ]]; then openssl aes-256-cbc -k "$encryption_key" -in id_rsa.enc -out ~/.ssh/id_rsa -d; chmod 600 ~/.ssh/id_rsa; fi @@ -23,6 +32,7 @@ - if [[ "$TRAVIS_PULL_REQUEST" == "false" ]]; then git remote set-url origin g...@github.com:phalcon/zephir.git; fi install: + - export CC="ccache gcc" - export LD_LIBRARY_PATH="$TRAVIS_BUILD_DIR/build/lib":$LD_LIBRARY_PATH - export LIBRARY_PATH="$TRAVIS_BUILD_DIR/build/lib":$LIBRARY_PATH - export C_INCLUDE_PATH="$TRAVIS_BUILD_DIR/build/include" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zephir-master/Library/ClassDefinition.php new/zephir-master/Library/ClassDefinition.php --- old/zephir-master/Library/ClassDefinition.php 2016-05-09 13:14:56.000000000 +0200 +++ new/zephir-master/Library/ClassDefinition.php 2016-05-27 18:50:25.000000000 +0200 @@ -857,13 +857,13 @@ { foreach ($interfaceDefinition->getMethods() as $method) { if (!$classDefinition->hasMethod($method->getName())) { - throw new CompilerException("Class " . $classDefinition->getCompleteName() . " must implement method: " . $method->getName() . " defined on interface: " . $interfaceDefinition->getCompleteName()); + throw new CompilerException("Class " . $classDefinition->getCompleteName() . " must implement a method called: \"" . $method->getName() . "\" as requirement of interface: \"" . $interfaceDefinition->getCompleteName() . "\""); } if ($method->hasParameters()) { $implementedMethod = $classDefinition->getMethod($method->getName()); if ($implementedMethod->getNumberOfRequiredParameters() > $method->getNumberOfRequiredParameters() || $implementedMethod->getNumberOfParameters() < $method->getNumberOfParameters()) { - throw new CompilerException("Class " . $classDefinition->getCompleteName() . "::" . $method->getName() . "() does not have the same number of required parameters in interface: " . $interfaceDefinition->getCompleteName()); + throw new CompilerException("Class " . $classDefinition->getCompleteName() . "::" . $method->getName() . "() does not have the same number of required parameters in interface: \"" . $interfaceDefinition->getCompleteName() . "\""); } } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zephir-master/Library/Commands/CommandHelp.php new/zephir-master/Library/Commands/CommandHelp.php --- old/zephir-master/Library/Commands/CommandHelp.php 2016-05-09 13:14:56.000000000 +0200 +++ new/zephir-master/Library/Commands/CommandHelp.php 2016-05-27 18:50:25.000000000 +0200 @@ -72,13 +72,14 @@ /** * Executes the command + * * @param Config $config * @param Logger $logger */ public function execute(Config $config, Logger $logger) { echo self::LOGO, PHP_EOL; - echo "Zephir version " , Compiler::VERSION, PHP_EOL, PHP_EOL; + echo "Zephir version " , Compiler::getCurrentVersion(), PHP_EOL, PHP_EOL; echo "Usage: ", PHP_EOL; echo "\tcommand [options]", PHP_EOL; echo PHP_EOL; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zephir-master/Library/Commands/CommandVersion.php new/zephir-master/Library/Commands/CommandVersion.php --- old/zephir-master/Library/Commands/CommandVersion.php 2016-05-09 13:14:56.000000000 +0200 +++ new/zephir-master/Library/Commands/CommandVersion.php 2016-05-27 18:50:25.000000000 +0200 @@ -67,6 +67,6 @@ */ public function execute(Config $config, Logger $logger) { - echo Compiler::VERSION, PHP_EOL; + echo Compiler::getCurrentVersion(), PHP_EOL; } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zephir-master/Library/Compiler.php new/zephir-master/Library/Compiler.php --- old/zephir-master/Library/Compiler.php 2016-05-09 13:14:56.000000000 +0200 +++ new/zephir-master/Library/Compiler.php 2016-05-27 18:50:25.000000000 +0200 @@ -116,6 +116,11 @@ protected static $loadedPrototypes = false; /** + * @var string + */ + protected static $currentVersion; + + /** * @var array */ protected $extraFiles = array(); @@ -232,10 +237,14 @@ $buildType = 'Release'; if (strpos($buildLog, 'Debug_TS\\') !== false) { $buildType = 'Debug_TS'; - } else if (strpos($buildLog, 'Release_TS\\') !== false) { - $buildType = 'Release_TS'; - } else if (strpos($buildLog, 'Debug\\') !== false) { - $buildType = 'Debug'; + } else { + if (strpos($buildLog, 'Release_TS\\') !== false) { + $buildType = 'Release_TS'; + } else { + if (strpos($buildLog, 'Debug\\') !== false) { + $buildType = 'Debug'; + } + } } if (strpos($buildLog, 'x64\\'.$buildType) !== false) { @@ -679,6 +688,38 @@ } /** + * Returns the current version + the ident if available + * + * @return string + */ + public static function getCurrentVersion() + { + $version = '$Id$'; + if (strlen($version) != 4) { + return self::VERSION . '-' . substr($version, 0, 10); + } + + if (!Utils::isWindows()) { + if (self::$currentVersion === null) { + if (file_exists(__DIR__ . '/../.git')) { + exec('cd ' . __DIR__ . '/.. && git log --format="%H" -n 1', $xversion); + if (isset($xversion[0]) && strlen($xversion[0]) > 10) { + self::$currentVersion = substr($xversion[0], 0, 10); + } else { + self::$currentVersion = false; + } + } + } + + if (self::$currentVersion) { + return self::VERSION . '-' . self::$currentVersion; + } + } + + return self::VERSION; + } + + /** * Checks if the current directory is a valid Zephir project * * @return string @@ -699,13 +740,15 @@ $this->fileSystem->initialize(); } - if (!$this->fileSystem->exists(self::VERSION)) { + $version = self::getCurrentVersion(); + + if (!$this->fileSystem->exists($version)) { if (!$this->checkIfPhpized()) { $this->logger->output( 'Zephir version has changed, use "zephir fullclean" to perform a full clean of the project' ); } - $this->fileSystem->makeDirectory(self::VERSION); + $this->fileSystem->makeDirectory($version); } return $namespace; @@ -718,24 +761,26 @@ */ protected function getGccVersion() { + $version = self::getCurrentVersion(); + if (!Utils::isWindows()) { - if ($this->fileSystem->exists(self::VERSION . '/gcc-version')) { - return $this->fileSystem->read(self::VERSION . '/gcc-version'); + if ($this->fileSystem->exists($version . '/gcc-version')) { + return $this->fileSystem->read($version . '/gcc-version'); } - $this->fileSystem->system('gcc -v', 'stderr', self::VERSION . '/gcc-version-temp'); - $lines = $this->fileSystem->file(self::VERSION . '/gcc-version-temp'); + $this->fileSystem->system('gcc -v', 'stderr', $version . '/gcc-version-temp'); + $lines = $this->fileSystem->file($version . '/gcc-version-temp'); foreach ($lines as $line) { if (strpos($line, 'LLVM') !== false) { - $this->fileSystem->write(self::VERSION . '/gcc-version', '4.8.0'); + $this->fileSystem->write($version . '/gcc-version', '4.8.0'); return '4.8.0'; } } $lastLine = $lines[count($lines) - 1]; if (preg_match('/[0-9]+\.[0-9]+\.[0-9]+/', $lastLine, $matches)) { - $this->fileSystem->write(self::VERSION . '/gcc-version', $matches[0]); + $this->fileSystem->write($version . '/gcc-version', $matches[0]); return $matches[0]; } } @@ -776,10 +821,13 @@ */ public function getPhpIncludeDirs() { + $version = self::getCurrentVersion(); + if (!Utils::isWindows()) { - $this->fileSystem->system('php-config --includes', 'stdout', self::VERSION . '/php-includes'); + $this->fileSystem->system('php-config --includes', 'stdout', $version . '/php-includes'); } - return trim($this->fileSystem->read(self::VERSION . '/php-includes')); + + return trim($this->fileSystem->read($version . '/php-includes')); } /** @@ -788,6 +836,7 @@ public function preCompileHeaders() { if (!Utils::isWindows()) { + $version = self::getCurrentVersion(); $phpIncludes = $this->getPhpIncludeDirs(); foreach (new \DirectoryIterator('ext/kernel') as $file) { @@ -799,7 +848,7 @@ 'cd ext && gcc -c kernel/' . $file->getBaseName() . ' -I. ' . $phpIncludes . ' -o kernel/' . $file->getBaseName() . '.gch', 'stdout', - self::VERSION . '/compile-header' + $version . '/compile-header' ); } else { if (filemtime($path) > filemtime($path . '.gch')) { @@ -807,7 +856,7 @@ 'cd ext && gcc -c kernel/' . $file->getBaseName() . ' -I. ' . $phpIncludes . ' -o kernel/' . $file->getBaseName() . '.gch', 'stdout', - self::VERSION . '/compile-header' + $version . '/compile-header' ); } } @@ -1106,17 +1155,19 @@ $needConfigure |= $this->createProjectFiles($extensionName); $needConfigure |= $this->checkIfPhpized(); + $version = self::getCurrentVersion(); + /** * When a new file is added or removed we need to run configure again */ if (!($command instanceof CommandGenerate)) { - if (!$this->fileSystem->exists(self::VERSION . '/compiled-files-sum')) { + if (!$this->fileSystem->exists($version . '/compiled-files-sum')) { $needConfigure = true; - $this->fileSystem->write(self::VERSION . '/compiled-files-sum', $hash); + $this->fileSystem->write($version . '/compiled-files-sum', $hash); } else { - if ($this->fileSystem->read(self::VERSION . '/compiled-files-sum') != $hash) { + if ($this->fileSystem->read($version . '/compiled-files-sum') != $hash) { $needConfigure = true; - $this->fileSystem->write(self::VERSION . '/compiled-files-sum', $hash); + $this->fileSystem->write($version . '/compiled-files-sum', $hash); } } } @@ -1327,10 +1378,13 @@ $namespace = $this->checkDirectory(); $this->logger->output('Running tests...'); - system( - 'export CC="gcc" && export CFLAGS="-O0 -g" && export NO_INTERACTION=1 && cd ext && make test', - $exit - ); + + if (!Utils::isWindows()) { + system( + 'export CC="gcc" && export CFLAGS="-O0 -g" && export NO_INTERACTION=1 && cd ext && make test', + $exit + ); + } } /** @@ -2134,6 +2188,8 @@ throw new Exception('Template php_project.h doesn`t exist'); } + $version = self::getCurrentVersion(); + $toReplace = array( '%PROJECT_LOWER_SAFE%' => strtolower($safeProject), '%PROJECT_LOWER%' => strtolower($project), @@ -2143,7 +2199,7 @@ '%PROJECT_AUTHOR%' => utf8_decode($this->config->get('author')), '%PROJECT_VERSION%' => utf8_decode($this->config->get('version')), '%PROJECT_DESCRIPTION%' => utf8_decode($this->config->get('description')), - '%PROJECT_ZEPVERSION%' => self::VERSION, + '%PROJECT_ZEPVERSION%' => $version, '%EXTENSION_GLOBALS%' => $globalCode, '%EXTENSION_STRUCT_GLOBALS%' => $globalStruct ); @@ -2333,9 +2389,6 @@ } } else { switch ($ar[0]) { - default: - $version = trim($ar[1]); - break; case '<': $operator = '<='; $operatorCmd = '--max-version'; @@ -2346,14 +2399,17 @@ $operatorCmd = '--atleast-version'; $version = trim($ar[1]); break; + default: + $version = trim($ar[1]); + break; } } $toReplace = array( '%PACKAGE_LOWER%' => strtolower($pkg), '%PACKAGE_UPPER%' => strtoupper($pkg), - '%PACKAGE_REQUESTED_VERSION%' => $operator.' '.$version, - '%PACKAGE_PKG_CONFIG_COMPARE_VERSION%' => $operatorCmd.'='.$version, + '%PACKAGE_REQUESTED_VERSION%' => $operator . ' ' . $version, + '%PACKAGE_PKG_CONFIG_COMPARE_VERSION%' => $operatorCmd . '=' . $version, ); foreach ($toReplace as $mark => $replace) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zephir-master/Library/CompilerFile.php new/zephir-master/Library/CompilerFile.php --- old/zephir-master/Library/CompilerFile.php 2016-05-09 13:14:56.000000000 +0200 +++ new/zephir-master/Library/CompilerFile.php 2016-05-27 18:50:25.000000000 +0200 @@ -153,7 +153,7 @@ public function genIR(Compiler $compiler) { $normalizedPath = str_replace(array(DIRECTORY_SEPARATOR, ":", '/'), '_', realpath($this->_filePath)); - $compilePath = DIRECTORY_SEPARATOR . Compiler::VERSION . DIRECTORY_SEPARATOR . $normalizedPath . ".js"; + $compilePath = DIRECTORY_SEPARATOR . Compiler::getCurrentVersion() . DIRECTORY_SEPARATOR . $normalizedPath . ".js"; $zepRealPath = realpath($this->_filePath); $changed = false; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zephir-master/Library/FileSystem/HardDisk.php new/zephir-master/Library/FileSystem/HardDisk.php --- old/zephir-master/Library/FileSystem/HardDisk.php 2016-05-09 13:14:56.000000000 +0200 +++ new/zephir-master/Library/FileSystem/HardDisk.php 2016-05-27 18:50:25.000000000 +0200 @@ -19,6 +19,8 @@ namespace Zephir\FileSystem; +use Zephir\Compiler; + /** * HardDisk * @@ -191,7 +193,7 @@ return hash_file($algorithm, $path); } else { $changed = false; - $cacheFile = $this->basePath . str_replace(array(DIRECTORY_SEPARATOR, ':', '/'), '_', $path) . '.md5'; + $cacheFile = $this->basePath . Compiler::getCurrentVersion() . DIRECTORY_SEPARATOR . str_replace(array(DIRECTORY_SEPARATOR, ':', '/'), '_', $path) . '.md5'; if (!file_exists($cacheFile)) { $hash = hash_file($algorithm, $path); file_put_contents($cacheFile, $hash); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zephir-master/generated/ZendEngine_2/strings.zep.c new/zephir-master/generated/ZendEngine_2/strings.zep.c --- old/zephir-master/generated/ZendEngine_2/strings.zep.c 2016-05-09 13:14:56.000000000 +0200 +++ new/zephir-master/generated/ZendEngine_2/strings.zep.c 2016-05-27 18:50:25.000000000 +0200 @@ -322,6 +322,19 @@ } +PHP_METHOD(Test_Strings, testStripcslashes) { + + zval *str; + + zephir_fetch_params(0, 1, 0, &str); + + + + zephir_stripcslashes(return_value, str TSRMLS_CC); + return; + +} + PHP_METHOD(Test_Strings, testHardcodedMultilineString) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zephir-master/generated/ZendEngine_2/strings.zep.h new/zephir-master/generated/ZendEngine_2/strings.zep.h --- old/zephir-master/generated/ZendEngine_2/strings.zep.h 2016-05-09 13:14:56.000000000 +0200 +++ new/zephir-master/generated/ZendEngine_2/strings.zep.h 2016-05-27 18:50:25.000000000 +0200 @@ -23,6 +23,7 @@ PHP_METHOD(Test_Strings, testSubstr4); PHP_METHOD(Test_Strings, testAddslashes); PHP_METHOD(Test_Strings, testStripslashes); +PHP_METHOD(Test_Strings, testStripcslashes); PHP_METHOD(Test_Strings, testHardcodedMultilineString); PHP_METHOD(Test_Strings, testEchoMultilineString); PHP_METHOD(Test_Strings, testTrimMultilineString); @@ -124,6 +125,10 @@ ZEND_ARG_INFO(0, str) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_INFO_EX(arginfo_test_strings_teststripcslashes, 0, 0, 1) + ZEND_ARG_INFO(0, str) +ZEND_END_ARG_INFO() + ZEPHIR_INIT_FUNCS(test_strings_method_entry) { PHP_ME(Test_Strings, camelize, arginfo_test_strings_camelize, ZEND_ACC_PUBLIC) PHP_ME(Test_Strings, uncamelize, arginfo_test_strings_uncamelize, ZEND_ACC_PUBLIC) @@ -145,6 +150,7 @@ PHP_ME(Test_Strings, testSubstr4, arginfo_test_strings_testsubstr4, ZEND_ACC_PUBLIC) PHP_ME(Test_Strings, testAddslashes, arginfo_test_strings_testaddslashes, ZEND_ACC_PUBLIC) PHP_ME(Test_Strings, testStripslashes, arginfo_test_strings_teststripslashes, ZEND_ACC_PUBLIC) + PHP_ME(Test_Strings, testStripcslashes, arginfo_test_strings_teststripcslashes, ZEND_ACC_PUBLIC) PHP_ME(Test_Strings, testHardcodedMultilineString, NULL, ZEND_ACC_PUBLIC) PHP_ME(Test_Strings, testEchoMultilineString, NULL, ZEND_ACC_PUBLIC) PHP_ME(Test_Strings, testTrimMultilineString, NULL, ZEND_ACC_PUBLIC) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zephir-master/generated/ZendEngine_3/strings.zep.c new/zephir-master/generated/ZendEngine_3/strings.zep.c --- old/zephir-master/generated/ZendEngine_3/strings.zep.c 2016-05-09 13:14:56.000000000 +0200 +++ new/zephir-master/generated/ZendEngine_3/strings.zep.c 2016-05-27 18:50:25.000000000 +0200 @@ -395,6 +395,22 @@ } +PHP_METHOD(Test_Strings, testStripcslashes) { + + zval *str, str_sub; + ZEPHIR_INIT_THIS(); + + ZVAL_UNDEF(&str_sub); + + zephir_fetch_params(0, 1, 0, &str); + + + + zephir_stripcslashes(return_value, str TSRMLS_CC); + return; + +} + PHP_METHOD(Test_Strings, testHardcodedMultilineString) { ZEPHIR_INIT_THIS(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zephir-master/generated/ZendEngine_3/strings.zep.h new/zephir-master/generated/ZendEngine_3/strings.zep.h --- old/zephir-master/generated/ZendEngine_3/strings.zep.h 2016-05-09 13:14:56.000000000 +0200 +++ new/zephir-master/generated/ZendEngine_3/strings.zep.h 2016-05-27 18:50:25.000000000 +0200 @@ -23,6 +23,7 @@ PHP_METHOD(Test_Strings, testSubstr4); PHP_METHOD(Test_Strings, testAddslashes); PHP_METHOD(Test_Strings, testStripslashes); +PHP_METHOD(Test_Strings, testStripcslashes); PHP_METHOD(Test_Strings, testHardcodedMultilineString); PHP_METHOD(Test_Strings, testEchoMultilineString); PHP_METHOD(Test_Strings, testTrimMultilineString); @@ -124,6 +125,10 @@ ZEND_ARG_INFO(0, str) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_INFO_EX(arginfo_test_strings_teststripcslashes, 0, 0, 1) + ZEND_ARG_INFO(0, str) +ZEND_END_ARG_INFO() + ZEPHIR_INIT_FUNCS(test_strings_method_entry) { PHP_ME(Test_Strings, camelize, arginfo_test_strings_camelize, ZEND_ACC_PUBLIC) PHP_ME(Test_Strings, uncamelize, arginfo_test_strings_uncamelize, ZEND_ACC_PUBLIC) @@ -145,6 +150,7 @@ PHP_ME(Test_Strings, testSubstr4, arginfo_test_strings_testsubstr4, ZEND_ACC_PUBLIC) PHP_ME(Test_Strings, testAddslashes, arginfo_test_strings_testaddslashes, ZEND_ACC_PUBLIC) PHP_ME(Test_Strings, testStripslashes, arginfo_test_strings_teststripslashes, ZEND_ACC_PUBLIC) + PHP_ME(Test_Strings, testStripcslashes, arginfo_test_strings_teststripcslashes, ZEND_ACC_PUBLIC) PHP_ME(Test_Strings, testHardcodedMultilineString, NULL, ZEND_ACC_PUBLIC) PHP_ME(Test_Strings, testEchoMultilineString, NULL, ZEND_ACC_PUBLIC) PHP_ME(Test_Strings, testTrimMultilineString, NULL, ZEND_ACC_PUBLIC) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zephir-master/kernels/ZendEngine2/string.c new/zephir-master/kernels/ZendEngine2/string.c --- old/zephir-master/kernels/ZendEngine2/string.c 2016-05-09 13:14:56.000000000 +0200 +++ new/zephir-master/kernels/ZendEngine2/string.c 2016-05-27 18:50:25.000000000 +0200 @@ -252,13 +252,14 @@ } /** - * Convert dash/underscored texts returning camelized (an optional delimiter can be specified) + * Convert dash/underscored texts returning camelized + * (an optional delimiter can be specified as character-mask as for ltrim) */ void zephir_camelize(zval *return_value, const zval *str, const zval *delimiter) { - int i, len, first = 0; + int i, len, delim_len, pre_del = 1; smart_str camelize_str = {0}; - char *marker, ch, delim; + char *marker, ch, *delim; if (unlikely(Z_TYPE_P(str) != IS_STRING)) { zend_error(E_WARNING, "Invalid arguments supplied for camelize()"); @@ -266,11 +267,13 @@ } if (delimiter == NULL || Z_TYPE_P(delimiter) == IS_NULL) { - delim = '_'; - } else if (Z_TYPE_P(delimiter) == IS_STRING && Z_STRLEN_P(delimiter) == 1) { - delim = *(Z_STRVAL_P(delimiter)); + delim = "_-"; + delim_len = 2; + } else if (Z_TYPE_P(delimiter) == IS_STRING && Z_STRLEN_P(delimiter) > 0) { + delim = Z_STRVAL_P(delimiter); + delim_len = Z_STRLEN_P(delimiter); } else { - zend_error(E_WARNING, "Second argument passed to the camelize() must be a string of one character"); + zend_error(E_WARNING, "The second argument passed to the camelize() must be a string containing at least one character"); RETURN_EMPTY_STRING(); } @@ -278,30 +281,18 @@ len = Z_STRLEN_P(str); for (i = 0; i < len; i++) { - ch = marker[i]; - if (first == 0) { - - if (ch == delim) { - continue; - } - - first = 1; - smart_str_appendc(&camelize_str, toupper(ch)); + if (memchr(delim, ch, delim_len)) { + pre_del = 1; continue; } - - if (ch == delim) { - if (i != (len - 1)) { - i++; - ch = marker[i]; - smart_str_appendc(&camelize_str, toupper(ch)); - } - continue; + if (pre_del == 1) { + smart_str_appendc(&camelize_str, toupper(ch)); + pre_del = 0; + } else { + smart_str_appendc(&camelize_str, tolower(ch)); } - - smart_str_appendc(&camelize_str, tolower(ch)); } smart_str_0(&camelize_str); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zephir-master/kernels/ZendEngine3/main.c new/zephir-master/kernels/ZendEngine3/main.c --- old/zephir-master/kernels/ZendEngine3/main.c 2016-05-09 13:14:56.000000000 +0200 +++ new/zephir-master/kernels/ZendEngine3/main.c 2016-05-27 18:50:25.000000000 +0200 @@ -305,6 +305,9 @@ return (int) retval; } +/** + * Checks whether a variable has a scalar type + */ int zephir_is_scalar(zval *var) { switch (Z_TYPE_P(var)) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zephir-master/kernels/ZendEngine3/string.c new/zephir-master/kernels/ZendEngine3/string.c --- old/zephir-master/kernels/ZendEngine3/string.c 2016-05-09 13:14:56.000000000 +0200 +++ new/zephir-master/kernels/ZendEngine3/string.c 2016-05-27 18:50:25.000000000 +0200 @@ -568,14 +568,15 @@ } /** - * Convert dash/underscored texts returning camelized (an optional delimiter can be specified) + * Convert dash/underscored texts returning camelized + * (an optional delimiter can be specified as character-mask as for ltrim) */ void zephir_camelize(zval *return_value, const zval *str, const zval *delimiter) { - int i, len, first = 0; + int i, len, delim_len, pre_del = 1; smart_str camelize_str = {0}; - char *marker, ch, delim; + char *marker, ch, *delim; if (unlikely(Z_TYPE_P(str) != IS_STRING)) { zend_error(E_WARNING, "Invalid arguments supplied for camelize()"); @@ -583,11 +584,13 @@ } if (delimiter == NULL || Z_TYPE_P(delimiter) == IS_NULL) { - delim = '_'; - } else if (Z_TYPE_P(delimiter) == IS_STRING && Z_STRLEN_P(delimiter) == 1) { - delim = *(Z_STRVAL_P(delimiter)); + delim = "_-"; + delim_len = 2; + } else if (Z_TYPE_P(delimiter) == IS_STRING && Z_STRLEN_P(delimiter) > 0) { + delim = Z_STRVAL_P(delimiter); + delim_len = Z_STRLEN_P(delimiter); } else { - zend_error(E_WARNING, "Second argument passed to the camelize() must be a string of one character"); + zend_error(E_WARNING, "The second argument passed to the camelize() must be a string containing at least one character"); RETURN_EMPTY_STRING(); } @@ -595,30 +598,18 @@ len = Z_STRLEN_P(str); for (i = 0; i < len; i++) { - ch = marker[i]; - if (first == 0) { - - if (ch == delim) { - continue; - } - - first = 1; - smart_str_appendc(&camelize_str, toupper(ch)); + if (memchr(delim, ch, delim_len)) { + pre_del = 1; continue; } - - if (ch == delim) { - if (i != (len - 1)) { - i++; - ch = marker[i]; - smart_str_appendc(&camelize_str, toupper(ch)); - } - continue; + if (pre_del == 1) { + smart_str_appendc(&camelize_str, toupper(ch)); + pre_del = 0; + } else { + smart_str_appendc(&camelize_str, tolower(ch)); } - - smart_str_appendc(&camelize_str, tolower(ch)); } smart_str_0(&camelize_str); @@ -631,7 +622,7 @@ } /** - * Convert a camelized to a dash/underscored texts (an optional delimiter can be specified) + * Convert a camelized to a dash/underscored texts (a single-character optional delimiter can be specified) */ void zephir_uncamelize(zval *return_value, const zval *str, const zval *delimiter) { @@ -1333,5 +1324,25 @@ if (unlikely(use_copy)) { zval_dtor(©); + } +} + +void zephir_stripcslashes(zval *return_value, zval *str) +{ + zval copy; + int use_copy = 0; + + if (unlikely(Z_TYPE_P(str) != IS_STRING)) { + use_copy = zend_make_printable_zval(str, ©); + if (use_copy) { + str = © + } + } + + ZVAL_STRINGL(return_value, Z_STRVAL_P(str), Z_STRLEN_P(str)); + php_stripcslashes(Z_STR_P(return_value)); + + if (unlikely(use_copy)) { + zval_dtor(©); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zephir-master/kernels/ZendEngine3/string.h new/zephir-master/kernels/ZendEngine3/string.h --- old/zephir-master/kernels/ZendEngine3/string.h 2016-05-09 13:14:56.000000000 +0200 +++ new/zephir-master/kernels/ZendEngine3/string.h 2016-05-27 18:50:25.000000000 +0200 @@ -79,6 +79,7 @@ void zephir_ucfirst(zval *return_value, zval *s); void zephir_addslashes(zval *return_value, zval *str); void zephir_stripslashes(zval *return_value, zval *str); +void zephir_stripcslashes(zval *return_value, zval *str); void zephir_unique_key(zval *return_value, const zval *prefix, zval *value); void zephir_append_printable_array(smart_str *implstr, const zval *value); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zephir-master/test/strings.zep new/zephir-master/test/strings.zep --- old/zephir-master/test/strings.zep 2016-05-09 13:14:56.000000000 +0200 +++ new/zephir-master/test/strings.zep 2016-05-27 18:50:25.000000000 +0200 @@ -102,6 +102,11 @@ return stripslashes(str); } + public function testStripcslashes(var str) -> string + { + return stripcslashes(str); + } + public function testHardcodedMultilineString() { return " diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zephir-master/unit-tests/Extension/BuiltIn/StringMethodTest.php new/zephir-master/unit-tests/Extension/BuiltIn/StringMethodTest.php --- old/zephir-master/unit-tests/Extension/BuiltIn/StringMethodTest.php 2016-05-09 13:14:56.000000000 +0200 +++ new/zephir-master/unit-tests/Extension/BuiltIn/StringMethodTest.php 2016-05-27 18:50:25.000000000 +0200 @@ -36,7 +36,7 @@ /** * @dataProvider providerCamelizeWrongSecondParam * @expectedException \PHPUnit_Framework_Error_Warning - * @expectedExceptionMessage Second argument passed to the camelize() must be a string of one character + * @expectedExceptionMessage The second argument passed to the camelize() must be a string containing at least one character */ public function testCamelizeWrongSecondParam($delimiter) { @@ -152,6 +152,9 @@ ["came_li_ze", 'CameLiZe', null], ["came#li#ze", 'CameLiZe', "#" ], ["came li ze", 'CameLiZe', " " ], + ["came.li^ze", 'CameLiZe', ".^"], + ["c_a-m_e-l_i-z_e", 'CAMELIZE', "-_"], + ["c_a-m_e-l_i-z_e", 'CAMELIZE', null], ["came.li.ze", 'CameLiZe', "." ], ["came-li-ze", 'CameLiZe', "-" ], ["c+a+m+e+l+i+z+e", 'CAMELIZE', "+" ], @@ -177,7 +180,6 @@ { return [ ["" ], - ["--" ], [true ], [false ], [1 ], diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zephir-master/unit-tests/Extension/StringTest.php new/zephir-master/unit-tests/Extension/StringTest.php --- old/zephir-master/unit-tests/Extension/StringTest.php 2016-05-09 13:14:56.000000000 +0200 +++ new/zephir-master/unit-tests/Extension/StringTest.php 2016-05-27 18:50:25.000000000 +0200 @@ -34,7 +34,7 @@ /** * @dataProvider providerCamelizeWrongSecondParam * @expectedException \PHPUnit_Framework_Error_Warning - * @expectedExceptionMessage Second argument passed to the camelize() must be a string of one character + * @expectedExceptionMessage The second argument passed to the camelize() must be a string containing at least one character */ public function testCamelizeWrongSecondParam($delimiter) { @@ -170,6 +170,18 @@ $this->assertTrue($t->testStripslashes(addslashes("hello\0world")) == "hello\0world"); } + public function testStripcslashes() + { + $t = new \Test\Strings(); + + parent::assertSame( + stripcslashes('\abcd\e\f\g\h\i\j\k\l\m\n\o\pqrstuvwxy\z'), + $t->testStripcslashes('\abcd\e\f\g\h\i\j\k\l\m\n\o\pqrstuvwxy\z') + ); + parent::assertSame(stripcslashes('\065\x64'), $t->testStripcslashes('\065\x64')); + parent::assertSame(stripcslashes(''), $t->testStripcslashes('')); + } + public function testMultilineStrings() { $hardcodedString = ' @@ -197,6 +209,9 @@ ["came_li_ze", 'CameLiZe', null], ["came#li#ze", 'CameLiZe', "#" ], ["came li ze", 'CameLiZe', " " ], + ["came.li^ze", 'CameLiZe', ".^"], + ["c_a-m_e-l_i-z_e", 'CAMELIZE', "-_"], + ["c_a-m_e-l_i-z_e", 'CAMELIZE', null], ["came.li.ze", 'CameLiZe', "." ], ["came-li-ze", 'CameLiZe', "-" ], ["c+a+m+e+l+i+z+e", 'CAMELIZE', "+" ], @@ -222,7 +237,6 @@ { return [ ["" ], - ["--" ], [true ], [false ], [1 ],