Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#36501 closed defect (bug) (fixed)

Fatal error: Undefined class constant 'ALPHACHANNEL_UNDEFINED'

Reported by: gblsm's profile gblsm Owned by: kirasong's profile kirasong
Milestone: 4.5.1 Priority: normal
Severity: normal Version: 4.5
Component: Media Keywords: has-patch fixed-major
Focuses: Cc:

Description

After upgrading to WordPress 4.5 today, some people have reported that a Fatal error occurs when they upload an image through Admin > Media.

Fatal error: Undefined class constant 'ALPHACHANNEL_UNDEFINED' in /home/users/2/lolipop.jp-xxxxx/web/news/wp-includes/class-wp-image-editor-imagick.php on line 379

I found that the parameter for PHP’s define function caused the error. It should be quoted but is not done right now. The patch to this is attached.

if ( is_callable( array( $this->image, 'getImageAlphaChannel' ) )
	&& is_callable( array( $this->image, 'setImageAlphaChannel' ) )
	&& defined( 'Imagick::ALPHACHANNEL_UNDEFINED' )
	&& defined( 'Imagick::ALPHACHANNEL_OPAQUE' )
) {
	if ( $this->image->getImageAlphaChannel() === Imagick::ALPHACHANNEL_UNDEFINED ) {
		$this->image->setImageAlphaChannel( Imagick::ALPHACHANNEL_OPAQUE );
	}
}

Attachments (1)

class-wp-image-editor-imagick.php.diff (1.1 KB) - added by gblsm 9 years ago.

Download all attachments as: .zip

Change History (13)

#1 in reply to: ↑ description @gblsm
9 years ago

The issue was originally reported in this WordPress Japanese forum thread:
https://ja.forums.wordpress.org/topic/158985

Thank you for reporting @amachang, @qingmu with support from @extendwings

Last edited 9 years ago by gblsm (previous) (diff)

#2 @SergeyBiryukov
9 years ago

  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 4.5.1

Introduced in [36700] and [36891].

#3 @kirasong
9 years ago

  • Owner set to mikeschroder
  • Resolution set to fixed
  • Status changed from new to closed

In 37192:

Media: Resolve fatal error on resize with ImageMagick < 6.4.6

Improper checking for 'Imagick::ALPHACHANNEL_UNDEFINED' and
'Imagick::ALPHACHANNEL_OPAQUE' caused fatal errors for some users
with Imagick when compiled against ImageMagick < 6.4.6, when these
constants were introduced. Fixes these compatibility checks.

Props gblsm.
Fixes #36501.

#4 @kirasong
9 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopening for 4.5.1.

#5 @DrewAPicture
9 years ago

  • Keywords fixed-major added

This ticket was mentioned in Slack in #core by mike. View the logs.


9 years ago

#7 follow-up: @extendwings
9 years ago

@mikeschroder, do you have a target date of WordPress 4.5.1 release?

Some "Lollipop" (one of major hosting service in Japan) users are affected by this issue and they have no plan to update ImageMagick. (So, the faster release, the better.)

#8 in reply to: ↑ 7 ; follow-up: @kirasong
9 years ago

Replying to extendwings:

@mikeschroder, do you have a target date of WordPress 4.5.1 release?

Some "Lollipop" (one of major hosting service in Japan) users are affected by this issue and they have no plan to update ImageMagick. (So, the faster release, the better.)

No, I do not have a target date at this point. Am concerned about the breakage, and it absolutely needs to be fixed (it's a bug, and the fix has been committed to trunk), but it's worth noting that this seems to be the only host that users have reported issues with thusfar. I'm very interested in knowing if there are more instances.

ImageMagick 6.4.6 was released in 2008, so this is probably the reason that fewer users are affected than would otherwise be.

It's likely that the timeline for 4.5.1 will be discussed at next week's dev meeting (April 20 at 2000 UTC).

#9 @tenpura
9 years ago

Lolipop identified that some of their old servers are affected by this, and officially announced the solution for the issue. They also provide the method for migrating to a non-affected server for their customers, so it seems to be OK somehow.

#10 in reply to: ↑ 8 @stevengliebe
9 years ago

Replying to mikeschroder:

...seems to be the only host that users have reported issues with thusfar. I'm very interested in knowing if there are more instances.

I have a user on http://www.surpasshosting.com having this issue. They're running version 6.4.1 of ImageMagick.

This ticket was mentioned in Slack in #core by adamsilverstein. View the logs.


9 years ago

#12 @ocean90
9 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 37245:

Media: Resolve fatal error on resize with ImageMagick < 6.4.6

Improper checking for 'Imagick::ALPHACHANNEL_UNDEFINED' and
'Imagick::ALPHACHANNEL_OPAQUE' caused fatal errors for some users
with Imagick when compiled against ImageMagick < 6.4.6, when these
constants were introduced. Fixes these compatibility checks.

Merge of [37192] to the 4.5 branch.

Props gblsm.
Fixes #36501.

Note: See TracTickets for help on using tickets.