Re: [PHP-DEV] Garbage Collection!

2002-05-17 Thread Robert Cummings

Zeev Suraski wrote:
> 
> If you're adding elements to a hash you created using array_init(), and
> you're using the standard macros (which apparently you are) - then yes, the
> engine will take care of garbage collection for you.

Thanks a lot, this is what I needed to know, I guess somehow I have
allocation going on somewhere else.

Cheers,
Rob.
-- 
.-----.
| Robert Cummings |
:-`.
| Webdeployer - Chief PHP and Java Programmer  |
:--:
| Mail  : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109 |
:--:
| Website : http://www.webmotion.com   |
| Fax : (613) 260-9545 |
`--'

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




Re: [PHP-DEV] Garbage Collection!

2002-05-17 Thread Robert Cummings

Zeev Suraski wrote:
> 
> At 09:04 PM 5/17/2002, Robert Cummings wrote:
> >To be honest I'm passing the return_value into my recursion
> 
> Not sure what you mean by that - return_value is handled by the engine as
> soon as you return from your function implementation, if that's what you're
> asking.  If you're using it internally, then you're responsible for it
> until you return from your code.

Well I'm creating a nested hash that I want to return ultimately, so
at my first recursive step I pass return_value as the hash to be filled.
However at various steps in the recursion I add elements to the hash that
overwrite default values. So my question is whether during this recursive
process does the garbage collector run when I overwrite a hash entry?
Hope that clears things up.

Cheers,
Rob.
-- 
.-.
| Robert Cummings |
:-`.
| Webdeployer - Chief PHP and Java Programmer  |
:--:
| Mail  : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109 |
:--:
| Website : http://www.webmotion.com   |
| Fax : (613) 260-9545 |
`--'

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




Re: [PHP-DEV] Garbage Collection!

2002-05-17 Thread Robert Cummings

Zeev Suraski wrote:
> 
> At 08:53 PM 5/17/2002, Robert Cummings wrote:
> >Let's say I do:
> >
> > zval *newVar;
> > MAKE_STD_ZVAL( newVar );
> > ZEND_SET_SYMBOL( &EG(symbol_table), "varKey", newVar );
> >
> >and then I do:
> >
> > MAKE_STD_ZVAL( newVar );
> > ZEND_SET_SYMBOL( &EG(symbol_table), "varKey", newVar );
> >
> >This will overwrite my orignal newVar, however, will the original
> >newVar be garbaged collected or is this my responsibility now that
> >I'm out of PHP land? Also if it is auto garbage collected, is there
> >a way I can force garbage collection to run while I'm in a deep
> >recursion?
> 
> Whatever you register into the standard data structures, EG(symbol_table)
> included, is taken care of by the engine.  In that case, the old value will
> be destroyed as soon as you replace it in the 2nd SET_SYMBOL call.

To be honest I'm passing the return_value into my recursion
- is the same true of it? I ask because I watched my memory
consumption climb to over 500MB and all I use is
MAKE_STD_ZVAL( newVar ) and insert into some depth of the
recursion initially stored into return_value for the
calling function. My initial assumption was that indeed this
stuff is garbage collected... but maybe I'm doing something
wrong if this is collected at the moment of overwrite and
I'm seeing such massive allocations using top.

Cheers,
Rob.
-- 
.-.
| Robert Cummings |
:-`.
| Webdeployer - Chief PHP and Java Programmer  |
:--:
| Mail  : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109 |
:--:
| Website : http://www.webmotion.com   |
| Fax : (613) 260-9545 |
`--'

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




[PHP-DEV] Garbage Collection!

2002-05-17 Thread Robert Cummings

Let's say I do:

zval *newVar;
MAKE_STD_ZVAL( newVar );
ZEND_SET_SYMBOL( &EG(symbol_table), "varKey", newVar );

and then I do:

MAKE_STD_ZVAL( newVar );
ZEND_SET_SYMBOL( &EG(symbol_table), "varKey", newVar );

This will overwrite my orignal newVar, however, will the original
newVar be garbaged collected or is this my responsibility now that
I'm out of PHP land? Also if it is auto garbage collected, is there
a way I can force garbage collection to run while I'm in a deep
recursion?

Cheers,
Rob.
-- 
.-.
| Robert Cummings |
:-`.
| Webdeployer - Chief PHP and Java Programmer  |
:--:
| Mail  : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109 |
:--:
| Website : http://www.webmotion.com   |
| Fax : (613) 260-9545 |
`--'

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




[PHP-DEV] Help please.

2002-05-16 Thread Robert Cummings

Is there someplace other than:

http://www.php.net/manual/en/zend.php

Where I can get more advanced information about how the engine
itself works. While I've made some extensions I was recently
wondering if perhaps I've done some things wrong (no doubt I have).
For instance... Let's say I do:

zval *newVar;
MAKE_STD_ZVAL( newVar );
ZEND_SET_SYMBOL( &EG(symbol_table), "varKey", newVar );

and then for some unknown reason not particularly important
for this discussion I do the following:

MAKE_STD_ZVAL( newVar );
ZEND_SET_SYMBOL( &EG(symbol_table), "varKey", newVar );

