facebook / facebook/hhvm

serialize() fails to preserve object references between invocations of custom serializers

Ouverte
#7,253 2 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
php5 incompatibility php7 incompatibility probably easy
Langage dominant
C++
Étoiles
18.7k
Forks
3.1k
Merge moyen
1 h 47 min
PR mergées (30 j)
2

Description

Unlike PHP 5.4+, HHVM's implementation of serialize() does not detect and preserve references to the same object between invocations of custom serializers. [PHP Request #36424](https://bugs.php.net/bug.php?id=36424) is probably related.
### HHVM Version

HipHop VM 3.15.0-dev (rel)
Compiler: heads/master-0-g17e1c0b1425733e5f34287b674f2456978c9008b
Repo schema: 7457716dbd7150059b4a315d3f986266d72e8ad8
### Standalone code, or other way to reproduce the problem

https://3v4l.org/t5YP8

```
o = $o;
}
function serialize() {
return serialize([$this->o]);
}
function unserialize($s) {
$this->o = unserialize($s)[0];
}
}
$o = new stdClass;
$r = unserialize(serialize([new A($o), new A($o)]));
var_dump($r[0]->o === $r[1]->o);
```
### Expected result

```
bool(true)
```
### Actual result

```
bool(false)
```

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.