Skip to content

Commit 73148f8

Browse files
jwong-dayspringmichalmagic42tworzeniewebmentalstring
authored
compatibility with php 7.4 and 8.x (#4)
* Correct deprecated methods in PHP7.4 (propelorm#1079) * runtime/lib/query/Join.php implode() was used against the definition (wrong PHP documentation * runtime/lib/query/ModelCriteria.php count() was used on non-countable variable (non-array) * 7.4 and phpunit9 changes. Tests are passing * Compatibility changes * Added docker setup * updated travis * added correct path * 7.4 final travis setup * propelorm#1086: Code review suggestions applying * remove dependency on docker mysql * remove 5.6 and 7.2 from test matrix; add 8.0 and 8.1 * Upgraded PHP version and removed some deprecations * Migrated phpunit.xml.dist * Switched to PHP8.0 in Dockerfile * Removed usage of ReflectionClass->getClass in favor of ReflectionClass->getType * Changed order of arguments in ModelCriteriaTest.php and ModelCriteriaWithNamespaceTest.php * Fixed signatures of PropelOnDemandCollection::asort and PropelOnDemandCollection::ksort * Removed require_once from all the classes because we have autoloading via composer * Rector automated upgrade to PHP8 * Fixed invalid handling of resource type for binded value in DebugPDOStatement.php * Fixed invalid way of checking if method exists in delegated class via is_callable. Switched to method_exists * Replaced order of params because of failed tests * [STYLE]: Added simplified usage because of version support dropping * Fix use of abs() with string on PHP8.0 Can happen when using Yaml's multiline syntax * specify minimum version of phing for php8 * drop php 7.3 from test matrix * update to ubuntu-20.04 * fork propel/propel1 for versions >=1.8 Co-authored-by: Michal Drozd <[email protected]> Co-authored-by: Luke Adamczewski <[email protected]> Co-authored-by: Łukasz Adamczewski <[email protected]> Co-authored-by: Jeffrey Wong <[email protected]> Co-authored-by: Luke Adamczewski <[email protected]> Co-authored-by: Paulo Magalhaes <[email protected]>
1 parent 7f42869 commit 73148f8

File tree

310 files changed

+618
-687
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

310 files changed

+618
-687
lines changed

.github/workflows/test.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,14 @@ jobs:
88
env:
99
DB: mysql
1010
DB_USER: root
11-
runs-on: ubuntu-18.04
11+
runs-on: ubuntu-20.04
1212
strategy:
1313
fail-fast: false
1414
matrix:
1515
php:
16-
- '5.6'
17-
- '7.2'
18-
- '7.3'
1916
- '7.4'
20-
# - '8.0'
21-
# - '8.1'
17+
- '8.0'
18+
- '8.1'
2219
composer:
2320
- ''
2421
- '--prefer-lowest'

.travis.yml

Lines changed: 4 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,10 @@
11
language: php
2-
dist: trusty
32

43
branches:
54
only:
6-
- 1.6
7-
- master
8-
- gh-pages
5+
- php7.4
96

10-
php:
11-
- 5.4
12-
- 5.5
13-
- hhvm
7+
services: docker
148

15-
env:
16-
- DB=mysql DB_USER=root
17-
18-
before_script:
19-
# MySQL
20-
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'SET FOREIGN_KEY_CHECKS = 0; DROP DATABASE IF EXISTS test; DROP SCHEMA IF EXISTS second_hand_books; DROP SCHEMA IF EXISTS contest; DROP DATABASE IF EXISTS reverse_bookstore; DROP SCHEMA IF EXISTS bookstore_schemas; SET FOREIGN_KEY_CHECKS = 1;'; fi"
21-
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE test; CREATE SCHEMA bookstore_schemas; CREATE SCHEMA contest; CREATE SCHEMA second_hand_books; CREATE DATABASE reverse_bookstore;'; fi"
22-
23-
# Composer
24-
- wget http://getcomposer.org/composer.phar
25-
- php composer.phar install --prefer-source
26-
27-
- ./test/reset_tests.sh
28-
29-
script: vendor/bin/phpunit
30-
31-
matrix:
32-
include:
33-
- php: 5.3
34-
dist: precise
35-
allow_failures:
36-
- php: hhvm
9+
script:
10+
bash docker/run.sh

composer.json

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "propel/propel1",
2+
"name": "dayspring-tech/propel1",
33
"description": "Propel is an open-source Object-Relational Mapping (ORM) for PHP5.",
44
"keywords": ["orm", "active record", "mapping", "database", "persistence"],
55
"homepage": "http://www.propelorm.org/",
@@ -14,23 +14,23 @@
1414
},
1515
"include-path": ["runtime/lib", "generator/lib"],
1616
"require": {
17-
"php": ">=5.2.4",
18-
"phing/phing": "~2.4"
17+
"php": "^8.0|^7.4",
18+
"phing/phing": "^2.17",
19+
"ext-pdo": "*"
1920
},
2021
"require-dev": {
21-
"pear-pear.php.net/PEAR_PackageFileManager2": "@stable",
22-
"phpunit/phpunit": "~4.0||~5.0"
22+
"phpunit/phpunit": "^9.0.0",
23+
"phpcompatibility/php-compatibility": "^9.3",
24+
"squizlabs/php_codesniffer": "^3.5",
25+
"ext-simplexml": "*",
26+
"ext-dom": "*"
2327
},
24-
"extra": {
25-
"branch-alias": {
26-
"dev-master": "1.7-dev"
27-
}
28+
"replace": {
29+
"propel/propel1": "^1.8"
2830
},
29-
"repositories": [
30-
{
31-
"type": "pear",
32-
"url": "https://pear.php.net"
33-
}
34-
],
35-
"bin": ["generator/bin/propel-gen", "generator/bin/propel-gen.bat"]
31+
"bin": ["generator/bin/propel-gen", "generator/bin/propel-gen.bat"],
32+
"scripts": {
33+
"post-install-cmd": "\"vendor/bin/phpcs\" --config-set installed_paths vendor/phpcompatibility/php-compatibility",
34+
"post-update-cmd" : "\"vendor/bin/phpcs\" --config-set installed_paths vendor/phpcompatibility/php-compatibility"
35+
}
3636
}

docker/Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM thecodingmachine/php:8.0-v4-cli
2+
USER root
3+
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y locales
4+
5+
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
6+
dpkg-reconfigure --frontend=noninteractive locales && \
7+
update-locale LANG=en_US.UTF-8
8+
9+
USER docker
10+
ENV LANG en_US.UTF-8
11+

docker/docker-compose.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
version: '3'
2+
services:
3+
php:
4+
build:
5+
context: .
6+
dockerfile: Dockerfile
7+
working_dir: /usr/src/app
8+
command: phpunit
9+
volumes:
10+
- ../:/usr/src/app
11+
environment:
12+
- PHP_EXTENSIONS=intl pdo_sqlite sqlite3 xdebug
13+
- STARTUP_COMMAND_1=composer install
14+
- STARTUP_COMMAND_2=bash test/reset_tests.sh
15+
- PHP_IDE_CONFIG="serverName=propel"
16+
- XDEBUG_MODE=debug
17+
- XDEBUG_SESSION=1
18+
19+
db:
20+
image: percona
21+
command: >
22+
mysqld
23+
--sql-mode="NO_ENGINE_SUBSTITUTION"
24+
--character-set-server="utf8"
25+
--collation-server="utf8_unicode_ci"
26+
--default-authentication-plugin=mysql_native_password
27+
restart: always
28+
environment:
29+
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'

docker/reset.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env bash
2+
3+
mysql -u root -e 'SET FOREIGN_KEY_CHECKS = 0; DROP DATABASE IF EXISTS test; DROP SCHEMA IF EXISTS second_hand_books; DROP SCHEMA IF EXISTS contest; DROP DATABASE IF EXISTS reverse_bookstore; DROP SCHEMA IF EXISTS bookstore_schemas; SET FOREIGN_KEY_CHECKS = 1;'
4+
mysql -u root -e 'CREATE DATABASE test; CREATE SCHEMA bookstore_schemas; CREATE SCHEMA contest; CREATE SCHEMA second_hand_books; CREATE DATABASE reverse_bookstore;'

docker/run.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env bash
2+
cd docker
3+
docker-compose up -d db
4+
sleep 20
5+
docker-compose exec -T db bash < reset.sh
6+
docker-compose build
7+
docker-compose run php

generator/lib/behavior/DelegateBehavior.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public function objectCall($builder)
111111
$relationName = $builder->getFKPhpNameAffix($fk);
112112
}
113113
$script .= "
114-
if (is_callable(array('$ARFQCN', \$name))) {
114+
if (method_exists('$ARFQCN', \$name)) {
115115
if (!\$delegate = \$this->get$relationName()) {
116116
\$delegate = new $ARClassName();
117117
\$this->set$relationName(\$delegate);

generator/lib/behavior/aggregate_column/AggregateColumnBehavior.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
* @license MIT License
99
*/
1010

11-
require_once 'AggregateColumnRelationBehavior.php';
12-
1311
/**
1412
* Keeps an aggregate column updated with related table
1513
*

generator/lib/behavior/aggregate_column/AggregateColumnRelationBehavior.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
* @license MIT License
99
*/
1010

11-
require_once 'AggregateColumnRelationBehavior.php';
12-
1311
/**
1412
* Keeps an aggregate column updated with related table
1513
*

0 commit comments

Comments
 (0)