Syntax error, unexpected T_NS_SEPARATOR
levycarneiro opened this issue · 23 comments
Ran into this issue when attempting to S/R a wordpress install (staging to www) via CLI.
wp_oauth_clients: 0 rows, 0 changes found, 0 updates made in 0.00028396 seconds
wp_oauth_refresh_tokens: replacing staging.community.newmessage.org with community.newmessage.org
wp_oauth_refresh_tokens: 0 rows, 0 changes found, 0 updates made in 0.00022697 seconds
wp_oauth_scopes: replacing staging.community.newmessage.org with community.newmessage.org
wp_oauth_scopes: 0 rows, 0 changes found, 0 updates made in 0.00022101 seconds
wp_options: replacing staging.community.newmessage.org with community.newmessage.org
syntax error, unexpected '\' (T_NS_SEPARATOR), expecting '{'
$
Any idea what could be wrong here?
Thanks!
Same issue here; running 4.0.1
what php version are you running? could you try with the last version on master?
- php 7.3.16
- script v4.1
- Mysql Ver 14.14 Distrib 5.7.29
- issue happens only on wp_options table of wordpress.
so it might be some serialised data, this tools tries to unserialise and there might be some error there. That's why you get that message, I cannot reproduce it on my side, can you post some sample?
Well I think the issue comes from the Elementor plugin.
thanks @dejury
some plugins don't play nice with our tool, @levycarneiro are you using the same plugin?
Yes, with Elementor same error.
Error on option 'elementor_log'
Im simple remove this option from wp_options and problem is gone.
elementor_log in my case have 4kb length and not easy to undestand cause.
PS: A text variable affects script syntax? I'm scared...
Indeed, we are using Elementor.
Thanks for the report, some plugins don't play nice with SR and we cannot write specific code for each of them. Let's close this issue, if someone else is having the same problem, this page will pop up on search engines for sure.
Well I'm not sure if that is the right decision. I agree that you should not have specific code for each and every plugin. But Elementor is a plugin that is so widely used, so I think for some plugins you have to make a decision to support it. For example the company that I work for uses Elementor in almost every site, and that are more then 200 sites. Which means we cannot use SR anymore?
@dejury we don't use any of those plugins, you can fork SRDB and write your patches. Other developers already have forks for any sort of setup.
GPL software doesn't mean free stuff, you can study and change SRDB without limitations as long as you respect the license.
Happy Hacking
@dejury
Ran into same issue today.
As an alternate manual solution, one can go in the admin panel under Elementor > Tools > Replace URL, and do the search and replace there for those sites. They have a dedicated helper tool to do that. That's what I did for my one case.
I made a hacky patch for the unescaped \
in the elementor_log
-option:
itg-dave@376591e
I've seen this on a couple of our recent projects and we aren't using Elementor.
Works on all tables except wp_options
. I plan on looking at this more closely soon so will report back.
I have the issue in wp_usermeta
– no Elementor in the project
No. I tried with extra verbose debug in CLI, but no usable details to isolate it. The table is semi big with 17 000 records (1.5 MB), but that shouldn't be a problem.
After I wrote I've tried several runs for debug and it appears that it actually does replace something, because the string was eventually changed in all recods.
No, haven't tried the wp cli but I will - thx.
One possibly important detail I forgot to mention was that I actually changed from php 7.3.21 to 7.4.10 before the multiple runs that eventually made the replace. However, it still reported the error and stopped.
Som Googling on "'' (T_NS_SEPARATOR)" points to issues in the PHP code and possibly not the string it is trying to replace.
I've got the same error stopped on wp_option table when used version 4.1.1 but all working when used older version 3.1.0 even there were PHP Notice info.
@iwayanwirka thank you :) Your solution worked. Downloaded 3.1 from the repo and I am back in good hands. Wish I would have found this article sooner but I had to finally figure this out as it has plagued me for about 2 months now.
This seems to be a duplicate. I've mentioned the solution here: #348