Re: [PHP-DEV] intval($resource)

2001-05-06 Thread Manuel Lemos

Hello Andi,

On 27-Apr-01 19:18:12, you wrote:

At 06:03 PM 4/27/2001 -0400, Joe Brown wrote:
Run into a spot of trouble using Metabase(db wrapper) because of it's use of
casting a $var=intval($resource) where OCIFreeCursor fails to function after
it has been casted.

Guessing that it fails because intval is creating a reference to the
resource, in turn OCI does not release the resource because there additional
reference exist.

I'd like to start working on fixing this, but don't know which behaviour to
attack.  Does OCI need to be fixed or intval()?

Suggestions anyone...

Is there a good reason it needs to use intval() on the resource? To be 

Just to overcome a past bug in PHP 4.0.(?).  It was making resource values
inconsistently turn into strings when used as array indexes.  A user
reported a bug on Metabase because of that when it turned out to be a PHP
bug. The workaround of using intval() made the bug effect go away.


quite honest intval() shouldn't really return a valid value for resources 
and just by chance it returns the resource id which is probably not a good 
thing.
We can try and look into fixing this problem though.

Resource values should be integers to be consistent with the PHP
documentation.


Regards,
Manuel Lemos

Web Programming Components using PHP Classes.
Look at: http://phpclasses.UpperDesign.com/?[EMAIL PROTECTED]
--
E-mail: [EMAIL PROTECTED]
URL: http://www.mlemos.e-na.net/
PGP key: http://www.mlemos.e-na.net/ManuelLemos.pgp
--


-- 
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] intval($resource)

2001-05-06 Thread Sterling Hughes

On 6 May 2001, Manuel Lemos wrote:

 Hello Andi,

 On 27-Apr-01 19:18:12, you wrote:

 At 06:03 PM 4/27/2001 -0400, Joe Brown wrote:
 Run into a spot of trouble using Metabase(db wrapper) because of it's use of
 casting a $var=intval($resource) where OCIFreeCursor fails to function after
 it has been casted.
 
 Guessing that it fails because intval is creating a reference to the
 resource, in turn OCI does not release the resource because there additional
 reference exist.
 
 I'd like to start working on fixing this, but don't know which behaviour to
 attack.  Does OCI need to be fixed or intval()?
 
 Suggestions anyone...

 Is there a good reason it needs to use intval() on the resource? To be

 Just to overcome a past bug in PHP 4.0.(?).  It was making resource values
 inconsistently turn into strings when used as array indexes.  A user
 reported a bug on Metabase because of that when it turned out to be a PHP
 bug. The workaround of using intval() made the bug effect go away.


This shouldn't be happening (does it still happen for you?)  The only time
when a resource should be represented as a string is if you print it out,
in which case that is the proper behaviour.


 quite honest intval() shouldn't really return a valid value for resources
 and just by chance it returns the resource id which is probably not a good
 thing.
 We can try and look into fixing this problem though.

 Resource values should be integers to be consistent with the PHP
 documentation.



Resource values are internally integers (well, no actually they're
long's but so are PHP's integers, anyyyway).  They're an
abstract type so they should be shown as such, and not have an integer
value.

And the PHP documentation should be consistent with the PHP source, not
the other way around :)

-Sterling


-- 
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] intval($resource)

2001-05-06 Thread Manuel Lemos

Hello Sterling,

On 07-May-01 00:53:37, you wrote:

 Is there a good reason it needs to use intval() on the resource? To be

 Just to overcome a past bug in PHP 4.0.(?).  It was making resource values
 inconsistently turn into strings when used as array indexes.  A user
 reported a bug on Metabase because of that when it turned out to be a PHP
 bug. The workaround of using intval() made the bug effect go away.


This shouldn't be happening (does it still happen for you?)  The only time
when a resource should be represented as a string is if you print it out,
in which case that is the proper behaviour.

Yes, but until that bug was fixed I felt that I needed to add the
workaround because some people were using that version and were complaining
as a bug in Metabase.


 quite honest intval() shouldn't really return a valid value for resources
 and just by chance it returns the resource id which is probably not a good
 thing. We can try and look into fixing this problem though.

 Resource values should be integers to be consistent with the PHP
 documentation.



Resource values are internally integers (well, no actually they're
long's but so are PHP's integers, anyyyway).  They're an
abstract type so they should be shown as such, and not have an integer
value.

Yes, I know, but that other broke the behaviour.


And the PHP documentation should be consistent with the PHP source, not
the other way around :)

Except when the source is buggy! :-)


Regards,
Manuel Lemos

Web Programming Components using PHP Classes.
Look at: http://phpclasses.UpperDesign.com/?[EMAIL PROTECTED]
--
E-mail: [EMAIL PROTECTED]
URL: http://www.mlemos.e-na.net/
PGP key: http://www.mlemos.e-na.net/ManuelLemos.pgp
--


-- 
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] intval($resource)

2001-04-28 Thread Joe Brown

There is a good reason AFAIK.

Manuel Lemos' Metabase uses the intval of a resource as an array key for
managing mutiple queries, etc.

A don't do that responce does not help the situation, because it must in
order to function the way it does.

Manuel's Metabase is quite elegant PHP coding.

I have written to metabase-dev on groups.yahoo.com in hopes for another
resolution.  As it stands now, I don't foresee simple solution to this
issue.
--
Having said that,
1. is there a good reason OCI shouldn't free the resource reguardless of the
reference count?

2. Should intval not pump up the refcount when doing something silly like
converting a resource to an integer?


Andi Gutmans [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 At 06:03 PM 4/27/2001 -0400, Joe Brown wrote:
 Run into a spot of trouble using Metabase(db wrapper) because of it's use
of
 casting a $var=intval($resource) where OCIFreeCursor fails to function
after
 it has been casted.
 
 Guessing that it fails because intval is creating a reference to the
 resource, in turn OCI does not release the resource because there
additional
 reference exist.
 
 I'd like to start working on fixing this, but don't know which behaviour
to
 attack.  Does OCI need to be fixed or intval()?
 
 Suggestions anyone...

 Is there a good reason it needs to use intval() on the resource? To be
 quite honest intval() shouldn't really return a valid value for resources
 and just by chance it returns the resource id which is probably not a good
 thing.
 We can try and look into fixing this problem though.

 Andi


 --
 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 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] intval($resource)

2001-04-28 Thread Andi Gutmans

At 08:28 AM 4/28/2001 -0400, Joe Brown wrote:
Having said that,
1. is there a good reason OCI shouldn't free the resource reguardless of the
reference count?

There are different ways to look at this. Some people might think it should 
and some might think it shouldn't. I'm not even completely sure this is 
consistent across all the db modules of PHP.


2. Should intval not pump up the refcount when doing something silly like
converting a resource to an integer?

There was a bug in the Zend engine which is at least partially the reason 
for you seeing the behavior you saw. Zeev fixed it a few minutes ago. I 
suggest you try and use the latest CVS and let us know how it goes for you.

Andi


-- 
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] intval($resource)

2001-04-28 Thread Thies C. Arntzen

On Sat, Apr 28, 2001 at 06:12:19PM +0200, Andi Gutmans wrote:
 At 08:28 AM 4/28/2001 -0400, Joe Brown wrote:
 Having said that,
 1. is there a good reason OCI shouldn't free the resource reguardless of the
 reference count?

the problem is that freeing resources that are still in use
will cause trouble once we try to use them (and expect they
are still there)

 
 There are different ways to look at this. Some people might think it should 
 and some might think it shouldn't. I'm not even completely sure this is 
 consistent across all the db modules of PHP.
 
 
 2. Should intval not pump up the refcount when doing something silly like
 converting a resource to an integer?
 
 There was a bug in the Zend engine which is at least partially the reason 
 for you seeing the behavior you saw. Zeev fixed it a few minutes ago. I 
 suggest you try and use the latest CVS and let us know how it goes for you.

if that doesn't help - could you please send me a minimal
testscript that shows the problem? ( 50 lines) - i'll then
dig into this a bit...

re,
tc



 
 Andi
 
 
 -- 
 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 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] intval($resource)

2001-04-28 Thread Andi Gutmans

