Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Basically:
defaultUri()
(camelCase) appears three times in “…/entity/includes/entity.inc”:- Defined as a
protected function defaultUri() { …
in line #312, - Invoked in line #307 as
return $this->defaultUri();
, and… - Mentioned in the documenting comment in line #177
- Defined as a
- Yet
defaultURI()
(uppercase acronym) exists in “…/entity/tests/entity_test.module” defined as aprotected function defaultURI() { …
in line #159!
This has caused some confusion among developers of other modules, such as the Group module which in its GProfile submodule uses the uppercase-acronym defaultURI throughout, which results in a Javascript error as reported in [#2874940].
I think this needs to be patched here in your “…/entity/includes/entity.inc” to simply create a deprecated, not-intended-to-be-used but intended only to catch such errors uppercase-URL protected function that simply calls the existing camelCase version, like so (inserted starting at line #319):
/**
* MMCC: DO NOT use this! Added only for compatibility with some modules that had misspelled “defaultUri” (camelCase)!
*/
protected function defaultURI() { ///MMCC: DO NOT use this! Added only for compatibility with some modules that had misspelled “defaultUri”!
return $this->defaultUri();
}
Comment | File | Size | Author |
---|---|---|---|
#5 | entityapi_allow_bad_defaulturi_casing.patch | 694 bytes | Joel MMCC |
#2 | entityapi_allow_bad_defaulturi_casing.patch | 636 bytes | Joel MMCC |
Comments
Comment #2
Joel MMCC CreditAttribution: Joel MMCC commentedI’m very new to Drupal (and even PHP) development (my background is in ASP.NET and I use Windows even for Drupal & PHP, and am using NetBeans IDE v8), so I hope I’m doing this right. While I’ve submitted several proposed fixes for several modules, I’ve always done it in code since I didn’t know how to properly generate DIFF .patch files that patch multiple files in a project, and I still don’t (NetBeans seems to lack that ability).
But since this one is a single file, I’m attempting my first patch on a Drupal issue using NetBeans’s single-file “Diff to…” command, and here it is (it’s basically the above code without my “MMCC”-tagged comments).
Comment #3
Joel MMCC CreditAttribution: Joel MMCC commentedI hope I’m doing this right.
Comment #4
Joel MMCC CreditAttribution: Joel MMCC commentedGuess not. “Patch Failed to Apply.” What did I do wrong?
Comment #5
Joel MMCC CreditAttribution: Joel MMCC commentedTrying again. Looking at other patches, it seems to need
a
andb
before the file path/names.Also, a
diff --git a/includes/entity.inc b/includes/entity.inc
line.Comment #6
Joel MMCC CreditAttribution: Joel MMCC commentedYou know what? Forget all of this. I really should’ve tested before trying a patch. I got errors for trying to redefine
defaultURI
.Comment #7
Joel MMCC CreditAttribution: Joel MMCC commented