Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: [Debug] Backtrace does not display contents of file in PHP +8.3.0 #8616

Closed
wants to merge 2 commits into from

Conversation

Nightprince
Copy link

@Nightprince Nightprince commented Mar 10, 2024

https://www.php.net/manual/en/function.highlight-string.php

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@kenjis kenjis added the tests needed Pull requests that need tests label Mar 10, 2024
@kenjis
Copy link
Member

kenjis commented Mar 10, 2024

Thank you for sending PR!

Can you explain what's the issue, and add test code to prove your fix?

See https://github.com/codeigniter4/CodeIgniter4/blob/develop/contributing/pull_request.md#unit-testing

system/Debug/Exceptions.php Outdated Show resolved Hide resolved
@paulbalandan
Copy link
Member

I think this is fixing the highlight_string output which I believe has been fixed already in 4.5 branch.

@Nightprince
Copy link
Author

Thank you for sending PR!

Can you explain what's the issue, and add test code to prove your fix?

See https://github.com/codeigniter4/CodeIgniter4/blob/develop/contributing/pull_request.md#unit-testing

In PHP versions 8.3.0 and above due to update of highlight_string function
https://www.php.net/manual/en/function.highlight-string.php
Backtrace does not display contents of file and does not highlight error line and is empty.

@kenjis
Copy link
Member

kenjis commented Mar 11, 2024

I think it was fixed in #8401.

@Nightprince Can you show the steps to reproduce the issue?
Why do you need to fix the deprecated method?

@kenjis kenjis changed the title System/Debug: Fix show Backtrace in PHP +8.3.0 fix: [Debug] Backtrace does not display contents of file in PHP +8.3.0 Mar 11, 2024
@datamweb
Copy link
Contributor

@Nightprince Can you post a screenshot before and after this PR?

@Nightprince
Copy link
Author

@Nightprince Can you post a screenshot before and after this PR?

Before:

Screenshot 2024-03-14 095340

After:

Screenshot 2024-03-14 095510

@kenjis
Copy link
Member

kenjis commented Mar 14, 2024

It seems you are using very old CI4. Could you update to v4.4.6?

@datamweb
Copy link
Contributor

@Nightprince As mentioned, your CI version is outdated. The output in the CI4.4.6 and PHP 8.3.0 is as follows:

Screenshot 2024-03-14 165507

It is recommended to upgrade to the new version. Before anything else don't forget to make a backup then upgrade to the latest version step by step via:
https://codeigniter.com/user_guide/installation/upgrading.html

@kenjis I suggest moving the information shown in footer to the top, it can be helpful in reporting users.

Screenshot 2024-03-14 165748

@kenjis
Copy link
Member

kenjis commented Mar 15, 2024

@datamweb I sent a PR #8626

@Nightprince
Copy link
Author

It seems you are using very old CI4. Could you update to v4.4.6?

problem has been fixed in latest version, but this pull request can be useful for those who use older versions.

@kenjis
Copy link
Member

kenjis commented Mar 15, 2024

We recommend to use the latest version.

But if you really want to fix the deprecated method, modify it exactly the same way as the following change:
https://github.com/codeigniter4/CodeIgniter4/pull/8401/files
Or can I close this?

@Nightprince
Copy link
Author

We recommend to use the latest version.

But if you really want to fix the deprecated method, modify it exactly the same way as the following change:
https://github.com/codeigniter4/CodeIgniter4/pull/8401/files
Or can I close this?

Not important for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests needed Pull requests that need tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants