RE: [PHP-DEV] php/ext/xslt and TSRM

2002-10-30 Thread David Viner
perhaps i'm a bit slow... what is the gain by moving the TSRMLS_FETCH() from
functions to having the TSRM params in the php_xslt struct?  that is, what
functionality or benefit is brought to the extension or the code? Is there
something that the extension does not handle properly as it stands?  or is
the idea simply to remove lots of TSRMLS_FETCH() calls?

btw - we should move this discussion from php-dev to sab-php.  that's where
we're trying to maintain all php/sablotron maintanence issues.

dave


-Original Message-
From: Marcus Boerger [mailto:marcus.boerger;t-online.de]
Sent: Wednesday, October 30, 2002 7:38 AM
To: Melvyn Sopacua
Cc: Sterling Hughes; [EMAIL PROTECTED]; David Viner
Subject: Re: [PHP-DEV] php/ext/xslt and TSRM


At 15:54 30.10.2002, Melvyn Sopacua wrote:
At 15:10 30-10-2002, Marcus Boerger wrote:

What about removing all TSRMLS_FETCH() and instead passing
TSRM parameters in php_xslt struct?

Before you do that, I'd rather you wait untill after the weekend - unless
there's a compelling reason not too.

I'm working on exposure of Sablotron SXP_ functions, and this may alter
quite a few things in the files.

A complete overhaul of the thread issues is then welcome, but I think David
is capable of this also.

When it shall be done by me tell me when i can proceed. I suggest a diff
to check before comitting would be the way to go with this issue.

marcus


With kind regards,

Melvyn Sopacua
?php include(not_reflecting_employers_views.txt); ?




-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DEV] berkeley db and dba

2002-10-28 Thread David Viner
Hi,
I noticed that the ext/dba extension allows me to use Berkeley DB.  I'm
interested in using some of the newer features in Berkeley DB v4
(sleepycat's latest release).  In particular, there are a set of features
regarding a db environment.  See
http://www.sleepycat.com/docs/ref/env/intro.html for more information if
you're interested.  Basically the things that really attract me to this are
the memory pools that might allow multiple apache processes to use shared
memory (file-backed or system memory) for caching data.  But the dba
extension doesn't seem to provide any hooks for these calls, or other
db-specific functions.  What is the best way for me to get access to these
functions?


thanks
dave viner


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DEV] Problem with XSLT Sablotron - Bug ?

2002-10-14 Thread David Viner

does this work from the sablotron command line?  you should be able to run
sabcmd test.xslt test.xml
and see the correct output.  If this fails, then the problem has nothing to
do with PHP.  If this succeeds, then the error lies with the php extension.

I'm cc-ing sab-php list which has assumed ownership of PHP's xslt extension.
We should remove php-dev from this list for the time being.

dave


-Original Message-
From: Dirk Schwier [mailto:[EMAIL PROTECTED]]
Sent: Monday, October 14, 2002 1:24 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DEV] Problem with XSLT Sablotron - Bug ?


Hy NG,

I get under some circumstances an Sablotron Error: XML parser error 3: no
element
found - this Error occurs only, when I put a lot of Text into an
CDATA-Section.

I Put a sample script beyond, maybe somone can tell me, if there is a
wokaround or if it is a bug (this is, what I guess).
I tried different php versions (4.2.3, 4.3.0dev, 4.3.0.-pre1, etc.) at the
moment I use Sablotron 0.96.1.

These are the sample scripts:
An XML-Datei (test.xml)

?xml version=1.0 encoding=iso-8859-1?
!DOCTYPE navigation [
 !ENTITY module1 SYSTEM test2.xml
]
navigation
 module1;
/navigation

and test2.xml. the entity:

?xml version=1.0 encoding=iso-8859-1?

test

![CDATA[
sdfgsdfgjsödfkjgsödlkfjgsödkfjgsödfkgjsödkfgjsödkfgjsödkfgjsödlkfjgsödfgsdfg
gslkdjfgsödlkfjgöslkdjgösldkgjsödlkfgjsödklfgjsödlkfgjsödkfgjsöd
flkgjsödkfgjsödklfgjsödlkfgjsödlkfgjsödlkfgjsödlkfgjsödlkfgjsödklfgjösdklfgj
södklfgjsödklfgjsödkfgjösdkfgjsödfkgjsödfkgjsödfkgjsödfgsdfgsjdöfgksjödfkgjs
ödlfkgjsödlkfjgsödlkfgjsödkfjgösdklfgjösdkfjgösdkfgjösdlkfgjsödlkfgjsödlkfjg
öskldfgjöslkjgölkwejrtkwejrtwejrtkjweörkltjweörkltjwöekrtjwöerlktjwöerkltjwö
ekrltjwöelkrtjwöeklrjtwöelkrtjweölrktjwöelrktjwöelkrjtwöekrtjwöekrjtöwerktjw
öerkjtöweklrtjwkerjtöwkerjtöwlkerjtöwklerjtöwlkerjtöweklrjtöwklerjtöwekrtjöw
elkrtjöwkelrjtöwkerjtöwlkerjtöweklrtjöweklrjtöwekrjtöwerktjwöekrtjwöekrjtöwe
lkrjtwöekrtjöwekrtjöwelkrjtwökelrtöwekrtjöwkelrjtölwkerjtwlökerjtwölekrjtwöl
ekrjtlwöekrjtlwöekrjlketjlkjklrjlkjkjrkjlkröjlkrjklrejlkrejlkrtjlktrjlktrkjl
trjlktrkljkltrjlktrjkltrkjlötrewrjlkewjlkrewjklrejlktrwkjlrkjlörwejklörewjkl
trjöewrjlökerkwrelökwrjkleöw
[... snipp ca. 240 columns with same content ...]
]]

/test

(for the test you have to the 240 cols into the script ...)

and test.xslt:
[... snipp ...]
xsl:template match=navigation
 xsl:value-of select=./
/xsl:template
[... snipp ...]

this is the parsing script (test.php):
if( !$result = @xslt_process(  $parser, // resource xh
test.xml,  // string xml
test.xslt,  // string xslt
$html,  // string result
array(),   // array arguments
array()   // array parameters
) )
{
printf( Sablotron Error (%s): br /strong%s/strong,
xslt_errno($parser), xslt_error($parser) );
}
xslt_free($parser);
echo $result;
echo $html;

after that I get the error.

If I delete some content in the test2.xml I get no error.

So I hope, that someone can help me.

:) Dirk Schwier.



--
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DEV] using run-tests.php on windows

2002-10-06 Thread David Viner

hi,
i'm trying to get the php tests to run on my windows 2k machine, and having
a lot of trouble.  i seem to fail at this line:

if (!is_executable($php)) {
error(invalid PHP executable specified by TEST_PHP_EXECUTABLE  =  .
$php);
}

I removed the '' to see what was happening, and I get this error message:
PHP Fatal error: Call to undefined function: is_executable()

I just checked out the latest tree, and recompiled everything, and it all
compiled without an error.  Here's the full output:

D:\php\php4release_ts\php.exe run-tests.php
PHP Fatal error:  Call to undefined function:  is_executable() in
D:\php\php4\ru
n-tests.php on line 77

Fatal error: Call to undefined function:  is_executable() in
D:\php\php4\run-tes
ts.php on line 77

I'm sure I'm just missed a step somewhere, but I can't seem to figure out
what I've done wrong.  (Also, I tried using the MSVC++ testsuite workspace,
but again without success.  that error message said:

Configuration: testsuite - Win32
Release_TS
Build : warning : failed to (or don't know how to) build
'D:\php\php4\results.txt'
Running Testsuite, please wait...
Error executing c:\winnt\system32\cmd.exe.

testsuite - 1 error(s), 1 warning(s)

)

Does anyone else have this problem?  or does anyone have success building
the tests from Windows?

thanks
dave viner


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DEV] [PATCH] ext/xslt - xslt_set_object

2002-10-04 Thread David Viner

after talking with other xslt developers, and ensuring backwards
compatibility, I have commited this change to the ext/xslt extension.

dave


-Original Message-
From: David Viner [mailto:[EMAIL PROTECTED]]
Sent: Thursday, October 03, 2002 11:00 AM
To: Php-Dev@lists. php. net
Subject: [PHP-DEV] [PATCH] ext/xslt - xslt_set_object


Here's a short patch to the XSLT extension that allows a user to call
xslt_set_object($xh,$obj);
This works in a manner similar to the 'xml_set_object' function. (Only
difference is that the second argument is not passed by reference.)

dave


= BEGIN PATCH =
Index: ext/xslt/php_sablot.h
===
RCS file: /repository/php4/ext/xslt/php_sablot.h,v
retrieving revision 1.11
diff -B -b -u -r1.11 php_sablot.h
--- ext/xslt/php_sablot.h   22 Aug 2002 09:54:04 -  1.11
+++ ext/xslt/php_sablot.h   3 Oct 2002 17:57:27 -
@@ -62,6 +62,7 @@
 PHP_FUNCTION(xslt_error);
 PHP_FUNCTION(xslt_errno);
 PHP_FUNCTION(xslt_free);
