#48766 [NEW]: gpf on imap on when using OP_PROTOTYPE option (Reopened)

[email protected] ("d_kelsey at uk dot ibm dot com")
Newsgroups php.bugs
Message-ID <[email protected]>
From:             d_kelsey at uk dot ibm dot com
Operating system: linux
PHP version:      5.2CVS-2009-07-02 (snap)
PHP Bug Type:     IMAP related
Bug description:  gpf on imap on when using OP_PROTOTYPE option (Reopened)

Description:
------------
I was not able to re-open bug 48400 so have created a new bug with the
extra information.

I asked the question on the c-client mailing list using the example code
provided in bug http://bugs.php.net/bug.php?id=48400
and the response implies that php code is at fault here 

---------------------------------------------------------------------
This is not a bug.  Rather, you have misunderstood some important points.

There are three issues with your sample program.

[1] You SHOULD include c-client.h, and not mail.h directly.  mail.h has 
most, but not all, of the consumer API definitions and prototypes.

[2] You MUST (repeat, MUST!!) include linkage.c at the start of your 
main() function instead of calling mail_link() directly.

[3] A prototype stream is not something that can be given to 
mail_close_full().

Without knowing why you are opening a prototype stream, it appears to me 
that you do not understand what a prototype stream is and how/why it is 
used; especially since this is an IMAP prototype stream, something which 
is almost completely useless except for internal c-client purposes.

A prototype stream is not a stream.  The closest analog to a prototype 
stream would be a factory object or class definition.  Internally, a 
prototype stream is simply a pointer to a static area of constant memory 
that has the dtb for that driver.

Prototype streams have VERY limited use to API consumers.  The primary 
consumer use is that of a local filesystem format prototype stream as an 
argument to mail_create() to force the created mailbox to be in that 
format.  However, that use is deprecated in favor of the #driver.???/ 
prefix; e.g.,
 		 mail_create (NIL,"#driver.mix/newbox");
is the preferred and more modern way of doing
 		 mail_create (mail_open
(NIL,existingmixmailbox,OP_PROTOTYPE),"newbox");

The prototype stream method is the way to create a new local filesystem 
mailbox of the same format as an existing local filesystem mailbox, as 
opposed to a specified format via the #driver.???/ syntax .  This is 
therefore the 99% reason why any API consumer would use a prototype 
stream.

Your use may be in the remaining 1% (it would have to be, given that it's

an IMAP prototype stream), but I suspect that it's really a case of your 
not understanding what you are doing.

Getting back to the subject at hand; since it is a factory object (or 
class definition), it is inappropriate to call non-factory methods on it.

For most API consumers, other than mail_create() with a local filesystem 
driver prototype, the remaining uses are power tools for master
sorcerers.

mail_close() and mail_close_full() are completely inappropriate methods to

use with a prototype stream, even for a master sorcerer.  A prototype 
stream is not a stream, and is not something that can be closed.  When you

are finished with a prototype stream, you just drop the pointer.

-- Mark --
---------------------------------------------------------------------

The simpliest solution would be to remove the OP_PROTOTYPE option but the
response may indicate a concern in general in the way php uses the c-client
apis.


-- 
Edit bug report at http://bugs.php.net/?id=48766&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        http://bugs.php.net/fix.php?id=48766&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        http://bugs.php.net/fix.php?id=48766&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        http://bugs.php.net/fix.php?id=48766&r=trysnapshot60
Fixed in CVS:                        http://bugs.php.net/fix.php?id=48766&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=48766&r=needdocs
Fixed in release:                    http://bugs.php.net/fix.php?id=48766&r=alreadyfixed
Need backtrace:                      http://bugs.php.net/fix.php?id=48766&r=needtrace
Need Reproduce Script:               http://bugs.php.net/fix.php?id=48766&r=needscript
Try newer version:                   http://bugs.php.net/fix.php?id=48766&r=oldversion
Not developer issue:                 http://bugs.php.net/fix.php?id=48766&r=support
Expected behavior:                   http://bugs.php.net/fix.php?id=48766&r=notwrong
Not enough info:                     http://bugs.php.net/fix.php?id=48766&r=notenoughinfo
Submitted twice:                     http://bugs.php.net/fix.php?id=48766&r=submittedtwice
register_globals:                    http://bugs.php.net/fix.php?id=48766&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=48766&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=48766&r=dst
IIS Stability:                       http://bugs.php.net/fix.php?id=48766&r=isapi
Install GNU Sed:                     http://bugs.php.net/fix.php?id=48766&r=gnused
Floating point limitations:          http://bugs.php.net/fix.php?id=48766&r=float
No Zend Extensions:                  http://bugs.php.net/fix.php?id=48766&r=nozend
MySQL Configuration Error:           http://bugs.php.net/fix.php?id=48766&r=mysqlcfg
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.