Skip to content

preg_split error message with php 8.1 #2735

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

Closed
Zignature opened this issue Jan 10, 2023 · 2 comments · Fixed by #2736
Closed

preg_split error message with php 8.1 #2735

Zignature opened this issue Jan 10, 2023 · 2 comments · Fixed by #2736

Comments

@Zignature
Copy link

Description of the problem
Came across the same error as in issue #2348 concerning another line in ee/ExpressionEngine/Service/Formatter/Formats/Text.php after upgrading PHP to 8.1.0.

How To Reproduce
Upgrade PHP from v7.4.29 to v8.1.0

Error Messages

preg_split(): Passing null to parameter #3 ($limit) of type int is deprecated
ee/ExpressionEngine/Service/Formatter/Formats/Text.php, line 160

Severity: E_DEPRECATED

Environment Details:

  • EE Version: 7.2.5
  • PHP Version 8.1
  • MariaDB 10.4.24
  • Apache 2.4.54
  • Windows 11 Pro 22H2 build 22621.963

Possible Solution
Line 160:
$censored = preg_split('/[\n|\|]/', $censored, null, PREG_SPLIT_NO_EMPTY);

should probably be changed to:
$censored = preg_split('/[\n|\|]/', $censored, 0, PREG_SPLIT_NO_EMPTY);

@Zignature
Copy link
Author

I noticed another one on line 382:
foreach (preg_split('/[\s\|]/', $options['options'], null, PREG_SPLIT_NO_EMPTY) as $param) {

@intoeetive
Copy link
Contributor

@Zignature the referenced PR is fixing that one as well

matthewjohns0n added a commit that referenced this issue Jan 17, 2023
…-php-81

Resolved #2735 where Text Formatter could show deprecation notices when using PHP 8.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants