Re: [PHP-DEV] Re: #18824 [NEW]: PHP should produce an appropriate

2002-08-09 Thread Troels Arvin

On Fri, 09 Aug 2002 11:28:20 +0200, Rasmus Lerdorf wrote:

 Buffering should be transparent and should not have a different http
 status code from a non-buffered.

There are already differences with regard to output buffering or not. Like
the way cookie-setting should designed by the web developer.

But OK; it may be valid point, depending how transparent is interpreted.

Would it be difficult to add a configuration option which, when enabled,
makes PHP send an 500 HTTP response code _if possible_ in case of fatal
errors? if possible would probably mean if output buffering is on or if
no HTTP request body has been sent yet. I know that we would use such a
feature.

-- 
Greetings from Troels Arvin, Copenhagen, Denmark

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




[PHP-DEV] Patch suggestions for PHP 4.2.3 (sablotron and pcre)

2002-07-23 Thread Troels Arvin

Hello,

I have two patch suggestions for PHP 4.2.3. Both patches patch well into
PHP 4.2.2.


http://rpms.arvin.dk/php/source/patches/php-4.2.2-xslt-config.m4.patch
--

First part of the patch removes the iconv detection which simply doesn't
seem to work well; at least it didn't detect iconv built into glibc on my
Red Hat 7.3 system. This may be a bit controversial.

The second part of the patch is less controversial: Without the changes,
detection of SablotSetEncoding fails on my system (I have sablotron with
javascript enabled).


http://rpms.arvin.dk/php/source/patches/php-4.2.2-pcre.config.m4.patch
--

Without this patch, configure can't find pcre.h on my system (Red Hat
7.3) when pcre is compiled to use the system pcre library in stead of the
bundled pcre library.

-- 
Greetings from Troels Arvin, Copenhagen, Denmark

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




Re: [PHP-DEV] Fixes/suggestions for PHP 4.2.2

2002-06-24 Thread Troels Arvin

Hello Derick,

On Mon, 24 Jun 2002 10:48:56 +0200, derick wrote:
 I merged all suggested patches to the branch, and applied most of your
 patches
Thanks! - That will make my RPM-building process a bit easier.

 except for the pcre thing, as I don't know how this is supposed to work.
I'll try creating a proper patch for pcre's config.m4; hopefully in the
PHP 4.2.2 time frame.

 Thank you for submitting this, and if you may find anything else, feel
 free to write this list.
Actually, I have one more suggestion. See this patch:
http://rpms.arvin.dk/php/source/patches/php-4.2-info.c.patch

It clears up some potential misunderstandings in phpinfo()'s output.

Example:
phpinfo()'s Apache Version output prints the apache version present at
build-time. If PHP is built on a system with Apache 1.3.26, and then
installed on a system with an Apach 1.3.20, then phpinfo() will currently
write:
Apache Version: 1.3.26.

This is confusing, at best. And it could make some not-so-experienced
system administrators think that their Apache doesn't have the nasty
chunked encoding bug while, in fact, it has.

-- 
Greetings from Troels Arvin, Copenhagen, Denmark

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




[PHP-DEV] Re: [PHP-CVS] cvs: php4(PHP_4_2_0) /ext/mcal config.m4

2002-06-24 Thread Troels Arvin

On Mon, 24 Jun 2002 12:29:02 +0200, Jani Taskinen wrote:


 The real fix would be to
 fix PHP_ADD_LIBRARY_DEFER_WITH_PATH..

That's how it is in PHP 4.2.1, and it's buggy: The mcal library is linked
to the main PHP binary (e.g. libphp4.so) and not the the extension
(mcal.so).

Maybe there is a bug in PHP_ADD_LIBRARY_WITH_PATH?

-- 
Greetings from Troels Arvin, Copenhagen, Denmark

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




[PHP-DEV] Fixes/suggestions for PHP 4.2.2

2002-06-23 Thread Troels Arvin

Hello,

If PHP 4.2.2 is going to be released, then I have some suggestions:

I believe that the following changes to HEAD should be MFH'ed:

