Problem/Motivation

Found another old file not being handled correctly from the advanced aggregates module.
On modern (8.1+) PHP getting this error:

Deprecated function: preg_split(): Passing null to parameter #2 ($subject) of type string is deprecated in Drupal\api\Formatter::processPattern() (line 1292 of modules/contrib/api/src/Formatter.php).

Drupal\api\Formatter::processPattern('!'([a-zA-Z0-9_\x7f-\xff]+)'!', NULL, '\Drupal\api\Formatter::linkName', Array, '\Drupal\api\Formatter::makeDocumentationLinks', Array, , '', '') (Line: 1138)
Drupal\api\Formatter::makeDocumentationLinks(NULL, Object, '2724', NULL, Array) (Line: 2894)
Drupal\api\Formatter::linkCode(NULL, Object, '2724', NULL, '1') (Line: 2637)
Drupal\api\Formatter::preparePageFileVariables(Object) (Line: 419)
Drupal\api\Controller\OutputController->branchExplicitRoute(Object, 'advagg_css_compress!csstidy!class.csstidy.inc', Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 580)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 163)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 74)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 50)
Drupal\ban\BanMiddleware->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 692)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

But I don't think that is the real error.
Ex: https://nickdickinsonwilde.ca/en/work/drupal-api/advagg/advagg_css_compr... doesn't show any content under source
https://nickdickinsonwilde.ca/en/work/drupal-api/advagg/advagg_css_compr... does have full source.

PHP file: https://git.drupalcode.org/project/advagg/-/blob/7.x-1.x/advagg_css_comp...

Steps to reproduce

Add AdvAgg 7.x-1.x to site and navigate to that path.

Proposed resolution

Fix tokenization? Not sure that's what is going wrong but my first guess.
If you want to say, old not fixing it won't complain. (Right now i'm a bit busy and probably won't be investigating it properly)

Issue fork api-3379409

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

NickDickinsonWilde created an issue. See original summary.

fjgarlin made their first commit to this issue’s fork.

fjgarlin’s picture

Thanks for creating the issue.

I've found the following when running the cron job to initially parse the files:
[error] File advagg_css_compress/csstidy/class.csstidy.inc could not be parsed. Message: Syntax error, unexpected T_ELSE, expecting '}' on line 1028

These are the lines: https://git.drupalcode.org/project/advagg/-/blob/7.x-1.x/advagg_css_comp...
It doesn't seem like valid PHP.

Having said that, the code did throw the warning because that file's code wasn't parsed, so I'm fixing that.
Incoming MR.

fjgarlin’s picture

Status: Active » Needs review

@NickDickinsonWilde - it'd be great if you can try the fix.

The page will still not show any code under "view source", because it's not valid PHP, but it should not throw the warning about "preg_split" anymore.