I’ve just found a strange behaviour trying to load a view while adding dynamic data to it.
It’s a peculiar case and i need it to be confirmed before i submit it to the Bug Tracker.
My controller:
class MyController extends Controller
{
function MyController()
{
parent::Controller();
}
function index()
{
$data = array(
'title' => 'My Title',
'path' => 'My Title',
'heading' => 'My Heading',
'message' => 'My Message'
);
$this->load->view('myview', $data);
}
}
If in the passed array there is a key named “path” the view is not loaded at all
throwing this warning:
A PHP Error was encountered
Severity: Warning
Message: CI_Loader::include(My Title) [function.CI-Loader-include]: failed to open stream: No such file or directory
Filename: libraries/Loader.php
Line Number: 652
a quick check reveals that $data[‘path’] is used in libraries/Loader.php line 652 instead of the correct path.
Removing the $data[‘path’] key will fix the problem.
Is this a bug? Can you reproduce it?
—————————
Environement:
PHP Version 5.2.1
Apache 2.2.3
