KD2 Framework  Check-in [b3eca260b9]

Overview
Comment:Fix some issues with PHP 7.4
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | 7.3
Files: files | file ages | folders
SHA1: b3eca260b97a5ae964c4cb047fcf978a4b3787c3
User & Date: bohwaz on 2020-01-30 23:31:33
Other Links: branch diff | manifest | tags
Context
2020-02-12
01:23
HTTP root URI: Return exceptions when required data is missing check-in: 6ea68344b2 user: bohwaz tags: 7.3
2020-01-30
23:31
Fix some issues with PHP 7.4 check-in: b3eca260b9 user: bohwaz tags: 7.3
23:14
Fix some issues with PHP 7.4 check-in: 06c3f53895 user: bohwaz tags: 5.6, trunk
2020-01-29
14:29
EntityManager: use @TABLE instead of {$table} to refer to the entity table check-in: d15e394651 user: bohwaz tags: 7.3
Changes

Modified src/lib/KD2/ErrorManager.php from [cfb9e4ff96] to [a00a72b10a].

651
652
653
654
655
656
657

658
659
660
661
662
663
664
665

666
667
668
669
670
671
672
	 * @param  integer $type Type of error management (ErrorManager::PRODUCTION or ErrorManager::DEVELOPMENT)
	 * @return void
	 */
	static public function enable($type = self::DEVELOPMENT)
	{
		if (self::$enabled)
			return true;


		self::$enabled = $type;

		self::$term_color = function_exists('posix_isatty') && @posix_isatty(STDOUT);

		ini_set('display_errors', false);
		ini_set('log_errors', false);
		ini_set('html_errors', false);

		error_reporting($type == self::DEVELOPMENT ? -1 : E_ALL & ~E_DEPRECATED & ~E_STRICT);

		if ($type == self::DEVELOPMENT && PHP_SAPI != 'cli')
		{
			self::setHtmlHeader('<!DOCTYPE html><meta charset="utf-8" /><style type="text/css">
			body { font-family: sans-serif; } * { margin: 0; padding: 0; }
			u, code b, i, h3 { font-style: normal; font-weight: normal; text-decoration: none; }







>








>







651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
	 * @param  integer $type Type of error management (ErrorManager::PRODUCTION or ErrorManager::DEVELOPMENT)
	 * @return void
	 */
	static public function enable($type = self::DEVELOPMENT)
	{
		if (self::$enabled)
			return true;


		self::$enabled = $type;

		self::$term_color = function_exists('posix_isatty') && @posix_isatty(STDOUT);

		ini_set('display_errors', false);
		ini_set('log_errors', false);
		ini_set('html_errors', false);
		ini_set('zend.exception_ignore_args', false); // We want to get the args in exceptions (since PHP 7.4)
		error_reporting($type == self::DEVELOPMENT ? -1 : E_ALL & ~E_DEPRECATED & ~E_STRICT);

		if ($type == self::DEVELOPMENT && PHP_SAPI != 'cli')
		{
			self::setHtmlHeader('<!DOCTYPE html><meta charset="utf-8" /><style type="text/css">
			body { font-family: sans-serif; } * { margin: 0; padding: 0; }
			u, code b, i, h3 { font-style: normal; font-weight: normal; text-decoration: none; }

Modified src/lib/KD2/Smartyer.php from [b378e07275] to [bd73b93cad].

814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
		// Start counter
		if ($name == 'foreach' || $name == 'for' || $name == 'while')
		{
			$code = '$_i[] = 0; ';
		}

		// This is just PHP, this is easy
		if ($raw_args[0] == '(' && substr($raw_args, -1) == ')')
		{
			$raw_args = $this->parseMagicVariables($raw_args);

			// Make sure the arguments for if/elseif are wrapped in parenthesis
			// as it could be a false positive
			// eg. "if ($a == 1) || ($b == 1)" would create an error
			// this is not valid for other blocks though (foreach/for/while)







|







814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
		// Start counter
		if ($name == 'foreach' || $name == 'for' || $name == 'while')
		{
			$code = '$_i[] = 0; ';
		}

		// This is just PHP, this is easy
		if (substr($raw_args, 0, 1) == '(' && substr($raw_args, -1) == ')')
		{
			$raw_args = $this->parseMagicVariables($raw_args);

			// Make sure the arguments for if/elseif are wrapped in parenthesis
			// as it could be a false positive
			// eg. "if ($a == 1) || ($b == 1)" would create an error
			// this is not valid for other blocks though (foreach/for/while)