Re: [PHP-DEV] mbstring and 4.3.0

2002-11-07 Thread Marcus Boerger
To make php be easier usable in non US-ASCII (127chars) environments
especially those requiring UCS-2, UTF-8 or other any character mapping
other than iso-8859-1 or -15 we should more likly try to integrate mbstring
fully in php. As long as we cannot or want not make it a core component
such as ext/standard we should enable it by default.

And it do not see why it is dangerous or why it should harm any test?
All hose mbstring settings affecting the tests are no set in such a way
that activating mbstring cannot harm AND mbstring is deply tested for
its own. When currently any test is affected by mbstring this should be
reported so we can adjust test settings!

marcus

At 16:04 07.11.2002, Andrei Zmievski wrote:

At the PHP Conference in Germany several of us have discussed the
current state of mbstring and there was a proposal to not have it
enabled by default for 4.3.0 release. It seems that the extension
attempts to do magic stuff by overloading functions in the executor
globals and, as Thies said, that could be dangerous. Also, doesn't it
affect run-tests.php script currently?

Comments are welcome.

-Andrei   http://www.gravitonic.com/
* We are not a clone. *

--
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] dba and db extensions

2002-11-06 Thread Marcus Boerger
Hi Markus,

The main difference left between dba and db is that dba does not do any
locking. We could easily add this by copying the necessary parts from the
db extension. However we would need to change the resource type to also
keep the lock information. Otherwise a crashed php or one that does not
store the dba_open result would leave the lockfile locked.

However i tested this with the flatfile support and it did not work this way. I
had to keep the lock file open until the dba_close() call. But when keeping
the file open it worked as expected and even multiple reades, read during
write and killing of the writer process worked as expected.

marcus


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




Re: [PHP-DEV] PHP CLI environment variables

2002-11-06 Thread Marcus Boerger
Does ini setting variables_order include E?

At 13:30 06.11.2002, Kjartan Mannes wrote:

I just tried using php-cli from the latest cvs and am a little confused
by the placement of shell environment variables. $_ENV is empty, but the
values are stored in $HTTP_SERVER_VARS and $_SERVER.

Is this the proper behavior?

--
Kjartan [EMAIL PROTECTED] (http://natrak.net/)
:: Women are made to be loved, not understood. - Oscar Wilde


--
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] empty variables_order, was PHP CLI environment variables

2002-11-06 Thread Marcus Boerger
When ini setting variables_order is empty there are memory leaks in
cgi as well as cli version. See below:

marcus

[marcus@zaphod marcus]$ echo ?php var_dump($_ENV);? | 
/usr/src/php4-ZE1/sapi/cgi/php-cgi
/home/marcus/-(1) : Warning - Wrong parameter count for var_dump()
Status: 200
Content-type: text/html
X-Powered-By: PHP/4.3.0-dev

/usr/src/php4-ZE1/Zend/zend_hash.c(262) :  Freeing 0x084409C0 (40 bytes), 
script=-
Last leak repeated 40 times
/usr/src/php4-ZE1/main/main.c(1434) :  Freeing 0x08440928 (12 bytes), script=-
/usr/src/php4-ZE1/Zend/zend_hash.c(178) :  Freeing 0x084408D8 (32 bytes), 
script=-
/usr/src/php4-ZE1/main/main.c(1387) :  Freeing 0x08440878 (44 bytes), script=-
/usr/src/php4-ZE1/Zend/zend_API.c(565) : Actual location (location was relayed)
/usr/src/php4-ZE1/main/main.c(1386) :  Freeing 0x08440838 (12 bytes), script=-
/usr/src/php4-ZE1/main/php_variables.c(175) :  Freeing 0x08440798 (12 
bytes), script=-
Last leak repeated 38 times
/usr/src/php4-ZE1/ext/standard/string.c(2485) :  Freeing 0x08440408 (1 
bytes), script=-
Last leak repeated 38 times
/usr/src/php4-ZE1/Zend/zend_hash.c(440) :  Freeing 0x08440278 (256 bytes), 
script=-
/usr/src/php4-ZE1/main/main.c(1214) :  Freeing 0x0843E3B8 (44 bytes), script=-
/usr/src/php4-ZE1/Zend/zend_API.c(565) : Actual location (location was relayed)
/usr/src/php4-ZE1/main/main.c(1213) :  Freeing 0x0843E378 (12 bytes), script=-

At 13:30 06.11.2002, Kjartan Mannes wrote:
I just tried using php-cli from the latest cvs and am a little confused
by the placement of shell environment variables. $_ENV is empty, but the
values are stored in $HTTP_SERVER_VARS and $_SERVER.

Is this the proper behavior?

--
Kjartan [EMAIL PROTECTED] (http://natrak.net/)
:: Women are made to be loved, not understood. - Oscar Wilde


--
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] empty variables_order, was PHP CLI environment variables

2002-11-06 Thread Marcus Boerger
Interesting, i have $_ENV when variables_order is empty in ini using cli. But i
still do get memory leaks. However i do get the expected result when i use
-d option for the call.

I also tested all the possible version to get this failed.

[marcuszaphod php4-HEAD]$ php -d variables_order=\\ -r 'var_dump($_ENV);'
array(0) {
}
[marcuszaphod php4-HEAD]$ php -d variables_order=\\ -r 'var_dump(void);'
Command line code(1) : Notice - Use of undefined constant void - assumed 'void'
string(4) void
[marcuszaphod php4-HEAD]$ php -d variables_order=\\ -r 'var_dump(null);'
NULL
[marcuszaphod php4-HEAD]$ php -d variables_order=\\ -r 'var_dump($x);'
Command line code(1) : Notice - Undefined variable:  x
NULL
[marcuszaphod php4-HEAD]$ php -d variables_order=\\ -r 'var_dump();'
Command line code(1) : Warning - Wrong parameter count for var_dump()
[marcuszaphod php4-HEAD]$ php -d variables_order= -r 'var_dump($_ENV);'
array(39) {
  [PWD]=
 ()
}
/usr/src/php4-HEAD/main/main.c(1434) :  Freeing 0x4093CB34 (16 bytes), script=-
Last leak repeated 1 time
/usr/src/php4-HEAD/Zend/zend_hash.c(260) :  Freeing 0x40939C7C (40 bytes), 
script=-
Last leak repeated 45 times
/usr/src/php4-HEAD/Zend/zend_hash.c(404) :  Freeing 0x40939AC8 (35 bytes), 
script=-
/usr/src/php4-HEAD/main/main.c(1397) :  Freeing 0x40939A8C (2 bytes), script=-
/usr/src/php4-HEAD/main/main.c(1394) :  Freeing 0x40939A48 (16 bytes), script=-
/usr/src/php4-HEAD/Zend/zend_API.c(575) :  Freeing 0x409399F4 (32 bytes), 
script=-
/usr/src/php4-HEAD/Zend/zend_hash.c(175) : Actual location (location was 
relayed)
/usr/src/php4-HEAD/main/main.c(1387) :  Freeing 0x40939990 (44 bytes), script=-
/usr/src/php4-HEAD/Zend/zend_API.c(573) : Actual location (location was 
relayed)
/usr/src/php4-HEAD/main/main.c(1386) :  Freeing 0x4093994C (16 bytes), script=-
/usr/src/php4-HEAD/main/php_variables.c(175) :  Freeing 0x4093989C (16 
bytes), script=-
Last leak repeated 43 times
/usr/src/php4-HEAD/ext/standard/string.c(2492) :  Freeing 0x40939860 (1 
bytes), script=-
Last leak repeated 43 times
/usr/src/php4-HEAD/Zend/zend_hash.c(438) :  Freeing 0x40938E88 (256 bytes), 
script=-
/usr/src/php4-HEAD/Zend/zend_hash.c(175) : Actual location (location was 
relayed)
/usr/src/php4-HEAD/main/main.c(1214) :  Freeing 0x40936D0C (44 bytes), script=-
/usr/src/php4-HEAD/Zend/zend_API.c(573) : Actual location (location was 
relayed)
/usr/src/php4-HEAD/main/main.c(1213) :  Freeing 0x40936CC8 (16 bytes), script=-



At 13:58 06.11.2002, Melvyn Sopacua wrote:
At 13:52 6-11-2002, Marcus Boerger wrote:


When ini setting variables_order is empty there are memory leaks in
cgi as well as cli version. See below:

marcus

[marcuszaphod marcus]$ echo ?php var_dump($_ENV);?


== $_ENV isn't set in /bin/sh

So memleaks on var_dump(void)


Met vriendelijke groeten / With kind regards,

Webmaster IDG.nl
Melvyn Sopacua




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




[PHP-DEV] Re: Manual page suggestions (was: dba_open...)

2002-11-06 Thread Marcus Boerger
After the message from Philip Olson i was reminded that i had a little
discussion about return values but could not find everything i collected.

Some function return NULL some return FALSE and some return
either FALSE or NULL in case of an error.

I allways used to check for
xxx() !== false
since that is used in the documentation in some examples. See strpos().

Some function use NULL to tell there was a parser error and FALSE for
other errors. If so one cannot do something like:
if (xxx() !== false) ...
or
if (!is_null(xxx())) ...
instead you would have to use
if (($res = xxx() !== false)  !is_null($res)) ...

I posted the full thing already here. That also contains an analysis of
some function documentations:
http://marc.theaimsgroup.com/?l=php-devm=103376370906751w=2

marcus

p.s.: I am crossposting this so that it might get attetion.

At 12:28 06.11.2002, Philip Olson wrote:



On Wed, 6 Nov 2002, Marcus Boerger wrote:
 It return false on failure as documented. I feel we should use this for all
 functions where any failure results in false. This way users easily know
 that they must check for func()!==false

That's something to bring up for discussion but right
now it's not how we document functions.  Only resource
should be listed there.

I like your idea of more structure.  Right now each manual
entry is full of notes's, parameter descriptions can
sometimes get lost, and what the function does on failure
is also not structured.  During the phpdoc meeting awhile
back there was discussion of each manual entry having
a CHANGELOG but that's only part of it.

Here's a rough example (it's late, forgive me):

function in_array:

 --
 Parameter | Description   | Notes
 --
 needle| What is being searched for| Became mixed in
   |   | PHP 4.2.0
 haystack  | What we're searching in   |
 strict| If set to true, the type will | Defaults to false
   | also be compared. |
 ==
 On failure: returns false
 --

Seeing that below the proto might be useful and easy to read.
Anyway, something to think about :)

Regards,
Philip Olson



[PHP-DEV] shtool update to 1.6.2?

2002-11-06 Thread Marcus Boerger
Will we update shtool from 1.5.4 (our current version) to 1.6.2 (actual 
version)?
I just tried it and it seems to work. But i would like to here other 
meanings before
commiting.

marcus

 ChangeLog
 Changes between 1.6.1 and 1.6.2 (12-Jul-2002 to 02-Nov-2002):
   *) Map shtool install -d dir [...] internally to shtool mkdir

  -f -p -m 755 dir [...] in order to support the BSD-style
  install -d variant.
  [Ralf S. Engelschall, Alan Eldridge [EMAIL PROTECTED]]
   *) Add -o|--owner and -g|--group options to shtool mkdir.
  [Ralf S. Engelschall]
   *) Fixed 'shtool scpp -f ...'. The arguments to option -f
  were not evaluated correctly.
  [Ralf S. Engelschall]
   *) Support bold font on 'cygwin' terminals.
  [Marcus Boerger [EMAIL PROTECTED]]
   *) Try the terminal 'init' sequence before 'reset' for bold mode
  restoring in order to make sure the terminal is not cleared.
  Additionally, fallback to a consistent no-bold mode.
  [Mirko Liss [EMAIL PROTECTED]]
 Changes between 1.6.0 and 1.6.1 (01-Feb-2002 to 12-Jul-2002):
   *) Removed not-existing --min-size option from the usage
  of shtool rotate. The name is just --size.
  [Thomas Linden [EMAIL PROTECTED]]
   *) Port to POSIX 1003.1-2001 (SUSv3) standard:
  sh.echo, sh.version: head -1 - sed -e 'q'
  sh.path: sort -u | tail -1 - sort -r -u | sed -e q
  sh.subst: diff -u1 - diff -U1
  [Paul Eggert [EMAIL PROTECTED]]
   *) Fixed various typos in shtool.pod.
  [Ralf S. Engelschall, Liones [EMAIL PROTECTED]]
 Changes between 1.5.4 and 1.6.0 (14-Jun-2001 to 01-Feb-2002):
   *) Upgraded to GNU Autoconf 2.52 environment.
  [Ralf S. Engelschall]
   *) Fixed contained RPM specification (shtool.spec)
  [Ralf S. Engelschall]
   *) Added new command `shtool rotate [-v|--verbose] [-t|--trace]
  [-f|--force] [-n|--num-files count] [-s|--min-size size]
  [-c|--copy] [-r|--remove] [-a|--archive-dir dir] [-z|--compress
  [tool:]level] [-b|--background] [-d|--delay] [-p|--pad len]
  [-o|--owner owner] [-g|--group group] [-m|--mode mode]
  [-M|--migrate cmd] [-P|--prolog cmd] [-E|--epilog cmd]
  [file ...]'. This is a sophisticated command for rotating
  logfiles of daemons.
  [Ralf S. Engelschall]
   *) Added GNU long-option support (`--').
  [Ralf S. Engelschall]
   *) Cleaned up temporary file handling in `shtool path'.
  [Ralf S. Engelschall]
   *) Added NEWS file to source tree to comply to GNU standards.
  [Ralf S. Engelschall]
   *) Add new `shtool subst [-v] [-t] [-n] [-s] [-i] [-bext]
  [-ecmd] [-fcmd-file] [file] [...]' command. This
  is a useful wrapper around sed(1).
  [Ralf S. Engelschall]


Diff:

cvs -z3 -q diff shtool (in directory S:\php4-HEAD\build\)
Index: shtool
===
RCS file: /repository/php4/build/shtool,v
retrieving revision 1.3
diff -u -r1.3 shtool
--- shtool  7 Mar 2002 14:17:56 -   1.3
+++ shtool  6 Nov 2002 13:57:36 -
@@ -1,13 +1,13 @@
 #!/bin/sh
 ##
 ##  GNU shtool -- The GNU Portable Shell Tool
-##  Copyright (c) 1994-2001 Ralf S. Engelschall [EMAIL PROTECTED]
+##  Copyright (c) 1994-2002 Ralf S. Engelschall [EMAIL PROTECTED]
 ##
 ##  See http://www.gnu.org/software/shtool/ for more information.
 ##  See ftp://ftp.gnu.org/gnu/shtool/ for latest version.
 ##
-##  Version:  1.5.4 (14-Jun-2001)
-##  Contents: 3/17 available modules
+##  Version:  1.6.2 (02-Nov-2002)
+##  Contents: 3/19 available modules
 ##

 ##
@@ -50,7 +50,9 @@
 ##mkln   Make link with calculation of relative paths
 ##mkshadow   Make a shadow tree through symbolic links
 ##fixpermFix file permissions inside a source tree
+##rotate Logfile rotation
 ##tarballRoll distribution tarballs
+##subst  Apply sed(1) substitution operations
 ##guessosSimple operating system guesser
 ##arxExtended archive command
 ##sloSeparate linker options by library class
@@ -65,8 +67,8 @@
 exit 1
 fi
 if [ .$1 = .-h -o .$1 = .--help ]; then
-echo This is GNU shtool, version 1.5.4 (14-Jun-2001)
-echo Copyright (c) 1994-2001 Ralf S. Engelschall [EMAIL PROTECTED]
+echo This is GNU shtool, version 1.6.2 (02-Nov-2002)
+echo Copyright (c) 1994-2002 Ralf S. Engelschall [EMAIL PROTECTED]
 echo Report bugs to [EMAIL PROTECTED]
 echo ''
 echo Usage: shtool [options] [cmd-name [cmd-options] 
[cmd-args]]
@@ -78,38 +80,63 @@
 echo '  -r, --recreate  recreate this shtool script via shtoolize'
 echo ''
 echo 'Available cmd-name [cmd-options] [cmd-args]:'
-echo '  echo [-n] [-e] [str ...]'
-echo '  install  [-v] [-t] [-c] [-C] [-s] [-mmode] [-oowner] 
[-ggroup]'
-echo '   [-esed-cmd] file [file ...] path'
-echo '  mkdir[-t] [-f] [-p] [-mmode] dir [dir ...]'
+echo '  echo [-n|--newline] [-e|--expand] [str ...]'
+echo '  install  [-v|--verbose

[PHP-DEV] TSRM compiler warnings

2002-11-05 Thread Marcus Boerger
Could someone with karma please commit following patch
or give me karma for tsrm? It would silence all those warnings
at once:

/usr/src/php4-HEAD/TSRM/TSRM.c: In function `tsrm_startup':
/usr/src/php4-HEAD/TSRM/TSRM.c:124: warning: left-hand operand of comma 
expression has no effect
/usr/src/php4-HEAD/TSRM/TSRM.c:124: warning: statement with no effect
/usr/src/php4-HEAD/TSRM/TSRM.c:132: warning: left-hand operand of comma 
expression has no effect
/usr/src/php4-HEAD/TSRM/TSRM.c:132: warning: statement with no effect
/usr/src/php4-HEAD/TSRM/TSRM.c:142: warning: left-hand operand of comma 
expression has no effect
/usr/src/php4-HEAD/TSRM/TSRM.c:142: warning: left-hand operand of comma 
expression has no effect
/usr/src/php4-HEAD/TSRM/TSRM.c:142: warning: left-hand operand of comma 
expression has no effect
/usr/src/php4-HEAD/TSRM/TSRM.c:142: warning: statement with no effect
/usr/src/php4-HEAD/TSRM/TSRM.c: In function `tsrm_shutdown':
/usr/src/php4-HEAD/TSRM/TSRM.c:177: warning: left-hand operand of comma 
expression has no effect
/usr/src/php4-HEAD/TSRM/TSRM.c:177: warning: statement with no effect
/usr/src/php4-HEAD/TSRM/TSRM.c: In function `ts_allocate_id':
/usr/src/php4-HEAD/TSRM/TSRM.c:196: warning: left-hand operand of comma 
expression has no effect
/usr/src/php4-HEAD/TSRM/TSRM.c:196: warning: left-hand operand of comma 
expression has no effect
/usr/src/php4-HEAD/TSRM/TSRM.c:196: warning: statement with no effect
/usr/src/php4-HEAD/TSRM/TSRM.c:202: warning: left-hand operand of comma 
expression has no effect
/usr/src/php4-HEAD/TSRM/TSRM.c:202: warning: left-hand operand of comma 
expression has no effect
/usr/src/php4-HEAD/TSRM/TSRM.c:202: warning: statement with no effect
/usr/src/php4-HEAD/TSRM/TSRM.c:209: warning: left-hand operand of comma 
expression has no effect
/usr/src/php4-HEAD/TSRM/TSRM.c:209: warning: statement with no effect
/usr/src/php4-HEAD/TSRM/TSRM.c:241: warning: left-hand operand of comma 
expression has no effect
/usr/src/php4-HEAD/TSRM/TSRM.c:241: warning: left-hand operand of comma 
expression has no effect
/usr/src/php4-HEAD/TSRM/TSRM.c:241: warning: statement with no effect
/usr/src/php4-HEAD/TSRM/TSRM.c: In function `allocate_new_resource':
/usr/src/php4-HEAD/TSRM/TSRM.c:250: warning: left-hand operand of comma 
expression has no effect
/usr/src/php4-HEAD/TSRM/TSRM.c:250: warning: left-hand operand of comma 
expression has no effect
/usr/src/php4-HEAD/TSRM/TSRM.c:250: warning: statement with no effect
/usr/src/php4-HEAD/TSRM/TSRM.c: In function `ts_resource_ex':
/usr/src/php4-HEAD/TSRM/TSRM.c:311: warning: left-hand operand of comma 
expression has no effect
/usr/src/php4-HEAD/TSRM/TSRM.c:311: warning: left-hand operand of comma 
expression has no effect
/usr/src/php4-HEAD/TSRM/TSRM.c:311: warning: left-hand operand of comma 
expression has no effect
/usr/src/php4-HEAD/TSRM/TSRM.c:311: warning: statement with no effect
/usr/src/php4-HEAD/TSRM/TSRM.c:323: warning: left-hand operand of comma 
expression has no effect
/usr/src/php4-HEAD/TSRM/TSRM.c:323: warning: left-hand operand of comma 
expression has no effect
/usr/src/php4-HEAD/TSRM/TSRM.c:323: warning: left-hand operand of comma 
expression has no effect
/usr/src/php4-HEAD/TSRM/TSRM.c:323: warning: statement with no effect
/usr/src/php4-HEAD/TSRM/TSRM.c: In function `tsrm_mutex_lock':
/usr/src/php4-HEAD/TSRM/TSRM.c:511: warning: left-hand operand of comma 
expression has no effect
/usr/src/php4-HEAD/TSRM/TSRM.c:511: warning: left-hand operand of comma 
expression has no effect
/usr/src/php4-HEAD/TSRM/TSRM.c: In function `tsrm_mutex_unlock':
/usr/src/php4-HEAD/TSRM/TSRM.c:538: warning: left-hand operand of comma 
expression has no effect
/usr/src/php4-HEAD/TSRM/TSRM.c:538: warning: left-hand operand of comma 
expression has no effect


cvs -z3 -q diff TSRM.c (in directory S:\php4-HEAD\TSRM\)
Index: TSRM.c
===
RCS file: /repository/TSRM/TSRM.c,v
retrieving revision 1.46
diff -u -r1.46 TSRM.c
--- TSRM.c  5 Oct 2002 11:34:02 -   1.46
+++ TSRM.c  5 Nov 2002 13:01:41 -
 -79,7 +79,7 
} 
\
}
 #else
-#define TSRM_ERROR
+#define TSRM_ERROR(args)
 #define TSRM_SAFE_RETURN_RSRC(array, offset, range)\
if (offset==0) 
{\
return 
array;  \



[PHP-DEV] Re: [PHP-CVS] cvs: php4 /ext/standard ftp_fopen_wrapper.c

2002-11-05 Thread Marcus Boerger
At 15:32 05.11.2002, Wez Furlong wrote:

Hi Marcus,

I'm assuming that it's a warning about result being uninitialized; if
that is the case, lets just initialize it to zero in it's declaration.


Yes. It did it there so that further warnings may arise.


The cleanup code in errexit: inspects the first byte of tmp_line before
attempting to use it; it might also be a good idea to initialize
tmp_line to  in it's declaration.


Seems like. But will there be a warning in that case anyway?



--Wez.

On 11/05/02, Marcus B?rger [EMAIL PROTECTED] wrote:
 helly Tue Nov  5 06:17:45 2002 EDT

   Modified files:
 /php4/ext/standardftp_fopen_wrapper.c
   Log:
   silence
   #when i get this code right tmp_line is not initialised, too.
   #Therefore php_stream_wrapper_log_error() will be called with
   #undefined value, will it?


 Index: php4/ext/standard/ftp_fopen_wrapper.c
 diff -u php4/ext/standard/ftp_fopen_wrapper.c:1.36 
php4/ext/standard/ftp_fopen_wrapper.c:1.37
 --- php4/ext/standard/ftp_fopen_wrapper.c:1.36Fri Oct  4 
17:58:39 2002
 +++ php4/ext/standard/ftp_fopen_wrapper.c Tue Nov  5 06:17:45 2002
 @@ -17,7 +17,7 @@
 |  Hartmut Holzgraefe 
[EMAIL PROTECTED]   |
 
+--+
   */
 -/* $Id: ftp_fopen_wrapper.c,v 1.36 2002/10/04 21:58:39 sesser Exp $ */
 +/* $Id: ftp_fopen_wrapper.c,v 1.37 2002/11/05 11:17:45 helly Exp $ */

  #include php.h
  #include php_globals.h
 @@ -162,8 +162,10 @@
   resource-port = 21;

   stream = php_stream_sock_open_host(resource-host, 
resource-port, SOCK_STREAM, NULL, 0);
 - if (stream == NULL)
 + if (stream == NULL) {
 + result = 0; /* silence */
   goto errexit;
 + }

   php_stream_context_set(stream, context);
   php_stream_notify_info(context, PHP_STREAM_NOTIFY_CONNECT, NULL, 0);



 --
 PHP CVS 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] apache_hooks

2002-11-03 Thread Marcus Boerger
At 09:52 03.11.2002, Edin Kadribasic wrote:

On Saturday 02 November 2002 23:58, Rasmus Lerdorf wrote:
 What do you think would be the best way to make the apache_hooks code more
 accessible to people?  A tarball with the relevant files that overwrites
 the standard files, or perhaps it is time to #ifdef it into the main
 branch?

I would personally like #ifdef option that can be configured with
--enable-apache-hooks or something similar.

Edin



+1

and i have to agree to the merge problem mentioned by rasmus already

marcus


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




[PHP-DEV] Re: [PHP-CVS] cvs: php4 / run-tests.php

2002-11-03 Thread Marcus Boerger
Maybe we should add those two settings also to the default overwrites
since you can easily fail all tests by this simple settings and mbstring
module as well as output buffering are checked elsewhere.

marcus

Index: run-tests.php
===
RCS file: /repository/php4/run-tests.php,v
retrieving revision 1.111
diff -u -r1.111 run-tests.php
--- run-tests.php   3 Nov 2002 10:52:19 -   1.111
+++ run-tests.php   3 Nov 2002 10:56:08 -
 -508,6 +510,8 

// Default ini settings
$settings = array (
+   output_handler=,
+   zlib.output_compression=0,
open_basedir=,
disable_functions=,
error_reporting=2047,


At 11:52 03.11.2002, Marcus Börger wrote:

helly   Sun Nov  3 05:52:19 2002 EDT

  Modified files:
/php4   run-tests.php
  Log:
  pass params used for info call to skipif also
  #try php.ini with
  #output_handler=mb_string
  #mbstring.http_output=UCS-2LE


Index: php4/run-tests.php
diff -u php4/run-tests.php:1.110 php4/run-tests.php:1.111
--- php4/run-tests.php:1.110Sat Nov  2 17:06:03 2002
+++ php4/run-tests.php  Sun Nov  3 05:52:19 2002
 -117,10 +117,10 
'auto_append_file=',
 (bla)



Re: [PHP-DEV] Tests and output handler (Re: [PHP-QA] Test results)

2002-11-03 Thread Marcus Boerger
As i wrote already in another mail nearly all tests are affected by this.

Try a php.ini  with
output_handler=mb_string
mbstring.http_output=UCS-2LE

marcus

  At 09:42 03.11.2002, Moriyoshi Koizumi wrote:

Forgot to send CC to dev list...

 =
 FAILED TEST SUMMARY
 -
 mb_strtoupper() / mb_strtolower() [ext/mbstring/tests/casefold.phpt]
 mb_convert_encoding() [ext/mbstring/tests/mb_convert_encoding.phpt]
 mb_convert_variables() [ext/mbstring/tests/mb_convert_variables.phpt]
 mb_ereg() [ext/mbstring/tests/mb_ereg.phpt]
 mb_ereg_search() stuff [ext/mbstring/tests/mb_ereg_search_xxx.phpt]
 mb_strcut() [ext/mbstring/tests/mb_strcut.phpt]
 mb_strimwidth() [ext/mbstring/tests/mb_strimwidth.phpt]
 mb_substr() [ext/mbstring/tests/mb_substr.phpt]
 Simple multi-byte print test (EUC-JP) [ext/mbstring/tests/simpletest.phpt]
 quoted_printable_decode() function test 
[ext/standard/tests/general_functions/002.phpt]
 quoted_printable_decode() function test with CR/LF 
[ext/standard/tests/general_functions/006.phpt]
 htmlentities() test 4 (setlocale / ja_JP.EUC-JP) 
[ext/standard/tests/strings/htmlentities04.phpt]
 Test strtoupper on non-ASCII characters 
[ext/standard/tests/strings/strtoupper.phpt]
 Formatted print functions [tests/strings/002.phpt]
 HTML entities [tests/strings/003.phpt]
 =

These tests are failed because mb_output_handler is enabled.

 output_handler = mb_output_handler = mb_output_handler

IMO it should be disabled in --INI-- section, otherwise it would be
hard to determine whether a test result is buggy thing.


Moriyoshi



--
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] [PATCH] A fix for OnUpdate_zlib_output_compression

2002-11-03 Thread Marcus Boerger
Yes please commit

At 21:21 03.11.2002, Moriyoshi Koizumi wrote:

The attached patch is a fix for misbehaviour of
OnUpdate_zlib_output_compression. Without this patch, test cases always
fail complaining Cannot use both zlib.output_compression and
output_handler together!! when output_handler is used.

Any objections?


Moriyoshi


--
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] run-test output

2002-11-02 Thread Marcus Boerger
I would prefer using ob_end_clean() instead of ob_implicit_flush().
This way what ever settings one uses you can see the progress
of the tests.

marcus

cvs -z3 -q diff run-tests.php (in directory S:\php4-HEAD\)
Index: run-tests.php
===
RCS file: /repository/php4/run-tests.php,v
retrieving revision 1.106
diff -u -r1.106 run-tests.php
--- run-tests.php   2 Nov 2002 12:33:24 -   1.106
+++ run-tests.php   2 Nov 2002 12:39:05 -
 -44,7 +44,7 

 $cwd = getcwd();
 set_time_limit(0);
-ob_implicit_flush();
+ob_end_clean();
 error_reporting(E_ALL);
 ini_set('magic_quotes_runtime',0); // this would break tests by modifying 
EXPECT sections



[PHP-DEV] Missing info about configure

2002-11-02 Thread Marcus Boerger
Perhaps someone should add the missing info for configure here.

marcus

cvs -z3 -q diff tsrm.m4 (in directory S:\php4-ZE1\TSRM\)
Index: tsrm.m4
===
RCS file: /repository/TSRM/tsrm.m4,v
retrieving revision 1.14
diff -u -r1.14 tsrm.m4
--- tsrm.m4 5 Oct 2002 11:26:17 -   1.14
+++ tsrm.m4 2 Nov 2002 13:12:51 -
 -102,7 +102,7 
 ])

 AC_ARG_WITH(tsrm-st,
-[  --with-tsrm-st],[
+[  --with-tsrm-st  Use SGI's State Threads],[
   TSRM_ST=$withval
 ],[
   TSRM_ST=no




Re: [PHP-DEV] ODBTP, a possible solution for MS-SQL and other databases

2002-11-02 Thread Marcus Boerger
At 18:38 02.11.2002, Robert Twitty wrote:

Hello

(NOTE: This message was originally posted to PHP-DB, but I was told that
PHP-DEV was a more appropriate place)

I have been using PHP for about 9 months, and have chosen it as my primary
scripting language for web applications.   I have and still use ASP and JSP.
IMHO, PHP is superior and easier to use than those languages except in one
area that is important to me,  which is the ability to access MS SQL Server
7.0 / 2000 databases from a UNIX box.  Out of the box PHP provides great
support for MySQL and PostgreSQL, and at this time I have no desire to use
them because I do not believe that they are ready for  prime time.


I do not like MySQL due to its simplicity and lack of relations. But i must
disagree to PHP/Postgres. Postgres IS very stable and fast. Another very 
important
thing is that any security problem found in postgres is fixed very soon. On the
otherhand there is Microsoft and we have seen in the past that there are a 
lot of
problems and that it takes some time to get them fixed by MS. Last but not 
least
i d not like MS products for large server applications for several reasons.

The
open source solution that is always recommended for UNIX-based PHP / MS-SQL
connectivity is freeTDS, and unfortunately I found it to be quite lacking in
its capabilities and useless in certain situations.   Another alternative
was to use a commercial ODBC driver management system on UNIX.  Sadly, it
was not in the budget for this endeavor, and the PHP odbc extensions could
use some work in terms of ease of use.

Because I was determined to use PHP (I really dislike using JSP / JDBC on
UNIX, and  IIS / ASP is out of the question), I decided to create my own
solution.  Since I have a substantial amount of experience in programming
directly with the Win32 ODBC API and TCP/IP,  I decided to create a service
that runs on a Win32 platform that can communicate with any platform via
TCP/IP.  The service uses a home grown protocol that allows a client to
access any database that the service can see via the ODBC drivers that are
installed on the computer which it resides.  In other words, it allows a PHP
client on UNIX to access a database using the ODBC drivers installed on a
Windows NT / 2000 server.  It is nothing more than a middle man service for
Win32 ODBC.  The name of the service is called ODBTP (Open Database
Transport Protocol),  and no there is not a RFC for this protocol.  Thus
far, I have successfully accessed MS-SQL, Oracle and Sybase databases via
ODBTP.

ODBTP consists of a Windows NT / 2000 service application, an ODBTP client
library that can be used to create  Win32 or UNIX clients,  and a PHP
extension module that was created with the library.   ODBTP has the
following features:

* Multi-client servicing
* True connection pooling (not persistent connections)
* Client reserved connections (virtual connections for stateless web
clients)
* Supports all data types, including nvarchar, ntext, varchar(255),
char(255), datetime, and bigint.
* No big-endian / little-endian problems.
* Server-side data binding.
* Stored procedure execution, parameter passing (including NULL's) and
output retrieval.
* Transactions, i.e., supports commits and rollbacks under any transaction
isolation level.
* UNICODE data is processed using UTF-8 encoding (important since PHP
strings are not UNICODE)


did you use mbstring and internal encoding set to utf-8 or ucs-whatever?


* Can retrieve query results sent in XML format.
* Verbose error reporting, all ODBC error messages are sent to client.
* No discovered memory leaks or buffer overflow possibilities.
* Designed to be as easy as possible to use with PHP

I am new to this mailing list, and it appears that PHP is predominantly used
for MySQL and PostgreSQL, and thus I am not sure if ODBTP is of any interest
to most people on this list.  My original intent was not to release ODBTP to
the public (I really don't have the time to maintain freeware),  but if
there is a substantial interest I will release it to the public.  I am
curious to see how well it performs in other environments.

-- bob


Sounds interesting to me :-)

There is no problem with adding this as a new extension in pecl since all new
extensions should be created there. Maybe it is even worth to discuss this
belonging to /ext but i doubt. Just ask for approriate CVS account.

However, where can one download ODBTP or will be part of the extension
build?

regards
marcus


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




[PHP-DEV] Re: [PHP-CVS] cvs: php4 / run-tests.php

2002-11-02 Thread Marcus Boerger
You can now use php run-test.php ext/whatever

At 22:48 02.11.2002, you wrote:

helly   Sat Nov  2 16:48:06 2002 EDT

  Modified files:
/php4   run-tests.php
  Log:
  -allow parameters to be directories
  -${dir} - $dir


Index: php4/run-tests.php
diff -u php4/run-tests.php:1.108 php4/run-tests.php:1.109

(bla)


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




[PHP-DEV] ext/imap finding libraries

2002-11-01 Thread Marcus Boerger
The following patch allows to find the kerberos libraries to
be found in /usr, /usr/local, /usr/kerberos
and a given path. If there are no objections i will commit this.

marcus

cvs -z3 -q diff ext\imap\config.m4 (in directory S:\php4-HEAD\)
Index: ext/imap/config.m4
===
RCS file: /repository/php4/ext/imap/config.m4,v
retrieving revision 1.48
diff -u -r1.48 config.m4
--- ext/imap/config.m4  20 Aug 2002 23:08:24 -  1.48
+++ ext/imap/config.m4  1 Nov 2002 10:31:21 -
 -67,15 +67,20 
 test -d /usr/kerberos  PHP_KERBEROS=/usr/kerberos
   fi

-  if test $PHP_KERBEROS != no; then
-if test ! -f $PHP_KERBEROS/lib/libkrb5.a  test ! -f 
$PHP_KERBEROS/lib/libkrb5.$SHLIB_SUFFIX_NAME; then
-  AC_MSG_ERROR([Kerberos libraries not found in $PHP_KERBEROS/lib.
+  for i in /usr /usr/local /usr/kerberos $PHP_KERBEROS; do
+test -f $i/lib/libkrb5.$SHLIB_SUFFIX_NAME -o -f $i/lib/libkrb5.a  
PHP_KERBEROS_DIR=$i
+  done
+
+  if test -z $PHP_KERBEROS_DIR; then
+AC_MSG_ERROR([Kerberos libraries not found.

   Check the path given to --with-kerberos (if no path is given, 
defaults to /usr/kerberos )
-  ])
-fi
+])
+  fi
+
+  if test $PHP_KERBEROS != no; then
 AC_DEFINE(HAVE_IMAP_KRB,1,[ ])
-PHP_ADD_LIBPATH($PHP_KERBEROS/lib, IMAP_SHARED_LIBADD)
+PHP_ADD_LIBPATH($PHP_KERBEROS_DIR/lib, IMAP_SHARED_LIBADD)
 PHP_ADD_LIBRARY(gssapi_krb5, 1, IMAP_SHARED_LIBADD)
 PHP_ADD_LIBRARY(krb5, 1, IMAP_SHARED_LIBADD)
 PHP_ADD_LIBRARY(k5crypto, 1, IMAP_SHARED_LIBADD)




Re: [PHP-DEV] RE: [PHP-QA] 64-bit SGI account offer

2002-11-01 Thread Marcus Boerger
What about an additional cronjob for automated builds
which could then be included in snaps.php.net. This
way all of us could verify the build results?

marcus

At 12:18 01.11.2002, Sebastian Nohn wrote:

 -Original Message-
 From: Seth Price [mailto:sprice;wisc.edu]
 Sent: Friday, November 01, 2002 2:32 AM
 To: [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Subject: [PHP-QA] 64-bit SGI account offer


 It sounds like there is a need to get some 64-bit test systems to work
 with PHP on. Where I work we have some 64-bit SGI systems that we use
 for various scientific global simulations. I don't use the systems
 personally, but I spoke with my boss and I may be able to get an ssh
 login account for someone to get a PHP build working if there is
 interest. Would you guys find this useful?

It think this would be very useful, but I don't have the time to test PHP on
just another platform. I even have Problems testing it at my platform,
Alpha/Tru64, but I think someone should get an account on that machine. I
would suggest someone from the dev-team like Jani or any other bug-hunter
rather than someone from the QA-Team for this.

Regards,
   Sebastian Nohn
--
[EMAIL PROTECTED] - http://www.nohn.net/
PGP Key Available - Did I help you? Consider a gift:
http://www.amazon.de/exec/obidos/wishlist/3HYH6NR8ZI0WI/


--
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: [PATCH] run-tests.php

2002-11-01 Thread Marcus Boerger
At 18:44 01.11.2002, Ilia A. wrote:

On November 1, 2002 12:23 pm, John Coggeshall wrote:
 Wait wait wait..

 I think I've been misunderstood... I'm not talking about the version 4.3
 release, and yes we are working on the web edition of the test script..
 However, Shane (rightly so, IMHO) re-wrote run-tests (now run-tests2)
 and made it a class (testHarness) from which to base the web-based
 testing from...

What made you decide to go for the OO model of the run-tests script, there
does not seem to be any advantage in adding this overhead (imho)?


More important is that there are differences in ZE1  ZE2 but besides
those problems i think this makes handling of different sapis easier.

marcus


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




[PHP-DEV] ZE2 configure

2002-11-01 Thread Marcus Boerger
The build system complains that LIBZEND_DLSYM_CHECK
is not available. Should this be provided in Zend/Zend.m4?

marcus

cvs -z3 -q diff Zend\Zend.m4 (in directory S:\php4-HEAD\)
Index: Zend/Zend.m4
===
RCS file: /repository/ZendEngine2/Zend.m4,v
retrieving revision 1.35
diff -u -r1.35 Zend.m4
--- Zend/Zend.m423 Aug 2002 22:11:10 -  1.35
+++ Zend/Zend.m41 Nov 2002 20:17:36 -
 -230,3 +230,6 

 ])

+AC_DEFUN(LIBZEND_DLSYM_CHECK,[
+
+])




Re: [PHP-DEV] ext/imap finding libraries

2002-11-01 Thread Marcus Boerger
Your version is a bit nicer  work, too.

marcus

At 17:46 01.11.2002, Jani Taskinen wrote:


I've added similar patch. Please test. :)
(I don't have kerberos enabled in my c-client lib)

--Jani


On Fri, 1 Nov 2002, Marcus Boerger wrote:

The following patch allows to find the kerberos libraries to
be found in /usr, /usr/local, /usr/kerberos
and a given path. If there are no objections i will commit this.

marcus

cvs -z3 -q diff ext\imap\config.m4 (in directory S:\php4-HEAD\)
Index: ext/imap/config.m4
===
RCS file: /repository/php4/ext/imap/config.m4,v
retrieving revision 1.48
diff -u -r1.48 config.m4
--- ext/imap/config.m4  20 Aug 2002 23:08:24 -  1.48
+++ ext/imap/config.m4  1 Nov 2002 10:31:21 -
 -67,15 +67,20 
  test -d /usr/kerberos  PHP_KERBEROS=/usr/kerberos
fi

-  if test $PHP_KERBEROS != no; then
-if test ! -f $PHP_KERBEROS/lib/libkrb5.a  test ! -f
$PHP_KERBEROS/lib/libkrb5.$SHLIB_SUFFIX_NAME; then
-  AC_MSG_ERROR([Kerberos libraries not found in $PHP_KERBEROS/lib.
+  for i in /usr /usr/local /usr/kerberos $PHP_KERBEROS; do
+test -f $i/lib/libkrb5.$SHLIB_SUFFIX_NAME -o -f $i/lib/libkrb5.a 
PHP_KERBEROS_DIR=$i
+  done
+
+  if test -z $PHP_KERBEROS_DIR; then
+AC_MSG_ERROR([Kerberos libraries not found.

Check the path given to --with-kerberos (if no path is given,
defaults to /usr/kerberos )
-  ])
-fi
+])
+  fi
+
+  if test $PHP_KERBEROS != no; then
  AC_DEFINE(HAVE_IMAP_KRB,1,[ ])
-PHP_ADD_LIBPATH($PHP_KERBEROS/lib, IMAP_SHARED_LIBADD)
+PHP_ADD_LIBPATH($PHP_KERBEROS_DIR/lib, IMAP_SHARED_LIBADD)
  PHP_ADD_LIBRARY(gssapi_krb5, 1, IMAP_SHARED_LIBADD)
  PHP_ADD_LIBRARY(krb5, 1, IMAP_SHARED_LIBADD)
  PHP_ADD_LIBRARY(k5crypto, 1, IMAP_SHARED_LIBADD)




--
- For Sale! -



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




Re: [PHP-DEV] Re: [PHP-CVS] cvs: php4 /ext/standard css.c

2002-11-01 Thread Marcus Boerger
At 01:40 02.11.2002, Stig S. Bakken wrote:

On Wed, 2002-10-09 at 09:35, Yasuo Ohgaki wrote:
 Colin Viebrock wrote:
  I really think the best solution (not perfect, but best) is to specify
  some fonts so the pages look nice, and hard code in the ISO-8859-1 font

 hard code in the ISO-8859-1 font means assuming ISO 8859-1 and
 use ISO 8859-1 type face by converting chars to entities?

 Take a look at this page, for example.

 http://czyborra.com/charsets/iso8859.html

 Do you see converting text to entity assuming ISO 8859-1
 breaks not only multibyte encoding but also other ISO 8859
 encoding?

 I'm well aware of that I'm suggesting to make phpinfo()
 non XHTML, since it is more useful if it is not confirm
 XHTML perfectly.

 If use of HTML entities are preferred, only text that
 needs HTML entities should use entities. e.g. Names.
 Isn't using entities for names or like enough?

 Please no automatic entity conversion assuming ISO 8859-1.
 Thanks.

A bit late, but I'd like to throw in my .02EUR.

When dealing with multiple languages, the only reasonable charset to
support internally is Unicode, encoded in utf-8.

Now, while MSIE supports utf-8, it doesn't sent the Accept-Encoding
header.  NS4 is AFAIK the only browser that explicitly announces being
able to handle utf-8 in the request, but it's not a big issue to figure
out if the user agent is from a browser that can deal with utf-8.

The real solution would be using iconv on the output buffer to change
the utf-8 to whatever charset the browser prefers, or if iconv is not
available, try converting to 8859-1 and replace characters that don't
fit to ?.  IMHO this is the only thing that will work for everyone.


Since mbstring is better integrated in php i HOPE that will be done by
mbstring (and it is not even dependant on another library).

marcus


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




[PHP-DEV] building with cygwin/ssh

2002-10-30 Thread Marcus Boerger
When building php on a remote machine using cygwin+ssh
the terminal name is 'cygwin' and cannot be detected by
shtool. However it works when using settings from vt100.
I maild this to the developer but did not get any feedback
yet...

marcus

cvs -z3 -q diff build\shtool (in directory S:\php4-HEAD\)
Index: build/shtool
===
RCS file: /repository/php4/build/shtool,v
retrieving revision 1.3
diff -u -r1.3 shtool
--- build/shtool7 Mar 2002 14:17:56 -   1.3
+++ build/shtool30 Oct 2002 13:38:08 -
 -362,7 +362,7 
 term_bold=`awk 'BEGIN { printf(%c%c%c%c, 27, 91, 49, 
109); }' /dev/null 2/dev/null`
 term_norm=`awk 'BEGIN { printf(%c%c%c, 27, 91, 109); }' 
/dev/null 2/dev/null`
 ;;
-vt100|vt100*)
+vt100|vt100*|cygwin)
 term_bold=`awk 'BEGIN { printf(%c%c%c%c%c%c, 27, 91, 
49, 109, 0, 0); }' /dev/null 2/dev/null`
 term_norm=`awk 'BEGIN { printf(%c%c%c%c%c, 27, 91, 109, 
0, 0); }' /dev/null 2/dev/null`
 ;;



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

2002-10-30 Thread Marcus Boerger
What about removing all TSRMLS_FETCH() and instead passing
TSRM parameters in php_xslt struct?

marcus


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




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

2002-10-30 Thread Marcus Boerger
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




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

2002-10-30 Thread Marcus Boerger
At 19:02 30.10.2002, David Viner wrote:

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?


Simply removing the fetch macros since we have the parameter we need already.



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 Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] Bug #20175 (Static vars can't store ref to new instance)

2002-10-30 Thread Marcus Boerger
Attached you see it as a .phpt file (but where is the difference between
your ZE1/2 results).

Part 2: bar_static() is the test that failed in bug20175 but
i think the way Zend Engine 1.1/2 do it now is correct because
they return copies.
Part 3: indeed seems to be an error. Because the manual says one
can return a reference but it shows you can't.

=tests/lang/bug20175.phpt=
--TEST--
Bug #20175 (Static vars can't store ref to new instance)
--FILE--
?php
/* Part 1:
 * Storing the result of a function in a static variable.
 * foo_global() increments global variable $foo_count whenever it is executed.
 * When foo_static() is called it checks for the static variable $foo_value
 * being initialised. In case initialisation is necessary foo_global() will be
 * called. Since that must happen only once the return value should be equal.
 */
$foo_count = 0;

function foo_global() {
global $foo_count;
return 'foo:' . ++$foo_count;
}

function foo_static() {
static $foo_value;
if (!isset($foo_value)) {
$foo_value = foo_global();
}
return $foo_value;
}

/* Part 2:
 * Storing a reference to the result of a function in a static variable.
 * Same as Part 1 but:
 * The return statment transports a copy of the value to return. In other
 * words the return value of bar_global() is a temporary variable only valid
 * after the function call bar_global() is done in current local scope.
 */
$bar_global = 0;

function bar_global() {
global $bar_count;
return 'bar:' . ++$bar_count;
}

function bar_static() {
static $bar_value;
if (!isset($bar_value)) {
$bar_value = bar_global();
}
return $bar_value;
}

/* Part 3:
 * Storing a reference to the result of a function in a static variable.
 * Same as Part 2 but wow_global() returns a reference.
 */
$wow_global = 0;
$wow_name = '';

function wow_global() {
global $wow_count, $wow_name;
$wow_name = 'wow:' . ++$wow_count;
return $wow_name;
}

function wow_static() {
static $wow_value;
if (!isset($wow_value)) {
$wow_value = wow_global();
}
return $wow_value;
}

print zend_version().\n;
print foo_static().\n;
print foo_static().\n;
print bar_static().\n;
print bar_static().\n;
print wow_static().\n;
print wow_static().\n;
?
--EXPECTF--
%s
foo:1
foo:1
bar:1
bar:2
wow:1
wow:1
=EOF==

At 21:51 30.10.2002, Moriyoshi Koizumi wrote:

I've simplified the test code, and I still have got a strange result
with ZE2.

--
?php
function foo() {
static $value;
if (!isset($value)) {
$value = rand(0,100);
}
return $value;
}

function bar() {
static $value;
if (!isset($value)) {
$value = rand(0,100);
}
return $value;
}

print zend_version().\n;
print foo().\n;
print foo().\n;
print bar().\n;
print bar().\n;
?
--

with ZE1
--
1.3.0
26
26
75
95
--

with ZE2
--
2.0.0-alpha3
34
34
29
92
--

Is this a known behaviour?


Moriyoshi

--
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] error_prepend_string error_append_string

