Skip to content

Commit 8740bda

Browse files
PHP 7.2 fix
1 parent 05d85f2 commit 8740bda

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
## Laravel API Handler
2-
[![Build Status](https://travis-ci.org/marcelgwerder/laravel-api-handler.png?branch=master)](https://travis-ci.org/marcelgwerder/laravel-api-handler) [![Latest Stable Version](https://poser.pugx.org/marcelgwerder/laravel-api-handler/v/stable.png)](https://packagist.org/packages/marcelgwerder/laravel-api-handler) [![Total Downloads](https://poser.pugx.org/marcelgwerder/laravel-api-handler/downloads.png)](https://packagist.org/packages/marcelgwerder/laravel-api-handler) [![License](https://poser.pugx.org/marcelgwerder/laravel-api-handler/license.png)](https://packagist.org/packages/marcelgwerder/laravel-api-handler)
32

43
This helper package provides functionality for parsing the URL of a REST-API request.
54

5+
### Attention
6+
7+
This is a fix for `marcelgwerder/laravel-api-handler` on PHP 7.2. There is a pull request in original package.
8+
69
### Installation
710

811
***Note:*** This version is for Laravel 5. When using Laravel 4 you need to use version 0.4.x.

composer.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
{
2-
"name": "marcelgwerder/laravel-api-handler",
3-
"description": "Package providing helper functions for a Laravel REST-API ",
2+
"name": "betalabs/laravel-api-handler",
3+
"description": "Package providing helper functions for a Laravel REST-API. This is a fix for PHP 7.2.",
44
"keywords": ["api", "laravel", "rest", "url", "parse", "mysql"],
5-
"homepage": "http://github.com/marcelgwerder/laravel-api-handler",
65
"license": "MIT",
76
"authors": [
87
{

src/Parser.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ protected function parseFields($fieldsParam)
328328
protected function parseWith($withParam)
329329
{
330330
$fields = $this->query->columns;
331-
$fieldsCount = count($fields);
331+
$fieldsCount = count($fields ?: []);
332332
$baseModel = $this->builder->getModel();
333333

334334
$withHistory = [];
@@ -449,7 +449,7 @@ protected function parseWith($withParam)
449449
$this->builder->with($withsArr);
450450

451451
//Merge the base fields
452-
if (count($fields) > 0) {
452+
if (count($fields ?: []) > 0) {
453453
if (!is_array($this->query->columns)) {
454454
$this->query->columns = [];
455455
}

0 commit comments

Comments
 (0)