Make WordPress Core

Opened 17 years ago

Closed 17 years ago

#3906 closed defect (bug) (worksforme)

Windows Live Writer can't upload image

Reported by: momo360modena's profile momo360modena Owned by: westi's profile westi
Milestone: Priority: normal
Severity: minor Version: 2.1.2
Component: XML-RPC Keywords: wlw, bug, php5.2, 5.2, windows, live, writer, upload, image reporter-feedback
Focuses: Cc:

Description

Now :

        $this->message = preg_replace('/<\?xml(.*)?\?'.'>/', '', $this->message);
        if (trim($this->message) == '') {
            return false;
        }
        $this->_parser = xml_parser_create();

Fix :

$rx = '/<?xml.*encoding=[\'"](.*?)[\'"].*?>/m';				
  if ( preg_match($rx, $this->message, $m) ) {
  $encoding = strtoupper($m[1]);
} 
else {
  $encoding = 'UTF-8';
}
$this->_parser = xml_parser_create($encoding);

Source :
http://blog.kingtch.com/2007/02/01/55/upload-image-with-windows-live-writer-2.html

Verify on 2 hosts PHP 5.2

Attachments (1)

class-IXR.php (27.1 KB) - added by momo360modena 17 years ago.

Download all attachments as: .zip

Change History (7)

#1 @westi
17 years ago

  • Keywords reporter-feedback added
  • Milestone changed from 2.1.3 to 2.2
  • Owner changed from anonymous to westi
  • Status changed from new to assigned

Can we see an example of the xml generated by live writer so as to understand what you are changing and why?

#2 follow-up: @Otto42
17 years ago

The code change above is appearantly to pull out the encoding value from the xml declaration, if it's there, and then pass that along to xml_parser_create().

#3 in reply to: ↑ 2 @westi
17 years ago

  • Summary changed from Bug : Windows Live Writer - PHP 5.2 - WordPress // Upload image to Windows Live Writer can't upload image

Replying to Otto42:

The code change above is appearantly to pull out the encoding value from the xml declaration, if it's there, and then pass that along to xml_parser_create().

True.

My worry here is that the linked blog entry has comments saying this doesn't fix the issue for other people.

I would like to see an example of the failed request to ensure we fix the actual cause of the problem.

I will see if i can get Windows Live Writer and try it against my test blog while I await further info from the reporter.

#4 @westi
17 years ago

  • Severity changed from major to minor

Ok I have tried to reproduce this issue and I can upload fine with Windows Live Writer to my 2.2-bleeding install.

ENV: PHP 5.1.6-pl6-gentoo with Hardening-Patch 0.4.15

I can't see why xml_parser_create needs the encoding specifying to sucessfully decode the file as it autodetects in v5.0+

#5 follow-up: @foolswisdom
17 years ago

  • Milestone changed from 2.2 to 2.3

Is the problem specific to PHP 5.2?

#6 in reply to: ↑ 5 @westi
17 years ago

  • Milestone 2.3 deleted
  • Resolution set to worksforme
  • Status changed from assigned to closed

Replying to foolswisdom:

Is the problem specific to PHP 5.2?

Not from what I can see. My server is now upgraded to PHP 5.2 and this works fine still:

PHP 5.2.1-pl3-gentoo with Suhosin-Patch 0.9.6.2
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies

with Suhosin v0.9.17, Copyright (c) 2002-2006, by Hardened-PHP Project

Note: See TracTickets for help on using tickets.