http://cvs.php.net/diff.php/php4/ext/gmp/config.m4?r1=1.6r2=1.7
http://cvs.php.net/diff.php/php4/ext/standard/link.c?r1=1.37r2=1.38
http://cvs.php.net/diff.php/php4/ext/standard/math.c?sbt=2r1=1.83r2=1.85
http://cvs.php.net/diff.php/php4/ext/mcrypt/mcrypt.c?r1=1.75r2=1.76
http://cvs.php.net/diff.php/php4/ext/standard/basic_functions.c?r1=1.478r2=1.479
http://cvs.php.net/diff.php/php4/ext/standard/string.c?r1=1.274r2=1.275
http://cvs.php.net/diff.php/php4/ext/standard/versioning.c?sbt=2r1=1.8r2=1.9

I also _seems_ that the May 17 changes in HEAD's sysvsem extension should
be MFH'ed.


I need the following patch for the mcal extension to build properly as a
shared module on my Linuxes:

http://rpms.arvin.dk/php/source/patches/php-4.2.1-mcal-shared.patch

It reverts a change made by sniper on April 3. Without the patch, then the
main PHP binary links to libmcal.so.0, but the PHP extension (mcal.so)
doesn't.


If I don't use the following patch, then the pcre extension will not build
with the system pcre library:

http://rpms.arvin.dk/php/source/patches/php-4.2.1-pcre.h.patch

The correct fix would probably be to add checks in pcre's config.m4 (see
if pcre.h is in /usr/local/include/pcre, /usr/local/include,
/usr/include/pcre, or /usr/include).


If I don't use the following patch, then make install will fail to
respect a prefix= argument when doing make install:
http://rpms.arvin.dk/php/source/patches/php-4.2.1-regression-tools.patch

-- 
Greetings from Troels Arvin, Copenhagen, Denmark

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




[PHP-DEV] Re: Output Compression Issues

2001-08-16 Thread Troels Arvin

On Thu, 16 Aug 2001 07:44:50 +0200, John Donagher [EMAIL PROTECTED]
wrote:

 So, we really want to disable output compression when we are serving
 anything but HTML/text.

I agree on that. I have heard that some older versions of both major
browsers have trouble with compressed non-HTML content. - Or perhaps the
ob_gzhandler could be given an argument telling it to be conservative or
not?


- Oh, and please:
Could someone take a look at this bug which I really think is serious:
http://www.php.net/bugs.php?id=12631

As written, it's currently not possible to send proper Content-Length
headers along with gz-encoded PHP-output because it's not possible to
get the correct output-length information when using the gzhandler.

When Content-Lengh headers are not sent, then Apache is not capable of
using keep-alive == worse performance.

There are lines like this in zlib.c:

#if 0
} else {
char lenbuf[64];

sprintf(lenbuf,Content-Length: %d,Z_STRLEN_P(return_value));
sapi_add_header(lenbuf,strlen(lenbuf), 1);
#endif

What does #if 0 actually mean?

If it's too hard to change the output buffering system to return proper
content lengths, maybe it would be an idea to be able to tell
ob_end_flush() that you want a Content-Length header to be sent along?
(It seems that ob_gzhandler knows the correct Content-Length but is
unable to pass that information along to the output buffering system.)

-- 
Greetings from Troels Arvin, Copenhagen, Denmark

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




Re: [PHP-DEV] Re: Output Compression Issues

2001-08-16 Thread Troels Arvin

On Thu, 16 Aug 2001 14:26:09 +0200, Zeev Suraski [EMAIL PROTECTED] wrote:
 Can anybody think of good reasons not to send the content-length header
 in case we're performing output buffering?

Personally: No.

- However, the docs for the output handling system seems to indicate
that output buffering filters may be nested. I could imagine that this
will pose troubles if Content-Length headers are sent along in each
output buffering module(?):
http://www.php.net/manual/en/function.ob-start.php

Quoting:

 Output buffers are stackable, that is, you may call ob_start() while 
 another ob_start() is active. Just make sure that you call 
 ob_end_flush() the appropriate number of times. If multiple output 
 callback functions are active, output is being filtered sequentially 
 through each of them in nesting order.

-- 
Greetings from Troels Arvin, Copenhagen, Denmark

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




Re: [PHP-DEV] Re: Bug #12241 Updated: imap.so: undefined symbol:

2001-08-05 Thread Troels Arvin

On Wed, 01 Aug 2001 03:04:29 +0200, Jani Taskinen [EMAIL PROTECTED]
wrote:

 I guess this problem exists only when it's configured as shared
 extension? If so, I know how to fix it..

I just tried the latest snapshot.

Now everything works.

One last strange thing:
The shared imap extension used to be called imap.so. Now it's called
imap.a. Personally, I don't care, but maybe it will cause some
confusion and a new wave of bug reports because people aren't aware that
their php.ini files need to be adjusted.

-- 
Greetings from Troels Arvin, Copenhagen, Denmark

-- 
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] Re: Shared imap extension..