2002-10-29 Thread Marcus Boerger
Why use error_prepend_string  error_append_string OnUndateStringUnempty?
Shouldn`t they use OnUpdateString instead what is wanted in run-tests.php?

marcus


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




[PHP-DEV] RFC: run-tests.php errors/warnings

2002-10-29 Thread Marcus Boerger
I think we need to discuss the behaviour of run-tests.php
according too error/warning handling a bit.

First question (let me know if i am wrong): Any error/warning/
notice in a test result is either expected or a real error.

To make that clear: Yes some tests failed after i made those
visible but then i fixed the real problem and now there are no
more warnings.

Solution:
Enable error reporting for any error/warning/notice etc. in
run-tests.php and use the following where necessary

a) Disable messages in --INI-- section of a test.
When notices are expected E_ALL  ~ E_NOTICE can
be set as error_reporting=2039

b) Use  in conjunction with $php_errormsg.
--INI--
track_errors=1
display_erros=1
log_errors=0
--FILE--
erroneous_function_call();
echo $php_errormsg\n;
--EXPECT--
Error message generated by error_prepend_string  error_append_string

c) Magically add echo $php_errormsg; after each --FILE-- section in 
run-tests.php
But this is already condidered a baddirty solution.

So my RFC is to use the following overwrites in run-test.phpt:

error_reporting=2047
display_errors=1
log_errors=0
html_errors=0
track_errors=1
report_memleaks=1
docref_root=/phpmanual/
docref_ext=.html
error_log=
error_prepend_string=
error_append_string=
auto_append_file=
auto_prepend_file=

Remark 1: auto_append_file=  auto_prepend_file= currently do not work 
but that is
another thread.

Remark 2: We could instead use the log_errors and direct them to the output
with the following changes to above settings:
display_errors=0
log_errors=1

The output would be nicer but when we go to test other sapis than CGI/CLI 
this won't
work anymore.

marcus


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



[PHP-DEV] domxml memory leak

2002-10-29 Thread Marcus Boerger
The following fixes the memory leak of domxml002.phpt test.

marcus

cvs -z3 -q diff php_domxml.c (in directory S:\php4-HEAD\ext\domxml\)
Index: php_domxml.c
===
RCS file: /repository/php4/ext/domxml/php_domxml.c,v
retrieving revision 1.215
diff -u -r1.215 php_domxml.c
--- php_domxml.c29 Oct 2002 16:45:19 -  1.215
+++ php_domxml.c29 Oct 2002 16:49:08 -
 -572,7 +572,7 
zval *wrapper;
int refcount = 0;
/* FIXME: type check probably unnecessary here? */
-   if (!node || Z_TYPE_P(node) == XML_DTD_NODE)
+   if (!node) /* || Z_TYPE_P(node) == XML_DTD_NODE)*/
return;

wrapper = dom_object_get_data(node);





[PHP-DEV] functions in time.c

2002-10-29 Thread Marcus Boerger
Shouldn't microtime and gettimeofday be unavailable
when HAVE_GETTIMEOFDAY is undefined?


PHP_FUNCTION(microtime)
{
#ifdef HAVE_GETTIMEOFDAY
 ...
#endif
		RETURN_FALSE;
}
PHP_FUNCTION(gettimeofday)
{
#ifdef HAVE_GETTIMEOFDAY
 ...
#endif
		RETURN_FALSE;
}


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




[PHP-DEV] ZE2 questions

2002-10-23 Thread Marcus Boerger
Why doesn't the function zend_list_insert expect a TSRM parameter and instead
calls TSRMLS_FETCH()?

marcus


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




[PHP-DEV] Problems compiling HEAD

2002-10-19 Thread Marcus Boerger
I can no longer compile CVS version. See log:

[...]
Thank you for using PHP.

gcc  -Iext/zlib/ -I/usr/src/php4-HEAD/ext/zlib/ -DPHP_ATOM_INC 
-I/usr/src  [...]   -DZTS  -c /usr/src/php4-HEAD/ext/zlib/zlib.c -o 
ext/zlib/zlib.o   echo  ext/zlib/zlib.lo
In file included from /usr/src/php4-HEAD/Zend/zend_globals.h:53,
 from /usr/src/php4-HEAD/Zend/zend_list.h:25,
 from /usr/src/php4-HEAD/Zend/zend_API.h:26,
 from /usr/src/php4-HEAD/main/php.h:38,
 from /usr/src/php4-HEAD/ext/zlib/zlib.c:28:
/usr/src/php4-HEAD/Zend/zend_compile.h:206: redefinition of `zend_execute_data'
/usr/src/php4-HEAD/Zend/zend_compile.h:62: `zend_execute_data' previously 
declared here
make: *** [ext/zlib/zlib.lo] Error 1

System is mandrake 8.2. And same configuration worked fine some days ago...

I also wonder why do we have to specify both --with-zlib and 
--with-zlib-dir now?
Wouldn't it be enoght to specify --with-zlib if wanted. I mean in that case 
we do
not need a second configure option to specify the same. O.k. if zlib extension
is not wanted that makes sense but the first case can be simplyfied.

Another thing is that we have different messages for -the -with-zlib-dir 
option:

[marcuszaphod php4-HEAD]$ ./configure --help | grep zlib
  --with-zlib[=DIR]   Include ZLIB support (requires zlib = 1.0.9).
  --with-zlib-dir=DIR   Define the location of zlib install directory
  --with-zlib-dir[=DIR] GD: Set the path to libz install prefix.
  --with-zlib-dir[=DIR] PDFLIB: define libz install directory.

regards
marcus


[PHP-DEV] poweroff for some days

2002-10-04 Thread Marcus Boerger

I am moving to my new flat no and therefore beeing
offline for some days. They said internet is back on
wednesday but who knows...

Hope i did not leave anything important open.
I already had to poweroff linux and no shutting the rest
of my stuff.

marcus


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




[PHP-DEV] ZTS and tests problem

2002-10-03 Thread Marcus Boerger

I do not know why but i get the following error messages when running
tests:

Warning: Cannot get the virtual filepath of /usr/src/php4-HEAD/pear/PHPDoc
  in /usr/src/php4-HEAD/run-tests.php on line 160
/usr/src/php4-HEAD/run-tests.php(160) : Warning - Cannot get the virtual 
filepath of /usr/src/php4-HEAD/pear/PHPDoc

I tracked i down to filestat.c line 575:
#ifndef PHP_WIN32
#ifdef VIRTUAL_DIR
 {
 char *tmpname;

 if (virtual_filepath(filename, tmpname TSRMLS_CC)) {
 php_error(E_WARNING, Cannot get the virtual 
filepath of %s\n, filename);
 RETURN_FALSE;
 }

 filename = tmpname;
 }
#endif

But i do not know when it last worked...

Any Help?



[PHP-DEV] developing with php

2002-08-28 Thread Marcus Boerger

Nothing happened to my idea (with was agreed by some others)
to have developers list send an initial email to new users that
clearyfies the difference between developer list and user list,
which then can be used to get access to either one upone reply.

I now have another easier idea. We have the following headings
on the mailing lists webpage:

General mailing lists for PHP users - Announcements of new PHP releases are 
sent to this very low-volume list
and
Lists for the developers of PHP and the Zend Engine - A medium volume list 
for those who want to help out with the development of PHP

this really is not clear!

Why not use an additional heading
PHP developers list - A list for developers using and programming with PHP
direct above the heading of the other developers lists?

marcus


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




[PHP-DEV] cgi and mod_php

2002-08-28 Thread Marcus Boerger

Hi Sascha is ther a waay to build three modules, in particular
i want to build cli, cgi and the apache module.

regards
marcus


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




[PHP-DEV] error_log()

2002-08-26 Thread Marcus Boerger

During analysis of error_log i remembered it's lack to be integrated in
php_error() mechanism.

We could implement behaviour 5 and emit an E_USER_xxx message
with the name of the user function being executed.

Any comments?

marcus



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




[PHP-DEV] UltraEdit

2002-08-26 Thread Marcus Boerger

Anybody working with UltraEdit may like
the following function detection:
/Function String = ^{PHPAPI[ ^t]+^}^{^}^(PHP[A-Z_]+FUNCTION([a-zA-Z0-9_]+)^)

It detects all PHP__FUNCTION with the names of the defined functions.

Today i found having this VERY usefull :-)

marcus


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




[PHP-DEV] RFC: run-tests.php + diff

2002-08-21 Thread Marcus Boerger

The following patch produces *.diff files similar to
diff command. These would allow for easier checks in faild tests
when test combines multiple function checks in one test file
or the test uses var_dump for output.

For example i changed precision to 13 in array test 003.phpt
The tests now produce 003.diff
004-   float(-0.33)
004+   float(-0.3)
034-   float(-0.33)
034+   float(-0.3)
050-   float(-0.33)
050+   float(-0.3)

When the test fails because of memory leaks and such then
of cause .log files are better to read.

Any pros/cons?

Here is the diff

cvs -z3 -q diff -w run-tests.php (in directory S:\php4\)
Index: run-tests.php
===
RCS file: /repository/php4/run-tests.php,v
retrieving revision 1.53
diff -u -w -r1.53 run-tests.php
--- run-tests.php   21 Aug 2002 23:06:38 -  1.53
+++ run-tests.php   22 Aug 2002 00:34:57 -
@@ -420,9 +420,30 @@
  );
  fclose($log);

+$diffname = ereg_replace('\.phpt$','.diff',$file);
+$diff = fopen($diffname,'w')
+or error(Cannot create test log - $logname);
+
+fwrite($diff,generate_diff($wanted,$output));
+fclose($diff);
+
  error_report($file,$logname,$tested);

  return 'FAILED';
+}
+
+function generate_diff($wanted,$output) {
+$w = explode(\n, $wanted);
+$o = explode(\n, $output);
+$w1 = array_diff($w,$o);
+$o1 = array_diff($o,$w);
+$w2 = array();
+$o2 = array();
+foreach($w1 as $idx = $val) $w2[sprintf(%03d,$idx)] = 
sprintf(%03d- $val, $idx+1);
+foreach($o1 as $idx = $val) $o2[sprintf(%03d,$idx)] = 
sprintf(%03d+ $val, $idx+1);
+$diff = array_merge($w2, $o2);
+ksort($diff);
+return implode(\r\n, $diff);
  }

  function error($message) {




--- mailto:[EMAIL PROTECTED] --
Wir sind allzumal Tiere unter Tieren, Kinder der Materie wie sie,
nur wehrloser. Doch da wir im Unterschied zu den Tieren wissen,
dass wir sterben muessen, wollen wir uns auf jenen Augenblick vorbereiten,
indem wir das Leben geniessen, das uns durch Zufall und vom Zufall gegeben 
ist.
 Umberto Eco, Die Insel des vorigen Tages
- http://marcus-boerger.de -
 Tel. 0241 / 874 09-7 ### 0179 / 29 14 980  



[PHP-DEV] NO C++ comments

2002-08-20 Thread Marcus Boerger

Hi,

the following is a list of files containing C++ comments.
Comments to files note why there is no problem with C++ comments.
Maybe those involved in the development of these files change the comments.

To find C++ comments easier it may be a good idea to have CODING_STANDARS
added like this: Do not even use // inside comments.

regards
marcus

ext/com/*.* - Win only
ext/fbsql/php_fbsql.c
ext/fbsql/php_fbsql.h
ext/interbase/interbase.c
ext/mcve/php_mcve.h
ext/mime_magic/mime_magic.c
ext/msession/msession.c
ext/msession/reqclient.h - guarded by __cplusplus
ext/mysql/libmysql/my_getwd.c
ext/mysql/libmysql/my_tempnam.c - OS2 only
ext/notes/php_notes.c
ext/qtdom/qtdom_qt.h - C++ extension
ext/w32api/w32api.c: Win only
ext/w32api/php_w32api.h: Win only
ext/xmlrpc/libxmlrpc/*.*

sapi/activescript/*.* - C++/Win only
sapi/fastcgi/fastcgi.c
sapi/cgi/libfcgi/fcgiapp.c
sapi/cgi/libfcgi/os_win32.c - Win only
sapi/caudium/caudium.c
sapi/pi3web/pi3web_sapi.h
sapi/pi3web/pi3web_sapi.c
sapi/tux/php_tux.c

win32/resource.h - Win only
win32/sendmail.c - Win only: one surley not intended before function 
TSMClose()

Zend/FlexLexer.h




--- mailto:[EMAIL PROTECTED] --
We are animals among animals, all children of matter,
save that we are the more disarmed. But since, unlike animals,
we know that we must die, let us prepare for that moment
by enjoying the life that has been given us by chance and for chance.
Umberto Eco, The island of the day before
- http://marcus-boerger.de -



[PHP-DEV] session memory leaks

2002-08-20 Thread Marcus Boerger

I just checked out a fresh copy of php4 with zend1.3 but unfortuanetly the
errors i had in php4/zend2 + changes are there too.

As i do not understand why there are memory leaks i hope someone can help.

/usr/src/php4/ext/session/session.c(568) :  Freeing 0x40922D30 (16 bytes), 
script=/var/www/html/empty.php
Last leak repeated 2 times
/usr/src/php4/ext/session/session.c(1213) :  Freeing 0x40912AC0 (16 bytes), 
script=/var/www/html/empty.php
Last leak repeated 1 time
/usr/src/php4/ext/session/session.c(420) :  Freeing 0x40927D40 (16 bytes), 
script=/var/www/html/empty.php
Last leak repeated 2 times

those leaks only occur when using php function session_register().

i looked into it but do not understand how and why the variables are freed and
why that does not work correct.

regards
marcus


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




[PHP-DEV] mbstring and html encode/const structs

2002-07-31 Thread Marcus Boerger

Hi,

i have changed two things in ext/mbstring:

1) i changed all structs to be const to prevent compiler warnings and 
programming errors.

2) i implemented a html encoding.

at this time i have input decoding simply as a pass by and output encoding 
that produces
named or numeric entities for html output. This way i can enforce the 
engine to deliver
entities in output.

At this point it only works with characters  256. I guess the problem has 
something
to do with internal handling of characters  255.

Anyone interested may download the patch: 
http://marcus.boerger.de/php/ext/mbstring/mbstring-entities-const.patch
And the additional file holding translation the table: 
http://marcus.boerger.de/php/ext/mbstring/html_entities.c

If the idea finds friends i will check this in and invent some more work in 
decoding and encoding.

Example script:
--
?php
 mb_http_input(ISO-8859-1);
 mb_internal_encoding(ISO-8859-1);
 mb_http_output(HTML);
 ob_start(mb_output_handler);
?html
head
titleext/mbstring HTML Encoding Test Page/title
/head
body
?php echo chr(126).chr(127).chr(126).chr(0xE4).chr(0xF6).chr(0xFC);?

?php echo #126;#127;#126;auml;ouml;uuml;;?

/body
/html
--

The above script will output the first php line just as the second one:
--
#126;#127;#126;auml;ouml;uuml;
#126;#127;#126;auml;ouml;uuml;
--

regards
marcus



--- mailto:[EMAIL PROTECTED] --
We are animals among animals, all children of matter,
save that we are the more disarmed. But since, unlike animals,
we know that we must die, let us prepare for that moment
by enjoying the life that has been given us by chance and for chance.
Umberto Eco, The island of the day before
- http://marcus-boerger.de -



[PHP-DEV] ZendEngine2 and $argc,$argv

2002-06-24 Thread Marcus Boerger

Since i use ZendEngine2 i cannot use global $argc,$argv.

Example:

function somefunction() {
 global $argc, $argv;
}

worked before ZE2, PHP-3.0-dev
now i get: Fatal error - Can't assign by reference non-referencable value!

function somefunction() {
 $argc = $GLOBALS['argc'];
 $argv = $GLOBALS['argv'];
}

works just fine.

I assume global creates a reference and checks if the variable is writeable.
But a readonly variable or constant *should* also be referenceable.

regards
marcus




[PHP-DEV] Difference between sprintf, snprintf and spprintf

2002-06-22 Thread Marcus Boerger

Proposal comment for spprintf/snprintf header. When nobody objects i commit
this to spprintf.h and make a notice in snprintf.h.

/*

Comparing: sprintf, snprintf, spprintf

sprintf  offers the ability to make a lot of falures since it does not know
  the size of the buffer it uses. Therefore usage of sprintf often
  results in possible entries for buffer overrun attacks.
  SO PLEASE DO NOT USE IT!

snprintf knows the buffers size and will not write behind it. but you will
  have to use either a static buffer or allocate one dynamic buffer
  before beeing able to call the function. In other words you must
  be sure that you really know the maximum size of the buffer required.
  A bad thing is if you hav a big maximum and in most cases you only
  need a small buffer.

spprintf Is the dynamical version of snprintf it allocates the buffer in size
  as neede and allows a maximum setting as snprintf (turn this feature
  of by setting max_len to 0). spprintf is a little bit slower than
  snprintf and offers possible memory leakes if you miss freeing the
  buffer allocated by the function. Therfore this function should be
  used where either no maximum is known or the maximum is much bigger
  then normal size required.

Example:
   char *buffer;
   #define MAX 1024

   spprintf(buffer, MAX, text);
   if (!buffer)
 return OUT_OF_MEMORY
   action_with_buffer();
   efree(buffer);

*/


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




[PHP-DEV] main/main.c question

2002-06-22 Thread Marcus Boerger

1) Do we need the call to ts_resource?
If so we could remove sapi_globals as we don't use it.
If not we can remove the whole line which works fine for me.

2) One more warning in uninitialized dummy_track_vars_array

regards
marcus

cvs -z3 -q diff main\main.c (in directory S:\php4\)
Index: main/main.c
===
RCS file: /repository/php4/main/main.c,v
retrieving revision 1.460
diff -u -r1.460 main.c
--- main/main.c 23 Jun 2002 00:57:01 -  1.460
+++ main/main.c 23 Jun 2002 01:05:13 -
@@ -844,7 +844,6 @@
 void ***tsrm_ls;

 php_core_globals *core_globals;
-   sapi_globals_struct *sapi_globals = ts_resource(sapi_globals_id);
  #endif
  #ifdef PHP_WIN32
 WORD wVersionRequested = MAKEWORD(2, 0);
@@ -1097,7 +1096,7 @@
 char *p;
 unsigned char _gpc_flags[3] = {0, 0, 0};
 zend_bool have_variables_order;
-   zval *dummy_track_vars_array;
+   zval *dummy_track_vars_array = NULL;
 zend_bool initialized_dummy_track_vars_array=0;
 int i;
 char *variables_order;




- mailto:[EMAIL PROTECTED] 
Wir sind allzumal Tiere unter Tieren, Kinder der Materie wie sie,
nur wehrloser. Doch da wir im Unterschied zu den Tieren wissen,
dass wir sterben muessen, wollen wir uns auf jenen Augenblick vorbereiten,
indem wir das Leben geniessen, das uns durch Zufall und vom Zufall gegeben 
ist.
Umberto Eco, Die Insel des vorigen Tages
--- http://www.marcus-boerger.de ---
-- Tel. 0241 / 874 09-7 ### 0179 / 29 14 980  --


[PHP-DEV] Thread safety global strings

2002-04-12 Thread Marcus Boerger

Correct me if i am wrong:
We have a macros that garantees thread safety for module globals TSRMG.
But if we use this on strings or structures that is not thread safe because
then the lock only occurs for copying the pointer. But another thread could
change the global value what results in efree of the former copied pointer.

If i am correct we would need:
a) to generate an error if TSRMG is used on a string
b) a function that allows to do a thread safe copy operation with the string.
OR
we make TSRMG do this and all current TSRMG calls with strings have
to explicitly call free for the copy.

marcus



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




[PHP-DEV] modified base64

2002-04-10 Thread Marcus Boerger

After (v)spprintf i have another modified function here:
base64url_(en|de)code
I sometimes transmit binary data or thinks like session ids over http.
when 
using base64 the problem is in the chars '+', '/' and '='. So i changed
base64 
to use '-', '_' and '!' instead. After this change no modification is
done to the 
string as with the '+' sign and i do not have the problems of '=', '/'
which would 
have to be url encoded what makes the string longer. In fact the 65
characters 
i use now are those 71 characters which have neither a protocol function
nor 
have to be encoded (RFC1321). As these characters have no meaning in

filesystems as well things like session ids (len % 4 == 0) which are
often used 
for filenames as well can have shorter names with this encoding. And last
but 
not least these characters have no meaning with regular
expressions.
In addition i could make the functions accept hexadecimal values as
well
because (i suppose) in most such cases the input/output is
hexadecimal.
Reference: RFC1321 MD5, RFC2396 URI, RFC2616 HTTP
Any comments?
marcus



mailto:[EMAIL PROTECTED]
--
Man will never reach the moon, 
regardless of all future scientific advances 
Dr. Lee de Forest, inventor of the Audion tube 
 and father of the radio, Feb. 25, 1967
--- http://www.marcus-boerger.de 



[PHP-DEV] (v)spprintf

2002-04-09 Thread Marcus Boerger

I just implemented spprintf and vpprintf.
Both are nearly the same as (v)snprintf. The difference is that using
vspprintf you
usee a dynamically allocated buffer which *can* have a maximum length. To
reduce
runtime cost the functions reallocate in buffers of 1K. The old value of
*pbuf is ignored
and set NULL on initialisation failure. If during a call not enough
memory could be 
allocated you will not be modified (maybe i add a parameter for that).
The result
is the length as with (v)snprintf. If *pbuf != NULL you have to call

efree(*pbuf).
extern int spprintf( char **pbuf, size_t max_len, const char *format,
...);
extern int vspprintf(char **pbuf, size_t max_len, const char *format,
va_list ap);
Currentls i used it to fix a problem in ext/exif and to have error_logs
allowing longer
messages by ini setting.
I searched through the code and found many calls to (v)snprintf
includeing those using
php_printf. As php_printf is a replacement for printf i suggest we
implement that function
using vspprintf, too. But i could not test yet. So here is the diff on
that:
cvs -z3 -q diff main.c (in directory
S:\php4\main\)
Index: main.c
===
RCS file: /repository/php4/main/main.c,v
retrieving revision 1.443
diff -u -r1.443 main.c
--- main.c10 Apr 2002
01:27:44
-1.443
+++ main.c10 Apr 2002
01:41:19 -
@@ -357,16 +357,18 @@
{
va_list
args;
int
ret;
-char
buffer[PRINTF_BUFFER_SIZE];
+char
*buffer;
int
size;
TSRMLS_FETCH();

va_start(args,
format);
-size =
vsnprintf(buffer, sizeof(buffer), format, args);
-if(size 
sizeof(buffer) - 1) {
-size
= sizeof(buffer) - 1;
+size =
vspprintf(buffer, 0, format, args);
+if (buffer)
{
+ret
= PHPWRITE(buffer, size);
+efree(buffer);
+} else {
+ret
= 0;
}
-ret =
PHPWRITE(buffer, size);
va_end(args);

return
ret;

marcus


-
mailto:[EMAIL PROTECTED]

 I don't want to start any blashphemous rumours
 but i think that god's got a sick sense of humor
 and when i die i expect to find him laughing.
 Depeche Mode
--- http://www.marcus-boerger.de ---



Re: [PHP-DEV] cvs: php4 /main/main.c [[Re: [PHP-DEV] ErrorLog problem]]

2002-03-30 Thread Marcus Boerger

Try this patch. It does the same but it's a better solution.
But where is the configure variable to have your feature
disabled by default? - keep to discussion or say why you
ignore discussion points.



marcus

 At 04:40 30.03.2002, you wrote:
 rootshell  Fri Mar 29 23:13:29 2002 CET
 
   Modified files:
  /php4/main/main.c
   Log:
 lot of same errors are logged as one, cleans errorlog
 

cvs -z3 -q diff main\main.c (in directory S:\php4\)
Index: main/main.c
===
RCS file: /repository/php4/main/main.c,v
retrieving revision 1.440
diff -u -r1.440 main.c
--- main/main.c 19 Mar 2002 23:29:37 -  1.440
+++ main/main.c 30 Mar 2002 14:32:05 -
 -84,6 +84,9 
  PHPAPI int core_globals_id;
  #endif

+#define ERROR_BUF_LEN  1024
+static char last_err_buf[ERROR_BUF_LEN];
+
  static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC);


 -408,18 +411,21 
   extended error handling function */
  static void php_error_cb(int type, const char *error_filename, const uint 
error_lineno, const char *format, va_list args)
  {
-   char buffer[1024];
-   int buffer_len;
+   char buffer[ERROR_BUF_LEN];
+   int buffer_len, display;
 TSRMLS_FETCH();

 buffer_len = vsnprintf(buffer, sizeof(buffer)-1, format, args);
 buffer[sizeof(buffer)-1]=0;
-   if(buffer_len  sizeof(buffer) - 1 || buffer_len  0) {
-   buffer_len = sizeof(buffer) - 1;
+   if ((display = strncmp(buffer, last_err_buf, ERROR_BUF_LEN)) != 0) {
+   strncpy(last_err_buf, buffer, ERROR_BUF_LEN);
+   if(buffer_len  sizeof(buffer) - 1 || buffer_len  0) {
+   buffer_len = sizeof(buffer) - 1;
+   }
 }
-
+
 /* display/log the error if necessary */
-   if ((EG(error_reporting)  type || (type  E_CORE))
+   if (display  (EG(error_reporting)  type || (type  E_CORE))
  (PG(log_errors) || PG(display_errors) || 
(!module_initialized))) {
 char *error_type_str;

 -449,14 +455,14 
 }

 if (!module_initialized || PG(log_errors)) {
-   char log_buffer[1024];
+   char log_buffer[ERROR_BUF_LEN];

  #ifdef PHP_WIN32
 if (type==E_CORE_ERROR || type==E_CORE_WARNING) {
 MessageBox(NULL, buffer, error_type_str, 
MB_OK|ZEND_SERVICE_MB_STYLE);
 }
  #endif
-   snprintf(log_buffer, 1024, PHP %s:  %s in %s on 
line %d, error_type_str, buffer, error_filename, error_lineno);
+   snprintf(log_buffer, ERROR_BUF_LEN, PHP %s:  %s in 
%s on line %d, error_type_str, buffer, error_filename, error_lineno);
 php_log_err(log_buffer TSRMLS_CC);
 }
 if (module_initialized  PG(display_errors)
 -469,8 +475,8 
 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(xmlrpc_errors)) {
-   error_format = do_alloca(1024);
-   snprintf(error_format, 1023, ?xml 
version=\1.0\?methodResponsefaultvaluestructmembernamefaultCode/namevalueint%ld/int/value/membermembernamefaultString/namevaluestring%%s:%%s
 
in %%s on line 
%%d/string/value/member/struct/value/fault/methodResponse, 
PG(xmlrpc_error_number));
+   error_format = do_alloca(ERROR_BUF_LEN);
+   snprintf(error_format, ERROR_BUF_LEN-1, 
?xml 
version=\1.0\?methodResponsefaultvaluestructmembernamefaultCode/namevalueint%ld/int/value/membermembernamefaultString/namevaluestring%%s:%%s
 
in %%s on line 
%%d/string/value/member/struct/value/fault/methodResponse, 
PG(xmlrpc_error_number));
 }

 if (prepend_string) {
 -526,6 +532,7 
 }

 /* Log if necessary */
+   if (!display) return;
 if (PG(track_errors)  EG(active_symbol_table)) {
 pval *tmp;




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




[PHP-DEV] RFC: CLI -x

2002-03-22 Thread Marcus Boerger

I added new -x switch to CLI version which enables execution of
files without having scripting tags.
Suppose we have a file called /usr/bin/phpx:
/usr/bin/php -x $1
EOF
Suppose we have a file called hello.phpc
#!/usr/bin/phpx
echo Hello ;echoWorld!\n;
EOF
Suppose we have a file called hello2.phpc
#!/usr/bin/php -x
$a = Hello ;
$b = World!;
echo $a $b\n;
EOF
With this you can do:
[marcus@marvin tmp]$ ./hello.phpc
Hello
World!\n
[marcus@marvin tmp]$ phpx hello.phpc
Hello World!
[marcus@marvin tmp]$ ./hello2.phpc
Hello World!
[marcus@marvin tmp]$
About the implementation: I had very big problems with a nicer
implementation. When using buffered copy operation using
fread/fwrite
i cannot copy any bytes ?!? (don't know why). When using streams
every thing works fine but it i get segfault on
php_request_shutdown().
It seems that the shutdown process closes the filepointer to the
script
and then frees the stream and segfaults because of php_stream_free 
working with an illegal file pointer.
Any comments?
marcus

-
mailto:[EMAIL PROTECTED]

 I don't want to start any blashphemous rumours
 but i think that god's got a sick sense of humor
 and when i die i expect to find him laughing.
 Depeche Mode
--- http://www.marcus-boerger.de ---



[PHP-DEV] RFC: CLI alone

2002-03-17 Thread Marcus Boerger

The following patch enables a CLI build without
having CGI. Any suggestions?

marcus

diff -u -w -r1.163 acinclude.m4
--- acinclude.m413 Mar 2002 16:59:49 -  1.163
+++ acinclude.m417 Mar 2002 17:14:09 -
 -126,6 +126,14 
  ])

  dnl
+dnl Disable building CGI
+dnl
+AC_DEFUN(PHP_DISABLE_CGI,[
+  disable_cgi=1
+])
+
+
+dnl
  dnl Separator into the configure --help display.
  dnl
  AC_DEFUN(PHP_HELP_SEPARATOR,[
Index: configure.in
===
RCS file: /repository/php4/configure.in,v
retrieving revision 1.319
diff -u -w -r1.319 configure.in
--- configure.in15 Mar 2002 21:02:54 -  1.319
+++ configure.in17 Mar 2002 17:14:10 -
 -239,9 +239,16 

  esyscmd(./scripts/config-stubs sapi)

-if test $PHP_SAPI = default; then
+if test $PHP_SAPI = default;  test $disable_cgi != 1; then
PHP_SELECT_SAPI(cgi, program, cgi_main.c getopt.c)
  fi
+if test $PHP_SAPI = default;  test $disable_cli != 1; then
+  PHP_SAPI=cli
+fi
+if test $PHP_SAPI = cli; then
+  PHP_DISABLE_CLI
+  PHP_SELECT_SAPI(cli, program, php_cli.c getopt.c)
+fi

  AC_MSG_CHECKING([for chosen SAPI module])
  AC_MSG_RESULT([$PHP_SAPI])
 -1094,7 +1101,11 

  PHP_ADD_BUILD_DIR(main)
  PHP_ADD_BUILD_DIR(regex)
-PHP_ADD_BUILD_DIR(sapi/$PHP_SAPI sapi/cli)
+PHP_ADD_BUILD_DIR(sapi/$PHP_SAPI)
+dnl Do not include cli if it is already invoked from PHP_SAPI
+if test $PHP_SAPI != cli; then
+  PHP_ADD_BUILD_DIR(sapi/cli)
+fi
  PHP_ADD_BUILD_DIR(TSRM)
  PHP_ADD_BUILD_DIR(Zend)

Index: sapi/cgi/config.m4
===
RCS file: /repository/php4/sapi/cgi/config.m4,v
retrieving revision 1.13
diff -u -w -r1.13 config.m4
--- sapi/cgi/config.m4  7 Mar 2002 14:19:51 -   1.13
+++ sapi/cgi/config.m4  17 Mar 2002 17:14:10 -
 -2,6 +2,22 
  dnl $Id: config.m4,v 1.13 2002/03/07 14:19:51 sas Exp $
  dnl

+AC_MSG_CHECKING(for CGI build)
+
+AC_ARG_ENABLE(cgi,
+[  --disable-cgi   Disable building CGI version of PHP.],
+[
+  if test $enable_cgi != no; then
+PHP_SAPI_CGI=yes
+  else
+PHP_SAPI_CGI=no
+  fi
+],
+[PHP_SAPI_CGI=yes]
+)
+
+if test $PHP_SAPI_CGI != no; then
+
  AC_DEFUN(PHP_TEST_WRITE_STDOUT,[
AC_CACHE_CHECK(whether writing to stdout works,ac_cv_write_stdout,[
  AC_TRY_RUN([
 -97,3 +113,9 
  dnl## AC_SUBST(FHTTPD_INCLUDE)
  PHP_SUBST(FHTTPD_LIB)
  PHP_SUBST(FHTTPD_TARGET)
+
+else
+  PHP_DISABLE_CGI
+fi
+
+AC_MSG_RESULT($PHP_SAPI_CGI)




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




[PHP-DEV] memory streams

2002-03-16 Thread Marcus Boerger

At the moment i am working at memory-streams

If have the following problem left:
I must extend
struct _php_stream_ops
with ftell

by the way php_stream_tell is wrong because it relies on seek and
that does return either 0 on success or an erroecode

regards
marcus



- mailto:[EMAIL PROTECTED] 
 I don't want to start any blashphemous rumours
 but i think that god's got a sick sense of humor
 and when i die i expect to find him laughing.
  Depeche Mode
--- http://www.marcus-boerger.de ---


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




[PHP-DEV] Streams

2002-03-16 Thread Marcus Boerger

Hi Wez,

i tried the streams and memory streams now in ext/exif.

What i do is check whether a stream is an stdio stream and if not
copy it to a memory stream and work with that. But before going
on using it i close/free the original stream.

I tested with http:... and the wrapper has destroy set to NULL.
But when closing the destroy is not NULL
To have it work i set it to NULL before closing it.
Do you have any ideas?

Test command for CLI was:
php -r 
'foreach(exif_read_data(http://marcus-boerger.de/php/ext/exif/test/kodak-dc210.jpg,,true)
 
as $sect=$data) foreach($data as $key=$val) echo $sect.$key: $val\n;'

Besides that it is working.

regards
marcus

have to go to party again now.


- mailto:[EMAIL PROTECTED] 
Wir sind allzumal Tiere unter Tieren, Kinder der Materie wie sie,
nur wehrloser. Doch da wir im Unterschied zu den Tieren wissen,
dass wir sterben muessen, wollen wir uns auf jenen Augenblick vorbereiten,
indem wir das Leben geniessen, das uns durch Zufall und vom Zufall gegeben 
ist.
Umberto Eco, Die Insel des vorigen Tages
--- http://www.marcus-boerger.de ---
-- Tel. 0241 / 874 09-7 ### 0179 / 29 14 980  --


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




[PHP-DEV] CLI: Passing arguments to scripts....

2002-03-10 Thread Marcus Boerger

The following path for cli version is concerned with passing arguments
to scripts. I found out that not all ways work correct and $PHP_SELF is not set
at all. The four example below explain the patch. All four execute:
echo $PHP_SELF\n;
echo join($argv,',').\n;

1) Execute a file using -f and pass 'a -b c' - before patch scriptfile was 
set to a - didn't work
$ php -f /t/temp/arg.php a -b c
/t/temp/arg.php
/t/temp/arg.php,a,-b,c

2) Execute a file using without and pass 'a -b c' - before patch 
scriptfile was set to a - didn't work
$ php /t/temp/arg.php a -b c
/t/temp/arg.php
/t/temp/arg.php,/t/temp/arg.php,a,-b,c

3) Execute code directly and pass 'a -b c' - before patch scriptfile was 
set to a - didn't work
$ php -r 'echo $PHP_SELF\n.join($argv,,).\n;' a -b c
-
-,a,-b,c

4) Execute stdin and pass 'a -b c' - before patch passing arguments wasn't 
possible at all
$ echo '?echo $PHP_SELF\n.join($argv,,).\n;?' | php -- a -b c
-
-,a,-b,c

There was no need to change function ap_php_getopt as it does handle -- to 
end interpreting arguments.
But i added PHP_SELF and set it to either the executed script or - for 
stdin/run code. The
value for argv[0] seen by script is set to the same value to make argument 
enumerating consistent.

An opportunity would be setting argv[0] of script to argv[0] of cli. This 
way the user could get the
execution-path on some systems.

Any suggenstions? May i commit the change?

regards
marcus


diff -u -w -r1.9 php_cli.c
--- sapi/cli/php_cli.c  8 Mar 2002 09:55:58 -   1.9
+++ sapi/cli/php_cli.c  10 Mar 2002 14:53:17 -
@@ -240,7 +241,9 @@
 prog = php;
 }

-   php_printf(Usage: %s [-h] [-s] [-v] [-i] [-f file] |  {file 
[args...]}\n
+   php_printf( Usage: %s [options] [-f] file [args...]\n
+  %s [options] -r code [args...]\n
+  %s [options] [-- args...]\n
   -s Display colour syntax 
highlighted source.\n
   -w Display source with 
stripped comments and whitespace.\n
   -f file  Parse file.\n
@@ -253,8 +256,12 @@
   -l Syntax check only (lint)\n
   -m Show compiled in modules\n
   -i PHP information\n
- -r code  Run PHP code\n
- -h This help\n, prog);
+ -r code  Run PHP code without 
using script tags ?..?\n
+ -h This help\n
+   \n
+ args...Arguments passed to 
script. Use -- args when first argument \n
+starts with - or script 
is read from stdin\n
+   , prog, prog, prog);
  }
  /* }}} */

@@ -301,6 +308,7 @@
 int no_headers=1;
 int orig_optind=ap_php_optind;
 char *orig_optarg=ap_php_optarg;
+   char *arg_free=NULL, **arg_excp=arg_free;
 char *script_file=NULL;
 zend_llist global_vars;
 int interactive=0;
@@ -512,18 +520,32 @@
 }
 }

+   /* only set script_file if not set already and not in 
direct mode and not at end of parameter list */
+   if (argc  ap_php_optind  !script_file  !exec_direct  
strcmp(argv[ap_php_optind-1],--)) {
+   script_file=argv[ap_php_optind];
+   }
+
 CG(interactive) = interactive;
-   SG(request_info).argc=argc-ap_php_optind;
-   SG(request_info).argv=argv+ap_php_optind;

-   if (argc  ap_php_optind) {
-   script_file=argv[ap_php_optind];
+   /* before registering argv to modulule exchange the *new* 
argv[0] */
+   /* we can achieve this without allocating more memory */
+   SG(request_info).argc=argc-ap_php_optind+1;
+   arg_excp = argv+ap_php_optind-1;
+   arg_free = argv[ap_php_optind-1];
+   if (script_file) {
+   argv[ap_php_optind-1] = script_file;
+   } else {
+   argv[ap_php_optind-1] = -; /* should be stdin */
 }
+   SG(request_info).argv=argv+ap_php_optind-1;

 if (php_request_startup(TSRMLS_C)==FAILURE) {
 php_module_shutdown(TSRMLS_C);
+   *arg_excp = arg_free;
 return FAILURE;
 }
+   *arg_excp = arg_free; /* reconstuct argv */
 if (no_headers) {
 SG(headers_sent) = 1;
 SG(request_info).no_headers = 1;
@@ -535,6 +557,7 @@
 

[PHP-DEV] vote for new function FP_FSKIP

2002-03-08 Thread Marcus Boerger

Some image functions need to skip ofer certain file/stream regions.
The current solution is to skip these regions by reading them into an
allocated buffer. This makes the problem: Allocating the buffer.
Some images are very big so we have to allocate a large amount of
memory.

For files we could simply use fseek but sockets do not have such a
function so we have to read. But They have an internal buffer that is
there without being allocated additionally. So i implemented a new
function that skips the data without writeing it to a receiver buffer as
read functions do.

See diff attached

Please comment, if i hear enough '+' i will commit it.

regards
marcus


- mailto:[EMAIL PROTECTED] 
We are animals among animals, all children of matter,
save that we are the more disarmed. But since, unlike animals,
we know that we must die, let us prepare for that moment
by enjoying the life that has been given us by chance and for chance.
Umberto Eco, The island of the day before
--- http://www.marcus-boerger.de ---


diff -u -w -r1.33 ./fopen_wrappers.h
--- main/fopen_wrappers.h   28 Feb 2002 08:27:03 -  1.33
+++ ./main/fopen_wrappers.h 8 Mar 2002 23:21:22 -
@@ -49,6 +49,7 @@
 #define SOCK_FEOF(sock) php_sock_feof((sock))
 #define SOCK_FREAD(ptr, size, sock) php_sock_fread((ptr), (size), (sock))
 #define SOCK_FCLOSE(s) php_sock_close(s)
+#define SOCK_FSKIP(l, s) php_sock_fskip((l), (s))

 #define FP_FGETS(buf, len, sock, fp, issock) \
((issock)?SOCK_FGETS(buf, len, sock):fgets(buf, len, fp))
@@ -58,6 +59,8 @@
((issock)?SOCK_FEOF(sock):feof(fp))
 #define FP_FGETC(sock, fp, issock) \
((issock)?SOCK_FGETC(sock):fgetc(fp))
+#define FP_FSKIP(len, sock, fp, issock) \
+   ((issock)?SOCK_FSKIP(len,sock):fseek(fp,ftell(fp)+len,SEEK_SET))

 /* values for issock */
 #define IS_NOT_SOCKET  0
diff -u -w -r1.84 ./ext/standard/fsock.c
--- ext/standard/fsock.c11 Dec 2001 15:30:31 -  1.84
+++ ./ext/standard/fsock.c  8 Mar 2002 23:21:22 -
@@ -596,8 +596,6 @@
SOCK_FIND(sock, socket);
return php_sock_fgets_internal(buf, maxlen, sock);
 }
-
-
 /* }}} */

 /*
@@ -742,6 +740,26 @@
return ret;
 }

+/* }}} */
+
+/* {{{ php_sock_fskip() */
+/* Skip an amount of bytes in socket
+ */
+PHPAPI int php_sock_fskip(size_t len, int socket)
+{
+   size_t ret = 0;
+   SOCK_FIND_AND_READ_MAX(len);
+
+   if(len  0)
+   return ret;
+
+   ret = MIN(TOREAD(sock), len);
+   if(ret) {
+   sock-readpos += ret;
+   }
+
+   return !ret; /* 0 if success: same behaviour as fseek */
+}
 /* }}} */

 /* {{{ module start/shutdown functions */
diff -u -w -r1.41 ext/standard/fsock.h
--- ext/standard/fsock.h28 Feb 2002 08:26:45 -  1.41
+++ ./ext/standard/fsock.h  8 Mar 2002 23:21:22 -
@@ -63,6 +63,7 @@
 PHPAPI int php_lookup_hostname(const char *addr, struct in_addr *in);
 PHPAPI char *php_sock_fgets(char *buf, size_t maxlen, int socket);
 PHPAPI size_t php_sock_fread(char *buf, size_t maxlen, int socket);
+PHPAPI int php_sock_fskip(size_t len, int socket);
 PHPAPI int php_sock_feof(int socket);
 PHPAPI int php_sock_fgetc(int socket);
 PHPAPI int php_is_persistent_sock(int);




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


[PHP-DEV] Executing code with CLI without using a file

2002-03-05 Thread Marcus Boerger

hi,

i just looked at the code for a possibility to extend CLI to execute code
without using files. For example:

php -- 'echo Hello World;'

I saw that only files can be executed, so i had to pacth the following files:
Zend/zend_compile.h:
 added new constant ZEND_HANDLE_STRING
 added new prototype for zend_execute_code
Zend/zend.c:
 added function zend_execute_code which executed a prepended file a
 code string and an appended file
main/main.c:
 make function php_execute_script recognize type ZEND_HANDLE_STRING
 and invoke zend_execute_code instead zend_execute_scripts 
on that type.
sapi/cli/php_cli.c
 added switch -- in php_cli_usage
 function main:
 stop interpreting argumants after --
 setting up information for -- with file_handle.type = 
ZEND_HANDLE_STRING
 the code pointer uses file_handle.filename

The code compiles but i cannot build an executable. I only have CYGWIN 
where i am now and
the CVS version does not build them

marcus


- mailto:[EMAIL PROTECTED] 
We are animals among animals, all children of matter,
save that we are the more disarmed. But since, unlike animals,
we know that we must die, let us prepare for that moment
by enjoying the life that has been given us by chance and for chance.
Umberto Eco, The island of the day before
--- http://www.marcus-boerger.de ---



cli-direct.tar.bz2
Description: Binary data

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


[PHP-DEV] New function (repost from php-cvs)

2002-03-04 Thread Marcus Boerger

hi guys,

what about a new function called strnlen str*n*len which will
return the length of a string with a given maximum to avoid
problems with strings not zero terminated

i suggest we put this in a single c file near strlcpyc

/* {{{ php_strnlen
  * get length of string if buffer if less than buffer size or buffer size */
static size_t php_strnlen( char* str, size_t maxlen) {
 size_t len = 0;

 if ( str  maxlen  *str) {
 do {
 len++;
 } while ( --maxlen  *(++str));
 }
 return len;
}
/* }}} */

I already had a small discussion with Andy

 Andi: There aren't supposed to be strings which aren't zero terminated 
and if there are it should be fixed (or am I missing something?)

Of cause not but currently i am working on ext/exif and i cannot assume 
that a file is correct
So when i scan a buffer whose length i now i cannot exceed it's length when 
searching for
NUL to determine its string length I must stop searching for NUL if buffer 
end is reached
Also there are situations in which you have a string with now NUL from 
outside PHP
(which was one of the many errors in exifc) 

So i think i am not the only one who use this(or shoul i say must use 
this for savety reasons?)

marcus




-- 
PHP Development Mailing List http://wwwphpnet/
To unsubscribe, visit: http://wwwphpnet/unsubphp




[PHP-DEV] php_error $php_erormsg

2002-03-04 Thread Marcus Boerger

Question, do we have a function that resets the $php_errormsg variable 
before returning
from a php function (Then one could write E_NOTICE to log but not generae 
info returning
in $php_errormsg)?

marcus


- mailto:[EMAIL PROTECTED] 
 I don't want to start any blashphemous rumours
 but i think that god's got a sick sense of humor
 and when i die i expect to find him laughing.
  Depeche Mode
--- http://www.marcus-boerger.de ---


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




[PHP-DEV] GetImageSize,read_exif_data,Bug #6787,#14994

2002-03-03 Thread Marcus Boerger

Hi Rasmus,

today i woke up and i think the solution is to have read_exif_data
a third parameter whether or not to return information if no exif is
present. And to support TIFFs with GetImageSize we only need
a small addition of say less than 100 lines c code...

marcus
--

[sorry first one has gone to wrong mailing list - so here again]

Hi Rasmus,

i think Serge is correct because one can use standard functions for
FileName,FileDateTime and FileSize. So better reply with false.
The other solution would be adding an array entry 'EXIFPresent' (true|false)
BUT i think that is not so good.

 From my point of view i would like to discuss the difference between
getimagesize and read_exif_data a little:

We would need some function*ality* from exif.c in image.c to support TIFF.
When we have those functions we would be able to interpret APP markers
of JPEG also (see below).

I suppose we check whether or not ext/exif is present and then return
read_exif_data results in GetImageSize (i do not see the point of returning
and APP marker section which has to be interpreted). Then we should also
make ext/exif default to present and change switch from --enable-exif to
--disable-exif (prefer this).

Or we move the necessary functions from exif.c to image.c and
then make ext/exif optional for editing exif headers in the future.

If to many people use APP return info we could use a third parameter to
return interpreted values.

The real point here is that i do not know what APP markers and EXIF
headers have to do with GetImageSize but we have the information when
adding TIFF support.

what do you think?

marcus

---

#6787
[17 Sep 2000 6:07am] [EMAIL PROTECTED]
Hi Guys,

It seems that read_exif_data builds certain fields like
FileName, FileDateTime, FileSize etc .. even when no real
EXIF data exists. So read_exif_data will always return something!

This makes it a pain to test for the presence of actual EXIF data cause
I have to do something like this:

$exif_data = @read_exif_data($upload);
if (isset ($exif_data['CameraMake'])) {

Not very bullet proof 

Would be nice if it would not return anything without the presence of
actual EXIF data.

Thanks, Serge

#14994
[11 Jan 6:07am] [EMAIL PROTECTED]
I know, that Rasmus made the implementation for this function and that
he used the header readouts from an imageinfo.c, but I'm missing the
ability to identify TIFF images.
As i'm not firm with imageheaders, I'd like to ask someone to implement
this feature.




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




Re: [PHP-DEV] php + cygwin - some more

2002-03-03 Thread Marcus Boerger

At 15:29 03.03.2002, you wrote:
Ok, seeing that some people indeed do use cygwin to build PHP, here's
report about my achievements:

Just checked with new cygwin and it builds, compiles but does not link,
seem to be a problem with underscore generation. The cli executable
does not find its functionsmaybe i check this later

by the way i have now problems with php 4.1.1 and 4.1.2 but then came cli...

After upgrading cygwin to latest version (1.3.10-1) and all tools there
(autoconf 2.52, libtool 1.4e) and checking out latest CVS, it builds. Only
problems being:

1. line 187 of datetime.c - complains about timezone, since timezone is
defined as function in headers. Changed to _timezone, seems to work.

For me i have two errors in that file but i think we can add a type 
conversion to the resulttype.
So we only do anything for cygwin:

datetime.c: In function `php_mktime':
datetime.c:187: wrong type argument to unary minus
 gmadjust = -(is_dst ? (int)timezone - 3600 : (int)timezone);