At 08:50 PM 4/28/2001 +0200, Thies C. Arntzen wrote:
On Sat, Apr 28, 2001 at 06:12:19PM +0200, Andi Gutmans wrote:
  At 08:28 AM 4/28/2001 -0400, Joe Brown wrote:
  Having said that,
  1. is there a good reason OCI shouldn't free the resource reguardless 
 of the
  reference count?

 the problem is that freeing resources that are still in use
 will cause trouble once we try to use them (and expect they
 are still there)

Well it will cause a warning because the resource doesn't exist anymore but 
I don't think it would cause serious problems. In any case, I think there 
are two ways to look at this and none is really more correct than the other.

Andi


-- 
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] intval($resource)

2001-04-28 Thread Joe Brown


Andi Gutmans [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 At 08:50 PM 4/28/2001 +0200, Thies C. Arntzen wrote:
 On Sat, Apr 28, 2001 at 06:12:19PM +0200, Andi Gutmans wrote:
   At 08:28 AM 4/28/2001 -0400, Joe Brown wrote:
   Having said that,
   1. is there a good reason OCI shouldn't free the resource reguardless
  of the
   reference count?
 
  the problem is that freeing resources that are still in use
  will cause trouble once we try to use them (and expect they
  are still there)

 Well it will cause a warning because the resource doesn't exist anymore
but
 I don't think it would cause serious problems. In any case, I think there
 are two ways to look at this and none is really more correct than the
other.

 Andi


 --
 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 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] intval($resource)

2001-04-28 Thread Joe Brown

Bah!

My newsreader is freaking out on replies...  Please accept apologies for
null message.

IMO.  The resource should be freed upon request, reguardless of refcount.
Further attempts to access the resource would then be in error.  This logic
makes sense to me.

If the resource is not released, a warning should be generated.
@OCIFreeStatement would then squash the warning, if this is the desired
behaviour.


Joe Brown [EMAIL PROTECTED] wrote in message
9cfi6l$75n$[EMAIL PROTECTED]">news:9cfi6l$75n$[EMAIL PROTECTED]...

 Andi Gutmans [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  At 08:50 PM 4/28/2001 +0200, Thies C. Arntzen wrote:
  On Sat, Apr 28, 2001 at 06:12:19PM +0200, Andi Gutmans wrote:
At 08:28 AM 4/28/2001 -0400, Joe Brown wrote:
Having said that,
1. is there a good reason OCI shouldn't free the resource
reguardless
   of the
reference count?
  
   the problem is that freeing resources that are still in use
   will cause trouble once we try to use them (and expect they
   are still there)
 
  Well it will cause a warning because the resource doesn't exist anymore
 but
  I don't think it would cause serious problems. In any case, I think
there
  are two ways to look at this and none is really more correct than the
 other.
 
  Andi
 
 
  --
  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 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 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] intval($resource)

2001-04-27 Thread Joe Brown

Run into a spot of trouble using Metabase(db wrapper) because of it's use of
casting a $var=intval($resource) where OCIFreeCursor fails to function after
it has been casted.

Guessing that it fails because intval is creating a reference to the
resource, in turn OCI does not release the resource because there additional
reference exist.

I'd like to start working on fixing this, but don't know which behaviour to
attack.  Does OCI need to be fixed or intval()?

Suggestions anyone...

-Joe



-- 
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] intval($resource)

2001-04-27 Thread Andi Gutmans

At 06:03 PM 4/27/2001 -0400, Joe Brown wrote:
Run into a spot of trouble using Metabase(db wrapper) because of it's use of
casting a $var=intval($resource) where OCIFreeCursor fails to function after
it has been casted.

Guessing that it fails because intval is creating a reference to the
resource, in turn OCI does not release the resource because there additional
reference exist.

I'd like to start working on fixing this, but don't know which behaviour to
attack.  Does OCI need to be fixed or intval()?

Suggestions anyone...

Is there a good reason it needs to use intval() on the resource? To be 
quite honest intval() shouldn't really return a valid value for resources 
and just by chance it returns the resource id which is probably not a good 
thing.
We can try and look into fixing this problem though.

Andi


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