[PHP-DEV] Variable name?

2002-03-01 Thread Walter A. Boring IV

Howdy,
  I was thinking about tweaking the var_dump/print_r functions to
provide the name of the variable being dumped.  Is there a way to look 
that up?  from the active_symbol_table-- ?

Thanks
Walt



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




[PHP-DEV] segfaulting apache

2002-03-07 Thread Walter A. Boring IV

Howdy,
  I'm having an issue running the latest (as of 5pm today) version of
php from CVS.  Apache seems to be bailing on me.

Here is my configure

./configure \
--with-apxs=/usr/local/apache/bin/apxs \
--with-mysql=/usr \
--with-oci8=/u01/app/oracle/product/8.1.7 \
--enable-sigchild \
--with-mcrypt=/usr/local \
--with-gd=/usr \
--with-png-dir=/usr \
--with-jpeg-dir=/usr \
--with-zlib-dir=/usr \
--enable-sysvsem \
--enable-sysvshm \
--enable-trackvars \
--with-xml \
--with-zlib \
--disable-debug


Here is the gdb trace
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1024 (LWP 32039)]
0x40126fe6 in free () from /lib/libc.so.6
(gdb) bt
#0  0x40126fe6 in free () from /lib/libc.so.6
#1  0x40126f44 in free () from /lib/libc.so.6
#2  0x402b4e07 in free_zend_constant (c=0x83dea00)
at /home/waboring/devel/php4/Zend/zend_constants.c:34
#3  0x402c3083 in zend_hash_del_key_or_index (ht=0x8102d18,
arKey=0x83de9f0 "prev_ip2", nKeyLength=9, h=3381757664, flag=0)
at /home/waboring/devel/php4/Zend/zend_hash.c:512
#4  0x402c368d in zend_hash_reverse_apply (ht=0x8102d18,
apply_func=0x402b4eb0 )
at /home/waboring/devel/php4/Zend/zend_hash.c:743
#5  0x402b524c in clean_non_persistent_constants ()
at /home/waboring/devel/php4/Zend/zend_constants.c:166
#6  0x402b5a8f in shutdown_executor ()
at /home/waboring/devel/php4/Zend/zend_execute_API.c:199
#7  0x402be73d in zend_deactivate ()
at /home/waboring/devel/php4/Zend/zend.c:596
#8  0x4029d34e in php_request_shutdown (dummy=0x0)
at /home/waboring/devel/php4/main/main.c:783
#9  0x402d125c in apache_php_module_main (r=0x813e71c,
display_source_mode=0)
at /home/waboring/devel/php4/sapi/apache/sapi_apache.c:96
#10 0x402d1d72 in send_php (r=0x813e71c, display_source_mode=0,
filename=0x0)
at /home/waboring/devel/php4/sapi/apache/mod_php4.c:575
#11 0x402d1dd3 in send_parsed_php (r=0x813e71c)
at /home/waboring/devel/php4/sapi/apache/mod_php4.c:590
#12 0x080742e7 in ap_invoke_handler (r=0x813e71c) at http_config.c:517
#13 0x0808993b in process_request_internal (r=0x813e71c) at
http_request.c:1308
#14 0x08089d77 in ap_internal_redirect (new_uri=0x813e6dc
"/fo/home/index.php",
r=0x813da6c) at http_request.c:1436
#15 0x08060780 in handle_dir (r=0x813da6c) at mod_dir.c:174
#16 0x080742e7 in ap_invoke_handler (r=0x813da6c) at http_config.c:517
#17 0x0808993b in process_request_internal (r=0x813da6c) at
http_request.c:1308
#18 0x080899b0 in ap_process_request (r=0x813da6c) at
http_request.c:1324
#19 0x080807e2 in child_main (child_num_arg=0) at http_main.c:4565
#20 0x08080a57 in make_child (s=0x80dac44, slot=0, now=1015539081)
at http_main.c:4724
#21 0x08080b08 in startup_children (number_to_start=1) at
http_main.c:4751
#22 0x080811b0 in standalone_main (argc=1, argv=0xb9d4) at
http_main.c:5056
#23 0x08081a1f in main (argc=1, argv=0xb9d4) at http_main.c:5401
#24 0x400c25b0 in __libc_start_main () from /lib/libc.so.6

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




Re: [PHP-DEV] OCIError patch

2002-03-12 Thread Walter A. Boring IV

Ahh.  very kewl patch Dan.

Walt