+PHP_FUNCTION(xslt_set_object);
 PHP_FUNCTION(xslt_backend_version);
 PHP_FUNCTION(xslt_backend_name);

@@ -112,6 +114,7 @@
struct xslt_handlers  *handlers;
struct xslt_processor  processor;
struct xslt_error *err;
+   zval  *object;
 } php_xslt;

 #else
Index: ext/xslt/php_xslt.h
===
RCS file: /repository/php4/ext/xslt/php_xslt.h,v
retrieving revision 1.9
diff -B -b -u -r1.9 php_xslt.h
--- ext/xslt/php_xslt.h 28 Feb 2002 08:27:00 -  1.9
+++ ext/xslt/php_xslt.h 3 Oct 2002 17:57:27 -
@@ -51,7 +51,7 @@

 extern void xslt_assign_handler(struct xslt_function **, zval **);
 extern void xslt_free_handler(struct xslt_function *);
-extern void xslt_call_function(char *, zval *, int, zval **, zval **);
+extern void xslt_call_function(char *, zval *, zval *, int, zval **, zval
**);

 extern void xslt_debug(char *, char *, ...);

Index: ext/xslt/sablot.c
===
RCS file: /repository/php4/ext/xslt/sablot.c,v
retrieving revision 1.52
diff -B -b -u -r1.52 sablot.c
--- ext/xslt/sablot.c   22 Aug 2002 09:54:04 -  1.52
+++ ext/xslt/sablot.c   3 Oct 2002 17:57:27 -
@@ -87,6 +88,7 @@
PHP_FE(xslt_error,   NULL)
PHP_FE(xslt_errno,   NULL)
PHP_FE(xslt_free,NULL)
+   PHP_FE(xslt_set_object,  NULL)
PHP_FE(xslt_backend_version, NULL)
PHP_FE(xslt_backend_name,NULL)
{NULL, NULL, NULL}
@@ -182,6 +184,7 @@
handle   = ecalloc(1, sizeof(php_xslt));
handle-handlers = ecalloc(1, sizeof(struct xslt_handlers));
handle-err  = ecalloc(1, sizeof(struct xslt_error));
+   handle-object   = NULL;

XSLT_LOG(handle).path = NULL;

@@ -610,6 +613,32 @@
 }
 /* }}} */

+/* {{{ proto void xslt_set_object(resource parser, object obj)
+   sets the object in which to resolve callback functions */
+PHP_FUNCTION(xslt_set_object)
+{
+   zval  **processor_p;  /* Resource pointer to a PHP-XSLT processor */
+   zval  **myobj;/* The object that will handle the callback */
+   php_xslt   *handle;   /* A PHP-XSLT processor */
+
+   if (ZEND_NUM_ARGS() != 2 ||
+   zend_get_parameters_ex(2, processor_p, myobj) == FAILURE) {
+   WRONG_PARAM_COUNT;
+   }
+   /* make sure the second argument is an object */
+   if (Z_TYPE_PP(myobj) != IS_OBJECT) {
+   php_error(E_WARNING,arg 2 has wrong type);
+   RETURN_FALSE;
+   }
+
+   ZEND_FETCH_RESOURCE(handle, php_xslt *, processor_p, -1, le_xslt_name,
le_xslt);
+
+   handle-object = *myobj;
+
+   RETURN_TRUE;
+}
+/* }}} */
+
 /* {{{ proto void xslt_backend_version()
Returns the version number of Sablotron (if available) */
 PHP_FUNCTION(xslt_backend_version)
@@ -742,7 +771,7 @@
ZVAL_STRING(argv[1], (char *) scheme, 1);
ZVAL_STRING(argv[2], (char *) rest, 1);

