Re: [PHP-DEV] Question for Zeev, Zak or Georg - mysql_query and possible integer overflow?

2003-03-25 Thread Zak Greant
D'oh - read too little, too fast. :)

On Tue, Mar 25, 2003 at 05:55:42PM -0800, Zeev Suraski wrote:
> I believe he meant the query id's that the engine uses, and not the auto 
> increment id's.  Wez's response was accurate, we'll overflow at some 
> point.  This is basically because PHP was designed with short requests in 
> mind.  We could probably fix it relatively easily for ZE2.

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



Re: [PHP-DEV] Question for Zeev, Zak or Georg - mysql_query and possible integer overflow?

2003-03-25 Thread Zeev Suraski
I believe he meant the query id's that the engine uses, and not the auto 
increment id's.  Wez's response was accurate, we'll overflow at some 
point.  This is basically because PHP was designed with short requests in 
mind.  We could probably fix it relatively easily for ZE2.

Zeev

At 13:15 25/03/2003, Zak Greant wrote:
On Tue, Mar 25, 2003 at 01:50:17PM +, Matt Flaherty wrote:
> Hi,
>
> I have a question for the authors of the mysql extension. I'm sure you
> gentlemen are very busy, but I'd appreciate your insight if you can
> spare a moment. I'm developing a stand-alone php application running in
> an infinite loop from the command line interface. A mysql database is
> polled continually for new rows to deal with. The same query is executed
> several times in one second. I've noticed that whether or not a query
> resource is freed the next query identifier returned from mysql_query()
> is ++ the last one. I'm sure this is by design and governed by the mysql
> driver. Naturally I'm concerned about integer overflow when the the
> application has been running uninterrupted for a very long time. I don't
> think I can wait around while a test script runs to see what happens
> after 4,294,967,295 is exceeded though! Can anyone tell me with
> certainty or hazard a guess what might happen here? I thank you very
> much for your time.
  The query that generates an auto_increment value larger than the largest
  value allowed for the column will fail with error 1062 (Duplicate
  entry 'xxx' for key 1)
> Matt
>
> ps - I'm doing this through PEAR::DB::mysql
  I am not exactly sure how PEAR::DB will propagate this error through
  its error handling interface.
  An easy way to test this is to create a temporary table that has a
  TINYINT as its auto_incrementing primary key, fill the table up and
  then watch to see what breaks.
  Cheers!
  --zak
--
PHP Development Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php


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


Re: [PHP-DEV] Is this a bug?