On Tue, 2002-03-12 at 12:48, Daniel Ceregatti wrote:
> Hi,
> 
> I wrote a small patch to oci8.c's OCIError function which places the 
> following tag:
> 
> 
> 
> just before an error in a sql statement and adds the modified statement 
> text into a new element called "sqltext" to the array returned by 
> OCIError, much the same way sqlplus adds an asterisk under an error.
> 
> I find this very useful, and I'm hoping you will too. I've attached the 
> patch.
> 
> Thanks,
> 
> Daniel Ceregatti
> 
> 

> --- php-4.1.2/ext/oci8/oci8.c.origTue Mar 12 11:56:17 2002
> +++ php-4.1.2/ext/oci8/oci8.c Tue Mar 12 12:23:35 2002
> @@ -4090,10 +4090,13 @@
>   zval **arg;
>   oci_statement *statement;
>   oci_connection *connection;
> -text errbuf[512];
> -sb4 errcode = 0;
> + text errbuf[512];
> + sb4 errcode = 0;
>   sword error = 0;
>   dvoid *errh = NULL;
> + ub2 errorofs = 0;
> + text *sqltext;
> + char *retsql;
>  
>   if (zend_get_parameters_ex(1, &arg) == SUCCESS) {
>   statement = (oci_statement *) zend_fetch_resource(arg TSRMLS_CC, -1, 
>NULL, NULL, 1, le_stmt);
> @@ -4130,10 +4133,33 @@
>   (ub4) sizeof(errbuf),
>   (ub4) OCI_HTYPE_ERROR));
>  
> + CALL_OCI_RETURN(statement->error, OCIAttrGet(
> + (dvoid *)statement->pStmt,
> + OCI_HTYPE_STMT,
> + (text *) &sqltext,
> + (ub4 *)0,
> + OCI_ATTR_STATEMENT,
> + statement->pError));
> +
> + CALL_OCI_RETURN(statement->error, OCIAttrGet(
> + (dvoid *)statement->pStmt,
> + OCI_HTYPE_STMT,
> + (ub2 *)&errorofs,
> + (ub4 *)0,
> + OCI_ATTR_PARSE_ERROR_OFFSET,
> + statement->pError));
> +
>   if (errcode) {
> + retsql = (char *) malloc (strlen (sqltext) + 100);
> + memset (retsql, 0, strlen (sqltext) + 100);
> + strncat (retsql, sqltext, (int) errorofs);
> + strcat (retsql, "font-weight:bold\">");
> + strcat (retsql, (char *) sqltext + (int) errorofs);
>   array_init(return_value);
>   add_assoc_long(return_value, "code", errcode);
> + add_assoc_string(return_value, "sqltext", (char *) retsql, 1);
>   add_assoc_string(return_value, "message", (char*) errbuf, 1);
> + free (retsql);
>   } else {
>   RETURN_FALSE;
>   }
> 
> 
> 

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


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




Re: FW: [PHP-DEV] OCIError patch

2002-03-12 Thread Walter A. Boring IV

I like the idea of having the sqltext in the return array, as well as
the offset.  This is a very usefull tool for debugging oracle sql
queries.  I believe its something that OCIError has been lacking.
Anyone that uses Oracle along with sqlplus, you get the * under the 
broken portion of the query. I find it very usefull.  
  If there is a general rule of not putting html inside return values
for php internal functions, thats fine.  But I still want an easy way of
showing this type of info, without having to create my own wrapper
function call to OCIError, just so I can highlight the broken portion of
the query.

my $0.02
Walt

On Tue, 2002-03-12 at 15:08, Daniel Ceregatti wrote:
> Yes. An example of what would be in the array returned by OCIError would be:
> 
> // Given the code below...
> 
> $conn = OCILogon (bla bla bla);
> 
> $sql = "select t.foo, t.bar from table t where t.id = 1";
> 
> $stmt = OCIParse ($conn, $sql);
> 
> OCIExecute ($stmt, OCI_DEFAULT);
> 
> $error = OCIError ($stmt);
> 
> // What follows are the values of the elements of the array returned by 
> OCIError (presuming "bar" is an invalid column it the table):
> 
> $error["code"] = 904
> $error["message"] = "ORA-00904: invalid column name"
> $error["sqltext"] = "select t.foo, t.*bar from table t where t.id = 1"
> $error["offset"] = 16
> 
> The PHP user then has the option of using either the "sqltext" element 
> directly, or using the "offset" element and the $sql variable to create 
> any output they see fit. I think this allows for the greatest 
> felxibility, IMHO.
> 
> Daniel
> 
> Markus Fischer wrote:
> 
> >On Tue, Mar 12, 2002 at 02:26:24PM -0800, Daniel Ceregatti wrote : 
> >
> >>How about doing what sqlplus does and simply add an asterisk at that 
> >>point? I'm ok with rolling my own inside of the script by using the 
> >>offset element. I simply think it'll do PHP users a service to have the 
> >>"sqltext" in the array in _some_ form, even if only with an asterisk.
> >>
> >
> >Asterisk at what point? Specified by offset?
> >
> 


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




