WordPress.org

Make WordPress Core

Opened 4 years ago

Last modified 8 weeks ago

#35927 new defect (bug)

_wp_attachment_metadata meta_value wrong type in export

Reported by: davidak Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.4.2
Component: Export Keywords: 2nd-opinion
Focuses: Cc:
PR Number:

Description

this if from an export using wp 4.4.2, the particular post is from Dec 2010.

		<wp:postmeta>
			<wp:meta_key><![CDATA[_wp_attachment_metadata]]></wp:meta_key>
			<wp:meta_value><![CDATA[a:6:{s:5:"width";s:4:"1280";s:6:"height";s:3:"800";s:14:"hwstring_small";s:23:"height='80' width='128'";s:4:"file";s:49:"2010/12/Bildschirmfoto-2010-12-14-um-19.47.29.png";s:5:"sizes";a:3:{s:9:"thumbnail";a:3:{s:4:"file";s:49:"Bildschirmfoto-2010-12-14-um-19.47.29-150x150.png";s:5:"width";s:3:"150";s:6:"height";s:3:"150";}s:6:"medium";a:3:{s:4:"file";s:49:"Bildschirmfoto-2010-12-14-um-19.47.29-300x187.png";s:5:"width";s:3:"300";s:6:"height";s:3:"187";}s:5:"large";a:3:{s:4:"file";s:50:"Bildschirmfoto-2010-12-14-um-19.47.29-1024x640.png";s:5:"width";s:4:"1024";s:6:"height";s:3:"640";}}s:10:"image_meta";a:10:{s:8:"aperture";s:1:"0";s:6:"credit";s:0:"";s:6:"camera";s:0:"";s:7:"caption";s:0:"";s:17:"created_timestamp";s:1:"0";s:9:"copyright";s:0:"";s:12:"focal_length";s:1:"0";s:3:"iso";s:1:"0";s:13:"shutter_speed";s:1:"0";s:5:"title";s:0:"";}}]]></wp:meta_value>
		</wp:postmeta>

every width and height value is a string but should be an int!

s:5:"width";s:3:"150";s:6:"height";s:3:"150";

should be

s:5:"width";i:150;s:6:"height";i:150;

if i edit it manually, the import works.

could you provide database migration or something in the next update to fix the values?
this don't happen with newer articles.

Change History (2)

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


8 weeks ago

#2 @noisysocks
8 weeks ago

  • Component changed from General to Export
  • Keywords 2nd-opinion added

Verified that new posts, when exported, have width and height as an integer. It's possible an older version of WordPress saved strings to the database.

We could patch the exporter to coerce these strings to integers, or we could add a migration script which coerces the strings to integers. I'm not sure if either of these approaches is feasible, so adding 2nd-opinion here.

Note: See TracTickets for help on using tickets.