forked from zenovich/runkit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes of issues with importing constant arrays into properties and co…
…nstants. Fixes of issues with importing functions or methods having static variables inside them. Some new tests were added.
- Loading branch information
Showing
9 changed files
with
227 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
return new Test; | ||
|
||
class Test { | ||
const C = 4; | ||
public $v = array(Test::C,5,6); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
--TEST-- | ||
runkit_import() Importing and overriding property with constant array as the value | ||
--SKIPIF-- | ||
<?php | ||
if(!extension_loaded("runkit")) print "skip"; | ||
?> | ||
--FILE-- | ||
<?php | ||
class Test { | ||
const C = 1; | ||
public $v = array(Test::C,2,3); | ||
} | ||
|
||
$t = new Test; | ||
var_dump($t->v); | ||
runkit_import(dirname(__FILE__) . '/runkit_import_constant_properties.inc', RUNKIT_IMPORT_CLASS_PROPS | RUNKIT_IMPORT_OVERRIDE); | ||
$t = new Test; | ||
var_dump($t->v); | ||
runkit_import(dirname(__FILE__) . '/runkit_import_constant_properties.inc', RUNKIT_IMPORT_CLASSES | RUNKIT_IMPORT_OVERRIDE); | ||
$t = new Test; | ||
var_dump($t->v); | ||
?> | ||
--EXPECT-- | ||
array(3) { | ||
[0]=> | ||
int(1) | ||
[1]=> | ||
int(2) | ||
[2]=> | ||
int(3) | ||
} | ||
array(3) { | ||
[0]=> | ||
int(1) | ||
[1]=> | ||
int(5) | ||
[2]=> | ||
int(6) | ||
} | ||
array(3) { | ||
[0]=> | ||
int(4) | ||
[1]=> | ||
int(5) | ||
[2]=> | ||
int(6) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
return new Test; | ||
|
||
class Test { | ||
const C = 4; | ||
public static $v = array(Test::C,5,6); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
--TEST-- | ||
runkit_import() Importing and overriding static property with constant array as the value | ||
--SKIPIF-- | ||
<?php | ||
if(!extension_loaded("runkit")) print "skip"; | ||
?> | ||
--FILE-- | ||
<?php | ||
class Test { | ||
const C = 1; | ||
public static $v = array(Test::C,2,3); | ||
} | ||
|
||
var_dump(Test::$v); | ||
runkit_import(dirname(__FILE__) . '/runkit_import_constant_static_properties.inc', RUNKIT_IMPORT_CLASS_STATIC_PROPS | RUNKIT_IMPORT_OVERRIDE); | ||
var_dump(Test::$v); | ||
runkit_import(dirname(__FILE__) . '/runkit_import_constant_static_properties.inc', RUNKIT_IMPORT_CLASSES | RUNKIT_IMPORT_OVERRIDE); | ||
var_dump(Test::$v); | ||
?> | ||
--EXPECT-- | ||
array(3) { | ||
[0]=> | ||
int(1) | ||
[1]=> | ||
int(2) | ||
[2]=> | ||
int(3) | ||
} | ||
array(3) { | ||
[0]=> | ||
int(1) | ||
[1]=> | ||
int(5) | ||
[2]=> | ||
int(6) | ||
} | ||
array(3) { | ||
[0]=> | ||
int(4) | ||
[1]=> | ||
int(5) | ||
[2]=> | ||
int(6) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?php | ||
function f() { | ||
static $v = 1; | ||
$v++; | ||
echo $v, "\n"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--TEST-- | ||
runkit_import() Importing and overriding function with a static variable | ||
--SKIPIF-- | ||
<?php | ||
if(!extension_loaded("runkit")) print "skip"; | ||
?> | ||
--FILE-- | ||
<?php | ||
function f() { | ||
static $v = 0; | ||
$v++; | ||
echo $v, "\n"; | ||
} | ||
|
||
f(); | ||
runkit_import(dirname(__FILE__) . '/runkit_import_function_with_static_var.inc', RUNKIT_IMPORT_FUNCTIONS | RUNKIT_IMPORT_OVERRIDE); | ||
f(); | ||
runkit_import(dirname(__FILE__) . '/runkit_import_function_with_static_var.inc', RUNKIT_IMPORT_FUNCTIONS | RUNKIT_IMPORT_OVERRIDE); | ||
f(); | ||
?> | ||
--EXPECT-- | ||
1 | ||
2 | ||
2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
return new Test; | ||
|
||
class Test { | ||
public function f() { | ||
static $v = 1; | ||
$v++; | ||
echo $v, "\n"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--TEST-- | ||
runkit_import() Importing and overriding method with a static variable | ||
--SKIPIF-- | ||
<?php | ||
if(!extension_loaded("runkit")) print "skip"; | ||
?> | ||
--FILE-- | ||
<?php | ||
class Test { | ||
public function f() { | ||
static $v = 0; | ||
$v++; | ||
echo $v, "\n"; | ||
} | ||
} | ||
|
||
$t = new Test; | ||
$t->f(); | ||
runkit_import(dirname(__FILE__) . '/runkit_import_method_with_static_var.inc', RUNKIT_IMPORT_CLASSES | RUNKIT_IMPORT_OVERRIDE); | ||
$t->f(); | ||
runkit_import(dirname(__FILE__) . '/runkit_import_method_with_static_var.inc', RUNKIT_IMPORT_CLASSES | RUNKIT_IMPORT_OVERRIDE); | ||
$t->f(); | ||
?> | ||
--EXPECT-- | ||
1 | ||
2 | ||
2 | ||
|