Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notice: Undefined index: generation.level4.generator #27

Closed
inxomnyaa opened this issue May 22, 2017 · 10 comments
Closed

Notice: Undefined index: generation.level4.generator #27

inxomnyaa opened this issue May 22, 2017 · 10 comments

Comments

@inxomnyaa
Copy link
Collaborator

Notice: Undefined index: generation.level4.generator in phar://C:/Users/Administrator/Desktop/Server/MinecraftPE/WolvesFortressCSphp7/ClearSky-PocketMine-MP_1.6.2dev.phar/src/pocketmine/scheduler/AsyncTask.php on line 142
[20:16:46] [Asynchronous Worker #2 thread/CRITICAL]: Error: "Cannot access protected property Ad5001\BetterGen\generator\BetterNormal::$options" (EXCEPTION) in "/BetterGen/src/Ad5001/BetterGen/biome/BetterDesert" at line 46
[20:16:46] [Asynchronous Worker #1 thread/CRITICAL]: Error: "Cannot access protected property Ad5001\BetterGen\generator\BetterNormal::$options" (EXCEPTION) in "/BetterGen/src/Ad5001/BetterGen/biome/BetterDesert" at line 46
[20:16:46] [Asynchronous Worker #1 thread/DEBUG]: #0 /BetterGen/src/Ad5001/BetterGen/generator/BetterNormal(148): Ad5001\BetterGen\biome\BetterDesert->__construct(boolean)
[20:16:46] [Asynchronous Worker #2 thread/DEBUG]: #0 /BetterGen/src/Ad5001/BetterGen/generator/BetterNormal(148): Ad5001\BetterGen\biome\BetterDesert->__construct(boolean)
[20:16:46] [Asynchronous Worker #1 thread/DEBUG]: #1 /src/pocketmine/level/generator/GeneratorRegisterTask(53): Ad5001\BetterGen\generator\BetterNormal->init(pocketmine\level\SimpleChunkManager object, pocketmine\utils\Random object)
[20:16:46] [Asynchronous Worker #2 thread/DEBUG]: #1 /src/pocketmine/level/generator/GeneratorRegisterTask(53): Ad5001\BetterGen\generator\BetterNormal->init(pocketmine\level\SimpleChunkManager object, pocketmine\utils\Random object)
[20:16:46] [Asynchronous Worker #2 thread/DEBUG]: #2 /src/pocketmine/scheduler/AsyncTask(80): pocketmine\level\generator\GeneratorRegisterTask->onRun(boolean)
[20:16:46] [Asynchronous Worker #1 thread/DEBUG]: #2 /src/pocketmine/scheduler/AsyncTask(80): pocketmine\level\generator\GeneratorRegisterTask->onRun(boolean)
[20:16:46] [Asynchronous Worker #2 thread/DEBUG]: #3 (): pocketmine\scheduler\AsyncTask->run(boolean)
[20:16:46] [Asynchronous Worker #1 thread/DEBUG]: #3 (): pocketmine\scheduler\AsyncTask->run(boolean)

Notice: Undefined index: generation.level4.generator in phar://C:/Users/Administrator/Desktop/Server/MinecraftPE/WolvesFortressCSphp7/ClearSky-PocketMine-MP_1.6.2dev.phar/src/pocketmine/scheduler/AsyncTask.php on line 142
[20:16:46] [Server thread/CRITICAL]: Could not execute asynchronous task GeneratorRegisterTask: Task crashed
[20:16:46] [Server thread/CRITICAL]: Could not execute asynchronous task GeneratorRegisterTask: Task crashed
zend_mm_heap corrupted
[20:16:46] [Asynchronous Worker #2 thread/CRITICAL]: Error: "Cannot access protected property Ad5001\BetterGen\generator\BetterNormal::$options" (EXCEPTION) in "/BetterGen/src/Ad5001/BetterGen/biome/BetterDesert" at line 46
bin\php\php.exe: Exit 1

@inxomnyaa
Copy link
Collaborator Author

Notice: Undefined index: generation.level4.manager in phar://C:/Users/Administrator/Desktop/Server/MinecraftPE/WolvesFortressCSphp7/ClearSky-PocketMine-MP_1.6.2dev.phar/src/pocketmine/scheduler/AsyncTask.php on line 142

@Ad5001
Copy link
Owner

Ad5001 commented May 22, 2017

I see... will fix this this evening.

@inxomnyaa
Copy link
Collaborator Author

inxomnyaa commented May 22, 2017

i have no idea where this comes from ^^

Offtoppic: can you explain me yield/generators?
For example, i don't understand why yield is needed here, for me it looks like its not even necessary..

<?php
function fib($n)
{
    $cur = 1;
    $prev = 0;
    for ($i = 0; $i < $n; $i++) {
	yield $cur;
        $temp = $cur;
        $cur = $prev + $cur;
        $prev = $temp;
    }
}

$fibs = fib(9);
foreach ($fibs as $fib) {
    echo " " . $fib;
}

This here is just the same:

<?php
function fib($n)
{
	$res = [];
    $cur = 1;
    $prev = 0;
    for ($i = 0; $i < $n; $i++) {
		$res[] = $cur;
        $temp = $cur;
        $cur = $prev + $cur;
        $prev = $temp;
    }
	return $res;
}

$fibs = fib(9);
foreach ($fibs as $fib) {
    echo " " . $fib;
}

@inxomnyaa
Copy link
Collaborator Author

Oh actually i see now. it simply doesn't save an array to memory

@Ad5001
Copy link
Owner

Ad5001 commented May 22, 2017

@thebigsmileXD There is an another difference, yield pauses the function execution and execute the code on the foreach (where you can send values back using the $gen->send() function).
Your code should look like this:

<?php
function fib($n) {
    $cur = 1;
    for ($i = 0; $i < $n; $i++) {
        echo " " . $cur;
        $cur += yield $cur;
    }
}

$prev = 0;
foreach ($gen = fib(9) as $fib) {
    echo " Foreach:" . $fib;
    $gen->send($fib);
    $prev = $fib;
}

This would output:

1 Foreach:1 2 2 Foreach:2 4 4 Foreach:4 8 8 Foreach:8 16 16 Foreach:16

@Ad5001
Copy link
Owner

Ad5001 commented May 22, 2017

Uhh. What branch are you runing?

@inxomnyaa
Copy link
Collaborator Author

Not sure, i guess.. master?

@Ad5001
Copy link
Owner

Ad5001 commented May 22, 2017

Well on master, BetterNormal::$options is public. Try updating it maybe?

@Ad5001
Copy link
Owner

Ad5001 commented Nov 13, 2017

Do anyone still get this bug or I can close it? I cannot reproduce it.

@AvgZing
Copy link

AvgZing commented Nov 14, 2017

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants