M
mpopp
Aktives Mitglied
- Dabei seit
- 14.01.2004
- Beiträge
- 40
- Reaktionspunkte
- 0
Hallo!
Ich habe hier ein kleines Beispiel, welches bei mir in PHP 4 funktioniert, in PHP 5 Release Candidate 3 allerdings nicht:
func.inc.php
a.php
b.php
Die Ausgabe sollte einfach sein (unabhängig davon, welchen Link man verwendet):
object obj->x: 10
In PHP 5 bekomme ich folgende Fehlermeldung:
Notice: unserialize() [function.unserialize]: Error at offset 0 of 32 bytes in C:\Apache2\htdocs\test_php5\b.php on line 4
Notice: Trying to get property of non-object in C:\Apache2\htdocs\test_php5\b.php on line 6
object obj->x:
Hat jemand eine Idee, wie das unter PHP 5 funktioniert?
Danke!
Ich habe hier ein kleines Beispiel, welches bei mir in PHP 4 funktioniert, in PHP 5 Release Candidate 3 allerdings nicht:
func.inc.php
PHP:
<?php
class test
{
var $x;
function test($value)
{
$this->x = $value;
}
}
?>
PHP:
<?php
include ("func.inc.php");
$obj = new test(10);
echo "<a href='b.php?obj=".urlencode(serialize($obj))."'>b.php</a><br><br>";
echo "<form action='b.php' method='post'>";
echo "<input type='hidden' name='obj' value='".serialize($obj)."'>";
echo "<input type='submit'>";
echo "</form>";
?>
PHP:
<?php
include ("func.inc.php");
$obj = unserialize($obj);
echo "object obj->x: ".$obj->x."<br><br>";
?>
object obj->x: 10
In PHP 5 bekomme ich folgende Fehlermeldung:
Notice: unserialize() [function.unserialize]: Error at offset 0 of 32 bytes in C:\Apache2\htdocs\test_php5\b.php on line 4
Notice: Trying to get property of non-object in C:\Apache2\htdocs\test_php5\b.php on line 6
object obj->x:
Hat jemand eine Idee, wie das unter PHP 5 funktioniert?
Danke!