[PHP-DEV] today's current cvs won't build

2002-03-14 Thread Walter A. Boring IV

Howdy,
  I'm trying to build the latest (just did a cvs up -dP) php from cvs
and I can't seem to build it.  configure seems to work just fine,
and most of the make works.


Linux Mandrake 8.1 box.


./configure \
--with-apxs=/usr/local/apache/bin/apxs \
--with-mysql=/usr \
--with-oci8=/u01/app/oracle/product/8.1.7 \
--enable-sigchild \
--with-mcrypt=/usr/local \
--with-gd=/usr \
--with-png-dir=/usr \
--with-jpeg-dir=/usr \
--with-zlib-dir=/usr \
--enable-trackvars \
--with-xml \
--with-zlib \
--with-mm=/usr/local \
--disable-debug



main/internal_functions_cli.lo: In function
`php_startup_internal_extensions':
/home/waboring/devel/php4/main/internal_functions_cli.c:67: undefined
reference to `posix_module_entry'
/home/waboring/devel/php4/main/internal_functions_cli.c:68: undefined
reference to `overload_module_entry'
/home/waboring/devel/php4/main/internal_functions_cli.c:68: undefined
reference to `oci8_module_entry'
/home/waboring/devel/php4/main/internal_functions_cli.c:68: undefined
reference to `mcrypt_module_entry'
/home/waboring/devel/php4/main/internal_functions_cli.c:69: undefined
reference to `gd_module_entry'
/home/waboring/devel/php4/main/internal_functions_cli.c:69: undefined
reference to `ctype_module_entry'
/home/waboring/devel/php4/main/internal_functions_cli.c:69: undefined
reference to `php_zlib_module_entry'
collect2: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1

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




Re: [PHP-DEV] today's current cvs won't build

2002-03-14 Thread Walter A. Boring IV

I got it to work now.  I had an up to date php4 and Zend dir.
I just hadn't done a cvsclean and buildconf after I updated.

Walt

On Thu, 2002-03-14 at 12:44, [EMAIL PROTECTED] wrote:
> Hello,
> 
> update your Zend directory too, that should fix it.
> 
> Derick
> 
> On 14 Mar 2002, Walter A. Boring IV wrote:
> 
> > Howdy,
> >   I'm trying to build the latest (just did a cvs up -dP) php from cvs
> > and I can't seem to build it.  configure seems to work just fine,
> > and most of the make works.
> > 
> > 
> > Linux Mandrake 8.1 box.
> > 
> > 
> > ./configure \
> > --with-apxs=/usr/local/apache/bin/apxs \
> > --with-mysql=/usr \
> > --with-oci8=/u01/app/oracle/product/8.1.7 \
> > --enable-sigchild \
> > --with-mcrypt=/usr/local \
> > --with-gd=/usr \
> > --with-png-dir=/usr \
> > --with-jpeg-dir=/usr \
> > --with-zlib-dir=/usr \
> > --enable-trackvars \
> > --with-xml \
> > --with-zlib \
> > --with-mm=/usr/local \
> > --disable-debug
> > 
> > 
> > 
> > main/internal_functions_cli.lo: In function
> > `php_startup_internal_extensions':
> > /home/waboring/devel/php4/main/internal_functions_cli.c:67: undefined
> > reference to `posix_module_entry'
> > /home/waboring/devel/php4/main/internal_functions_cli.c:68: undefined
> > reference to `overload_module_entry'
> > /home/waboring/devel/php4/main/internal_functions_cli.c:68: undefined
> > reference to `oci8_module_entry'
> > /home/waboring/devel/php4/main/internal_functions_cli.c:68: undefined
> > reference to `mcrypt_module_entry'
> > /home/waboring/devel/php4/main/internal_functions_cli.c:69: undefined
> > reference to `gd_module_entry'
> > /home/waboring/devel/php4/main/internal_functions_cli.c:69: undefined
> > reference to `ctype_module_entry'
> > /home/waboring/devel/php4/main/internal_functions_cli.c:69: undefined
> > reference to `php_zlib_module_entry'
> > collect2: ld returned 1 exit status
> > make: *** [sapi/cli/php] Error 1
> > 
> > -- 
> > PHP Development Mailing List <http://www.php.net/>
> > To unsubscribe, visit: http://www.php.net/unsub.php
> > 
> 
> ---
>   PHP: Scripting the Web - [EMAIL PROTECTED]
> All your branches are belong to me!
> SRM: Site Resource Manager - www.vl-srm.net
> ---


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




