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).
| Comment | File | Size | Author |
|---|---|---|---|
| #20 | interdiff-3308707-18-20.txt | 668 bytes | dmytro-aragorn |
| #20 | suppress_error_when_empty_path-3308707-20.patch.txt | 1.81 KB | dmytro-aragorn |
| #15 | suppress_error_when_empty_path-3308707-15.patch | 3.37 KB | slydevil |
| #8 | 3308707-5.patch | 2.48 KB | connbi |
| #2 | 3308707-2.patch | 2.09 KB | viniciusrp |
Issue fork drupal-3308707
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:
Comments
Comment #2
viniciusrp commentedHere is a very simple fix.
Comment #3
viniciusrp commentedComment #4
connbi commentedComment #5
connbi commentedComment #6
connbi commentedComment #7
connbi commentedComment #8
connbi commentedComment #10
smustgrave commentedThis 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.
Comment #11
anybodyConfirming 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?
Comment #12
slydevil commentedNot fixed in 10.0...just happened to me.
Comment #14
slydevil commentedComment #15
slydevil commentedReversed the diff...new patch attached.
Comment #16
joseph.olstadpatch #15 works well on D9.5.9
Needs tests
Comment #17
josephcheek@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...
Comment #18
connbi commentedComment #19
connbi commentedComment #20
dmytro-aragornNo need to call
rawurlencode()for non-existing or empty $path variable.Comment #21
longwaveWe 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.
Comment #22
longwaveComment #23
fadonascimento commentedThanks @josephcheek the patch #17 works as expected in Druapl 10.1
Comment #24
xaa commentedI 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: /
Comment #26
sittard commentedWe 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.
Comment #27
smustgrave commentedJust following up if anyone can provide steps to reproduce this issue? If no steps are provided probably will close out in 3 months.
Comment #28
anybodyI 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?
Comment #29
smustgrave commentedLet do that!