Login!
Lost password?
 

MODx Bug/Feature Tracker and Feature Requests

Welcome to the MODx CMS Tracker. Please choose the appropriate project from the drop down menu and provide as much information as possible regarding your server environment and browser. Thanks!

FS#877 — Parser not executed in configurations with auto_prepend_file

Attached to Project — MODx
Opened by Jason Coward (opengeek) - Monday, 28 May 2007, 04:35PM
Last edited by Jason Coward (opengeek) - Thursday, 14 June 2007, 02:11AM
Task Type Bug Report
Category Core Distribution
Status Closed
Assigned To Jason Coward (opengeek)
Operating System All
Severity High
Priority Urgent
Reported Version 0.9.6
Due in Version 0.9.6.1
Due Date Undecided
Percent Complete 100%

Details

When PHP is configured with an auto_prepend_file, the $noparser logic added to index.php is triggered because the number of included files is then greater than 1. As an alternative, I'm going to implement a new constant (MODX_API_MODE) that can be defined before including the index.php to gain access to the $modx object and API. i.e.

define('MODX_API_MODE', true);
include('index.php');
$modx->runSnippet('mySnippet');
...

This task depends upon

This task blocks these from closing
Closed by  Jason Coward (opengeek)
Wednesday, 21 November 2007, 10:50AM
Reason for closing:  Fixed
Additional comments about closing:  This issue is resolved for 0.9.6.1
Comment by Aidan Haskins (shuriken) - Wednesday, 30 May 2007, 10:03PM
This behaviour of get_included_files() is contrary to the PHP documentation:
http://php.net/manual/en/function.get-included-files.php#73541

A workaround is to replace line 49 in index.php:

if(count(get_included_files())>1) $noparser = true;

with this:

if(count(get_included_files())>1) {
$included_files = get_included_files();
if (array_search(__FILE__,get_included_files())>0)
$noparser = true;
}

Comment by Aidan Haskins (shuriken) - Wednesday, 30 May 2007, 10:05PM
oops, should be:

if(count(get_included_files())>1) {
if (array_search(__FILE__,get_included_files())>0)
$noparser = true;
}