Merged in bugfix/PMCORE-3971 (pull request #8565)

PMCORE-3971 (remove conflicts with develop branch) 3.8.x: Solve the conflicts to merge this epic into develop

Approved-by: Julio Cesar Laura Avendaño
This commit is contained in:
Roly Gutierrez
2022-09-13 15:07:33 +00:00
committed by Julio Cesar Laura Avendaño
5 changed files with 1991 additions and 2613 deletions

4081
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,247 +1,197 @@
<?php <?php
namespace Database\Factories; use Faker\Generator as Faker;
use App\Factories\Factory; $factory->define(\ProcessMaker\Model\Delegation::class, function(Faker $faker) {
use Illuminate\Support\Str; $user = factory(\ProcessMaker\Model\User::class)->create();
$process = factory(\ProcessMaker\Model\Process::class)->create();
$task = factory(\ProcessMaker\Model\Task::class)->create([
'PRO_UID' => $process->PRO_UID,
'PRO_ID' => $process->PRO_ID
]);
$application = factory(\ProcessMaker\Model\Application::class)->create([
'PRO_UID' => $process->PRO_UID,
'APP_INIT_USER' => $user->USR_UID,
'APP_CUR_USER' => $user->USR_UID
]);
// Return with default values
return [
'DELEGATION_ID' => $faker->unique()->numberBetween(5000),
'APP_UID' => $application->APP_UID,
'DEL_INDEX' => 1,
'APP_NUMBER' => $application->APP_NUMBER,
'DEL_PREVIOUS' => 0,
'PRO_UID' => $process->PRO_UID,
'TAS_UID' => $task->TAS_UID,
'USR_UID' => $user->USR_UID,
'DEL_TYPE' => 'NORMAL',
'DEL_THREAD' => 1,
'DEL_THREAD_STATUS' => 'OPEN',
'DEL_THREAD_STATUS_ID' => 1,
'DEL_PRIORITY' => 3,
'DEL_DELEGATE_DATE' => $faker->dateTime(),
'DEL_INIT_DATE' => $faker->dateTime(),
'DEL_TASK_DUE_DATE' => $faker->dateTime(),
'DEL_RISK_DATE' => $faker->dateTime(),
'DEL_LAST_INDEX' => 0,
'USR_ID' => $user->USR_ID,
'PRO_ID' => $process->PRO_ID,
'TAS_ID' => $task->TAS_ID,
'DEL_DATA' => '',
'DEL_TITLE' => $faker->word()
];
});
class DelegationFactory extends Factory // Create a delegation with the foreign keys
{ $factory->state(\ProcessMaker\Model\Delegation::class, 'foreign_keys', function (Faker $faker) {
// Create values in the foreign key relations
$user = factory(\ProcessMaker\Model\User::class)->create();
$category = factory(\ProcessMaker\Model\ProcessCategory::class)->create();
$process = factory(\ProcessMaker\Model\Process::class)->create([
'PRO_CATEGORY' => $category->CATEGORY_UID,
'CATEGORY_ID' => $category->CATEGORY_ID
]);
$task = factory(\ProcessMaker\Model\Task::class)->create([
'PRO_UID' => $process->PRO_UID,
'PRO_ID' => $process->PRO_ID
]);
$application = factory(\ProcessMaker\Model\Application::class)->create([
'PRO_UID' => $process->PRO_UID,
'APP_INIT_USER' => $user->USR_UID,
'APP_CUR_USER' => $user->USR_UID
]);
/** $delegateDate = $faker->dateTime();
* Define the model's default state. $initDate = $faker->dateTimeInInterval($delegateDate, '+30 minutes');
* $riskDate = $faker->dateTimeInInterval($initDate, '+1 day');
* @return array $taskDueDate = $faker->dateTimeInInterval($riskDate, '+2 day');
*/ $index = $faker->unique()->numberBetween(2000);
public function definition()
{
$user = \ProcessMaker\Model\User::factory()->create();
$process = \ProcessMaker\Model\Process::factory()->create();
$task = \ProcessMaker\Model\Task::factory()->create([
'PRO_UID' => $process->PRO_UID,
'PRO_ID' => $process->PRO_ID
]);
$application = \ProcessMaker\Model\Application::factory()->create([
'PRO_UID' => $process->PRO_UID,
'APP_INIT_USER' => $user->USR_UID,
'APP_CUR_USER' => $user->USR_UID
]);
// Return with default values
return [
'DELEGATION_ID' => $this->faker->unique()->numberBetween(5000),
'APP_UID' => $application->APP_UID,
'DEL_INDEX' => 1,
'APP_NUMBER' => $application->APP_NUMBER,
'DEL_PREVIOUS' => 0,
'PRO_UID' => $process->PRO_UID,
'TAS_UID' => $task->TAS_UID,
'USR_UID' => $user->USR_UID,
'DEL_TYPE' => 'NORMAL',
'DEL_THREAD' => 1,
'DEL_THREAD_STATUS' => 'OPEN',
'DEL_PRIORITY' => 3,
'DEL_DELEGATE_DATE' => $this->faker->dateTime(),
'DEL_INIT_DATE' => $this->faker->dateTime(),
'DEL_TASK_DUE_DATE' => $this->faker->dateTime(),
'DEL_RISK_DATE' => $this->faker->dateTime(),
'DEL_LAST_INDEX' => 0,
'USR_ID' => $user->USR_ID,
'PRO_ID' => $process->PRO_ID,
'TAS_ID' => $task->TAS_ID,
'DEL_DATA' => '',
'DEL_TITLE' => $this->faker->word()
];
}
/** // Return with default values
* Create a delegation with the foreign keys return [
* @return type 'DELEGATION_ID' => $faker->unique()->numberBetween(5000),
*/ 'APP_UID' => $application->APP_UID,
public function foreign_keys() 'DEL_INDEX' => $index,
{ 'APP_NUMBER' => $application->APP_NUMBER,
$state = function (array $attributes) { 'DEL_PREVIOUS' => $index - 1,
// Create values in the foreign key relations 'PRO_UID' => $process->PRO_UID,
$user = \ProcessMaker\Model\User::factory()->create(); 'TAS_UID' => $task->TAS_UID,
$category = \ProcessMaker\Model\ProcessCategory::factory()->create(); 'USR_UID' => $user->USR_UID,
$process = \ProcessMaker\Model\Process::factory()->create([ 'DEL_TYPE' => 'NORMAL',
'PRO_CATEGORY' => $category->CATEGORY_UID, 'DEL_THREAD' => 1,
'CATEGORY_ID' => $category->CATEGORY_ID 'DEL_THREAD_STATUS' => 'OPEN',
]); 'DEL_THREAD_STATUS_ID' => 1,
$task = \ProcessMaker\Model\Task::factory()->create([ 'DEL_PRIORITY' => 3,
'PRO_UID' => $process->PRO_UID, 'DEL_DELEGATE_DATE' => $delegateDate,
'PRO_ID' => $process->PRO_ID 'DEL_INIT_DATE' => $initDate,
]); 'DEL_TASK_DUE_DATE' => $taskDueDate,
$application = \ProcessMaker\Model\Application::factory()->create([ 'DEL_RISK_DATE' => $riskDate,
'PRO_UID' => $process->PRO_UID, 'DEL_LAST_INDEX' => 1,
'APP_INIT_USER' => $user->USR_UID, 'USR_ID' => $user->USR_ID,
'APP_CUR_USER' => $user->USR_UID 'PRO_ID' => $process->PRO_ID,
]); 'TAS_ID' => $task->TAS_ID,
'DEL_DATA' => '',
'DEL_TITLE' => $faker->word()
];
});
$delegateDate = $this->faker->dateTime(); // Create a delegation with the foreign keys
$initDate = $this->faker->dateTimeInInterval($delegateDate, '+30 minutes'); $factory->state(\ProcessMaker\Model\Delegation::class, 'web_entry', function (Faker $faker) {
$riskDate = $this->faker->dateTimeInInterval($initDate, '+1 day'); // Create values in the foreign key relations
$taskDueDate = $this->faker->dateTimeInInterval($riskDate, '+2 day'); $user = factory(\ProcessMaker\Model\User::class)->create();
$index = $this->faker->unique()->numberBetween(2000); $category = factory(\ProcessMaker\Model\ProcessCategory::class)->create();
$process = factory(\ProcessMaker\Model\Process::class)->create([
'PRO_CATEGORY' => $category->CATEGORY_UID,
'CATEGORY_ID' => $category->CATEGORY_ID
]);
$task = factory(\ProcessMaker\Model\Task::class)->create([
'PRO_UID' => $process->PRO_UID,
'PRO_ID' => $process->PRO_ID
]);
$application = factory(\ProcessMaker\Model\Application::class)->states('web_entry')->create([
'PRO_UID' => $process->PRO_UID,
'APP_INIT_USER' => $user->USR_UID,
'APP_CUR_USER' => $user->USR_UID
]);
// Return with default values // Return with default values
return [ return [
'DELEGATION_ID' => $this->faker->unique()->numberBetween(5000), 'DELEGATION_ID' => $faker->unique()->numberBetween(5000),
'APP_UID' => $application->APP_UID, 'APP_UID' => $application->APP_UID,
'DEL_INDEX' => $index, 'DEL_INDEX' => 1,
'APP_NUMBER' => $application->APP_NUMBER, 'APP_NUMBER' => $application->APP_NUMBER,
'DEL_PREVIOUS' => $index - 1, 'DEL_PREVIOUS' => 0,
'PRO_UID' => $process->PRO_UID, 'PRO_UID' => $process->PRO_UID,
'TAS_UID' => $task->TAS_UID, 'TAS_UID' => $task->TAS_UID,
'USR_UID' => $user->USR_UID, 'USR_UID' => $user->USR_UID,
'DEL_TYPE' => 'NORMAL', 'DEL_TYPE' => 'NORMAL',
'DEL_THREAD' => 1, 'DEL_THREAD' => 1,
'DEL_THREAD_STATUS' => 'OPEN', 'DEL_THREAD_STATUS' => 'OPEN',
'DEL_PRIORITY' => 3, 'DEL_THREAD_STATUS_ID' => 1,
'DEL_DELEGATE_DATE' => $delegateDate, 'DEL_PRIORITY' => 3,
'DEL_INIT_DATE' => $initDate, 'DEL_DELEGATE_DATE' => $faker->dateTime(),
'DEL_TASK_DUE_DATE' => $taskDueDate, 'DEL_INIT_DATE' => $faker->dateTime(),
'DEL_RISK_DATE' => $riskDate, 'DEL_TASK_DUE_DATE' => $faker->dateTime(),
'DEL_LAST_INDEX' => 1, 'DEL_RISK_DATE' => $faker->dateTime(),
'USR_ID' => $user->USR_ID, 'USR_ID' => $user->USR_ID,
'PRO_ID' => $process->PRO_ID, 'PRO_ID' => $process->PRO_ID,
'TAS_ID' => $task->TAS_ID, 'TAS_ID' => $task->TAS_ID,
'DEL_DATA' => '', 'DEL_DATA' => '',
'DEL_TITLE' => $this->faker->word() 'DEL_TITLE' => $faker->word()
]; ];
}; });
return $this->state($state);
}
/** // Create a open delegation
* Create a delegation with the foreign keys $factory->state(\ProcessMaker\Model\Delegation::class, 'open', function (Faker $faker) {
* @return type // Create dates with sense
*/ $delegateDate = $faker->dateTime();
public function web_entry() $initDate = $faker->dateTimeInInterval($delegateDate, '+30 minutes');
{ $riskDate = $faker->dateTimeInInterval($initDate, '+1 day');
$state = function (array $attributes) { $taskDueDate = $faker->dateTimeInInterval($riskDate, '+2 day');
// Create values in the foreign key relations
$user = \ProcessMaker\Model\User::factory()->create();
$category = \ProcessMaker\Model\ProcessCategory::factory()->create();
$process = \ProcessMaker\Model\Process::factory()->create([
'PRO_CATEGORY' => $category->CATEGORY_UID,
'CATEGORY_ID' => $category->CATEGORY_ID
]);
$task = \ProcessMaker\Model\Task::factory()->create([
'PRO_UID' => $process->PRO_UID,
'PRO_ID' => $process->PRO_ID
]);
$application = \ProcessMaker\Model\Application::factory()->web_entry()->create([
'PRO_UID' => $process->PRO_UID,
'APP_INIT_USER' => $user->USR_UID,
'APP_CUR_USER' => $user->USR_UID
]);
// Return with default values return [
return [ 'DEL_THREAD_STATUS' => 'OPEN',
'DELEGATION_ID' => $this->faker->unique()->numberBetween(5000), 'DEL_THREAD_STATUS_ID' => 1,
'APP_UID' => $application->APP_UID, 'DEL_DELEGATE_DATE' => $delegateDate,
'DEL_INDEX' => 1, 'DEL_INIT_DATE' => $initDate,
'APP_NUMBER' => $application->APP_NUMBER, 'DEL_RISK_DATE' => $riskDate,
'DEL_PREVIOUS' => 0, 'DEL_TASK_DUE_DATE' => $taskDueDate,
'PRO_UID' => $process->PRO_UID, 'DEL_FINISH_DATE' => null
'TAS_UID' => $task->TAS_UID, ];
'USR_UID' => $user->USR_UID, });
'DEL_TYPE' => 'NORMAL',
'DEL_THREAD' => 1,
'DEL_THREAD_STATUS' => 'OPEN',
'DEL_PRIORITY' => 3,
'DEL_DELEGATE_DATE' => $this->faker->dateTime(),
'DEL_INIT_DATE' => $this->faker->dateTime(),
'DEL_TASK_DUE_DATE' => $this->faker->dateTime(),
'DEL_RISK_DATE' => $this->faker->dateTime(),
'USR_ID' => $user->USR_ID,
'PRO_ID' => $process->PRO_ID,
'TAS_ID' => $task->TAS_ID,
'DEL_DATA' => '',
'DEL_TITLE' => $this->faker->word()
];
};
return $this->state($state);
}
/** // Create a closed delegation
* Create a open delegation $factory->state(\ProcessMaker\Model\Delegation::class, 'closed', function (Faker $faker) {
* @return type // Create dates with sense
*/ $delegateDate = $faker->dateTime();
public function open() $initDate = $faker->dateTimeInInterval($delegateDate, '+30 minutes');
{ $riskDate = $faker->dateTimeInInterval($initDate, '+1 day');
$state = function (array $attributes) { $taskDueDate = $faker->dateTimeInInterval($riskDate, '+2 day');
// Create dates with sense $finishDate = $faker->dateTimeInInterval($initDate, '+10 days');
$delegateDate = $this->faker->dateTime();
$initDate = $this->faker->dateTimeInInterval($delegateDate, '+30 minutes');
$riskDate = $this->faker->dateTimeInInterval($initDate, '+1 day');
$taskDueDate = $this->faker->dateTimeInInterval($riskDate, '+2 day');
return [ return [
'DEL_THREAD_STATUS' => 'OPEN', 'DEL_THREAD_STATUS' => 'CLOSED',
'DEL_DELEGATE_DATE' => $delegateDate, 'DEL_DELEGATE_DATE' => $delegateDate,
'DEL_INIT_DATE' => $initDate, 'DEL_INIT_DATE' => $initDate,
'DEL_RISK_DATE' => $riskDate, 'DEL_RISK_DATE' => $riskDate,
'DEL_TASK_DUE_DATE' => $taskDueDate, 'DEL_TASK_DUE_DATE' => $taskDueDate,
'DEL_FINISH_DATE' => null 'DEL_FINISH_DATE' => $finishDate
]; ];
}; });
return $this->state($state);
}
/** // Create a last delegation
* Create a closed delegation $factory->state(\ProcessMaker\Model\Delegation::class, 'last_thread', function (Faker $faker) {
* @return type
*/
public function closed()
{
$state = function (array $attributes) {
// Create dates with sense
$delegateDate = $this->faker->dateTime();
$initDate = $this->faker->dateTimeInInterval($delegateDate, '+30 minutes');
$riskDate = $this->faker->dateTimeInInterval($initDate, '+1 day');
$taskDueDate = $this->faker->dateTimeInInterval($riskDate, '+2 day');
$finishDate = $this->faker->dateTimeInInterval($initDate, '+10 days');
return [ return [
'DEL_THREAD_STATUS' => 'CLOSED', 'DEL_LAST_INDEX' => 1,
'DEL_DELEGATE_DATE' => $delegateDate, ];
'DEL_INIT_DATE' => $initDate, });
'DEL_RISK_DATE' => $riskDate,
'DEL_TASK_DUE_DATE' => $taskDueDate,
'DEL_FINISH_DATE' => $finishDate
];
};
return $this->state($state);
}
/** // Create a first delegation
* Create a last delegation $factory->state(\ProcessMaker\Model\Delegation::class, 'first_thread', function (Faker $faker) {
* @return type
*/
public function last_thread()
{
$state = function (array $attributes) {
return [
'DEL_LAST_INDEX' => 1,
];
};
return $this->state($state);
}
/** return [
* Create a first delegation 'DEL_INDEX' => 1,
* @return type 'DEL_PREVIOUS' => 0,
*/ ];
public function first_thread() });
{
$state = function (array $attributes) {
return [
'DEL_INDEX' => 1,
'DEL_PREVIOUS' => 0,
];
};
return $this->state($state);
}
}

