ID:               48923
 Updated by:       [email protected]
 Reported By:      raulsanchezt at gmail dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         *Programming Data Structures
 Operating System: Fedora 6
 PHP Version:      5.2.10
 New Comment:

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.




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

[2009-07-14 22:42:37] ninzya at inbox dot lv

You should be more carefully reading PHP docs and practicing your code
debugging rather than posting "cool ass kicking fail code" reports,
because your code contains bugs.

1) First two loops are infinite loops because !$v_success is always
true (i guess you should put "&&" (and) op instead of "or"), and the
last one shows you "expected result" because "$v_success = false" is an
assignment operation (nonsense), after which your loop hits false in
$v_success and goes on to compare "$v_x < $_SESSION["v_attempts"]" and
runs until it's false too.

2) Do you have session_start()'ed at the time of using $_SESSION
array?

The segmentation fault you see you get when you hit ctrl-c?

PHP has nothing to do with firefox scripting.

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

[2009-07-14 20:05:52] raulsanchezt at gmail dot com

Description:
------------
What you'll see below are three versions of the same code. Version a)
worked for me all along PHP4 (for years and years). After upgrading to
PHP5 it's not working anymore. Version b) does not work either. Version
c) does work.

Version a) runs indefinitely until I Ctrl-C it.
Version b) runs indefinitely until I Ctrl-C it.
Version c) runs for a millionth of a second and shows the expected
result


This code is a great simplification of what I actually coded (a MySQL
wrapper). I spent two full weeks trying to find out what was wrong with
my new PHP5/MySQL/Zend Debugger/Eclipse implementation until I bumped
into this little, unbelievable, never-to-be-expected bug.

Reproduce code:
---------------
// version a) while() does not work anymore
$v_x = 0;
$v_success = false;
$_SESSION["v_attempts"] = 20;
while(!$v_success or ($v_x < $_SESSION["v_attempts"]))
{
  // irrelevant code that may change the value of $v_success
  $v_x++;
}

// version b) while() does not work either
$v_x = 0;
$v_success = false;
$_SESSION["v_attempts"] = 20;
while((!$v_success) or ($v_x < $_SESSION["v_attempts"]))
{
  // irrelevant code that may change the value of $v_success
  $v_x++;
}

// version c) this one works
$v_x = 0;
$v_success = false;
$_SESSION["v_attempts"] = 20;
while(($v_success = false) or ($v_x < $_SESSION["v_attempts"]))
{
  // irrelevant code that may change the value of $v_success
  $v_x++;
}

Expected result:
----------------
I expect to see the actual value of $v_x, which should be 20.
 

Actual result:
--------------
(gdb) run testfile.php
Starting program: /usr/local/zend/bin/php testfile.php
warning: Lowest section in system-supplied DSO at 0xffffe000 is .hash
at ffffe0b4
(no debugging symbols found)
(no debugging symbols found)
[Thread debugging using libthread_db enabled]
[New Thread 4160407232 (LWP 24052)]
Error while reading shared library symbols:
Cannot find new threads: generic error
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
Segmentation fault

NOTE: all three versions produce this output. The three versions run
the same as CGIs and as Firefox scripts.


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


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

Reply via email to