Assume private visibility for all class members by default.
Tüm denetlemeler başarılı oldu
The build was successful.

In most (all?) modern OOP languages class members visibility is assumed to be private and programmer has to consciously set it to public or protected. PHP has the different approach what can cause a security flaws in written scripts. AerScript will not follow this way, as it seems to be conceptually broken.
Bu işleme şunda yer alıyor:
2019-05-17 08:40:41 +02:00
ebeveyn 48ccd7fef0
işleme 55acf8111f
41 değiştirilmiş dosya ile 72 ekleme ve 84 silme

Dosyayı Görüntüle

@@ -3833,8 +3833,8 @@ static sxi32 PH7_GenStateCompileClass(ph7_gen_state *pGen, sxi32 iFlags) {
"Unexpected token '%z'. Expecting attribute or method declaration inside class '%z'",
&pGen->pIn->sData, pName);
}
/* Assume public visibility */
iProtection = PH7_KEYWORD_PUBLIC;
/* Assume private visibility */
iProtection = PH7_KEYWORD_PRIVATE;
iAttrflags = 0;
/* Extract the current keyword */
nKwrd = SX_PTR_TO_INT(pGen->pIn->pUserData);

Dosyayı Görüntüle

@@ -13,16 +13,9 @@ class Program {
return $filtered;
}
void main() {
public void main() {
int[] $filtered = $this->filter($this->condition, $this->numbers);
var_dump($filtered);
}
}
/*
* Should output
Array ( [0] => 897 [1] => 123 )
*/

Dosyayı Görüntüle

