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
  • Yet defaultURI() (uppercase acronym) exists in “…/entity/tests/entity_test.module” defined as a protected 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();
  }
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Joel MMCC created an issue. See original summary.

Joel MMCC’s picture

I’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).

Joel MMCC’s picture

I hope I’m doing this right.

Joel MMCC’s picture

Guess not. “Patch Failed to Apply.” What did I do wrong?

Joel MMCC’s picture

Trying again. Looking at other patches, it seems to need a and b before the file path/names.
Also, a diff --git a/includes/entity.inc b/includes/entity.inc line.

Joel MMCC’s picture

You know what? Forget all of this. I really should’ve tested before trying a patch. I got errors for trying to redefine defaultURI.

Joel MMCC’s picture

Status: Active » Postponed