# Leisure PHP 8.5 upgrade

This directory contains the upgraded application. The earlier upgrade copy is
retained in `upgrade/`; shared server configuration has not been changed.

## Runtime and manually installed dependencies

Use `php8.5` for every PHP command. No Composer installation or update is needed.
The framework's upstream Composer metadata is retained for reference only.

| Component | Version | Official source |
| --- | --- | --- |
| CodeIgniter manual distribution | 4.7.6 | https://github.com/codeigniter4/framework/releases/tag/v4.7.6 |
| Authorize.Net SDK | 2.0.4 | https://github.com/AuthorizeNet/sdk-php/releases/tag/2.0.4 |
| AWS SDK, including dependencies | 3.404.0 | https://github.com/aws/aws-sdk-php/releases/tag/3.404.0 |
| Dompdf, including dependencies | 3.1.6 | https://github.com/dompdf/dompdf/releases/tag/v3.1.6 |

The `system` directory is unchanged from the official 4.7.6 distribution.
Application code, views, static assets, routes and tests were copied from the
original project. Writable directories start empty: live sessions, logs, caches
and uploads are not duplicated.

AWS ZIP SHA-256:
`e7eae67dbb727813ab15bb23a28956503bf89925e14c2aec2ee8d4600bd09102`.
Dompdf ZIP SHA-256:
`05df8ee4907325ed2e09a139de9784325f761b43a049297155499270163ac94d`.

Retain the bundled licenses when updating these manually installed packages.
The Authorize.Net SDK has local compatibility fixes: its class map was rebuilt
from the shipped classes (the upstream map references missing files and omits
classes), unused JMS annotation initialization was removed, and deprecated
`curl_close()` and reflection `setAccessible()` calls were removed. No obsolete PHPMailer dependency was installed:
application email uses CodeIgniter's mailer.

## Configure before opening the application

From this directory, copy `env` to `.env` and configure:

- `CI_ENVIRONMENT` and `app.baseURL`, including any subdirectory and a trailing
  slash. Host-based environment guessing from the old framework bootstrap has
  been removed; environment selection is now explicit. Without `app.baseURL`,
  web requests use HTTPS and the request host, as before; configure the web
  server to reject unrecognized hosts. CLI requests default to localhost.
- The app uses the shared MSA database configuration for `database.default`
  (Admin) and `database.cms` (CMS), as the original app did. Confirm those
  targets are approved staging databases before testing. CodeIgniter
  `database.default.*` and `database.cms.*` environment settings can override
  the shared values when needed.
- `REDIS_SERVER` and `REDIS_PORT` configure the shop/insurance Redis connection;
  `COUPONS_REDIS_SERVER` and `COUPONS_REDIS_PORT` configure coupon Redis.
  Their defaults preserve the original production endpoints. The shared CMS
  and other shared libraries retain their own connection settings.
- `email.SMTPHost`, `email.SMTPUser` and `email.SMTPPass`, using a staging mail
  capture service. The previous SMTP host, username, port, encryption and HTML
  format are the defaults; the password must be supplied separately.
- `MERCHANT_LOGIN_ID` and `MERCHANT_TRANSACTION_KEY`, using sandbox credentials.
  Payments default to production in the production environment and sandbox
  otherwise. `AUTHORIZE_ENVIRONMENT` overrides this; the supplied `env` template
  explicitly selects sandbox. Missing credentials and invalid environment
  values raise errors before any payment request.
- `NOREPLY_ACCOUNT_PASS`, `CAPTCH_SECRET_KEY`, `HASH_KEY` and
  `INSURANCE_SITE_PATH` as required by the flows being tested. `HASH_KEY` falls
  back to the legacy key when unset or empty; set it to the existing
  application's key to read existing encrypted links. The fallback is in source
  code and is not secret.
- The S3 credentials consumed by the existing `MsaCrypt` integration, using an
  approved staging identity before testing uploads.
- A readable `aws_lambda.ini` in the PHP working directory with staging
  `AWS_KEY` and `AWS_SECRET` for review image uploads. The shared image
  processor also requires its configured Lambda function to be available.

Keep credentials out of Git. `.env` and generated runtime files are ignored.

The current shared `/php85` OpenResty location exposes files outside `public`,
including `.env`. Do not put credentials in this development `.env` until the
server administrator restricts access to application files.

**External dependencies still require staging verification.** The application
continues to load CMS, database connector, coupons, PayPal, image-resizer and
encryption libraries under `/opt/msa/lib/php/include`. In particular, the shared
CMS connector maintains its own database and Redis configuration: setting the
CodeIgniter database groups does not reconfigure it. Those shared files were not
modified, and their PHP 8.5 runtime compatibility is not established by linting.
Do not open database-backed pages until their service targets are confirmed.

For a staging virtual host, use this directory's `public` as the document root,
PHP 8.5 FPM, and grant the application user write access only to `writable`.
Do not change the server-wide default PHP version.
The session cookie defaults to the existing `ci_session` name. Configure a
different name when running isolated copies on the same host if needed.