2003-03-25 Thread Chris Shiflett
--- Tony Bibbs <[EMAIL PROTECTED]> wrote:
> Are there instances you all can think of where doing a header('location: 
> $url'); causes a loss of all session data?

This is most likely not a bug. You can (hopefully) find more people to help
with this type of question on [EMAIL PROTECTED]

Good luck.

Chris

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



[PHP-DEV] Is this a bug?

2003-03-25 Thread Tony Bibbs
Are there instances you all can think of where doing a header('location: 
$url'); causes a loss of all session data?  I have a case I can reproduce 
consistently where doing a header() refresh or echoing out an HTML page 
with a meta refresh both cause resulting page to lose session.  My hunch 
is that I may not be accounting for some ingrained PHP handling and that 
this isn't a bug but I can't be sure.  

If required, I can submit the offending code but I'll hold off in case 
there is an obvious answer.

-- 
Tony Bibbs  "I guess you have to remember that those who don't
[EMAIL PROTECTED]  hunt or fish often see those of us who do as  
harmlessly strange and sort of amusing. When you  
think about it, that might be a fair assessment." 
--Unknown



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



Re: [PHP-DEV] Question for Zeev, Zak or Georg - mysql_query and possible integer overflow?

2003-03-25 Thread Zak Greant
On Tue, Mar 25, 2003 at 01:50:17PM +, Matt Flaherty wrote:
> Hi,
> 
> I have a question for the authors of the mysql extension. I'm sure you
> gentlemen are very busy, but I'd appreciate your insight if you can
> spare a moment. I'm developing a stand-alone php application running in
> an infinite loop from the command line interface. A mysql database is
> polled continually for new rows to deal with. The same query is executed
> several times in one second. I've noticed that whether or not a query
> resource is freed the next query identifier returned from mysql_query()
> is ++ the last one. I'm sure this is by design and governed by the mysql
> driver. Naturally I'm concerned about integer overflow when the the
> application has been running uninterrupted for a very long time. I don't
> think I can wait around while a test script runs to see what happens
> after 4,294,967,295 is exceeded though! Can anyone tell me with
> certainty or hazard a guess what might happen here? I thank you very
> much for your time.

  The query that generates an auto_increment value larger than the largest
  value allowed for the column will fail with error 1062 (Duplicate
  entry 'xxx' for key 1)

> Matt
> 
> ps - I'm doing this through PEAR::DB::mysql

  I am not exactly sure how PEAR::DB will propagate this error through
  its error handling interface.

  An easy way to test this is to create a temporary table that has a
  TINYINT as its auto_incrementing primary key, fill the table up and
  then watch to see what breaks.
  
  Cheers!
  --zak

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



Re: [PHP-DEV] Question for Zeev, Zak or Georg - mysql_query andpossible integer overflow?

2003-03-25 Thread Matt Flaherty
Thanks Wez,

If all that happens is the query will fail, I can live with that. It's a
simple SELECT query called over and over again. If the integer wraps
around negative, I'm guessing that would probably have undesirable
effects. If not, then I can let it run forever. What I don't want is
something like a segfault. I'm considering making the application
restart itself periodically to clear out the cobwebs.

-Matt

On Tue, 2003-03-25 at 14:12, Wez Furlong wrote:
> Hi Matt,
> 
> Yes, there is a risk of overflow.
> >From my understanding, the id is signed, so you will hit overflow at 2G
> rather than 4G resources.
> This applies to any/all PHP/ZE resources.
> 
> I'm not sure what happens when it overflows; it seems like the query
> would fail.
> 
> You could design your application so that it re-runs itself when the
> query fails (pcntl_exec(), or one of the other execution functions).
> 
> --Wez.
> 


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



Re: [PHP-DEV] Question for Zeev, Zak or Georg - mysql_query andpossible integer overflow?

2003-03-25 Thread Wez Furlong
Hi Matt,

Yes, there is a risk of overflow.
>From my understanding, the id is signed, so you will hit overflow at 2G
rather than 4G resources.
This applies to any/all PHP/ZE resources.

I'm not sure what happens when it overflows; it seems like the query
would fail.

You could design your application so that it re-runs itself when the
query fails (pcntl_exec(), or one of the other execution functions).

--Wez.

On Tue, 25 Mar 2003, Matt Flaherty wrote:

> Hi,
>
> I have a question for the authors of the mysql extension. I'm sure you
> gentlemen are very busy, but I'd appreciate your insight if you can
> spare a moment. I'm developing a stand-alone php application running in
> an infinite loop from the command line interface. A mysql database is
> polled continually for new rows to deal with. The same query is executed
> several times in one second. I've noticed that whether or not a query
> resource is freed the next query identifier returned from mysql_query()
> is ++ the last one. I'm sure this is by design and governed by the mysql
> driver. Naturally I'm concerned about integer overflow when the the
> application has been running uninterrupted for a very long time. I don't
> think I can wait around while a test script runs to see what happens
> after 4,294,967,295 is exceeded though! Can anyone tell me with
> certainty or hazard a guess what might happen here? I thank you very
> much for your time.
>
> Matt
>
> ps - I'm doing this through PEAR::DB::mysql
> --
> Matt Flaherty <[EMAIL PROTECTED]>
> Boltblue International Ltd.
>
>
> --
> PHP Development Mailing List 
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>

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



[PHP-DEV] Question for Zeev, Zak or Georg - mysql_query and possible integeroverflow?

2003-03-25 Thread Matt Flaherty
Hi,

I have a question for the authors of the mysql extension. I'm sure you
gentlemen are very busy, but I'd appreciate your insight if you can
spare a moment. I'm developing a stand-alone php application running in
an infinite loop from the command line interface. A mysql database is
polled continually for new rows to deal with. The same query is executed
several times in one second. I've noticed that whether or not a query
resource is freed the next query identifier returned from mysql_query()
is ++ the last one. I'm sure this is by design and governed by the mysql
driver. Naturally I'm concerned about integer overflow when the the
application has been running uninterrupted for a very long time. I don't
think I can wait around while a test script runs to see what happens
after 4,294,967,295 is exceeded though! Can anyone tell me with
certainty or hazard a guess what might happen here? I thank you very
much for your time.

Matt

ps - I'm doing this through PEAR::DB::mysql
-- 
Matt Flaherty <[EMAIL PROTECTED]>
Boltblue International Ltd.


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