Bug #16947 Updated: array issue in object
| From: | max at reallyusefulcomputing dot com | Date: | Thu, 02 May 2002 15:06:10 +0000 |
| Subject: | Bug #16947 Updated: array issue in object | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-6749@lists.php.net to get a copy of this message | ||
ID: 16947
Updated by: max@reallyusefulcomputing.com
Reported By: max@reallyusefulcomputing.com
Status: Bogus
Bug Type: *General Issues
Operating System: SunOS 5.8 Generic_108528-
PHP Version: 4.1.2
New Comment:
>The bug system is not the appropriate forum for asking support
>questions. For a list of a range of more appropriate places to ask
>for help using PHP, please visit http://www.php.net/support.php
fuck off
Previous Comments:
------------------------------------------------------------------------
[2002-05-02 08:55:25] sniper@php.net
The bug system is not the appropriate forum for asking support
questions. For a list of a range of more appropriate places to ask
for help using PHP, please visit http://www.php.net/support.php
------------------------------------------------------------------------
[2002-05-01 15:34:17] max@reallyusefulcomputing.com
checked the os with phpinfo()
------------------------------------------------------------------------
[2002-05-01 15:24:17] max@reallyusefulcomputing.com
three test results...
----test case html----
<html>
<head>
<title>Filter Test</title>
</head>
<body bgcolor="#ffffff">
<?php
$input_to_test = "Here are some words. here is a naughty words. Some
final ending content.";
require("includes/old_filter.php");
$my_filter = new Filter("word_files/basicwords.txt");
$my_filter -> approve($input_to_test);
$v = $my_filter ->getViolatingContent();
echo "<H4>Violating</H4>";
for($i=0;$i<count($v);$i++){
printf("%s<br>",$v[$i]);
}
echo "<h4>Keywords</h4>";
$keywords = $my_filter ->getKeywords($input_to_test);
for($i=0;$i<count($keywords);$i++){
printf("%s<br>",$keywords[$i]);
}
?>
</body>
</html>
TEST #1
---- changing code as you suggested -----
$this->violations = $violation_arr;
$this->keywords = $keyword_arr;
produces the following output
Violating
Keywords
0
TEST #2
---- my posted code-----
$this->$violations = $violation_arr;
$this->$keywords = $keyword_arr;
produces the following output
Violating
words.
naughty
words.
final
ending
content.
Keywords
0words.
naughty
words.
final
ending
content.
TEST #3
---- using my code but inverting the two assignment statements-----
$this->$keywords = $keyword_arr;
$this->$violations = $violation_arr;
produces the following output
Violating
naughty
Keywords
0naughty
again i remain pretty convinced this is some sort of bug...
------------------------------------------------------------------------
[2002-05-01 15:03:25] msopacua@idg.nl
Looking at your code, your assigning $this->$violations which is very
different from $this->violations (NOTICE: the dollar sign AFTER the
arrow).
At the time of assignment, the $violations, is an empty var even. So
what would happen is that $this->=$arr_violations.
If that does anything usefull, it would probably be, something like:
foreach($violations as $key => $value)
{
$this->$key=$value;
}
The object would then get property '0', '1','2' etc.
But that is more speculation than fact, because what you're trying to
do here is incorrect.
use:
$this->violations=$arr_violations;
then report back.
------------------------------------------------------------------------
[2002-05-01 14:34:19] max@reallyusefulcomputing.com
i am trying to set the object variables $violations and $keywords to be
$violation_arr and $keyword_arr respectively. the assignment itself
works however it assigns the last value in this case $keyword_arr to
both. if i invert the order of the assignments doing the $violation
assignment last then both are set to that value.
i do not believe the problem has anything to do with my use of this->
because again a value is being assigned but it is assigning to more
than one variable.
of additonal note it does not set any of the other variables
$filter_name, $allowed_number and $filter_word_file.
------------------------------------------------------------------------
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/16947
--
Edit this bug report at http://bugs.php.net/?id=16947&edit=1