* warning: mb_eregi_replace() expects parameter 3 to be string, array given in /sites/all/modules/pathauto/pathauto.inc on line 184.
    * warning: mb_eregi_replace() expects parameter 3 to be string, array given in /sites/all/modules/pathauto/pathauto.inc on line 184.

I get the error when using filefield paths and pathauto together.

In case you haven't heard of filefield paths, here is the link:
http://drupal.org/project/filefield_paths

Comments

greggles’s picture

Status: Active » Postponed (maintainer needs more info)

This is likely a problem with a bad token implementation.

See the debugging steps we went through for a similar problem in #222637: mb_ereg_replace error when creating taxonomy term (or forum or gallery or...)

greggles’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

More than 2 weeks without response, closing.

marcano’s picture

We get this on our site (Redmami - a site for Spanish parents), when users create content, but NOT when admins or editors create content. Is this a permissions issue?

weynhamz’s picture

Component: Miscellaneous » I18n stuff
Assigned: Unassigned » weynhamz

Hi,I am a chinese user,and i got the same issue.
the i type the following codes before $output = mb_eregi_replace($ignore_re, '', $output); on line 184.

    $fp = fopen ('sites/debug.txt','a');
    ob_start();
    if(is_array($output)) {print_r($output);}
    $debug_techli = ob_get_contents();
    fwrite($fp,$debug_techli);
    ob_end_clean();
    fclose($fp);

and then,i find that in my debug.txt,there is an array like this

Array
(
    [zh-hans] => Array
        (
......

I know that some module have modified the 'value' field of the node object as data type array,then is do the debug step of reinstall module to find which module has a conflict,finally i find that the Advanced Blog do this.
An addtional information is that the current user is ok, but it will happen when modified the other author's node.i don't know why.
Hope this can help you to do somthing.

murokoma’s picture

Hi there,

found this thread after looking at some other mb_eregi error threads, and finally, I could reproduce it.

If I switch Advanced Blog OFF, the error message is gone.
Back on, here comes the error.

Hope this will help to reproduce it!

Robert

Eli Baskin’s picture

Adding up - it's the Advanced Blog module that causes the error.

olafkarsten’s picture

Disabling the Advanced Blog module works here, too.

greggles’s picture

Project: Pathauto » Advanced Blog
Version: 6.x-1.1 » 6.x-1.x-dev
Component: I18n stuff » Code
Status: Closed (fixed) » Active

Seems like it should be active and in their queue then.

To the Advanced Blog maintainers, this is likely a problem with your hook_token_values implementation. Let me know if you have any questions about it.

greggles’s picture

Status: Active » Postponed (maintainer needs more info)

For folks having this problem, please add a line like this just prior to line 140:

watchdog('array_not_string', print_r($output, true));

And then past your output here.

olafkarsten’s picture

I will do this, but don't know exactly which file you mean. I put this in pathauto.inc but no output there to paste it here? I can see an some 'array_not_string' entries in the logs, but now more information provided within these entries.

scapy’s picture

Hello,

I found a workaround for this problem.
In my case the problem occurrs when the owner of a node doesn't have a title for the blog.

In fact, in the advanced_blog_token_values function it is called t($advanced_blog->title); that returns an array when $advanced_blog->title is an empty string.
The same array generates the warning: mb_eregi_replace() expects parameter 3

To solve the problem, i added an IF to check if the blog title is empty.
Here the code.

NOTE: The advanced_blog_token_values function is placed in the "advanced_blog.module" file.

function advanced_blog_token_values($type, $object = NULL, $options = array()) {
  // watchdog('??????', 'advanced_blog_token_values()'); 

  if ($type == 'user') {
    $user = $object;
    $results = db_query("SELECT title, description, format FROM {advanced_blog} WHERE uid = %d", $user->uid);
    $advanced_blog = db_fetch_object($results);
    if (! empty($advanced_blog->title)) { 
         $tokens['blog-title'] = t($advanced_blog->title);
         //watchdog('$$$$$$$$', 'advanced_blog_token_values() - type user - '.  print_r(t($advanced_blog->title), true));
         return $tokens;
    }         
  }
  else if ($type == 'node') {
    $node = $object;
    $results = db_query("SELECT title, description, format FROM {advanced_blog} WHERE uid = %d", $node->uid);
    $advanced_blog = db_fetch_object($results);
    if (! empty($advanced_blog->title)) {
        $tokens['blog-title'] = t($advanced_blog->title);
        //watchdog('$$$$$$$$', 'advanced_blog_token_values() - type node - Value:'. $advanced_blog->title. ' -> '. print_r(t($advanced_blog->title), true) ); 
        return $tokens;
    }   
  }
  
  
}
sw3b’s picture

I confirmed the modification of #11 make the job ! I add the same issue and did the modification into the file and problem gone !

greggles’s picture

Status: Postponed (maintainer needs more info) » Active

Thanks for your comment and for helping make this a better module. Could you provide this as a patch?

svendecabooter’s picture

Assigned: weynhamz » svendecabooter
Status: Active » Fixed

I have slightly changed the token implementation as part of the cleanup i'm doing for this module.
Please check if the latest HEAD version fixes your problem, and report back if there are still problems.

izus’s picture

Status: Fixed » Needs review

just to say that i have the same error in my website
when i desable advenced_blog it desapears=> great ! but then, even with the code in #11, I can't get red of the error :(

please let me know if other solutions are suggested !

svendecabooter’s picture

Status: Needs review » Fixed

Have you downloaded the latest version of this module from CVS and tested that one?
As this problem is supposed to be fixed during the latest changes to this module that got committed.
Of course these changes are not yet available as a packaged release on drupal.org...
Stay tuned for a new release of this module in the upcoming weeks, with a lot of problems fixed.

greggles’s picture

They are available as a packaged release - 6.x-1.x-dev

izus’s picture

I tried the patch but the error still there.
I think that the problem is with the advanced_blog module and not pathauto, cause when i desable the advenced blog everything is all right and i do not see the error any were in my 10 subsites !

Status: Fixed » Closed (fixed)

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