Skip to content

Commit 633c5ad

Browse files
authored
CodeIgniter 3 Compatibility (#2515)
* feat: CodeIgniter 3 Compatibility * fix: Add ignored core files * fix: Rename controllers to be capitalized * tests: Update Snapshots * tests: Update Snapshots * tests: Handle Cgi/Non-Cgi scenarios * fix: Snapshots * tests: Handle 8.2/8.3
1 parent ac0f416 commit 633c5ad

File tree

279 files changed

+70707
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

279 files changed

+70707
-2
lines changed

Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,7 @@ TEST_WEB_70 := \
528528
test_metrics \
529529
test_web_cakephp_28 \
530530
test_web_codeigniter_22 \
531+
test_web_codeigniter_31 \
531532
test_web_laravel_42 \
532533
test_web_lumen_52 \
533534
test_web_nette_24 \
@@ -572,6 +573,7 @@ TEST_WEB_71 := \
572573
test_metrics \
573574
test_web_cakephp_28 \
574575
test_web_codeigniter_22 \
576+
test_web_codeigniter_31 \
575577
test_web_laravel_42 \
576578
test_web_laravel_57 \
577579
test_web_laravel_58 \
@@ -624,6 +626,7 @@ TEST_INTEGRATIONS_72 := \
624626
TEST_WEB_72 := \
625627
test_metrics \
626628
test_web_codeigniter_22 \
629+
test_web_codeigniter_31 \
627630
test_web_drupal_89 \
628631
test_web_laravel_42 \
629632
test_web_laravel_57 \
@@ -682,6 +685,7 @@ TEST_INTEGRATIONS_73 :=\
682685
TEST_WEB_73 := \
683686
test_metrics \
684687
test_web_codeigniter_22 \
688+
test_web_codeigniter_31 \
685689
test_web_drupal_89 \
686690
test_web_laminas_14 \
687691
test_web_laravel_57 \
@@ -742,6 +746,7 @@ TEST_INTEGRATIONS_74 := \
742746
TEST_WEB_74 := \
743747
test_metrics \
744748
test_web_codeigniter_22 \
749+
test_web_codeigniter_31 \
745750
test_web_drupal_89 \
746751
test_web_drupal_95 \
747752
test_web_laminas_14 \
@@ -803,6 +808,7 @@ TEST_INTEGRATIONS_80 := \
803808
TEST_WEB_80 := \
804809
test_metrics \
805810
test_web_codeigniter_22 \
811+
test_web_codeigniter_31 \
806812
test_web_drupal_95 \
807813
test_web_laminas_rest_19 \
808814
test_web_laminas_14 \
@@ -850,6 +856,7 @@ TEST_INTEGRATIONS_81 := \
850856
TEST_WEB_81 := \
851857
test_metrics \
852858
test_web_codeigniter_22 \
859+
test_web_codeigniter_31 \
853860
test_web_drupal_95 \
854861
test_web_drupal_101 \
855862
test_web_laminas_rest_19 \
@@ -900,6 +907,7 @@ TEST_INTEGRATIONS_82 := \
900907
TEST_WEB_82 := \
901908
test_metrics \
902909
test_web_codeigniter_22 \
910+
test_web_codeigniter_31 \
903911
test_web_drupal_95 \
904912
test_web_drupal_101 \
905913
test_web_laminas_rest_19 \
@@ -954,6 +962,7 @@ TEST_INTEGRATIONS_83 := \
954962
TEST_WEB_83 := \
955963
test_metrics \
956964
test_web_codeigniter_22 \
965+
test_web_codeigniter_31 \
957966
test_web_drupal_95 \
958967
test_web_laravel_8x \
959968
test_web_laravel_9x \
@@ -1238,6 +1247,9 @@ test_web_cakephp_28: global_test_run_dependencies
12381247
$(call run_tests_debug,--testsuite=cakephp-28-test)
12391248
test_web_codeigniter_22: global_test_run_dependencies
12401249
$(call run_tests_debug,--testsuite=codeigniter-22-test)
1250+
test_web_codeigniter_31: global_test_run_dependencies
1251+
$(COMPOSER) --working-dir=tests/Frameworks/CodeIgniter/Version_3_1 update
1252+
$(call run_tests_debug,--testsuite=codeigniter-31-test)
12411253
test_web_drupal_89: global_test_run_dependencies
12421254
$(call run_composer_with_retry,tests/Frameworks/Drupal/Version_8_9/core,--ignore-platform-reqs)
12431255
$(call run_composer_with_retry,tests/Frameworks/Drupal/Version_8_9,--ignore-platform-reqs)

src/Integrations/Integrations/CodeIgniter/V2/CodeIgniterIntegration.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function init(\CI_Router $router = null)
3636
return Integration::NOT_LOADED;
3737
}
3838
$majorVersion = \substr(\CI_VERSION, 0, 2);
39-
if ('2.' === $majorVersion) {
39+
if ('2.' === $majorVersion || '3.' === $majorVersion) {
4040
/* After _set_routing has been called the class and method
4141
* are known, so now we can set up tracing on CodeIgniter.
4242
*/
@@ -70,7 +70,7 @@ function (SpanData $span) use ($rootSpan, $method, $service) {
7070

7171
// We took the assumption that all controllers will extend CI_Controller.
7272
// But we've at least seen one healthcheck controller not extending it.
73-
if ($this->load && \method_exists($this->load, 'helper')) {
73+
if (property_exists($this, 'load') && $this->load && \method_exists($this->load, 'helper')) {
7474
$this->load->helper('url');
7575

7676
if (!array_key_exists(Tag::HTTP_URL, $rootSpan->meta)) {
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# top-most EditorConfig file
2+
root = true
3+
4+
# Unix-style newlines with a newline ending every file
5+
[*]
6+
end_of_line = lf
7+
insert_final_newline = true
8+
9+
# Matches multiple files with brace expansion notation
10+
# Set default charset
11+
[*]
12+
charset = utf-8
13+
14+
# Tab indentation (no size specified)
15+
indent_style = tab
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
.DS_Store
2+
3+
application/cache/*
4+
!application/cache/index.html
5+
6+
application/logs/*
7+
!application/logs/index.html
8+
9+
!application/*/.htaccess
10+
11+
composer.lock
12+
tests/mocks/database/ci_test.sqlite
13+
14+
user_guide_src/build/*
15+
user_guide_src/cilexer/build/*
16+
user_guide_src/cilexer/dist/*
17+
user_guide_src/cilexer/pycilexer.egg-info/*
18+
/vendor/
19+
20+
# IDE Files
21+
#-------------------------
22+
/nbproject/
23+
.idea/*
24+
25+
## Sublime Text cache files
26+
*.tmlanguage.cache
27+
*.tmPreferences.cache
28+
*.stTheme.cache
29+
*.sublime-workspace
30+
*.sublime-project
31+
/tests/tests/
32+
/tests/results/
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<IfModule authz_core_module>
2+
Require all denied
3+
</IfModule>
4+
<IfModule !authz_core_module>
5+
Deny from all
6+
</IfModule>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>403 Forbidden</title>
5+
</head>
6+
<body>
7+
8+
<p>Directory access is forbidden.</p>
9+
10+
</body>
11+
</html>
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
<?php
2+
defined('BASEPATH') OR exit('No direct script access allowed');
3+
4+
/*
5+
| -------------------------------------------------------------------
6+
| AUTO-LOADER
7+
| -------------------------------------------------------------------
8+
| This file specifies which systems should be loaded by default.
9+
|
10+
| In order to keep the framework as light-weight as possible only the
11+
| absolute minimal resources are loaded by default. For example,
12+
| the database is not connected to automatically since no assumption
13+
| is made regarding whether you intend to use it. This file lets
14+
| you globally define which systems you would like loaded with every
15+
| request.
16+
|
17+
| -------------------------------------------------------------------
18+
| Instructions
19+
| -------------------------------------------------------------------
20+
|
21+
| These are the things you can load automatically:
22+
|
23+
| 1. Packages
24+
| 2. Libraries
25+
| 3. Drivers
26+
| 4. Helper files
27+
| 5. Custom config files
28+
| 6. Language files
29+
| 7. Models
30+
|
31+
*/
32+
33+
/*
34+
| -------------------------------------------------------------------
35+
| Auto-load Packages
36+
| -------------------------------------------------------------------
37+
| Prototype:
38+
|
39+
| $autoload['packages'] = array(APPPATH.'third_party', '/usr/local/shared');
40+
|
41+
*/
42+
$autoload['packages'] = array();
43+
44+
/*
45+
| -------------------------------------------------------------------
46+
| Auto-load Libraries
47+
| -------------------------------------------------------------------
48+
| These are the classes located in system/libraries/ or your
49+
| application/libraries/ directory, with the addition of the
50+
| 'database' library, which is somewhat of a special case.
51+
|
52+
| Prototype:
53+
|
54+
| $autoload['libraries'] = array('database', 'email', 'session');
55+
|
56+
| You can also supply an alternative library name to be assigned
57+
| in the controller:
58+
|
59+
| $autoload['libraries'] = array('user_agent' => 'ua');
60+
*/
61+
$autoload['libraries'] = array();
62+
63+
/*
64+
| -------------------------------------------------------------------
65+
| Auto-load Drivers
66+
| -------------------------------------------------------------------
67+
| These classes are located in system/libraries/ or in your
68+
| application/libraries/ directory, but are also placed inside their
69+
| own subdirectory and they extend the CI_Driver_Library class. They
70+
| offer multiple interchangeable driver options.
71+
|
72+
| Prototype:
73+
|
74+
| $autoload['drivers'] = array('cache');
75+
|
76+
| You can also supply an alternative property name to be assigned in
77+
| the controller:
78+
|
79+
| $autoload['drivers'] = array('cache' => 'cch');
80+
|
81+
*/
82+
$autoload['drivers'] = array();
83+
84+
/*
85+
| -------------------------------------------------------------------
86+
| Auto-load Helper Files
87+
| -------------------------------------------------------------------
88+
| Prototype:
89+
|
90+
| $autoload['helper'] = array('url', 'file');
91+
*/
92+
$autoload['helper'] = array();
93+
94+
/*
95+
| -------------------------------------------------------------------
96+
| Auto-load Config files
97+
| -------------------------------------------------------------------
98+
| Prototype:
99+
|
100+
| $autoload['config'] = array('config1', 'config2');
101+
|
102+
| NOTE: This item is intended for use ONLY if you have created custom
103+
| config files. Otherwise, leave it blank.
104+
|
105+
*/
106+
$autoload['config'] = array();
107+
108+
/*
109+
| -------------------------------------------------------------------
110+
| Auto-load Language files
111+
| -------------------------------------------------------------------
112+
| Prototype:
113+
|
114+
| $autoload['language'] = array('lang1', 'lang2');
115+
|
116+
| NOTE: Do not include the "_lang" part of your file. For example
117+
| "codeigniter_lang.php" would be referenced as array('codeigniter');
118+
|
119+
*/
120+
$autoload['language'] = array();
121+
122+
/*
123+
| -------------------------------------------------------------------
124+
| Auto-load Models
125+
| -------------------------------------------------------------------
126+
| Prototype:
127+
|
128+
| $autoload['model'] = array('first_model', 'second_model');
129+
|
130+
| You can also supply an alternative model name to be assigned
131+
| in the controller:
132+
|
133+
| $autoload['model'] = array('first_model' => 'first');
134+
*/
135+
$autoload['model'] = array();

0 commit comments

Comments
 (0)