[PHP-DOC] #35698 [Opn]: SDO confusing letter

2005-12-15 Thread jsgoupil
 ID:  35698
 Updated by:  [EMAIL PROTECTED]
 Reported By: [EMAIL PROTECTED]
 Status:  Open
 Bug Type:Documentation problem
 PHP Version: Irrelevant
 New Comment:

test to see if the property is many-valued..

2 dots


Previous Comments:


[2005-12-16 05:11:25] [EMAIL PROTECTED]

"or understand the 'SDO_Model_ and 'SDO_DAS_' interfaces"

' missing



[2005-12-16 04:35:03] [EMAIL PROTECTED]

Description:

sdo/reference.xml
After Example 13 "Get/set sequence values", I think there is some
confusing things with $letter, $letters_seq and $letter_seq
Just before it is written : "All subsequent examples assume that the
*$letter_seq* variable has been assigned the sequence for the letter
data object."

Could you double check please ?

Thank you






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


[PHP-DOC] #35698 [Opn]: SDO confusing letter

2005-12-15 Thread jsgoupil
 ID:  35698
 Updated by:  [EMAIL PROTECTED]
 Reported By: [EMAIL PROTECTED]
 Status:  Open
 Bug Type:Documentation problem
 PHP Version: Irrelevant
 New Comment:

"or understand the 'SDO_Model_ and 'SDO_DAS_' interfaces"

' missing


Previous Comments:


[2005-12-16 04:35:03] [EMAIL PROTECTED]

Description:

sdo/reference.xml
After Example 13 "Get/set sequence values", I think there is some
confusing things with $letter, $letters_seq and $letter_seq
Just before it is written : "All subsequent examples assume that the
*$letter_seq* variable has been assigned the sequence for the letter
data object."

Could you double check please ?

Thank you






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


[PHP-DOC] #35698 [NEW]: SDO confusing letter

2005-12-15 Thread [EMAIL PROTECTED]
From: [EMAIL PROTECTED]
Operating system: 
PHP version:  Irrelevant
PHP Bug Type: Documentation problem
Bug description:  SDO confusing letter

Description:

sdo/reference.xml
After Example 13 "Get/set sequence values", I think there is some
confusing things with $letter, $letters_seq and $letter_seq
Just before it is written : "All subsequent examples assume that the
*$letter_seq* variable has been assigned the sequence for the letter data
object."

Could you double check please ?

Thank you


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


[PHP-DOC] cvs: phpdoc /en/reference/sdo reference.xml

2005-12-15 Thread Jean-S�bastien Goupil
jsgoupilFri Dec 16 03:33:00 2005 EDT

  Modified files:  
/phpdoc/en/reference/sdoreference.xml 
  Log:
  typo and space after links
  http://cvs.php.net/viewcvs.cgi/phpdoc/en/reference/sdo/reference.xml?r1=1.18&r2=1.19&diff_format=u
Index: phpdoc/en/reference/sdo/reference.xml
diff -u phpdoc/en/reference/sdo/reference.xml:1.18 
phpdoc/en/reference/sdo/reference.xml:1.19
--- phpdoc/en/reference/sdo/reference.xml:1.18  Fri Dec  2 16:14:19 2005
+++ phpdoc/en/reference/sdo/reference.xml   Fri Dec 16 03:33:00 2005
@@ -1,5 +1,5 @@
 
-
+
 
 
 
@@ -123,8 +123,7 @@

 The latest DLLs for the SDO core and the XML DAS can be 
 downloaded from 
-   php_sdo
-and 
+   php_sdo and 
php_sdo_das_xml
 respectively.

@@ -133,8 +132,7 @@

 Check out the Relational DAS from CVS to somewhere on the
 PHP 
-include_path
-.
+include_path.

   
  
@@ -152,8 +150,7 @@

 Check out the Relational DAS from CVS to somewhere on the
 PHP 
-include_path
-.
+include_path.

   
  
@@ -246,8 +243,7 @@
 update your 
 include_path
 in &php.ini; to point to the directory that contains
-sdo/DAS/Relational
-.
+sdo/DAS/Relational.


 Building SDO on Linux
