Welcome Guest, Not a member yet? Register   Sign In
CI3.1.13 and PHP 8.2
#1

Hello  dev's

Problem on codeigniter 3.1.13

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI::$benchmark is deprecated

Filename: core/Controller.php
Line Number: 83

This code $this->$var =& load_class($class);

what a fix?
Reply
#2

See https://github.com/bcit-ci/CodeIgniter/pull/6173
Reply
#3

Hello
It's OK
IN systemcore/Router.php   and   systemcore/Controller.php  add  this code  under
defined('BASEPATH') OR exit('No direct script access allowed');
#[AllowDynamicProperties]//PHP 8.2 Creation of dynamic property MY_Router::$uri is deprecated

Thank you
Byoosdigital
Reply
#4

(This post was last modified: 01-09-2023, 11:23 AM by volkankaban.)

Hey, thanks for your help! I'm having some issues with PHP 8.2. I can't use the index.php file in the public folder, and I'm getting a config error. It looks like index.php is adding '/development' to the config link for some reason.
I'm getting this error message: 'An Error Was Encountered. The configuration file paypal.php does not exist. C:\wamp\www\ci3\application\config/development\paypal.php'

application
public/index.php
system
vendor

https://github.com/volkankaban/ci3

index.php

PHP Code:
<?php