[PHP-DEV] make install

2002-03-14 Thread Walter A. Boring IV

Howdy,
  I'm sure this is a known issue, but I thought I'd throw it out there.
It seems that if you do a make install w/o doing a make, it doesn't
work.  I guess make install doesn't do a dependency check?

Walt



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




[PHP-DEV] Session Patch

2002-03-19 Thread Walter A. Boring IV

Howdy,
  I have created a patch against the latest CVS to add a couple new
functions to the session extension.  They enable some new features that
would be useful for folks building Applications with PHP.  I currently
need the abilities that these functions enable.  By default 
These new functions are off, since they wouldn't be wanted by most ISP's
which run virtual hosted sites on 1 box.  

The patch provides:
 configure option "--enable-app-session", which turns on the new
functions.

session_get_list() : function which returns an array of
active  
session ids.
session_get_data() : function which returns the session data array of a 
 particular session id.
session_destroy_id() : destroys a particular session.

This is my first stab at a patch, so I'm sure there are things which I
have missed.


Walt




? foo.patch
Index: config.m4
===
RCS file: /repository/php4/ext/session/config.m4,v
retrieving revision 1.17
diff -u -r1.17 config.m4
--- config.m4	7 Mar 2002 14:19:36 -	1.17
+++ config.m4	19 Mar 2002 18:42:47 -
@@ -8,6 +8,16 @@
 PHP_ARG_WITH(mm,for mm support,
 [  --with-mm[=DIR] Include mm support for session storage])
 
+AC_ARG_ENABLE(app-session,
+[  --enable-app-session  Enable Application Session functions.  Access to all sessions.],[
+  PHP_APP_SESSION=$enableval
+],[
+  PHP_APP_SESSION=no
+])
+
+AC_MSG_CHECKING(whether to enable application session access functions)
+AC_MSG_RESULT($PHP_APP_SESSION)
+
 if test "$PHP_MM" != "no"; then
   for i in /usr/local /usr $PHP_MM; do
 if test -f "$i/include/mm.h"; then
@@ -23,6 +33,11 @@
   PHP_ADD_INCLUDE($MM_DIR/include)
   AC_DEFINE(HAVE_LIBMM, 1, [Whether you have libmm])
   PHP_MODULE_PTR(phpext_ps_mm_ptr)
+fi
+
+if test "$PHP_APP_SESSION" = "yes"; then
+  AC_DEFINE(APP_SESSON, 1, [Activate application sessions functions])
+  CFLAGS="$CFLAGS -DAPP_SESSION"
 fi
 
 if test "$PHP_SESSION" != "no"; then
Index: mod_files.c
===
RCS file: /repository/php4/ext/session/mod_files.c,v
retrieving revision 1.72
diff -u -r1.72 mod_files.c
--- mod_files.c	6 Mar 2002 11:49:51 -	1.72
+++ mod_files.c	19 Mar 2002 18:42:48 -
@@ -210,6 +210,49 @@
 	return (nrdels);
 }
 
+#ifdef APP_SESSION
+static int ps_files_get_session_list(const char *dirname, zval *list) {
+
+DIR *dir;
+char dentry[sizeof(struct dirent) + MAXPATHLEN];
+	struct dirent *entry = (struct dirent *) &dentry;
+	//struct stat sbuf;
+	char buf[MAXPATHLEN];
+char id[MAXPATHLEN];
+	time_t now;
+	//int nrdels = 0;
+	size_t dirname_len;
+	TSRMLS_FETCH();
+
+dir = opendir(dirname);
+	if (!dir) {
+		php_error(E_NOTICE, "ps_files_get_session_list: opendir(%s) failed: %s (%d)\n", dirname, strerror(errno), errno);
+		return 0;
+	}
+time(&now);
+
+dirname_len = strlen(dirname);
+
+	/* Prepare buffer (dirname never changes) */
+	memcpy(buf, dirname, dirname_len);
+	buf[dirname_len] = PHP_DIR_SEPARATOR;
+
+	while (php_readdir_r(dir, (struct dirent *) dentry, &entry) == 0 && entry) {
+		/* does the file start with our prefix? */
+		if (!strncmp(entry->d_name, FILE_PREFIX, sizeof(FILE_PREFIX) - 1)) {
+/* We found a session file here */
+/* lets extract the session id */
+memset(id, 0, sizeof(id) );
+strcpy(id, entry->d_name+5);
+add_next_index_string( list, id, 1);
+		}
+	}
+
+closedir(dir);
+return 1;
+}
+#endif
+
 #define PS_FILES_DATA ps_files *data = PS_GET_MOD_DATA()
 
 PS_OPEN_FUNC(files)
