jackalope / jackalope-jackrabbit

Jackalope implementation with the jackrabbit backend
http://jackalope.github.io/
Other
65 stars 27 forks source link

Undefined Index in ObjectManager #87

Closed wachterjohannes closed 10 years ago

wachterjohannes commented 10 years ago

I have initialized a Repository with following tree. Between initialize the tree and the rest i have added:

        $session->save();
        $session->refresh(false);

When i delete now /cmf/default/routes/test i get changing exceptions like:

the same exceptions i get when i purge the workspace:

        if (isset($this->session)) {
            NodeHelper::purgeWorkspace($this->session);
            $this->session->save();
        }

in the ObjectManager:

    public function isNodeDeleted($absPath)
    {
        return array_key_exists($absPath, $this->nodesRemove)
1675:    && ! ((array_key_exists($absPath, $this->nodesAdd))
                || $this->nodesAdd[$absPath]
                || $this->getMoveSrcPath($absPath))
            ;
    }

bildschirmfoto 2014-05-26 um 17 33 13

if line 1675 is false the next line will be executed and will fail because nodesAdd has no key $absPath

/cmf -- /default ---- /routes ------ /news -------- /news-1 ---------- /sub-1 ---------- /sub-2 -------- /news-2 ---------- /sub-1 ---------- /sub-2 ------ /test -------- /news-1 ---------- /sub-1 ---------- /sub-2 -------- /news-2 ---------- /sub-1 ---------- /sub-2

Stacktrace:

PHPUnit_Framework_Error_Notice : Undefined index: /cmf/default/routes/de/test/news-2/sub-2
#0 /Users/johannes/workspace/sulu/sulu-standard/vendor/sulu/sulu/vendor/jackalope/jackalope/src/Jackalope/ObjectManager.php(1676): PHPUnit_Util_ErrorHandler::handleError(8, 'Undefined index...', '/Users/johannes...', 1676, Array)
#1 /Users/johannes/workspace/sulu/sulu-standard/vendor/sulu/sulu/vendor/jackalope/jackalope/src/Jackalope/Node.php(152): Jackalope\ObjectManager->isNodeDeleted('/cmf/default/ro...')
#2 /Users/johannes/workspace/sulu/sulu-standard/vendor/sulu/sulu/vendor/jackalope/jackalope/src/Jackalope/Node.php(1274): Jackalope\Node->parseData(Object(stdClass), true, false)
#3 /Users/johannes/workspace/sulu/sulu-standard/vendor/sulu/sulu/vendor/jackalope/jackalope/src/Jackalope/Item.php(589): Jackalope\Node->refresh(false)
#4 /Users/johannes/workspace/sulu/sulu-standard/vendor/sulu/sulu/vendor/jackalope/jackalope/src/Jackalope/Node.php(802): Jackalope\Item->checkState()
#5 /Users/johannes/workspace/sulu/sulu-standard/vendor/sulu/sulu/vendor/jackalope/jackalope/src/Jackalope/ObjectManager.php(1169): Jackalope\Node->getIdentifier()
#6 /Users/johannes/workspace/sulu/sulu-standard/vendor/sulu/sulu/vendor/jackalope/jackalope/src/Jackalope/ObjectManager.php(1197): Jackalope\ObjectManager->performNodeRemove('/cmf/default/ro...', Object(Jackalope\Node), true, true)
#7 /Users/johannes/workspace/sulu/sulu-standard/vendor/sulu/sulu/vendor/jackalope/jackalope/src/Jackalope/ObjectManager.php(1262): Jackalope\ObjectManager->cascadeDelete('/cmf')
#8 /Users/johannes/workspace/sulu/sulu-standard/vendor/sulu/sulu/vendor/jackalope/jackalope/src/Jackalope/Item.php(414): Jackalope\ObjectManager->removeItem('/cmf')
#9 /Users/johannes/workspace/sulu/sulu-standard/vendor/sulu/sulu/vendor/jackalope/jackalope/src/Jackalope/Node.php(1306): Jackalope\Item->remove()
#10 /Users/johannes/workspace/sulu/sulu-standard/vendor/sulu/sulu/vendor/phpcr/phpcr-utils/src/PHPCR/Util/NodeHelper.php(84): Jackalope\Node->remove()
#11 /Users/johannes/workspace/sulu/sulu-standard/vendor/sulu/sulu/vendor/sulu/test-bundle/Sulu/Bundle/TestBundle/Testing/PhpcrTestCase.php(150): PHPCR\Util\NodeHelper::purgeWorkspace(Object(Jackalope\Session))
#12 /Users/johannes/workspace/sulu/sulu-standard/vendor/sulu/sulu/vendor/phpunit/phpunit/src/Framework/TestCase.php(843): Sulu\Bundle\TestBundle\Testing\PhpcrTestCase->tearDown()
#13 /Users/johannes/workspace/sulu/sulu-standard/vendor/sulu/sulu/vendor/phpunit/phpunit/src/Framework/TestResult.php(686): PHPUnit_Framework_TestCase->runBare()
#14 /Users/johannes/workspace/sulu/sulu-standard/vendor/sulu/sulu/vendor/phpunit/phpunit/src/Framework/TestCase.php(754): PHPUnit_Framework_TestResult->run(Object(Sulu\Component\Content\Rlp\Strategy\PhpcrMapperTest))
#15 /Users/johannes/workspace/sulu/sulu-standard/vendor/sulu/sulu/vendor/phpunit/phpunit/src/Framework/TestSuite.php(675): PHPUnit_Framework_TestCase->run(Object(PHPUnit_Framework_TestResult))
#16 /Users/johannes/workspace/sulu/sulu-standard/vendor/sulu/sulu/vendor/phpunit/phpunit/src/TextUI/TestRunner.php(425): PHPUnit_Framework_TestSuite->run(Object(PHPUnit_Framework_TestResult))
#17 /usr/local/php5-5.4.20-20130930-105609/lib/php/PHPUnit/TextUI/Command.php(176): PHPUnit_TextUI_TestRunner->doRun(Object(PHPUnit_Framework_TestSuite), Array)
#18 /private/var/folders/pd/j71nctrj4nb56hznrrz4v32w0000gn/T/ide-phpunit.php(268): PHPUnit_TextUI_Command->run(Array, true)
#19 /private/var/folders/pd/j71nctrj4nb56hznrrz4v32w0000gn/T/ide-phpunit.php(506): IDE_Base_PHPUnit_TextUI_Command::main()
#20 {main}
wachterjohannes commented 10 years ago

/cc @chirimoya @danrot

wachterjohannes commented 10 years ago

wrong repository moved to https://github.com/jackalope/jackalope/issues/227