This will overwrite my orignal newVar, however, will the original
newVar be garbaged collected or is this my responsibility now that
I'm out of PHP land? Also if it is auto garbage collected, is there
a way I can force garbage collection to run while I'm in a deep
recursion?

Cheers,
Rob.
-- 
.-.
| Robert Cummings |
:-`.
| Webdeployer - Chief PHP and Java Programmer  |
:--:
| Mail  : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109 |
:--:
| Website : http://www.webmotion.com   |
| Fax : (613) 260-9545 |
`--'

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




[PHP-DEV] Information request.

2002-05-15 Thread Robert Cummings

I apologize for double posting this, until today I didn't
realize replying-to and clearing the subject line caused me
to thread into the previous message, in other words I didn't
know that a reference was sent via the headers.
--

Is there someplace other than:

http://www.php.net/manual/en/zend.php

Where I can get more advanced information about how the engine
itself work. While I've made some extensions I was recently
wondering if perhaps I've done some things wrong (no doubt I have).
For instance... Let's say I do:

zval *newVar;
MAKE_STD_ZVAL( newVar );
ZEND_SET_SYMBOL( &EG(symbol_table), "varKey", newVar );

and then for some unknown reason not particularly important
for this discussion I do the following:

MAKE_STD_ZVAL( newVar );
ZEND_SET_SYMBOL( &EG(symbol_table), "varKey", newVar );

This will overwrite my orignal newVar, however, will the original
newVar be garbaged collected or is this my responsibility now that
I'm out of PHP land? Also if it is auto garbage collected, is there
a way I can force garbage collection to run while I'm in a deep
recursion?

Cheers,
Rob.
-- 
.-.
| Robert Cummings |
:-`.
| Webdeployer - Chief PHP and Java Programmer  |
:--:
| Mail  : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109 |
:--:
| Website : http://www.webmotion.com   |
| Fax : (613) 260-9545 |
`--'

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




[PHP-DEV] Information request.

2002-05-15 Thread Robert Cummings

Is there someplace other than:

http://www.php.net/manual/en/zend.php

Where I can get more advanced information about how the engine
itself work. While I've made some extensions I was recently
wondering if perhaps I've done some things wrong (no doubt I have).
For instance... Let's say I do:

zval *newVar;
MAKE_STD_ZVAL( newVar );
ZEND_SET_SYMBOL( &EG(symbol_table), "varKey", newVar );

and then for some unknown reason not particularly important
for this discussion I do the following:

MAKE_STD_ZVAL( newVar );
ZEND_SET_SYMBOL( &EG(symbol_table), "varKey", newVar );

This will overwrite my orignal newVar, however, will the original
newVar be garbaged collected or is this my responsibility now that
I'm out of PHP land? Also if it is auto garbage collected, is there
a way I can force garbage collection to run while I'm in a deep
recursion?

Cheers,
Rob.
-- 
.-.
| Robert Cummings |
:-`.
| Webdeployer - Chief PHP and Java Programmer  |
:--:
| Mail  : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109 |
:--:
| Website : http://www.webmotion.com   |
| Fax : (613) 260-9545 |
`--'

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




Re: [PHP-DEV] Probably a simple answer...

2002-05-14 Thread Robert Cummings

Simon Fogg wrote:
> 
> That's o.k.- I'm just grouchy. There seems to be so much information to wade
> through to find out what you need to know.
> 
> Since we are on the subject though, and you have already done this sort of
> thing before, can you tell me whether extensions are supported on MacOSX. My
> Mac colleague is off sick today and since I am looking at finding a fairly
> X-Plaform solution to our problem, I thought it would be beneficial if I
> could find out whether the same solution could be used on a Mac.

I don't see why not provided you are able to compile PHP. As long as you
can compile PHP your extension "should" compile into a Mac native binary.
All you should need to do is create wrapper functions around your current
library to make them accessible via PHP in your extension. If you're like me
you will compile this directly into the PHP binary itself, and then I don't
think you will need any other binaries. Alternatively, since you are
comparing this to window's DLLs I think you can compile as a shared library,
but I don't know much about that route and wouldn't advise it since as
far as I know it runs like CGI.

Cheers,
Rob.
-- 
.-.
| Robert Cummings |
:-`.
| Webdeployer - Chief PHP and Java Programmer  |
:--:
| Mail  : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109 |
:--:
| Website : http://www.webmotion.com   |
| Fax : (613) 260-9545 |
`--'

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




Re: [PHP-DEV] Probably a simple answer...

2002-05-14 Thread Robert Cummings

Simon Fogg wrote:
> 
> I believe you hijacked my thread - The original subject was: 'Creating
> extension module for PHP'!

I was asking about specific information about specific functionality,
your thread asks about how to write an extension... I already know how
and have done so, I'd just like to know more about what I'm doing and
since there isn't much in the way of docs for doing so, then sometimes
I need to clear things up here. I apologize if it appears I hijacked
your thread..

Cheers,
Rob.
-- 
.-----.
| Robert Cummings |
:-`.
| Webdeployer - Chief PHP and Java Programmer  |
:--:
| Mail  : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109 |
:--:
| Website : http://www.webmotion.com   |
| Fax : (613) 260-9545 |
`--'

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




Re: [PHP-DEV] Probably a simple answer...

2002-05-14 Thread Robert Cummings