2001-08-05 Thread Troels Arvin

On Sun, 05 Aug 2001 11:52:02 +0200, Jani Taskinen [EMAIL PROTECTED]
wrote:

The shared imap extension used to be called imap.so. Now it's called
imap.a. Personally, I don't care, but maybe it will cause some
 
 What was your configure line? It should create a .so NOT .a (works for
 me)
See below.

 Did you use phpize?
No.

PHP code-base:
PHP-snapshot php4-200108050135

Imap-devel package:
2000c. The package was built with ssl-support, but without kerberos
support, see
http://rpms.arvin.dk/imap-no_kerberos/
(Based on Red Hat Rawhide, but without Kerberos stuff.)

Contents of config.nice:
---
#! /bin/sh
#
# Created by configure

CFLAGS='-O2 -march=i686' \
CXXFLAGS='-O2 -march=i686' \
'./configure' \
'--prefix=/home/troels/local-php' \
'--without-mysql' \
'--disable-session' \
'--disable-xml' \
'--with-imap=shared' \
'--with-imap-ssl' \
'--without-pcre-regex' \
$@
---

Output from ./configure, relevant to this issue:
---
...
checking for IMAP support... yes, shared
...
creating ext/imap/Makefile
...
---

Output from make, relevant to this issue:
---
...
make[1]: Entering directory `/home/troels/temp2/php4-200108050135/ext'
Making all in imap
make[2]: Entering directory `/home/troels/temp2/php4-200108050135/ext/imap'
make[3]: Entering directory `/home/troels/temp2/php4-200108050135/ext/imap'
make[3]: Nothing to be done for `all-p'.
make[3]: Leaving directory `/home/troels/temp2/php4-200108050135/ext/imap'
make[2]: Leaving directory `/home/troels/temp2/php4-200108050135/ext/imap'
...
Making install in imap
make[2]: Entering directory `/home/troels/temp2/php4-200108050135/ext/imap'
make[3]: Entering directory `/home/troels/temp2/php4-200108050135/ext/imap'
make[3]: Nothing to be done for `install-p'.
make[3]: Leaving directory `/home/troels/temp2/php4-200108050135/ext/imap'
make[2]: Leaving directory `/home/troels/temp2/php4-200108050135/ext/imap'
...
---

The imap.a file contains one object-file: php_imap.o

Content of ext/imap/libs.mk:
---
include $(top_builddir)/config_vars.mk
LTLIBRARY_OBJECTS = $(LTLIBRARY_SOURCES:.c=.lo) $(LTLIBRARY_OBJECTS_X)
LTLIBRARY_SHARED_OBJECTS = $(LTLIBRARY_OBJECTS:.lo=.slo)
$(LTLIBRARY_SHARED_NAME): $(LTLIBRARY_SHARED_OBJECTS) $(LTLIBRARY_DEPENDENCIES)
$(SHARED_LIBTOOL) --mode=link $(COMPILE) $(LDFLAGS) -o $@ -avoid-version 
-module -rpath $(phplibdir) $(LTLIBRARY_LDFLAGS) $(LTLIBRARY_OBJECTS) 
$(LTLIBRARY_SHARED_LIBADD)
$(SHARED_LIBTOOL) --mode=install cp $@ $(phplibdir)

targets = $(LTLIBRARY_SHARED_NAME)
---

Content of ext/imap/imap.la:
---
# imap.la - a libtool library file
# Generated by ltmain.sh - GNU libtool 1.4 (1.920 2001/04/24 23:26:18)
#
# Please DO NOT delete this file!
# It is necessary for linking the library.

# The name that we can dlopen(3).
dlname=''

# Names of this library.
library_names=''

# The name of the static archive.
old_library='imap.a'

# Libraries that this one depends upon.
dependency_libs=' -lcrypto -lssl -lc-client'

# Version information for imap.
current=0
age=0
revision=0

# Is this an already installed library?
installed=no

# Files to dlopen/dlpreopen
dlopen=''
dlpreopen=''

# Directory that this library needs to be installed in:
libdir='/home/troels/temp2/php4-200108050135/modules'
---

Content of ext/imap/Makefile:
---
top_srcdir   = /home/troels/temp2/php4-200108050135
top_builddir = /home/troels/temp2/php4-200108050135
srcdir   = /home/troels/temp2/php4-200108050135/ext/imap
builddir = /home/troels/temp2/php4-200108050135/ext/imap
VPATH= /home/troels/temp2/php4-200108050135/ext/imap

LTLIBRARY_NAME= libimap.la
LTLIBRARY_SOURCES = php_imap.c
LTLIBRARY_SHARED_NAME = imap.la
LTLIBRARY_SHARED_LIBADD = $(IMAP_SHARED_LIBADD)

include $(top_srcdir)/build/dynlib.mk
---

-- 
Greetings from Troels Arvin, Copenhagen, Denmark

-- 
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] Re: Shared imap extension..

2001-08-05 Thread Troels Arvin

On Sun, 05 Aug 2001 11:52:02 +0200, Jani Taskinen [EMAIL PROTECTED]
wrote:

The shared imap extension used to be called imap.so. Now it's called
imap.a. Personally, I don't care, but maybe it will cause some
 
 What was your configure line? It should create a .so NOT .a (works for
 me)
See below.

 Did you use phpize?
No.

PHP code-base:
PHP-snapshot php4-200108050135

Imap-devel package:
2000c. The package was built with ssl-support, but without kerberos
support, see
http://rpms.arvin.dk/imap-no_kerberos/
(Based on Red Hat Rawhide, but without Kerberos stuff.)

Contents of config.nice:
---
#! /bin/sh
#
# Created by configure

CFLAGS='-O2 -march=i686' \
CXXFLAGS='-O2 -march=i686' \
'./configure' \
'--prefix=/home/troels/local-php' \
'--without-mysql' \
'--disable-session' \
'--disable-xml' \
'--with-imap=shared' \
'--with-imap-ssl' \
'--without-pcre-regex' \
$@
---

Output from ./configure, relevant to this issue:
---
...
checking for IMAP support... yes, shared
...
creating ext/imap/Makefile
...
---

Output from make, relevant to this issue:
---
...
make[1]: Entering directory `/home/troels/temp2/php4-200108050135/ext'
Making all in imap
make[2]: Entering directory `/home/troels/temp2/php4-200108050135/ext/imap'
make[3]: Entering directory `/home/troels/temp2/php4-200108050135/ext/imap'
make[3]: Nothing to be done for `all-p'.
make[3]: Leaving directory `/home/troels/temp2/php4-200108050135/ext/imap'
make[2]: Leaving directory `/home/troels/temp2/php4-200108050135/ext/imap'
...
Making install in imap
make[2]: Entering directory `/home/troels/temp2/php4-200108050135/ext/imap'
make[3]: Entering directory `/home/troels/temp2/php4-200108050135/ext/imap'
make[3]: Nothing to be done for `install-p'.
make[3]: Leaving directory `/home/troels/temp2/php4-200108050135/ext/imap'
make[2]: Leaving directory `/home/troels/temp2/php4-200108050135/ext/imap'
...
---

