Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2020-09-07 02:20:20

detail
Member
From: geez, I seem to be in NZ
Registered: 2010-07-13
Posts: 176
Website

Parse error: syntax error, unexpected 'yield' (T_YIELD),

Hi there, from the security of my own bunker.

I’m trying to get a few websites up to date and have an unexpected error in an old site.

The site is not displaying at all, and just throwing up an error message.

Parse error: syntax error, unexpected 'yield' (T_YIELD), expecting '(' in /home/content/39/6300239/html/textpattern/publish/taghandlers.php on line 313

When I check out that line this is what I see:


	function yield()
	{
		global $yield;

		$inner = end($yield);

		return isset($inner) ? $inner : '';
	}

I note with some horror that I am still running Txp 4.5.2.

I guess you are going to tell me to upgrade to Txp 4.8.2, which I assume is possible to do in one go. Or do I need to install an intermediate?

Or, in the meantime, can I just fiddle with line 313?

Cheers

Graeme

Last edited by detail (2020-09-07 02:30:42)

Offline

#2 2020-09-07 05:16:28

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,011
Website GitHub Mastodon Twitter

Re: Parse error: syntax error, unexpected 'yield' (T_YIELD),

Hi,
Your server updated their php. It is best to backup your db first and then update incrementally, not directly. There are a lot of discussions in troubleshooting regarding issues you may face.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#3 2020-09-07 06:04:56

detail
Member
From: geez, I seem to be in NZ
Registered: 2010-07-13
Posts: 176
Website

Re: Parse error: syntax error, unexpected 'yield' (T_YIELD),

Thanks, Yiannis.

That makes total sense. Although now I’ve checked it’s only on version 5.6.

When you say “incrementally” what jumps do you recommend?

Txp 4.5.2 > 4.7.1 > 4.8.2

Or have 4.6 in there as well?

Graeme

Offline

#4 2020-09-07 06:26:20

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,271
Website GitHub

Re: Parse error: syntax error, unexpected 'yield' (T_YIELD),

You should be fine to jump from 4.5.2 directly to 4.8.2 (even 4.8.3-dev which is pretty much going to become 4.8.3 in the next few days).

Anything 4.4-ish or below might benefit from smaller jumps due to an issue we found a couple of days ago, and for anything pre-4.2.0 it helps to jump to 4.2.0 first. But I think you’ll be fine, with the usual file system and DB backup by your side just in case :)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#5 2020-09-07 08:01:38

detail
Member
From: geez, I seem to be in NZ
Registered: 2010-07-13
Posts: 176
Website

Re: Parse error: syntax error, unexpected 'yield' (T_YIELD),

Thanks for that, Bloke.

What else would I be doing?

Cheers

Offline

#6 2020-09-07 13:11:21

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,011
Website GitHub Mastodon Twitter

Re: Parse error: syntax error, unexpected 'yield' (T_YIELD),

detail wrote #325830:

Thanks for that, Bloke.

What else would I be doing?

Cheers

You may need want to upgrade your php to 7.x. It is faster and more secure.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#7 2020-09-12 05:34:24

detail
Member
From: geez, I seem to be in NZ
Registered: 2010-07-13
Posts: 176
Website

Re: Parse error: syntax error, unexpected 'yield' (T_YIELD),

Bloke wrote #325829:

You should be fine to jump from 4.5.2 directly to 4.8.2 . . .

I tried the big jump, and had a 500 Internal Server error message.

(I’m on one of those multi-domain hosting plans, where you have a top domain, and the other 5 domains are in their own folder. Each website had a different txp version, with only the 4.5.2 one causing real issues.)

Eventually, frustrated, I went back to the 4.5.2. Thought I might tidy up the pages as there have been a few changes to coding since 2013.

(Not sure how it is possible to log into the txp backend when the front end has the error messages.)

Changed:

  • Doctype from XHTML to HTML5.
  • The old article to article_custom thing. Txp has become more picky.
  • http to https where needed
  • www to non-www

Had to be done sometime.

Still had the error messages when jumped up to 4.6.2, so fiddled around with the htaccess files.

After replacing various htaccess files, it suddenly came right. Easy enough then to go to 4.7.3. Then more error messages with 4.8.2. More fiddling with htaccess, then it just worked.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

Now I just need to upload the full 3 Gb database for 6 different websites, etc, to a new 2020 cpanel-based server, and I should be able to finally get beyond php version 5.6.27. Hopefully that will future proof everything for a while.

Moral of the story: don’t leave a website for 7 years without much in the way of upgrades.

Offline

#8 2020-09-12 14:16:28

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,271
Website GitHub

Re: Parse error: syntax error, unexpected 'yield' (T_YIELD),

Sorry for the rough ride. A 500 internal server error is usually an Apache misconfiguration so you were right to dig there. I’m not aware of any major changes in .htaccess between those versions, though, unless you’d done some customization that conflicted with something? Weird.

Glad you’re kind of up-to-date, or at least on the path to PHP 7. It’s well worth the time investment.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#9 2020-09-13 16:49:20

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,137
GitHub

Re: Parse error: syntax error, unexpected 'yield' (T_YIELD),

detail wrote #325879:

Now I just need to upload the full 3 Gb database for 6 different websites, etc

Hold on…3GB for 6 sites? Holy moly, what are you doing? If you’ve left it alone for 7 years, it’s entirely possible that your visitor log is out of control and is just chewing up space. That will all be taken care of (read: removed) with an upgrade, so it should be much smaller afterwards, assuming that’s what’s taking up most of the space…I’m fully prepared to be totally wrong on this.

Offline

#10 2020-09-16 06:37:19

detail
Member
From: geez, I seem to be in NZ
Registered: 2010-07-13
Posts: 176
Website

Re: Parse error: syntax error, unexpected 'yield' (T_YIELD),

gaekwad wrote #325884:

Hold on. 3GB for 6 sites?

Good old Txp.

One of my sites has over 1200 pages, and more than 5200 images at 1080 × 600 px.

Another is two-thirds of that.

It runs multiple 50 image slide shows, with a bit of 2010 js magic.

Txp handles it all seamlessly. I’m amazed by how it all works.

Offline

#11 2020-09-16 07:12:21

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,137
GitHub

Re: Parse error: syntax error, unexpected 'yield' (T_YIELD),

detail wrote #325903:

One of my sites has over 1200 pages, and more than 5200 images at 1080 × 600 px.

Another is two-thirds of that.

That still feels too big to me. Images are (usually) held outside the database – I can totally see how that many images would be 6GB, but 1200 pages (plus two thirds again, and some more) of text should be way less than 6GB.

I’m curious – if you’re able to run a database query, this would show the table sizes:

SELECT 
     table_schema as `Database`, 
     table_name AS `Table`, 
     round(((data_length + index_length) / 1024 / 1024), 2) `Size in MB` 
FROM information_schema.TABLES 
ORDER BY (data_length + index_length) DESC;

Would you be able to run that on your main site and post the results, please? It’s read-only, it won’t change any data.

Offline

#12 2020-09-16 13:39:29

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,011
Website GitHub Mastodon Twitter

Re: Parse error: syntax error, unexpected 'yield' (T_YIELD),

It does indeed sound too large. The NeMe site currently has 1582 images (plus their thumbnails) and 1921 articles, some of them very lengthy. The textpattern table is just over 33Mbs and the txp_image one is just under 199kb. Aside the plugins table which is about 2Mb (because of mostly disabled plugins) all other tables are well under 1Mb each as I have the logs expire every 2 days.

You should definitely look into it as 500Mb average/site is not very normal for txp.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

Board footer

Powered by FluxBB