see (int) conversion of timezone - gmadjust has type int

datetime.c: In function `php_date':
datetime.c:254: warning: assignment makes integer from pointer without a cast
 tzone = (long)timezone;
see (long) conversion of timezone - tzone has type long

  i think we can commit this to cvs anyone against? 

2. A lot of undefined symbols in XML modules. Rebuilt with
--without-xml, since no time to investigate further on this.

I do not use this with cygwin sorry

Besides that, builds php.exe cleanly. Still don't know if and how is
possible to build .dll for apache with cygwin.
--
Stanislav Malyshev, Zend Products Engineer
[EMAIL PROTECTED]  http://www.zend.com/ +972-3-6139665 ext.115



--
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] Bug #12856: dynamic default function parameter not possible

2001-08-20 Thread marcus . boerger

From: [EMAIL PROTECTED]
Operating system: 
PHP version:  4.0.6
PHP Bug Type: Feature/Change Request
Bug description:  dynamic default function parameter not possible

Hi all,

Why is it not possible to have dynamic default function parameters?

This would give the possibility to execute any code snippet when the
default value will be used in a function code.

At current time you can only define
function f( $v=statis_val) {
  return $v;
}

return f();
what would result in: static_val

BUT sometimes there must be a dynamic part. For example when dealing with
times. Consider the following:
function t( $v=null) {
if ($v===null) $v=time();
return date( r, $v);
}
return t();
what would return the current time formatted.

With dynamic defaults this would enable the following:
function t($v=time()) {
return date( r, $v);
}
return t();

Additionally that *should* be used to give access to global variables:
$d = time();
function t($v=$d) {
return date( r, $v);
}
return t(); // formatted time of script start..or given time

Another good idea would be to execute the variables from within context:
$d = 1;
function t($v=$d) {
return $v;
}
function t2() {
$d=2;
return t();
}
function t3($v=$GLOBALS['d']) {
return $v;
}
return t();   // -- 1
return t2();  // -- 2
return t3();  // -- 1

greetings marcus
-- 
Edit bug report at: http://bugs.php.net/?id=12856edit=1


-- 
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] Bug #12302: timezone,struct statfs,linking

2001-07-21 Thread marcus . boerger

From: [EMAIL PROTECTED]
Operating system: cygwin
PHP version:  4.0.6
PHP Bug Type: *Compile Issues
Bug description:  timezone,struct statfs,linking

I am trying to install php with gd,postgres,... to cygwin.
+timezone must be explicitly converted to long by typecast in
openssl/openssl.c 
in line 782 replace it with
gmadjust = -(thetime.tm_isdst ? (long)timezone - 3600 : (long)timezone +
3600);

same in standard/datetime.c (multiple occurences of same problem)

+ struct statfs not defined
included file sys/vfs.h in configure mechanism...

include following block at line 49 in statndard/filestat.h
#if defined(HAVE_SYS_VFS_H)
# include sys/vfs.h
#endif
--block end

+ leaving problem of creating the .so library
what ever i do there is a problem :-(
when working with original scripts the .a/.lai files are generated but make
install fails
-- 
Edit bug report at: http://bugs.php.net/?id=12302edit=1


-- 
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]