Publisher does not support the Fluid field type. Please do not contact asking when support will be available.

If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.

Ticket: Need to reset $limit on Publisher_hooks_base

Status Resolved
Add-on / Version 1.3.2
Severity Critical
EE Version 2.7.3

JohnDWells

Apr 25, 2014

Hi Brian,

I believe I’ve found a bug in Publisher_hooks_base - on lines 101 - 103 you reset the class properties before re-calibrating the query limit, but you only reset $this->offset and $limit_matched, and not $this->limit:

// Reset
        $this->offset = 0;
        $limit_matched = FALSE;

I believe it also needs this:

$this->limit = 1000;

Cheers,
John

#1

BoldMinded (Brian)

Good catch, thanks. Added to next release.

#2

JohnDWells

Hi Brian,

I just grabbed a copy of Publisher 1.3.3, and regarding this ticket you’ve reset $this->limit = 0, but shouldn’t it be reset to 1000?

Cheers, John

#3

Brian Litzinger

Actually, it makes more sense to comment them out entirely, right?

https://www.evernote.com/shard/s9/sh/ee023bdb-6ce9-4cba-97da-34b699e974c0/e9589c12f0976961f7c12bce4bf6312d

#4

JohnDWells

You’ll know better than me I guess - I found it because I was debugging a case where, in the CP, some entries were not returning all Assets in a custom field, when viewing the non-default language translation. Only the 1st Asset was coming back. It was only happening for some entries (I really think I have a couple of gremlins in this install, but let’s ignore that for now!). When I changed $this->limit = 1000, which is the same as the property is set during instantiation, then the assets were restored.

I assumed from that exercise that the hook essentially acts as a Singleton for each runtime session, so $limit was being modified in an earlier fieldtype and not properly being reset.

That said, I’ve just changed it to be $this->limit = 0, and all Assets come back.

Well if that’s the correct value during a reset, shouldn’t then the default property value be 0 as well?

#5

BoldMinded (Brian)

John, can you send me the version of the file you’re using?

#6

JohnDWells

Sure - this is my modified version of of Publisher_hooks_base.php (modified as above), from Publisher 1.3.2.

https://www.dropbox.com/s/0d8gyh3cbxf278s/Publisher_hooks_base.php.zip

Cheers, John

#7

BoldMinded (Brian)

Ah, I see now. Yes it is a singleton, so your change makes sense. I’ll get this in the next release.

Login to reply