Jump to content

Recommended Posts

Posted

The problem turned out to be a bug in PW 2.6.1.

I didn't realise my local PW version was on 2.8.35 and not 2.6.1.


The bug was in        

 $ad = wire(pages)->get("/ads/")->children->getRandom();

It was not returning an object in PW 2.6.1 despite data being present.


Live and (hopefully) learn ....

  • Like 2
Posted

Shouldn't it be with quotes around pages? Be it in blog/ or talk/, it seems to always be wire("pages") or wire('pages')wire("page") or wire('page').

  • Like 2
Posted
6 hours ago, Christophe said:

Shouldn't it be with quotes around pages? Be it in blog/ or talk/, it seems to always be wire("pages") or wire('pages')wire("page") or wire('page').

I've used wire(pages) everywhere on my codebase. This was the first time I've had an issue with it.

I probably will leave it alone but I'll keep your post it mind. 
Thanks for the pointer, @Christophe. Much appreciated.

Posted

I bet the server that is failing has strict error reporting on. The code you are using should return this error:

Error: Use of undefined constant pages - assumed 'pages'

So it will work with strict error reporting off, but it's not correct code.

  • Like 1
Posted
Just now, adrian said:

I bet the server that is failing has strict error reporting on. The code you are using should return this error:


Error: Use of undefined constant pages - assumed 'pages'

So it will work with strict error reporting off, but it's not correct code.

 

@adrian, it was failing on this 1 particular call.  All the other calls were working fine.

In any case, I will change it to "pages" as it's the correct method.

 

×
×
  • Create New...