View File

@@ -1,46 +1,34 @@
<?php <?php
/**
* Model factory for web entries
*/
use Faker\Generator as Faker;
namespace Database\Factories; $factory->define(\ProcessMaker\Model\WebEntry::class, function(Faker $faker) {
return [
use App\Factories\Factory; 'WE_UID' => G::generateUniqueID(),
use G; 'PRO_UID' => G::generateUniqueID(),
use Illuminate\Support\Str; 'TAS_UID' => G::generateUniqueID(),
'DYN_UID' => G::generateUniqueID(),
class WebEntryFactory extends Factory 'USR_UID' => G::generateUniqueID(),
{ 'WE_METHOD' => $faker->randomElement(['WS', 'HTML']),
'WE_INPUT_DOCUMENT_ACCESS' => $faker->randomElement([0, 1]),
/** 'WE_DATA' => G::generateUniqueID() . '.php',
* Define the model's default state. 'WE_CREATE_USR_UID' => G::generateUniqueID(),
* 'WE_UPDATE_USR_UID' => G::generateUniqueID(),
* @return array 'WE_CREATE_DATE' => $faker->date('Y-m-d H:i:s', 'now'),
*/ 'WE_UPDATE_DATE' => $faker->date('Y-m-d H:i:s', 'now'),
public function definition() 'WE_TYPE' => $faker->randomElement(['SINGLE', 'MULTIPLE']),
{ 'WE_CUSTOM_TITLE' => $faker->words(5, true),
return [ 'WE_AUTHENTICATION' => $faker->randomElement(['LOGIN_REQUIRED', 'ANONYMOUS']),
'WE_UID' => G::generateUniqueID(), 'WE_HIDE_INFORMATION_BAR' => $faker->randomElement(['0', '1']),
'PRO_UID' => G::generateUniqueID(), 'WE_HIDE_ACTIVE_SESSION_WARNING' => $faker->randomElement(['0', '1']),
'TAS_UID' => G::generateUniqueID(), 'WE_CALLBACK' => $faker->randomElement(['PROCESSMAKER', 'CUSTOM', 'CUSTOM_CLEAR']),
'DYN_UID' => G::generateUniqueID(), 'WE_CALLBACK_URL' => $faker->url,
'USR_UID' => G::generateUniqueID(), 'WE_LINK_GENERATION' => $faker->randomElement(['DEFAULT', 'ADVANCED']),
'WE_METHOD' => $this->faker->randomElement(['WS', 'HTML']), 'WE_LINK_SKIN' => 'classic',
'WE_INPUT_DOCUMENT_ACCESS' => $this->faker->randomElement([0, 1]), 'WE_LINK_LANGUAGE' => 'en',
'WE_DATA' => G::generateUniqueID() . '.php', 'WE_LINK_DOMAIN' => $faker->domainName,
'WE_CREATE_USR_UID' => G::generateUniqueID(), 'WE_SHOW_IN_NEW_CASE' => $faker->randomElement(['0', '1'])
'WE_UPDATE_USR_UID' => G::generateUniqueID(), ];
'WE_CREATE_DATE' => $this->faker->date('Y-m-d H:i:s', 'now'), });
'WE_UPDATE_DATE' => $this->faker->date('Y-m-d H:i:s', 'now'),
'WE_TYPE' => $this->faker->randomElement(['SINGLE', 'MULTIPLE']),
'WE_CUSTOM_TITLE' => $this->faker->words(5, true),
'WE_AUTHENTICATION' => $this->faker->randomElement(['LOGIN_REQUIRED', 'ANONYMOUS']),
'WE_HIDE_INFORMATION_BAR' => $this->faker->randomElement(['0', '1']),
'WE_CALLBACK' => $this->faker->randomElement(['PROCESSMAKER', 'CUSTOM', 'CUSTOM_CLEAR']),
'WE_CALLBACK_URL' => $this->faker->url,
'WE_LINK_GENERATION' => $this->faker->randomElement(['DEFAULT', 'ADVANCED']),
'WE_LINK_SKIN' => 'classic',
'WE_LINK_LANGUAGE' => 'en',
'WE_LINK_DOMAIN' => $this->faker->domainName,
'WE_SHOW_IN_NEW_CASE' => $this->faker->randomElement(['0', '1'])
];
}
}

