Ticket #3906 (closed defect (bug): worksforme)

Opened 5 years ago

Last modified 5 years ago

Windows Live Writer can't upload image

Reported by: momo360modena Owned by: westi
Priority: normal Milestone:
Component: XML-RPC Version: 2.1.2
Severity: minor Keywords: wlw, bug, php5.2, 5.2, windows, live, writer, upload, image reporter-feedback
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

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

Change History

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

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

comment:2 follow-up: ↓ 3   Otto425 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().

comment:3 in reply to: ↑ 2   westi5 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.

  • 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+

comment:5 follow-up: ↓ 6   foolswisdom5 years ago

  • Milestone changed from 2.2 to 2.3

Is the problem specific to PHP 5.2?

comment:6 in reply to: ↑ 5   westi5 years ago

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

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.