]> Raphaël G. Git Repositories - packbundle/commitdiff
Fix default_socket_timeout invalid values
authorRaphaël Gertz <git@rapsys.eu>
Mon, 4 Mar 2024 16:47:33 +0000 (17:47 +0100)
committerRaphaël Gertz <git@rapsys.eu>
Mon, 4 Mar 2024 16:47:33 +0000 (17:47 +0100)
Controller/MapController.php
Parser/TokenParser.php

index 869d5abe913e40787142d9e2c2d072b939de0b61..255c47b868453d5bc8c78b545478278aafdabefd 100644 (file)
@@ -54,7 +54,7 @@ class MapController extends AbstractController implements ServiceSubscriberInter
                                'http' => [
                                        #'header' => ['Referer: https://www.openstreetmap.org/'],
                                        'max_redirects' => $_ENV['RAPSYSPACK_REDIRECT'] ?? 20,
-                                       'timeout' => $_ENV['RAPSYSPACK_TIMEOUT'] ?? (int)ini_get('default_socket_timeout') ?: 60,
+                                       'timeout' => $_ENV['RAPSYSPACK_TIMEOUT'] ?? (($timeout = ini_get('default_socket_timeout')) !== false && $timeout !== "" ? (float)$timeout : 60),
                                        'user_agent' => $_ENV['RAPSYSPACK_AGENT'] ?? (($agent = ini_get('user_agent')) !== false && $agent !== "" ? (string)$agent : RapsysPackBundle::getAlias().'/'.RapsysPackBundle::getVersion())
                                ]
                        ]
index 1115e0cdce49916b3535dc72967f034e56097d79..07267b9ae14c040c917e9c9b1cdee3557e1a7429 100644 (file)
@@ -50,7 +50,7 @@ class TokenParser extends AbstractTokenParser {
                                'http' => [
                                        #'header' => ['Referer: https://www.openstreetmap.org/'],
                                        'max_redirects' => $_ENV['RAPSYSPACK_REDIRECT'] ?? 20,
-                                       'timeout' => $_ENV['RAPSYSPACK_TIMEOUT'] ?? (int)ini_get('default_socket_timeout') ?: 60,
+                                       'timeout' => $_ENV['RAPSYSPACK_TIMEOUT'] ?? (($timeout = ini_get('default_socket_timeout')) !== false && $timeout !== "" ? (float)$timeout : 60),
                                        'user_agent' => $_ENV['RAPSYSPACK_AGENT'] ?? (($agent = ini_get('user_agent')) !== false && $agent !== "" ? (string)$agent : RapsysPackBundle::getAlias().'/'.RapsysPackBundle::getVersion())
                                ]
                        ]