[#6628] PHP Fatal error: Cannot use string offset as an array in ./lib/Horde/Crypt/smime.php on line 830
Summary PHP Fatal error: Cannot use string offset as an array in ./lib/Horde/Crypt/smime.php on line 830
Queue Horde Framework Packages
Queue Version HEAD
Type Bug
State Feedback
Priority 1. Low
Owners Horde Developers, Michael Slusarz <slusarz (at) horde (dot) org>
Requester horde (at) iiegn (dot) de
Created 04/19/2008 (132 days ago)
Due
Updated 07/16/2008 (44 days ago)
Assigned 07/16/2008 (44 days ago)
Resolved
Attachments horde.zip Download
Milestone
Patch No

History
07/16/2008 CVS Commit Comment #8 Reply to this comment
07/16/2008 Michael Slusarz Comment #7
State ⇒ Feedback
Reply to this comment
I didn't write any of this code (sorry) - but mucking through the 
attached data, looks like this is the difference between the two 
pertinent data objects is as follows:

Bad data:
[9] => Array
                                 (
                                     [0] => bit string
                                     [1] => +
                                 )

Good data:
                             [9] => Array
                                 (
                                     [0] => sequence
                                     [1] => Array
                                         (
                                             [0] => Array
                                                 (
                                                     [0] => oid
                                                     [1] => 
id-ce-basicConstraints
                                                 )

                                             [1] => Array
                                                 (
                                                     [0] => boolean
                                                     [1] => 1
                                                 )

                                             [2] => Array
                                                 (
                                                     [0] => octet string
                                                     [1] => 0&#65533;
                                                 )

                                         )

                                 )

The code has something to do with determining certificate extensions I 
guess, so I just ignored data formatted as the former to fix the 
error.  Others who know more about S/MIME can feel free to fix 
properly, as necessary.
07/16/2008 CVS Commit Comment #6 Reply to this comment
07/06/2008 Jan Schneider Assigned to Horde DevelopersHorde Developers
 
05/01/2008 Chuck Hagenbuch State ⇒ Assigned
 
04/22/2008 Chuck Hagenbuch Comment #5
Assigned to Michael Slusarz
Reply to this comment
Michael, is this something you could take a look at?
04/21/2008 horde (at) iiegn (dot) de Comment #4
New Attachment: horde.zip Download
Reply to this comment
versions and the like are:

Horde Version
Horde: 3.2-RC3

Horde Applications
Dimp: H3 (1.0-RC3)
Horde: 3.2-RC3
Imp: H3 (4.2-RC3)
Ingo: H3 (1.2-cvs))
Kronolith: H3 (2.2-RC2)
Mimp: H3 (1.0-cvs)
Nag: H3 (2.2-cvs)
Turba: H3 (2.2-cvs)

PHP Version
PHP Version: 5.2.0-8+etch10

in particular, smime.php:
* $Horde: framework/Crypt/Crypt/smime.php,v 1.49.2.17 2008/01/02 
11:30:26 jan Exp $


the exact error message is simply this (when trying to *view* a 
message in IMP):
Apr 21 13:44:27 ### apache2: PHP Fatal error:  Cannot use string 
offset as an array in /###/horde.org/lib/Horde/Crypt/smime.php on line 
827


however, it seems that the error only occurs with one of my 
certificates, i.e. (and that's probably what makes it hard to 
reproduce) messages signed with one of my certificates just display 
fine and messages signed with another one fail - sorry, hadn't 
realized this before...

so: i attached the two certificates (der format) and two message 
sources (names should be rather obvious) where one displays fine and 
the other fails with the mentioned error message.


04/20/2008 Chuck Hagenbuch Comment #3
State ⇒ Feedback
Reply to this comment
Can you please provide a full source message that we can use to 
reproduce the problem?
04/19/2008 horde (at) iiegn (dot) de Comment #2 Reply to this comment
(OOPS - sorry) a possible solution:

*** smime.php.org
--- smime.php
***************
*** 825,830 ****
--- 825,831 ----
           }

           $i = 9;
+                   $cert_data[1][0][1] = array();
           while (isset($cert_data[1][0][1][$i])) {
               $oid = $cert_data[1][0][1][$i][1][0][1];
               $cert_details['certificate']['extensions'][$oid] = 
$cert_data[1][0][1][$i][1][1];


04/19/2008 horde (at) iiegn (dot) de Comment #1
Patch ⇒
Milestone ⇒
Queue ⇒ Horde Framework Packages
Summary ⇒ PHP Fatal error: Cannot use string offset as an array in ./lib/Horde/Crypt/smime.php on line 830
Type ⇒ Bug
Priority ⇒ 1. Low
State ⇒ Unconfirmed
Reply to this comment
when trying to view a s/mime signed message in imp (at least this 
holds for my own signed messages - however, signed with a different 
application) i get the mentioned php fatal error:

a possible solution:

         $i = 9;
         $cert_data[1][0][1] = array();
         while (isset($cert_data[1][0][1][$i])) {
             $oid = $cert_data[1][0][1][$i][1][0][1];
             $cert_details['certificate']['extensions'][$oid] = 
$cert_data[1][0][1][$i][1][1];
             $i++;
         }