Module causes a pathauto error message to appear in certain circumstances

wkmit - March 11, 2009 - 15:57
Project:Known User Role
Version:6.x-1.2
Component:Code
Category:bug report
Priority:normal
Assigned:greg.harvey
Status:closed
Description

If a non 'superuser' user saves a node the following message displays
warning: mb_eregi_replace() expects parameter 3 to be string, array given in C:\Program Files\wamp\www\connect\trunk\www\sites\all\modules\contribs\pathauto\pathauto.inc on line 185.

I tracked down the culprit to this line of code. $form['uid']['#value'] = explode('|',$_COOKIE['known_user_role_details'],1);

Assume
$_COOKIE['known_user_role_details'] = "164|randomuser";

If we use $form['uid']['#value'] = explode('|',$_COOKIE['known_user_role_details'],1); to extract the uid.
The value returned to $form['uid']['#value'] will not be 164.
It will be $form['uid']['#value'] =Array([0] => 164|wai).

The solution is a 2 liner.
+ $fragments = explode('|',$_COOKIE['known_user_role_details']);
+ //get uid
+ $form['uid']['#value'] = $fragments[0];

Let me know if you have any questions. =)

AttachmentSize
known_user_role_v1.patch3.93 KB

#1

greg.harvey - March 29, 2009 - 17:52
Assigned to:Anonymous» greg.harvey

Thanks for detail and patch. Will review ASAP. =)

#2

greg.harvey - June 12, 2009 - 17:18
Status:needs review» fixed

Committed and in latest release! Thanks! =)

#3

System Message - June 26, 2009 - 17:20
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.