View File

@@ -17,7 +17,7 @@ class ServerTest extends TestCase
/** /**
* Setup method. * Setup method.
*/ */
public function setUp(): void public function setUp()
{ {
parent::setUp(); parent::setUp();
$this->server = $_SERVER; $this->server = $_SERVER;
@@ -29,7 +29,7 @@ class ServerTest extends TestCase
/** /**
* Teardown method. * Teardown method.
*/ */
public function tearDown(): void public function tearDown()
{ {
parent::tearDown(); parent::tearDown();
$_SERVER = $this->server; $_SERVER = $this->server;
@@ -42,8 +42,8 @@ class ServerTest extends TestCase
*/ */
public function it_should_test_post_token_with_valid_credentials() public function it_should_test_post_token_with_valid_credentials()
{ {
$user = User::where('USR_ID', '=', 1)->get()->first(); $user = User::where('USR_ID', '=', 1)->first();
$oauthClients = OauthClients::factory()->create([ $oauthClients = factory(OauthClients::class)->create([
"USR_UID" => $user->USR_UID "USR_UID" => $user->USR_UID
]); ]);
@@ -80,8 +80,8 @@ class ServerTest extends TestCase
*/ */
public function it_should_test_post_token_with_return_handle_token() public function it_should_test_post_token_with_return_handle_token()
{ {
$user = User::where('USR_ID', '=', 1)->get()->first(); $user = User::where('USR_ID', '=', 1)->first();
$oauthClients = OauthClients::factory()->create([ $oauthClients = factory(OauthClients::class)->create([
"USR_UID" => $user->USR_UID "USR_UID" => $user->USR_UID
]); ]);
@@ -116,8 +116,8 @@ class ServerTest extends TestCase
*/ */
public function it_should_test_post_token_with_empty_client_id() public function it_should_test_post_token_with_empty_client_id()
{ {
$user = User::where('USR_ID', '=', 1)->get()->first(); $user = User::where('USR_ID', '=', 1)->first();
$oauthClients = OauthClients::factory()->create([ $oauthClients = factory(OauthClients::class)->create([
"USR_UID" => $user->USR_UID "USR_UID" => $user->USR_UID
]); ]);
@@ -155,8 +155,8 @@ class ServerTest extends TestCase
*/ */
public function it_should_test_post_token_for_pm_client_id() public function it_should_test_post_token_for_pm_client_id()
{ {
$user = User::where('USR_ID', '=', 1)->get()->first(); $user = User::where('USR_ID', '=', 1)->first();
$oauthClients = OauthClients::where('CLIENT_ID', '=', 'x-pm-local-client')->get()->first(); $oauthClients = OauthClients::where('CLIENT_ID', '=', 'x-pm-local-client')->first();
$data = '{ $data = '{
"grant_type":"password", "grant_type":"password",
@@ -202,7 +202,7 @@ class ServerTest extends TestCase
file_put_contents($filename, $data); file_put_contents($filename, $data);
LicenseManager::truncate(); LicenseManager::truncate();
LicenseManager::factory()->create([ factory(LicenseManager::class)->create([
"LICENSE_DATA" => $data, "LICENSE_DATA" => $data,
"LICENSE_PATH" => $filename, "LICENSE_PATH" => $filename,
"LICENSE_WORKSPACE" => env('MAIN_SYS_SYS') "LICENSE_WORKSPACE" => env('MAIN_SYS_SYS')

View File

@@ -139,15 +139,16 @@ class Capsule {
$iniSet($inclDir, $path); $iniSet($inclDir, $path);
} }
} }
@ini_set('track_errors', true);
include $__template; include $__template;
@ini_restore('track_errors');
// restore the include path // restore the include path
ini_set('include_path', $__old_inc_path); ini_set('include_path', $__old_inc_path);
$lastError = error_get_last(); if (!empty($php_errormsg)) {
if (!empty($lastError['message'])) { throw new Exception("Unable to parse template " . $__template . ": " . $php_errormsg);
throw new Exception("Unable to parse template " . $__template . ": " . $lastError['message']);
} }
} }
@@ -199,9 +200,9 @@ class Capsule {
* @return string "Best guess" path for this file. * @return string "Best guess" path for this file.
*/ */
protected function resolvePath($file, $basepath) { protected function resolvePath($file, $basepath) {
if ( !($file[0] == DIRECTORY_SEPARATOR || $file[0] == '/') if ( !($file[0] == DIRECTORY_SEPARATOR || $file[0] == '/')
// also account for C:\ style path // also account for C:\ style path
&& !($file[1] == ':' && ($file[2] == DIRECTORY_SEPARATOR || $file[2] == '/'))) { && !($file[1] == ':' && ($file[2] == DIRECTORY_SEPARATOR || $file[2] == '/'))) {
if ($basepath != null) { if ($basepath != null) {
$file = $basepath . DIRECTORY_SEPARATOR . $file; $file = $basepath . DIRECTORY_SEPARATOR . $file;
} }