com web/rmtools: fixed error handling for build object creation: client/include/PeclBranch.php client/script/pecl.php
| From: | Stephen A. Zarkos | Date: | Fri, 20 Sep 2013 18:20:55 +0000 |
| Subject: | com web/rmtools: fixed error handling for build object creation: client/include/PeclBranch.php client/script/pecl.php | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-16657@lists.php.net to get a copy of this message | ||
Commit: 0918b58df1d1e8d4e0f7fc86b09bb165ccd9c180
Author: Anatol Belski <ab@php.net> Fri, 20 Sep 2013 20:20:55 +0200
Parents: d4a11b526fe22a8672a766d704dc557fdab887c2
Branches: master
Link: http://git.php.net/?p=web/rmtools.git;a=commitdiff;h=0918b58df1d1e8d4e0f7fc86b09bb165ccd9c180
Log:
fixed error handling for build object creation
Changed paths:
M client/include/PeclBranch.php
M client/script/pecl.php
Diff:
diff --git a/client/include/PeclBranch.php b/client/include/PeclBranch.php
index a79ba57..14ce9c8 100644
--- a/client/include/PeclBranch.php
+++ b/client/include/PeclBranch.php
@@ -85,13 +85,14 @@ class PeclBranch {
function createBuildInstance($build_name)
{
- $build = $this->config->getBuildFromName($build_name);
+ $build = NULL;
+ $build_config = $this->config->getBuildFromName($build_name);
- if (!$build) {
+ if (!$build_config) {
throw new \Exception("Invalid build name <$build_name>");
}
- $compiler = strtolower($build['compiler']);
+ $compiler = strtolower($build_config['compiler']);
switch ($compiler) {
case 'vc11':
case 'vc9':
diff --git a/client/script/pecl.php b/client/script/pecl.php
index 974be97..2d07331 100644
--- a/client/script/pecl.php
+++ b/client/script/pecl.php
@@ -73,10 +73,14 @@ foreach ($builds as $build_name) {
$build_src_path = realpath($build_dir_parent . DIRECTORY_SEPARATOR .
$branch->config->getBuildSrcSubdir());
$log = rm\exec_single_log('mklink /J ' . $build_src_path . ' ' .
$build_src_path);
- $build = $branch->createBuildInstance($build_name);
- $build->setSourceDir($build_src_path);
-
try {
+ $build = $branch->createBuildInstance($build_name);
+ if (!$build) {
+ throw new \Exception("Build instance failed to instantiate");
+ }
+
+ $build->setSourceDir($build_src_path);
+
$ext = new rm\PeclExt($pkg_path, $build);
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage() . PHP_EOL;