Jump to content

[solved] Contains all words selector "~=" triggers an error since updating to 3.0.165


celfred
 Share

Recommended Posts

Hello,

I've just upgraded to 3.0.165 (and updated my Ubuntu version as well) and on my localhost, I am facing a weird issue : all my requests having the ~= selector cause a Mysql error with this message :

	PDOException #HY000
	SQLSTATE[HY000]: General error: 3685 Illegal argument to a regular expression.
	

I have no idea what is going on. If I change my request from

	$visualizer = $pages->get("name~=visualizer"); // Triggers the error
	

to

	$visualizer = $pages->get("name=visualizer");
	

or

	$visualizer = $pages->get("name~*=visualizer");
	

My code works fine again.

Any idea ? Shall I change all my requests (but from what I understand by reading the documentation, ~= exists and fits my needs : all words in any order [though I do understand that in my example above it may be useless since I have only one word])

Thanks !

Link to comment
Share on other sites

So nobody has any clue for me 😞 ?

On my localhost, I have :

PHP version is 7.4.3.

MySQL version is 8.0.21.

Maybe this can help...

I have a feeling if it was just a configuration problem, all requests should end up with the 'illegal argument to a regular expression' error ? But I can't imagine PW would be the cause (otherwise I vould get some clue from the community, I'm sure 😉)

 

Link to comment
Share on other sites

44 minutes ago, celfred said:

MySQL version is 8.0.21.

Some have experienced issues before with MySQL 8+ with latter versions of ProcessWire, though I cannot recall if it had to do with selectors. Hopefully you get better answers than this one.

Link to comment
Share on other sites

@kongondo Thanks for your reply.

23 hours ago, kongondo said:

Some have experienced issues before with MySQL 8+ with latter versions of ProcessWire, though I cannot recall if it had to do with selectors. Hopefully you get better answers than this one.

Ah... And downgrading MySql doesn't seem possible (at least for my low skills... - https://dev.mysql.com/doc/refman/8.0/en/downgrading.html

So I guess I'm gonna be in trouble here...

Link to comment
Share on other sites

@kongondo Thanks for your reply.

23 hours ago, kongondo said:

Some have experienced issues before with MySQL 8+ with latter versions of ProcessWire, though I cannot recall if it had to do with selectors. Hopefully you get better answers than this one.

Ah... And downgrading MySql doesn't seem possible (at least for my low skills... - https://dev.mysql.com/doc/refman/8.0/en/downgrading.html

So I guess I'm gonna be in trouble here...

Link to comment
Share on other sites

@kongondo I'm just noticing that my previous message didn't go through... I was saying that for your information, I had replaced all  my ~= operators with either ^=, ~*= or = depending on my use cases. It did the trick although I'm losing the original 'whole words' searching capability... but at least I'm not stuck 😉

I wen tahead and submitted a 'bug' issue as you advised. Not sure this is a real bug since I have a feeling somebody else would reproduce it if it was, but I di dmy best explaining the issue and I hope it can help !

If anybody needs more information about it, just ask. I'll keep an eye on this issue since I would like to understand and solve it in a better way !

But thanks again for your help !

  • Like 1
Link to comment
Share on other sites

13 hours ago, kongondo said:

For completeness, here's the link to the bug report

https://github.com/processwire/processwire-issues/issues/1240

Btw, @celfred, is the error only when you do a $pages->get("name.....), i.e only on the 'name' field or other fields as well? e.g. $pages->get("another_text_field...)

@kongondo Great idea ! I've just tested and it works with other fields : title, summary... No problems (apparently). As soon as I change to "name~=", the error triggers.

I'll go ahead and write this as well on the 'bug' report.

Link to comment
Share on other sites

  • 2 weeks later...

As a follow-up, @ryan had a look at this and made a patch that somehow  tests the Mysql version and does something that makes it work fine (at least on my localhost).

Technically speaking, I am unable to explain all this, so I prefer let the pros give details if needed, but just know the issue seems solved.

As I said on Github, I am quite glad I have been able to somehow contribute to the community. You all have provided me with so much help since I have discovered PW.

THANKS again !

  • Like 3
Link to comment
Share on other sites

  • celfred changed the title to [solved] Contains all words selector "~=" triggers an error since updating to 3.0.165

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...