Skip to content

Commit

Permalink
Merge pull request #2310 from zephir-lang/development
Browse files Browse the repository at this point in the history
0.15.1
  • Loading branch information
Jeckerson authored Oct 8, 2021
2 parents d56e764 + d5bcff3 commit 643e639
Show file tree
Hide file tree
Showing 13 changed files with 136 additions and 13 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,21 @@ jobs:
- name: Build Zephir PHAR
run: .ci/build-phar.sh

- name: Upload Zephir Phar
uses: actions/upload-artifact@v2
with:
name: zephir.phar
path: zephir.phar

- name: Get the release version
id: get-version
run: |
echo ::set-output name=version::${GITHUB_REF#refs/tags/}
- name: Prepare Release Notes
run: |
./.ci/release-notes.sh ./CHANGELOG.md > ./release-notes.md
- name: Create Release
uses: ncipollo/release-action@v1
with:
Expand Down
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](http://semver.org).

## [Unreleased]

## [0.15.1] - 2021-10-08
### Fixed
- Fix support of `string` type in struct globals [#2308](https://github.com/zephir-lang/zephir/issues/2308)

## [0.15.0] - 2021-10-05
### Added
- Added support for `string` type in php.ini [#2280](https://github.com/zephir-lang/zephir/issues/2280)
Expand Down Expand Up @@ -553,7 +557,8 @@ and this project adheres to [Semantic Versioning](http://semver.org).
[#1524](https://github.com/zephir-lang/zephir/issues/1524)


[Unreleased]: https://github.com/zephir-lang/zephir/compare/0.15.0...HEAD
[Unreleased]: https://github.com/zephir-lang/zephir/compare/0.15.1...HEAD
[0.15.1]: https://github.com/zephir-lang/zephir/compare/0.15.0...0.15.1
[0.15.0]: https://github.com/zephir-lang/zephir/compare/0.14.0...0.15.0
[0.14.0]: https://github.com/zephir-lang/zephir/compare/0.14.0-beta.3...0.14.0
[0.14.0-beta.3]: https://github.com/zephir-lang/zephir/compare/0.14.0-beta.2...0.14.0-beta.3
Expand Down
6 changes: 6 additions & 0 deletions Library/Code/Builder/Struct.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ public function getCDefault(string $name, array $global, string $namespace): str
case 'bool':
return '';

case 'string':
return "\t".$namespace.'_globals->'.$this->simpleName.'.'.$name.' = ZSTR_VAL(zend_string_init(ZEND_STRL("'.$global['default'].'"), 0));';

case 'int':
case 'uint':
case 'long':
Expand Down Expand Up @@ -192,6 +195,9 @@ protected function convertToCType(string $type): string
case 'hash':
return 'HashTable* ';

case 'string':
return 'zend_string* ';

case 'int':
case 'uint':
case 'long':
Expand Down
19 changes: 9 additions & 10 deletions Library/Compiler/CompilerFileFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
* the LICENSE file that was distributed with this source code.
*/

declare(strict_types=1);

namespace Zephir\Compiler;

use Psr\Log\LoggerInterface;
Expand All @@ -19,15 +21,12 @@

final class CompilerFileFactory
{
private $config;
private $filesystem;
private $logger;

public function __construct(
Config $config,
FileSystemInterface $filesystem,
LoggerInterface $logger
) {
private Config $config;
private FileSystemInterface $filesystem;
private LoggerInterface $logger;

public function __construct(Config $config, FileSystemInterface $filesystem, LoggerInterface $logger)
{
$this->config = $config;
$this->filesystem = $filesystem;
$this->logger = $logger;
Expand All @@ -43,7 +42,7 @@ public function __construct(
*
* @return FileInterface
*/
public function create($className, $filePath)
public function create(string $className, string $filePath): FileInterface
{
$compiler = new CompilerFile($this->config, new AliasManager(), $this->filesystem);

Expand Down
2 changes: 1 addition & 1 deletion Library/Zephir.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
final class Zephir
{
public const VERSION = '0.15.0-$Id$';
public const VERSION = '0.15.1-$Id$';

public const LOGO = <<<'ASCII'
_____ __ _
Expand Down
4 changes: 4 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@
"type": "bool",
"default": true
},
"orm.cache_prefix": {
"type": "string",
"default": "prefix-string-"
},
"extension.test_ini_variable": {
"type": "bool",
"default": true,
Expand Down
3 changes: 2 additions & 1 deletion ext/php_stub.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#define PHP_STUB_VERSION "1.0.0"
#define PHP_STUB_EXTNAME "stub"
#define PHP_STUB_AUTHOR "Phalcon Team and contributors"
#define PHP_STUB_ZEPVERSION "0.15.0-$Id$"
#define PHP_STUB_ZEPVERSION "0.15.1-$Id$"
#define PHP_STUB_DESCRIPTION "Description <b>test</b> for<br/>Test Extension."

typedef struct _zephir_struct_db {
Expand All @@ -26,6 +26,7 @@ typedef struct _zephir_struct_db {
typedef struct _zephir_struct_orm {
int cache_level;
zend_bool cache_enable;
zend_string* cache_prefix;
} zephir_struct_orm;

typedef struct _zephir_struct_extension {
Expand Down
2 changes: 2 additions & 0 deletions ext/stub.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ PHP_INI_BEGIN()


STD_PHP_INI_BOOLEAN("stub.orm.cache_enable", "1", PHP_INI_ALL, OnUpdateBool, orm.cache_enable, zend_stub_globals, stub_globals)

STD_PHP_INI_BOOLEAN("extension.test_ini_variable", "1", PHP_INI_ALL, OnUpdateBool, extension.test_ini_variable, zend_stub_globals, stub_globals)
STD_PHP_INI_BOOLEAN("ini-entry.my_setting_1", "1", PHP_INI_ALL, OnUpdateBool, my_setting_1, zend_stub_globals, stub_globals)
STD_PHP_INI_BOOLEAN("stub.test_setting_1", "1", PHP_INI_ALL, OnUpdateBool, test_setting_1, zend_stub_globals, stub_globals)
Expand Down Expand Up @@ -520,6 +521,7 @@ static void php_zephir_init_globals(zend_stub_globals *stub_globals)
stub_globals->db.my_setting_3 = 7.5;
stub_globals->orm.cache_level = 3;

stub_globals->orm.cache_prefix = ZSTR_VAL(zend_string_init(ZEND_STRL("prefix-string-"), 0));

stub_globals->my_setting_1 = 1;
stub_globals->test_setting_1 = 1;
Expand Down
37 changes: 37 additions & 0 deletions ext/stub/globals.zep.c

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

16 changes: 16 additions & 0 deletions ext/stub/globals.zep.h

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

13 changes: 13 additions & 0 deletions release-notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
### Fixed
- Fixed multiple return types in stubs [#2283](https://github.com/zephir-lang/zephir/issues/2283)
- Fixed `bool` return type in stubs [#2272](https://github.com/zephir-lang/zephir/issues/2272)

### Changed
- Removed `.zep` from stubs filenames [#2273](https://github.com/zephir-lang/zephir/issues/2273)

## [0.14.0] - 2021-09-18
### Added
- Added support for `require_once` [#2253](https://github.com/zephir-lang/zephir/issues/2253)

### Changed
- Bumped minimal version of Zephir Parser to `1.4.1`. [#2284](https://github.com/zephir-lang/zephir/issues/2284)
13 changes: 13 additions & 0 deletions stub/globals.zep
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ class Globals
globals_set("orm.cache_level", value);
}

public function setDefaultGlobalsOrmCachePrefix(string value) -> void
{
globals_set("orm.cache_prefix", value);
}

/* Get Default Properties */

/**
Expand Down Expand Up @@ -108,4 +113,12 @@ class Globals
{
return globals_get("orm.cache_level");
}

/**
* @return mixed
*/
public function getDefaultGlobalsOrmCachePrefix()
{
return globals_get("orm.cache_prefix");
}
}
17 changes: 17 additions & 0 deletions tests/Extension/GlobalsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,23 @@ public function testSetStringValue(): void

$this->test->setStringValue('Long Text without any sense...');
$this->assertSame('Long Text without any sense...', $this->test->getDefaultGlobals8());

/**
* Get and set string value from globals struct.
*/
$this->assertSame('prefix-string-', $this->test->getDefaultGlobalsOrmCachePrefix());

$this->test->setDefaultGlobalsOrmCachePrefix('1');
$this->assertSame('1', $this->test->getDefaultGlobalsOrmCachePrefix());

$this->test->setDefaultGlobalsOrmCachePrefix('c');
$this->assertSame('c', $this->test->getDefaultGlobalsOrmCachePrefix());

$this->test->setDefaultGlobalsOrmCachePrefix('char');
$this->assertSame('char', $this->test->getDefaultGlobalsOrmCachePrefix());

$this->test->setDefaultGlobalsOrmCachePrefix('Long Text without any sense...');
$this->assertSame('Long Text without any sense...', $this->test->getDefaultGlobalsOrmCachePrefix());
}

public function testSetBoolValueUsingInt(): void
Expand Down

0 comments on commit 643e639

Please sign in to comment.