Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Enable root index.php to get CAKE_CORE_INCLUDE_PATH from PHP 'include_path' #788

Closed
wants to merge 2 commits into from

4 participants

@leokolln

Before this path, it was necessary to manually configure the CAKE_CORE_INCLUDE_PATH on the '/index.php' for a shared location Core Lib.

The modification was based on the detection code of the 'webroot/index.php'

index.php
@@ -36,7 +36,12 @@
* Full path to the directory containing "cake". Do not add trailing directory separator
*/
if (!defined('CAKE_CORE_INCLUDE_PATH')) {
- define('CAKE_CORE_INCLUDE_PATH', ROOT . DS . 'lib');
+ if (function_exists('ini_set')) {
+ ini_set('include_path', ROOT . DS . 'lib' . PATH_SEPARATOR . ini_get('include_path'));
+ }
+ else {
@markstory Owner

This else is all wrong, try running this change through the code sniffer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@leokolln

Sorry for the initial mistake.
Corrected version added to this pull.

Ps: The phpcs returned no warnings on the old pull. (Maybe missconfiguration on my part...)

@markstory
Owner

You need to include --standard=CakePHP and install the CakePHP code sniffer rules.

@leokolln

I had done it...
Is the new commit ok?

@adael

For include path, I think is better to use set_include_path and get_include_path available from (PHP 4 >= 4.3.0, PHP 5)

set_include_path(get_include_path() . PATH_SEPARATOR . $path);

http://php.net/manual/en/function.set-include-path.php

@leokolln

If so, there is a need to change the implementation on files "/app/webroot/index.php" and "/app/webroot/test.php" too.

@leokolln

So, do you want me to implement as @adael said or the commit as it stands is enough?

@markstory
Owner

I don't think there is a need to change the files in webroot, as if you're hitting the top level index.php then CAKE_CORE_INCLUDE_PATH will already be set.

@markstory
Owner

One thing that does need to be updated though is the top level index.php file in lib/Cake/Console/Templates/skel

@jippi
Collaborator

Hi

I'm gonna close this PR as it's 11 months old and haven't gotten any love

Thanks for the contribution though :)

@jippi jippi closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 23, 2012
  1. @leokolln
Commits on Aug 24, 2012
  1. @leokolln
This page is out of date. Refresh to see the latest.
Showing with 5 additions and 1 deletion.
  1. +5 −1 index.php
View
6 index.php
@@ -36,7 +36,11 @@
* Full path to the directory containing "cake". Do not add trailing directory separator
*/
if (!defined('CAKE_CORE_INCLUDE_PATH')) {
- define('CAKE_CORE_INCLUDE_PATH', ROOT . DS . 'lib');
+ if (function_exists('ini_set')) {
+ ini_set('include_path', ROOT . DS . 'lib' . PATH_SEPARATOR . ini_get('include_path'));
+ } else {
+ define('CAKE_CORE_INCLUDE_PATH', ROOT . DS . 'lib');
+ }
}
require APP_DIR . DS . WEBROOT_DIR . DS . 'index.php';
Something went wrong with that request. Please try again.