#27150 [Opn]: 2 feature requests, directly accessing returned arrays, and statics by reference

2004-02-04 Thread sven at leon dot uia dot mx
 ID:   27150
 User updated by:  sven at leon dot uia dot mx
-Summary:  array returning mechanism from objects?
 Reported By:  sven at leon dot uia dot mx
 Status:   Open
 Bug Type: Feature/Change Request
 Operating System: All (redhat 90)
 PHP Version:  5.0.0b3 (beta3)
 New Comment:

oops: forgot to write correct summarym, done


Previous Comments:


[2004-02-04 13:43:39] sven at leon dot uia dot mx

Description:

I have a number of feature requests:

1) Could it be possible to immediately access an array that was
returned from a function, just like its possible to access object
functions immediately? This way its easy to safely access arrays that
are privately stored inside an object (so that another person can not
(accidentally) change information inside that array.

i.e. $temp=$object->return_object($parameter)->data($key);
for an array (that is privately kept inside an object):
 $temp=$object->return_array($parameter)[$key];

where $object->return_array would be like:

function return_array(){
return $copied_array=$private_array;
}

This same (feature request) has been asked in report 25898, but the
given "possible solution" did not seem to match my question. 

2) Could it be possible for functions that accept parameters by
reference, and return values by reference, to also accept static
value's like strings or booleans?

This would be very nice in situations where I would have to accept a
large string PLUS a small piece of text like "hey", and it would be
very usefull too in situations where I would  have to return either an
array or FALSE.

like this:

$data="hey";
test(TRUE, $data."");
function test($param1, &$param2){
  $data=array($param2, "bye");
  If($param1)
  {
return $data;
  }
  else
  {
return FALSE;
  }
}

The above script will fail with beta 3 on both the parameters (since a
static string was part of $param2) and the return value (Becouse FALSE
is also not a variable)

This is a functionality I have used alot in other programming
languages, without problems. Sending strings by reference will (in my
opinion) make it possible to optimize your scripts a little more.






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


#27150 [NEW]: array returning mechanism from objects?

2004-02-04 Thread sven at leon dot uia dot mx
From: sven at leon dot uia dot mx
Operating system: All (redhat 90)
PHP version:  5.0.0b3 (beta3)
PHP Bug Type: Feature/Change Request
Bug description:  array returning mechanism from objects?

Description:

I have a number of feature requests:

1) Could it be possible to immediately access an array that was returned
from a function, just like its possible to access object functions
immediately? This way its easy to safely access arrays that are privately
stored inside an object (so that another person can not (accidentally)
change information inside that array.

i.e. $temp=$object->return_object($parameter)->data($key);
for an array (that is privately kept inside an object):
 $temp=$object->return_array($parameter)[$key];

where $object->return_array would be like:

function return_array(){
return $copied_array=$private_array;
}

This same (feature request) has been asked in report 25898, but the given
"possible solution" did not seem to match my question. 

2) Could it be possible for functions that accept parameters by reference,
and return values by reference, to also accept static value's like strings
or booleans?

This would be very nice in situations where I would have to accept a large
string PLUS a small piece of text like "hey", and it would be very usefull
too in situations where I would  have to return either an array or FALSE.

like this:

$data="hey";
test(TRUE, $data."");
function test($param1, &$param2){
  $data=array($param2, "bye");
  If($param1)
  {
return $data;
  }
  else
  {
return FALSE;
  }
}

The above script will fail with beta 3 on both the parameters (since a
static string was part of $param2) and the return value (Becouse FALSE is
also not a variable)

This is a functionality I have used alot in other programming languages,
without problems. Sending strings by reference will (in my opinion) make
it possible to optimize your scripts a little more.


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


#25957 [NoF->Opn]: bad one? mixingup of array / $this-> in memory

2003-11-27 Thread sven at leon dot uia dot mx
 ID:   25957
 User updated by:  sven at leon dot uia dot mx
 Reported By:  sven at leon dot uia dot mx
-Status:   No Feedback
+Status:   Open
 Bug Type: Zend Engine 2 problem
 Operating System: All (redhat 90)
 PHP Version:  5.0.0b1 (beta1)
 New Comment:

Sorry for late update.

I think I have found the cause of the problem, if you have 2 objects, 1
is parent, other is child, en in both you have defined the __destruct()
function, and you call the childs __destruct() function, then stuff
gets really mixed up...

for the rest I have had _no_ problem yet, GREAT JOB PHP5!! :)


Previous Comments:


[2003-11-25 15:29:55] [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-11-18 15:34:59] [EMAIL PROTECTED]

Provide a complete (preferrably short as possible) example script.




[2003-10-22 17:32:16] sven at leon dot uia dot mx

Description:

In a class I send an array $test as a parameter to a protected
function. Then, if I try to access that array in any way in that
function, suddenly the $this object contains the data of that array
$test (!)

Reproduce code:
---
Sorry, cant make a short-and-clear reproducing code, but here I have a
small code sample that actually caused the problem: (note that
$this->params["source"] _IS_ an array)

protected function get_body($css){

echo "B0 (";
print_r($this);
echo ")";
flush();

  $retval="";
  while(list($key, $cell_data)=each($this->params["source"])){

  echo "B1 (";
  print_r($this);
  echo ")";
  flush();



Expected result:

I will try to get a .zip together with the classes that seem to cause
this problem.

Actual result:
--
B0 (table_key_value_a Object ( [params:protected] => Array ( [source]
=> Array ( [crc] => mBjsS50UkhAnxjWp [sid] => 75 [test_site] =>
75,mBjsS50UkhAnxjWp ) [col headers] => Array ( [0] => Key [1] => Value
) [table header] => HTTP VARIABLES [css prefix] => debug [table header
extra] => align='center' ) ) )

B1 (table_key_value_a Object ( [cell_data] => mBjsS50UkhAnxjWp [key] =>
crc ) )





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


#25957 [NEW]: bad one? mixingup of array / $this-> in memory

2003-10-22 Thread sven at leon dot uia dot mx
From: sven at leon dot uia dot mx
Operating system: All (redhat 90)
PHP version:  5.0.0b1 (beta1)
PHP Bug Type: *Programming Data Structures
Bug description:  bad one? mixingup of array / $this-> in memory

Description:

In a class I send an array $test as a parameter to a protected function.
Then, if I try to access that array in any way in that function, suddenly
the $this object contains the data of that array $test (!)

Reproduce code:
---
Sorry, cant make a short-and-clear reproducing code, but here I have a
small code sample that actually caused the problem: (note that
$this->params["source"] _IS_ an array)

protected function get_body($css){

echo "B0 (";
print_r($this);
echo ")";
flush();

  $retval="";
  while(list($key, $cell_data)=each($this->params["source"])){

  echo "B1 (";
  print_r($this);
  echo ")";
  flush();



Expected result:

I will try to get a .zip together with the classes that seem to cause this
problem.

Actual result:
--
B0 (table_key_value_a Object ( [params:protected] => Array ( [source] =>
Array ( [crc] => mBjsS50UkhAnxjWp [sid] => 75 [test_site] =>
75,mBjsS50UkhAnxjWp ) [col headers] => Array ( [0] => Key [1] => Value )
[table header] => HTTP VARIABLES [css prefix] => debug [table header
extra] => align='center' ) ) )

B1 (table_key_value_a Object ( [cell_data] => mBjsS50UkhAnxjWp [key] =>
crc ) )

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


#25898 [NEW]: array returning mechanism from objects?

2003-10-17 Thread sven at leon dot uia dot mx
From: sven at leon dot uia dot mx
Operating system: All (redhat 90)
PHP version:  5.0.0b1 (beta1)
PHP Bug Type: Class/Object related
Bug description:  array returning mechanism from objects?

Description:

Im not sure if it is a bug or not.

with an object inside an object, this is possible:
echo $test->testobject()->color;

with and array inside an object, this is NOT possible:
echo $test->testarray()["color"];

In other words, when an object returns an array, I can not directly access
it. 

This will work:
$temparray=$test->testarray();
echo $temparray["color"];


Reproduce code:
---
color="red";
}
}
class c_test{
  private $testobject; private $testarray=array("color" => "red");
  function testobject(){
$testobject=new c_testobject;
return $testobject;
  }
  function testarray(){
return $testarray;
  }
}
$test=new c_test();
echo $test->testobject()->color;
echo $test->testarray()["color"];
?>

Expected result:

redred

Actual result:
--
Parse error: parse error, expecting `','' or `';'' in
/var/www/html/php-easy/test.php on line 19

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