Robert Cummings wrote:
> 
> brad lafountain wrote:
> >
> > Well i do believe that the zval string SHOULD be null termiated and have the
> > length stored.
> 
> You would think so, but on further thought, if that were the case you
> wouldn't be able to store compressed data from gzip in a string because
> the null bytes everywhere would interfere. Also, as I said, ZVAL_STRING
> suggests that this is so... since when you use it to set a zval container
> to a string it saves the length as strlen( passedString ), rather
> than strlen( passedString ) + 1, also the memcpy then uses this length
^^
I just took another look at ZVAL_STRING and it uses estrndup and
not memcpy... maybe I'm losing my mind :)

Cheers,
Rob.
-- 
.-.
| Robert Cummings |
:-`.
| Webdeployer - Chief PHP and Java Programmer  |
:--:
| Mail  : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109 |
:--:
| Website : http://www.webmotion.com   |
| Fax : (613) 260-9545 |
`--'

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




Re: [PHP-DEV] Probably a simple answer...

2002-05-14 Thread Robert Cummings

brad lafountain wrote:
> 
> Well i do believe that the zval string SHOULD be null termiated and have the
> length stored.
> 
>  But zend does provied this api function
> 
> zend_binary_zval_strcmp(zval *, zval*);

Oh and I almost forgot... THANKS... this appears to be exactly
what I was looking for :)

Cheers,
Rob.
-- 
.-----.
| Robert Cummings |
:-`.
| Webdeployer - Chief PHP and Java Programmer  |
:--:
| Mail  : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109 |
:--:
| Website : http://www.webmotion.com   |
| Fax : (613) 260-9545 |
`--'

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




Re: [PHP-DEV] Probably a simple answer...

2002-05-14 Thread Robert Cummings

brad lafountain wrote:
> 
> Well i do believe that the zval string SHOULD be null termiated and have the
> length stored.

You would think so, but on further thought, if that were the case you
wouldn't be able to store compressed data from gzip in a string because
the null bytes everywhere would interfere. Also, as I said, ZVAL_STRING
suggests that this is so... since when you use it to set a zval container
to a string it saves the length as strlen( passedString ), rather
than strlen( passedString ) + 1, also the memcpy then uses this length
to copy the string if you set the copy flag to true.

Cheers,
Rob.


> 
>  But zend does provied this api function
> 
> zend_binary_zval_strcmp(zval *, zval*);
> 
>  - Brad
> 
> --- Robert Cummings <[EMAIL PROTECTED]> wrote:
> > zval containers that are of string type don't seem to hold
> > a null terminating character, but rather directly store the
> > length of the string - I note this because of how the
> > ZVAL_STRING macro works... My question then is what is the
> > best way to compare two strings in a zval? I would imagine
> > a macro or function would already exist, and I'm quite sure
> > that the following simple invocation is asking for trouble:
> >
> > strcmp( Z_STRVAL_P( target1 ), Z_STRVAL_P( target2 ) ) == 0
> >
> > Thanks for any information.
> >
> > Cheers,
> > Rob.
> > --
> > .-.
> > | Robert Cummings |
> > :-`.
> > | Webdeployer - Chief PHP and Java Programmer  |
> > :--:
> > | Mail  : mailto:[EMAIL PROTECTED] |
> > | Phone : (613) 731-4046 x.109 |
> > :--:
> > | Website : http://www.webmotion.com   |
> > | Fax : (613) 260-9545 |
> > `--'
> >
> > --
> > PHP Development Mailing List <http://www.php.net/>
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> 
> __
> Do You Yahoo!?
> LAUNCH - Your Yahoo! Music Experience
> http://launch.yahoo.com

-- 
.-.
| Robert Cummings |
:-`.
| Webdeployer - Chief PHP and Java Programmer  |
:--:
| Mail  : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109 |
:--:
| Website : http://www.webmotion.com   |
| Fax : (613) 260-9545 |
`--'

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




[PHP-DEV] Probably a simple answer...

2002-05-14 Thread Robert Cummings

zval containers that are of string type don't seem to hold
a null terminating character, but rather directly store the
length of the string - I note this because of how the
ZVAL_STRING macro works... My question then is what is the
best way to compare two strings in a zval? I would imagine
a macro or function would already exist, and I'm quite sure
that the following simple invocation is asking for trouble:

strcmp( Z_STRVAL_P( target1 ), Z_STRVAL_P( target2 ) ) == 0

Thanks for any information.

Cheers,
Rob.
-- 
.-.
| Robert Cummings |
:-`.
| Webdeployer - Chief PHP and Java Programmer  |
:--:
| Mail  : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109 |
:--:
| Website : http://www.webmotion.com   |
| Fax : (613) 260-9545 |
`--'

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




Re: [PHP-DEV] feature request for __LINE__, __FILE__ and trigger_error

2002-04-26 Thread Robert Cummings


I wrote this extension a while back, but I never released it since
I didn't follow coding style and it was my first forage into extension
coding for PHP. It should be what your looking for though for the
most part... the function of usefulness is: get_function_call_stack()
which will return an array with the call stack for the current function
which includes the calling file, funcion and line number. Use a print_r()
on the results to get a better idea. Please don't flame me for not
releasing or following coding style.

Cheers,
Rob.
-

[EMAIL PROTECTED] wrote:
> 
> Addressed to: [EMAIL PROTECTED]
>   [EMAIL PROTECTED]
> 
> ** Reply to note from [EMAIL PROTECTED] Wed, 24 Apr 2002 21:06:41 +0200 (CEST)
> >
> > Hello Michael,
> >
> > I'm working (80% done) on an extension for this. It should be finished in
> >  a few days. It doesn't feature the __C*__ things yet, but I can add a
> > function for that too.
> >
> > I'll keep you posted,
> 
> 
> 
> Thanks, I've wished for this for a long time!

-- 
.-.
| Robert Cummings |
:-`.
| Webdeployer - Chief PHP and Java Programmer  |
:--:
| Mail  : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109 |
:--:
| Website : http://www.webmotion.com   |
| Fax : (613) 260-9545 |
`--'


ftrace.tar.gz
Description: GNU Zip compressed data

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


Re: [PHP-DEV] The PHP Platform

2002-04-16 Thread Robert Cummings

I keep hearing a lot of "my company this in microsoft" and "my company that"
and "blah blah blah". I'm sorry, but if the fullfillment of all your dreams
are in your company then you live a sad, sad life. The future is what you make
of it, and each and every person has the power to contribute to change what
may be.

Cheers,
Rob.


Dave Mertens wrote:
> 
> On Tue, Apr 16, 2002 at 07:57:26AM -0700, brad lafountain wrote:
> > > --- Dave Mertens <[EMAIL PROTECTED]> wrote:
> > > But the fact the PHP don't have a proper XML parser, only a scripting SOAP
> > > parser
> >
> >  Well i currently am working on a soap c extension for php (ext/soap). Its
> > pretty fast. And with other technologies like ext/session and ext/msession I
> > have created a way to create a cluster of soap object with each soap request
> > not needing to got the same machine. My extension is in a 'alpha' stage right
> > now. I am working on a website and docuementation right now. After that im
> > going to clean up the code and release an alpha release. I'll definly email
> > this list when i get something i want to release.
> 
> I didn't know there was an native SOAP parses in PHP. I hope it will become 
>production soon, so i can start using it.
> 
> But than on the other hand XML is still very poor in PHP. And the relation between 
>SOAP and XML is very tight.
> 
> But i'm not trying to trap someone into the floor, i'm only saying what i'm facing 
>as a PHP developer in a company that is a Microsoft partner.
> See it as a coca-cola agent who likes Pepsi. It's hard to sell Coca-cola when you 
>like Pepsi.
> 
> But i'm a Pepsi agent that is trying to sell Pepsi to the Coca-cola factory!
> 
> Dave Mertens
> 
> --
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, visit: http://www.php.net/unsub.php

-- 
.-.
| Robert Cummings |
:-`.
| Webdeployer - Chief PHP and Java Programmer  |
:--:
| Mail  : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109 |
:--:
| Website : http://www.webmotion.com   |
| Fax : (613) 260-9545 |
`--'

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




Re: [PHP-DEV] The PHP Platform

2002-04-15 Thread Robert Cummings

Hey all,

I'm just doing a general followup to say how much I love the PHP
engine. I find it extremely fast for development and I love that
I can integrate C extension modules when time is a huge factor.
While PHP seems to be moving into the shadows here where I work
I find that I love it more and more personally and is my favourite
engine for doing just about everything. I use it for the web and
for shell scripting. Most of all I love that something like this
can be free, since in my spare time I like to code for a MUD,
which doesn't make me any money, but which I find very satisfying.
Kudos to all the PHP contributors.

Cheers,
Rob.
-- 
.-.
| Robert Cummings |
:-`.
| Webdeployer - Chief PHP and Java Programmer  |
:--:
| Mail  : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109 |
:--:
| Website : http://www.webmotion.com   |
| Fax : (613) 260-9545 |
`--'

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




Re: [PHP-DEV] object refrences (POSSIBLE MAJOR BUG)

2002-04-11 Thread Robert Cummings

My apologies... this examples better clarifies your point and I must admit
that it is rather strange behaviour :) And I think I forgot that PHP does
do deep copies, probably because I'm so used to writing wrapper objects
with references to my real objects so I automate shallow copies.

Cheers,
Rob.

brad lafountain wrote:
> 
> 
>  I do understand the difference... but it also doesn't say it does a shallow
> copy. because it DOES do a deep copy run the following code..
> 
>  class foo
> {
>  function foo()
>  {
>   $this->bar = new bar();
>  }
> }
> 
> class bar
> {
>  function bar()
>  {
>   $this->tmp = "bar";
>  }
>  function do_nothing()
>  {
>  }
> }
> 
> // As you see no shallow copy!!
> $foo = new foo();
> $foo->bar->tmp = "test";
> $foo2 = $foo;
> $foo2->bar->tmp = "foo";
> var_dump($foo);
> var_dump($foo2);
> 
> // now
> $foo->bar->do_nothing();
> $foo3 = $foo;
> $foo3->bar->tmp = "bug";
> var_dump($foo);
> var_dump($foo3);
> ?>
> 
> as soon as a function is called from a objects member.. this is where the
> refrence is created!
> 
>  - Brad

-- 
.-.
| Robert Cummings |
:-`.
| Webdeployer - Chief PHP and Java Programmer  |
:--:
| Mail  : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109 |
:--:
| Website : http://www.webmotion.com   |
| Fax : (613) 260-9545 |
`--'

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




Re: [PHP-DEV] object refrences (POSSIBLE MAJOR BUG)

2002-04-11 Thread Robert Cummings

Andrey Hristov wrote:
> 
> But dereferncing like this
> $foo->bar()->fubar
> is feature of Z2 or not?
> Till today I didn't know that my 4.1.1(or 2) not sure can do this kind of 
>dereferencing.

The above quote dereference involves an intermediate method, the one
described in the example below uses an object which is currently
supported.

> > $foo = new foo();
> > $foo->bar->set_tmp("outside foo");
> > $foo->variable = "foo";

As far as references go... I believe when you copy an object it is a
shallow copy, in otherwords, the object is copied, but not its members.
This behaviour is preferrable as far as I'm concerned. If you want a
deep copy try doing the following:

$foo = new foo();
$fee = unserialize( serialize( $foo ) );

That should provide a nice quick, clean solution for what you want while
not incurring the overhead most programmers would rather skip on every
object copy.

Cheers,
Rob.
-- 
.-.
| Robert Cummings |
:-`.
| Webdeployer - Chief PHP and Java Programmer  |
:--:
| Mail  : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109 |
:--:
| Website : http://www.webmotion.com   |
| Fax : (613) 260-9545 |
`--'

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




[PHP-DEV] Finding key in a hash...

2002-04-11 Thread Robert Cummings


I am trying to determine if a key exists in a hash that has been passed
to my function. I couldn't find much information on finding how to do
it, but from greping the source I managed to come up with the following.
Problem is it doesn't work *heh*. All I want to do is check whether the
key exists or not and act appropriately. My code compiles fine, but the
zend_hash_exists() test always returns false. The A facsimile of my code
follows:
---
ZEND_FUNCTION( foofunction ){

zval **paramHash = NULL;
zval  *aHash = NULL;

if( ZEND_NUM_ARGS() != 1 ||zend_get_parameters_ex( ZEND_NUM_ARGS(), ¶mHash ) 
== FAILURE ){
WRONG_PARAM_COUNT;
} 

aHash = *paramHash;

if( zend_hash_exists( aHash->value.ht, "foo", sizeof( "foo" ) ) ){
//
// Do something here.
//
}
else{
//
// Do something else here.
//
}
}

---
In my PHP code I have the following:
---

$aHash = array();
$aHash['foo'] = 'fee';

foofunction( $aHash );

---

Cheers,
Rob.
-- 
.-.
| Robert Cummings |
:-`.
| Webdeployer - Chief PHP and Java Programmer  |
:--:
| Mail  : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109 |
:--:
| Website : http://www.webmotion.com   |
| Fax : (613) 260-9545 |
`--'

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




[PHP-DEV] Re-entrant PHP

2002-04-05 Thread Robert Cummings


I mostly don't keep up with the bulk of the PHP threads; however, I
did a pretty thorough scan of them to find information about re-entrancy
and didn't find anything to answer my question. So here goes... I was
wondering if there were any plans to make php_mod re-entrant in any
way or if there were any comments on how difficult this task would be.
I see the advantages of re-entrancy being that my source code wouldn't
need to be reloaded every single time a page is loaded; much of the data
would already be in memory with respect to properties and caching; I
could have a global persistent cache for some of my data versus saving
to a database or shared memory location for subsequent page hit retrieval.
Mostly I just don't want my source code re-parsed and loaded on every
hit since that is a large overhead once you get into several layers of
abstraction.

Cheers,
Rob.
-- 
.-.
| Robert Cummings |
:-`.
| Webdeployer - Chief PHP and Java Programmer  |
:--:
| Mail  : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109 |
:--:
| Website : http://www.webmotion.com   |
| Fax : (613) 260-9545 |
`--'

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




[PHP-DEV] Bug #15156 Updated: apache segmentation fault (11) with php4

2002-02-01 Thread cummings

ID: 15156
Updated by: [EMAIL PROTECTED]
Reported By: [EMAIL PROTECTED]
Old Status: Feedback
Status: Open
Bug Type: Reproducible crash
Operating System: RedHat Linux, 2.4.2 kernel
PHP Version: 4.1.1
New Comment:

I did as you suggested.  New apache and apache-devel rpms.  Then
installed PHP 4.1.1   All is well regarding segmentation faults. 
However, in order to get apache to process the embedded php code, I had
to slightly modify the httpd.conf file. 

This was the code that didn't work:


  AddType application/x-httpd-php .php4 .php3 .phtml .php
  AddType application/x-httpd-php-source .phps

 
# The following is for PHP3:

  AddType application/x-httpd-php3 .php3
  AddType application/x-httpd-php3-source .phps


# The following is for PHP/FI (PHP2):

  AddType application/x-httpd-php .phtml


I moved the AddType directives outside of the 
block and now it works.  

Thanks for your help!


Previous Comments:


[2002-02-01 00:31:20] [EMAIL PROTECTED]

I suggest you to install from scrach (including all config files
related)
Make sure you do "rpm -e" for all apache/php related package including
-devel one. Delete or move all httpd.conf/php.ini.

If you still have segfault problem, report it again.





[2002-01-31 18:55:54] [EMAIL PROTECTED]

In spite of my prior 'make clean' commands, I found that copies of
libphp3.so and libphp4.so were present on my system.  I deleted these
files and reinstalled PHP 4.1.1 from a fresh tarball distribution
(configuration options as before).  I also scrutinized my httpd.conf
file and found that 'LoadModule libphp4.so' appeared twice, each with a
different path.  In order to satisfy apache, I had previously created a
symbolic link from the second directory to modules/libphp4.so.  I
subsequently deleted the symbolic link and the Apache directive that
refered to it.

I continue to have the problems but there are some differences.  The
server starts fine.  Documents with .html or .php extensions fail to
load in the browser and result in a child process segmentation fault in
the error_log.  Occasionally, one browser request results in multiple
child seg. faults.

I tried to get a backtrace but strangely, when I run httpd with the -X
flag, the server does not crash.  However, PHP code is not processed. 
The core file is nowhere to be found.

Incidentally, commenting out the AddModule directive: 

   ...
   LoadModule php4_modulemodules/libphp4.so
   ...
   # AddModule mod_php4.c
   ...

restores functionality to the server (without PHP enabled).

Scripts in the cgi-bin directory seem to work fine and text documents
(with .txt extensions) load fine from the html directory.

Any advice?



[2002-01-30 14:29:33] [EMAIL PROTECTED]

Sorry if this is a stupid question but how do I turn off the xbit hack
directive?

Here are the answers to your questions:

1) I followed directions for an Apache module installation.  If PHP4 is
installed as a CGI version as well, then I am not aware of it.  How can
I confirm that the CGI version is not installed? 

2) PHP3 was installed on this machine as part of the RedHat 7.1
distribution.  I removed it (rpm -e php) prior to installing PHP4. 
Should I check for some remnant of the previous installation that might
be causing a conflict?

3) Here are the relevant lines from my httpd.conf file


  AddType application/x-httpd-php .php4 .php3 .phtml .php
  AddType application/x-httpd-php-source .phps


# The following is for PHP3:

  AddType application/x-httpd-php3 .php3
  AddType application/x-httpd-php3-source .phps


# The following is for PHP/FI (PHP2):

  AddType application/x-httpd-php .phtml
 

Thanks again.

Craig



[2002-01-24 21:01:31] [EMAIL PROTECTED]

Turn off xbit hack ini directive to see if it helps.
BTW, xbit hack works fine for me. (4.2.0-dev. It worked older versions
also)

Are you using PHP CGI version also?
Are you using PHP3 AND PHP4 as module?
What is "AddType" setting for PHP. (In httpd.conf)



[2002-01-24 13:03:15] [EMAIL PROTECTED]

I've tried versions of PHP all the way back to 3.0.18 and I still get
the same problems.



The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/?id=15156


Edit this bug report at http://bugs.php.net/?id=15156&edit=1


-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list admin

[PHP-DEV] Bug #15156 Updated: apache segmentation fault (11) with php4

2002-01-31 Thread cummings

ID: 15156
User updated by: [EMAIL PROTECTED]
Reported By: [EMAIL PROTECTED]
Status: Open
Bug Type: Reproducible crash
Operating System: RedHat Linux, 2.4.2 kernel
PHP Version: 4.1.1
New Comment:

In spite of my prior 'make clean' commands, I found that copies of
libphp3.so and libphp4.so were present on my system.  I deleted these
files and reinstalled PHP 4.1.1 from a fresh tarball distribution
(configuration options as before).  I also scrutinized my httpd.conf
file and found that 'LoadModule libphp4.so' appeared twice, each with a
different path.  In order to satisfy apache, I had previously created a
symbolic link from the second directory to modules/libphp4.so.  I
subsequently deleted the symbolic link and the Apache directive that
refered to it.

I continue to have the problems but there are some differences.  The
server starts fine.  Documents with .html or .php extensions fail to
load in the browser and result in a child process segmentation fault in
the error_log.  Occasionally, one browser request results in multiple
child seg. faults.

I tried to get a backtrace but strangely, when I run httpd with the -X
flag, the server does not crash.  However, PHP code is not processed. 
The core file is nowhere to be found.

Incidentally, commenting out the AddModule directive: 

   ...
   LoadModule php4_modulemodules/libphp4.so
   ...
   # AddModule mod_php4.c
   ...

restores functionality to the server (without PHP enabled).

Scripts in the cgi-bin directory seem to work fine and text documents
(with .txt extensions) load fine from the html directory.

Any advice?


Previous Comments:


[2002-01-30 14:29:33] [EMAIL PROTECTED]

Sorry if this is a stupid question but how do I turn off the xbit hack
directive?

Here are the answers to your questions:

1) I followed directions for an Apache module installation.  If PHP4 is
installed as a CGI version as well, then I am not aware of it.  How can
I confirm that the CGI version is not installed? 

2) PHP3 was installed on this machine as part of the RedHat 7.1
distribution.  I removed it (rpm -e php) prior to installing PHP4. 
Should I check for some remnant of the previous installation that might
be causing a conflict?

3) Here are the relevant lines from my httpd.conf file


  AddType application/x-httpd-php .php4 .php3 .phtml .php
  AddType application/x-httpd-php-source .phps


# The following is for PHP3:

  AddType application/x-httpd-php3 .php3
  AddType application/x-httpd-php3-source .phps


# The following is for PHP/FI (PHP2):

  AddType application/x-httpd-php .phtml
 

Thanks again.

Craig



[2002-01-24 21:01:31] [EMAIL PROTECTED]

Turn off xbit hack ini directive to see if it helps.
BTW, xbit hack works fine for me. (4.2.0-dev. It worked older versions
also)

Are you using PHP CGI version also?
Are you using PHP3 AND PHP4 as module?
What is "AddType" setting for PHP. (In httpd.conf)



[2002-01-24 13:03:15] [EMAIL PROTECTED]

I've tried versions of PHP all the way back to 3.0.18 and I still get
the same problems.



[2002-01-22 18:40:22] [EMAIL PROTECTED]

Update:

I just tried to reinstall using slightly older releases of MySQL and
PHP.  However, the problem persists.  Requests for HTML cause segfault,
requests for PHP return unprocessed document text.  Latest installed
versions are:

PHP 4.0.6
MySQL 3.23.47




[2002-01-22 03:00:55] [EMAIL PROTECTED]

I recently installed PHP4 from the tarball distribution as a
dynamically loaded module for Apache.  It builds cleanly and the server
starts.  However, I have two serious problems with my server:

  1) all requests to the server for .html documents result in a
"[notice] child pid 15202 exit signal Segmentation fau
lt (11)" error

  2) requests for PHP-containing documents do not return anything to
the server.  However, an examination of the source shows the text of
the document with per_dir_c
onfig, &php4_module);
(gdb)
(gdb) bt
#0  0x40480108 in php_xbithack_handler (r=0x80df818) at mod_php4.c:777
#1  0x8054f7a in ap_invoke_handler ()
#2  0x8068e73 in ap_some_auth_required ()
#3  0x403d9ea4 in handle_dir () from /etc/httpd/modules/mod_dir.so
#4  0x8054f7a in ap_invoke_handler ()
#5  0x8068e73 in ap_some_auth_required ()
#6  0x806910e in ap_process_request ()
#7  0x806113d in ap_child_terminate ()
#8  0x80613c2 in ap_child_terminate ()
#9  0x8061449 in ap_child_terminate ()
#10 0x80620aa in ap_child_terminate ()
#11 0x8062434 in main ()
#12 0x40171108 in __libc_start_main () from /lib/i686/libc.so.6
--

I'd appreciate any

[PHP-DEV] Bug #15156 Updated: apache segmentation fault (11) with php4

2002-01-30 Thread cummings

ID: 15156
User updated by: [EMAIL PROTECTED]
Reported By: [EMAIL PROTECTED]
Old Status: Feedback
Status: Open
Bug Type: Reproducible crash
Operating System: RedHat Linux, 2.4.2 kernel
PHP Version: 4.1.1
New Comment:

Sorry if this is a stupid question but how do I turn off the xbit hack
directive?

Here are the answers to your questions:

1) I followed directions for an Apache module installation.  If PHP4 is
installed as a CGI version as well, then I am not aware of it.  How can
I confirm that the CGI version is not installed? 

2) PHP3 was installed on this machine as part of the RedHat 7.1
distribution.  I removed it (rpm -e php) prior to installing PHP4. 
Should I check for some remnant of the previous installation that might
be causing a conflict?

3) Here are the relevant lines from my httpd.conf file


  AddType application/x-httpd-php .php4 .php3 .phtml .php
  AddType application/x-httpd-php-source .phps


# The following is for PHP3:

  AddType application/x-httpd-php3 .php3
  AddType application/x-httpd-php3-source .phps


# The following is for PHP/FI (PHP2):

  AddType application/x-httpd-php .phtml
 

Thanks again.

Craig


Previous Comments:


[2002-01-24 21:01:31] [EMAIL PROTECTED]

Turn off xbit hack ini directive to see if it helps.
BTW, xbit hack works fine for me. (4.2.0-dev. It worked older versions
also)

Are you using PHP CGI version also?
Are you using PHP3 AND PHP4 as module?
What is "AddType" setting for PHP. (In httpd.conf)



[2002-01-24 13:03:15] [EMAIL PROTECTED]

I've tried versions of PHP all the way back to 3.0.18 and I still get
the same problems.



[2002-01-22 18:40:22] [EMAIL PROTECTED]

Update:

I just tried to reinstall using slightly older releases of MySQL and
PHP.  However, the problem persists.  Requests for HTML cause segfault,
requests for PHP return unprocessed document text.  Latest installed
versions are:

PHP 4.0.6
MySQL 3.23.47




[2002-01-22 03:00:55] [EMAIL PROTECTED]

I recently installed PHP4 from the tarball distribution as a
dynamically loaded module for Apache.  It builds cleanly and the server
starts.  However, I have two serious problems with my server:

  1) all requests to the server for .html documents result in a
"[notice] child pid 15202 exit signal Segmentation fau
lt (11)" error

  2) requests for PHP-containing documents do not return anything to
the server.  However, an examination of the source shows the text of
the document with per_dir_c
onfig, &php4_module);
(gdb)
(gdb) bt
#0  0x40480108 in php_xbithack_handler (r=0x80df818) at mod_php4.c:777
#1  0x8054f7a in ap_invoke_handler ()
#2  0x8068e73 in ap_some_auth_required ()
#3  0x403d9ea4 in handle_dir () from /etc/httpd/modules/mod_dir.so
#4  0x8054f7a in ap_invoke_handler ()
#5  0x8068e73 in ap_some_auth_required ()
#6  0x806910e in ap_process_request ()
#7  0x806113d in ap_child_terminate ()
#8  0x80613c2 in ap_child_terminate ()
#9  0x8061449 in ap_child_terminate ()
#10 0x80620aa in ap_child_terminate ()
#11 0x8062434 in main ()
#12 0x40171108 in __libc_start_main () from /lib/i686/libc.so.6
--

I'd appreciate any help you can provide on this.  By the way, I'm
willing to use an older version of PHP if the bug is fixed there. 
Thanks a lot.

Best regards,

Craig






Edit this bug report at http://bugs.php.net/?id=15156&edit=1


-- 
PHP Development Mailing List 
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 #15156 Updated: apache segmentation fault (11) with php4

2002-01-24 Thread cummings

ID: 15156
User updated by: [EMAIL PROTECTED]
Reported By: [EMAIL PROTECTED]
Status: Open
Bug Type: Reproducible crash
Operating System: RedHat Linux, 2.4.2 kernel
PHP Version: 4.1.1
New Comment:

I've tried versions of PHP all the way back to 3.0.18 and I still get
the same problems.


Previous Comments:


[2002-01-22 18:40:22] [EMAIL PROTECTED]

Update:

I just tried to reinstall using slightly older releases of MySQL and
PHP.  However, the problem persists.  Requests for HTML cause segfault,
requests for PHP return unprocessed document text.  Latest installed
versions are:

PHP 4.0.6
MySQL 3.23.47




[2002-01-22 03:00:55] [EMAIL PROTECTED]

I recently installed PHP4 from the tarball distribution as a
dynamically loaded module for Apache.  It builds cleanly and the server
starts.  However, I have two serious problems with my server:

  1) all requests to the server for .html documents result in a
"[notice] child pid 15202 exit signal Segmentation fau
lt (11)" error

  2) requests for PHP-containing documents do not return anything to
the server.  However, an examination of the source shows the text of
the document with per_dir_c
onfig, &php4_module);
(gdb)
(gdb) bt
#0  0x40480108 in php_xbithack_handler (r=0x80df818) at mod_php4.c:777
#1  0x8054f7a in ap_invoke_handler ()
#2  0x8068e73 in ap_some_auth_required ()
#3  0x403d9ea4 in handle_dir () from /etc/httpd/modules/mod_dir.so
#4  0x8054f7a in ap_invoke_handler ()
#5  0x8068e73 in ap_some_auth_required ()
#6  0x806910e in ap_process_request ()
#7  0x806113d in ap_child_terminate ()
#8  0x80613c2 in ap_child_terminate ()
#9  0x8061449 in ap_child_terminate ()
#10 0x80620aa in ap_child_terminate ()
#11 0x8062434 in main ()
#12 0x40171108 in __libc_start_main () from /lib/i686/libc.so.6
--

I'd appreciate any help you can provide on this.  By the way, I'm
willing to use an older version of PHP if the bug is fixed there. 
Thanks a lot.

Best regards,

Craig






Edit this bug report at http://bugs.php.net/?id=15156&edit=1


-- 
PHP Development Mailing List 
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 #15156: apache segmentation fault (11) with php4

2002-01-21 Thread cummings

From: [EMAIL PROTECTED]
Operating system: RedHat Linux, 2.4.2 kernel
PHP version:  4.1.1
PHP Bug Type: Reproducible crash
Bug description:  apache segmentation fault (11) with php4

I recently installed PHP4 from the tarball distribution as a dynamically
loaded module for Apache.  It builds cleanly and the server starts. 
However, I have two serious problems with my server:

  1) all requests to the server for .html documents result in a "[notice]
child pid 15202 exit signal Segmentation fau
lt (11)" error

  2) requests for PHP-containing documents do not return anything to the
server.  However, an examination of the source shows the text of the
document with per_dir_c
onfig, &php4_module);
(gdb)
(gdb) bt
#0  0x40480108 in php_xbithack_handler (r=0x80df818) at mod_php4.c:777
#1  0x8054f7a in ap_invoke_handler ()
#2  0x8068e73 in ap_some_auth_required ()
#3  0x403d9ea4 in handle_dir () from /etc/httpd/modules/mod_dir.so
#4  0x8054f7a in ap_invoke_handler ()
#5  0x8068e73 in ap_some_auth_required ()
#6  0x806910e in ap_process_request ()
#7  0x806113d in ap_child_terminate ()
#8  0x80613c2 in ap_child_terminate ()
#9  0x8061449 in ap_child_terminate ()
#10 0x80620aa in ap_child_terminate ()
#11 0x8062434 in main ()
#12 0x40171108 in __libc_start_main () from /lib/i686/libc.so.6
--

I'd appreciate any help you can provide on this.  By the way, I'm willing
to use an older version of PHP if the bug is fixed there.  Thanks a lot.

Best regards,

Craig

-- 
Edit bug report at: http://bugs.php.net/?id=15156&edit=1


-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]