Mombu the Php Forum sponsored links

Go Back   Mombu the Php Forum > Php > #34782 : token_get_all gives wrong result
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 18th April 11:05
php-bugs
External User
 
Posts: 1
Default #34782 : token_get_all gives wrong result



From: linus at mccabe dot nu
Operating system: Linux & Windows
PHP version: 5.0.5
PHP Bug Type: Scripting Engine problem
Bug description: token_get_all gives wrong result

Description:
------------
This is bug 29761, I'd like to see it reopened.
(it might also be 33093, not sure)

Create the two php files in 'reproduce code'.
Point your browser to 'test.php'. First time you should get the expected
result, second the actual result.

If you have many apache threads, you might need to refresh a few times
until the error occurs.

I've tested and reproduced this on:
* Windows XP: Apache/2.0.52 (Win32) PHP/5.0.5
* Linux: Apache/1.3.33 (Debian GNU/Linux) PHP/4.3.10-15

(yes, error.php is supposed to have a parser error)

thanks for your time

/Linus

Reproduce code:
---------------
error.php:
<?php

print('abc'
;

?>

test.php:
<?php

header('Content-Type: text/plain');

$first = token_get_all('<?php $a=$b;');
print_r($first);

require('error.php');

?>

Expected result:
----------------
Array
(
[0] => Array
(
[0] => 366
[1] => <?php
)

[1] => Array
(
[0] => 309
[1] => $a
)

[2] => =
[3] => Array
(
[0] => 309
[1] => $b
)

[4] => ;
)
<br />
<b>Parse error</b>: parse error, unexpected ';' in <b>C:\Program
Files\Apache Group\Apache2\htdocs\error.php</b> on line <b>4</b><br />


Actual result:
--------------
Array
(
[0] => <
[1] => ?
[2] => Array
(
[0] => 307
[1] => php
)

[3] => Array
(
[0] => 369
[1] =>
)

[4] => Array
(
[0] => 309
[1] => $a
)

[5] => =
[6] => Array
(
[0] => 309
[1] => $b
)

[7] => ;
)
<br />
<b>Parse error</b>: parse error, unexpected ';' in <b>C:\Program
Files\Apache Group\Apache2\htdocs\error.php</b> on line <b>4</b><br />


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


  sponsored links


2 18th April 11:06
External User
 
Posts: 1
Default #34782 : token_get_all gives wrong result



ID: 34782
Updated by: sniper@php.net
Reported By: linus at mccabe dot nu
-Status: Open
+Status: Feedback
Bug Type: Scripting Engine problem
-Operating System: Linux & Windows
+Operating System: *
PHP Version: 5.0.5
New Comment:

Please try using this CVS snapshot:

http://snaps.php.net/php5-latest.tar.gz

For Windows:

http://snaps.php.net/win32/php5-win32-latest.zip


Previous Comments:
------------------------------------------------------------------------

[2005-10-07 18:06:53] linus at mccabe dot nu

Description:
------------
This is bug 29761, I'd like to see it reopened.
(it might also be 33093, not sure)

Create the two php files in 'reproduce code'.
Point your browser to 'test.php'. First time you should get the
expected result, second the actual result.

If you have many apache threads, you might need to refresh a few times
until the error occurs.

I've tested and reproduced this on:
* Windows XP: Apache/2.0.52 (Win32) PHP/5.0.5
* Linux: Apache/1.3.33 (Debian GNU/Linux) PHP/4.3.10-15

(yes, error.php is supposed to have a parser error)

thanks for your time

/Linus

Reproduce code:
---------------
error.php:
<?php

print('abc'
;

?>

test.php:
<?php

header('Content-Type: text/plain');

$first = token_get_all('<?php $a=$b;');
print_r($first);

require('error.php');

?>

Expected result:
----------------
Array
(
[0] => Array
(
[0] => 366
[1] => <?php
)

[1] => Array
(
[0] => 309
[1] => $a
)

[2] => =
[3] => Array
(
[0] => 309
[1] => $b
)

[4] => ;
)
<br />
<b>Parse error</b>: parse error, unexpected ';' in <b>C:\Program
Files\Apache Group\Apache2\htdocs\error.php</b> on line <b>4</b><br />


Actual result:
--------------
Array
(
[0] => <
[1] => ?
[2] => Array
(
[0] => 307
[1] => php
)

[3] => Array
(
[0] => 369
[1] =>
)

[4] => Array
(
[0] => 309
[1] => $a
)

[5] => =
[6] => Array
(
[0] => 309
[1] => $b
)

[7] => ;
)
<br />
<b>Parse error</b>: parse error, unexpected ';' in <b>C:\Program
Files\Apache Group\Apache2\htdocs\error.php</b> on line <b>4</b><br />

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


--
Edit this bug report at http://bugs.php.net/?id=34782&edit=1
  Reply With Quote
3 18th April 14:07
php-bugs
External User
 
Posts: 1
Default #34782 : token_get_all gives wrong result


ID: 34782
User updated by: linus at mccabe dot nu
Reported By: linus at mccabe dot nu
-Status: Feedback
+Status: Open
Bug Type: Scripting Engine problem
Operating System: *
PHP Version: 5.0.5
New Comment:

I tried with php5-win32-latest: Apache/2.0.52 (Win32) PHP/5.1.0RC2-dev

Same behaviour...


Previous Comments:
------------------------------------------------------------------------

[2005-10-07 21:56:48] sniper@php.net

Please try using this CVS snapshot:

http://snaps.php.net/php5-latest.tar.gz

For Windows:

http://snaps.php.net/win32/php5-win32-latest.zip

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

[2005-10-07 18:06:53] linus at mccabe dot nu

Description:
------------
This is bug 29761, I'd like to see it reopened.
(it might also be 33093, not sure)

Create the two php files in 'reproduce code'.
Point your browser to 'test.php'. First time you should get the
expected result, second the actual result.

If you have many apache threads, you might need to refresh a few times
until the error occurs.

I've tested and reproduced this on:
* Windows XP: Apache/2.0.52 (Win32) PHP/5.0.5
* Linux: Apache/1.3.33 (Debian GNU/Linux) PHP/4.3.10-15

(yes, error.php is supposed to have a parser error)

thanks for your time

/Linus

Reproduce code:
---------------
error.php:
<?php

print('abc'
;

?>

test.php:
<?php

header('Content-Type: text/plain');

$first = token_get_all('<?php $a=$b;');
print_r($first);

require('error.php');

?>

Expected result:
----------------
Array
(
[0] => Array
(
[0] => 366
[1] => <?php
)

[1] => Array
(
[0] => 309
[1] => $a
)

[2] => =
[3] => Array
(
[0] => 309
[1] => $b
)

[4] => ;
)
<br />
<b>Parse error</b>: parse error, unexpected ';' in <b>C:\Program
Files\Apache Group\Apache2\htdocs\error.php</b> on line <b>4</b><br />


Actual result:
--------------
Array
(
[0] => <
[1] => ?
[2] => Array
(
[0] => 307
[1] => php
)

[3] => Array
(
[0] => 369
[1] =>
)

[4] => Array
(
[0] => 309
[1] => $a
)

[5] => =
[6] => Array
(
[0] => 309
[1] => $b
)

[7] => ;
)
<br />
<b>Parse error</b>: parse error, unexpected ';' in <b>C:\Program
Files\Apache Group\Apache2\htdocs\error.php</b> on line <b>4</b><br />

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


--
Edit this bug report at http://bugs.php.net/?id=34782&edit=1
  Reply With Quote
4 18th April 14:07
php-bugs
External User
 
Posts: 1
Default #34782 : token_get_all gives wrong result


ID: 34782
User updated by: linus at mccabe dot nu
Reported By: linus at mccabe dot nu
Status: Open
Bug Type: Scripting Engine problem
Operating System: *
PHP Version: 5.0.5
New Comment:

I should also add that this is not reproducable with cli version of php
(probably because it's always a new process?).

Only with apache module have I seen this behaviour and once it get's
into 'error mode' it usually stays that way.

/Linus


Previous Comments:
------------------------------------------------------------------------

[2005-10-08 08:03:04] linus at mccabe dot nu

I tried with php5-win32-latest: Apache/2.0.52 (Win32) PHP/5.1.0RC2-dev

Same behaviour...

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

[2005-10-07 21:56:48] sniper@php.net

Please try using this CVS snapshot:

http://snaps.php.net/php5-latest.tar.gz

For Windows:

http://snaps.php.net/win32/php5-win32-latest.zip

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

[2005-10-07 18:06:53] linus at mccabe dot nu

Description:
------------
This is bug 29761, I'd like to see it reopened.
(it might also be 33093, not sure)

Create the two php files in 'reproduce code'.
Point your browser to 'test.php'. First time you should get the
expected result, second the actual result.

If you have many apache threads, you might need to refresh a few times
until the error occurs.

I've tested and reproduced this on:
* Windows XP: Apache/2.0.52 (Win32) PHP/5.0.5
* Linux: Apache/1.3.33 (Debian GNU/Linux) PHP/4.3.10-15

(yes, error.php is supposed to have a parser error)

thanks for your time

/Linus

Reproduce code:
---------------
error.php:
<?php

print('abc'
;

?>

test.php:
<?php

header('Content-Type: text/plain');

$first = token_get_all('<?php $a=$b;');
print_r($first);

require('error.php');

?>

Expected result:
----------------
Array
(
[0] => Array
(
[0] => 366
[1] => <?php
)

[1] => Array
(
[0] => 309
[1] => $a
)

[2] => =
[3] => Array
(
[0] => 309
[1] => $b
)

[4] => ;
)
<br />
<b>Parse error</b>: parse error, unexpected ';' in <b>C:\Program
Files\Apache Group\Apache2\htdocs\error.php</b> on line <b>4</b><br />


Actual result:
--------------
Array
(
[0] => <
[1] => ?
[2] => Array
(
[0] => 307
[1] => php
)

[3] => Array
(
[0] => 369
[1] =>
)

[4] => Array
(
[0] => 309
[1] => $a
)

[5] => =
[6] => Array
(
[0] => 309
[1] => $b
)

[7] => ;
)
<br />
<b>Parse error</b>: parse error, unexpected ';' in <b>C:\Program
Files\Apache Group\Apache2\htdocs\error.php</b> on line <b>4</b><br />

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


--
Edit this bug report at http://bugs.php.net/?id=34782&edit=1
  Reply With Quote
5 18th April 14:07
External User
 
Posts: 1
Default #34782 : token_get_all gives wrong result


ID: 34782
Updated by: derick@php.net
Reported By: linus at mccabe dot nu
Status: Open
Bug Type: Scripting Engine problem
Operating System: *
PHP Version: 5.0.5
New Comment:

This is probably related to the strange reports about highlight_string
doing weird things. If you can, please try to run this:
sudo valgrind /path/to/apachesrc/src/httpd -X
and request the same file twice. If valgrind gives any errors, please
put the trace online and provide a link here. With this we see if it is
indeed multiple requests causeing this problem.


Previous Comments:
------------------------------------------------------------------------

[2005-10-08 08:06:08] linus at mccabe dot nu

I should also add that this is not reproducable with cli version of php
(probably because it's always a new process?).

Only with apache module have I seen this behaviour and once it get's
into 'error mode' it usually stays that way.

/Linus

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

[2005-10-08 08:03:04] linus at mccabe dot nu

I tried with php5-win32-latest: Apache/2.0.52 (Win32) PHP/5.1.0RC2-dev

Same behaviour...

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

[2005-10-07 21:56:48] sniper@php.net

Please try using this CVS snapshot:

http://snaps.php.net/php5-latest.tar.gz

For Windows:

http://snaps.php.net/win32/php5-win32-latest.zip

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

[2005-10-07 18:06:53] linus at mccabe dot nu

Description:
------------
This is bug 29761, I'd like to see it reopened.
(it might also be 33093, not sure)

Create the two php files in 'reproduce code'.
Point your browser to 'test.php'. First time you should get the
expected result, second the actual result.

If you have many apache threads, you might need to refresh a few times
until the error occurs.

I've tested and reproduced this on:
* Windows XP: Apache/2.0.52 (Win32) PHP/5.0.5
* Linux: Apache/1.3.33 (Debian GNU/Linux) PHP/4.3.10-15

(yes, error.php is supposed to have a parser error)

thanks for your time

/Linus

Reproduce code:
---------------
error.php:
<?php

print('abc'
;

?>

test.php:
<?php

header('Content-Type: text/plain');

$first = token_get_all('<?php $a=$b;');
print_r($first);

require('error.php');

?>

Expected result:
----------------
Array
(
[0] => Array
(
[0] => 366
[1] => <?php
)

[1] => Array
(
[0] => 309
[1] => $a
)

[2] => =
[3] => Array
(
[0] => 309
[1] => $b
)

[4] => ;
)
<br />
<b>Parse error</b>: parse error, unexpected ';' in <b>C:\Program
Files\Apache Group\Apache2\htdocs\error.php</b> on line <b>4</b><br />


Actual result:
--------------
Array
(
[0] => <
[1] => ?
[2] => Array
(
[0] => 307
[1] => php
)

[3] => Array
(
[0] => 369
[1] =>
)

[4] => Array
(
[0] => 309
[1] => $a
)

[5] => =
[6] => Array
(
[0] => 309
[1] => $b
)

[7] => ;
)
<br />
<b>Parse error</b>: parse error, unexpected ';' in <b>C:\Program
Files\Apache Group\Apache2\htdocs\error.php</b> on line <b>4</b><br />

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


--
Edit this bug report at http://bugs.php.net/?id=34782&edit=1
  Reply With Quote
6 18th April 14:07
External User
 
Posts: 1
Default #34782 : token_get_all gives wrong result


ID: 34782
Updated by: derick@php.net
Reported By: linus at mccabe dot nu
-Status: Open
+Status: Feedback
Bug Type: Scripting Engine problem
Operating System: *
PHP Version: 5.0.5


Previous Comments:
------------------------------------------------------------------------

[2005-10-08 13:37:45] derick@php.net

This is probably related to the strange reports about highlight_string
doing weird things. If you can, please try to run this:
sudo valgrind /path/to/apachesrc/src/httpd -X
and request the same file twice. If valgrind gives any errors, please
put the trace online and provide a link here. With this we see if it is
indeed multiple requests causeing this problem.

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

[2005-10-08 08:06:08] linus at mccabe dot nu

I should also add that this is not reproducable with cli version of php
(probably because it's always a new process?).

Only with apache module have I seen this behaviour and once it get's
into 'error mode' it usually stays that way.

/Linus

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

[2005-10-08 08:03:04] linus at mccabe dot nu

I tried with php5-win32-latest: Apache/2.0.52 (Win32) PHP/5.1.0RC2-dev

Same behaviour...

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

[2005-10-07 21:56:48] sniper@php.net

Please try using this CVS snapshot:

http://snaps.php.net/php5-latest.tar.gz

For Windows:

http://snaps.php.net/win32/php5-win32-latest.zip

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

[2005-10-07 18:06:53] linus at mccabe dot nu

Description:
------------
This is bug 29761, I'd like to see it reopened.
(it might also be 33093, not sure)

Create the two php files in 'reproduce code'.
Point your browser to 'test.php'. First time you should get the
expected result, second the actual result.

If you have many apache threads, you might need to refresh a few times
until the error occurs.

I've tested and reproduced this on:
* Windows XP: Apache/2.0.52 (Win32) PHP/5.0.5
* Linux: Apache/1.3.33 (Debian GNU/Linux) PHP/4.3.10-15

(yes, error.php is supposed to have a parser error)

thanks for your time

/Linus

Reproduce code:
---------------
error.php:
<?php

print('abc'
;

?>

test.php:
<?php

header('Content-Type: text/plain');

$first = token_get_all('<?php $a=$b;');
print_r($first);

require('error.php');

?>

Expected result:
----------------
Array
(
[0] => Array
(
[0] => 366
[1] => <?php
)

[1] => Array
(
[0] => 309
[1] => $a
)

[2] => =
[3] => Array
(
[0] => 309
[1] => $b
)

[4] => ;
)
<br />
<b>Parse error</b>: parse error, unexpected ';' in <b>C:\Program
Files\Apache Group\Apache2\htdocs\error.php</b> on line <b>4</b><br />


Actual result:
--------------
Array
(
[0] => <
[1] => ?
[2] => Array
(
[0] => 307
[1] => php
)

[3] => Array
(
[0] => 369
[1] =>
)

[4] => Array
(
[0] => 309
[1] => $a
)

[5] => =
[6] => Array
(
[0] => 309
[1] => $b
)

[7] => ;
)
<br />
<b>Parse error</b>: parse error, unexpected ';' in <b>C:\Program
Files\Apache Group\Apache2\htdocs\error.php</b> on line <b>4</b><br />

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


--
Edit this bug report at http://bugs.php.net/?id=34782&edit=1
  Reply With Quote
7 18th April 14:07
php-bugs
External User
 
Posts: 1
Default #34782 : token_get_all gives wrong result


ID: 34782
User updated by: linus at mccabe dot nu
Reported By: linus at mccabe dot nu
-Status: Feedback
+Status: Open
Bug Type: Scripting Engine problem
Operating System: *
PHP Version: 5.0.5
New Comment:

Here you'll find some valgrind outputs:
http://x.mccabe.nu/public/traces/

I didnt build apache from source, so I used:
valgrind --log-file=./trace1 /usr/sbin/apache -X
I hope its good enough anyway?

The result can be seen in trace1.log, trace2.log and trace3.log.

trace1.log shows was on a request on a small php file that did not
include any parsing error or use token_get_all.

trace2.log shows the request of earlier mentioned 'test.php' requested
once.

trace3.log shows the request of 'test.php' requested twice and the
second time it gave the wrong result.

traceX_full.log is the same request all over again, but using:
valgrind --leak-check=full --log-file=./trace1 /usr/sbin/apache -X

Hope this helps and let me know if there's anything else i can do!

/Linus


Previous Comments:
------------------------------------------------------------------------

[2005-10-08 13:37:45] derick@php.net

This is probably related to the strange reports about highlight_string
doing weird things. If you can, please try to run this:
sudo valgrind /path/to/apachesrc/src/httpd -X
and request the same file twice. If valgrind gives any errors, please
put the trace online and provide a link here. With this we see if it is
indeed multiple requests causeing this problem.

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

[2005-10-08 08:06:08] linus at mccabe dot nu

I should also add that this is not reproducable with cli version of php
(probably because it's always a new process?).

Only with apache module have I seen this behaviour and once it get's
into 'error mode' it usually stays that way.

/Linus

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

[2005-10-08 08:03:04] linus at mccabe dot nu

I tried with php5-win32-latest: Apache/2.0.52 (Win32) PHP/5.1.0RC2-dev

Same behaviour...

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

[2005-10-07 21:56:48] sniper@php.net

Please try using this CVS snapshot:

http://snaps.php.net/php5-latest.tar.gz

For Windows:

http://snaps.php.net/win32/php5-win32-latest.zip

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

[2005-10-07 18:06:53] linus at mccabe dot nu

Description:
------------
This is bug 29761, I'd like to see it reopened.
(it might also be 33093, not sure)

Create the two php files in 'reproduce code'.
Point your browser to 'test.php'. First time you should get the
expected result, second the actual result.

If you have many apache threads, you might need to refresh a few times
until the error occurs.

I've tested and reproduced this on:
* Windows XP: Apache/2.0.52 (Win32) PHP/5.0.5
* Linux: Apache/1.3.33 (Debian GNU/Linux) PHP/4.3.10-15

(yes, error.php is supposed to have a parser error)

thanks for your time

/Linus

Reproduce code:
---------------
error.php:
<?php

print('abc'
;

?>

test.php:
<?php

header('Content-Type: text/plain');

$first = token_get_all('<?php $a=$b;');
print_r($first);

require('error.php');

?>

Expected result:
----------------
Array
(
[0] => Array
(
[0] => 366
[1] => <?php
)

[1] => Array
(
[0] => 309
[1] => $a
)

[2] => =
[3] => Array
(
[0] => 309
[1] => $b
)

[4] => ;
)
<br />
<b>Parse error</b>: parse error, unexpected ';' in <b>C:\Program
Files\Apache Group\Apache2\htdocs\error.php</b> on line <b>4</b><br />


Actual result:
--------------
Array
(
[0] => <
[1] => ?
[2] => Array
(
[0] => 307
[1] => php
)

[3] => Array
(
[0] => 369
[1] =>
)

[4] => Array
(
[0] => 309
[1] => $a
)

[5] => =
[6] => Array
(
[0] => 309
[1] => $b
)

[7] => ;
)
<br />
<b>Parse error</b>: parse error, unexpected ';' in <b>C:\Program
Files\Apache Group\Apache2\htdocs\error.php</b> on line <b>4</b><br />

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


--
Edit this bug report at http://bugs.php.net/?id=34782&edit=1
  Reply With Quote
8 18th April 14:08
External User
 
Posts: 1
Default #34782 : token_get_all gives wrong result


ID: 34782
Updated by: sniper@php.net
Reported By: linus at mccabe dot nu
-Status: Open
+Status: Feedback
Bug Type: Scripting Engine problem
Operating System: *
PHP Version: 5CVS-2005-10-08 (snap)
New Comment:

What configure line did you use? What MPM you use in Apache2?

Previous Comments:
------------------------------------------------------------------------

[2005-10-08 14:50:52] linus at mccabe dot nu

Here you'll find some valgrind outputs:
http://x.mccabe.nu/public/traces/

I didnt build apache from source, so I used:
valgrind --log-file=./trace1 /usr/sbin/apache -X
I hope its good enough anyway?

The result can be seen in trace1.log, trace2.log and trace3.log.

trace1.log shows was on a request on a small php file that did not
include any parsing error or use token_get_all.

trace2.log shows the request of earlier mentioned 'test.php' requested
once.

trace3.log shows the request of 'test.php' requested twice and the
second time it gave the wrong result.

traceX_full.log is the same request all over again, but using:
valgrind --leak-check=full --log-file=./trace1 /usr/sbin/apache -X

Hope this helps and let me know if there's anything else i can do!

/Linus

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

[2005-10-08 13:37:45] derick@php.net

This is probably related to the strange reports about highlight_string
doing weird things. If you can, please try to run this:
sudo valgrind /path/to/apachesrc/src/httpd -X
and request the same file twice. If valgrind gives any errors, please
put the trace online and provide a link here. With this we see if it is
indeed multiple requests causeing this problem.

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

[2005-10-08 08:06:08] linus at mccabe dot nu

I should also add that this is not reproducable with cli version of php
(probably because it's always a new process?).

Only with apache module have I seen this behaviour and once it get's
into 'error mode' it usually stays that way.

/Linus

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

[2005-10-08 08:03:04] linus at mccabe dot nu

I tried with php5-win32-latest: Apache/2.0.52 (Win32) PHP/5.1.0RC2-dev

Same behaviour...

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

[2005-10-07 21:56:48] sniper@php.net

Please try using this CVS snapshot:

http://snaps.php.net/php5-latest.tar.gz

For Windows:

http://snaps.php.net/win32/php5-win32-latest.zip

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

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/34782

--
Edit this bug report at http://bugs.php.net/?id=34782&edit=1
  Reply With Quote
9 18th April 14:08
php-bugs
External User
 
Posts: 1
Default #34782 : token_get_all gives wrong result


ID: 34782
User updated by: linus at mccabe dot nu
Reported By: linus at mccabe dot nu
-Status: Feedback
+Status: Open
Bug Type: Scripting Engine problem
Operating System: *
-PHP Version: 5CVS-2005-10-08 (snap)
+PHP Version: 5.0.5
New Comment:

I did another test and altered test.php to look like:

<?php

header('Content-Type: text/plain');

register_shutdown_function('term');

$first = token_get_all('<?php $a=$b;');
print_r($first);

require('error.php');

function term()
{
apache_child_terminate();
}

?>

After that it gives the correct result every time.
This is of course not an ideal solution, but I thought it might give
yet another hint that the failing has something to do with the previous
script's error.

Also, I've tried with other errors than parsing errors (like doing
division by zero, trigger_error, etc) but nothing else seems to get php
into 'error mode'.


Previous Comments:
------------------------------------------------------------------------

[2005-10-08 18:21:58] sniper@php.net

What configure line did you use? What MPM you use in Apache2?


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

[2005-10-08 14:50:52] linus at mccabe dot nu

Here you'll find some valgrind outputs:
http://x.mccabe.nu/public/traces/

I didnt build apache from source, so I used:
valgrind --log-file=./trace1 /usr/sbin/apache -X
I hope its good enough anyway?

The result can be seen in trace1.log, trace2.log and trace3.log.

trace1.log shows was on a request on a small php file that did not
include any parsing error or use token_get_all.

trace2.log shows the request of earlier mentioned 'test.php' requested
once.

trace3.log shows the request of 'test.php' requested twice and the
second time it gave the wrong result.

traceX_full.log is the same request all over again, but using:
valgrind --leak-check=full --log-file=./trace1 /usr/sbin/apache -X

Hope this helps and let me know if there's anything else i can do!

/Linus

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

[2005-10-08 13:37:45] derick@php.net

This is probably related to the strange reports about highlight_string
doing weird things. If you can, please try to run this:
sudo valgrind /path/to/apachesrc/src/httpd -X
and request the same file twice. If valgrind gives any errors, please
put the trace online and provide a link here. With this we see if it is
indeed multiple requests causeing this problem.

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

[2005-10-08 08:06:08] linus at mccabe dot nu

I should also add that this is not reproducable with cli version of php
(probably because it's always a new process?).

Only with apache module have I seen this behaviour and once it get's
into 'error mode' it usually stays that way.

/Linus

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

[2005-10-08 08:03:04] linus at mccabe dot nu

I tried with php5-win32-latest: Apache/2.0.52 (Win32) PHP/5.1.0RC2-dev

Same behaviour...

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

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/34782

--
Edit this bug report at http://bugs.php.net/?id=34782&edit=1
  Reply With Quote
10 18th April 14:08
php-bugs
External User
 
Posts: 1
Default #34782 : token_get_all gives wrong result


ID: 34782
User updated by: linus at mccabe dot nu
Reported By: linus at mccabe dot nu
Status: Open
Bug Type: Scripting Engine problem
Operating System: *
PHP Version: 5.0.5
New Comment:

I put my phpinfo's in
http://x.mccabe.nu/public/traces/

one for the linux box and one for the windows box.

On windows I have apache2, binaries supplied by apache foundation.
On Linux I use debian's apache packages, but it's apache 1.3


Previous Comments:
------------------------------------------------------------------------

[2005-10-08 18:22:25] linus at mccabe dot nu

I did another test and altered test.php to look like:

<?php

header('Content-Type: text/plain');

register_shutdown_function('term');

$first = token_get_all('<?php $a=$b;');
print_r($first);

require('error.php');

function term()
{
apache_child_terminate();
}

?>

After that it gives the correct result every time.
This is of course not an ideal solution, but I thought it might give
yet another hint that the failing has something to do with the previous
script's error.

Also, I've tried with other errors than parsing errors (like doing
division by zero, trigger_error, etc) but nothing else seems to get php
into 'error mode'.

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

[2005-10-08 18:21:58] sniper@php.net

What configure line did you use? What MPM you use in Apache2?


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

[2005-10-08 14:50:52] linus at mccabe dot nu

Here you'll find some valgrind outputs:
http://x.mccabe.nu/public/traces/

I didnt build apache from source, so I used:
valgrind --log-file=./trace1 /usr/sbin/apache -X
I hope its good enough anyway?

The result can be seen in trace1.log, trace2.log and trace3.log.

trace1.log shows was on a request on a small php file that did not
include any parsing error or use token_get_all.

trace2.log shows the request of earlier mentioned 'test.php' requested
once.

trace3.log shows the request of 'test.php' requested twice and the
second time it gave the wrong result.

traceX_full.log is the same request all over again, but using:
valgrind --leak-check=full --log-file=./trace1 /usr/sbin/apache -X

Hope this helps and let me know if there's anything else i can do!

/Linus

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

[2005-10-08 13:37:45] derick@php.net

This is probably related to the strange reports about highlight_string
doing weird things. If you can, please try to run this:
sudo valgrind /path/to/apachesrc/src/httpd -X
and request the same file twice. If valgrind gives any errors, please
put the trace online and provide a link here. With this we see if it is
indeed multiple requests causeing this problem.

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

[2005-10-08 08:06:08] linus at mccabe dot nu

I should also add that this is not reproducable with cli version of php
(probably because it's always a new process?).

Only with apache module have I seen this behaviour and once it get's
into 'error mode' it usually stays that way.

/Linus

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

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/34782

--
Edit this bug report at http://bugs.php.net/?id=34782&edit=1
  Reply With Quote
Reply


Thread Tools
Display Modes




Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666