define
('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'development');
switch (
ENVIRONMENT) {
    case 'development':
        error_reporting(-1);
        ini_set('display_errors'1);
        break;
    case 'testing':
    case 'production':
        ini_set('display_errors'0);
        error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
        break;
    default:
        header('HTTP/1.1 503 Service Unavailable.'true503);
        echo 'The application environment is not set correctly.';
        exit(1); // EXIT_ERROR
}

$system_path '../system';
$application_folder 'application';
$view_folder '';

if (
defined('STDIN')) {
    chdir(dirname(__FILE__));
}
if ((
$_temp realpath($system_path)) !== false) {
    $system_path $_temp.DIRECTORY_SEPARATOR;
} else {
    $system_path strtr(
                    rtrim($system_path'/\\'),
                    '/\\',
                    DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
            
).DIRECTORY_SEPARATOR;
}
if ( ! 
is_dir($system_path)) {
    header('HTTP/1.1 503 Service Unavailable.'true503);
    echo 'Your system folder path does not appear to be set correctly. Please open the following file and correct this: '.pathinfo(__FILE__PATHINFO_BASENAME);
    exit(3); // EXIT_CONFIG
}

define('SELF'pathinfo(__FILE__PATHINFO_BASENAME));
define('BASEPATH'$system_path);
define('FCPATH'__DIR__.DIRECTORY_SEPARATOR.'..');
define('SYSDIR'basename(BASEPATH));
chdir(FCPATH);

if (
is_dir($application_folder)) {
    if (($_temp realpath($application_folder)) !== false) {
        $application_folder $_temp;
    } else {
        $application_folder strtr(
                rtrim($application_folder"/\\"),
                "/\\",
                DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
        
);
    }
} elseif (
is_dir(BASEPATH.$application_folder.DIRECTORY_SEPARATOR)) {
    $application_folder =
            BASEPATH.
            strtr(
                    trim($application_folder"/\\"),
                    "/\\",
                    DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
            
);
} else {
    header('HTTP/1.1 503 Service Unavailable.'true503);
    echo 'Your application folder path does not appear to be set correctly. Please open the following file and correct this: '.
            self;
    exit(3); // EXIT_CONFIG
}

define('APPPATH'$application_folder.DIRECTORY_SEPARATOR);
if (
        ! isset($view_folder[0]) &&
        is_dir(APPPATH.'views'.DIRECTORY_SEPARATOR)
) {
    $view_folder APPPATH.'views';
} elseif (
is_dir($view_folder)) {
    if (($_temp realpath($view_folder)) !== false) {
        $view_folder $_temp;
    } else {
        $view_folder strtr(
                rtrim($view_folder"/\\"),
                "/\\",
                DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
        
);
    }
} elseif (
is_dir(APPPATH.$view_folder.DIRECTORY_SEPARATOR)) {
    $view_folder =
            APPPATH.
            strtr(
                    trim($view_folder"/\\"),
                    "/\\",
                    DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
            
);
} else {
    header('HTTP/1.1 503 Service Unavailable.'true503);
    echo 'Your view folder path does not appear to be set correctly. Please open the following file and correct this: '.
            self;
    exit(3); // EXIT_CONFIG
}
define('VIEWPATH'$view_folder.DIRECTORY_SEPARATOR);
require_once 
BASEPATH.'core/CodeIgniter.php'
Reply
#5

See https://www.codeigniter.com/userguide3/l...vironments
Reply
#6

(01-09-2023, 10:26 AM)volkankaban Wrote: Hey, thanks for your help! I'm having some issues with PHP 8.2. I can't use the index.php file in the public folder, and I'm getting a config error. It looks like index.php is adding '/development' to the config link for some reason.
I'm getting this error message: 'An Error Was Encountered. The configuration file paypal.php does not exist. C:\wamp\www\ci3\application\config/development\paypal.php'

application
public/index.php
system
vendor

https://github.com/volkankaban/ci3

index.php

PHP Code:
<?php

define
('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'development');
switch (
ENVIRONMENT) {
    case 'development':
        error_reporting(-1);
        ini_set('display_errors'1);
        break;
    case 'testing':
    case 'production':
        ini_set('display_errors'0);
        error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
        break;
    default:
        header('HTTP/1.1 503 Service Unavailable.'true503);
        echo 'The application environment is not set correctly.';
        exit(1); // EXIT_ERROR
}

$system_path '../system';
$application_folder 'application';
$view_folder '';

if (
defined('STDIN')) {
    chdir(dirname(__FILE__));
}
if ((
$_temp realpath($system_path)) !== false) {
    $system_path $_temp.DIRECTORY_SEPARATOR;
} else {
    $system_path strtr(
                    rtrim($system_path'/\\'),
                    '/\\',
                    DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
            
).DIRECTORY_SEPARATOR;
}
if ( ! 
is_dir($system_path)) {
    header('HTTP/1.1 503 Service Unavailable.'true503);
    echo 'Your system folder path does not appear to be set correctly. Please open the following file and correct this: '.pathinfo(__FILE__PATHINFO_BASENAME);
    exit(3); // EXIT_CONFIG
}

define('SELF'pathinfo(__FILE__PATHINFO_BASENAME));
define('BASEPATH'$system_path);
define('FCPATH'__DIR__.DIRECTORY_SEPARATOR.'..');
define('SYSDIR'basename(BASEPATH));
chdir(FCPATH);

if (
is_dir($application_folder)) {
    if (($_temp realpath($application_folder)) !== false) {
        $application_folder $_temp;
    } else {
        $application_folder strtr(
                rtrim($application_folder"/\\"),
                "/\\",
                DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
        
);
    }
} elseif (
is_dir(BASEPATH.$application_folder.DIRECTORY_SEPARATOR)) {
    $application_folder =
            BASEPATH.
            strtr(
                    trim($application_folder"/\\"),
                    "/\\",
                    DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
            
);
} else {
    header('HTTP/1.1 503 Service Unavailable.'true503);
    echo 'Your application folder path does not appear to be set correctly. Please open the following file and correct this: '.
            self;
    exit(3); // EXIT_CONFIG
}

define('APPPATH'$application_folder.DIRECTORY_SEPARATOR);
if (
        ! isset($view_folder[0]) &&
        is_dir(APPPATH.'views'.DIRECTORY_SEPARATOR)
) {
    $view_folder APPPATH.'views';
} elseif (
is_dir($view_folder)) {
    if (($_temp realpath($view_folder)) !== false) {
        $view_folder $_temp;
    } else {
        $view_folder strtr(
                rtrim($view_folder"/\\"),
                "/\\",
                DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
        
);
    }
} elseif (
is_dir(APPPATH.$view_folder.DIRECTORY_SEPARATOR)) {
    $view_folder =
            APPPATH.
            strtr(
                    trim($view_folder"/\\"),
                    "/\\",
                    DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
            
);
} else {
    header('HTTP/1.1 503 Service Unavailable.'true503);
    echo 'Your view folder path does not appear to be set correctly. Please open the following file and correct this: '.
            self;
    exit(3); // EXIT_CONFIG
}
define('VIEWPATH'$view_folder.DIRECTORY_SEPARATOR);
require_once 
BASEPATH.'core/CodeIgniter.php'

(01-09-2023, 05:09 PM)kenjis Wrote: See https://www.codeigniter.com/userguide3/l...vironments
Your a life saver!
Reply
#7

(This post was last modified: 01-12-2024, 04:38 AM by umutsurmeli.)

You can try https://github.com/umutsurmeli/codeigniter3_php8.2  Ci3 fork on github.
But this branch is not completed.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB