Re: [PHP-DEV] Tie'ing variables

2003-03-01 Thread Rasmus Lerdorf
> Analyzing PHP's routines a bit, it seems that the slowest part of a
> "generic" request is populating the special arrays, $_ENV, $_GET, etc.

Do you have any profiling evidence of this?  Everything I have looked at 
points squarely at the parts of PHP that requires a system call.  Reducing 
system calls gives you a lot more bang for the buck than optimizing 
elsewhere.

-Rasmus


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



[PHP-DEV] More Apache than PHP

2003-03-01 Thread Timothy Hitchens \(HiTCHO\)
Greetings All...

Usually I am helping others on the list but this time I am asking for
help!!

I was wondering if someone could offer some clarity for me as
my years of using Apache has never seen the following as a possibility.

Background: This server is using PHP along with Apache

If a server (entire box) was I/O bound and wasn't coping with the load
then
would Apache simple close the connection (I think this) or serve a 404
error.

The reason for asking this is not that I have gone Mad but that a
consulting firm is trying to tell us that our server is I/O bound
and serving 404 errors.  I just can't see how.

Thanks to all.


Timothy Hitchens (HiTCHO)
Web Application Consulting
e-mail: [EMAIL PROTECTED]


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



[PHP-DEV] session extension question

2003-03-01 Thread George Schlossnagle
Any feelings on a patch to the session extension so that if 
session_set_save_handler is passed a class or namespace as it's sole 
argument, it auto-registers class::open, class::close, class::read, 
class::write, class::destory and class::gc?

George

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


[PHP-DEV] [PATCH] - 64 bit issue with zend_parse_parameters calls

2003-03-01 Thread Dave Hill
Hi all, I am back again

Diff against php4-STABLE-200302241430
   (without the last patch I suggested)
Applies to 4.5.x and 5.x as well.
Affects any 64 bit OS.
I ran into another problem after I turned optimization back on. Usually
these are hell to find, but Julien Soula (who I met through the
bug database) had encountered this already.
This time I have a 64 bit issue with zend_parse_parameters().
Luckily the problem is not the implementation, rather the usage.
"s" -> needs a char *, int *
"l" -> needs a long *
Passing the wrong type into this function will have  unexpected
results... :-) In my case I was getting string lengths with random
values in the upper 32 bits making for strings a bit longer than
in reality.
I did a code inspection (helped by cscope) of the 480 hits,
checking what the types were passed for s & l entries. I did this
regardless of if I actually use the code - it was just easier to
look at them all, but this does mean that I will not be compile
testing all of them I have 26 changed files. I hope the
diff will work against 4.5.x and later because that was a lot of
files to inspect :-p
Where a type like size_t or an enum was used, I converted this to
a long. I did this because the function is defined as taking a
long, and in some cases (like enum) you may actually be getting
an int. Even in a case like size_t where you are probablly safe,
I have always found it to be safe then sorry.
Interestingly enough I did find one coding error, in
ext/w32api/w32api.c there are two calls with "s|l" and only
two arguments passed into the function, so heaven help anyone
who tries to pass that optional long :-) I guess it is lucky
that I am using Apache/Unix :-)
Per README.SUBMITTING_PATCH I am trying to copy all
of the extension owners.
Files affected:
   ./ext/domxml/php_domxml.c
   ./ext/fdf/fdf.c
   ./ext/ftp/php_ftp.c
   ./ext/ldap/ldap.c
   ./ext/mcrypt/mcrypt.c
   ./ext/mhash/mhash.c
   ./ext/pgsql/pgsql.c
   ./ext/posix/posix.c
   ./ext/dio/dio.c
   ./ext/sockets/sockets.c
   ./ext/standard/exec.c
   ./ext/standard/file.c
   ./ext/standard/fsock.c
   ./ext/standard/head.c
   ./ext/standard/html.c
   ./ext/standard/metaphone.c
   ./ext/standard/string.c
   ./ext/sysvsem/sysvsem.c
   ./ext/zlib/zlib.c
   ./ext/bz2/bz2.c
   ./ext/openssl/openssl.c
   ./ext/rpc/com/com.c
   ./ext/iconv/iconv.c
   ./ext/mbstring/mbstring.c
   ./ext/mbstring/php_mbregex.c
   ./ext/zip/zip.c
   ./main/output.c
