Skip to content

Commit

Permalink
updated doc with a couple of won't fix bugs
Browse files Browse the repository at this point in the history
Summary:
adding the code example Drew found as a "won't fix" per our discussion

Test Plan:
doc

DiffCamp Revision: 129742
Reviewed By: andrewparoski
CC: hphp-diffs@lists, andrewparoski
Tasks:
#238897: bug in late static binding
#244920: HPHP doesn't preserve insane PHP behavior with respect to recursive
arrays.
#247054: XMLWriter/resource class cannot appear as type hints
#247963: assigning $GLOBALS

Revert Plan:
OK
  • Loading branch information
haiping authored and macvicar committed Jul 5, 2010
1 parent ab20856 commit b8138ff
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 1 deletion.
46 changes: 45 additions & 1 deletion doc/inconsistencies
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,32 @@ a data member and then resetting it, it's order is not altered in foreach
iteration. When unsetting then resetting to NULL, HipHop will be confused to
think the property is still not present (bug).

(3) $this handling of static method

In PHP, $this may be passed into an unrelated class's static method. Here's an
example,

<?php
class b {
public function bar() {
var_dump($this); // <-- $this is actually class "c" object
$this->baz();
}
}
class c { // <-- note that "c" has nothing to do with "b"
public $x = 2;
public function foo() {
b::bar();
}
public function baz() {
echo "Hello!\n";
}
}
$obj = new c;
$obj->foo();

In HipHop, $this will be NULL when doing this.

3. Eval Issues

(1) eval
Expand Down Expand Up @@ -60,7 +86,10 @@ Also, in PHP, $GLOBALS can be used as a regular variable, for example,
$GLOBALS = 0;
$x = $GLOBALS - 5;

In HipHop, this is not allowed.
$g = $GLOBALS;
$g['x'] = 3;

In HipHop, this is not allowed or not working.

5. Dynamic declared constants

Expand All @@ -78,3 +107,18 @@ Can return classes in different order from PHP's.

If an uninitialized variable is being used before it's assigned with a value,
and this variable is inferred as integers, it will be 0, instead of null.

(3) XMLWriter

In PHP, XMLWriter class and its functions returned different types of objects,

<?php
function foo(XMLWriter $w) {}
$obj = new XMLWriter();
foo($obj); // <-- this one is actually okay
$obj2 = xmlwriter_open_memory(); // <-- just not this one
var_dump($obj, $obj2);
foo($obj2);

In HipHop, they are the same.

1 change: 1 addition & 0 deletions doc/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ function format_document($doc) {

$doc = preg_replace('/\n\n/', '<p>', $doc); // paragraphs
$doc = preg_replace('/<T>/', '&lt;T&gt;', $doc); // C++ templates
$doc = preg_replace('/<\?/', '&lt;?', $doc); // PHP start tags

// copyright notice
$doc .= '<p>&nbsp;<table width="100%"><tr><td class="footer" align=right>'.
Expand Down

0 comments on commit b8138ff

Please sign in to comment.