[Git][codeigniterpower/codeigniterpower][codeigniter2] 4 commits: PHP 8.2 support for dynamics properties, improve table class

1 view
Skip to first unread message

Герхард PICCORO Lenz McKAY (@mckaygerhard)

unread,
Feb 6, 2024, 2:34:09 PMFeb 6
to venenux...@googlegroups.com

Герхард PICCORO Lenz McKAY pushed to branch codeigniter2 at codeigniterpower / codeigniterpower

Commits:

  • 6b56f9f9
    by mckaygerhard at 2024-02-06T14:42:19-04:00
    PHP 8.2 support for dynamics properties, improve table class
    
    * Adding PHP 8.2 support by using AllowDynamicProps tag comment
      thanks to @diazvictor
    * backported for CI2 from
      https://gitlab.com/codeigniterpower/codeigniterpower/commit/0e109f6eb4ff38167849cef9544a11657cc908a2
    
  • fc8e7a39
    by mckaygerhard at 2024-02-06T15:02:32-04:00
    Fix PHP 8.1 E_DEPRECATED issue when the page has no output.
    
    * backported commit aad14aaf58d8b4b3e0278b27ec7be747a05a9cee
    
  • 0728e2a0
    by mckaygerhard at 2024-02-06T15:08:59-04:00
    fix generating captcha in PHP with workaround in CI2 for php
    
    * allows php8 working too alongside php7/php5
    * Fixed bcit-ci/CodeIgniter#6256
    * backported from 0175908e9728cbf9f3be3ce6ce5545d2e710fad0
    
  • c105802f
    by mckaygerhard at 2024-02-06T15:34:33-04:00
    Fix php8/php7 compat for xml_parser_create that nows returns object
    
    * this function returns an XMLParser instance on php8;
      previously, a resource was returned, or false on failure.
      so i just compare php versions and use thep roperty on
    

13 changed files:

