Skip to content
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
2 changes: 2 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
* [Overview](overview.md)
* [Updating from v1 to v2](v1-to-v2-update.md)
* [Updating from v2 to v3](v2-to-v3-update.md)
* [Updating from v3 to v4](v3-to-v4-update.md)
7 changes: 7 additions & 0 deletions docs/v2-to-v3-update.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Updating from v2 to v3

The following changes were made to the Application package between v1 and v2.

### Minimum supported PHP version raised

All Framework packages now require PHP 8.1 or newer.
19 changes: 19 additions & 0 deletions docs/v3-to-v4-update.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
## Updating from v3 to v4

The following changes were made to the Application package between v3 and v4.

### Access to input data

Accessing the input data in the input attribute of the application can now only be done via the `getInput()`.

```php
// Old
$app->input->getInt();

// New
$app->getInput()->getInt();
```

### Status on redirect

When calling `$app->redirect()`, you can not hand over a boolean value for the status, but always have to use an integer representing the HTTP status code.
58 changes: 2 additions & 56 deletions src/AbstractWebApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,46 +213,6 @@ public function __construct(
$this->loadSystemUris();
}

/**
* Magic method to access properties of the application.
*
* @param string $name The name of the property.
*
* @return Input|null A value if the property name is valid, null otherwise.
*
* @since 2.0.0
* @deprecated 3.0 This is a B/C proxy for deprecated read accesses
*/
public function __get($name)
{
switch ($name) {
case 'input':
\trigger_deprecation(
'joomla/application',
'2.0.0',
'Accessing the input property of %s is deprecated, use the %s::getInput() method instead.',
self::class,
self::class
);

return $this->getInput();

default:
$trace = \debug_backtrace();
\trigger_error(
\sprintf(
'Undefined property via __get(): %1$s in %2$s on line %3$s',
$name,
$trace[0]['file'],
$trace[0]['line']
),
E_USER_NOTICE
);

return null;
}
}

/**
* Execute the application.
*
Expand Down Expand Up @@ -423,8 +383,8 @@ public function getInput(): Input
* Other" code in the header pointing to the new location. If the headers have already been sent this will be
* accomplished using a JavaScript statement.
*
* @param string $url The URL to redirect to. Can only be http/https URL
* @param integer|boolean $status The HTTP status code to be provided. 303 is assumed by default.
* @param string $url The URL to redirect to. Can only be http/https URL
* @param integer $status The HTTP status code to be provided. 303 is assumed by default.
*
* @return void
*
Expand Down Expand Up @@ -478,20 +438,6 @@ public function redirect($url, $status = 303)

echo $html;
} else {
// Check if we have a boolean for the status variable for compatibility with v1 of the framework
// @deprecated 3.0
if (\is_bool($status)) {
\trigger_deprecation(
'joomla/application',
'2.0.0',
'Passing a boolean value for the $status argument in %s() is deprecated,'
. ' an integer should be passed instead.',
__METHOD__
);

$status = $status ? 301 : 303;
}

if (!\is_int($status) && !$this->isRedirectState($status)) {
throw new \InvalidArgumentException('You have not supplied a valid HTTP status code');
}
Expand Down
4 changes: 2 additions & 2 deletions src/WebApplicationInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public function getInput(): Input;
* If the headers have not been sent the redirect will be accomplished using a "301 Moved Permanently" or "303 See Other" code in the header
* pointing to the new location. If the headers have already been sent this will be accomplished using a JavaScript statement.
*
* @param string $url The URL to redirect to. Can only be http/https URL
* @param integer|boolean $status The HTTP status code to be provided. 303 is assumed by default.
* @param string $url The URL to redirect to. Can only be http/https URL
* @param integer $status The HTTP status code to be provided. 303 is assumed by default.
*
* @return void
*
Expand Down