The imap.a file contains one object-file: php_imap.o

Content of ext/imap/libs.mk:
---
include $(top_builddir)/config_vars.mk
LTLIBRARY_OBJECTS = $(LTLIBRARY_SOURCES:.c=.lo) $(LTLIBRARY_OBJECTS_X)
LTLIBRARY_SHARED_OBJECTS = $(LTLIBRARY_OBJECTS:.lo=.slo)
$(LTLIBRARY_SHARED_NAME): $(LTLIBRARY_SHARED_OBJECTS) $(LTLIBRARY_DEPENDENCIES)
$(SHARED_LIBTOOL) --mode=link $(COMPILE) $(LDFLAGS) -o $@ -avoid-version 
-module -rpath $(phplibdir) $(LTLIBRARY_LDFLAGS) $(LTLIBRARY_OBJECTS) 
$(LTLIBRARY_SHARED_LIBADD)
$(SHARED_LIBTOOL) --mode=install cp $@ $(phplibdir)

targets = $(LTLIBRARY_SHARED_NAME)
---

Content of ext/imap/imap.la:
---
# imap.la - a libtool library file
# Generated by ltmain.sh - GNU libtool 1.4 (1.920 2001/04/24 23:26:18)
#
# Please DO NOT delete this file!
# It is necessary for linking the library.