The shared OpenResty development server forwards clean routes such as `/about`
to this copy's `public/index.php`. The local `.env` uses an empty
`app.indexPage` and `app.uriProtocol = 'REQUEST_URI'`. Apache `.htaccess`
rules are not read by OpenResty; other deployments need equivalent front
controller routing that preserves query strings and serves static files.
Do not change shared routing without an administrator's review.

```sh
php8.5 spark list
php8.5 spark routes
# Only after staging services are configured:
php8.5 spark serve --host 127.0.0.1 --port 8080
```

## Compatibility changes and verification

- Current framework bootstrap and configuration are merged with application
  settings; the `auth` filter and routes are preserved.
- Traditional validation rules and the old filter order are intentionally kept
  to avoid silently changing existing request behavior. Page caching is not
  enabled by the new default required filters.
- URL helpers and segment handling use the configured base path rather than
  hardcoded development-directory offsets.
- Short PHP tags, dynamic application properties and deprecated cURL cleanup
  calls are fixed.
- `CmsLibrary` declares legacy CMS state in a local subclass, avoiding dynamic
  property deprecations without editing the shared CMS source. Its character
  replacement method and the app's equivalent helper also handle null values
  without PHP deprecation warnings.
- Insurance uses local AWS and PDF bundles instead of the old shared Composer
  autoloader, which conflicts with the new framework logger.
- Review image uploads reuse the shared image processor with the local AWS
  bundle, without loading its outdated shared Guzzle autoloader. The processor
  is initialized only when an image is uploaded.
- Tests force the CMS database group onto SQLite during testing and treat
  deprecations as errors.

Run the tests from this directory with a standalone PHPUnit 12.5 PHAR:

```sh
php8.5 /path/to/phpunit-12.phar -c phpunit.dist.xml --no-coverage --display-all-issues
```

The offline suite covers baseline tests, subdirectory links, test database
isolation, payment serialization/configuration, S3 signing without network
access, PDF rendering, authenticated/anonymous filter requests, category segment
handling, mocked payment response hydration and payment log masking. Where the
shared CMS is installed, its disconnected initialization is also tested.
Every defined route handler was checked for an existing public method, and all
277 bundled payment SDK classes were loaded under strict PHP 8.5 error handling.
The checks do not
prove live CMS, booking, email, PayPal, insurance upload or payment flows work.
Validate those against staging before replacing the original deployment.

---

# Upstream CodeIgniter 4 Framework

## What is CodeIgniter?

CodeIgniter is a PHP full-stack web framework that is light, fast, flexible and secure.
More information can be found at the [official site](https://codeigniter.com).

This repository holds the distributable version of the framework.
It has been built from the
[development repository](https://github.com/codeigniter4/CodeIgniter4).

More information about the plans for version 4 can be found in [CodeIgniter 4](https://forum.codeigniter.com/forumdisplay.php?fid=28) on the forums.

You can read the [user guide](https://codeigniter.com/user_guide/)
corresponding to the latest version of the framework.

## Important Change with index.php

`index.php` is no longer in the root of the project! It has been moved inside the *public* folder,
for better security and separation of components.

This means that you should configure your web server to "point" to your project's *public* folder, and
not to the project root. A better practice would be to configure a virtual host to point there. A poor practice would be to point your web server to the project root and expect to enter *public/...*, as the rest of your logic and the
framework are exposed.

**Please** read the user guide for a better explanation of how CI4 works!

## Repository Management

We use GitHub issues, in our main repository, to track **BUGS** and to track approved **DEVELOPMENT** work packages.
We use our [forum](http://forum.codeigniter.com) to provide SUPPORT and to discuss
FEATURE REQUESTS.

This repository is a "distribution" one, built by our release preparation script.
Problems with it can be raised on our forum, or as issues in the main repository.

## Contributing

We welcome contributions from the community.

Please read the [*Contributing to CodeIgniter*](https://github.com/codeigniter4/CodeIgniter4/blob/develop/CONTRIBUTING.md) section in the development repository.

## Server Requirements

PHP version 8.2 or higher is required, with the following extensions installed:

- [intl](http://php.net/manual/en/intl.requirements.php)
- [mbstring](http://php.net/manual/en/mbstring.installation.php)

> [!WARNING]
> - The end of life date for PHP 7.4 was November 28, 2022.
> - The end of life date for PHP 8.0 was November 26, 2023.
> - The end of life date for PHP 8.1 was December 31, 2025.
> - If you are still using below PHP 8.2, you should upgrade immediately.
> - The end of life date for PHP 8.2 will be December 31, 2026.

Additionally, make sure that the following extensions are enabled in your PHP:

- json (enabled by default - don't turn it off)
- [mysqlnd](http://php.net/manual/en/mysqlnd.install.php) if you plan to use MySQL
- [libcurl](http://php.net/manual/en/curl.requirements.php) if you plan to use the HTTP\CURLRequest library
