Skip to content

Commit 643e639

Browse files
authored
Merge pull request #2310 from zephir-lang/development
0.15.1
2 parents d56e764 + d5bcff3 commit 643e639

File tree

13 files changed

+136
-13
lines changed

13 files changed

+136
-13
lines changed

.github/workflows/release.yml

+10
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,21 @@ jobs:
5555
- name: Build Zephir PHAR
5656
run: .ci/build-phar.sh
5757

58+
- name: Upload Zephir Phar
59+
uses: actions/upload-artifact@v2
60+
with:
61+
name: zephir.phar
62+
path: zephir.phar
63+
5864
- name: Get the release version
5965
id: get-version
6066
run: |
6167
echo ::set-output name=version::${GITHUB_REF#refs/tags/}
6268
69+
- name: Prepare Release Notes
70+
run: |
71+
./.ci/release-notes.sh ./CHANGELOG.md > ./release-notes.md
72+
6373
- name: Create Release
6474
uses: ncipollo/release-action@v1
6575
with:

CHANGELOG.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](http://semver.org).
66

77
## [Unreleased]
88

9+
## [0.15.1] - 2021-10-08
10+
### Fixed
11+
- Fix support of `string` type in struct globals [#2308](https://github.com/zephir-lang/zephir/issues/2308)
12+
913
## [0.15.0] - 2021-10-05
1014
### Added
1115
- Added support for `string` type in php.ini [#2280](https://github.com/zephir-lang/zephir/issues/2280)
@@ -553,7 +557,8 @@ and this project adheres to [Semantic Versioning](http://semver.org).
553557
[#1524](https://github.com/zephir-lang/zephir/issues/1524)
554558

555559

556-
[Unreleased]: https://github.com/zephir-lang/zephir/compare/0.15.0...HEAD
560+
[Unreleased]: https://github.com/zephir-lang/zephir/compare/0.15.1...HEAD
561+
[0.15.1]: https://github.com/zephir-lang/zephir/compare/0.15.0...0.15.1
557562
[0.15.0]: https://github.com/zephir-lang/zephir/compare/0.14.0...0.15.0
558563
[0.14.0]: https://github.com/zephir-lang/zephir/compare/0.14.0-beta.3...0.14.0
559564
[0.14.0-beta.3]: https://github.com/zephir-lang/zephir/compare/0.14.0-beta.2...0.14.0-beta.3

Library/Code/Builder/Struct.php

+6
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ public function getCDefault(string $name, array $global, string $namespace): str
122122
case 'bool':
123123
return '';
124124

125+
case 'string':
126+
return "\t".$namespace.'_globals->'.$this->simpleName.'.'.$name.' = ZSTR_VAL(zend_string_init(ZEND_STRL("'.$global['default'].'"), 0));';
127+
125128
case 'int':
126129
case 'uint':
127130
case 'long':
@@ -192,6 +195,9 @@ protected function convertToCType(string $type): string
192195
case 'hash':
193196
return 'HashTable* ';
194197

198+
case 'string':
199+
return 'zend_string* ';
200+
195201
case 'int':
196202
case 'uint':
197203
case 'long':

Library/Compiler/CompilerFileFactory.php

+9-10
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
* the LICENSE file that was distributed with this source code.
1010
*/
1111

12+
declare(strict_types=1);
13+
1214
namespace Zephir\Compiler;
1315

1416
use Psr\Log\LoggerInterface;
@@ -19,15 +21,12 @@
1921

2022
final class CompilerFileFactory
2123
{
22-
private $config;
23-
private $filesystem;
24-
private $logger;
25-
26-
public function __construct(
27-
Config $config,
28-
FileSystemInterface $filesystem,
29-
LoggerInterface $logger
30-
) {
24+
private Config $config;
25+
private FileSystemInterface $filesystem;
26+
private LoggerInterface $logger;
27+
28+
public function __construct(Config $config, FileSystemInterface $filesystem, LoggerInterface $logger)
29+
{
3130
$this->config = $config;
3231
$this->filesystem = $filesystem;
3332
$this->logger = $logger;
@@ -43,7 +42,7 @@ public function __construct(
4342
*
4443
* @return FileInterface
4544
*/
46-
public function create($className, $filePath)
45+
public function create(string $className, string $filePath): FileInterface
4746
{
4847
$compiler = new CompilerFile($this->config, new AliasManager(), $this->filesystem);
4948

Library/Zephir.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*/
1717
final class Zephir
1818
{
19-
public const VERSION = '0.15.0-$Id$';
19+
public const VERSION = '0.15.1-$Id$';
2020

2121
public const LOGO = <<<'ASCII'
2222
_____ __ _

config.json

+4
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@
119119
"type": "bool",
120120
"default": true
121121
},
122+
"orm.cache_prefix": {
123+
"type": "string",
124+
"default": "prefix-string-"
125+
},
122126
"extension.test_ini_variable": {
123127
"type": "bool",
124128
"default": true,

ext/php_stub.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#define PHP_STUB_VERSION "1.0.0"
1515
#define PHP_STUB_EXTNAME "stub"
1616
#define PHP_STUB_AUTHOR "Phalcon Team and contributors"
17-
#define PHP_STUB_ZEPVERSION "0.15.0-$Id$"
17+
#define PHP_STUB_ZEPVERSION "0.15.1-$Id$"
1818
#define PHP_STUB_DESCRIPTION "Description <b>test</b> for<br/>Test Extension."
1919

2020
typedef struct _zephir_struct_db {
@@ -26,6 +26,7 @@ typedef struct _zephir_struct_db {
2626
typedef struct _zephir_struct_orm {
2727
int cache_level;
2828
zend_bool cache_enable;
29+
zend_string* cache_prefix;
2930
} zephir_struct_orm;
3031

3132
typedef struct _zephir_struct_extension {

ext/stub.c

+2
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ PHP_INI_BEGIN()
254254

255255

256256
STD_PHP_INI_BOOLEAN("stub.orm.cache_enable", "1", PHP_INI_ALL, OnUpdateBool, orm.cache_enable, zend_stub_globals, stub_globals)
257+
257258
STD_PHP_INI_BOOLEAN("extension.test_ini_variable", "1", PHP_INI_ALL, OnUpdateBool, extension.test_ini_variable, zend_stub_globals, stub_globals)
258259
STD_PHP_INI_BOOLEAN("ini-entry.my_setting_1", "1", PHP_INI_ALL, OnUpdateBool, my_setting_1, zend_stub_globals, stub_globals)
259260
STD_PHP_INI_BOOLEAN("stub.test_setting_1", "1", PHP_INI_ALL, OnUpdateBool, test_setting_1, zend_stub_globals, stub_globals)
@@ -520,6 +521,7 @@ static void php_zephir_init_globals(zend_stub_globals *stub_globals)
520521
stub_globals->db.my_setting_3 = 7.5;
521522
stub_globals->orm.cache_level = 3;
522523

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

524526
stub_globals->my_setting_1 = 1;
525527
stub_globals->test_setting_1 = 1;

ext/stub/globals.zep.c

+37
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/stub/globals.zep.h

+16
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

release-notes.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
### Fixed
2+
- Fixed multiple return types in stubs [#2283](https://github.com/zephir-lang/zephir/issues/2283)
3+
- Fixed `bool` return type in stubs [#2272](https://github.com/zephir-lang/zephir/issues/2272)
4+
5+
### Changed
6+
- Removed `.zep` from stubs filenames [#2273](https://github.com/zephir-lang/zephir/issues/2273)
7+
8+
## [0.14.0] - 2021-09-18
9+
### Added
10+
- Added support for `require_once` [#2253](https://github.com/zephir-lang/zephir/issues/2253)
11+
12+
### Changed
13+
- Bumped minimal version of Zephir Parser to `1.4.1`. [#2284](https://github.com/zephir-lang/zephir/issues/2284)

stub/globals.zep

+13
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ class Globals
3535
globals_set("orm.cache_level", value);
3636
}
3737

38+
public function setDefaultGlobalsOrmCachePrefix(string value) -> void
39+
{
40+
globals_set("orm.cache_prefix", value);
41+
}
42+
3843
/* Get Default Properties */
3944

4045
/**
@@ -108,4 +113,12 @@ class Globals
108113
{
109114
return globals_get("orm.cache_level");
110115
}
116+
117+
/**
118+
* @return mixed
119+
*/
120+
public function getDefaultGlobalsOrmCachePrefix()
121+
{
122+
return globals_get("orm.cache_prefix");
123+
}
111124
}

tests/Extension/GlobalsTest.php

+17
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,23 @@ public function testSetStringValue(): void
8383

8484
$this->test->setStringValue('Long Text without any sense...');
8585
$this->assertSame('Long Text without any sense...', $this->test->getDefaultGlobals8());
86+
87+
/**
88+
* Get and set string value from globals struct.
89+
*/
90+
$this->assertSame('prefix-string-', $this->test->getDefaultGlobalsOrmCachePrefix());
91+
92+
$this->test->setDefaultGlobalsOrmCachePrefix('1');
93+
$this->assertSame('1', $this->test->getDefaultGlobalsOrmCachePrefix());
94+
95+
$this->test->setDefaultGlobalsOrmCachePrefix('c');
96+
$this->assertSame('c', $this->test->getDefaultGlobalsOrmCachePrefix());
97+
98+
$this->test->setDefaultGlobalsOrmCachePrefix('char');
99+
$this->assertSame('char', $this->test->getDefaultGlobalsOrmCachePrefix());
100+
101+
$this->test->setDefaultGlobalsOrmCachePrefix('Long Text without any sense...');
102+
$this->assertSame('Long Text without any sense...', $this->test->getDefaultGlobalsOrmCachePrefix());
86103
}
87104

88105
public function testSetBoolValueUsingInt(): void

0 commit comments

Comments
 (0)