php Laravel-遇到格式不正确的数值(在字符串上) [英] php Laravel- A non well formed numeric value encountered (on string)

查看:84
本文介绍了php Laravel-遇到格式不正确的数值(在字符串上)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的控制器和服务有两个功能.我想在服务中调用一个函数.这是我的代码:

I have two function in my controller and service. I want to call a function in service. Here is my code :

控制器:

public function findNeighborhoodGet(): array
{
    $regionCenter = Request::get('region_center');
    $distanceService = \App::make('App\web\one\Infrastructure\Service\Google\Map');
    try {
        $userPoint = $distanceService->getOriginPoint($regionCenter);
    }
 .
 .
 .
 return $result
}

我的服务(Map.php):

public function getOriginPoint(string $origin):Point
{
    dd($origin);

    return $this->getPointObject($origin);
}

实际上,我得到一个错误:

Actually , I get an error :

A non well formed numeric value encountered 

在此行:公共函数getOriginPoint(string $ origin):Point

如何解决?

推荐答案

在使用PHP7.1时,这是symfony/var-dumper软件包中的错误.它已在版本2.7.16、2.8.9、3.0.9和3.1.3中修复.请参阅请求请求: https://github.com/symfony/symfony/pull/19379

This is a bug in the symfony/var-dumper package when using PHP7.1. It was fixed in version 2.7.16, 2.8.9, 3.0.9 and 3.1.3. See the pull request: https://github.com/symfony/symfony/pull/19379

就我而言,我需要对laravel框架软件包进行 composer update 更新,因为该软件包的供应商目录副本为2.7.9.(我使用的是Laravel 5.1;更高版本使用的是symfony的2.8和3.0,它们也有bug)

In my case, I needed to composer update my laravel framework packages, as my vendor directory copy of that package was at 2.7.9. (I'm using Laravel 5.1; later versions use 2.8 and 3.0 of symfony, which also had the bug)

这篇关于php Laravel-遇到格式不正确的数值(在字符串上)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