Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PHP 8.3 support, drop PHP 8.0 #91

Merged
merged 6 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,26 @@ jobs:
- "highest"
- "locked"
php-version:
- "8.0"
- "8.1"
- "8.2"
- "8.3"
operating-system:
- "ubuntu-latest"

steps:
- name: "Checkout"
uses: "actions/checkout@v2"
uses: "actions/checkout@v4"

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "pcov"
php-version: "${{ matrix.php-version }}"
ini-values: memory_limit=-1
ini-values: memory_limit=-1,zend.assertions=1
tools: composer:v2, cs2pr

- name: "Cache dependencies"
uses: "actions/cache@v2"
uses: "actions/cache@v3"
with:
path: |
~/.composer/cache
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-on-milestone-closed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

steps:
- name: "Checkout"
uses: "actions/checkout@v2"
uses: "actions/checkout@v4"

- name: "Release"
uses: "laminas/automatic-releases@v1"
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ build
/vendor/
/doc/temp/
/docs/
/.phpunit.cache
.phpunit.result.cache
8 changes: 2 additions & 6 deletions classes/PHPTAL.php
Original file line number Diff line number Diff line change
Expand Up @@ -1191,7 +1191,7 @@ final public static function restoreIncludePath()
*/
final public static function autoload($class)
{
if (version_compare(PHP_VERSION, '5.3', '>=') && __NAMESPACE__) {
if (__NAMESPACE__) {
$class = str_replace(__NAMESPACE__, 'PHPTAL', $class);
$class = strtr($class, '\\', '_');
}
Expand Down Expand Up @@ -1222,11 +1222,7 @@ final public static function autoloadRegister()

// Prepending PHPTAL's autoloader helps if there are other autoloaders
// that throw/die when file is not found. Only >5.3 though.
if (version_compare(PHP_VERSION, '5.3', '>=')) {
@spl_autoload_register(array(__CLASS__,'autoload'), false, true);
} else {
spl_autoload_register(array(__CLASS__,'autoload'));
}
@spl_autoload_register(array(__CLASS__,'autoload'), true, true);

if ($uses_autoload) {
spl_autoload_register('__autoload');
Expand Down
3 changes: 1 addition & 2 deletions classes/PHPTAL/Dom/SaxXmlParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -443,8 +443,7 @@ private function sanitizeEscapedText($str)
/* <?php ?> blocks can't reliably work in attributes (due to escaping impossible in XML)
so they have to be converted into special TALES expression
*/
$types = version_compare(PHP_VERSION, '5.4.0') < 0 ? (ini_get('short_open_tag') ? 'php|=|' : 'php') : 'php|=';
$str = preg_replace_callback("/<\?($types)(.*?)\?>/", static function ($m) {
$str = preg_replace_callback('/<\?(php|=)(.*?)\?>/', static function ($m) {
list(, $type, $code) = $m;
if ($type === '=') $code = 'echo '.$code;
return '${structure phptal-internal-php-block:'.rawurlencode($code).'}';
Expand Down
2 changes: 1 addition & 1 deletion classes/PHPTAL/Namespace/Builtin.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function createAttributeHandler(PHPTAL_NamespaceAttribute $att, PHPTAL_Do
$name = str_replace(' ', '', ucwords(strtr($name, '-', ' ')));

// case is important when using autoload on case-sensitive filesystems
if (version_compare(PHP_VERSION, '5.3', '>=') && __NAMESPACE__) {
if (__NAMESPACE__) {
$class = 'PHPTALNAMESPACE\\Php\\Attribute\\'.strtoupper($this->getPrefix()).'\\'.$name;
} else {
$class = 'PHPTAL_Php_Attribute_'.strtoupper($this->getPrefix()).'_'.$name;
Expand Down
2 changes: 1 addition & 1 deletion classes/PHPTAL/Php/CodeWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function getCacheFilesBaseName()
public function getResult()
{
$this->flush();
if (version_compare(PHP_VERSION, '5.3', '>=') && __NAMESPACE__) {
if (__NAMESPACE__) {
return '<?php use '.'PHPTALNAMESPACE as P; ?>'.trim($this->_result);
} else {
return trim($this->_result);
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"name": "phptal/phptal",
"homepage": "http://phptal.org/",
"description": "PHPTAL is a templating engine for PHP5 that implements Zope Page Templates syntax",
"license": "LGPL-2.1+",
"type": "library",
Expand All @@ -21,11 +20,12 @@
"homepage": "http://pornel.net/"
}
],
"homepage": "https://phptal.org/",
"require": {
"php": "~8.0.0 || ~8.1.0 || ~8.2.0"
"php": "~8.1.0 || ~8.2.0 || ~8.3.0"
},
"require-dev": {
"phpunit/phpunit": "^9.5.24"
"phpunit/phpunit": "^10.4.1"
},
"autoload": {
"psr-0": {
Expand Down
Loading