subject: a fresh delicous module installation for drupal 4.6

  1. a freshly installed Drupal 4.6 without third party patches
  2. the delicous.4.6.0 tarbal installed as mentioned in the README
  3. I tried a sample post with some words known as "delicous tags" this ended with a bunch of errors like this:

Wrong parameter count for preg_replace() in /var/www/web560/html/modules/delicious/delicious.module in Zeile 844.

On line 844 we have this:
$tag = preg_replace($tag, '/');

The PHP Manual says this about preg_replace():
mixed preg_replace ( mixed Suchmuster, mixed Ersatz, mixed Zeichenkette [, int Limit [, int &Anzahl]] )
IMHO we a parameter less then expected.

CommentFileSizeAuthor
delicous-error.jpg40.57 KBxeniac

Comments

merlinofchaos’s picture

Thank you for your report.

Try replacing $tag = preg_replace($tag, '/'); with $tag = preg_replace($tag, '/', '')

(This has to do with tags containing '/'. The fix for that needs to be better than it is I think)

xeniac’s picture

That gaves me an:
Delimiter must not be alphanumeric or backslash in /var/www/web560/html/modules/delicious/delicious.module in Zeile 844.

As i understand: you want to strip the / (Slash) becourse it makes trouble with the uri on Line 845, but del.icio.us allow slashes in Tags.

This Code strips all possible whitespaces from the Tag an encodes all specialchars in the link.
This Means you could tag your links as >My/Slash&Co< without any technical Problems:

function _delicious_tag_string($text, $tags, $username) {

  if (!$tags)
    return $text;

  // error, it must start with a tag... :-(
  foreach ($tags AS $tag) {
    trim($tag);
    if (!empty($tag)) {
      $path = 'http://del.icio.us/'.urlencode($username).'/'.urlencode($tag);
      $deliciousLink = "<a href = \"$path\"><img src = \"modules/delicious/deliciousIcon.gif\" border = \"0\" style = \"margin: 0px; padding: 0px; vertical-align: middle;\"></a>";

      if (!preg_match('/<.+>/',$text)) {
        $text = preg_replace('/(\b'.$tag.'\b)/i','$1'.$deliciousLink,$text);
      } else {
        $text = preg_replace('/(?<=>)([^<]+)?(\b'.$tag.'\b)/i','$1$2'.$deliciousLink,$text);
      }
    }
  }
merlinofchaos’s picture

This will only half-work; it will generate a valid-looking URL, but the / will break the part where it reads the tag. It's a start, though, and I know how to fix that, I just have to get it done.

jasonwhat’s picture

Any update to this? I'm getting this error as well.

Who8MyRice’s picture

I get this error too. While I would love to use this module, it won't even let my website load and gives me an 30 second timeout on line 851 of the drupal module. So towards the end of enabling a drupal block, I just made my own block with the code from here.

http://del.icio.us/help/tagrolls

While i don't like the tagroll as much as the delicious block, it functions for now. Can't wait to get this block workin again.

merlinofchaos’s picture

Assigned: Unassigned » merlinofchaos
Status: Active » Fixed

Ok, have been busy and haven't done this.

The fix to this particular problem has been committed and is in, but the overall problem which isn't as critical still exists.

Who8MyRice, your problem doesn't sound like the same thing, however. Try installing the latest module and see if that fixes your problem. If it doesn't, please enter a new bug.

Anonymous’s picture

Status: Fixed » Closed (fixed)