In testing out the new mediawiki_api on the Fedora Weekly News dev site, pasting in longer sections of mediawiki content produced the following error:

Notice: unserialize() [function unserialize]: Error at offset 0 of 449 bytes in _mediawiki_api_process() (line 105 of /home/asrob/insight.asrob.net/sites/all/modules/mediawiki_api)

Interestingly, the text is saved as a draft, and if I resave the draft, the error is not repeated.

Comments

asrob’s picture

Assigned: Unassigned » asrob

I'm trying to fix this.

im_lex’s picture

Change code in mediawiki_api.module in _mediawiki_api_process function to:

  // Query
  $query = array(
    'action' => 'parse',
    'format' => 'php',
    'text' => $text,
  );

  // Init curl request
  $ch = curl_init($filter->settings['mediawiki_api_url']); 

  curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded;charset=UTF-8','Expect:'));
  curl_setopt($ch, CURLOPT_HEADER, 0);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
  curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
  curl_setopt($ch, CURLOPT_POST, TRUE);
  curl_setopt($ch, CURLOPT_POSTFIELDS, drupal_http_build_query($query));
asrob’s picture

Status: Active » Fixed

Fixed and commited. Thank you, im_lex!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.