@@ -338,6 +381,22 @@
 	
 	return SUCCESS;
 }
+
+#ifdef APP_SESSION
+PS_GET_LIST_FUNC(files)
+{
+int ret=0;
+PS_FILES_DATA;
+
+if (ps_files_get_session_list( data->basedir, *list )) {
+return SUCCESS;
+} else {
+return FAILURE;
+}
+
+return SUCCESS;
+}
+#endif
 
 /*
  * Local variables:
Index: mod_mm.c
===
RCS file: /repository/php4/ext/session/mod_mm.c,v
retrieving revision 1.38
diff -u -r1.38 mod_mm.c
--- mod_mm.c	6 Mar 2002 12:25:01 -	1.38
+++ mod_mm.c	19 Mar 2002 18:42:48 -
@@ -247,6 +247,26 @@
 	free(data);
 }
 
+#ifdef APP_SESSION
+static int ps_mm_get_session_list(ps_mm *data, zval *list) {
+
+ps_sd **ohash, **ehash;
+	ps_sd *sd, *next;
+
+ehash = data->hash + data->hash_max + 1;
+for (ohash = data->hash; ohash < ehash; ohash++)
+for (sd = *ohash; sd; sd = next) {
+next = sd->next;
+if (sd->ctime) {
+//we assume since ctime isn't
+add_next_index_string( list, sd->key, 1);
+}
+		}
+	
+return 1;
+}
+#endif
+
 PHP_MINIT_FUNCTION(ps_mm)
 {
 	int save_path_len = strlen(PS(save_path));
@@ -422,6 +442,27 @@
 	
 	return SUCCESS;
 }
+
+#ifdef APP_SESSION
+PS_GET_LIST_FUNC(mm)
+{
+PS_MM_DATA;
+ps_sd *sd;
+int ret=0;
+
+mm_lock(data->mm

Re: [PHP-DEV] Session Patch

2002-03-20 Thread Walter A. Boring IV


> > The patch provides:
> >  configure option "--enable-app-session", which turns on the new
> > functions.
> > 
> > session_get_list() : function which returns an array of
> > active  
> > session ids.
> > session_get_data() : function which returns the session data array of a 
> >  particular session id.
> > session_destroy_id() : destroys a particular session.
> 
> 
> What's the purpose of this, what's the difference to msession?

First of all, these functions are new functions that extend the standard
session support functionality.  So these allow folks who are using
libmm, files, user save handlers to get application session support.
Second, you don't have to install another library and daemon just to get
application session support.  I have no idea what kind of state the
Phoenix project is in, but I don't want to have to install it just to
get something that could come for free w/ PHP's built in session
support.

  I think I can prolly merge session_destroy_id() in with
session_destroy().

Walt



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




[PHP-DEV] W3C html validation issue

2002-07-22 Thread Walter A. Boring IV

Howdy,
  This may be a tad off topic, but it is related to how php deals with
building the $_GET superglobal w/ query string vars.  

According to the W3C HTML validator, it is illegal to build a query
string for a url such as 

foo.php?bar=1&myvar=2
 

They say you HAVE to use
foo.php?bar=1&myvar=2
 

in php's case it builds 
$_GET["bar"] = 1;
$_GET["amp;myvar"] = 2;

I don't know of ANYONE on the planet that builds query string vars in
this way. Unless you do, your html pages will not validate through the
W3C validator.

The official W3c spec explanation is at
http://www.htmlhelp.com/tools/validator/problems.html#amp


I think changing this could potentially break many sites.  
Does anyone know what other web languages do with &myvar=2 ?
I think the W3C validator is broken/wrong in this respect, and wanted to
know what other folks think about it.  


Walt



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