# The name that we can dlopen(3).
dlname=''

# Names of this library.
library_names=''

# The name of the static archive.
old_library='imap.a'

# Libraries that this one depends upon.
dependency_libs=' -lcrypto -lssl -lc-client'

# Version information for imap.
current=0
age=0
revision=0

# Is this an already installed library?
installed=no

# Files to dlopen/dlpreopen
dlopen=''
dlpreopen=''

# Directory that this library needs to be installed in:
libdir='/home/troels/temp2/php4-200108050135/modules'
---

Content of ext/imap/Makefile:
---
top_srcdir   = /home/troels/temp2/php4-200108050135
top_builddir = /home/troels/temp2/php4-200108050135
srcdir   = /home/troels/temp2/php4-200108050135/ext/imap
builddir = /home/troels/temp2/php4-200108050135/ext/imap
VPATH= /home/troels/temp2/php4-200108050135/ext/imap

LTLIBRARY_NAME= libimap.la
LTLIBRARY_SOURCES = php_imap.c
LTLIBRARY_SHARED_NAME = imap.la
LTLIBRARY_SHARED_LIBADD = $(IMAP_SHARED_LIBADD)

include $(top_srcdir)/build/dynlib.mk
---

-- 
Greetings from Troels Arvin, Copenhagen, Denmark



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




Re: [PHP-DEV] Re: gmp_init with a base argument

2001-08-05 Thread Troels Arvin

On Thu, 02 Aug 2001 19:16:26 +0200, Stanislav Malyshev [EMAIL PROTECTED]
wrote:

 on the quick glance your patch looks OK.
OK. It seems that I don't have sufficient karma.

I tried to commit the below patch with the following commit message:
(gmp_init) Added extra (optional) argument to gmp_init():
   a base argument which indicates the number base. E.g.:
   gmp_init('1010101010',2); // feed gmp a binary value.
@- Added optional extra argument to gmp_init(). The extra argument
@  indicates which number base gmp should use when converting a
@  string to the gmp-number. (Troels)

Suggested patch is attached below (the patch is against current CVS).

/Troels