-   xslt_call_function(scheme get all, XSLT_SCHEME(handle).get_all,
+   xslt_call_function(scheme get all, XSLT_SCHEME(handle).get_all,
handle-object,
   3, argv, retval);

/* Save the return value in the buffer (copying it) */
@@ -820,7 +849,7 @@
ZVAL_STRING(argv[2], (char *) rest, 1);

/* Call the function */
-   xslt_call_function(scheme open, XSLT_SCHEME(handle).open,
+   xslt_call_function(scheme open, XSLT_SCHEME(handle).open,
handle-object,
   3, argv, retval);

/* Return value is a resource pointer to an open file */
@@ -864,7 +893,7 @@
ZVAL_STRINGL(argv[2], buffer, *byte_count, 0);

/* Call the function */
-   xslt_call_function(scheme get, XSLT_SCHEME(handle).get,
+   xslt_call_function(scheme get

[PHP-DEV] [PATCH] ext/xslt - xslt_set_object

2002-10-03 Thread David Viner

Here's a short patch to the XSLT extension that allows a user to call
xslt_set_object($xh,$obj);
This works in a manner similar to the 'xml_set_object' function. (Only
difference is that the second argument is not passed by reference.)

dave


= BEGIN PATCH =
Index: ext/xslt/php_sablot.h
===
RCS file: /repository/php4/ext/xslt/php_sablot.h,v
retrieving revision 1.11
diff -B -b -u -r1.11 php_sablot.h
--- ext/xslt/php_sablot.h   22 Aug 2002 09:54:04 -  1.11
+++ ext/xslt/php_sablot.h   3 Oct 2002 17:57:27 -
 -62,6 +62,7 
 PHP_FUNCTION(xslt_error);
 PHP_FUNCTION(xslt_errno);
 PHP_FUNCTION(xslt_free);
+PHP_FUNCTION(xslt_set_object);
 PHP_FUNCTION(xslt_backend_version);
 PHP_FUNCTION(xslt_backend_name);

 -112,6 +114,7 
struct xslt_handlers  *handlers;
struct xslt_processor  processor;
struct xslt_error *err;
+   zval  *object;
 } php_xslt;

 #else
Index: ext/xslt/php_xslt.h
===
RCS file: /repository/php4/ext/xslt/php_xslt.h,v
retrieving revision 1.9
diff -B -b -u -r1.9 php_xslt.h
--- ext/xslt/php_xslt.h 28 Feb 2002 08:27:00 -  1.9
+++ ext/xslt/php_xslt.h 3 Oct 2002 17:57:27 -
 -51,7 +51,7 

 extern void xslt_assign_handler(struct xslt_function **, zval **);
 extern void xslt_free_handler(struct xslt_function *);
-extern void xslt_call_function(char *, zval *, int, zval **, zval **);
+extern void xslt_call_function(char *, zval *, zval *, int, zval **, zval
**);

 extern void xslt_debug(char *, char *, ...);

Index: ext/xslt/sablot.c
===
RCS file: /repository/php4/ext/xslt/sablot.c,v
retrieving revision 1.52
diff -B -b -u -r1.52 sablot.c
--- ext/xslt/sablot.c   22 Aug 2002 09:54:04 -  1.52
+++ ext/xslt/sablot.c   3 Oct 2002 17:57:27 -
 -87,6 +88,7 
PHP_FE(xslt_error,   NULL)
PHP_FE(xslt_errno,   NULL)
PHP_FE(xslt_free,NULL)
+   PHP_FE(xslt_set_object,  NULL)
PHP_FE(xslt_backend_version, NULL)
PHP_FE(xslt_backend_name,NULL)
{NULL, NULL, NULL}
 -182,6 +184,7 
handle   = ecalloc(1, sizeof(php_xslt));
handle-handlers = ecalloc(1, sizeof(struct xslt_handlers));
handle-err  = ecalloc(1, sizeof(struct xslt_error));
+   handle-object   = NULL;

XSLT_LOG(handle).path = NULL;

 -610,6 +613,32 
 }
 /* }}} */

+/* {{{ proto void xslt_set_object(resource parser, object obj)
+   sets the object in which to resolve callback functions */
+PHP_FUNCTION(xslt_set_object)
+{
+   zval  **processor_p;  /* Resource pointer to a PHP-XSLT processor */
+   zval  **myobj;/* The object that will handle the callback */
+   php_xslt   *handle;   /* A PHP-XSLT processor */
+
+   if (ZEND_NUM_ARGS() != 2 ||
+   zend_get_parameters_ex(2, processor_p, myobj) == FAILURE) {
+   WRONG_PARAM_COUNT;
+   }
+   /* make sure the second argument is an object */
+   if (Z_TYPE_PP(myobj) != IS_OBJECT) {
+   php_error(E_WARNING,arg 2 has wrong type);
+   RETURN_FALSE;
+   }
+
+   ZEND_FETCH_RESOURCE(handle, php_xslt *, processor_p, -1, le_xslt_name,
le_xslt);
+
+   handle-object = *myobj;
+
+   RETURN_TRUE;
+}
+/* }}} */
+
 /* {{{ proto void xslt_backend_version()
Returns the version number of Sablotron (if available) */
 PHP_FUNCTION(xslt_backend_version)
 -742,7 +771,7 
ZVAL_STRING(argv[1], (char *) scheme, 1);
ZVAL_STRING(argv[2], (char *) rest, 1);

-   xslt_call_function(scheme get all, XSLT_SCHEME(handle).get_all,
+   xslt_call_function(scheme get all, XSLT_SCHEME(handle).get_all,
handle-object,
   3, argv, retval);

/* Save the return value in the buffer (copying it) */
 -820,7 +849,7 
ZVAL_STRING(argv[2], (char *) rest, 1);

/* Call the function */
-   xslt_call_function(scheme open, XSLT_SCHEME(handle).open,
+   xslt_call_function(scheme open, XSLT_SCHEME(handle).open,
handle-object,
   3, argv, retval);

/* Return value is a resource pointer to an open file */
 -864,7 +893,7 
ZVAL_STRINGL(argv[2], buffer, *byte_count, 0);

/* Call the function */
-   xslt_call_function(scheme get, XSLT_SCHEME(handle).get,
+   xslt_call_function(scheme get, XSLT_SCHEME(handle).get, handle-object,
   3, argv, retval);

/* Returns the number of bytes read */
 -908,7 +937,7 
ZVAL_STRINGL(argv[2], (char *) buffer, *byte_count, 1);

/* Call the scheme put function already */
-   xslt_call_function(scheme put, XSLT_SCHEME(handle).put,
+   xslt_call_function(scheme put, 

RE: [PHP-DEV] [PATCH] ext/xslt - xslt_set_object

2002-10-03 Thread David Viner

resending as an attachment.

dave


-Original Message-
From: David Viner [mailto:[EMAIL PROTECTED]]
Sent: Thursday, October 03, 2002 11:00 AM
To: Php-Dev@lists. php. net
Subject: [PHP-DEV] [PATCH] ext/xslt - xslt_set_object


Here's a short patch to the XSLT extension that allows a user to call
xslt_set_object($xh,$obj);
This works in a manner similar to the 'xml_set_object' function. (Only
difference is that the second argument is not passed by reference.)

dave


= BEGIN PATCH =
Index: ext/xslt/php_sablot.h
===
RCS file: /repository/php4/ext/xslt/php_sablot.h,v
retrieving revision 1.11
diff -B -b -u -r1.11 php_sablot.h
--- ext/xslt/php_sablot.h   22 Aug 2002 09:54:04 -  1.11
+++ ext/xslt/php_sablot.h   3 Oct 2002 17:57:27 -
@@ -62,6 +62,7 @@
 PHP_FUNCTION(xslt_error);
 PHP_FUNCTION(xslt_errno);
 PHP_FUNCTION(xslt_free);
+PHP_FUNCTION(xslt_set_object);
 PHP_FUNCTION(xslt_backend_version);
 PHP_FUNCTION(xslt_backend_name);

@@ -112,6 +114,7 @@
struct xslt_handlers  *handlers;
struct xslt_processor  processor;
struct xslt_error *err;
+   zval  *object;
 } php_xslt;

 #else
Index: ext/xslt/php_xslt.h
===
RCS file: /repository/php4/ext/xslt/php_xslt.h,v
retrieving revision 1.9
diff -B -b -u -r1.9 php_xslt.h
--- ext/xslt/php_xslt.h 28 Feb 2002 08:27:00 -  1.9
+++ ext/xslt/php_xslt.h 3 Oct 2002 17:57:27 -
@@ -51,7 +51,7 @@

 extern void xslt_assign_handler(struct xslt_function **, zval **);
 extern void xslt_free_handler(struct xslt_function *);
-extern void xslt_call_function(char *, zval *, int, zval **, zval **);
+extern void xslt_call_function(char *, zval *, zval *, int, zval **, zval
**);

 extern void xslt_debug(char *, char *, ...);

Index: ext/xslt/sablot.c
===
RCS file: /repository/php4/ext/xslt/sablot.c,v
retrieving revision 1.52
diff -B -b -u -r1.52 sablot.c
--- ext/xslt/sablot.c   22 Aug 2002 09:54:04 -  1.52
+++ ext/xslt/sablot.c   3 Oct 2002 17:57:27 -
@@ -87,6 +88,7 @@
PHP_FE(xslt_error,   NULL)
PHP_FE(xslt_errno,   NULL)
PHP_FE(xslt_free,NULL)
+   PHP_FE(xslt_set_object,  NULL)
PHP_FE(xslt_backend_version, NULL)
PHP_FE(xslt_backend_name,NULL)
{NULL, NULL, NULL}
@@ -182,6 +184,7 @@
handle   = ecalloc(1, sizeof(php_xslt));
handle-handlers = ecalloc(1, sizeof(struct xslt_handlers));
handle-err  = ecalloc(1, sizeof(struct xslt_error));
+   handle-object   = NULL;

XSLT_LOG(handle).path = NULL;

@@ -610,6 +613,32 @@
 }
 /* }}} */

+/* {{{ proto void xslt_set_object(resource parser, object obj)
+   sets the object in which to resolve callback functions */
+PHP_FUNCTION(xslt_set_object)
+{
+   zval  **processor_p;  /* Resource pointer to a PHP-XSLT processor */
+   zval  **myobj;/* The object that will handle the callback */
+   php_xslt   *handle;   /* A PHP-XSLT processor */
+
+   if (ZEND_NUM_ARGS() != 2 ||
+   zend_get_parameters_ex(2, processor_p, myobj) == FAILURE) {
+   WRONG_PARAM_COUNT;
+   }
+   /* make sure the second argument is an object */
+   if (Z_TYPE_PP(myobj) != IS_OBJECT) {
+   php_error(E_WARNING,arg 2 has wrong type);
+   RETURN_FALSE;
+   }
+
+   ZEND_FETCH_RESOURCE(handle, php_xslt *, processor_p, -1, le_xslt_name,
le_xslt);
+
+   handle-object = *myobj;
+
+   RETURN_TRUE;
+}
+/* }}} */
+
 /* {{{ proto void xslt_backend_version()
Returns the version number of Sablotron (if available) */
 PHP_FUNCTION(xslt_backend_version)
@@ -742,7 +771,7 @@
ZVAL_STRING(argv[1], (char *) scheme, 1);
ZVAL_STRING(argv[2], (char *) rest, 1);

-   xslt_call_function(scheme get all, XSLT_SCHEME(handle).get_all,
+   xslt_call_function(scheme get all, XSLT_SCHEME(handle).get_all,
handle-object,
   3, argv, retval);

/* Save the return value in the buffer (copying it) */
@@ -820,7 +849,7 @@
ZVAL_STRING(argv[2], (char *) rest, 1);

/* Call the function */
-   xslt_call_function(scheme open, XSLT_SCHEME(handle).open,
+   xslt_call_function(scheme open, XSLT_SCHEME(handle).open,
handle-object,
   3, argv, retval);

/* Return value is a resource pointer to an open file */
@@ -864,7 +893,7 @@
ZVAL_STRINGL(argv[2], buffer, *byte_count, 0);

/* Call the function */
-   xslt_call_function(scheme get, XSLT_SCHEME(handle).get,
+   xslt_call_function(scheme get, XSLT_SCHEME(handle).get, handle-object,
   3, argv, retval);

/* Returns the number

[PHP-DEV] CVS Account Request: dviner

2002-09-27 Thread David Viner

Developing the PHP runtime, as per Rasmus' suggestion.

-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DEV] [PATCH] include statement in php.ini file

2002-09-27 Thread David Viner
) {
-   if (*php_ini_search_path) {
-   strcat(php_ini_search_path, paths_separator);
-   }
-   strcat(php_ini_search_path, .);
-   }
-#endif
-
-   /* Add binary directory */
-#ifdef PHP_WIN32
-   binary_location = (char *) emalloc(MAXPATHLEN);
-   if (GetModuleFileName(0, binary_location, MAXPATHLEN)==0) {
-   efree(binary_location);
-   binary_location = NULL;
-   }
-#else
-   if (sapi_module.executable_location) {
-   binary_location = estrdup(sapi_module.executable_location);
-   } else {
-   binary_location = NULL;
-   }
-#endif
-   if (binary_location) {
-   char *separator_location = strrchr(binary_location, 
DEFAULT_SLASH);
-
-   if (separator_location) {
-   *(separator_location+1) = 0;
-   }
-   if (*php_ini_search_path) {
-   strcat(php_ini_search_path, paths_separator);
-   }
-   strcat(php_ini_search_path, binary_location);
-   efree(binary_location);
-   }
-
-   /* Add environment location */
-   if (env_location[0]) {
-   if (*php_ini_search_path) {
-   strcat(php_ini_search_path, paths_separator);
-   }
-   strcat(php_ini_search_path, env_location);
-   }
-
-   /* Add default location */
-#ifdef PHP_WIN32
-   default_location = (char *) emalloc(MAXPATHLEN+1);
-
-   if (0  GetWindowsDirectory(default_location, MAXPATHLEN)) {
-   if (*php_ini_search_path) {
-   strcat(php_ini_search_path, paths_separator);
-   }
-   strcat(php_ini_search_path, default_location);
-   }
-   efree(default_location);
-#else
-   default_location = PHP_CONFIG_FILE_PATH;
-   if (*php_ini_search_path) {
-   strcat(php_ini_search_path, paths_separator);
-   }
-   strcat(php_ini_search_path, default_location);
-#endif
-   }
+   /* build the search path */
+   free_ini_search_path = php_prepare_ini_search_path(php_ini_search_path);

PG(safe_mode) = 0;
PG(open_basedir) = NULL;
@@ -333,7 +612,7 @@
struct stat statbuf;

if (!VCWD_STAT(sapi_module.php_ini_path_override, statbuf)) {
-   if (!((statbuf.st_mode  S_IFMT) == S_IFDIR)) {
+   if (S_ISDIR(statbuf.st_mode) == 0) {
fh.handle.fp = 
VCWD_FOPEN(sapi_module.php_ini_path_override, r);
fh.filename = sapi_module.php_ini_path_override;
}
= END PATCH ===

-Original Message-
From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]]
Sent: Friday, September 27, 2002 9:14 AM
To: Edin Kadribasic
Cc: David Viner; Php-Dev@lists. php. net
Subject: Re: [PHP-DEV] [PATCH] include statement in php.ini file


  I'm not very concerned either way on the .ini extension
 restriction.
  Let's go ahead and commit this with the include to
 additional_ini name
  change.  Perhaps the commit will stir up more feedback since there
 has
  been so little.

 Some feedback:

 +1 for additional_ini=/path/to/new/additional.ini
 -1 for including whole directories, since I think it has to great a
 WTF factor.

Without scanning a directory, you would have to automatically edit and
insert directives into files in order to add an extension automatically.
It is so much easier just to drop a single ext.ini file in a dedicated ini
dir and have it be read.  Scanning a file and trying to figure out where
to add stuff and making sure it isn't already there is a real PITA.  Like
the silly LoadModule stuff that apxs does.  You often end up with multiple
LoadModule lines for the same module.

-Rasmus



-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DEV] [PATCH] include statement in php.ini file

2002-09-27 Thread David Viner

This code is executed at the time when the php.ini file is parsed.  So this
happens the first time the php engine starts (i.e., for Apache, at the time
of apache parent startup).  The additional_ini capability has the same
security issues that the php.ini file itself has.  So I'm not sure there
are any new security concerns that surface because of this patch.

You mention the ini_set/ini_get functions.  There's also the
parse_ini_file extension function
(http://www.php.net/manual/en/function.parse-ini-file.php) which allows you
to parse your own ini files at runtime.  I think this function along with
ini_set are sufficient to handle run time ini files.

dave



-Original Message-
From: James Moore [mailto:[EMAIL PROTECTED]]
Sent: Friday, September 27, 2002 10:32 AM
To: 'Php-Dev@lists. php. net'
Cc: 'David Viner'; 'Rasmus Lerdorf'; 'Edin Kadribasic'
Subject: RE: [PHP-DEV] [PATCH] include statement in php.ini file



In general I agree with this proposal but I have some concerns, as I am
not familiar with the ini code these may be unfounded, introducing it
may well

1) Introduce Security Concerns depending on the time the ini file is
loaded (IF I have safe_mode = on then you include an ini file with
safe_mode = off what happens)

2) If people use this with out understanding when the ini file is
loaded. Php.ini is loaded before script execution/compilation
   this ini file would probably be loaded at compile or runtime so
settings like sort_tags = on and register_globals = on would not make
sense.

Therefore, if appropriate (IE my concerns are well founded) I suggest we
add two new ini directives to the php.ini file (allow.runtime.ini.files
(Which defaults to off due to the fact that someone may upgrade to Php
4.3.x or whenever this appears and not update their php.ini file leaving
their system vurlnerable to safe_mode among others being turned off at
runtime). At the same time we add the directive
disallow.directive.overwrite which is given a list of ini directives
which cannot be overwritten by runtime loading).

I realize there is ini_set and ini_get at the moment and these issues
may have already been dealt with, as I said I do not know quite what the
situation is with the ini code as I am unfamilar with it but I feel that
these things need to be thought about before the patch makes it into a
release (or at least rubished enough so that Im sure these concerns are
unfounded :).

Cheers,

- James

   I'm not very concerned either way on the .ini extension
  restriction.
   Let's go ahead and commit this with the include to
  additional_ini name
   change.  Perhaps the commit will stir up more feedback since there
  has
   been so little.
 
  Some feedback:
 
  +1 for additional_ini=/path/to/new/additional.ini
  -1 for including whole directories, since I think it has to great a
  WTF factor.

 Without scanning a directory, you would have to automatically
 edit and insert directives into files in order to add an
 extension automatically. It is so much easier just to drop a
 single ext.ini file in a dedicated ini dir and have it be
 read.  Scanning a file and trying to figure out where to add
 stuff and making sure it isn't already there is a real PITA.
 Like the silly LoadModule stuff that apxs does.  You often
 end up with multiple LoadModule lines for the same module.




-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DEV] [PATCH] include statement in php.ini file

2002-09-26 Thread David Viner

I thought about reading only *.ini files when directories were specified,
and the main reason I didn't implement that is simply because I thought the
PHP include functionality should behave like Apache's Include directive.
Apache's include doesn't worry about ~ files and .ORIG or .OLD or .bak
files, so why should PHP's?  That said, I am happy to rework the patch to
only include files that end in .ini if the group feels this is the
appropriate action of an include statement.  (Personally, I think if a user
puts garbage in a directory, then says include that directory, then c'est la
vie.)

If the term include is not a good keyword, I'm also happy to rework the
patch to use any keyword the group prefers.  additional_ini sounds good to
me, and probably doesn't carry the other control-structure baggage.


dave

-Original Message-
From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 26, 2002 5:17 AM
To: Zeev Suraski
Cc: David Viner; Php-Dev@lists. php. net
Subject: RE: [PHP-DEV] [PATCH] include statement in php.ini file


I suppose using a PHP keyword like include may lead to a desire for other
PHP keywords, perhaps something like:

additional_ini = /some/dir
additional_ini = /some/file.ini

Not sure why you want to limit it to one.  Also, they can be nested, so in
/some/dir/foo.ini you might have:

additional_ini = /some/dir/my_ext

My only concern about the full directory scanning and reading every file
is that there could be foo.ini~ created by editors or other such junk in
there.  So perhaps only read in .ini files, or maybe use the new glob code
to allow /some/dir/*.ini to specify.  Probably going a bit too far as
well.

-Rasmus


On Thu, 26 Sep 2002, Zeev Suraski wrote:

 I'm concerned that adding this directive will make lead to control
 structures requirements.  However, it is quite useful for modular
 deployment;  So, my suggestion is:

 - Don't introduce 'include'
 - Introduce a special 'additional_ini_directory' (name subject to change)
 which will be read after php.ini loads up.  Only one (at most) such
 directory, full path required.

 This gives you (as far as I can tell) the modular deployment features, but
 won't make people beg for 'if'.

 Thoughts?

 Zeev

 At 00:50 26/09/2002, Rasmus Lerdorf wrote:
 I don't see any obvious problems with this patch except for a couple of
 extrananeos changes. I was a bit indisposed last week and didn't really
 follow the discussion leading up to this, but I have read the archive.  I
 agree that going full out with PHP-parsed .ini files is going too far,
but
 being able to do a simple include of individual files or directories of
 files seems like a useful thing to me when building a modular PHP
 deployment system.
 
 -Rasmus
 
 
 --
 PHP Development Mailing List http://www.php.net/
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DEV] [PATCH] include statement in php.ini file

2002-09-24 Thread David Viner

Hi,
  I've been working with Brian France on a patch that will allow users to
include other ini files from the php.ini (see
http://marc.theaimsgroup.com/?t=10317976671r=1w=2 for earlier
discussions).  This patch allows the following functionality from the
php.ini file:

include = file
include = directory
include = /full/path/to/file
include = /full/path/to/directory

When a full path is not specified, it will look in the same directory which
were examined to find the php.ini file itself.  When a directory is
specified, it will process each file in the directory.  The files included
are process exactly as the php.ini file is. (The included ini files are
handled as ini files, not .php files.)

This is nearly identical to the Include capability of Apache's configuration
files.  For those interested in using an Include feature from within the
php.ini, please let me know if this is sufficient.

Thanks
Dave Viner




-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP-DEV] [PATCH] include statement in php.ini file

2002-09-24 Thread David Viner
 = NULL;
-   }
-#endif
-   if (binary_location) {
-   char *separator_location = strrchr(binary_location, 
DEFAULT_SLASH);
-
-   if (separator_location) {
-   *(separator_location+1) = 0;
-   }
-   if (*php_ini_search_path) {
-   strcat(php_ini_search_path, paths_separator);
-   }
-   strcat(php_ini_search_path, binary_location);
-   efree(binary_location);
-   }
-
-   /* Add environment location */
-   if (env_location[0]) {
-   if (*php_ini_search_path) {
-   strcat(php_ini_search_path, paths_separator);
-   }
-   strcat(php_ini_search_path, env_location);
-   }
-
-   /* Add default location */
-#ifdef PHP_WIN32
-   default_location = (char *) emalloc(MAXPATHLEN+1);
-
-   if (0  GetWindowsDirectory(default_location, MAXPATHLEN)) {
-   if (*php_ini_search_path) {
-   strcat(php_ini_search_path, paths_separator);
-   }
-   strcat(php_ini_search_path, default_location);
-   }
-   efree(default_location);
-#else
-   default_location = PHP_CONFIG_FILE_PATH;
-   if (*php_ini_search_path) {
-   strcat(php_ini_search_path, paths_separator);
-   }
-   strcat(php_ini_search_path, default_location);
-#endif
-   }
+   /* build the search path */
+   free_ini_search_path = php_prepare_ini_search_path(php_ini_search_path);

PG(safe_mode) = 0;
PG(open_basedir) = NULL;
@@ -333,7 +605,7 @@
struct stat statbuf;

if (!VCWD_STAT(sapi_module.php_ini_path_override, statbuf)) {
-   if (!((statbuf.st_mode  S_IFMT) == S_IFDIR)) {
+   if (S_ISDIR(statbuf.st_mode) == 0) {
fh.handle.fp = 
VCWD_FOPEN(sapi_module.php_ini_path_override, r);
fh.filename = sapi_module.php_ini_path_override;
}
== END PATCH ==

-Original Message-
From: David Viner [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 24, 2002 1:40 PM
To: Php-Dev@lists. php. net
Subject: [PHP-DEV] [PATCH] include statement in php.ini file


Hi,
  I've been working with Brian France on a patch that will allow users to
include other ini files from the php.ini (see
http://marc.theaimsgroup.com/?t=10317976671r=1w=2 for earlier
discussions).  This patch allows the following functionality from the
php.ini file:

include = file
include = directory
include = /full/path/to/file
include = /full/path/to/directory

When a full path is not specified, it will look in the same directory which
were examined to find the php.ini file itself.  When a directory is
specified, it will process each file in the directory.  The files included
are process exactly as the php.ini file is. (The included ini files are
handled as ini files, not .php files.)

This is nearly identical to the Include capability of Apache's configuration
files.  For those interested in using an Include feature from within the
php.ini, please let me know if this is sufficient.

Thanks
Dave Viner




-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DEV] compilation order platform dependent?

2002-09-23 Thread David Viner

Hi,
I noticed that when I build php from the CVS source on Windows, the Zend/
directory is always compiled before the main/ directory.  But on FreeBSD,
it's the other way around.  Is this intentional? or have I messed up my
build environment somehow?

thanks
dave


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DEV] compilation order platform dependent?

2002-09-23 Thread David Viner

not of the straight source... but a patch that i'm developing works on one
platform but not on the other (relies on a generated header file in Zend/).

dave

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 23, 2002 12:06 PM
To: David Viner
Cc: Php-Dev@lists. php. net
Subject: Re: [PHP-DEV] compilation order platform dependent?


On Mon, 23 Sep 2002, David Viner wrote:

 Hi,
   I noticed that when I build php from the CVS source on Windows, the Zend/
 directory is always compiled before the main/ directory.  But on FreeBSD,
 it's the other way around.  Is this intentional? or have I messed up my
 build environment somehow?

This is very normal. Do you have any problems compiling?

Derick

--

---
 Derick Rethans   http://derickrethans.nl/
 JDI Media Solutions
--[ if you hold a unix shell to your ear, do you hear the c? ]-



-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DEV] ini question

2002-09-20 Thread David Viner

Here is my modified php_init_handler from mod_php4.c

static void php_init_handler(server_rec *s, pool *p)
{
fprintf(stderr,mod_php4.c: php_init_handler: starting to run\n);
register_cleanup(p, NULL, (void (*)(void
*))apache_php_module_shutdown_wrapper, (void (*)(void
*))php_module_shutdown_for_exec);
if (!apache_php_initialized) {
apache_php_initialized = 1;
#ifdef ZTS
tsrm_startup(1, 1, 0, NULL);
#endif
sapi_startup(apache_sapi_module);
php_apache_startup(apache_sapi_module);
}
#if MODULE_MAGIC_NUMBER = 19980527
{
TSRMLS_FETCH();
if (PG(expose_php)) {
ap_add_version_component(PHP/ PHP_VERSION);
}
}
#endif
fprintf(stderr,mod_php4.c: php_init_handler: all completed\n);
}

Should this print to stderr every time the init_handler is called regardless
of the value of apache_php_initialized?  Is there some other function that
is called by apache for initialization?

dave


-Original Message-
From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 19, 2002 6:25 PM
To: David Viner
Cc: Php-Dev@lists. php. net
Subject: RE: [PHP-DEV] ini question


 I am sure that you are correct, Rasmus, and apache is calling it twice,
but
 what I don't understand is, why are the messages not identical?

Because we check for it?  Sorry, I didn't actually read through your code
examples, but I bet if you trace back you will find that the
apache_php_initialized check that we do is the cause of the different
output on the two calls.

-Rasmus



-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DEV] ini question

2002-09-20 Thread David Viner

thanks... i got this working properly.

dave

-Original Message-
From: David Viner [mailto:[EMAIL PROTECTED]]
Sent: Friday, September 20, 2002 9:05 AM
To: Php-Dev@lists. php. net
Subject: RE: [PHP-DEV] ini question


Here is my modified php_init_handler from mod_php4.c

static void php_init_handler(server_rec *s, pool *p)
{
fprintf(stderr,mod_php4.c: php_init_handler: starting to run\n);
register_cleanup(p, NULL, (void (*)(void
*))apache_php_module_shutdown_wrapper, (void (*)(void
*))php_module_shutdown_for_exec);
if (!apache_php_initialized) {
apache_php_initialized = 1;
#ifdef ZTS
tsrm_startup(1, 1, 0, NULL);
#endif
sapi_startup(apache_sapi_module);
php_apache_startup(apache_sapi_module);
}
#if MODULE_MAGIC_NUMBER = 19980527
{
TSRMLS_FETCH();
if (PG(expose_php)) {
ap_add_version_component(PHP/ PHP_VERSION);
}
}
#endif
fprintf(stderr,mod_php4.c: php_init_handler: all completed\n);
}

Should this print to stderr every time the init_handler is called regardless
of the value of apache_php_initialized?  Is there some other function that
is called by apache for initialization?

dave


-Original Message-
From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 19, 2002 6:25 PM
To: David Viner
Cc: Php-Dev@lists. php. net
Subject: RE: [PHP-DEV] ini question


 I am sure that you are correct, Rasmus, and apache is calling it twice,
but
 what I don't understand is, why are the messages not identical?

Because we check for it?  Sorry, I didn't actually read through your code
examples, but I bet if you trace back you will find that the
apache_php_initialized check that we do is the cause of the different
output on the two calls.

-Rasmus



--
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DEV] ini question

2002-09-19 Thread David Viner

After some further tweaking and fprintf-ing, it appears that the second
round of parser print-outs somehow do not rely upon the lexer in
zend_ini_scanner.l.  So I am completely unsure of what is going on.

Is there any documentation that I should read to help me understand this?
(I own and have examined the OReilly Writing Apache Modules book (in case
this was the child processes each parsing the ini file on their own) but to
no avail.)  Is there Zend documentation of the startup process?

dave


-Original Message-
From: David Viner [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 18, 2002 3:45 PM
To: Php-Dev@lists. php. net
Subject: [PHP-DEV] ini question


Hi,
I turned on DEBUG_CFG_PARSER in Zend/zend_ini_parser.y which has the parser
spit out each key-value pair it discovers.  I noticed when I start my
Apache, it actually spits everything out twice.  The first time I know comes
from php_module_startup (called from php_apache_startup which is the init
handler in sapi/apache/mod_php4.c).  What causes the parser to spit out all
the key-value pairs the second time?


dave


--
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DEV] ini question

2002-09-19 Thread David Viner

Sure.  When I set
#define DEBUG_CFG_PARSER 1
in zend_ini_parser.y, I see lots of:

'short_open_tag' = '1'
'asp_tags' = ''
...

output to stderr when PHP starts.  I believe that this is the bison parser
discovering statements from the php.ini file.

When I run the php from the command line, it outputs these statements just
once.  However, when I run php as an apache module, it outputs these
statements once, then it outputs

Apache/1.3.23 (Win32) PHP/4.3.0-dev running...

then it outputs all the statements again.  What I don't understand is why it
happens a second time.

thanks

dave


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 19, 2002 4:35 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: [PHP-DEV] ini question


Can you provide some context?

Devon

Original Message:
-
From: David Viner [EMAIL PROTECTED]
Date: Thu, 19 Sep 2002 16:16:18 -0700
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DEV] ini question


After some further tweaking and fprintf-ing, it appears that the second
round of parser print-outs somehow do not rely upon the lexer in
zend_ini_scanner.l.  So I am completely unsure of what is going on.

Is there any documentation that I should read to help me understand this?
(I own and have examined the OReilly Writing Apache Modules book (in case
this was the child processes each parsing the ini file on their own) but to
no avail.)  Is there Zend documentation of the startup process?

dave


-Original Message-
From: David Viner [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 18, 2002 3:45 PM
To: Php-Dev@lists. php. net
Subject: [PHP-DEV] ini question


Hi,
I turned on DEBUG_CFG_PARSER in Zend/zend_ini_parser.y which has the parser
spit out each key-value pair it discovers.  I noticed when I start my
Apache, it actually spits everything out twice.  The first time I know comes
from php_module_startup (called from php_apache_startup which is the init
handler in sapi/apache/mod_php4.c).  What causes the parser to spit out all
the key-value pairs the second time?


dave


--
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php



mail2web - Check your email from the web at
http://mail2web.com/ .




-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DEV] ini question

2002-09-19 Thread David Viner

I suspect that this is where my error is.  But I have added another fprintf
to the mod_php4.c file that prints a message when entering the
php_init_handler function and when it exits.  The php_init_handler function
is registered as the module_init callback which I believe is what Apache
calls when initializing the module.


Amazingly, it prints this: (I added the parentheses below to identify the
src file)

mod_php4.c: php_init_handler: starting to run
(zend_ini_scanner.l) lex returning 'startofphpini'
(zend_ini_scanner.l) lex returning 'hereami'
(zend_ini_parser.y) 'startofphpini' = 'hereami'
(zend_ini_scanner.l) lex returning 'engine'
(zend_ini_parser.y) 'engine' = '1'
(zend_ini_scanner.l) lex returning 'short_open_tag'
(zend_ini_parser.y) 'short_open_tag' = '1'
(zend_ini_scanner.l) lex returning 'asp_tags'
(zend_ini_parser.y) 'asp_tags' = ''
.. snipped ..

mod_php4.c: php_init_handler: all completed
mod_php4.c: php_init_handler: all completed
Apache/1.3.23 (Win32) PHP/4.3.0-dev running...
(zend_ini_parser.y) 'startofphpini' = 'hereami'
(zend_ini_parser.y) 'engine' = '1'
(zend_ini_parser.y) 'short_open_tag' = '1'
(zend_ini_parser.y) 'asp_tags' = ''
.. snipped ..


At the initial step, it is clear that the ini parser is called by
php_init_handler.  But why is the same php_ini_handler: starting to run
not printed the second time?  And, why does the parser no longer call the
lexer?

I am sure that you are correct, Rasmus, and apache is calling it twice, but
what I don't understand is, why are the messages not identical?

dave

-Original Message-
From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 19, 2002 5:21 PM
To: David Viner
Cc: Php-Dev@lists. php. net
Subject: RE: [PHP-DEV] ini question


Apache calls the module startup hook twice.

On Thu, 19 Sep 2002, David Viner wrote:

 After some further tweaking and fprintf-ing, it appears that the second
 round of parser print-outs somehow do not rely upon the lexer in
 zend_ini_scanner.l.  So I am completely unsure of what is going on.

 Is there any documentation that I should read to help me understand this?
 (I own and have examined the OReilly Writing Apache Modules book (in case
 this was the child processes each parsing the ini file on their own) but
to
 no avail.)  Is there Zend documentation of the startup process?

 dave


 -Original Message-
 From: David Viner [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, September 18, 2002 3:45 PM
 To: Php-Dev@lists. php. net
 Subject: [PHP-DEV] ini question


 Hi,
   I turned on DEBUG_CFG_PARSER in Zend/zend_ini_parser.y which has the
parser
 spit out each key-value pair it discovers.  I noticed when I start my
 Apache, it actually spits everything out twice.  The first time I know
comes
 from php_module_startup (called from php_apache_startup which is the init
 handler in sapi/apache/mod_php4.c).  What causes the parser to spit out
all
 the key-value pairs the second time?


 dave


 --
 PHP Development Mailing List http://www.php.net/
 To unsubscribe, visit: http://www.php.net/unsub.php



 --
 PHP Development Mailing List http://www.php.net/
 To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DEV] ini question

2002-09-18 Thread David Viner

Hi,
I turned on DEBUG_CFG_PARSER in Zend/zend_ini_parser.y which has the parser
spit out each key-value pair it discovers.  I noticed when I start my
Apache, it actually spits everything out twice.  The first time I know comes
from php_module_startup (called from php_apache_startup which is the init
handler in sapi/apache/mod_php4.c).  What causes the parser to spit out all
the key-value pairs the second time?


dave


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DEV] Re: [RFC] include_ini and include_ini_dir

2002-09-12 Thread David Viner

Hmm... in the apache world, the srm.conf and access.conf were deprecated,
but the Include directive in the configuration file is still maintained.
That is, by default, people use a single apache configuration file.
However, for specialized cases, like Brian's, people have the ability to use
multiple files if they want the extra work of multiple configuration files.

It seems to me that PHP could do something similar.  That is, by default,
there is a single php.ini file.  If some developer or company wants multiple
ini files for whatever reason, then we could have this Include directive.

I haven't looked at Brian's implementation, but I think this concept of
allowing 'included' config files is really powerful.  I mean, why not let
people who like multiple config files have them?  That doesn't mean that
everyone will use them, just people who want the extra headache/flexibility
of them.

dave


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 12, 2002 12:26 AM
To: Devon O'Dell
Cc: PHP Developers Mailing List
Subject: Re: [PHP-DEV] Re: [RFC] include_ini and include_ini_dir


On Thu, 12 Sep 2002, Devon O'Dell wrote:

 Not to be a troll, but weren't srm.conf and access.conf deprecated for a
 reason?

I think it was the reason that it made configuration less clear. Three
files for one thing isn't just 'right'.

Derick

---
 Did I help you?   http://www.derickrethans.nl/link.php?url=giftlist
 Frequent ranting: http://www.derickrethans.nl/
---
 PHP: Scripting the Web - [EMAIL PROTECTED]
All your branches are belong to me!
SRM: Script Running Machine - www.vl-srm.net
---



--
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DEV] Re: [RFC] include_ini and include_ini_dir

2002-09-12 Thread David Viner

So is it fair to say that we (Brian and others who are interested) should persue a 
robust patch that will allow for an Include directive in PHP's ini file that functions 
like Apache's Include directive?

dave


-Original Message-
From: Wez Furlong [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 12, 2002 10:34 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]; Matthew Walker
Subject: Re: [PHP-DEV] Re: [RFC] include_ini and include_ini_dir


On 09/12/02, [EMAIL PROTECTED] wrote:
 On Thu, 12 Sep 2002, Matthew Walker wrote:
  For what it's worth, here's my +1 on enabling a php-parsed .ini file.
  And to
  maintain backwards compatibility, if the file had no php tags in it, it
  could be parsed as per the old .ini method.
 
 I'm -1 on this complexity.
 
 Having an include is OK, but making it a PHP Script will make it very 
 complex, and it's also very hard to implement. Also, do we really need 
 that?

Likewise, I'm -1 on any kind of scripting in the .ini file.
I know it's nice to have clever features, but considering that there
are only a finite number of options and that in most cases these are set
only once for a particular build, I don't think we need it.

I can understand Brian's intended use for include (but think that they
could be OK without it), but there aren't really that many options or
situations where you might need such a degree of flexibility for a couple
of options.

Most of the options can be set within a PHP script anyway.

--Wez.



-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DEV] [PATCH] translate capitalized functions in create_stubs

2002-09-03 Thread David Viner

Hi
When we use prototype files for ext_skel, we noticed that a function name
with capital letters doesn't work properly since php extension must have
lowercase function names.  However, ext_skel doesn't warn or fix an
erroneous prototype file.  Here's a small patch to the create_stubs file
which will both warn users that a function name from the prototype file
contains capital letters, and it will lowercase the function name.
Out of curiosity, why ext_skel/create_stubs a shell/awk script? Were it
written in perl, Windows users could use it too.  Is there a design reason
for shell/awk or is it just historical?

dave



-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DEV] Re: [PATCH] translate capitalized functions in create_stubs

2002-09-03 Thread David Viner

inlining patch since my attachment seemed to fail...

dave

===

--- create_stubs.ORIG   Tue Sep  3 13:21:41 2002
+++ create_stubsTue Sep  3 13:33:01 2002
@@ -153,6 +153,13 @@
 
spec_str = spec_str \
 
+## php extension must use lower case function names.
+## this will translate any capitalized letter to lowercase
+## and warn the user
+   if (match(func_name,[A-Z]) != 0) {
+   printf(NOTICE: lower casing function name '%s'\n,func_name)
+   func_name = tolower(func_name)
+   }
funcs[num_funcs]   = func_name
types[num_funcs]   = func_type
maxargs[num_funcs] = args_max



-Original Message-
From: David Viner [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 03, 2002 1:43 PM
To: Php-Dev@lists. php. net
Subject: [PHP-DEV] [PATCH] translate capitalized functions in
create_stubs


Hi
When we use prototype files for ext_skel, we noticed that a function name
with capital letters doesn't work properly since php extension must have
lowercase function names.  However, ext_skel doesn't warn or fix an
erroneous prototype file.  Here's a small patch to the create_stubs file
which will both warn users that a function name from the prototype file
contains capital letters, and it will lowercase the function name.
Out of curiosity, why ext_skel/create_stubs a shell/awk script? Were it
written in perl, Windows users could use it too.  Is there a design reason
for shell/awk or is it just historical?

dave



-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DEV] new webdav patch

2002-08-21 Thread David Viner

I think allowing php users to process webdav methods in user-space is an
awesome idea.  One question I have, why are the MKCOL, DELETE, and UNLOCK
methods not listed?  according to RFC 2518
(http://ftp.ics.uci.edu/pub/ietf/webdav/protocol/rfc2518.txt), DAV clients
are required to support them.

Also, would you be interested in including the extensions to DAV defined by
DeltaV?  This would add the following methods: VERSION-CONTROL, REPORT,
CHECKIN, CHECKOUT, UNCHECKOUT, MKWORKSPACE, UPDATE, LABEL, MERGE,
BASELINE-CONTROL, MKACTIVITY.

I'm not terribly familiar w/ the DeltaV stuff, but it seems that if php is
getting the ability to handle dav request, why not include this extension.
You can read more about deltav at
http://www.webdav.org/deltav/protocol/rfc3253.html


thanks
dave


-Original Message-
From: Christian Stocker [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 20, 2002 1:46 PM
To: Rasmus Lerdorf
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DEV] new webdav patch


On Tue, 20 Aug 2002, Rasmus Lerdorf wrote:

  On Tue, 20 Aug 2002, Rasmus Lerdorf wrote:
 
   It is getting there.  You are checking for POST under webdav_methods
when
   POST is already allowed by default, so it is a redundant strcmp().
 
  oops. that one slipped through and was certainly not intended to be
there
  :)
 
   Anybody else here have an issue with adding this configue option which
   will allows webdav methods through to be handled in user space?
 
  Just to avoid missunderstandings: It's not a ./configure option, but a
  php.ini/.htaccess option, which is turned off by default.

 Sorry, right, I should have been more explicit.

 Do you have karma to commit this?  If nobody screams, I suggest you commit
 it.

No, I don't have karma for the whole php4 tree. Someone else has to commit
it or if noone wants to be blamed later, someone has to give me karma :)

christian


--
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DEV] [PATCH] ZEND_* instead of PHP_*

2002-08-02 Thread David Viner

The CODING_STANDARDS document recommends the use of the ZEND_* macros
instead of the PHP_* ones (point 7). Use ZEND_* macros instead of PHP_*
macros.  This patch makes the CODING_STANDARDS, README.EXT_SKEL, and
skeleton directory use the ZEND_FE and ZEND_FUNCTION in place of the PHP_
counterparts.  This should encourage developers of new extension modules to
use the ZEND_ macros in place of the PHP_ ones.

dave

== PATCH inlined here ==
diff -ruNbB ../php-4.2.2.ORIG/CODING_STANDARDS ./CODING_STANDARDS
--- ../php-4.2.2.ORIG/CODING_STANDARDS  Wed Feb 27 22:31:09 2002
+++ ./CODING_STANDARDS  Fri Aug  2 09:56:42 2002
 -68,7 +68,7 
 --

 [1] Function names for user-level functions should be enclosed with in
-the PHP_FUNCTION() macro. They should be in lowercase, with words
+the ZEND_FUNCTION() macro. They should be in lowercase, with words
 underscore delimited, with care taken to minimize the letter count.
 Abbreviations should not be used when they greatly decrease the
 readability of the function name itself.
 -169,7 +169,7 

 /* {{{ proto int abs(int number)
Returns the absolute value of the number */
-PHP_FUNCTION(abs)
+ZEND_FUNCTION(abs)
 {
...
 }
diff -ruNbB ../php-4.2.2.ORIG/README.EXT_SKEL ./README.EXT_SKEL
--- ../php-4.2.2.ORIG/README.EXT_SKEL   Wed Aug  1 22:49:23 2001
+++ ./README.EXT_SKEL   Fri Aug  2 09:57:37 2002
 -148,7 +148,7 

 /* {{{ proto bool my_drawtext(resource image, string text, resource font,
int x, int y[, int color])
 */
-PHP_FUNCTION(my_drawtext)
+ZEND_FUNCTION(my_drawtext)
 {
zval **image, **text, **font, **x, **y, **color;
int argc;
diff -ruNbB ../php-4.2.2.ORIG/ext/skeleton/create_stubs
./ext/skeleton/create_stubs
--- ../php-4.2.2.ORIG/ext/skeleton/create_stubs Tue Dec 18 03:16:53 2001
+++ ./ext/skeleton/create_stubs Fri Aug  2 09:50:58 2002
 -226,7 +226,7 
convert(i, j, 1)
}

-   proto = proto closeopts )\nfcomments[i]  */\nPHP_FUNCTION(
funcs[i] )\n{
+   proto = proto closeopts )\nfcomments[i]  */\nZEND_FUNCTION(
funcs[i] )\n{
if (maxargs[i]0) {
fetchargs = fetchargs ) == FAILURE) closefetch  
\n\t\treturn;\n
}
 -254,11 +254,11 
print }\n/* }}} */\n  stubfile

if (stubs) {
-   h_stubs = h_stubs PHP_FUNCTION( funcs[i] );\n
-   c_stubs = c_stubs \tPHP_FE( funcs[i] ,\tNULL)\n
+   h_stubs = h_stubs ZEND_FUNCTION( funcs[i] );\n
+   c_stubs = c_stubs \tZEND_FE( funcs[i] ,\tNULL)\n
} else {
-   print PHP_FUNCTION( funcs[i] );  extname 
/function_declarations
-   print \tPHP_FE( funcs[i] ,\tNULL)  extname 
/function_entries
+   print ZEND_FUNCTION( funcs[i] );  extname 
+/function_declarations
+   print \tZEND_FE( funcs[i] ,\tNULL)  extname 
+/function_entries
}

if (xml) print xmlstr  xmldoc
diff -ruNbB ../php-4.2.2.ORIG/ext/skeleton/php_skeleton.h
./ext/skeleton/php_skeleton.h
--- ../php-4.2.2.ORIG/ext/skeleton/php_skeleton.h   Wed Aug  8 21:47:47 2001
+++ ./ext/skeleton/php_skeleton.h   Fri Aug  2 09:51:44 2002
 -22,7 +22,7 
 PHP_RSHUTDOWN_FUNCTION(extname);
 PHP_MINFO_FUNCTION(extname);

-PHP_FUNCTION(confirm_extname_compiled);/* For testing, remove later. */
+ZEND_FUNCTION(confirm_extname_compiled);   /* For testing, remove
later. */
 /* __function_declarations_here__ */

 /*
diff -ruNbB ../php-4.2.2.ORIG/ext/skeleton/skeleton.c
./ext/skeleton/skeleton.c
--- ../php-4.2.2.ORIG/ext/skeleton/skeleton.c   Sat Dec  1 16:59:44 2001
+++ ./ext/skeleton/skeleton.c   Fri Aug  2 09:54:28 2002
 -21,7 +21,7 
  * Every user visible function must have an entry in extname_functions[].
  */
 function_entry extname_functions[] = {
-   PHP_FE(confirm_extname_compiled,NULL)   /* For testing, remove 
later. */
+   ZEND_FE(confirm_extname_compiled,   NULL)   /* For testing, remove 
+later. */
/* __function_entries_here__ */
{NULL, NULL, NULL}  /* Must be the last line in extname_functions[] */
 };
 -135,7 +135,7 
 /* Every user-visible function in PHP should document itself in the source
*/
 /* {{{ proto string confirm_extname_compiled(string arg)
Return a string to confirm that the module is compiled in */
-PHP_FUNCTION(confirm_extname_compiled)
+ZEND_FUNCTION(confirm_extname_compiled)
 {
char *arg = NULL;
int arg_len, len;


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DEV] [PATCH] ext_skel: specify location of skeleton directory

2002-07-29 Thread David Viner

here's a patch that modifies ext_skel to accept a full path to the skeleton
directory.  This allows you to run the ext_skel script from any directory.

dave





-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP-DEV] [PATCH] ext_skel: specify location of skeleton directory

2002-07-29 Thread David Viner

inlining the patch...

dave


--- ext/ext_skelTue Jan  8 09:51:08 2002
+++ ext/ext_skelMon Jul 29 09:27:40 2002
@@ -7,12 +7,13 @@

 usage() {
 echo $0 --extname=module [--proto=file] [--stubs=file] [--xml[=file]]
-echo[--full-xml] [--no-help]
+echo[--skel=dir] [--full-xml] [--no-help]
 echo 
 echo   --extname=module   module is the name of your extension
 echo   --proto=file   file contains prototypes of functions to create
 echo   --stubs=file   generate only function stubs in file
 echo   --xml  generate xml documentation to be added to
phpdoc-cvs
+echo   --skel=dir path to the skeleton directory
 echo   --full-xml generate xml documentation for a self-contained
extension
 echo  (not yet implemented)
 echo   --no-help  don't try to be nice and create comments in the
code
@@ -33,7 +34,7 @@
   case $1 in
 --extname=?*)
extname=$optarg
-   EXTNAME=`echo $extname | tr [a-z] [A-Z]`
+   EXTNAME=`echo $extname | tr [:lower:] [:upper:]`
;;
 --proto=?*)
proto=$optarg
@@ -54,6 +55,9 @@
 --no-help)
no_help=yes
;;
+--skel=?*)
+   skel_dir=$optarg
+   ;;
 *)
usage
;;
@@ -65,8 +69,14 @@
   givup Directory $extname already exists.
 fi

-test -f ext_skel || givup ext_skel must be in the current directory
-test -d skeleton || givup subdirectory skeleton does not exist or is not
directory
+if test -z $skel_dir; then
+  skel_dir=skeleton
+fi
+
+## convert skel_dir to full path
+skel_dir=`cd $skel_dir  pwd`
+
+test -d $skel_dir || givup directory $skel_dir does not exist or is not
directory

 if echo '\c' | grep -s c /dev/null 21
 then
@@ -84,7 +94,7 @@
 fi

 if test -n $proto; then
-  cat $proto | awk -v extname=$extname -v stubs=$stubs -v
stubfile=$stubfile -v xml=$xml -v full_xml=$full_xml -v
i_know_what_to_do_shut_up_i_dont_need_your_help_mode=$no_help -f
./skeleton/create_stubs
+  cat $proto | awk -v extname=$extname -v stubs=$stubs -v
stubfile=$stubfile -v xml=$xml -v full_xml=$full_xml -v
i_know_what_to_do_shut_up_i_dont_need_your_help_mode=$no_help -f
$skel_dir/create_stubs
 fi

 if test -z $stubs; then
@@ -202,7 +212,7 @@
 echo '/^[[:space:]]*\/\*/,/^[[:space:]]*\*\//D'  sedscript
 fi

-sed -f sedscript ../skeleton/skeleton.c  $extname.c
+sed -f sedscript  $skel_dir/skeleton.c  $extname.c


 $ECHO_N  php_$extname.h$ECHO_C
@@ -220,26 +230,26 @@
 echo 's/^\/\*.*\*\/$//'  sedscript
 echo '/^[[:space:]]*\/\*/,/^[[:space:]]*\*\//D'  sedscript
 fi
-sed -f sedscript ../skeleton/php_skeleton.h  php_$extname.h
+sed -f sedscript $skel_dir/php_skeleton.h  php_$extname.h

 $ECHO_N  CREDITS$ECHO_C
 echo s/extname/$extname/g  sedscript
-sed -f sedscript ../skeleton/CREDITS  CREDITS
+sed -f sedscript $skel_dir/CREDITS  CREDITS

 $ECHO_N  EXPERIMENTAL$ECHO_C
 echo s/extname/$extname/g  sedscript
-sed -f sedscript ../skeleton/EXPERIMENTAL  EXPERIMENTAL
+sed -f sedscript $skel_dir/EXPERIMENTAL  EXPERIMENTAL

 $ECHO_N  tests/001.phpt$ECHO_C
 mkdir tests || givup Cannot create tests directory
 chmod 755 tests
-sed -f sedscript ../skeleton/tests/001.phpt  tests/001.phpt
+sed -f sedscript $skel_dir/tests/001.phpt  tests/001.phpt

 if test -z $stubs  test -z $no_help; then
   $ECHO_N  $extname.php$ECHO_C
   sed \
 -e s/extname/$extname/g \
-../skeleton/skeleton.php \
+$skel_dir/skeleton.php \
  $extname.php
 fi



-Original Message-
From: David Viner [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 29, 2002 9:32 AM
To: Php-Dev@lists. php. net
Subject: [PHP-DEV] [PATCH] ext_skel: specify location of skeleton
directory


here's a patch that modifies ext_skel to accept a full path to the skeleton
directory.  This allows you to run the ext_skel script from any directory.

dave





-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DEV] beginner question: how to execute unix command in PHP

2002-07-23 Thread David Viner

i think you want the php-general list.  this list is for developing PHP
itself, not developing in PHP.

dave


-Original Message-
From: Paul Oh [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 23, 2002 3:52 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DEV] beginner question: how to execute unix command in PHP


Hi, I'm just starting to learn PHP.  I couldn't find how to exec unix
command and read the result.  Basically, I just want to execute ls -lrt
and read and display the output.

This may be very simple question, but for some reason, I couldn't find any
info on executing unix command from PHP.

Thanks.

-Paul



--
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DEV] patch for ext_skel

2002-07-15 Thread David Viner

here's a patch for ext_skel that allows you to run ext_skel from any
directory.  Essentially, this just allows the user to specify the location
of the skeleton subdirectory.

I'm a relative newbie to this mailing list, so if this is the wrong place,
please let me know which php mailing list is the correct one.

thanks

dave



-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP-DEV] patch for ext_skel

2002-07-15 Thread David Viner

hmm.. the patch didn't seem to come thru...
here it is...

--- ext_skel.ORIG   Mon Jul 15 08:58:08 2002
+++ ext_skelMon Jul 15 10:42:30 2002
@@ -6,13 +6,14 @@
 }

 usage() {
-echo $0 --extname=module [--proto=file] [--stubs=file] [--xml[=file]]
+echo $0 --extname=module [--proto=file] [--stubs=file] [--xml[=file]]
[--skel=dir]
 echo[--full-xml] [--no-help]
 echo 
 echo   --extname=module   module is the name of your extension
 echo   --proto=file   file contains prototypes of functions to create
 echo   --stubs=file   generate only function stubs in file
 echo   --xml  generate xml documentation to be added to
phpdoc-cvs
+echo   --skel=dir path to the skeleton directory
 echo   --full-xml generate xml documentation for a self-contained
extension
 echo  (not yet implemented)
 echo   --no-help  don't try to be nice and create comments in the
code
@@ -33,7 +34,7 @@
   case $1 in
 --extname=?*)
extname=$optarg
-   EXTNAME=`echo $extname | tr [a-z] [A-Z]`
+   EXTNAME=`echo $extname | tr [:lower:] [:upper:]`
;;
 --proto=?*)
proto=$optarg
@@ -54,6 +55,9 @@
 --no-help)
no_help=yes
;;
+--skel=?*)
+   skel_dir=$optarg
+;;
 *)
usage
;;
@@ -65,8 +69,16 @@
   givup Directory $extname already exists.
 fi

-test -f ext_skel || givup ext_skel must be in the current directory
-test -d skeleton || givup subdirectory skeleton does not exist or is not
directory
+if test -z $skel_dir; then
+  skel_dir=skeleton
+fi
+
+test -d $skel_dir || givup $skel_dir must exist
+## convert skel_dir to full path
+skel_dir=`cd $skel_dir  pwd`
+
+##test -f ext_skel || givup ext_skel must be in the current directory
+test -d $skel_dir || givup subdirectory $skel_dir does not exist or is not
directory

 if echo '\c' | grep -s c /dev/null 21
 then
@@ -84,7 +96,7 @@
 fi

 if test -n $proto; then
-  cat $proto | awk -v extname=$extname -v stubs=$stubs -v
stubfile=$stubfile -v xml=$xml -v full_xml=$full_xml -v
i_know_what_to_do_shut_up_i_dont_need_your_help_mode=$no_help -f
./skeleton/create_stubs
+  cat $proto | awk -v extname=$extname -v stubs=$stubs -v
stubfile=$stubfile -v xml=$xml -v full_xml=$full_xml -v
i_know_what_to_do_shut_up_i_dont_need_your_help_mode=$no_help -f
$skel_dir/create_stubs
 fi

 if test -z $stubs; then
@@ -202,7 +214,7 @@
 echo '/^[[:space:]]*\/\*/,/^[[:space:]]*\*\//D'  sedscript
 fi

-sed -f sedscript ../skeleton/skeleton.c  $extname.c
+sed -f sedscript  $skel_dir/skeleton.c  $extname.c


 $ECHO_N  php_$extname.h$ECHO_C
@@ -220,26 +232,26 @@
 echo 's/^\/\*.*\*\/$//'  sedscript
 echo '/^[[:space:]]*\/\*/,/^[[:space:]]*\*\//D'  sedscript
 fi
-sed -f sedscript ../skeleton/php_skeleton.h  php_$extname.h
+sed -f sedscript $skel_dir/php_skeleton.h  php_$extname.h

 $ECHO_N  CREDITS$ECHO_C
 echo s/extname/$extname/g  sedscript
-sed -f sedscript ../skeleton/CREDITS  CREDITS
+sed -f sedscript $skel_dir/CREDITS  CREDITS

 $ECHO_N  EXPERIMENTAL$ECHO_C
 echo s/extname/$extname/g  sedscript
-sed -f sedscript ../skeleton/EXPERIMENTAL  EXPERIMENTAL
+sed -f sedscript $skel_dir/EXPERIMENTAL  EXPERIMENTAL

 $ECHO_N  tests/001.phpt$ECHO_C
 mkdir tests || givup Cannot create tests directory
 chmod 755 tests
-sed -f sedscript ../skeleton/tests/001.phpt  tests/001.phpt
+sed -f sedscript $skel_dir/tests/001.phpt  tests/001.phpt

 if test -z $stubs  test -z $no_help; then
   $ECHO_N  $extname.php$ECHO_C
   sed \
 -e s/extname/$extname/g \
-../skeleton/skeleton.php \
+$skel_dir/skeleton.php \
  $extname.php
 fi


-Original Message-
From: David Viner [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 15, 2002 10:48 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DEV] patch for ext_skel


here's a patch for ext_skel that allows you to run ext_skel from any
directory.  Essentially, this just allows the user to specify the location
of the skeleton subdirectory.

I'm a relative newbie to this mailing list, so if this is the wrong place,
please let me know which php mailing list is the correct one.

thanks

dave



-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php