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

Message: preg_match(): Compilation failed: #13

Closed
Andrewsuares opened this issue May 1, 2019 · 9 comments
Closed

Message: preg_match(): Compilation failed: #13

Andrewsuares opened this issue May 1, 2019 · 9 comments
Labels
bug Something isn't working

Comments

@Andrewsuares
Copy link

Hello, Any idea what could be wrong here?

CI_VERSION = '3.1.10';
PHP 7.3.4

A PHP Error was encountered

Severity: Warning

Message: preg_match(): Compilation failed: invalid range in character class at offset 33

Filename: src/CILogViewer.php

Line Number: 384

Backtrace:

File: /public_html/api/vendor/seunmatt/codeigniter-log-viewer/src/CILogViewer.php
Line: 384
Function: preg_match

File: /public_html/api/vendor/seunmatt/codeigniter-log-viewer/src/CILogViewer.php
Line: 285
Function: getLogLineStart

File: /public_html/api/vendor/seunmatt/codeigniter-log-viewer/src/CILogViewer.php
Line: 172
Function: processLogs

File: /public_html/api/application/modules/f_cp/controllers/F_cp.php
Line: 116
Function: showLogs

@SeunMatt
Copy link
Owner

SeunMatt commented May 1, 2019

Hi @Andrewsuares

I've not experienced that sort of error before. However, I need you to please do two things for me.

  • First, try using PHP 7.2 and observe the outcome? I'm suspecting it might have to do with PHP version.

  • Secondly, Please dig through the raw stack trace and pinpoint the parameters supplied to the preg_match() function that led to the crash

+1 for stating your PHP and CI versions. I'll be expecting your feedback.

Cheers.

@Andrewsuares
Copy link
Author

Hello Seun, I've deployed CI on a large project and we're good with PHP 7.3. Going to be a bit hard for me to test 7.2. How do I enable to raw stack trace?

Please look at the link below. The preg function was updated in PHP 7.3.
sunra/php-simple-html-dom-parser#64

@SeunMatt
Copy link
Owner

SeunMatt commented May 1, 2019

Ha I see @Andrewsuares
The package needs an update. I'll add it to the pipeline but can't say definitely when it'll be fixed.

In case you fix it in your code, please be so kind as to create a PR for it here as well.
Cheers

@SeunMatt SeunMatt added the bug Something isn't working label May 1, 2019
@matteopuppis
Copy link

Easy fix: you should escape "-" character. Fix at line 30
from this:
const LOG_LINE_START_PATTERN = "/((INFO)|(ERROR)|(DEBUG)|(ALL))[\s-\d:]+(-->)/";
to this
const LOG_LINE_START_PATTERN = "/((INFO)|(ERROR)|(DEBUG)|(ALL))[\s-\d:]+(-->)/";

;)

@matteopuppis
Copy link

I think also the same problem is at line 31:
from this:
const LOG_DATE_PATTERN = "/(\d{4,}-[\d-:]{2,})\s([\d:]{2,})/";
to this:
const LOG_DATE_PATTERN = "/(\d{4,}-[\d-:]{2,})\s([\d:]{2,})/";

@matteopuppis
Copy link

Another fix:

line 35 from this
<a href="?f="
to this
<a href="logs/?f="
or you get path error if defined a base path for css/js....

@semivan
Copy link
Contributor

semivan commented Aug 19, 2019

Hello! Fixed bug: #14

SeunMatt added a commit that referenced this issue Sep 3, 2019
@SeunMatt
Copy link
Owner

SeunMatt commented Sep 3, 2019

Hello @Andrewsuares issue has been fixed in the new version release
version 1.1.2

@SeunMatt SeunMatt closed this as completed Sep 3, 2019
@Andrewsuares
Copy link
Author

I finally got down to installing this update. Works brilliantly. The layout and the ability to see logs so easily just makes it great. Thank You for this!!

PS: Maybe you could do one to view the apache error log files :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants