Just upgraded from rc1 to rc2.
At "Entity selection mode" I'm checking "Views: Filter by an entity reference view". This results in an Ajax HTTP 500 and:

PHP Fatal error: Class EntityReference_SelectionHandler_Views contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (EntityReference_SelectionHandler::validateAutocompleteInput) in /public_html/sites/all/modules/contrib/entityreference/plugins/selection/EntityReference_SelectionHandler_Views.class.php on line 150, referer: http://example.com/admin/structure/types/manage/issue/fields/field_issue...

(Using PHP 5.2.10)

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

igor.ro’s picture

subscribe

igor.ro’s picture

Issue summary: View changes

added version info

GPeach’s picture

I also got this error when upgrading from rc1 to rc2.

I don't have the calendar or date modules installed and could not clear the cache without getting the error. Dropping back to rc1 and clearing caches fixed the problem for me... Thanks

Tara1981’s picture

This is the error I have. I wasn't sure if it was because I just installed entity references dialog module.
Fatal error: Class EntityReference_SelectionHandler_Views contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (EntityReference_SelectionHandler::validateAutocompleteInput) in public_html/sites/all/modules/entityreference/plugins/selection/EntityReference_SelectionHandler_Views.class.php on line 150
Page execution time was 209.16 ms. Memory used at: devel_boot()=4.83 MB, devel_shutdown()=39.09 MB, PHP peak=39.25 MB.
Any help appreciated.

stockliasteroid’s picture

Getting the same thing here... The problem is that the base class declares an abstract method validateAutocompleteInput that all sub-classes are required to implement, but the views handler doesn't use autocomplete and thus doesn't implement it. Seems like the abstract method should be removed from the base class if not all selection handlers will implement it.

ParisLiakos’s picture

Priority: Normal » Critical

same here, promoting to critical

Damien Tournoud’s picture

Status: Active » Needs review
FileSize
736 bytes

Two critical errors in the same release => we don't have enough tests (or tests at all for the Views integration).

This should fix it. Ideally we should have a base abstract class that implement a sane default behavior.

ParisLiakos’s picture

Status: Needs review » Reviewed & tested by the community

yes, that gets rid of the fatal error

Murz’s picture

Also got this issue, patch from #6 solves the problem, thanks!

garrettc’s picture

Patch from #6 fixed this issue for me.

Tara1981’s picture

I installed 7.x-1.0-rc3 and still get this error. Will the patch work for rc3 too? (I am a rank amateur, so apologies if this is an obvious question).

garrettc’s picture

Sorry Tara1981, I forgot to clarify that I applied the patch to rc3 and it was fine.

Tara1981’s picture

Thanks - I just wanted to check before attempting my first patch!

szt’s picture

Version: 7.x-1.0-rc2 » 7.x-1.0-rc3

Yes-yes, it works!

lilbebel’s picture

Sorry but where do I put this patch? Which file and line?

Thanks,

M

szt’s picture

Open the patch file at #6 and you will see the infos you need.

(Insert the "+" signed lines to "plugins/selection/EntityReference_SelectionHandler_Views.class.php" at line 134)

More info: Applying a patch manually

baby.hack’s picture

Applied #6 manually to both rc2 and later to rc3. Solved the issue for both.

lilbebel’s picture

Thank you.

Alan D.’s picture

Following up on fatal errors, EntityReferenceHandler_base is not referenced in the info file, so this kills other modules that are extending that class.

And doing this search, "class \w* (implements|extends) \w* \{" shows 14 files contain class definitions, yet the info file only mentions 7.

Alan D.’s picture

Mmm... it requires a full code replace cf. extract over, and fatal errors are unrelated due to dependency that uses a class that no longer exists in the module :(

If CTools stores class instances in the session / cache / etc, it would always pay to reference all classes still in the info file:

files[] = plugins/selection/EntityReference_SelectionHandler_Views.class.php
files[] = plugins/selection/EntityReference_SelectionHandler_Generic.class.php
files[] = plugins/behavior/EntityReferenceBehavior_ViewsFilterSelect.class.php

Tara1981’s picture

I am struggling with this patch business and it looks like this isn't totally resolved? I think I'll leave it for now.
I'm subscribing to this thread.

Abilnet’s picture

<newbie warning>

I tried to test-apply the patch in #6 but don't get it work. What I'm doing wrong? Some handholding appreciated!

Here's what I did and the results:

xxxxx@server1:~/domains/mysite.com/public_html/sites/all/modules/entityreference/plugins/selection$ patch -p0 --dry-run < 1608358-selectionhandler-views-broken.patch 
patching file b/plugins/selection/EntityReference_SelectionHandler_Views.class.php
Hunk #1 FAILED at 134.
1 out of 1 hunk FAILED -- saving rejects to file b/plugins/selection/EntityReference_SelectionHandler_Views.class.php.rej
xxxxx@server1:

</newbie warning>

lilbebel’s picture

FileSize
137.84 KB

Hi Albilnet,

Open up your file "plugins/selection/EntityReference_SelectionHandler_Views.class.php" with a code editor. Look at the screen shot I have attached for exactly what to add and where to add it. Make sure to remove the little + signs on the patch as they are indicators of placement and not part of the code.

Good luck.

Abilnet’s picture

By using the detailed instruction by lilbebel I managed to install the patch - the error went away!

Thank you so much lilbebel, your help greatly appreciated. Your kind of helpful people actually make Drupal community! I love Open Source!

NowThatsCookin.Com’s picture

Damien Tournoud and lilbebel I want to say thank you very much for your patch and instructions, I applied the patch and with the screen shot that helped me figure out where to put it easily.

This patch solved the problem for me.

I "updated" my Drupal install to 7.14 yesterday morning, and it broke my whole site. Finally got it rolled back, but then weird stuff started happening. Such as the right side navigation in I.E. would shift to the bottom of the content, and this error syntax would show up in light gray letters in the background of my site.

I found that switching to compatibility mode on I.E. solved the first issue, and this patch solved the later issue.

So again, thank you for taking the time to figure this out and post the solution up here for those of us that just do not have the understanding to be able to do so. It helped a TON!!!!

Frank

Pisco’s picture

+1 Would love to see this patch being committed soon.

attiks’s picture

Patch applies and solves the problem

yvmarques’s picture

Works well for me, thanks for the patch !

netw3rker’s picture

patch solved this for us too. I'd say this is worth committing now

Damien Tournoud’s picture

Status: Reviewed & tested by the community » Fixed

I actually merged this in 7.x-1.x a couple of days ago.

Sridharan-1’s picture

I dont have any file "EntityReference_SelectionHandler_Views.class.php"... Please help

szt’s picture

Maybe you have the earlier RC1 version?
This issue for RC3...

viseser’s picture

Patch applies and solves the problem for Entity reference 7.x-1.0-rc3. Thanks :)

mariagwyn’s picture

Confirmed that patch works. THX.

protoplasm’s picture

patch #6 worked, thnx

ParisLiakos’s picture

maybe a new version should be released that includes this patch?
closed as duplicates:

#1653660: Ajax http error
#1635156: Entity Selection Mode with Views is broken

joelrotelli’s picture

#6 works for me too, thanks

netw3rker’s picture

Status: Fixed » Reviewed & tested by the community

bumping this to RTBC instead of 'fixed'

szt’s picture

Status: Reviewed & tested by the community » Fixed

No, it's fixed, as mentioned at #29.
You can find in the dev version.

dustinrwh’s picture

#6 works for me as well. Thanks!

Sknight17’s picture

Status: Fixed » Patch (to be ported)

The patch in #6 does the trick.

szt, this issue is for 7.x-1.0-r3c which is still the 'stable' version. Since this bug is considered 'critical' by most it should not be labeled as fixed until the patch is applied to 7.x-1.0-r3c or until 7.x-1.x becomes stable.

ParisLiakos’s picture

Status: Patch (to be ported) » Fixed

One more duplicate: #1666320: Entity Reference - Entity Selection Mode Views Error - Contexual Filter Failure
Yeah, well critical bugs are not nice to have in a stable version, but this issue, is fixed..
Open a new issue: task with title: Release new version..
no point keeping this issue alive

EDIT
Issue opened here #1672618: Release a new version

mamanerd’s picture

Patch from #6 worked for me too on rc3. Thanks!

haqinai’s picture

I have tried #6 and have come up with some more issues. I may have not followed the instructions just right but I will show you what I have done to see if you all can help me to fix the problem.

If you go to the site you will see the error===> http://edah.ca/hubtool/

now in the code what I did is this:

122. ':input[name="field[settings][handler_settings][sort][type]"]' => array('value' => 'none'),
123. ),
124. ),
125. );
126.
127. return $form;
128. }
129.
130. /**
131. * Implements EntityReferenceHandler::getReferencableEntities().
132. */
133. public function getReferencableEntities($match = NULL, $match_operator = 'CONTAINS', $limit = 0) {
134. }
135. /**
136. * Implements EntityReferenceHandler::validateAutocompleteInput().
137. */
138. public function validateAutocompleteInput($input, &$element, &$form_state, $form) {
139. return NULL;
140. }
141.
142. /**
143. * Implements EntityReferenceHandler::getLabel().
144. */
145. public function getLabel($entity) {
146. $query = $this->buildEntityFieldQuery($match, $match_operator);
147. if ($limit > 0) {
148. $query->range(0, $limit);
149. }
150.

Please let me know your thoughts.

Cheers,

Jacob Melnick

haqinai’s picture

I am some what new to Drupal. I have been working with it for Three years now. If you need more information let me know.

mamanerd’s picture

Which page is your error on? I don't see any on the link you provided.

haqinai’s picture

haqinai’s picture

SCREEN SHOT Also note the screen shot

mamanerd’s picture

Looks like you're declaring the function below twice, once on line 138, once on line 193. You can only declare it once.

public function validateAutocompleteInput($input, &$element, &$form_state, $form)

haqinai’s picture

I think that we are getting closer. I now have this error:

Fatal error: Class EntityReference_SelectionHandler_Views contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (EntityReference_SelectionHandler::validateAutocompleteInput) in /home/edah/public_html/hubtool/sites/all/modules/entityreference/plugins/selection/EntityReference_SelectionHandler_Views.class.php on line 150

Mile23’s picture

Status: Fixed » Active

Not sure why this is marked fixed. I see this error.

@mamanerd:

You can see the AJAX error when you select one of the items in Entity Selection Mode.

You can see the PHP error by checking your server's PHP log:

PHP Fatal error: Class EntityReference_SelectionHandler_Views contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (EntityReference_SelectionHandler::validateAutocompleteInput) in PATH/drupal/sites/all/modules/entityreference/plugins/selection/EntityReference_SelectionHandler_Views.class.php on line 150

hbalagtas’s picture

I'm also still getting this error on a Drupal 7 + commerce setup, this error comes up on the log and the node reference autocomplete has stopped working, not really sure if the two are related.

PHP Fatal error: Class EntityReference_SelectionHandler_Views contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (EntityReference_SelectionHandler::validateAutocompleteInput) in /var/www/drupal/sites/all/modules/contrib/entityreference/plugins/selection/EntityReference_SelectionHandler_Views.class.php on line 150, referer:

ParisLiakos’s picture

Status: Active » Fixed

@Mile23 and @hbalagtas download the latest development version.
also see issue here:
#1672618: Release a new version

Mile23’s picture

Thanks, rootatwc.

hbalagtas’s picture

Thanks @rootatwc but I do have the rc3 installed, when I run cron I'm still getting an error.

$drush dl entityreference --select --all
Choose one of the available releases for entityreference:
[0] : Cancel
[1] : 7.x-1.x-dev - 2012-Jun-18 - Development
[2] : 7.x-1.0-rc3 - 2012-May-30 - Supported, Installed, Recommended
[3] : 7.x-1.0-rc2 - 2012-May-30 -
[4] : 7.x-1.0-rc1 - 2012-Mar-20 -
[5] : 7.x-1.0-beta5 - 2012-Feb-26 -

$ drush cron
PHP Fatal error: Class EntityReference_SelectionHandler_Views contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (EntityReference_SelectionHandler::validateAutocompleteInput) in /var/www/drupal/sites/all/modules/contrib/entityreference/plugins/selection/EntityReference_SelectionHandler_Views.class.php on line 150
Drush command terminated abnormally due to an unrecoverable error. [error]
Error: Class EntityReference_SelectionHandler_Views contains 1
abstract method and must therefore be declared abstract or implement
the remaining methods
(EntityReference_SelectionHandler::validateAutocompleteInput) in
/var/www/drupal/sites/all/modules/contrib/entityreference/plugins/selection/EntityReference_SelectionHandler_Views.class.php,
line 150

hbalagtas’s picture

@rootawc, misunderstood what you meant, when I clicked the link I thought you wanted us to install rc3, installing 7.x-1.x-dev did remove the error and my autocomplete text boxes are working again.

bstoppel’s picture

I too was getting this error when running "drush cc all" and other times with rc3. The June 18th dev version does fix this problem.

vparfaniuc’s picture

Patch from #6 worked just great for me. Thanks Damien.

elBradford’s picture

I confirm the most recent dev (June 18 2012) fixes the issue for me as well.

TheBarnacle’s picture

Thanks for this! Good fix.

j0rd’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Piyushagr’s picture

i have same error
Fatal error: Class EntityReference_SelectionHandler_Views contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (EntityReference_SelectionHandler::validateAutocompleteInput) in /home/mrater/public_html/sites/all/modules/contrib/entityreference/plugins/selection/EntityReference_SelectionHandler_Views.class.php on line 150

yannickoo’s picture

Just use the dev version, it works fine.

Mile23’s picture

jday’s picture

dev version fixed the error for me too.

selinav’s picture

I have the RC3 version and I have still the problem

Fatal error: Class EntityReference_SelectionHandler_Views contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (EntityReference_SelectionHandler::validateAutocompleteInput) in /.../sites/all/modules/entityreference/plugins/selection/EntityReference_SelectionHandler_Views.class.php on line 150

mgifford’s picture

Ya, RC3 is from May. It's definitely time for a new release.

Note, upgrading to the dev version & running update db still didn't help for me.

Not sure if it's with Entity Reference or Migrate UI because when I disabled Migrate UI it all seemed to work fine.

marsdk’s picture

More info can be found here on why we haven't seen a new version yet : http://drupal.org/node/1672618#comment-6457046

mgifford’s picture

That is wonderful news for sure. I do hope Damien takes time with his family (and away from the screen). However, he's not the only maintainer. Though not sure how it works between him and @Amitaibu.

We might just have to wait.....

dhallennem’s picture

patch #6 = solution !

Finn Lewis’s picture

Current dev version works for me.

Finn Lewis’s picture

Issue summary: View changes

added PHP version