--- php4-orig/ext/gmp/gmp.c Sun Aug  5 12:51:42 2001
+++ php4/ext/gmp/gmp.c  Sun Aug  5 13:24:02 2001
@@ -178,7 +178,7 @@
 if(Z_TYPE_PP(zval) == IS_RESOURCE) { \
ZEND_FETCH_RESOURCE(gmpnumber, mpz_t *, zval, -1, GMP_RESOURCE_NAME, le_gmp);\
 } else {\
-   if(convert_to_gmp(gmpnumber,zval) == FAILURE) {\
+   if(convert_to_gmp(gmpnumber,zval,0) == FAILURE) {\
RETURN_FALSE;\
}\
ZEND_REGISTER_RESOURCE(NULL, gmpnumber, le_gmp);\
@@ -190,7 +190,7 @@
 
 /* {{{ convert_to_gmp
  * Convert zval to be gmp number */
-static int convert_to_gmp(mpz_t * *gmpnumber, zval **val) 
+static int convert_to_gmp(mpz_t * *gmpnumber, zval **val, int base) 
 {
int ret = 0;
 
@@ -207,11 +207,14 @@
case IS_STRING:
{
char *numstr = Z_STRVAL_PP(val);
-   if(numstr[0] == '0'  (numstr[1] == 'x' || numstr[1] == 'X')) 
{
-   ret = mpz_init_set_str(**gmpnumber, numstr+2, 16);
-   } else {
-   ret = mpz_init_set_str(**gmpnumber, numstr, 10);
+   if (base==0) {
+   if(numstr[0] == '0'  (numstr[1] == 'x' || numstr[1] 
+== 'X')) {
+   base=16;
+   } else {
+   base=10;
+   }
}
+   ret = mpz_init_set_str(**gmpnumber, numstr, base);
}
break;
default:
@@ -434,22 +437,30 @@
 }
 /* }}} */
 
-/* Remove the following function when you have succesfully modified config.m4
-   so that your module can be compiled into PHP, it exists only for testing
-   purposes. */
-
-/* {{{ proto resource gmp_init(mixed number)
+/* {{{ proto resource gmp_init(mixed number [, int base])
Initializes GMP number */
 ZEND_FUNCTION(gmp_init)
 {
-   zval **number_arg;
+   zval **number_arg, **base_arg;
mpz_t * gmpnumber;
+   int argc;
+   int base=0;
 
-   if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, number_arg) == FAILURE){
+   argc = ZEND_NUM_ARGS();
+   if (argc  1 || argc  2 || zend_get_parameters_ex(argc, number_arg, 
+base_arg) == FAILURE){
WRONG_PARAM_COUNT;
}
 
-   if(convert_to_gmp(gmpnumber,number_arg) == FAILURE) {
+   if (argc==2) {
+   convert_to_long_ex(base_arg);
+   base = Z_LVAL_PP(base_arg);
+   if(base  2 || base  36) {
+   zend_error(E_WARNING, Bad base for conversion: %d (should be 
+between 2 and 36), base);
+   RETURN_FALSE;
+   }
+   }
+
+   if(convert_to_gmp(gmpnumber,number_arg,base) == FAILURE) {
RETURN_FALSE;
}

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




Re: [PHP-DEV] Re: gmp_init with a base argument

2001-08-05 Thread Troels Arvin

On Thu, 02 Aug 2001 19:16:26 +0200, Stanislav Malyshev [EMAIL PROTECTED]
wrote:

 TA By the way:
 TA I think that the decbin() function should bail out if you pass it
 a TA value which contains more bits than PHP is able to handle. -
 Perhaps TA with a hint about using GMP for large numbers.
 
 I'd say give a warning istead of bail out, but that's a good idea,
 generally.

OK. Here is a suggestion for an adjustment in math.c. The patch could
probably be improved: The check for strings with more than 31 chars
should probably be less hard-coded, but I'm not sure which contant to
use for determining maximum size of a LONG.

/Troels

--- php4-orig/ext/standard/math.c   Sun Aug  5 12:51:38 2001
+++ php4/ext/standard/math.cSun Aug  5 12:52:35 2001
@@ -813,6 +813,11 @@
}
 
convert_to_string_ex(arg);
+
+   if ((*arg)-value.str.len  31) {
+   php_error(E_WARNING, bindec: input string too long (max is a 31-bit 
+value));
+   }
+
ret = _php_math_basetolong(*arg, 2);
 
RETVAL_LONG(ret);

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




Re: [PHP-DEV] Re: Bug #12241 Updated: imap.so: undefined symbol:

2001-08-01 Thread Troels Arvin

On Wed, 01 Aug 2001 03:04:29 +0200, Jani Taskinen [EMAIL PROTECTED]
wrote:

 I guess this problem exists only when it's configured as shared
 extension? 
True

 If so, I know how to fix it..
That would be great.

-- 
Greetings from Troels Arvin, Copenhagen, Denmark

-- 
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] gmp_init with a base argument

2001-07-30 Thread Troels Arvin

Hello,

Because decbin is limited to 31 bit values, I thought that the gmp
extension might be expanded a bit: If you add an optional base argument
to gmp, then we actually have a large number-bit decbin. I think that
would be nice.

Proposed patch below.
(The patch is for php 4.0.6; I can easily make one for php-cvs if
wanted.)

diff -u php-4.0.6-orig/ext/gmp/gmp.c php-4.0.6/ext/gmp/gmp.c
--- php-4.0.6-orig/ext/gmp/gmp.cThu May 24 14:41:52 2001
+++ php-4.0.6/ext/gmp/gmp.c Mon Jul 30 22:01:55 2001
@@ -160,7 +160,7 @@
 if(Z_TYPE_PP(zval) == IS_RESOURCE) { \
ZEND_FETCH_RESOURCE(gmpnumber, mpz_t *, zval, -1, GMP_RESOURCE_NAME, le_gmp);\
 } else {\
-   if(convert_to_gmp(gmpnumber,zval) == FAILURE) {\
+   if(convert_to_gmp(gmpnumber,zval,0) == FAILURE) {\
RETURN_FALSE;\
}\
ZEND_REGISTER_RESOURCE(NULL, gmpnumber, le_gmp);\
@@ -170,8 +170,8 @@
 #define INIT_GMP_NUM(gmpnumber) { gmpnumber=emalloc(sizeof(mpz_t)); 
mpz_init(*gmpnumber); }
 #define FREE_GMP_NUM(gmpnumber) { mpz_clear(*gmpnumber); efree(gmpnumber); }
 
-/* Convert zval to be gmp number */
-static int convert_to_gmp(mpz_t * *gmpnumber, zval **val) 
+/* Convert string to be gmp number */
+static int convert_to_gmp(mpz_t * *gmpnumber, zval **val, int base)
 {
int ret = 0;
 
@@ -188,11 +188,14 @@
case IS_STRING:
{
char *numstr = Z_STRVAL_PP(val);
-   if(numstr[0] == '0'  (numstr[1] == 'x' || numstr[1] == 'X')) 
{
-   ret = mpz_init_set_str(**gmpnumber, numstr+2, 16);
-   } else {
-   ret = mpz_init_set_str(**gmpnumber, numstr, 10);
+   if (base==0) {
+   if(numstr[0] == '0'  (numstr[1] == 'x' || numstr[1] 
+== 'X')) {
+   base=16;
+   } else {
+   base=10;
+   }
}
+   ret = mpz_init_set_str(**gmpnumber, numstr, base);
}
break;
default:
@@ -391,22 +394,31 @@
 }
 
 
-/* Remove the following function when you have succesfully modified config.m4
-   so that your module can be compiled into PHP, it exists only for testing
-   purposes. */
-
-/* {{{ proto resource gmp_init(mixed number)
+/* {{{ proto resource gmp_init(mixed number [, int base ])
Initializes GMP number */
 ZEND_FUNCTION(gmp_init)
 {
-   zval **number_arg;
+   zval **number_arg, **base_arg;
mpz_t * gmpnumber;
+   int argc;
+   int base=0;
 
-   if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, number_arg) == FAILURE){
+   argc = ZEND_NUM_ARGS();
+   if (argc  1 || argc  2 || zend_get_parameters_ex(argc, number_arg, 
+base_arg) == FAILURE){
WRONG_PARAM_COUNT;
}
 
-   if(convert_to_gmp(gmpnumber,number_arg) == FAILURE) {
+   if (argc==2) {
+   convert_to_long_ex(base_arg);
+   base = Z_LVAL_PP(base_arg);
+   }
+
+   if(base  2 || base  36) {
+   zend_error(E_WARNING, Bad base for conversion: %d (should be between 
+2 and 36), base);
+   RETURN_FALSE;
+   }
+
+   if(convert_to_gmp(gmpnumber,number_arg,base) == FAILURE) {
RETURN_FALSE;
}

-- 
Greetings from Troels Arvin, Copenhagen, Denmark

-- 
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] Re: Bug #12241 Updated: imap.so: undefined symbol: mxdriver in Unknown on line 0

2001-07-28 Thread Troels Arvin

On Thu, 19 Jul 2001 03:01:03 +0200, jmmele [EMAIL PROTECTED]
wrote:

 all the modules I compile are working but imap.so

I have found the same problem with PHP 4.0.6 - on two different Red Hat
Linux generations.

I know about all the tricks regarding --with-imap-ssl and
--with-imap-kerberos, but none of them helped. Neither did changing imap
version.

Now, I have found a hack which seems to work, for some strange reason:

Don't use --with-imap

Instead, after the rest of PHP has compiled, go to the php source-dir and
do:

gcc -fPIC -shared -DCOMPILE_DL_IMAP -DHAVE_IMAP \
  -I. -I./TSRM -I./main -I`/usr/include/apache -I./Zend \
  -I/usr/include/imap -I./ext/imap \
  `grep ^CPPFLAGS Zend/Makefile | cut -f2- -d=` -DHAVE_IMAP2000 \
  -DHAVE_IMAP_SSL ext/imap/php_imap.c -o modules/imap.so \
  -L.libs /usr/lib/c-client.a -lssl -lcrypto -lc

(Notice the _back_-ticks around the grep-expression.)

Note that there are no references to Kerberos. That's because I use a
version of imap-devel which doesn't have Kerberos bloat:
http://rpms.arvin.dk/imap-no_kerberos/

PS:
This php-imap problem did not exist in previous PHP versions.

-- 
Greetings from Troels Arvin, Copenhagen, Denmark

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




RE: [PHP-DEV] Security Issues

2001-07-27 Thread Troels Arvin

On Fri, 27 Jul 2001 23:00:54 +0200, Brian Tanner [EMAIL PROTECTED]
wrote:

 *If* there will be:
 
 $_Get[]
 $_Post[]
 $_Cookie[]
 
 -- can we also have something else to the tune of:
 
 $_External or $_User or $_Something

Important point. It's stupid if we suddenly have to hard-code for
GET/POST/cookie-generated data. The interesting bit is to be aware of
what data which has external origin.

-- 
Greetings from Troels Arvin, Copenhagen, Denmark

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




Re: [PHP-DEV] Mac OS X newline patch

2001-05-03 Thread Troels Arvin

On Wed, 02 May 2001 23:25:36 +0200, Andi Gutmans [EMAIL PROTECTED] wrote:

 Attached is a patch which should allow the scripting engine to also
 allow \r as line delimiters.
Thanks; it works. Bug #10578 has been closed.

 If someone on Mac OS X who has had
 problems can test this and send me feedback that would be great.
Note:
This was _not_ a Mac OS _X_ problem. It was general problem with
Mac-style newlines in text containing PHP code. Access to a Mac is not
needed to verify that the bug has been squashed.

-- 
Greetings from Troels Arvin, Copenhagen, Denmark

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




Re: [PHP-DEV] 4.0.6

2001-05-02 Thread Troels Arvin

On Wed, 02 May 2001 13:52:58 +0200, Andi Gutmans [EMAIL PROTECTED] wrote:

 I think we should make a list of known 4.0.5 bugs which need to be
 fixed for 4.0.6

I think that bug #10578 is a very serious problem which should be looked
at before thinking about releasing 4.0.6.

By the way:
The problem _could_ be related to bug #10609.

-- 
Greetings from Troels Arvin, Copenhagen, Denmark

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




Re: [PHP-DEV] Bug #10578: Serious: Mac line-feeds not recognized as linefeeds in code any more

2001-05-02 Thread Troels Arvin

On Tue, 01 May 2001 18:36:15 +0200, Ukendt domæne [EMAIL PROTECTED]
wrote:

 Demonstration and more information (including configure-command) at
 http://schmidt.tv2.dk/public/linefeedbug/

Zend/zend_language_scanner.l seems to have gone through some changes
between 4.0.4pl1 and 4.0.5 which could affect how PHP interprets
whitespace (including \r) in relation to one-line comments. However, I
have no lex knowledge.

-- 
Greetings from Troels Arvin, Copenhagen, Denmark

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