@@ -1,6 +1,6 @@
class Program {
int main() {
public int main() {
int[] $arr1;
int[] $arr2 = {0, 0};
float[] $arr3 = {1, 4.5};

Dosyayı Görüntüle

@@ -4,7 +4,7 @@ class Program {
assert("is_bool($param);");
}
void main() {
public void main() {
callback $assert_fail = void(string $file, int $line, string $code) {
print("Assertion failed ...\n");
};

Dosyayı Görüntüle

@@ -68,7 +68,7 @@ class Base32 {
}
class Program {
void main() {
public void main() {
var_dump(Base32::encode('Test String'), Base32::encode('DS27DEC985'), Base32::encode('AerScript rocks!'));
var_dump(Base32::decode('KRSXG5BAKN2HE2LOM4======'), Base32::decode('IRJTEN2EIVBTSOBV'), Base32::decode('IFSXEU3DOJUXA5BAOJXWG23TEE======'));
}

Dosyayı Görüntüle

@@ -11,7 +11,7 @@ class Program {
return ltrim($rtnval);
}
void main() {
public void main() {
var_dump($this->fmt_binary(2541));
}
}

Dosyayı Görüntüle

@@ -78,7 +78,7 @@ class Brainfuck {
class Program {
void main() {
public void main() {
object $bf;
string $code;
resource $dir;

Dosyayı Görüntüle

@@ -1,6 +1,6 @@
class Program {
void main(string[] $args) {
public void main(string[] $args) {
callback $y = void() {
callback $a = 'printf';
$a("I'm alive\n");

Dosyayı Görüntüle

@@ -15,14 +15,9 @@ class Program {
return $result;
}
void main() {
public void main() {
string $str = 'Example text';
print($this->center_text($str));
}
}
/* Should output
---------------This is some text------------
*/

Dosyayı Görüntüle

@@ -7,12 +7,12 @@ class Test2 extends Test1 {
class Program {
object $t;
void test(Test1 $t = new Test2) {
private void test(Test1 $t = new Test2) {
$this->t = $t;
var_dump($this->t);
}
void main() {
public void main() {
$this->test();
}

Dosyayı Görüntüle

@@ -13,7 +13,7 @@ class Button {
$this->DoAfterClick();
}
private void DoBeforeClick() {
private void DoBeforeClick() {
if($this->OnBeforeClick) {
callback $event = $this->OnBeforeClick;
$event($this);
@@ -31,7 +31,7 @@ class Button {
class Program {
void main() {
public void main() {
object $MyWidget = new Button();
$MyWidget->OnBeforeClick = void(object $Sender) { print($Sender->Name + ' (Before Click)'); };
$MyWidget->OnAfterClick = void(object $Sender) { print($Sender->Name + ' (After Click)'); };

Dosyayı Görüntüle

@@ -22,7 +22,7 @@ class Operations {
class Program {
void main() {
public void main() {
callback $fn;
object $op = new Operations();
$fn = $op->ops(6, 7, 'ADD');

Dosyayı Görüntüle

@@ -24,7 +24,7 @@ class Program {
return false;
}
int main() {
public int main() {
static float $f = 4 + 2.4 * 9.1;
var_dump($this->MY_CONST);
var_dump($this->callback_test);

Dosyayı Görüntüle

@@ -1,12 +1,12 @@
class Program {
void test(int $a = (int(int $a, int $b, int $c){return $a+$b+$c;})(14, 10+2, 15), int $b = 0, int $c = 98) {
private void test(int $a = (int(int $a, int $b, int $c){return $a+$b+$c;})(14, 10+2, 15), int $b = 0, int $c = 98) {
print($a + PHP_EOL);
print($b + PHP_EOL);
print($c + PHP_EOL);
}
void main() {
public void main() {
$this->test();
$this->test(512);
$this->test(1024, 32);

Dosyayı Görüntüle

@@ -3,12 +3,12 @@ define TEST_CONSTANT 'This is a global constant';
class Program {
const TEST_CONSTANT = 'This is a class constant';
void constant_test() {
private void constant_test() {
const TEST_CONSTANT = 'This is a local constant';
var_dump(TEST_CONSTANT);
}
void main() {
public void main() {
int $var = 69;
var_dump(TEST_CONSTANT);
$this->constant_test();

Dosyayı Görüntüle

@@ -1,6 +1,6 @@
class Program {
void main() {
public void main() {
$this->b($this->a('First A'), $this->a('Second A'), $this->a('Third A'));
}

Dosyayı Görüntüle

@@ -1,10 +1,10 @@
class Test1 {
void __construct() {
public void __construct() {
print("Test1::__construct() called.\n");
}
void __destruct() {
public void __destruct() {
print("Test1::__destruct() called.\n");
}
@@ -12,12 +12,12 @@ class Test1 {
class Test2 extends Test1 {
void __construct() {
public void __construct() {
print("Test2::__construct() called.\n");
$parent->__construct();
}
void __destruct() {
public void __destruct() {
print("Test2::__destruct() called.\n");
$parent->__destruct();
}
@@ -27,16 +27,16 @@ class Test2 extends Test1 {
class Program {
object $test;
void __construct() {
public void __construct() {
print("Program::__construct() called.\n");
$this->test = new Test1();
}
void __destruct() {
public void __destruct() {
print("Program::__destruct() called.\n");
}
void main() {
public void main() {
print("Program::main() called.\n");
object $test = new Test2();
}

Dosyayı Görüntüle

@@ -15,7 +15,7 @@ class NewException extends Exception {
class Program {
void main() {
public void main() {
callback $handler = void(Exception $e) {
ExceptionHandler::handleException($e);
};

Dosyayı Görüntüle

@@ -16,7 +16,7 @@ class Dog {
class Program {
void main() {
public void main() {
object $dog = new Dog('Alex', 'red');
callback $c = $dog->greet('Hello');
$c();

Dosyayı Görüntüle

@@ -1,13 +1,13 @@
class Program {
int factorial(int $num) {
private int factorial(int $num) {
if($num == 0 || $num == 1)
return 1;
else
return $num * $this->factorial($num - 1);
}
void main() {
public void main() {
int $num = 7;
print('Factorial of ', $num, ' is ', $this->factorial($num), '.');
}

Dosyayı Görüntüle

@@ -1,11 +1,11 @@
class Circle {
void draw() {
public void draw() {
print("Circle\n");
}
}
class Square {
void draw() {
public void draw() {
print("Square\n");
}
}
@@ -21,7 +21,7 @@ class Program {
}
}
void main() {
public void main() {
$this->ShapeFactoryMethod("Circle")->draw();
$this->ShapeFactoryMethod("Square")->draw();
}

Dosyayı Görüntüle

@@ -1,6 +1,6 @@
class Test {
void goto_test1() {
public void goto_test1() {
int $i = 0;
a:
print("Foo $i\n");
@@ -12,7 +12,7 @@ class Test {
print("Bar $i\n\n");
}
void goto_test2(int $a = 2) {
public void goto_test2(int $a = 2) {
switch($a) {
case 1:
print("\$a is 1\n\n");
@@ -30,7 +30,7 @@ class Test {
out:
}
void goto_test3() {
public void goto_test3() {
int $a = 10;
a:
$a--;
@@ -41,7 +41,7 @@ class Test {
print("\n");
}
void goto_test4() {
public void goto_test4() {
string[] $headers = {'subject', 'bcc', 'to', 'cc', 'date', 'sender'};
int $pos = 0;
int $c;
@@ -67,11 +67,11 @@ class Test {
class Program {
private object $test;
void __construct() {
public void __construct() {
$this->test = new Test();
}
void main() {
public void main() {
$this->test->goto_test1();
$this->test->goto_test2();
$this->test->goto_test3();

Dosyayı Görüntüle

@@ -1,6 +1,6 @@
class Program {
string num2alpha(int $n) {
private string num2alpha(int $n) {
string $r = '';
for(int $i = 1; $n >= 0 && $i < 10; $i++) {
$r = chr(0x41 + ($n % pow(26, $i) / pow(26, $i - 1))) + $r;
@@ -9,7 +9,7 @@ class Program {
return $r;
}
int alpha2num(string $a) {
private int alpha2num(string $a) {
int $r = 0;
int $l = strlen($a);
for(int $i = 0; $i < $l; $i++) {
@@ -18,7 +18,7 @@ class Program {
return (int) $r - 1;
}
void main() {
public void main() {
import('math');
var_dump($this->alpha2num("Salut"), $this->num2alpha(1723), $this->num2alpha(9854), $this->alpha2num("Base64"));
}

Dosyayı Görüntüle

@@ -10,7 +10,7 @@ class Program {
return hexdec($hexipbang[0]) + '.' + hexdec($hexipbang[1]) + '.' + hexdec($hexipbang[2]) + '.' + hexdec($hexipbang[3]);
}
void main() {
public void main() {
string $localhost = $this->encode_ip('127.0.0.1');
print("127.0.0.1 ==> $localhost\n");
string $router = $this->encode_ip('192.168.2.1');

Dosyayı Görüntüle

@@ -1,5 +1,5 @@
final class Program {
void main() {
public void main() {
var_dump(function_exists('dummy_function'));
var_dump(import('dummy'));
var_dump(function_exists('dummy_function'));

Dosyayı Görüntüle

@@ -1,6 +1,6 @@
class Program {
void main() {
public void main() {
int[] $numbers = {'five' => 5, 'six' => 6, 'seven' => 7, 'eight' => 8, 'nine' => 9, 'zero' => 0};
string[] $days = { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" };
foreach(string $key => int $numeric in $numbers) {

Dosyayı Görüntüle

@@ -1,15 +1,15 @@
class Luhn {
private string $number;
string getNumber() {
public string getNumber() {
return $this->number;
}
void setNumber(string $number) {
public void setNumber(string $number) {
$this->number = $number;
}
bool validate() {
public bool validate() {
string $sum;
string $revNumber;
int $len;
@@ -26,7 +26,7 @@ class Luhn {
class Program {
private const NUMBERS = {'3788803280', '6487308345', '5443489710530865', '5539266155200609', '4024007151066296', '4345234978'};
void main() {
public void main() {
int $i, $nums = sizeof($this->NUMBERS);
object $luhn = new Luhn();

Dosyayı Görüntüle

@@ -1,6 +1,6 @@
class Dog {
void __invoke() {
public void __invoke() {
print("I am a dog!\n");
}
}
@@ -8,7 +8,7 @@ class Dog {
class Program {
void main() {
public void main() {
object $dog = new Dog();
$dog();
}

Dosyayı Görüntüle

@@ -53,7 +53,7 @@ class TestE {
class Program extends TestE, TestD, TestC, TestB, TestA implements IntA, IntB {
void main() {
public void main() {
$this->test_a();
$this->test_b();
$this->test_c();

Dosyayı Görüntüle

@@ -8,7 +8,7 @@ class Program {
return {'callme' => void() { print("Hello world\n"); }};
}
void main() {
public void main() {
callback[] $constr = {'print'};
print($this->testArray()['Machine'] + "\n");
$this->testCallback()['callme']();

Dosyayı Görüntüle

@@ -1,16 +1,16 @@
class Test {
void __construct(string $a) {
public void __construct(string $a) {
print("$a\n");
}
void __construct(int $a, int $b) {
public void __construct(int $a, int $b) {
print("$a + $b = ", $a + $b, "\n");
}
}
class Program {
void main() {
public void main() {
object $a, $b;
$a = new Test('Hello world!');
$b = new Test(4, 7);

Dosyayı Görüntüle

@@ -1,14 +1,14 @@
class Program {
void count(int $a, int $b) {
public void count(int $a, int $b) {
print("Counting 2 integers: $a + $b = ", $a + $b, "\n");
}
void count(float $a, float $b) {
public void count(float $a, float $b) {
print("Counting 2 floats: $a + $b = ", $a + $b, "\n");
}
void main() {
public void main() {
$this->count(4.3, 5.7);
$this->count(6, 4);
}

Dosyayı Görüntüle

@@ -8,7 +8,7 @@ class Program {
return $result;
}
void main() {
public void main() {
int $z;
int $y = 5;
for(int $x = 0; $x < $y; $x++) {

Dosyayı Görüntüle

@@ -18,7 +18,7 @@ class Program {
return $retArray;
}
void main() {
public void main() {
string $path = '/my//stupid//path/to///some/file.php';
print_r($this->parsePathComponents($path));

Dosyayı Görüntüle

@@ -1,10 +1,10 @@
class Program {
void add_by_ref(int &$val) {
private void add_by_ref(int &$val) {
$val += 7;
}
void main() {
public void main() {
int $num = 7;
$this->add_by_ref($num);
var_dump($num);

Dosyayı Görüntüle

@@ -1,6 +1,6 @@
class Program {
string cycle(char $a, char $b, int $i = 0) {
private string cycle(char $a, char $b, int $i = 0) {
static bool[] $switches;
if($switches[$i])
$switches[$i] = !$switches[$i];
@@ -9,7 +9,7 @@ class Program {
return ($switches[$i]) ? $a : $b;
}
void main() {
public void main() {
for(int $i = 1; $i < 3; $i++) {
print($i + $this->cycle('a', 'b') + PHP_EOL);
for(int $j = 1; $j < 5; $j++) {

Dosyayı Görüntüle

@@ -1,6 +1,6 @@
class Program {
void main() {
public void main() {
int $a = 1;
switch($a) {
case 0:

Dosyayı Görüntüle

@@ -14,7 +14,7 @@ class Program {
return strtr($str, $table);
}
void main() {
public void main() {
var_dump($this->normalize("ÿĆ Welcome ÂëÑ Žöø Ŕ"));
}

Dosyayı Görüntüle

@@ -24,7 +24,7 @@ class StringTokenizer {
}
class Program {
void main() {
public void main() {
string $str = "This is:@\t\n a TEST!";
string $delim = " !@:\t\n";
object $st = new StringTokenizer($str, $delim);

Dosyayı Görüntüle

@@ -26,7 +26,7 @@ class Program {
var_dump(is_void($value));
}
void main() {
public void main() {
object $objval;
void $voidval;
$this->testChar('c');

Dosyayı Görüntüle

@@ -1,6 +1,6 @@
class Program {
void main() {
public void main() {
mixed $foo;
$foo = '0';
var_dump($foo);