Skip to content

Commit 5f4eb21

Browse files
authored
Merge pull request #91 from Slamdunk/php_83
Add PHP 8.3 support, drop PHP 8.0
2 parents 1836dce + 45aeb53 commit 5f4eb21

15 files changed

+292
-470
lines changed

Diff for: .github/workflows/phpunit.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,26 @@ jobs:
1717
- "highest"
1818
- "locked"
1919
php-version:
20-
- "8.0"
2120
- "8.1"
2221
- "8.2"
22+
- "8.3"
2323
operating-system:
2424
- "ubuntu-latest"
2525

2626
steps:
2727
- name: "Checkout"
28-
uses: "actions/checkout@v2"
28+
uses: "actions/checkout@v4"
2929

3030
- name: "Install PHP"
3131
uses: "shivammathur/setup-php@v2"
3232
with:
3333
coverage: "pcov"
3434
php-version: "${{ matrix.php-version }}"
35-
ini-values: memory_limit=-1
35+
ini-values: memory_limit=-1,zend.assertions=1
3636
tools: composer:v2, cs2pr
3737

3838
- name: "Cache dependencies"
39-
uses: "actions/cache@v2"
39+
uses: "actions/cache@v3"
4040
with:
4141
path: |
4242
~/.composer/cache

Diff for: .github/workflows/release-on-milestone-closed.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414

1515
steps:
1616
- name: "Checkout"
17-
uses: "actions/checkout@v2"
17+
uses: "actions/checkout@v4"
1818

1919
- name: "Release"
2020
uses: "laminas/automatic-releases@v1"

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ build
22
/vendor/
33
/doc/temp/
44
/docs/
5+
/.phpunit.cache
56
.phpunit.result.cache

Diff for: classes/PHPTAL.php

+2-6
Original file line numberDiff line numberDiff line change
@@ -1191,7 +1191,7 @@ final public static function restoreIncludePath()
11911191
*/
11921192
final public static function autoload($class)
11931193
{
1194-
if (version_compare(PHP_VERSION, '5.3', '>=') && __NAMESPACE__) {
1194+
if (__NAMESPACE__) {
11951195
$class = str_replace(__NAMESPACE__, 'PHPTAL', $class);
11961196
$class = strtr($class, '\\', '_');
11971197
}
@@ -1222,11 +1222,7 @@ final public static function autoloadRegister()
12221222

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

12311227
if ($uses_autoload) {
12321228
spl_autoload_register('__autoload');

Diff for: classes/PHPTAL/Dom/SaxXmlParser.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -443,8 +443,7 @@ private function sanitizeEscapedText($str)
443443
/* <?php ?> blocks can't reliably work in attributes (due to escaping impossible in XML)
444444
so they have to be converted into special TALES expression
445445
*/
446-
$types = version_compare(PHP_VERSION, '5.4.0') < 0 ? (ini_get('short_open_tag') ? 'php|=|' : 'php') : 'php|=';
447-
$str = preg_replace_callback("/<\?($types)(.*?)\?>/", static function ($m) {
446+
$str = preg_replace_callback('/<\?(php|=)(.*?)\?>/', static function ($m) {
448447
list(, $type, $code) = $m;
449448
if ($type === '=') $code = 'echo '.$code;
450449
return '${structure phptal-internal-php-block:'.rawurlencode($code).'}';

Diff for: classes/PHPTAL/Namespace/Builtin.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function createAttributeHandler(PHPTAL_NamespaceAttribute $att, PHPTAL_Do
2727
$name = str_replace(' ', '', ucwords(strtr($name, '-', ' ')));
2828

2929
// case is important when using autoload on case-sensitive filesystems
30-
if (version_compare(PHP_VERSION, '5.3', '>=') && __NAMESPACE__) {
30+
if (__NAMESPACE__) {
3131
$class = 'PHPTALNAMESPACE\\Php\\Attribute\\'.strtoupper($this->getPrefix()).'\\'.$name;
3232
} else {
3333
$class = 'PHPTAL_Php_Attribute_'.strtoupper($this->getPrefix()).'_'.$name;

Diff for: classes/PHPTAL/Php/CodeWriter.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function getCacheFilesBaseName()
6161
public function getResult()
6262
{
6363
$this->flush();
64-
if (version_compare(PHP_VERSION, '5.3', '>=') && __NAMESPACE__) {
64+
if (__NAMESPACE__) {
6565
return '<?php use '.'PHPTALNAMESPACE as P; ?>'.trim($this->_result);
6666
} else {
6767
return trim($this->_result);

Diff for: composer.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"name": "phptal/phptal",
3-
"homepage": "http://phptal.org/",
43
"description": "PHPTAL is a templating engine for PHP5 that implements Zope Page Templates syntax",
54
"license": "LGPL-2.1+",
65
"type": "library",
@@ -21,11 +20,12 @@
2120
"homepage": "http://pornel.net/"
2221
}
2322
],
23+
"homepage": "https://phptal.org/",
2424
"require": {
25-
"php": "~8.0.0 || ~8.1.0 || ~8.2.0"
25+
"php": "~8.1.0 || ~8.2.0 || ~8.3.0"
2626
},
2727
"require-dev": {
28-
"phpunit/phpunit": "^9.5.24"
28+
"phpunit/phpunit": "^10.4.1"
2929
},
3030
"autoload": {
3131
"psr-0": {

0 commit comments

Comments
 (0)