--- php4-STABLE-200302241430/./ext/domxml/php_domxml.c  2003-01-10 13:11:03.0 
-0500
+++ php4-STABLE-200302241430.mod2/./ext/domxml/php_domxml.c 2003-03-01 
14:24:23.0 -0500
@@ -1967,7 +1967,8 @@
zval *rv = NULL;
zval *id;
xmlNode *n, *node;
-   int ret, recursive = 0;;
+   int ret; 
+   long recursive = 0;
 
DOMXML_GET_THIS_OBJ(n, id, le_domxmlnodep);
 
@@ -3558,7 +3559,8 @@
zval *arg1, *id, *rv = NULL;
xmlNodePtr node, srcnode;
xmlDocPtr docp;
-   int ret, recursive = 0;
+   int ret; 
+   long recursive = 0;
 
DOMXML_GET_THIS_OBJ(docp, id, le_domxmldocp);
 
@@ -3764,7 +3766,8 @@
int ret; 
char *buffer;
int buffer_len;
-   int mode = 0, prevSubstValue;
+   long mode = 0;
+   int prevSubstValue;
int oldvalue =  xmlDoValidityCheckingDefaultValue;
int oldvalue_keepblanks;
int prevLoadExtDtdValue = xmlLoadExtDtdDefaultValue;
@@ -3850,7 +3853,8 @@
xmlDoc *docp = NULL;
int ret, file_len;
char *file;
-   int mode = 0, prevSubstValue;
+   long mode = 0;
+   int prevSubstValue;
int oldvalue =  xmlDoValidityCheckingDefaultValue;
int oldvalue_keepblanks;
zval *errors = NULL;
@@ -5211,7 +5215,8 @@
xmlDocPtr xmldocp;
char *filename;
int filename_len;
-   int ret, compression = 0;
+   int ret;
+   long compression = 0;
 
DOMXML_GET_THIS(idxsl);
 
--- php4-STABLE-200302241430/./ext/fdf/fdf.c2002-12-31 12:15:19.0 -0500
+++ php4-STABLE-200302241430.mod2/./ext/fdf/fdf.c   2003-03-01 14:24:23.0 
-0500
@@ -554,7 +554,8 @@
 PHP_FUNCTION(fdf_get_ap) {
zval *r_fdf;
char *fieldname, *filename;
-   int fieldname_len, filename_len, face;
+   int fieldname_len, filename_len;
+   long face;
FDFDoc fdf;
FDFErc err;
FDFAppFace facenr;
@@ -941,7 +942,8 @@
 PHP_FUNCTION(fdf_get_flags) {
zval *r_fdf;
char *fieldname;
-   int fieldname_len, whichflags;
+   int fieldname_len;
+   long whichflags;
FDFDoc fdf;
FDFErc err;
ASUns32 flags;
@@ -997,7 +999,8 @@
 PHP_FUNCTION(fdf_get_opt) {
zval *r_fdf;
char *fieldname;
-   int fieldname_len, element = -1;
+   int fieldname_len;
+   long element = -1;
FDFDoc fdf;
FDFErc err;
 
--- php4-STABLE-200302241430/./ext/ftp/php_ftp.c2003-01-06 23:09:26.

[PHP-DEV] Re: main/network.c

2003-03-01 Thread Wez Furlong
Hi marcus,

Moriyoshi is going to revert the HAVE_INET_NTOP part;
I have to go out now, so I won't be able to address the warnings right
away, but will look at them later.

--Wez.

On Sat, 1 Mar 2003, Marcus [iso-8859-1] Börger wrote:

> Hi Wez,
>
> i cannot compile current network.c. The following patch fixes two warnings
> and one error
> but one warning is left:
> /usr/src/php4-HEAD/main/network.c: In function `php_network_accept_incoming':
> /usr/src/php4-HEAD/main/network.c:608: warning: `error' might be used
> uninitialized in this function
>
> If i understand code and message correct - then indeed this could be a real
> error because it is possible to return an uninitialised error code there.
>
> since you're the one knowing the correct default error codes i leave it up
> to you :-)
>
> regards
> marcus
>
> Index: main/network.c
> ===
> RCS file: /repository/php4/main/network.c,v
> retrieving revision 1.95
> diff -u -r1.95 network.c
> --- main/network.c  28 Feb 2003 21:03:36 -  1.95
> +++ main/network.c  1 Mar 2003 15:48:30 -
> @@ -434,6 +434,7 @@
>  break;
>  default:
>  /* Unknown family */
> +   socklen = 0; /* fix warning */
>  sa = NULL;
>  }
>
> @@ -493,7 +494,7 @@
>  }
>
>  if (textaddr) {
> -#if HAVE_IPV6 && HAVE_INET_NTOP
> +#if HAVE_IPV6
>  char abuf[256];
>   #endif
>  char *buf = NULL;
> @@ -711,6 +712,7 @@
>  break;
>  default:
>  /* Unknown family */
> +   socklen = 0; /* fix warning */
>  sa = NULL;
>  }
>
>
>
> --
> --
> Marcus Börger - Looking for all sorts of freelance work - just ask...
>
> Did i help you? Consider a gift:
> http://www.amazon.de/exec/obidos/wishlist/ho722v0rg1u0
> --
>
>
>


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



[PHP-DEV] main/network.c

2003-03-01 Thread Marcus Börger
Hi Wez,

i cannot compile current network.c. The following patch fixes two warnings 
and one error
but one warning is left:
/usr/src/php4-HEAD/main/network.c: In function `php_network_accept_incoming':
/usr/src/php4-HEAD/main/network.c:608: warning: `error' might be used 
uninitialized in this function

If i understand code and message correct - then indeed this could be a real
error because it is possible to return an uninitialised error code there.
since you're the one knowing the correct default error codes i leave it up 
to you :-)

regards
marcus
Index: main/network.c
===
RCS file: /repository/php4/main/network.c,v
retrieving revision 1.95
diff -u -r1.95 network.c
--- main/network.c  28 Feb 2003 21:03:36 -  1.95
+++ main/network.c  1 Mar 2003 15:48:30 -
@@ -434,6 +434,7 @@
break;
default:
/* Unknown family */
+   socklen = 0; /* fix warning */
sa = NULL;
}
@@ -493,7 +494,7 @@
}
if (textaddr) {
-#if HAVE_IPV6 && HAVE_INET_NTOP
+#if HAVE_IPV6
char abuf[256];
 #endif
char *buf = NULL;
@@ -711,6 +712,7 @@
break;
default:
/* Unknown family */
+   socklen = 0; /* fix warning */
sa = NULL;
}


--
--
Marcus Börger - Looking for all sorts of freelance work - just ask...
Did i help you? Consider a gift:
http://www.amazon.de/exec/obidos/wishlist/ho722v0rg1u0
--
--
PHP Development Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DEV] Tie'ing variables

2003-03-01 Thread Sterling Hughes
On Sat, 2003-03-01 at 13:09, Faisal Nasim wrote:
> At 10:26 PM 3/1/2003, Marcus Börger wrote:
> > At 18:11 01.03.2003, Derick Rethans wrote:
> > > On Sat, 1 Mar 2003, Sterling Hughes wrote:
> > > 
> > > > Analyzing PHP's routines a bit, it seems that the slowest part
> > > of a
> > > > "generic" request is populating the special arrays, $_ENV,
> > > $_GET, etc.
> > > >
> > > > I was wondering if it might be possible to "tie" these arrays to
> > > a
> > > > function (if you don't understand that, look at Perl for a
> > > definition).
> > > > One could populate them as an overloaded object, and then array
> > > accesses
> > > > would work - I guess.  But I would prefer a cleaner mechanism.
> > > 
> > > Why not just populate them when you need them? IE, if you access
> > > $_GET['foo'] it processes the GET data until it has processed upto
> > > foo
> > > in the data itself(and of course it adds the other ones that are
> > > before 'foo' in the GET data to the array too). With this you
> > > never
> > > process more data then you really need...
> > 
> > And for a quick start it would be enogh to simply initialize these
> > vars upon
> > first access. If we can do this the rest might be easy -> "devide
> > and conquer"!
> 
> Just had a thought. Wouldn't it be possible for some intermediate
> included script to change the data which is parsed and stored into
> $_GET (and family) upon first request?
> 

err, it already is possible for an included scripting to change the
value of $_GET variables.  I don't see what request order matters,
variables are parsed per-request.

-Sterling


> Faisal
-- 
"Science is like sex: sometimes something useful comes out, 
but that is not the reason we are doing it." 
- Richard Feynman


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



Re: [PHP-DEV] Tie'ing variables

2003-03-01 Thread Marcus Börger
At 18:11 01.03.2003, Derick Rethans wrote:
On Sat, 1 Mar 2003, Sterling Hughes wrote:

> Analyzing PHP's routines a bit, it seems that the slowest part of a
> "generic" request is populating the special arrays, $_ENV, $_GET, etc.
>
> I was wondering if it might be possible to "tie" these arrays to a
> function (if you don't understand that, look at Perl for a definition).
> One could populate them as an overloaded object, and then array accesses
> would work - I guess.  But I would prefer a cleaner mechanism.
Why not just populate them when you need them? IE, if you access
$_GET['foo'] it processes the GET data until it has processed upto foo
in the data itself(and of course it adds the other ones that are
before 'foo' in the GET data to the array too). With this you never
process more data then you really need...
And for a quick start it would be enogh to simply initialize these vars upon
first access. If we can do this the rest might be easy -> "devide and conquer"!
marcus

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


Re: [PHP-DEV] Tie'ing variables

2003-03-01 Thread Sterling Hughes
On Sat, 2003-03-01 at 12:11, Derick Rethans wrote:
> On Sat, 1 Mar 2003, Sterling Hughes wrote:
> 
> > Analyzing PHP's routines a bit, it seems that the slowest part of a
> > "generic" request is populating the special arrays, $_ENV, $_GET, etc.
> > 
> > I was wondering if it might be possible to "tie" these arrays to a
> > function (if you don't understand that, look at Perl for a definition). 
> > One could populate them as an overloaded object, and then array accesses
> > would work - I guess.  But I would prefer a cleaner mechanism.
> 
> Why not just populate them when you need them? IE, if you access 
> $_GET['foo'] it processes the GET data until it has processed upto foo 
> in the data itself(and of course it adds the other ones that are 
> before 'foo' in the GET data to the array too). With this you never 
> process more data then you really need...
> 

Err, that's exactly what I said. :)  That's what tieing a variable is,
it controls access to variables via a function.  An internal
implementation would probably look something like that (on the cgi sapi
at least, on the apache sapi it wouldn't).

-Sterling

> Derick
-- 
"A business that makes nothing but money is a poor kind of business." 
- Henry Ford


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



Re: [PHP-DEV] Tie'ing variables

2003-03-01 Thread Derick Rethans
On Sat, 1 Mar 2003, Sterling Hughes wrote:

> Analyzing PHP's routines a bit, it seems that the slowest part of a
> "generic" request is populating the special arrays, $_ENV, $_GET, etc.
> 
> I was wondering if it might be possible to "tie" these arrays to a
> function (if you don't understand that, look at Perl for a definition). 
> One could populate them as an overloaded object, and then array accesses
> would work - I guess.  But I would prefer a cleaner mechanism.

Why not just populate them when you need them? IE, if you access 
$_GET['foo'] it processes the GET data until it has processed upto foo 
in the data itself(and of course it adds the other ones that are 
before 'foo' in the GET data to the array too). With this you never 
process more data then you really need...

Derick

-- 
Stop mad cowboy disease!
-
 Derick Rethans http://derickrethans.nl/ 
 PHP Magazine - PHP Magazine for Professionals   http://php-mag.net/
-

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



Re: [PHP-DEV] Tie'ing variables

2003-03-01 Thread Moriyoshi Koizumi
George Schlossnagle <[EMAIL PROTECTED]> wrote:

> Having this sort of functionaility in general would be great.  I know 
> you can affect this with objects via overload, but it is useful for 
> scalars and arrays and streams as well.  It is pretty 'magical' though.

Then how about allowing access to object properties via square brackets 
like ECMA-Script? Though this will definitely add much more complexity to 
the Engine...

Moriyoshi

> George
> 
> On Saturday, March 1, 2003, at 11:26  AM, Sterling Hughes wrote:
> 
> > I was wondering if it might be possible to "tie" these arrays to a
> > function (if you don't understand that, look at Perl for a definition).
> > One could populate them as an overloaded object, and then array 
> > accesses
> > would work - I guess.  But I would prefer a cleaner mechanism.



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



Re: [PHP-DEV] Tie'ing variables

2003-03-01 Thread Sterling Hughes
On Sat, 2003-03-01 at 11:51, George Schlossnagle wrote:
> Having this sort of functionaility in general would be great.  I know 
> you can affect this with objects via overload, but it is useful for 
> scalars and arrays and streams as well.  It is pretty 'magical' though.
> 

Yeah - but just to be clear.  I'd be perfectly happy with this just
existing on an extension level.

-Sterling

PS:  I'd be for a user level api as well, but I don't have the energy to
fight that battle. :)

> -- 
> "Nothing is particularly hard if you divide it into small jobs." 
> - Henry Ford


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



Re: [PHP-DEV] Tie'ing variables

2003-03-01 Thread George Schlossnagle
Having this sort of functionaility in general would be great.  I know 
you can affect this with objects via overload, but it is useful for 
scalars and arrays and streams as well.  It is pretty 'magical' though.

George

On Saturday, March 1, 2003, at 11:26  AM, Sterling Hughes wrote:

I was wondering if it might be possible to "tie" these arrays to a
function (if you don't understand that, look at Perl for a definition).
One could populate them as an overloaded object, and then array 
accesses
would work - I guess.  But I would prefer a cleaner mechanism.


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


[PHP-DEV] Tie'ing variables

2003-03-01 Thread Sterling Hughes
Hi,

Analyzing PHP's routines a bit, it seems that the slowest part of a
"generic" request is populating the special arrays, $_ENV, $_GET, etc.

I was wondering if it might be possible to "tie" these arrays to a
function (if you don't understand that, look at Perl for a definition). 
One could populate them as an overloaded object, and then array accesses
would work - I guess.  But I would prefer a cleaner mechanism.

This would prevent a costly overhead for elements that don't really need
to be there, and yield only a slight performance cost when accessing
overloaded elements in these arrays.

-Sterling

-- 
"The computer programmer is a creator of universes for which he  
 alone is responsible. Universes of virtually unlimited complexity  
 can be created in the form of computer programs." 
- Joseph Weizenbaum


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



Re: [PHP-DEV] #php.bugs invite only?

2003-03-01 Thread Harald Radi


"Andi Gutmans" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:<[EMAIL PROTECTED]>...
> At 12:12 PM 2/28/2003 -0500, Ilia A. wrote:
> >On February 28, 2003 11:50 am, George Schlossnagle wrote:
> > > #php.bugs seems to be invite only now.  How do I go about getting
> > > myself invited?
> >
> >It would appear someone had accidentaly set the channel to invite only, it
is
> >fixed now.
> 
> I mailed Jani with the same question :)
> 
> Andi

but your bouncer was always in, zeev :)


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



[PHP-DEV] PHP 4 Bug Summary Report

2003-03-01 Thread php-dev
 PHP 4 Bug Database summary - http://bugs.php.net

 Num Status Summary (1051 total including feature requests)
===[*Configuration Issues]
19282 Wont fix   Place php4ts.dll into \sapi
20490 Analyzed   enable versioning not supported on OSX
20689 Wont fix   php_admin_value disable_functions not working as it should
21195 Verified   Configure warnings/errors
21216 Wont fix   phpize passes --no-verify to ltconfig without specifying host
21973 Open   'configure' script can't find libpng.(a|so), openldap, libjava...
22001 Wont fix   /php.ini is read instead of configured /usr/local/etc/php.ini !!!
22189 Open   Configuration file is not loaded, though PHP reports it is
===[*Database Functions]==
20946 Suspended  php_ingres.dll missing in the php 4 zip!!!
===[*Directory/Filesystem functions]
21310 Assigned   no such file (paths)
21532 Feedback   incorrect warning
===[*General Issues]==
20195 Open   make install doesnt set permissions
20775 Open   Silent install (/s) does not work
21254 Wont fix   Suggestion for the site
22047 Wont fix   PHP pollutes the namespace w/ (what looks like) its grammar tokens
22357 Feedback   exit signal Segmentation fault (11)
22472 Open   set_error_handler
===[*Languages/Translation]===
11975 Wont fix   mix of hebrew & english
13014 Wont fix   hebrevc ()
20166 Open   Unicode (Slovenian) characters are not displayed correctly
===[*Math Functions]==
21534 Open   GMP lib gmp_gcdext() gives incorrect results
===[*Network Functions]===
15639 Suspended  detecting end of UDP packets
===[*Programming Data Structures]=
21062 Wont fix   Recursive calls may SEGV
===[Apache related]===
15529 Open   ap_cleanup_for_exec not used when creating
17837 Wont fix   PHP 'handles' permission problems rather than letting Apache do it
19113 Open   HTTP status 200 returned on HTTP CONNECT when mod_proxy not in use
19292 Feedback   random error: open_basedir restriction in effect. File is in wrong 
directory
20190 Critical   Random mem corruption: zend_get_executed_filename() mismatch
20551 Feedback   Output compression causes segfaults (ob_gzhandler)
20665 Wont fix   Memory leaks on SIGHUP
21056 Feedback   PHP messes with virtual hosts
22154 Open   fpassthru() fails with files larger than a few hundered KB
22442 Open   auto_prepend_file not consistant
22480 Open   mod_php randomly displays source instead of script output
===[Apache2 related]==
17414 Open   Segfaults on restart
18359 Feedback   PHP module seem to make trouble with authentication under Apache 2
18957 Wont fixmultiple definitions
19618 Suspended  Cannot load libphp4.so - Win32 error 5
19787 Wont fix   Can not load module
21074 Open   PHP doesn't work with 401 (Auth) ErrorDocument and Apache2
21283 Open   Apache2 & PHP4.3 leak memory when respond to requests
21855 Open   Likely threading issue: Crash when using Apache 2.0 (worker model)
22072 Verified   connection_status() always returning 0
22273 Open   Cannot load libphp4.so into server: Unresolved external
22297 Feedback   Timeout when reading file from URL
22321 Open   Execute Bit and XBitHack seems to breaks PHP
22380 Feedback   Uploaded files automatically being deflated.
===[Arrays related]===
18829 Wont fix   array_pop, array_shift, array_push... functions very slow with large 
arrays
20251 Wont fix   Can't assign values to array in loop.
22463 Verified   array_reduce segmentation fault
===[CCVS related]=
10447 Wont fix   ccvs_*() functions segfault when given invalid session ID
===[CGI related]==
20896 Verified   php -w hangs indefinitely at 100% CPU
22127 Open   bogus http response when force-cgi-redirect safety mechanism triggered
22233 Assigned   "mod_gzip_on yes" makes force-cgi-redirect disabled and incorrect 
PHP_SELF
22270 Assigned   cgi binary parses itself when called directly
22291 Assigned   iisfunc extension crashes on shutdown
22440 Open   Bug with cookie in CGI not in ISAPI
===[Class/Object related]=
15675 Suspended  get_class() returns only lower chars
17637 Analyzed   constructors in classes (Back to PHP3)
20676 Verified   Reinitialization of a reference
22004 Open   Overload extension and _call() breaks classes.
22211 Feedback   Parameters not passed t

Re: [PHP-DEV] PHP_CHECK_FUNC and shared extension (OCI8)

2003-03-01 Thread Sascha Schumann
> how do I use PHP_CHECK_FUNC to make it work even when the extension is
> shared?

You can manipulate LDFLAGS directly:

php_save=$LDFLAGS
LDFLAGS="-L$dir $LDFLAGS"

.. check ..

LDFLAGS=$php_save

- Sascha

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



[PHP-DEV] PHP_CHECK_FUNC and shared extension (OCI8)

2003-03-01 Thread Michael Mauch
Hi,

how do I use PHP_CHECK_FUNC to make it work even when the extension is
shared?

In ext/oci8/config.m4, if I use

  PHP_ADD_LIBPATH($OCI8_DIR/lib, OCI8_SHARED_LIBADD)
  PHP_CHECK_FUNC(OCILobIsTemporary, clntsh, ocijdbc8)

it works when configured --with-oci8, but not with --with-oci8=shared.
With --with-oci8=shared, the test case in configure does not give
-L$OCI8_DIR/lib to gcc, so it cannot work.

My previous approach:

  AC_SEARCH_LIBS(OCILobIsTemporary, ocijdbc8, [
PHP_ADD_LIBRARY(ocijdbc8, 1, OCI8_SHARED_LIBADD)
  ], [ ], -lclntsh)
  
suffers from the same problem.

Apparently, I'm something missing here.


FWIW, I append a patch for current 4.3.2-dev, although I have not been
able to test it on anything else then Linux with Oracle 8.1.6. The patch
should not affect those systems that find OCILobIsTemporary with
-lclntsh alone. --with-oci8=shared should be no problem there, although
the configure messages

  checking for OCILobIsTemporary in -lclntsh... no
  checking for __OCILobIsTemporary in -lclntsh... no
  checking for OCILobIsTemporary in -locijdbc8... no
  checking for __OCILobIsTemporary in -locijdbc8... no

are misleading. On Tru64 (where OCILobIsTemporary needs -locijdbc8), it
should work --with-oci8, but still not --with-oci8=shared.

In case somebody wants to test the patch, I put a bzip'ed configure
(built with autoconf 2.13, automake 1.5, libtool 1.4.3) on
.

Prehistory:





Regards...
Michael

--- ext/oci8/config.m4.orig Sat Mar  1 13:06:55 2003
+++ ext/oci8/config.m4  Sat Mar  1 13:15:37 2003
@@ -89,12 +89,14 @@
 8.1)
   PHP_ADD_LIBRARY(clntsh, 1, OCI8_SHARED_LIBADD)
 
-dnl This breaks build on some systems (AIX at least).
-dnl   if test -f $OCI8_DIR/lib/libocijdbc8.so ; then
-dnl PHP_ADD_LIBRARY(ocijdbc8, 1, OCI8_SHARED_LIBADD)
-dnl   fi
-
   PHP_ADD_LIBPATH($OCI8_DIR/lib, OCI8_SHARED_LIBADD)
+
+  dnl Does not work with --with-oci8=shared on those
+  dnl systems (e.g. Tru64) where OCILobIsTemporary is found in
+  dnl libocijdbc8.so.
+  dnl
+  PHP_CHECK_FUNC(OCILobIsTemporary, clntsh, ocijdbc8)
+
   AC_DEFINE(HAVE_OCI8_TEMP_LOB,1,[ ])
   AC_DEFINE(HAVE_OCI8_SHARED_MODE,1,[ ])
 
@@ -107,12 +109,14 @@
 9.0)
   PHP_ADD_LIBRARY(clntsh, 1, OCI8_SHARED_LIBADD)
 
-dnl This breaks build on some systems (AIX at least)
-dnl if test -f $OCI8_DIR/lib/libocijdbc8.so ; then
-dnl   PHP_ADD_LIBRARY(ocijdbc8, 1, OCI8_SHARED_LIBADD)
-dnl fi
-
   PHP_ADD_LIBPATH($OCI8_DIR/lib, OCI8_SHARED_LIBADD)
+
+  dnl Does not work with --with-oci8=shared on those
+  dnl systems (e.g. Tru64) where OCILobIsTemporary is found in
+  dnl libocijdbc8.so.
+  dnl
+  PHP_CHECK_FUNC(OCILobIsTemporary, clntsh, ocijdbc9)
+
   AC_DEFINE(HAVE_OCI8_TEMP_LOB,1,[ ])
   AC_DEFINE(HAVE_OCI8_ATTR_STATEMENT,1,[ ])
   AC_DEFINE(HAVE_OCI8_SHARED_MODE,1,[ ])

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



Re: [PHP-DEV] ZE2 constructors

2003-03-01 Thread Andi Gutmans
The patch look OK. Go ahead and commit it.
Andi
At 08:20 PM 2/28/2003 +0100, Marcus Börger wrote:
Hi Zeev,

according to the plans the following test file should PASS:


--TEST--
The new constructor/destructor is called
--SKIPIF--

--FILE--


class early {
function early() {
echo "early::early\n";
}
function __construct() {
echo "early::__construct\n";
}
function __destruct() {
echo "early::__destruct\n";
}
}
class late {
function __construct() {
echo "late::__construct\n";
}
function late() {
echo "late::late\n";
}
function __destruct() {
echo "late::__destruct\n";
}
}
$t = new early();
$t->early();
unset($t);
$t = new late();
$t->late();
//unset($t); delay to end of script
echo "Done\n";
?>
--EXPECTF--
early::__construct
early::early
early::__destruct
late::__construct
late::late
Done
late::__destruct
#
However it fails and this patch is needed which also fixees the last final 
problem
mentioned already:

#
Index: Zend/zend_compile.c
===
RCS file: /repository/ZendEngine2/zend_compile.c,v
retrieving revision 1.375
diff -u -r1.375 zend_compile.c
--- Zend/zend_compile.c 25 Feb 2003 10:03:26 -  1.375
+++ Zend/zend_compile.c 28 Feb 2003 19:14:52 -
@@ -916,6 +916,9 @@
&& ((current_access_type->u.constant.value.lval & 
ZEND_ACC_PPP_MASK) != (new_modifier->u.constant.value.lval & 
ZEND_ACC_PPP_MASK))) {
zend_error(E_COMPILE_ERROR, "Multiple access type 
modifiers are not allowed");
}
+   if (((current_access_type->u.constant.value.lval | 
new_modifier->u.constant.value.lval) & (ZEND_ACC_ABSTRACT | 
ZEND_ACC_FINAL)) == (ZEND_ACC_ABSTRACT | ZEND_ACC_FINAL)) {
+   zend_error(E_COMPILE_ERROR, "Cannot use the final modifier 
on an abstract class member");
+   }
if (((current_access_type->u.constant.value.lval | 
new_modifier->u.constant.value.lval) & (ZEND_ACC_PRIVATE | 
ZEND_ACC_FINAL)) == (ZEND_ACC_PRIVATE | ZEND_ACC_FINAL)) {
zend_error(E_COMPILE_ERROR, "Cannot use the final 
modifier on a private class member");
}
@@ -974,7 +977,7 @@
fn_flags |= ZEND_ACC_PUBLIC;
}

-   if ((short_class_name_length == name_len) && 
(!memcmp(short_class_name, name, name_len))) {
+   if ((short_class_name_length == name_len) && 
(!memcmp(short_class_name, name, name_len)) && 
!CG(active_class_entry)->constructor) {
CG(active_class_entry)->constructor = 
(zend_function *) CG(active_op_array);
} else if ((function_name->u.constant.value.str.len == 
sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) && 
(!memcmp(function_name->u.constant.value.str.val, 
ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME {
CG(active_class_entry)->constructor = 
(zend_function *) CG(active_op_array);
#

regards
marcus


--
--
Marcus Börger - Looking for all sorts of freelance work - just ask...
Did i help you? Consider a gift:
http://www.amazon.de/exec/obidos/wishlist/ho722v0rg1u0
--


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