#49256 [Com]: PHP ignores Where clause on Where with boolean fields
ID: 49256 Comment by: selotsom at hotmail dot com Reported By: rafinguer at gmail dot com Status: Open Bug Type: PostgreSQL related Operating System: Windows Vista PHP Version: 5.2SVN-2009-08-14 (snap) New Comment: I use postgre and php, and I have not any problem. I also use logical deletions with a boolean field, and it works well. Please, send me your code and the database model at selot...@hotmail.com Previous Comments: [2009-08-15 09:30:33] rafinguer at yahoo dot es I'm sorry. The code is not correct. The code is the next following: $result=; $qry = select id_product_type, name_product_type . from sch_trazalogic.product_type . where deleted=false . order by name_product_type; $result_qry = pg_query($connection, $qry); $num_rows = pg_numrows($result_qry); $current=0; while ($current$num_rows) { $row = pg_fetch_row($result_qry, $current); // fetch current row $result = $result.$row[0].-.$row[1].\n; $current++; } pg_close($connection); echo $result; Apache version is 2.2 [2009-08-15 09:25:55] rafinguer at yahoo dot es I forgot to mention that the version of PostgreSQL is 8.3 [2009-08-14 16:07:01] rafinguer at gmail dot com Description: PHP ignores the true or false values in a SQL sentence, returning always all the records: select id_product_type, name_product_type from sch_trazalogic.product_type where deleted=false order by name_product_type I tried with where deleted='f' and with where not deleted. The result is the same. With PGAdmin (Query tool), the result is correct. Reproduce code: --- $result=; $qry = select id_product_type, name_product_type . from sch_trazalogic.product_type . where deleted=false . order by name_product_type; $result_qry = pg_query($connection, $qry); $num_rows = pg_numrows($result_qry); $current=0; while ($current$num_rows) { $row = pg_fetch_row($result_qry, $current); // fetch current row $result = $result_xml.$row[0].-.$row[1].\n; $current++; } pg_close($connection); echo $result_xml; Expected result: All the records with deleted with false value Actual result: -- All the records (deleted=true and deleted=false) -- Edit this bug report at http://bugs.php.net/?id=49256edit=1
#49272 [NEW]: Incorrect encoding in structured header field bodies
From: u235e at hotmail dot com Operating system: * PHP version: 5.2.10 PHP Bug Type: mbstring related Bug description: Incorrect encoding in structured header field bodies Description: Function: mb_encode_mimeheader When trying to construct a structured header field like From or To, only _words_ within phrases or ctext in comments may be encoded, especially not within quoted strings as of RFC 2047 section 5. This function does not take that into account, even worse it may make the field invalid as it greedily encodes everything after the first encountered WSP delimited text with non ASCII characters. This function is only useful for unstructured header fields as it is and thus only for the subject field in most common cases. Judging from the manual and the given example, I take it that this is not the only intended use. The example below would also apply to (comments) not just quoted strings. Technically the quotes should probably not be part of the encoded word (lexically invisible) where as the () in comments must stay in place to still recognize the text as a comment. And as a side note: I dont understand why digits are encoded and spaces not as underscores in Q scheme - renders the point of this scheme useless? Reproduce code: --- ?php mb_internal_encoding('ISO-8859-1'); $name = Peter \Der M\xFCller\; // German - Peter Der Müller // valid RFC 2822 display-name $mbox = peter.mueller; $doma = example.com; $addr = mb_encode_mimeheader($name, ISO-8859-1, Q) . . $mbox . @ . $doma . ; echo $addr; ? Expected result: should be: Peter =?ISO-8859-1?Q?=22Der=20M=FCller=22?= peter.muel...@example.com or very greedy: =?ISO-8859-1?Q?Peter=20=22Der=20M=FCller=22?= peter.muel...@example.com or maybe even with the quotes stripped: Peter =?ISO-8859-1?Q?Der=20M=FCller?= peter.muel...@example.com Actual result: -- Peter Der =?ISO-8859-1?Q?M=FCller=22?= peter.muel...@example.com Which is not a valid RFC 2822 name-addr (display-name) any more! -- Edit bug report at http://bugs.php.net/?id=49272edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49272r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49272r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49272r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=49272r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49272r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=49272r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=49272r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=49272r=needscript Try newer version: http://bugs.php.net/fix.php?id=49272r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=49272r=support Expected behavior: http://bugs.php.net/fix.php?id=49272r=notwrong Not enough info: http://bugs.php.net/fix.php?id=49272r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=49272r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=49272r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49272r=php4 Daylight Savings:http://bugs.php.net/fix.php?id=49272r=dst IIS Stability: http://bugs.php.net/fix.php?id=49272r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=49272r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=49272r=float No Zend Extensions: http://bugs.php.net/fix.php?id=49272r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=49272r=mysqlcfg
#49272 [Opn]: Incorrect encoding in structured header field bodies
ID: 49272 User updated by: u235e at hotmail dot com Reported By: u235e at hotmail dot com Status: Open Bug Type: mbstring related Operating System: * PHP Version: 5.2.10 New Comment: Disregard the parts about stripping quotes. Previous Comments: [2009-08-16 08:36:56] u235e at hotmail dot com Description: Function: mb_encode_mimeheader When trying to construct a structured header field like From or To, only _words_ within phrases or ctext in comments may be encoded, especially not within quoted strings as of RFC 2047 section 5. This function does not take that into account, even worse it may make the field invalid as it greedily encodes everything after the first encountered WSP delimited text with non ASCII characters. This function is only useful for unstructured header fields as it is and thus only for the subject field in most common cases. Judging from the manual and the given example, I take it that this is not the only intended use. The example below would also apply to (comments) not just quoted strings. Technically the quotes should probably not be part of the encoded word (lexically invisible) where as the () in comments must stay in place to still recognize the text as a comment. And as a side note: I dont understand why digits are encoded and spaces not as underscores in Q scheme - renders the point of this scheme useless? Reproduce code: --- ?php mb_internal_encoding('ISO-8859-1'); $name = Peter \Der M\xFCller\; // German - Peter Der Müller // valid RFC 2822 display-name $mbox = peter.mueller; $doma = example.com; $addr = mb_encode_mimeheader($name, ISO-8859-1, Q) . . $mbox . @ . $doma . ; echo $addr; ? Expected result: should be: Peter =?ISO-8859-1?Q?=22Der=20M=FCller=22?= peter.muel...@example.com or very greedy: =?ISO-8859-1?Q?Peter=20=22Der=20M=FCller=22?= peter.muel...@example.com or maybe even with the quotes stripped: Peter =?ISO-8859-1?Q?Der=20M=FCller?= peter.muel...@example.com Actual result: -- Peter Der =?ISO-8859-1?Q?M=FCller=22?= peter.muel...@example.com Which is not a valid RFC 2822 name-addr (display-name) any more! -- Edit this bug report at http://bugs.php.net/?id=49272edit=1
#49272 [Opn]: Incorrect encoding in structured header field bodies
ID: 49272 User updated by: u235e at hotmail dot com Reported By: u235e at hotmail dot com Status: Open Bug Type: mbstring related Operating System: * PHP Version: 5.2.10 New Comment: Oh, and the display-name in the example is technically not valid because of the non ASCII char of course - but that's the point of this function, right? ;-) Previous Comments: [2009-08-16 08:45:43] u235e at hotmail dot com Disregard the parts about stripping quotes. [2009-08-16 08:36:56] u235e at hotmail dot com Description: Function: mb_encode_mimeheader When trying to construct a structured header field like From or To, only _words_ within phrases or ctext in comments may be encoded, especially not within quoted strings as of RFC 2047 section 5. This function does not take that into account, even worse it may make the field invalid as it greedily encodes everything after the first encountered WSP delimited text with non ASCII characters. This function is only useful for unstructured header fields as it is and thus only for the subject field in most common cases. Judging from the manual and the given example, I take it that this is not the only intended use. The example below would also apply to (comments) not just quoted strings. Technically the quotes should probably not be part of the encoded word (lexically invisible) where as the () in comments must stay in place to still recognize the text as a comment. And as a side note: I dont understand why digits are encoded and spaces not as underscores in Q scheme - renders the point of this scheme useless? Reproduce code: --- ?php mb_internal_encoding('ISO-8859-1'); $name = Peter \Der M\xFCller\; // German - Peter Der Müller // valid RFC 2822 display-name $mbox = peter.mueller; $doma = example.com; $addr = mb_encode_mimeheader($name, ISO-8859-1, Q) . . $mbox . @ . $doma . ; echo $addr; ? Expected result: should be: Peter =?ISO-8859-1?Q?=22Der=20M=FCller=22?= peter.muel...@example.com or very greedy: =?ISO-8859-1?Q?Peter=20=22Der=20M=FCller=22?= peter.muel...@example.com or maybe even with the quotes stripped: Peter =?ISO-8859-1?Q?Der=20M=FCller?= peter.muel...@example.com Actual result: -- Peter Der =?ISO-8859-1?Q?M=FCller=22?= peter.muel...@example.com Which is not a valid RFC 2822 name-addr (display-name) any more! -- Edit this bug report at http://bugs.php.net/?id=49272edit=1
#36013 [Com]: Segmentation fault
ID: 36013 Comment by: jef at superior dot nl Reported By: xenon54 at generationphp dot net Status: No Feedback Bug Type: Session related Operating System: Centos 4.2 PHP Version: 5.1.1 New Comment: Same problem on 5.2.10 and 5.3.0 :/ plz resolve this issue Previous Comments: [2008-12-10 08:14:02] fb at smartterra dot de Hm, strange. Same behavior with PHP 5.2.6 :-( [2008-12-10 08:06:42] fb at smartterra dot de Same here: - CentOS 5 - PHP 5.1.6 - mysql Ver 14.12 Distrib 5.0.45 Browsing to any cacti webpage results in a white page. # tail /var/log/httpd/error_log [Tue Dec 09 18:00:41 2008] [notice] child pid 24763 exit signal Segmentation fault (11) [2008-09-06 13:15:19] test at example dot com I find it quite funny that this problem in connecting to MySQL leads to a segmentation fault. I can reproduce any it by installing OpenSuSE 10.x or OpenSuSE 11 and the 'cacti' package, and this has not changed for at least a couple years. [2006-03-12 17:40:54] alexdg at gmail dot com I think I know what the issue is, bad user/passwd login configuration for the cacti mysql account in include/config.php. When running thru Apache the error_log will only output segmentation fault but if you run the poller.php script on its own, you'll get the typical error msg of a failed mysql login (some 10 times?), until it crashs. [2006-01-23 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. 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/36013 -- Edit this bug report at http://bugs.php.net/?id=36013edit=1
#49269 [Com]: isset() fails on Iterator object when used inside foreach declaration
ID: 49269 Comment by: sjoerd-php at linuxonly dot nl Reported By: president at basnetworks dot net Status: Open Bug Type: Class/Object related Operating System: All PHP Version: 5.3.0 New Comment: Thank you for your bug report. I could reproduce the behavior and made a code sample to reproduce it: ?php class TestObject implements Iterator { private $first = true; function valid() { if ($this-first) { $this-first = false; return true; } return false; } function current() { } function next() { } function key() { } function rewind() { } } $array_object = new TestObject(); // Without ternary operator, the foreach is entered foreach ($array_object as $item) { echo This works.\n; } // With ternary operator, the foreach is not entered foreach ((true ? $array_object : $array_object) as $item) { die(Good. Expected behavior.\n); } die(Bad. Foreach was skipped.\n); ? Previous Comments: [2009-08-16 01:36:43] president at basnetworks dot net After further testing, I have found this bug is stranger than it seems: foreach ((isset($array_object) ? $array_object : array('1', '2', '3')) as $item) { echo $item; } Should either print 'abc' or '123' no matter if isset() is successful or fails. It prints neither. Now I am wondering if it is not isset(), but the ternary operator that is failing. [2009-08-16 01:28:52] president at basnetworks dot net I addition to the reproduce code, the following may help to understand the bug: foreach ($array_object as $item) { echo $item; } Will successfully print abc, while: foreach ((isset($array_object) ? $array_object : array()) as $item) { echo $item; } will not print anything, indicating that isset() is returning false. I hope that helps. [2009-08-16 01:20:32] president at basnetworks dot net Description: The function isset() produces an incorrect result when used on an object that implements the Iterator interface, within a foreach declaration. As illustrated below, when used outside of the foreach() declaration, isset() works as expected in the object that implements Iterator interface, returning true, causing the output 'true'. When isset() is used within the foreach() declaration on the same object, it instead returns false, causing an empty array to be used for the foreach() loop. There is no reason the isset() function should return anything different when used within the foreach() declaration block. Reproduce code: --- class NormalClass { public $a, $b, $c; public function __construct() { $this-a = 'a'; $this-b = 'b'; $this-c = 'c'; } } class ArrayClass implements Iterator { private $internal_array; public function __construct() { $this-internal_array = array('a', 'b', 'c'); } public function key() { return key($this-nodes); } public function current() { return current($this-nodes); } public function next() { next($this-nodes); } public function valid() { return (current($this-nodes) !== false) ? true : false; } public function rewind() { reset($this-nodes); } } $array = array('a', 'b', 'c'); $normal_object = new NormalClass(); $array_object = new ArrayClass(); echo Array: . (isset($array) ? 'true' : 'false'); echo \nNormal Object: . (isset($normal_object) ? 'true' : 'false'); echo \nArray Object: . (isset($array_object) ? 'true' : 'false'); echo \nArray: ; foreach ((isset($array) ? $array : array()) as $item) { echo $item; } echo \nNormal Object: ; foreach ((isset($normal_object) ? $normal_object : array()) as $item) { echo $item; } echo \nArray Object: ; foreach ((isset($array_object) ? $array_object : array()) as $item) { echo $item; } Expected result: Array: true Normal Object: true Array Object: true Array: abc Normal Object: abc Array Object: abc Actual result: -- Array: true Normal Object: true Array Object: true Array: abc Normal Object: abc Array Object: -- Edit this bug report at http://bugs.php.net/?id=49269edit=1
#49269 [Com]: isset() fails on Iterator object when used inside foreach declaration
ID: 49269 Comment by: sjoerd-php at linuxonly dot nl Reported By: president at basnetworks dot net Status: Open Bug Type: Class/Object related Operating System: All PHP Version: 5.3.0 New Comment: Thank you for your bug report. I could reproduce the behavior and made a code sample to reproduce it: ?php class TestObject implements Iterator { private $first = true; function valid() { if ($this-first) { $this-first = false; return true; } return false; } function current() { } function next() { } function key() { } function rewind() { } } $array_object = new TestObject(); // Without ternary operator, the foreach is entered foreach ($array_object as $item) { echo This works.\n; } // With ternary operator, the foreach is not entered foreach ((true ? $array_object : $array_object) as $item) { die(Good. Expected behavior.\n); } die(Bad. Foreach was skipped.\n); ? Previous Comments: [2009-08-16 10:52:20] sjoerd-php at linuxonly dot nl Thank you for your bug report. I could reproduce the behavior and made a code sample to reproduce it: ?php class TestObject implements Iterator { private $first = true; function valid() { if ($this-first) { $this-first = false; return true; } return false; } function current() { } function next() { } function key() { } function rewind() { } } $array_object = new TestObject(); // Without ternary operator, the foreach is entered foreach ($array_object as $item) { echo This works.\n; } // With ternary operator, the foreach is not entered foreach ((true ? $array_object : $array_object) as $item) { die(Good. Expected behavior.\n); } die(Bad. Foreach was skipped.\n); ? [2009-08-16 01:36:43] president at basnetworks dot net After further testing, I have found this bug is stranger than it seems: foreach ((isset($array_object) ? $array_object : array('1', '2', '3')) as $item) { echo $item; } Should either print 'abc' or '123' no matter if isset() is successful or fails. It prints neither. Now I am wondering if it is not isset(), but the ternary operator that is failing. [2009-08-16 01:28:52] president at basnetworks dot net I addition to the reproduce code, the following may help to understand the bug: foreach ($array_object as $item) { echo $item; } Will successfully print abc, while: foreach ((isset($array_object) ? $array_object : array()) as $item) { echo $item; } will not print anything, indicating that isset() is returning false. I hope that helps. [2009-08-16 01:20:32] president at basnetworks dot net Description: The function isset() produces an incorrect result when used on an object that implements the Iterator interface, within a foreach declaration. As illustrated below, when used outside of the foreach() declaration, isset() works as expected in the object that implements Iterator interface, returning true, causing the output 'true'. When isset() is used within the foreach() declaration on the same object, it instead returns false, causing an empty array to be used for the foreach() loop. There is no reason the isset() function should return anything different when used within the foreach() declaration block. Reproduce code: --- class NormalClass { public $a, $b, $c; public function __construct() { $this-a = 'a'; $this-b = 'b'; $this-c = 'c'; } } class ArrayClass implements Iterator { private $internal_array; public function __construct() { $this-internal_array = array('a', 'b', 'c'); } public function key() { return key($this-nodes); } public function current() { return current($this-nodes); } public function next() { next($this-nodes); } public function valid() { return (current($this-nodes) !== false) ? true : false; } public function rewind() { reset($this-nodes); } } $array = array('a', 'b', 'c'); $normal_object = new NormalClass(); $array_object = new ArrayClass(); echo Array: . (isset($array) ? 'true' : 'false'); echo \nNormal Object: .
#49269 [Com]: isset() fails on Iterator object when used inside foreach declaration
ID: 49269 Comment by: sjoerd-php at linuxonly dot nl Reported By: president at basnetworks dot net Status: Open Bug Type: Class/Object related Operating System: All PHP Version: 5.3.0 New Comment: Note that the Iterator in my previous comment sucks and should not be used. Previous Comments: [2009-08-16 10:53:07] sjoerd-php at linuxonly dot nl Thank you for your bug report. I could reproduce the behavior and made a code sample to reproduce it: ?php class TestObject implements Iterator { private $first = true; function valid() { if ($this-first) { $this-first = false; return true; } return false; } function current() { } function next() { } function key() { } function rewind() { } } $array_object = new TestObject(); // Without ternary operator, the foreach is entered foreach ($array_object as $item) { echo This works.\n; } // With ternary operator, the foreach is not entered foreach ((true ? $array_object : $array_object) as $item) { die(Good. Expected behavior.\n); } die(Bad. Foreach was skipped.\n); ? [2009-08-16 10:52:20] sjoerd-php at linuxonly dot nl Thank you for your bug report. I could reproduce the behavior and made a code sample to reproduce it: ?php class TestObject implements Iterator { private $first = true; function valid() { if ($this-first) { $this-first = false; return true; } return false; } function current() { } function next() { } function key() { } function rewind() { } } $array_object = new TestObject(); // Without ternary operator, the foreach is entered foreach ($array_object as $item) { echo This works.\n; } // With ternary operator, the foreach is not entered foreach ((true ? $array_object : $array_object) as $item) { die(Good. Expected behavior.\n); } die(Bad. Foreach was skipped.\n); ? [2009-08-16 01:36:43] president at basnetworks dot net After further testing, I have found this bug is stranger than it seems: foreach ((isset($array_object) ? $array_object : array('1', '2', '3')) as $item) { echo $item; } Should either print 'abc' or '123' no matter if isset() is successful or fails. It prints neither. Now I am wondering if it is not isset(), but the ternary operator that is failing. [2009-08-16 01:28:52] president at basnetworks dot net I addition to the reproduce code, the following may help to understand the bug: foreach ($array_object as $item) { echo $item; } Will successfully print abc, while: foreach ((isset($array_object) ? $array_object : array()) as $item) { echo $item; } will not print anything, indicating that isset() is returning false. I hope that helps. [2009-08-16 01:20:32] president at basnetworks dot net Description: The function isset() produces an incorrect result when used on an object that implements the Iterator interface, within a foreach declaration. As illustrated below, when used outside of the foreach() declaration, isset() works as expected in the object that implements Iterator interface, returning true, causing the output 'true'. When isset() is used within the foreach() declaration on the same object, it instead returns false, causing an empty array to be used for the foreach() loop. There is no reason the isset() function should return anything different when used within the foreach() declaration block. Reproduce code: --- class NormalClass { public $a, $b, $c; public function __construct() { $this-a = 'a'; $this-b = 'b'; $this-c = 'c'; } } class ArrayClass implements Iterator { private $internal_array; public function __construct() { $this-internal_array = array('a', 'b', 'c'); } public function key() { return key($this-nodes); } public function current() { return current($this-nodes); } public function next() { next($this-nodes); } public function valid() { return (current($this-nodes) !== false) ? true : false; } public function rewind() {
#49273 [NEW]: setcookie() segfaults the php process when adding a positive expires value
From: moisadoru at gmail dot com Operating system: Ubuntu linux 9.10alpha3 64bit PHP version: 6SVN-2009-08-16 (snap) PHP Bug Type: HTTP related Bug description: setcookie() segfaults the php process when adding a positive expires value Description: When setting a cookie with setcookie(), if the expires parameter is a positive integer, the PHP child process segfaults. Environment; Apache 2.2.12, PHP 6.0-200908152030, Ubuntu 9.10 alpha3 linux kernel 2.6.31 64bit. Reproduce code: --- ?php header('Set-Cookie: cookie1=foo1; expires=Sun, 16-Aug-2009 16:39:00 GMT; secure; HttpOnly', TRUE, 200); // works setcookie('cookie2', 'foo2',); // works setcookie('cookie3', 'foo3', -3600); // works setcookie('cookie4', 'foo4', 3600); // segfaults echo 'pre'; print_r($_COOKIE); ? Expected result: $_COOKIE array dumped to screen Actual result: -- Apache error log: [Sun Aug 16 19:06:38 2009] [notice] child pid 22565 exit signal Segmentation fault (11) -- Edit bug report at http://bugs.php.net/?id=49273edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49273r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49273r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49273r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=49273r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49273r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=49273r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=49273r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=49273r=needscript Try newer version: http://bugs.php.net/fix.php?id=49273r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=49273r=support Expected behavior: http://bugs.php.net/fix.php?id=49273r=notwrong Not enough info: http://bugs.php.net/fix.php?id=49273r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=49273r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=49273r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49273r=php4 Daylight Savings:http://bugs.php.net/fix.php?id=49273r=dst IIS Stability: http://bugs.php.net/fix.php?id=49273r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=49273r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=49273r=float No Zend Extensions: http://bugs.php.net/fix.php?id=49273r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=49273r=mysqlcfg
#49269 [Opn]: Ternary operator fails on Iterator object when used inside foreach declaration
ID: 49269 User updated by: president at basnetworks dot net -Summary: isset() fails on Iterator object when used inside foreach declaration Reported By: president at basnetworks dot net Status: Open Bug Type: Class/Object related Operating System: All PHP Version: 5.3.0 New Comment: sjoerd-php at linuxonly dot nl, Your code sample is much clearer, and seems to narrow it down to the ternary operator mis-behaving. Thanks for the added clarification, I will update the report. You should also vote that you reproduced the bug above. Previous Comments: [2009-08-16 10:57:44] sjoerd-php at linuxonly dot nl Note that the Iterator in my previous comment sucks and should not be used. [2009-08-16 10:53:07] sjoerd-php at linuxonly dot nl Thank you for your bug report. I could reproduce the behavior and made a code sample to reproduce it: ?php class TestObject implements Iterator { private $first = true; function valid() { if ($this-first) { $this-first = false; return true; } return false; } function current() { } function next() { } function key() { } function rewind() { } } $array_object = new TestObject(); // Without ternary operator, the foreach is entered foreach ($array_object as $item) { echo This works.\n; } // With ternary operator, the foreach is not entered foreach ((true ? $array_object : $array_object) as $item) { die(Good. Expected behavior.\n); } die(Bad. Foreach was skipped.\n); ? [2009-08-16 10:52:20] sjoerd-php at linuxonly dot nl Thank you for your bug report. I could reproduce the behavior and made a code sample to reproduce it: ?php class TestObject implements Iterator { private $first = true; function valid() { if ($this-first) { $this-first = false; return true; } return false; } function current() { } function next() { } function key() { } function rewind() { } } $array_object = new TestObject(); // Without ternary operator, the foreach is entered foreach ($array_object as $item) { echo This works.\n; } // With ternary operator, the foreach is not entered foreach ((true ? $array_object : $array_object) as $item) { die(Good. Expected behavior.\n); } die(Bad. Foreach was skipped.\n); ? [2009-08-16 01:36:43] president at basnetworks dot net After further testing, I have found this bug is stranger than it seems: foreach ((isset($array_object) ? $array_object : array('1', '2', '3')) as $item) { echo $item; } Should either print 'abc' or '123' no matter if isset() is successful or fails. It prints neither. Now I am wondering if it is not isset(), but the ternary operator that is failing. [2009-08-16 01:28:52] president at basnetworks dot net I addition to the reproduce code, the following may help to understand the bug: foreach ($array_object as $item) { echo $item; } Will successfully print abc, while: foreach ((isset($array_object) ? $array_object : array()) as $item) { echo $item; } will not print anything, indicating that isset() is returning false. I hope that helps. 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/49269 -- Edit this bug report at http://bugs.php.net/?id=49269edit=1
#49273 [Com]: setcookie() segfaults the php process when adding a positive expires value
ID: 49273 Comment by: moisadoru at gmail dot com Reported By: moisadoru at gmail dot com Status: Open Bug Type: HTTP related Operating System: Ubuntu linux 9.10alpha3 64bit PHP Version: 6SVN-2009-08-16 (snap) New Comment: This bug is also present in the latest SVN (r287372) Previous Comments: [2009-08-16 16:58:56] moisadoru at gmail dot com Description: When setting a cookie with setcookie(), if the expires parameter is a positive integer, the PHP child process segfaults. Environment; Apache 2.2.12, PHP 6.0-200908152030, Ubuntu 9.10 alpha3 linux kernel 2.6.31 64bit. Reproduce code: --- ?php header('Set-Cookie: cookie1=foo1; expires=Sun, 16-Aug-2009 16:39:00 GMT; secure; HttpOnly', TRUE, 200); // works setcookie('cookie2', 'foo2',); // works setcookie('cookie3', 'foo3', -3600); // works setcookie('cookie4', 'foo4', 3600); // segfaults echo 'pre'; print_r($_COOKIE); ? Expected result: $_COOKIE array dumped to screen Actual result: -- Apache error log: [Sun Aug 16 19:06:38 2009] [notice] child pid 22565 exit signal Segmentation fault (11) -- Edit this bug report at http://bugs.php.net/?id=49273edit=1
#49274 [NEW]: filter_var() should accept objects without fatal error
From: cel...@php.net Operating system: PHP version: 5.3SVN-2009-08-16 (SVN) PHP Bug Type: Filter related Bug description: filter_var() should accept objects without fatal error Description: ?php filter_var(new stdClass, FILTER_VALIDATE_EMAIL); ? throws a fatal error because stdClass can't be converted into a string. filter_var() should be more flexible and simply return false in this situation, it makes it very difficult to provide validation not just for untrusted user input but for untrusted third party use of libraries who may make it insecure by passing in the wrong value to a field for setting. -- Edit bug report at http://bugs.php.net/?id=49274edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49274r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49274r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49274r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=49274r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49274r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=49274r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=49274r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=49274r=needscript Try newer version: http://bugs.php.net/fix.php?id=49274r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=49274r=support Expected behavior: http://bugs.php.net/fix.php?id=49274r=notwrong Not enough info: http://bugs.php.net/fix.php?id=49274r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=49274r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=49274r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49274r=php4 Daylight Savings:http://bugs.php.net/fix.php?id=49274r=dst IIS Stability: http://bugs.php.net/fix.php?id=49274r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=49274r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=49274r=float No Zend Extensions: http://bugs.php.net/fix.php?id=49274r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=49274r=mysqlcfg
#49269 [Opn-Asn]: Ternary operator fails on Iterator object when used inside foreach declaration
ID: 49269 Updated by: col...@php.net Reported By: president at basnetworks dot net -Status: Open +Status: Assigned Bug Type: Class/Object related Operating System: All PHP Version: 5.3.0 -Assigned To: +Assigned To: colder New Comment: http://patches.colder.ch/Zend/bug49269.patch?markup This should fix it, and passes all the Zend tests, but as it may affect some untested edge cases out there, further checking is required. Previous Comments: [2009-08-16 17:21:46] president at basnetworks dot net sjoerd-php at linuxonly dot nl, Your code sample is much clearer, and seems to narrow it down to the ternary operator mis-behaving. Thanks for the added clarification, I will update the report. You should also vote that you reproduced the bug above. [2009-08-16 10:57:44] sjoerd-php at linuxonly dot nl Note that the Iterator in my previous comment sucks and should not be used. [2009-08-16 10:53:07] sjoerd-php at linuxonly dot nl Thank you for your bug report. I could reproduce the behavior and made a code sample to reproduce it: ?php class TestObject implements Iterator { private $first = true; function valid() { if ($this-first) { $this-first = false; return true; } return false; } function current() { } function next() { } function key() { } function rewind() { } } $array_object = new TestObject(); // Without ternary operator, the foreach is entered foreach ($array_object as $item) { echo This works.\n; } // With ternary operator, the foreach is not entered foreach ((true ? $array_object : $array_object) as $item) { die(Good. Expected behavior.\n); } die(Bad. Foreach was skipped.\n); ? [2009-08-16 10:52:20] sjoerd-php at linuxonly dot nl Thank you for your bug report. I could reproduce the behavior and made a code sample to reproduce it: ?php class TestObject implements Iterator { private $first = true; function valid() { if ($this-first) { $this-first = false; return true; } return false; } function current() { } function next() { } function key() { } function rewind() { } } $array_object = new TestObject(); // Without ternary operator, the foreach is entered foreach ($array_object as $item) { echo This works.\n; } // With ternary operator, the foreach is not entered foreach ((true ? $array_object : $array_object) as $item) { die(Good. Expected behavior.\n); } die(Bad. Foreach was skipped.\n); ? [2009-08-16 01:36:43] president at basnetworks dot net After further testing, I have found this bug is stranger than it seems: foreach ((isset($array_object) ? $array_object : array('1', '2', '3')) as $item) { echo $item; } Should either print 'abc' or '123' no matter if isset() is successful or fails. It prints neither. Now I am wondering if it is not isset(), but the ternary operator that is failing. 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/49269 -- Edit this bug report at http://bugs.php.net/?id=49269edit=1
#49130 [Opn-Fbk]: sha1_file() returns incorrect/unpredictable values
ID: 49130 Updated by: scott...@php.net Reported By: adam at elishome dot org -Status: Open +Status: Feedback Bug Type: hash related Operating System: freebsd PHP Version: 5.2.10 New Comment: Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with ?php and ends with ?, is max. 10-20 lines long and does not require any external resources such as databases, etc. If the script requires a database to demonstrate the issue, please make sure it creates all necessary tables, stored procedures etc. Please avoid embedding huge scripts into the report. I can't reproduce this. Nothing in the sha code has changed in 2+ years. Previous Comments: [2009-08-13 09:56:27] sjoerd-php at linuxonly dot nl Thank you for your bug report. Since I could not reproduce it, I have some questions for you. Can you reproduce the problem on a system with another OS? Is the output of php-5.2.10 sha1_file consistent for a given file, or does it give a different output each time? Can you supply an example file which gives a wrong hash, with both the good and the wrong hash? [2009-08-01 10:47:26] adam at elishome dot org Description: The value returned for the sha1_file() function is not reliable. The sha1_file function's result in PHP 5.2.10 is not the same as the sha1 value returned by the freebsd system, or by ruby's sha1 function. PHP 5.2.9 always returns the correct sha1 values, but 5.2.10 does not. It occasionally gets it right, but the large majority of the time it is incorrect. Reproduce code: --- Lookup a file's sha1 value using PHP 5.2.9 using the sha1_file function (or using freebsd's system function, or using Ruby's sha1 function), and then compare it to the value returned by PHP 5.2.10's sha1_file function. Expected result: I expect the sha1_file function to return correct values. Actual result: -- The values returned by sha1_file were not correct. -- Edit this bug report at http://bugs.php.net/?id=49130edit=1