@@ -373,7 +369,7 @@
 
 
  
-  XMLHelper/XSDHelper (the XML DAS provide a lot of this functionality)
+  XMLHelper/XSDHelper (the XML DAS provides a lot of this functionality)
  
 
 
@@ -696,7 +692,7 @@
  
 

[PHP-DOC] Problems with new CVS web view

2005-12-15 Thread Dallas Thunder

The problem can be regenerated at:
http://cvs.php.net/viewcvs.cgi/phpdoc/en/appendices/tokens.xml?r1=1.21&r2=1.23

Results:

An Exception Has Occurred
Python Traceback

Traceback (most recent call last):
 File "/usr/local/viewcvs-1.0-dev/lib/viewcvs.py", line 3486, in main
   request.run_viewcvs()
 File "/usr/local/viewcvs-1.0-dev/lib/viewcvs.py", line 370, in run_viewcvs
   self.view_func(self)
 File "/usr/local/viewcvs-1.0-dev/lib/viewcvs.py", line 2749, in view_diff
   data.update({
 File "/usr/local/viewcvs-1.0-dev/lib/viewcvs.py", line 2358, in 
rcsdiff_date_reformat

   date = compat.cvs_strptime(date_str)
 File "/usr/local/viewcvs-1.0-dev/lib/compat.py", line 51, in cvs_strptime
   return time.strptime(timestr, '%Y/%m/%d %H:%M:%S')[:-1] + (0,)
 File "/usr/local/lib/python2.4/_strptime.py", line 291, in strptime
   found = format_regex.match(data_string)
TypeError: expected string or buffer
Looks like happened when two compared versions are identical.  I'm not sure, 
maybe just something wrong with my browser.  Please verify it. 


[PHP-DOC] #35696 [Opn]: The function "snmp_set_oid_numeric_print" does not exist on the Win32 platform

2005-12-15 Thread larryjadams at comcast dot net
 ID:   35696
 User updated by:  larryjadams at comcast dot net
 Reported By:  larryjadams at comcast dot net
 Status:   Open
 Bug Type: Documentation problem
 Operating System: Win32
 PHP Version:  5.1.1
 New Comment:

It does appear that for some reason, php_snmp is compiled using
ucd_snmp based upon the php_info function and parsing the code.


Previous Comments:


[2005-12-16 00:27:46] larryjadams at comcast dot net

At first glance, it appears that the following code should be
executed:

#ifdef HAVE_NET_SNMP
PHP_FE(snmp_set_enum_print, NULL)
PHP_FE(snmp_set_oid_numeric_print, NULL)
#endif

For some reason, the "HAVE_NET_SNMP" constant is not defined although
php_snmp is using the NET_SNMP package in Windows.  Sounds like a
autoconf issue to me.  More to follow...



[2005-12-16 00:17:32] larryjadams at comcast dot net

I will e-mail Harrie and potentially provide workaround code to him. 
Any chance of implementing in the 4.x, 5.0.x branches?



[2005-12-15 23:58:15] [EMAIL PROTECTED]

Reclassified as docu problem.



[2005-12-15 23:56:46] larryjadams at comcast dot net

Description:

The following function does not exist in the windows environment and it
is very important to our tool.

snmp_set_oid_numeric_print



Reproduce code:
---
if function_exists("snmp_set_oid_numeric_print") {
   print "I'm There\n";
}else{
   print "Sadly, I'm Not\n";
}

Expected result:

We would like the function to be supported.






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


[PHP-DOC] #35696 [Opn]: The function "snmp_set_oid_numeric_print" does not exist on the Win32 platform

2005-12-15 Thread larryjadams at comcast dot net
 ID:   35696
 User updated by:  larryjadams at comcast dot net
 Reported By:  larryjadams at comcast dot net
 Status:   Open
 Bug Type: Documentation problem
 Operating System: Win32
 PHP Version:  5.1.1
 New Comment:

At first glance, it appears that the following code should be
executed:

#ifdef HAVE_NET_SNMP
PHP_FE(snmp_set_enum_print, NULL)
PHP_FE(snmp_set_oid_numeric_print, NULL)
#endif

For some reason, the "HAVE_NET_SNMP" constant is not defined although
php_snmp is using the NET_SNMP package in Windows.  Sounds like a
autoconf issue to me.  More to follow...


Previous Comments:


[2005-12-16 00:17:32] larryjadams at comcast dot net

I will e-mail Harrie and potentially provide workaround code to him. 
Any chance of implementing in the 4.x, 5.0.x branches?



[2005-12-15 23:58:15] [EMAIL PROTECTED]

Reclassified as docu problem.



[2005-12-15 23:56:46] larryjadams at comcast dot net

Description:

The following function does not exist in the windows environment and it
is very important to our tool.

snmp_set_oid_numeric_print



Reproduce code:
---
if function_exists("snmp_set_oid_numeric_print") {
   print "I'm There\n";
}else{
   print "Sadly, I'm Not\n";
}

Expected result:

We would like the function to be supported.






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


[PHP-DOC] cvs: phpdoc /en/reference/mysqli/functions mysqli-field-count.xml

2005-12-15 Thread Nuno Lopes
nlopess Thu Dec 15 23:27:02 2005 EDT

  Modified files:  
/phpdoc/en/reference/mysqli/functions   mysqli-field-count.xml 
  Log:
  fix OO example, per user note
  
http://cvs.php.net/viewcvs.cgi/phpdoc/en/reference/mysqli/functions/mysqli-field-count.xml?r1=1.12&r2=1.13&diff_format=u
Index: phpdoc/en/reference/mysqli/functions/mysqli-field-count.xml
diff -u phpdoc/en/reference/mysqli/functions/mysqli-field-count.xml:1.12 
phpdoc/en/reference/mysqli/functions/mysqli-field-count.xml:1.13
--- phpdoc/en/reference/mysqli/functions/mysqli-field-count.xml:1.12Fri Sep 
 2 16:55:47 2005
+++ phpdoc/en/reference/mysqli/functions/mysqli-field-count.xml Thu Dec 15 
23:27:02 2005
@@ -1,5 +1,5 @@
 
-
+
   

 mysqli_field_count
@@ -45,16 +45,16 @@
 
 $mysqli->query( "DROP TABLE IF EXISTS friends"); 
 $mysqli->query( "CREATE TABLE friends (id int, name varchar(20))"); 
- 
+
 $mysqli->query( "INSERT INTO friends VALUES (1,'Hartmut'), (2, 'Ulf')");
 
 
 $mysqli->real_query($HTTP_POST_VARS['query']);
 
-if (mysqli_field_count($link)) {
+if ($mysqli->field_count) {
 /* this was a select/show or describe query */
 $result = $mysqli->store_result();
-
+
 /* process resultset */
 $row = $result->fetch_row();
 
@@ -77,7 +77,7 @@
 
 mysqli_query($link, "DROP TABLE IF EXISTS friends"); 
 mysqli_query($link, "CREATE TABLE friends (id int, name varchar(20))"); 
- 
+
 mysqli_query($link, "INSERT INTO friends VALUES (1,'Hartmut'), (2, 'Ulf')");
 
 mysqli_real_query($link, $HTTP_POST_VARS['query']);
@@ -85,7 +85,7 @@
 if (mysqli_field_count($link)) {
 /* this was a select/show or describe query */
 $result = mysqli_store_result($link);
-
+
 /* process resultset */
 $row = mysqli_fetch_row($result);
 


[PHP-DOC] #35696 [Opn]: The function "snmp_set_oid_numeric_print" does not exist on the Win32 platform

2005-12-15 Thread larryjadams at comcast dot net
 ID:   35696
 User updated by:  larryjadams at comcast dot net
 Reported By:  larryjadams at comcast dot net
 Status:   Open
 Bug Type: Documentation problem
 Operating System: Win32
 PHP Version:  5.1.1
 New Comment:

I will e-mail Harrie and potentially provide workaround code to him. 
Any chance of implementing in the 4.x, 5.0.x branches?


Previous Comments:


[2005-12-15 23:58:15] [EMAIL PROTECTED]

Reclassified as docu problem.



[2005-12-15 23:56:46] larryjadams at comcast dot net

Description:

The following function does not exist in the windows environment and it
is very important to our tool.

snmp_set_oid_numeric_print



Reproduce code:
---
if function_exists("snmp_set_oid_numeric_print") {
   print "I'm There\n";
}else{
   print "Sadly, I'm Not\n";
}

Expected result:

We would like the function to be supported.






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


[PHP-DOC] #35696 [Opn]: The function "snmp_set_oid_numeric_print" does not exist on the Win32 platform

2005-12-15 Thread tony2001
 ID:   35696
 Updated by:   [EMAIL PROTECTED]
 Reported By:  larryjadams at comcast dot net
 Status:   Open
-Bug Type: SNMP related
+Bug Type: Documentation problem
 Operating System: Win32
 PHP Version:  5.1.1
 New Comment:

Reclassified as docu problem.


Previous Comments:


[2005-12-15 23:56:46] larryjadams at comcast dot net

Description:

The following function does not exist in the windows environment and it
is very important to our tool.

snmp_set_oid_numeric_print



Reproduce code:
---
if function_exists("snmp_set_oid_numeric_print") {
   print "I'm There\n";
}else{
   print "Sadly, I'm Not\n";
}

Expected result:

We would like the function to be supported.






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


[PHP-DOC] #35687 [Bgs]: XMLReader constants changed to class constants

2005-12-15 Thread jsgoupil
 ID:   35687
 Updated by:   [EMAIL PROTECTED]
 Reported By:  alex at mikitik dot com
 Status:   Bogus
 Bug Type: Documentation problem
 Operating System: Irrelevant
 PHP Version:  Irrelevant
 New Comment:

hum, Wrong message but it is already fixed in CVS.

Thank you.


Previous Comments:


[2005-12-15 19:33:37] [EMAIL PROTECTED]

Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP -- 
the problem might already be fixed. Please download a new
PHP version from http://www.php.net/downloads.php

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.

Already fixed in CVS



[2005-12-15 19:27:11] alex at mikitik dot com

Description:

Looks like in PHP5.1.1, the XMLReader constant definitions changed to
class constants (e.g. XMLREADER_ELEMENT to XMLREADER::ELEMENT).

This documentation still lists global constants.






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


[PHP-DOC] #35687 [Opn->Bgs]: XMLReader constants changed to class constants

2005-12-15 Thread jsgoupil
 ID:   35687
 Updated by:   [EMAIL PROTECTED]
 Reported By:  alex at mikitik dot com
-Status:   Open
+Status:   Bogus
 Bug Type: Documentation problem
 Operating System: Irrelevant
 PHP Version:  Irrelevant
 New Comment:

Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP -- 
the problem might already be fixed. Please download a new
PHP version from http://www.php.net/downloads.php

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.

Already fixed in CVS


Previous Comments:


[2005-12-15 19:27:11] alex at mikitik dot com

Description:

Looks like in PHP5.1.1, the XMLReader constant definitions changed to
class constants (e.g. XMLREADER_ELEMENT to XMLREADER::ELEMENT).

This documentation still lists global constants.






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


[PHP-DOC] #35687 [NEW]: XMLReader constants changed to class constants

2005-12-15 Thread alex at mikitik dot com
From: alex at mikitik dot com
Operating system: Irrelevant
PHP version:  Irrelevant
PHP Bug Type: Documentation problem
Bug description:  XMLReader constants changed to class constants

Description:

Looks like in PHP5.1.1, the XMLReader constant definitions changed to
class constants (e.g. XMLREADER_ELEMENT to XMLREADER::ELEMENT).

This documentation still lists global constants.


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


[PHP-DOC] #35579 [Opn]: Serialize / Unserialize Behavior with Objects including References

2005-12-15 Thread colder
 ID:   35579
 Updated by:   [EMAIL PROTECTED]
 Reported By:  al dot the dot x at gmail dot com
 Status:   Open
 Bug Type: Documentation problem
 Operating System: ANY
 PHP Version:  Irrelevant
 New Comment:

Well, as a second though, I would agree that the manual isn't clear
enough. 

"References inside the array/object you are serialize()ing will also be
stored."

$a = 'first';

$b = array(&$a);

$c = serialize($b);
unset($b);

$b = unserialize($c);
$a = 'second';

echo $b[0]; // -> first, which is not the behavior somebody would
expect



Previous Comments:


[2005-12-15 16:28:28] [EMAIL PROTECTED]

I fail to see the specific link with objects, nor the dilemnia, because
serialize/unserialize can't keep references at all:

$a = 'first';
$b = &$a; // create a reference
$c = serialize($b);
unset($b); // kill the reference
$b = unserialize($c); // won't restore it, unserialize() doesn't return
a reference.
$a = 'second';
echo $b;
-> 'first'



[2005-12-15 02:29:34] al dot the dot x at gmail dot com

Also, as I've discovered in further testing, even 
internal references are not preserved when serialize() 
and unserialize() are employed. For instance (mind the 
pun, it's tricky): 

Sample Code:


class A {
  var $value = 0;

  function A ( $newValue = 0 ) {
$this->value = $newValue;
  } // END constructor
} // END class A

class B {
  var pointers = array(); 
  vae aliases = array();
  // Excuse the misnomers, please...

  function B ( $newPointer = false ) {
if (false !== $newPointer) 
  $this->ponters[] =& $newPointer;
foreach ($pointers as $index => $value)
  $this->aliases[$index] =& $pointers[$index];
  } // END constructor
} // END class B

$newA = new A('I'm a new A'); 
$newB = new B(&$newA);
$oldB = unserialize(serialize($newB));
$newA->value = "Now I'm an old A";

// Forgive the PHP5-style syntax below...

echo $newA->value; 
// As expected, Output: Now I'm an old A

echo $newB->pointer[0]->value;
// As expected, Output same...

echo $oldB->pointers[0]->value;
// Somewhat expected, but not desired...
// Output: I'm an old A

$oldB->pointers[0]->value = "Also an old A";
echo $oldB->pointers[0]->value;
echo $oldB->aliased[0]->value;
// Nothing as expected or desired...
// Output 1: Also an old A
// Output 2: I'm an old A
// Internal references aren't even preserved... Boo.



[2005-12-14 13:16:12] [EMAIL PROTECTED]

And write with big letters "references are NOT pointers!" :)



[2005-12-07 09:20:40] al dot the dot x at gmail dot com

Description:

As discussed in several bug reports and in the 
additional comments in the PHP Documentation site 
(eventually, with some reading / searching), the 
functions serialize() and unserialize() do not restore 
references to other objects in PHP 4. As that this 
behavior is unexpected _and_ intrinsic to the use of 
session data in PHP, please consider including a caveat 
or clarification in the documentation XML for the 
affected functions, the "Classes and Objects" section,  
and the "Session-Handling Functions" section.

Certainly, there's a workaround with __sleep() and 
__wakeup(), but this really needs to be addressed in the 
primary documentation in all these places, since the 
thread regarding that behavior is now buried among 
others and only appears on the description of 
serialize().

I also understand that this has been fixed as of PHP 5, 
but that's not a very helpful explanation, Most hosting 
providers currently run PHP 4.3.x or 4.4.x and place low 
priority on upgrading until the next major Apache 
version is released (maybe not even then, the slackers).

Reproduce code:
---
// Consider:

class dataObject {
  var $data = NULL;
  var $pointer = NULL;

  function dataObject ($newData = false) {
if ($newData !== false) $this->data = $newData;
  } // END constructor

  function setPointer (&$newPtr) {
return ($this->pointer =& $newPtr);
  } // END setPointer

} // END class dataObject

$A = new base('This is A');
$B = new base('This is B');
$A->setPointer(&$B);
$C = serialize($A);

// Now check the original for reference...

$B->data = "Still B, but different";
echo $A->pointer->data; // Funky syntax, I know...

// Output as expected: "Still B, but different"
// But do the same on the serialized version...

unset($A);
$A = unserialize($C);
$B->data = "Where's B now?";
echo $A->pointer->data;

// Output is old "This is B"... Not cool.
// Reference is not preserved.






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


[PHP-DOC] #35579 [Opn]: Serialize / Unserialize Behavior with Objects including References

2005-12-15 Thread colder
 ID:   35579
 Updated by:   [EMAIL PROTECTED]
 Reported By:  al dot the dot x at gmail dot com
 Status:   Open
 Bug Type: Documentation problem
 Operating System: ANY
 PHP Version:  Irrelevant
 New Comment:

I fail to see the specific link with objects, nor the dilemnia, because
serialize/unserialize can't keep references at all:

$a = 'first';
$b = &$a; // create a reference
$c = serialize($b);
unset($b); // kill the reference
$b = unserialize($c); // won't restore it, unserialize() doesn't return
a reference.
$a = 'second';
echo $b;
-> 'first'


Previous Comments:


[2005-12-15 02:29:34] al dot the dot x at gmail dot com

Also, as I've discovered in further testing, even 
internal references are not preserved when serialize() 
and unserialize() are employed. For instance (mind the 
pun, it's tricky): 

Sample Code:


class A {
  var $value = 0;

  function A ( $newValue = 0 ) {
$this->value = $newValue;
  } // END constructor
} // END class A

class B {
  var pointers = array(); 
  vae aliases = array();
  // Excuse the misnomers, please...

  function B ( $newPointer = false ) {
if (false !== $newPointer) 
  $this->ponters[] =& $newPointer;
foreach ($pointers as $index => $value)
  $this->aliases[$index] =& $pointers[$index];
  } // END constructor
} // END class B

$newA = new A('I'm a new A'); 
$newB = new B(&$newA);
$oldB = unserialize(serialize($newB));
$newA->value = "Now I'm an old A";

// Forgive the PHP5-style syntax below...

echo $newA->value; 
// As expected, Output: Now I'm an old A

echo $newB->pointer[0]->value;
// As expected, Output same...

echo $oldB->pointers[0]->value;
// Somewhat expected, but not desired...
// Output: I'm an old A

$oldB->pointers[0]->value = "Also an old A";
echo $oldB->pointers[0]->value;
echo $oldB->aliased[0]->value;
// Nothing as expected or desired...
// Output 1: Also an old A
// Output 2: I'm an old A
// Internal references aren't even preserved... Boo.



[2005-12-14 13:16:12] [EMAIL PROTECTED]

And write with big letters "references are NOT pointers!" :)



[2005-12-07 09:20:40] al dot the dot x at gmail dot com

Description:

As discussed in several bug reports and in the 
additional comments in the PHP Documentation site 
(eventually, with some reading / searching), the 
functions serialize() and unserialize() do not restore 
references to other objects in PHP 4. As that this 
behavior is unexpected _and_ intrinsic to the use of 
session data in PHP, please consider including a caveat 
or clarification in the documentation XML for the 
affected functions, the "Classes and Objects" section,  
and the "Session-Handling Functions" section.

Certainly, there's a workaround with __sleep() and 
__wakeup(), but this really needs to be addressed in the 
primary documentation in all these places, since the 
thread regarding that behavior is now buried among 
others and only appears on the description of 
serialize().

I also understand that this has been fixed as of PHP 5, 
but that's not a very helpful explanation, Most hosting 
providers currently run PHP 4.3.x or 4.4.x and place low 
priority on upgrading until the next major Apache 
version is released (maybe not even then, the slackers).

Reproduce code:
---
// Consider:

class dataObject {
  var $data = NULL;
  var $pointer = NULL;

  function dataObject ($newData = false) {
if ($newData !== false) $this->data = $newData;
  } // END constructor

  function setPointer (&$newPtr) {
return ($this->pointer =& $newPtr);
  } // END setPointer

} // END class dataObject

$A = new base('This is A');
$B = new base('This is B');
$A->setPointer(&$B);
$C = serialize($A);

// Now check the original for reference...

$B->data = "Still B, but different";
echo $A->pointer->data; // Funky syntax, I know...

// Output as expected: "Still B, but different"
// But do the same on the serialized version...

unset($A);
$A = unserialize($C);
$B->data = "Where's B now?";
echo $A->pointer->data;

// Output is old "This is B"... Not cool.
// Reference is not preserved.






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