Problem/Motivation

Deprecated function: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in Drupal\path_alias\PathProcessor\AliasPathProcessor->processOutbound() (line 54 of core/modules/path_alias/src/PathProcessor/AliasPathProcessor.php).

Deprecated function: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in Drupal\Core\Routing\UrlGenerator->generateFromRoute() (line 301 of core/lib/Drupal/Core/Routing/UrlGenerator.php).

Deprecated function: rawurlencode(): Passing null to parameter #1 ($string) of type string is deprecated in Drupal\Core\Routing\UrlGenerator->generateFromRoute() (line 306 of core/lib/Drupal/Core/Routing/UrlGenerator.php).

Issue fork drupal-3308707

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:

  • 3308707- Comparechanges, plain diff MR !3944
  • 10.1.x Comparecompare

Comments

viniciusrp created an issue. See original summary.

viniciusrp’s picture

StatusFileSize
new2.09 KB

Here is a very simple fix.

viniciusrp’s picture

Status: Active » Needs review
connbi’s picture

StatusFileSize
new2.48 KB
connbi’s picture

connbi’s picture

StatusFileSize
new2.48 KB
connbi’s picture

connbi’s picture

StatusFileSize
new2.48 KB

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs Review Queue Initiative, +Needs issue summary update, +Needs tests

This issue is being reviewed by the kind folks in Slack, #needs-review-queue-initiative. We are working to keep the size of Needs Review queue [2700+ issues] to around 400 (1 month or less), following Review a patch or merge request as a guide.

This needs an issue summary update.
What steps were taken?
What's the proposed solution"

Think we should find what caused this issue as this seems to patching the symptom and not the cause.

This will need a test case as a bug.

anybody’s picture

Issue tags: +PHP 8.1

Confirming the issue with Drupal 9.5.5 + PHP 8.1.17 when viewing a node.

Perhaps in Drupal 10.0.x this is already fixed and can be backported?

slydevil’s picture

Not fixed in 10.0...just happened to me.

slydevil’s picture

slydevil’s picture

StatusFileSize
new3.37 KB

Reversed the diff...new patch attached.

joseph.olstad’s picture

patch #15 works well on D9.5.9

Needs tests

josephcheek’s picture

@slydevel made a patch for D10.1 that applies for me (whereas #15 does not). It took me a while to find it so here's the link, hoping to save others some time fixing this issue on D10.1.

https://git.drupalcode.org/issue/drupal-3308707/-/commit/acdedacad5af5af...

connbi’s picture

StatusFileSize
new1.8 KB
connbi’s picture

dmytro-aragorn’s picture

Status: Needs work » Needs review
StatusFileSize
new1.81 KB
new668 bytes

No need to call rawurlencode() for non-existing or empty $path variable.

longwave’s picture

We should write automated tests to cover this case so we don't cause a regression in the future.

Can someone who has experienced this error please write down the steps to reproduce it, preferably starting from "Install Drupal" if possible. We can use those instructions to write a test case.

longwave’s picture

Status: Needs review » Postponed (maintainer needs more info)
fadonascimento’s picture

Thanks @josephcheek the patch #17 works as expected in Druapl 10.1

xaa’s picture

I saw similar issue on a d10.2.0 (upgraded from 9.5.11) after adding URL alias (/admin/config/search/path/add). Patch #20 seems fixed the issue here.

trying to create alias:
- System path: /node
- URL alias: /

Version: 9.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

sittard’s picture

We were are also getting this on Drupal 10.2.6 for us we had some paths which appeared to be missing the alias value. Not 100% sure why or how these empty alias existed, they were all taxonomy terms.

We were able to delete the paths via the /admin/config/search/path interface and solve the problem.

smustgrave’s picture

Issue tags: +Bug Smash Initiative

Just following up if anyone can provide steps to reproduce this issue? If no steps are provided probably will close out in 3 months.

anybody’s picture

I can confirm that the typical reason for this issue is an empty path alias of a node. So this is a result of that root cause, but can happen, as we see above.

For example we set "/" for the front page alias and after saving the node twice, the URL alias is empty and this happens... That should be fixed in: #1255092: url() should return / when asked for the URL of the frontpage. Maybe it even fixes the main root cause of this issue. But I guess other cases can also lead to an empty URL alias and cause this.

Should we postpone this on #1255092: url() should return / when asked for the URL of the frontpage or see if others can confirm it's caused by that?

smustgrave’s picture

Status: Postponed (maintainer needs more info) » Postponed

Let do that!

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.