#42517 [NEW]: set_include_path('') doesn't work as expected

2007-09-01 Thread php at ideacode dot com
From: php at ideacode dot com
Operating system: Linux
PHP version:  5.2.4
PHP Bug Type: Feature/Change Request
Bug description:  set_include_path('') doesn't work as expected

Description:

There are legitimate "secure-operation" situations when you want the
include path wiped out, so that all included files must be explicitly
stated.

The obvious way to set this is with either:
set_include_path(''); // or
ini_set('include_path', '');

However, neither one of these sets the include path to '' on the latest
version of PHP 4 or PHP 5 in Linux.

A non-obvious workaround is to use a whitespace string:
set_include_path(' '); // or
ini_set('include_path', ' ');

which does set the path to ' ' (which hopefully isn't a valid
directory!).

I believe passing a lambda string to either set_include_path or
ini_set('include_path') should set the path to the lambda string.

http://bytejar.com/ - Software Lessons Learned the Hard Way

Reproduce code:
---
$original_path = set_include_path('');


Expected result:

'' === get_include_path();

Actual result:
--
$original_path === get_include_path();

-- 
Edit bug report at http://bugs.php.net/?id=42517&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=42517&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=42517&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=42517&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=42517&r=fixedcvs
Fixed in release: 
http://bugs.php.net/fix.php?id=42517&r=alreadyfixed
Need backtrace:   http://bugs.php.net/fix.php?id=42517&r=needtrace
Need Reproduce Script:http://bugs.php.net/fix.php?id=42517&r=needscript
Try newer version:http://bugs.php.net/fix.php?id=42517&r=oldversion
Not developer issue:  http://bugs.php.net/fix.php?id=42517&r=support
Expected behavior:http://bugs.php.net/fix.php?id=42517&r=notwrong
Not enough info:  
http://bugs.php.net/fix.php?id=42517&r=notenoughinfo
Submitted twice:  
http://bugs.php.net/fix.php?id=42517&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=42517&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=42517&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=42517&r=dst
IIS Stability:http://bugs.php.net/fix.php?id=42517&r=isapi
Install GNU Sed:  http://bugs.php.net/fix.php?id=42517&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=42517&r=float
No Zend Extensions:   http://bugs.php.net/fix.php?id=42517&r=nozend
MySQL Configuration Error:http://bugs.php.net/fix.php?id=42517&r=mysqlcfg


#24943 [NoF->Csd]: static variables in tick handler persist across multiple invocations

2005-07-08 Thread php at ideacode dot com
 ID:   24943
 User updated by:  php at ideacode dot com
 Reported By:  php at ideacode dot com
-Status:   No Feedback
+Status:   Closed
 Bug Type: Scripting Engine problem
 Operating System: * (all SAPIs except CGI!)
 PHP Version:  5CVS, 4CVS (2004-04-14)
 New Comment:

Agreed, closing; cannot reproduce in latest PHP4.


Previous Comments:


[2005-06-27 01:00:03] php-bugs at lists dot php dot net

No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".



[2005-06-19 21:33:42] [EMAIL PROTECTED]

Please try using this CVS snapshot:

  http://snaps.php.net/php4-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-STABLE-latest.zip

I can't reproduce.




[2003-08-04 21:37:28] php at ideacode dot com

The bug also occurs if you use a member variable within an object and
an object method as the callback:

  3 class Foo {
  4 function Foo() {
  5 $this->static = 0;
  6 }
  7
  8 function heartbeat($return = false) {
  9 $auto   = 0;
 10
 11 if ($return) {
 12 return "static=[{$this->static}]\nauto=[$auto]\n";
 13 } else {
 14 $this->static++;
 15 $auto++;
 16 }
 17
 18 }
 19 }
 20 $foo = new Foo();
 21
 22 register_tick_function(array (&$foo, 'heartbeat'));
 23 declare (ticks = 1) {
 24 // no op
 25 }
 26 echo $foo->heartbeat(true);

----------------

[2003-08-04 21:10:34] php at ideacode dot com

Description:

The values of static variables within a tick handler (registered with
register_tick_function) persist across multiple invocations of the
script.

You can run and re-run this script as many times as you like; the
static variable value keeps growing.

This bug is similar to #11536 and #17283, but those were closed due to
lack of response.

Reproduce code:
---
  1 function heartbeat($return = false) {
  2 static $static = 0;
  3$auto   = 0;
  4
  5 if ($return) {
  6 return "static=[$static]\nauto=[$auto]\n";
  7 } else {
  8 $static++;
  9 $auto++;
 10 }
 11
 12 }
 13
 14 register_tick_function('heartbeat');
 15 declare (ticks = 1) {
 16 }
 17 echo heartbeat(true);

Expected result:

At the end of each run of this script, the value of $static should be 1
and the value of $auto should be 0.

According to the documentation, the tick function (heartbeat) will be
called for every tick (1) statements ecxecuted in the declare block,
PLUS 1 for the declare close curly (line 16).  Because there are 0
statements in the block, I expect 0/1 + 1 callbacks to hearbeat.

Consequently, $static should have a value of 1 (incremented once) and
$auto should have a value of 0 (incremented once but looses value after
each call) when explicitly called on line 18.

If you set ticks = 2, I would expect 0/2 + 1 callbacks. Because there
are no statements in the block, ANY value of ticks should still execute
only once.  Ergo, regardless of the ticks setting, $static should still
have a value of 1 and $auto a value of 0.

Actual result:
--
At the end of each run of this script, the value of $static increases
relative to the value it had at the LAST run, and $auto remains at 0
always.  Furthermore, "LAST" appears to refer to the last value in the
particular Apache child. If I set Apache to 1 child only, the value
always increases relative to that single value, rather than bouncing
around.

In other words, the static variable within heartbeat appears to retain
its value ACROSS invocations. While this would otherwise be a nice
feature, the value bounces around (ie is not monotonically
increasing).

Also, with ticks = 1, the value of the static variable appears to
increase by 2 each time: 2, 4, 6, 8, etc. With ticks = 2, $static
increases by 1: 1, 2, 3, etc.  With ticks >= 3, $static doesn't
increase at all: 0, 0, 0, etc.
(This may be a separate bug, but I'd rather just mention it here)





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


#24943 [NoF->Opn]: static variables in tick handler persist across multiple invocations

2003-08-14 Thread php at ideacode dot com
 ID:   24943
 User updated by:  php at ideacode dot com
 Reported By:  php at ideacode dot com
-Status:   No Feedback
+Status:   Open
 Bug Type: Scripting Engine problem
 Operating System: Linux 2.4.18-3
 PHP Version:  4.3.2 (Apache module)
 New Comment:

I haven't yet tested it on the new release candidate. I don't have a
non-production box to upgrade at this time.
It's on my TODO. :)


Previous Comments:


[2003-08-10 21:45:12] [EMAIL PROTECTED]

No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.





[2003-08-05 10:51:44] [EMAIL PROTECTED]

Please try using this CVS snapshot:

  http://snaps.php.net/php4-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-STABLE-latest.zip



----

[2003-08-04 21:37:28] php at ideacode dot com

The bug also occurs if you use a member variable within an object and
an object method as the callback:

  3 class Foo {
  4 function Foo() {
  5 $this->static = 0;
  6 }
  7
  8 function heartbeat($return = false) {
  9 $auto   = 0;
 10
 11 if ($return) {
 12 return "static=[{$this->static}]\nauto=[$auto]\n";
 13 } else {
 14 $this->static++;
 15 $auto++;
 16 }
 17
 18 }
 19 }
 20 $foo = new Foo();
 21
 22 register_tick_function(array (&$foo, 'heartbeat'));
 23 declare (ticks = 1) {
 24 // no op
 25 }
 26 echo $foo->heartbeat(true);

--------------------

[2003-08-04 21:10:34] php at ideacode dot com

Description:

The values of static variables within a tick handler (registered with
register_tick_function) persist across multiple invocations of the
script.

You can run and re-run this script as many times as you like; the
static variable value keeps growing.

This bug is similar to #11536 and #17283, but those were closed due to
lack of response.

Reproduce code:
---
  1 function heartbeat($return = false) {
  2 static $static = 0;
  3$auto   = 0;
  4
  5 if ($return) {
  6 return "static=[$static]\nauto=[$auto]\n";
  7 } else {
  8 $static++;
  9 $auto++;
 10 }
 11
 12 }
 13
 14 register_tick_function('heartbeat');
 15 declare (ticks = 1) {
 16 }
 17 echo heartbeat(true);

Expected result:

At the end of each run of this script, the value of $static should be 1
and the value of $auto should be 0.

According to the documentation, the tick function (heartbeat) will be
called for every tick (1) statements ecxecuted in the declare block,
PLUS 1 for the declare close curly (line 16).  Because there are 0
statements in the block, I expect 0/1 + 1 callbacks to hearbeat.

Consequently, $static should have a value of 1 (incremented once) and
$auto should have a value of 0 (incremented once but looses value after
each call) when explicitly called on line 18.

If you set ticks = 2, I would expect 0/2 + 1 callbacks. Because there
are no statements in the block, ANY value of ticks should still execute
only once.  Ergo, regardless of the ticks setting, $static should still
have a value of 1 and $auto a value of 0.

Actual result:
--
At the end of each run of this script, the value of $static increases
relative to the value it had at the LAST run, and $auto remains at 0
always.  Furthermore, "LAST" appears to refer to the last value in the
particular Apache child. If I set Apache to 1 child only, the value
always increases relative to that single value, rather than bouncing
around.

In other words, the static variable within heartbeat appears to retain
its value ACROSS invocations. While this would otherwise be a nice
feature, the value bounces around (ie is not monotonically
increasing).

Also, with ticks = 1, the value of the static variable appears to
increase by 2 each time: 2, 4, 6, 8, etc. With ticks = 2, $static
increases by 1: 1, 2, 3, etc.  With ticks >= 3, $static doesn't
increase at all: 0, 0, 0, etc.
(This may be a separate bug, but I'd rather just mention it here)





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



#24943 [NEW]: static variables in tick handler persist across multiple invocations

2003-08-14 Thread php at ideacode dot com
From: php at ideacode dot com
Operating system: Linux 2.4.18-3
PHP version:  4.3.2
PHP Bug Type: *Programming Data Structures
Bug description:  static variables in tick handler persist across multiple invocations

Description:

The values of static variables within a tick handler (registered with
register_tick_function) persist across multiple invocations of the
script.

You can run and re-run this script as many times as you like; the static
variable value keeps growing.

This bug is similar to #11536 and #17283, but those were closed due to
lack of response.

Reproduce code:
---
  1 function heartbeat($return = false) {
  2 static $static = 0;
  3$auto   = 0;
  4
  5 if ($return) {
  6 return "static=[$static]\nauto=[$auto]\n";
  7 } else {
  8 $static++;
  9 $auto++;
 10 }
 11
 12 }
 13
 14 register_tick_function('heartbeat');
 15 declare (ticks = 1) {
 16 }
 17 echo heartbeat(true);

Expected result:

At the end of each run of this script, the value of $static should be 1
and the value of $auto should be 0.

According to the documentation, the tick function (heartbeat) will be
called for every tick (1) statements ecxecuted in the declare block, PLUS
1 for the declare close curly (line 16).  Because there are 0 statements
in the block, I expect 0/1 + 1 callbacks to hearbeat.

Consequently, $static should have a value of 1 (incremented once) and
$auto should have a value of 0 (incremented once but looses value after
each call) when explicitly called on line 18.

If you set ticks = 2, I would expect 0/2 + 1 callbacks. Because there are
no statements in the block, ANY value of ticks should still execute only
once.  Ergo, regardless of the ticks setting, $static should still have a
value of 1 and $auto a value of 0.

Actual result:
--
At the end of each run of this script, the value of $static increases
relative to the value it had at the LAST run, and $auto remains at 0
always.  Furthermore, "LAST" appears to refer to the last value in the
particular Apache child. If I set Apache to 1 child only, the value always
increases relative to that single value, rather than bouncing around.

In other words, the static variable within heartbeat appears to retain its
value ACROSS invocations. While this would otherwise be a nice feature,
the value bounces around (ie is not monotonically increasing).

Also, with ticks = 1, the value of the static variable appears to increase
by 2 each time: 2, 4, 6, 8, etc. With ticks = 2, $static increases by 1:
1, 2, 3, etc.  With ticks >= 3, $static doesn't increase at all: 0, 0, 0,
etc.
(This may be a separate bug, but I'd rather just mention it here)

-- 
Edit bug report at http://bugs.php.net/?id=24943&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=24943&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=24943&r=trysnapshot5
Fixed in CVS:   http://bugs.php.net/fix.php?id=24943&r=fixedcvs
Fixed in release:   http://bugs.php.net/fix.php?id=24943&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=24943&r=needtrace
Try newer version:  http://bugs.php.net/fix.php?id=24943&r=oldversion
Not developer issue:http://bugs.php.net/fix.php?id=24943&r=support
Expected behavior:  http://bugs.php.net/fix.php?id=24943&r=notwrong
Not enough info:http://bugs.php.net/fix.php?id=24943&r=notenoughinfo
Submitted twice:http://bugs.php.net/fix.php?id=24943&r=submittedtwice
register_globals:   http://bugs.php.net/fix.php?id=24943&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24943&r=php3
Daylight Savings:   http://bugs.php.net/fix.php?id=24943&r=dst
IIS Stability:  http://bugs.php.net/fix.php?id=24943&r=isapi
Install GNU Sed:http://bugs.php.net/fix.php?id=24943&r=gnused



#24943 [Opn]: static variables in tick handler persist across multiple invocations

2003-08-04 Thread php at ideacode dot com
 ID:   24943
 User updated by:  php at ideacode dot com
 Reported By:  php at ideacode dot com
 Status:   Open
 Bug Type: *Programming Data Structures
 Operating System: Linux 2.4.18-3
-PHP Version:  4.3.2
+PHP Version:  4.3.2 (Apache module)
 New Comment:

The bug also occurs if you use a member variable within an object and
an object method as the callback:

  3 class Foo {
  4 function Foo() {
  5 $this->static = 0;
  6 }
  7
  8 function heartbeat($return = false) {
  9 $auto   = 0;
 10
 11 if ($return) {
 12 return "static=[{$this->static}]\nauto=[$auto]\n";
 13 } else {
 14 $this->static++;
 15 $auto++;
 16 }
 17
 18 }
 19 }
 20 $foo = new Foo();
 21
 22 register_tick_function(array (&$foo, 'heartbeat'));
 23 declare (ticks = 1) {
 24 // no op
 25 }
 26 echo $foo->heartbeat(true);


Previous Comments:
--------

[2003-08-04 21:10:34] php at ideacode dot com

Description:

The values of static variables within a tick handler (registered with
register_tick_function) persist across multiple invocations of the
script.

You can run and re-run this script as many times as you like; the
static variable value keeps growing.

This bug is similar to #11536 and #17283, but those were closed due to
lack of response.

Reproduce code:
---
  1 function heartbeat($return = false) {
  2 static $static = 0;
  3$auto   = 0;
  4
  5 if ($return) {
  6 return "static=[$static]\nauto=[$auto]\n";
  7 } else {
  8 $static++;
  9 $auto++;
 10 }
 11
 12 }
 13
 14 register_tick_function('heartbeat');
 15 declare (ticks = 1) {
 16 }
 17 echo heartbeat(true);

Expected result:

At the end of each run of this script, the value of $static should be 1
and the value of $auto should be 0.

According to the documentation, the tick function (heartbeat) will be
called for every tick (1) statements ecxecuted in the declare block,
PLUS 1 for the declare close curly (line 16).  Because there are 0
statements in the block, I expect 0/1 + 1 callbacks to hearbeat.

Consequently, $static should have a value of 1 (incremented once) and
$auto should have a value of 0 (incremented once but looses value after
each call) when explicitly called on line 18.

If you set ticks = 2, I would expect 0/2 + 1 callbacks. Because there
are no statements in the block, ANY value of ticks should still execute
only once.  Ergo, regardless of the ticks setting, $static should still
have a value of 1 and $auto a value of 0.

Actual result:
--
At the end of each run of this script, the value of $static increases
relative to the value it had at the LAST run, and $auto remains at 0
always.  Furthermore, "LAST" appears to refer to the last value in the
particular Apache child. If I set Apache to 1 child only, the value
always increases relative to that single value, rather than bouncing
around.

In other words, the static variable within heartbeat appears to retain
its value ACROSS invocations. While this would otherwise be a nice
feature, the value bounces around (ie is not monotonically
increasing).

Also, with ticks = 1, the value of the static variable appears to
increase by 2 each time: 2, 4, 6, 8, etc. With ticks = 2, $static
increases by 1: 1, 2, 3, etc.  With ticks >= 3, $static doesn't
increase at all: 0, 0, 0, etc.
(This may be a separate bug, but I'd rather just mention it here)





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