Changes:

  • appsys/core/Controller.php
    ... ... @@ -27,6 +27,7 @@
    27 27
      * @author		ExpressionEngine Dev Team
    
    28 28
      * @link		http://codeigniter.com/user_guide/general/controllers.html
    
    29 29
      */
    
    30
    +#[AllowDynamicProperties]
    
    30 31
     class CI_Controller {
    
    31 32
     
    
    32 33
     	private static $instance;
    

  • appsys/core/Loader.php
    ... ... @@ -26,6 +26,7 @@
    26 26
      * @category	Loader
    
    27 27
      * @link		http://codeigniter.com/user_guide/libraries/loader.html
    
    28 28
      */
    
    29
    +#[AllowDynamicProperties]
    
    29 30
     class CI_Loader {
    
    30 31
     
    
    31 32
     	// All these are set automatically. Don't mess with them.
    

  • appsys/core/Output.php
    ... ... @@ -359,7 +359,7 @@ class CI_Output {
    359 359
     
    
    360 360
     		$elapsed = $BM->elapsed_time('total_execution_time_start', 'total_execution_time_end');
    
    361 361
     
    
    362
    -		if ($this->parse_exec_vars === TRUE)
    
    362
    +		if ($this->parse_exec_vars === TRUE && !empty($output))
    
    363 363
     		{
    
    364 364
     			$memory	 = ( ! function_exists('memory_get_usage')) ? '0' : round(memory_get_usage()/1024/1024, 2).'MB';
    
    365 365
     
    

  • appsys/database/DB_driver.php
    ... ... @@ -28,6 +28,7 @@
    28 28
      * @author		ExpressionEngine Dev Team
    
    29 29
      * @link		http://codeigniter.com/user_guide/database/
    
    30 30
      */
    
    31
    +#[AllowDynamicProperties]
    
    31 32
     class CI_DB_driver {
    
    32 33
     
    
    33 34
     	var $username;
    

  • appsys/helpers/captcha_helper.php
    ... ... @@ -248,12 +248,12 @@ if ( ! function_exists('create_captcha'))
    248 248
     		{
    
    249 249
     			$theta = $theta + $thetac;
    
    250 250
     			$rad = $radius * ($i / $points );
    
    251
    -			$x = ($rad * cos($theta)) + $x_axis;
    
    252
    -			$y = ($rad * sin($theta)) + $y_axis;
    
    251
    +			$x = round(($rad * cos($theta)) + $x_axis);
    
    252
    +			$y = round(($rad * sin($theta)) + $y_axis);
    
    253 253
     			$theta = $theta + $thetac;
    
    254 254
     			$rad1 = $radius * (($i + 1) / $points);
    
    255
    -			$x1 = ($rad1 * cos($theta)) + $x_axis;
    
    256
    -			$y1 = ($rad1 * sin($theta )) + $y_axis;
    
    255
    +			$x1 = round(($rad1 * cos($theta)) + $x_axis);
    
    256
    +			$y1 = round(($rad1 * sin($theta )) + $y_axis);
    
    257 257
     			imageline($im, $x, $y, $x1, $y1, $grid_color);
    
    258 258
     			$theta = $theta - $thetac;
    
    259 259
     		}
    

  • appsys/libraries/Console.php
    ... ... @@ -17,6 +17,7 @@
    17 17
     	License:
    
    18 18
     		MIT 
    
    19 19
     */
    
    20
    +#[AllowDynamicProperties]
    
    20 21
     class Console {
    
    21 22
     
    
    22 23
     	/*
    

  • appsys/libraries/Driver.php
    ... ... @@ -27,6 +27,7 @@
    27 27
      * @author		EllisLab Dev Team
    
    28 28
      * @link
    
    29 29
      */
    
    30
    +#[AllowDynamicProperties]
    
    30 31
     class CI_Driver_Library {
    
    31 32
     
    
    32 33
     	protected $valid_drivers	= array();
    

  • appsys/libraries/Profiler.php
    ... ... @@ -30,6 +30,7 @@
    30 30
      * @author		ExpressionEngine Dev Team
    
    31 31
      * @link		https://codeigniterpower.github.io/codeigniter-profiler/
    
    32 32
      */
    
    33
    +#[AllowDynamicProperties]
    
    33 34
     class CI_Profiler extends CI_Loader {
    
    34 35
     
    
    35 36
     	protected $CI;
    

  • appsys/libraries/REST.php
    ... ... @@ -13,6 +13,7 @@
    13 13
     * @license http://philsturgeon.co.uk/code/dbad-license
    
    14 14
     * @link http://getsparks.org/packages/restclient/show
    
    15 15
     */
    
    16
    +#[AllowDynamicProperties]
    
    16 17
     class REST
    
    17 18
     {
    
    18 19
     	protected $_ci;
    

  • appsys/libraries/REST_Controller.php
    ... ... @@ -14,6 +14,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
    14 14
     * @version 3.0.0
    
    15 15
     * hackeD by FeniX, see line 516 
    
    16 16
     */
    
    17
    +#[AllowDynamicProperties]
    
    17 18
     abstract class REST_Controller extends CI_Controller {
    
    18 19
     	// Note: Only the widely used HTTP status codes are documented
    
    19 20
     
    

  • appsys/libraries/Upload.php
    ... ... @@ -24,6 +24,7 @@
    24 24
      * @author		ExpressionEngine Dev Team
    
    25 25
      * @link		http://codeigniter.com/user_guide/libraries/file_uploading.html
    
    26 26
      */
    
    27
    +#[AllowDynamicProperties]
    
    27 28
     class CI_Upload {
    
    28 29
     
    
    29 30
     	public $max_size				= 0;
    

  • appsys/libraries/Xmlrpc.php
    ... ... @@ -703,6 +703,10 @@ class XML_RPC_Message extends CI_Xmlrpc
    703 703
     		//-------------------------------------
    
    704 704
     
    
    705 705
     		$parser = xml_parser_create($this->xmlrpc_defencoding);
    
    706
    +		if (version_compare(PHP_VERSION, '7.2.0') >= 0 && is_object($parser))
    
    707
    +			$parser = spl_object_id($parser);
    
    708
    +		else
    
    709
    +			$parser = (string) $parser;
    
    706 710
     
    
    707 711
     		$this->xh[$parser]					= array();
    
    708 712
     		$this->xh[$parser]['isf']			= 0;
    
    ... ... @@ -847,6 +851,11 @@ class XML_RPC_Message extends CI_Xmlrpc
    847 851
     
    
    848 852
     	function open_tag($the_parser, $name, $attrs)
    
    849 853
     	{
    
    854
    +		if (version_compare(PHP_VERSION, '7.2.0') >= 0 && is_object($the_parser))
    
    855
    +			$the_parser = spl_object_id($the_parser);
    
    856
    +		else
    
    857
    +			$the_parser = (string) $the_parser;
    
    858
    +
    
    850 859
     		// If invalid nesting, then return
    
    851 860
     		if ($this->xh[$the_parser]['isf'] > 1) return;
    
    852 861
     
    
    ... ... @@ -949,6 +958,11 @@ class XML_RPC_Message extends CI_Xmlrpc
    949 958
     
    
    950 959
     	function closing_tag($the_parser, $name)
    
    951 960
     	{
    
    961
    +		if (version_compare(PHP_VERSION, '7.2.0') >= 0 && is_object($the_parser))
    
    962
    +			$the_parser = spl_object_id($the_parser);
    
    963
    +		else
    
    964
    +			$the_parser = (string) $the_parser;
    
    965
    +
    
    952 966
     		if ($this->xh[$the_parser]['isf'] > 1) return;
    
    953 967
     
    
    954 968
     		// Remove current element from stack and set variable
    
    ... ... @@ -1093,6 +1107,11 @@ class XML_RPC_Message extends CI_Xmlrpc
    1093 1107
     
    
    1094 1108
     	function character_data($the_parser, $data)
    
    1095 1109
     	{
    
    1110
    +		if (version_compare(PHP_VERSION, '7.2.0') >= 0 && is_object($the_parser))
    
    1111
    +			$the_parser = spl_object_id($the_parser);
    
    1112
    +		else
    
    1113
    +			$the_parser = (string) $the_parser;
    
    1114
    +
    
    1096 1115
     		if ($this->xh[$the_parser]['isf'] > 1) return; // XML Fault found already
    
    1097 1116
     
    
    1098 1117
     		// If a value has not been found
    

  • appsys/libraries/Xmlrpcs.php
    ... ... @@ -190,6 +190,10 @@ class CI_Xmlrpcs extends CI_Xmlrpc
    190 190
     
    
    191 191
     		$parser = xml_parser_create($this->xmlrpc_defencoding);
    
    192 192
     		$parser_object = new XML_RPC_Message("filler");
    
    193
    +		if (version_compare(PHP_VERSION, '7.2.0') >= 0 && is_object($parser))
    
    194
    +			$parser = spl_object_id($parser);
    
    195
    +		else
    
    196
    +			$parser = (string) $parser;
    
    193 197
     
    
    194 198
     		$parser_object->xh[$parser]					= array();
    
    195 199
     		$parser_object->xh[$parser]['isf']			= 0;
    


View it on GitLab.
You're receiving this email because of your account on gitlab.com. Manage all notifications · Help

Reply all
Reply to author
Forward
0 new messages