[PHP-DEV] Re: Session Oddness

2002-03-13 Thread Matt Allen

I might be reading it wrong, and feel free to creect me if i am but:

does the code read:

If 
a cookie was sent 
then 
setup SID
else if a cookie wasnt sent
dont setup SID
end if

if (send_cookie) {
smart_str var = {0}; smart_str_appends(var, PS(session_name));
smart_str_appendc(var, '=');
smart_str_appends(var, PS(id));
smart_str_0(var);
REGISTER_STRING_CONSTANT(SID, var.c, 0);
} else {
REGISTER_STRING_CONSTANT(SID, empty_string, 0);
}

surely this is back to front? shouldnt SID be defined when a cookie ISNT
sent ?


Matt


On Wed, 2002-03-13 at 20:24, Sascha Schumann wrote:
 The current CVS behaviour is the correct and documented one.
 
 - Sascha Experience IRCG
   http://schumann.cx/http://schumann.cx/ircg
 
-- 
Matt Allen
Technical Director
Investigation Marketplace
0413 777 771
[EMAIL PROTECTED]


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




[PHP-DEV] Re: Session Oddness

2002-03-13 Thread Matt Allen

Ok then, no problems.

The thing is, last night in stalled the latest snap and SID was not
being popuulated, even though session cookies were DEFINATLY off,
accoring to a phpinfo anyway.

very strange.

Thanks,
Matt

On Wed, 2002-03-13 at 23:52, Sascha Schumann wrote:
 On 13 Mar 2002, Matt Allen wrote:
 
  I might be reading it wrong, and feel free to creect me if i am but:
 
 Yes, you are reading it wrong.
 
  does the code read:
 
 Note the tempus of the variable send_cookie.
 
 - Sascha Experience IRCG
   http://schumann.cx/http://schumann.cx/ircg
 
-- 
Matt Allen
Technical Director
Investigation Marketplace
0413 777 771
[EMAIL PROTECTED]


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




[PHP-DEV] Session Oddness

2002-03-12 Thread Matt Allen

Guys,

Somebody hsa done something screwy with sessions, ther WEREN'T defining SID
when a cookie wasnt set. heres a diff:

--- php4-200203120300/ext/session/session.c Wed Mar 13 02:51:51 2002
+++ tmp/php4-200203120300/ext/session/session.c Sat Mar  9 11:33:29 2002
 -940,14 +940,7 
smart_str_0(var);
REGISTER_STRING_CONSTANT(SID, var.c, 0);
} else {
-smart_str var = {0};
-
-smart_str_appends(var, PS(session_name));
-smart_str_appendc(var, '=');
-smart_str_appends(var, PS(id));
-smart_str_0(var);
-REGISTER_STRING_CONSTANT(SID, var.c, 0);
-   /* REGISTER_STRING_CONSTANT(SID, empty_string, 0); */
+   REGISTER_STRING_CONSTANT(SID, empty_string, 0);
}

PS(session_status) = php_session_active;

it had me scratchin my head for a while

Matt


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




[PHP-DEV] [PATCH] More error handling changes

2001-07-25 Thread Matt Allen

Hi All,

To carry on from the XMLRPC Error patch, here is another one that makes
PHP bork on parse errors as well as others from an INI directive called
break_on_parse.

The reason for this is if xmlrpc_errors is on, and PHP throws 2 errors,
2 xmlrpc error packets will be returned, making certain xmlrpc clients
(rightfully) spew becasue they have recieved 2 xmlrpc fault packets (xml
documents).

Cheerio,
Matta
-- 
Matt Allen
Technical Director
Investigation Marketplace
0413 777 771
[EMAIL PROTECTED]


Index: main.c
===
RCS file: /repository/php4/main/main.c,v
retrieving revision 1.383
diff -u -r1.383 main.c
--- main.c  23 Jul 2001 14:05:26 -  1.383
+++ main.c  25 Jul 2001 10:24:24 -
@@ -202,6 +202,7 @@
STD_PHP_INI_BOOLEAN(enable_dl,1,
PHP_INI_SYSTEM, OnUpdateBool,   enable_dl, 
 
php_core_globals,   core_globals)
STD_PHP_INI_BOOLEAN(expose_php,   1,
PHP_INI_SYSTEM, OnUpdateBool,   expose_php,
 
php_core_globals,   core_globals)
STD_PHP_INI_BOOLEAN(html_errors,  1,
PHP_INI_SYSTEM, OnUpdateBool,   html_errors,   
 
php_core_globals,   core_globals)
+   STD_PHP_INI_BOOLEAN(break_on_parse,   0,
+PHP_INI_SYSTEM, OnUpdateBool,   break_on_parse,   
+  php_core_globals,   core_globals)
STD_PHP_INI_BOOLEAN(xmlrpc_errors,0,
PHP_INI_SYSTEM, OnUpdateBool,   xmlrpc_errors, 
 php_core_globals,   core_globals)
STD_PHP_INI_ENTRY(xmlrpc_error_number,0,PHP_INI_ALL,   
 OnUpdateInt,xmlrpc_error_number,php_core_globals, 
  core_globals)
STD_PHP_INI_BOOLEAN(ignore_user_abort,0,PHP_INI_ALL,   
 OnUpdateBool,   ignore_user_abort,  
php_core_globals,   core_globals)
@@ -277,7 +278,7 @@
time_t error_time;
PLS_FETCH();
 
