6.0.0-beta1
8/9/25

[#5582] Need to replace sscanf() in Turba_Driver
Summary Need to replace sscanf() in Turba_Driver
Queue Turba
Queue Version HEAD
Type Bug
State Resolved
Priority 2. Medium
Owners chuck (at) horde (dot) org
Requester mrubinsk (at) horde (dot) org
Created 07/26/2007 (6589 days ago)
Due
Updated 08/04/2007 (6580 days ago)
Assigned 07/30/2007 (6585 days ago)
Resolved 08/04/2007 (6580 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch No

History
08/04/2007 05:18:21 PM Chuck Hagenbuch Comment #11
Assigned to Chuck Hagenbuch
State ⇒ Resolved
Reply to this comment
I've added the note about positioned parameters to sources.php.dist.
08/04/2007 01:48:43 PM Michael Rubinsky Comment #10 Reply to this comment
we need to put the field we are using to store the contact list name
first in the
'fields'
I don't follow this part.
Acutally, I think the issue this was referring to only occured with 
the positioned params, so never mind ;)



Guess we can close this then with a note in the sources.php file?



But i'm still getting some strange behaviour with lists...will 
investigate more.




08/04/2007 01:34:06 PM Michael Rubinsky Comment #9 Reply to this comment
Hmm. I'd forgotten about the updatefield action. I can't see how that
would work with positioned parameters already. So maybe the answer is
that positioned parameters simply aren't supported here?
Yea, that's what i was hoping and why I posted that 'just to clarify' 
post, as a kind of hint in that direction ;)
08/04/2007 04:57:09 AM Chuck Hagenbuch Comment #8 Reply to this comment
we need to put the field we are using to store the contact list name 
first in the
'fields'
I don't follow this part.
array...and off the top of my head, even if we were able to use a
regex, we'd still have to "manually" ensure the correct ordering of
the fields in the fields array, no?
Yeah. Not as pretty as I'd hoped.
08/04/2007 04:56:11 AM Chuck Hagenbuch Comment #7 Reply to this comment
Doesn't look like it's going to be that easy (of course).
1) We use the 'format' string in other places (as parameters to
vsprintf for example)
2) The format string is also used in Horde_Form_Action_updatefield,
which specifically explodes the string on '%s' ... and we can't
change this without breaking bc.
Hmm. I'd forgotten about the updatefield action. I can't see how that 
would work with positioned parameters already. So maybe the answer is 
that positioned parameters simply aren't supported here?
08/03/2007 09:02:39 PM Michael Rubinsky Comment #6 Reply to this comment
Just to clarify:

The existing code works fine as long as we don't use positioned 
parameters in the format string -' %2$s %1$s' for example.  With just 
' %s %s'  every thing is fine, but we need to put the field we are 
using to store the contact list name first in the 'fields' array...and 
off the top of my head, even if we were able to use a regex, we'd 
still have to "manually" ensure the correct ordering of the fields in 
the fields array, no?
08/03/2007 08:25:23 PM Michael Rubinsky Comment #5 Reply to this comment
Doesn't look like it's going to be that easy (of course).

1) We use the 'format' string in other places (as parameters to 
vsprintf for example)

2) The format string is also used in Horde_Form_Action_updatefield, 
which specifically explodes the string on '%s' ... and we can't change 
this without breaking bc.




07/30/2007 05:20:42 PM Jan Schneider Comment #4 Reply to this comment
Sounds good.
07/30/2007 03:25:41 PM Chuck Hagenbuch Comment #3
State ⇒ Feedback
Reply to this comment
Does anyone see a problem with changing the 'format' parameter from a 
printf format string to a regexp? That seems to be the simplest thing 
to me, and probably allows much more flexible fields as well.
07/26/2007 03:33:28 PM Michael Rubinsky Comment #2 Reply to this comment
07/26/2007 12:32:35 AM Michael Rubinsky Comment #1
Priority ⇒ 2. Medium
State ⇒
Queue ⇒ Turba
Summary ⇒ Need to replace sscanf() in Turba_Driver
Type ⇒ Bug
Reply to this comment
Due to a bug in PHP (both 4 and 5) we need to change the sscanf() call 
in Turba_Driver::toDriverKeys to some other inplementation.



The bug causes problems when using positioned parameters in the format 
string (inserts extra array elements in the results as well as 
confusing the order of the results in some cases) thus causing the 
composite fields to break....and possibly preventing the creation of 
new contact lists.



Example:



$test = sscanf('hello world, '%2$s %1$s');

print_r($test);



produces:



Array

(

     [0] =>

     [1] =>

     [3] => hello

     [2] => world

)






Saved Queries