Skip to content

Commit

Permalink
Fix small Route and Model empty value bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Robin de Graaf committed Feb 23, 2019
1 parent 9a2a77d commit 8d8fdf6
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Parable PHP Framework Changelog

### 1.2.1

__Bugfixes__
- `Route::extractParameterValues()` now only filters out values that are exactly an empty string. Anything else will be passed along as the provided value.
- `Model::removeEmptyValues()` has a similar issue, where now only `null` values are filtered out.

### 1.2.0

__Changes__
Expand Down
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
}
],
"require": {
"php": ">=5.6"
"php": ">=5.6",
"ext-json": "*",
"ext-mbstring": "*",
"ext-pdo": "*"
},
"require-dev": {
"phpunit/phpunit": "^5.7"
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Request
*/
public function __construct()
{
if (APP_CONTEXT === 'web') {
if (APP_CONTEXT === 'web' && function_exists('getallheaders')) {
$this->headers = getallheaders() ?: []; // @codeCoverageIgnore
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Mail/Mailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ public function send()
}

/**
* Actually send the email, using php's built-in mail() command.
* Actually send the email, using PHPs built-in mail() command.
*
* @param string $to
* @param string $subject
Expand Down
2 changes: 1 addition & 1 deletion src/Mail/Sender/PhpMail.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
class PhpMail implements \Parable\Mail\Sender\SenderInterface
{
/**
* Send using php's built-in Mail interface
* Send using PHPs built-in Mail interface
*
* @inheritdoc
*
Expand Down
2 changes: 1 addition & 1 deletion src/ORM/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ public function exportToArrayWithoutEmptyValues()
public function removeEmptyValues(array $array)
{
foreach ($array as $key => $value) {
if ($value !== 0 && empty($value)) {
if ($value !== 0 && $value !== '0' && empty($value)) {
unset($array[$key]);
}
}
Expand Down

0 comments on commit 8d8fdf6

Please sign in to comment.