Skip to content

Commit b3d87e1

Browse files
Fix HTTP request corruption by the user agent (GH-32)
The file `VERSION` used to send the version contains a new line. When it's used to generate the UserAgent for curl, the new line char stops the headers sent for the request. All other headers sent after the user agent are ignored and used like the body requests. To solve this issue, clean up the `VERSION` file content on load.
1 parent 53d6289 commit b3d87e1

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lib/php/libsdk/SDK/Config.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ public static function guessCurrentBranchName() : ?string
218218
}
219219

220220
/* Try to figure out the branch. The worky scenarios are
221-
- CWD is in php-src
221+
- CWD is in php-src
222222
- phpize is on the path
223223
FIXME for the dev package, there should be a php-config utility
224224
*/
@@ -256,7 +256,7 @@ public static function guessCurrentBranchName() : ?string
256256
$cmd = "\"$git\" branch";
257257

258258
$ret = trim(shell_exec($cmd));
259-
if (preg_match_all(",\*\s+master,", $ret) > 0) {
259+
if (preg_match_all(",\*\s+master,", $ret) > 0) {
260260
$branch = "master";
261261
}
262262
}
@@ -271,7 +271,7 @@ public static function getCurrentBranchName() : string
271271
$branch = self::guessCurrentBranchName();
272272
self::setCurrentBranchName($branch);
273273
}
274-
274+
275275
return self::$currentBranchName;
276276
}/*}}}*/
277277

@@ -336,7 +336,7 @@ public static function getCurrentBranchData() : array
336336
throw new Exception("Failed to find config with arch '" . self::getCurrentArchName() . "'");
337337
}
338338

339-
return $ret;
339+
return $ret;
340340
}/*}}}*/
341341

342342
public static function getSdkNugetFeedUrl() : string
@@ -368,7 +368,7 @@ public static function getSdkVersion() : string
368368
throw new Exception("Couldn't find the SDK version file.");
369369
}
370370

371-
return file_get_contents($path);
371+
return trim(file_get_contents($path));
372372
}/*}}}*/
373373

374374
public static function getDepsLocalPath() : ?string
@@ -391,7 +391,7 @@ public static function getDepsLocalPath() : ?string
391391
self::setDepsLocalPath($tmp);
392392
}
393393
}
394-
394+
395395
if (NULL == self::$depsLocalPath) {
396396
$tmp = realpath("../deps");
397397
if (is_dir($tmp)) {

0 commit comments

Comments
 (0)