-   /* Try to use the specified logging location. */
+   
if (PG(error_log) != NULL) {
 #ifdef HAVE_SYSLOG_H
if (!strcmp(PG(error_log), syslog)) {
@@ -451,7 +452,6 @@
}
/* no break - intentionally */
case E_ERROR:
-   /*case E_PARSE: the parser would return 1 (failure), we can bail out 
nicely */
case E_COMPILE_ERROR:
case E_USER_ERROR:
if (module_initialized) {
@@ -459,6 +459,13 @@
return;
}
break;
+   case E_PARSE:
+   if (PG(break_on_parse)) {
+   if (module_initialized) {
+   zend_bailout();
+   return;
+   }
+   }
}
 
/* Log if necessary */
Index: php_globals.h
===
RCS file: /repository/php4/main/php_globals.h,v
retrieving revision 1.68
diff -u -r1.68 php_globals.h
--- php_globals.h   17 Jul 2001 16:46:07 -  1.68
+++ php_globals.h   25 Jul 2001 10:24:25 -
@@ -127,7 +127,7 @@
zend_bool xmlrpc_errors;
 
long xmlrpc_error_number;
-
+   zend_bool break_on_parse;
 
zend_bool modules_activated;
 



-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


[PHP-DEV] [PEAR-PATCH] XMLRPC Pear Patch

2001-07-21 Thread Matt Allen

Hi All,

Attached is a small patch tp pear/XML/RPC.php.

It fixes 2 things:
1. There was a print statement left in the client class
2. xml_rpc_encode had new XML_RPC_VAL instead of new XML_RPC_VALUE.

Cheerio,
Matta
-- 
Matt Allen
Technical Director
Investigation Marketplace
0413 777 771
[EMAIL PROTECTED]


Index: RPC.php
===
RCS file: /repository/php4/pear/XML/RPC.php,v
retrieving revision 1.10
diff -u -r1.10 RPC.php
--- RPC.php 13 Jul 2001 17:45:43 -  1.10
+++ RPC.php 22 Jul 2001 01:52:47 -
@@ -509,7 +509,7 @@
 strlen($msg-payload) . \r\n\r\n .
 $msg-payload;
 
-print($op);
+//print($op);
 
 if (!fputs($fp, $op, strlen($op))) {
 $this-errstr=Write error;
@@ -1092,7 +1092,7 @@
global $XML_RPC_Struct;
 
$type = gettype($php_val);
-   $XML_RPC_val = new XML_RPC_val;
+   $XML_RPC_val = new XML_RPC_value;
 
switch($type) {
   case array:



-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


[PHP-DEV] XMLRPC Error Returns Patch

2001-07-06 Thread Matt Allen

Hi All,

Attached is a patch that does the following:

- Allows *all* PHP Errors to be returned as a Valid XMLRPC Fault Packet (ie including 
parse errors).
- Allows the user to turn these errors on and off in php.ini
- Allows the user to set the faultCode (in the XMLRPC packet) via php.ini

Why is this important?

When using XMLRPC, anything at all that gets returned from the server needs to be a 
valid XMLRPC packet, either a Fault or a proper payload, if PHP dies with any sort of 
error or warning the XMLRPC client dies becasue it cant grok the returned payload.  
This limits PHP ever being used as an XMLRPC server.  With these patches the user can 
set the faultCode that gets returned to the client, so if im making an XMLRPC server 
that anyone can build a client that will access it I can make a statement like If you 
get a faulCode of 666, then something broke on the server, bail out nicely and let me 
know.

I was originally thinking that maybe we should write a generice Errorhandler, ie let 
it be set in the php.ini, the reason for this is with more and more web services 
coming out (XMLRPC,SOAP, etc) each one will need a specific error format.  This might 
be something that could be discussed, but XMLRPC has been around the longest and alot 
of these other protocols are based on it, so here it is :)

I didnt change the php.ini-dist as I didnt know the protocol, ie, since most people 
wont want this feature do we leave it out?

Cheers,
Matta 
-- 
Matt Allen
Technical Director
Investigation Marketplace
0413 777 771
[EMAIL PROTECTED]


Index: main/main.c
===
RCS file: /repository/php4/main/main.c,v
retrieving revision 1.371
diff -r1.371 main.c
204a205,206
   STD_PHP_INI_BOOLEAN(xmlrpc_errors,0,
PHP_INI_SYSTEM, OnUpdateBool,  xmlrpc_errors, 
  php_core_globals,   core_globals)
   STD_PHP_INI_ENTRY(xmlrpc_error_number,   NULL,PHP_INI_ALL,   
 OnUpdateString,xmlrpc_error_number, 
php_core_globals,   core_globals)
397c399
   char *error_format;
---
   char error_format[1024];
399,401c401,411
   error_format = PG(html_errors) ?
   br\nb%s/b:  %s in b%s/b on line 
b%d/bbr\n
   : \n%s: %s in %s on line %d\n;
---
 if (PG(html_errors)) {
   strcpy(error_format , br\nb%s/b: %s in b%s/b oni line 
b%d/bbr\n);
 } else if (PG(xmlrpc_errors)) {
   snprintf(error_format, 1023 , ?xml
 
version=\1.0\?methodResponsefaultvaluestructmembernamefaultCode/namevalueint%d/int/value/membermembernamefaultString/namevaluestring%%s:%%s
 in %%s on line
 
%%d/string/value/member/struct/value/fault/methodResponse,PG(xmlrpc_error_number));
 } else {
 strcpy (error_format , \n%s: %s in %s on line
 %d\n);
 }
Index: main/php_globals.h
===
RCS file: /repository/php4/main/php_globals.h,v
retrieving revision 1.63
diff -r1.63 php_globals.h
125a126,129
   zend_bool xmlrpc_errors;
 
   short xmlrpc_error_number;
 



-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]