-
Notifications
You must be signed in to change notification settings - Fork 711
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds support for PHP8.0, dropping support for PHP7.0 and below. Backwards incompatible changes: - Dropped support for php asp tags in templates (removed from php since php7.0) - Dropped deprecated API calls that where only accessible through SmartyBC - Dropped support for {php} and {include_php} tags and embedded PHP in templates. Embedded PHP will now be passed through as is. - Removed all PHP_VERSION_ID and compare_version checks and conditional code blocks that are now no longer required - Dropped deprecated SMARTY_RESOURCE_CHAR_SET and SMARTY_RESOURCE_DATE_FORMAT constants - Dropped deprecated Smarty::muteExpectedErrors and Smarty::unmuteExpectedErrors API methods - Dropped deprecated $smarty->getVariable() method. Use $smarty->getTemplateVars() instead. - $smarty->registerResource() no longer accepts an array of callback functions See the changelog for more details. Switched CI from Travis to Github CI.
- Loading branch information
Showing
276 changed files
with
3,711 additions
and
6,757 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions | ||
|
||
on: | ||
- pull_request | ||
- push | ||
|
||
name: CI | ||
|
||
jobs: | ||
tests: | ||
name: Tests | ||
|
||
runs-on: ${{ matrix.os }} | ||
|
||
env: | ||
PHP_EXTENSIONS: dom, json, libxml, mbstring, pdo_sqlite, soap, xml, xmlwriter | ||
PHP_INI_VALUES: assert.exception=1, zend.assertions=1 | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: | ||
- ubuntu-latest | ||
|
||
php-version: | ||
- "7.1" | ||
- "7.2" | ||
- "7.3" | ||
- "7.4" | ||
- "8.0" | ||
|
||
compiler: | ||
- default | ||
|
||
include: | ||
- os: ubuntu-latest | ||
php-version: "8.0" | ||
compiler: jit | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Override PHP ini values for JIT compiler | ||
if: matrix.compiler == 'jit' | ||
run: echo "PHP_INI_VALUES::assert.exception=1, zend.assertions=1, opcache.enable=1, opcache.enable_cli=1, opcache.optimization_level=-1, opcache.jit=1255, opcache.jit_buffer_size=32M" >> $GITHUB_ENV | ||
|
||
- name: Install PHP with extensions | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-version }} | ||
coverage: pcov | ||
extensions: ${{ env.PHP_EXTENSIONS }} | ||
ini-values: ${{ env.PHP_INI_VALUES }} | ||
|
||
- name: Validate composer.json and composer.lock | ||
run: composer validate | ||
|
||
- name: Cache Composer packages | ||
id: composer-cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: vendor | ||
key: ${{ runner.os }}-php-${{ matrix.php-version }}-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-php-${{ matrix.php-version }}- | ||
- name: Install dependencies | ||
if: steps.composer-cache.outputs.cache-hit != 'true' | ||
run: composer install --prefer-dist --no-progress --no-suggest | ||
|
||
- name: Run tests with phpunit | ||
run: ./phpunit.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,5 +9,6 @@ utilies/*.php | |
|
||
# Dev | ||
phpunit* | ||
.phpunit.result.cache | ||
vendor/* | ||
composer.lock |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
"keywords": [ | ||
"templating" | ||
], | ||
"homepage": "http://www.smarty.net", | ||
"homepage": "https://www.smarty.net", | ||
"license": "LGPL-3.0", | ||
"authors": [ | ||
{ | ||
|
@@ -19,15 +19,18 @@ | |
{ | ||
"name": "Rodney Rehm", | ||
"email": "[email protected]" | ||
}, | ||
{ | ||
"name": "Simon Wisselink", | ||
"homepage": "https://www.iwink.nl/" | ||
} | ||
], | ||
"support": { | ||
"irc": "irc://irc.freenode.org/smarty", | ||
"issues": "https://github.com/smarty-php/smarty/issues", | ||
"forum": "http://www.smarty.net/forums/" | ||
"forum": "https://www.smarty.net/forums/" | ||
}, | ||
"require": { | ||
"php": ">=5.2" | ||
"php": "^7.1 || ^8.0" | ||
}, | ||
"autoload": { | ||
"classmap": [ | ||
|
@@ -36,11 +39,11 @@ | |
}, | ||
"extra": { | ||
"branch-alias": { | ||
"dev-master": "3.1.x-dev" | ||
"dev-master": "4.0.x-dev" | ||
} | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "^7.5 || ^6.5 || ^5.7 || ^4.8", | ||
"phpunit/phpunit": "^8.5 || ^7.5", | ||
"smarty/smarty-lexer": "^3.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
39b69f0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wisskid
39b69f0#diff-6bececa4fb8bbffafde9347cc96b9493bdfb2c14426b1b6a89130072ba0e85c2
The second (OR) condition looks very strange to me and is build wrong in my eyes.
If you remove the first condition (¹)
$tmp
is always undefinied and is build as a triple ternary additionally added by?? null
(for the param I assume) and is a string wriiten as$tmp==='' ? '' ?? null : $tmp
to the compile file.I "think" this second (OR) condition can be removed at all, since the first is alway true EDIT: No, but could be
Some example
result in
or did I miss some special case?
(¹) I still do not like it that way, since that forces users to not care about undefined variable assign, as mentioned somewhere before, but at least it works.
39b69f0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
39b69f0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah you didn't get my EDIT, sorry!
I mean it could be
39b69f0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just to add.. I said that
$tmp==='' ? '' ?? null : $tmp
looks weird, meaning shortform forisset('') ? '' : null
in the midpart, doesn't it?!39b69f0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
39b69f0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmmm, well I think I was just a little puzzled about that
|default:''
part usage, which in the second condition is giving$tmp==='' ? '' ?? null : $tmp
.If you test
var_dump('' ?? null);
behaviour outside of this context it returnsstring(0) ""
so this (short) ternary is doing nothing.Forgive the noise and close.
BTW, Did you notice all this space, line and indent changes in the smarty_internal_templatelexer.php diff at here? It looks like it changed worse. Was that intended?
39b69f0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, the lexer is generated code. The generated code is not very pretty.