Sylvio Posted October 17, 2011 Share Posted October 17, 2011 Hi, Lately I'm getting this PW error (PW 2.0) and I'm not able to find what's causing it? guest:/?/:ProcessWire Error:Exception: Not unique table/alias: 'rootparent' (in /var/www/vhosts/showled.tv/httpdocs/wire/core/Database.php line 72) Thanks Sylvio Link to comment Share on other sites More sharing options...
ryan Posted October 17, 2011 Share Posted October 17, 2011 I've not seen that error before. Do you have any other context of when it happens? Link to comment Share on other sites More sharing options...
Sylvio Posted October 17, 2011 Author Share Posted October 17, 2011 Hi Ryan, I have no other context of when it happens, I've checked log files, tried to reproduce it,etc... all without success The website seems to run smoothly,but every other day I get this error in my mailbox. Sylvio Link to comment Share on other sites More sharing options...
ryan Posted October 17, 2011 Share Posted October 17, 2011 Just looking in the PageFinder to see where it is using the alias 'rootparent' … do you have any selectors in your site that include multiple paths? For instance: parent=/a/b/c|/d/e/f/ path=/a/b/c/, parent=/d/e/f/ When did the error start appearing, and can you think of any changes you made near the time it started occurring? Link to comment Share on other sites More sharing options...
Sylvio Posted October 18, 2011 Author Share Posted October 18, 2011 Hi Ryan, Not that I can see, the only thing i did, was adding 2 templates, it has to be in one of these templates then I guess. - one template is a private login template: <?php if($input->post->login_submit) { // process submitted login form $name = $sanitizer->username($input->post->lblUsername); $pass = $input->post->lblPassword; if($session->login($name, $pass)) $session->redirect("./"); else echo '<p class="ui-state-error-text">Login failed, please try again.</p>'; } if($user->isLoggedin() && $user->hasRole("distributors")) { $categories = $pages->get("/private/")->children(); if (count($categories)>0) { ?> <ul class="tabs"> <?php foreach($categories as $category) { echo "<li><a href='#{$category->id}'>{$category->title}</a></li>"; } ?> <li><a href='#upload32654981'>Upload new file</a></li> </ul> <div class="tab_container"> <?php foreach($categories as $category) { $product_arr = array(); echo "<div id='{$category->id}' class='tab_content'>"; $children = $category->children(); if (count($children)>0) { foreach($children as $products) { foreach($products->related_products as $product) { $product_arr[] = $product->title; } } ?> <?php $product_arr = array_unique($product_arr); foreach ($product_arr as $value) { echo "<h2 class='acc_trigger'><a href='#'>» $value</a></h2>"; ?> <div class="acc_container"> <div class="block"> <?php foreach($children as $child) { $productchild_arr = array(); foreach($child->related_products as $productchild) { $productchild_arr[] = $productchild->title; } if (in_array($value, $productchild_arr)) { if ($child->template == 'client_images') { foreach($child->client_images as $image) { $thumb = $image->height(200); echo "<a href='{$image->url}' target='_blank'><img src='{$thumb->url}' alt='{$thumb->description}' title='{$thumb->description}' width='{$thumb->width()}' height='{$thumb->height()}' /></a>"; } } else { ?> <table> <?php foreach($child->client_documents as $doc) { ?> <tr> <td><a href='<?=$doc->url?>' target='_blank'><img src='<?php echo $config->urls->templates?>img/<?=$doc->ext?>_icon.png' alt='<?=$doc->get('description|name')?>' title='<?=$doc->get('description|name')?>' width='50' height='50'/></a></td> <td><?=$doc->name?><br/><?=$doc->description?></td> <td><?=strtoupper($doc->filesizeStr)?></td> </tr> <?php } ?> </table> <?php } } } ?> </div> </div> <?php } } echo "</div>"; } ?> <div id='upload32654981' class='tab_content'> <?php $fileextensions = $page->fields->get("client_upload")->extensions; if($input->post->upload_submit) { $uploadtab = TRUE; $page->setOutputFormatting(false); // instantiate the class and give it the name of the HTML field $u = new WireUpload('lblUpload'); $u->setMaxFiles(1); $u->setOverwrite(false); $u->setDestinationPath($page->client_upload->path); $valid_ext = explode(" ", $fileextensions); $u->setValidExtensions($valid_ext); // execute() returns an array, so we'll foreach() it even though only 1 file $exec_arr = $u->execute(); if(empty($exec_arr) || !count($exec_arr)) { if(empty($notices) || !count($notices)) { echo "<p class='ui-state-error-text'>Error: Choose a file to upload!</p>"; } else { foreach($notices as $notice) { if($notice instanceof NoticeError) { echo "<p class='ui-state-error-text'>Error: {$notice->text}</p>"; } } } } else { foreach($exec_arr as $filename) $page->client_upload->add($filename); $lastfile = $page->client_upload->last(); $lastfile->description = implode(",", $input->post->lblProducts); $page->save(); echo "<p>You file has been uploaded successfully!</p>"; } } else { $uploadtab = FALSE; ?> <form action='./' method='post' class="upload_form" enctype="multipart/form-data"> <ul class='Inputfields'> <li class='InputfieldText Inputfield_lblUpload ui-widget' id='wrap_Inputfield_lblUpload'> <div class='ui-widget-content'> <p class="description InputfieldFileValidExtensions"><?php echo $fileextensions; ?></p> <p><input id="Inputfield_lblUpload" class="required InputfieldMaxWidth" name="lblUpload" type="file" maxlength="255" /></p> </div> </li> <li class='InputfieldText Inputfield_lblProducts ui-widget' id='wrap_Inputfield_lblProducts'> <div class='ui-widget-content'> <p> <?php echo '<select id="Inputfield_lblProducts" name="lblProducts[]" multiple="multiple">'; echo "<option value='no product selected'>Select your product</option>"; $products = $pages->get("/products/")->children(); foreach($products as $product) { echo "<option value='{$product->title}'>{$product->title}</option>"; if ($product->numChildren && $product->rootParent->path == '/products/') { foreach($product->children as $subsubchild){ echo "<option value='{$subsubchild->title}'>{$subsubchild->title}</option>"; } } } echo "</select> "; ?> </p> </div> </li> <li class='InputfieldSubmit Inputfield_upload ui-widget' id='wrap_Inputfield_upload'> <div class='ui-widget-content'> <button id="Inputfield_upload" class="ui-button ui-widget ui-state-default ui-corner-all" name="upload_submit" value="Upload" type="submit"><span class='ui-button-text'>Send</span></button> </div> </li> </ul> </form> <?php } ?> </div> </div> <?php } } else { ?> <form action='./' method='post' class="login_form"> <ul class='Inputfields'> <li class='InputfieldText Inputfield_lblUsername ui-widget' id='wrap_Inputfield_lblUsername'> <label class='ui-widget-header' for='Inputfield_lblUsername'>Username</label> <div class='ui-widget-content'> <p><input id="Inputfield_lblUsername" class="required InputfieldMaxWidth" name="lblUsername" type="text" maxlength="255" /></p> </div> </li> <li class='InputfieldText Inputfield_lblPassword ui-widget' id='wrap_Inputfield_lblPassword'> <label class='ui-widget-header' for='Inputfield_lblPassword'>Password</label> <div class='ui-widget-content'> <p><input id="Inputfield_lblPassword" class="required InputfieldMaxWidth" name="lblPassword" type="password" maxlength="255" /></p> </div> </li> <li class='InputfieldSubmit Inputfield_login ui-widget' id='wrap_Inputfield_login'> <label class='ui-widget-header' for='Inputfield_login'>Login</label> <div class='ui-widget-content'> <button id="Inputfield_login" class="ui-button ui-widget ui-state-default ui-corner-all" name="login_submit" value="Login" type="submit"><span class='ui-button-text'>Login</span></button> </div> </li> </ul> </form> <?php } ?> - the other one is a logout template which does a simple 301 redirect: if($user->isLoggedin()) $session->logout(); if ($page->redirect_page) $session->redirect($page->redirect_page->url); I also created a new role, added a user. 1 Link to comment Share on other sites More sharing options...
ryan Posted October 18, 2011 Share Posted October 18, 2011 I don't see anything obvious in the code that we can point to. Though there is a lot here, so it's tell without stepping though live code. But if it's something that you yourself can't duplicate, then it's going to be a little hard to troubleshoot so we'd have to do more investigation into the error. I would suggest starting by matching up the time of the error email to entries in your apache log. See what requests were occurring at the time the error occurred. Was it a GET or POST request and what URL was it hitting? Grep the IP address in your log to see if it's a legitimate user or someone fishing for holes. Once you can match the request in your log to the error, we will at least know exactly what page (and likewise what template) is generating the error. It looks to me like PW doesn't yet know what page it's serving because it lists a "?" for the page, so there's a good chance this error may be occurring at bootstrap time. How random is the error? Does it come in at the same times every day and how many do you get? Link to comment Share on other sites More sharing options...
Ben Posted February 4, 2013 Share Posted February 4, 2013 I've seen a couple of these myself happen due to malformed markdown links, it's reproducible. To cause it - you take any page above the homepage, and add a special character (!@#$%^&*()) followed by a backslash. It'll throw the rootparent error. For example, http://www.example.com/news/*/ seems to throw it consistenly in LAMP, though not in a Windows environment for some reason. Not sure of the etiquette, perhaps I should've created a new thread rather than reanimate one that's over a year old? 1 Link to comment Share on other sites More sharing options...
ryan Posted February 5, 2013 Share Posted February 5, 2013 You are talking about putting that URL in your browser address bar and attempting to load it, right? So far, I can't seem to reproduce that one here. Is it specific to a certain version of ProcessWire? Technically, current versions of ProcessWire shouldn't even receive that request if your htaccess is working properly. What you should get is an Apache 404 (rather than a ProcessWire 404). As a result, I'm going to guess that you are using an older version of PW (2.0?) and that you are either logged in or have debug mode enabled? Let me know if you can think of any other ways to reproduce it? Netcarver, were you able to reproduce it? Link to comment Share on other sites More sharing options...
Ben Posted February 5, 2013 Share Posted February 5, 2013 Technically, current versions of ProcessWire shouldn't even receive that request if your htaccess is working properly. Thanks Ryan. That may have something to do with the Linux/WIndows deviation - Windows (localhost dev) is on Apache and Linux is running nginx. I'll have to take a closer look at the .htaccess file and make sure to create a parrallel rule for nginx. I believe I may have overdistilled the test case above, a better example would be (apologies for the oversight): http://www.example.com/news/*/news I'll dig a little deeper into the rewrite rules angle. EDIT: Forgot to mention -- I am just pasting the url into the browser. I'm running PW 2.2, PHP 5.4, and nginx. EDIT #2: Digging deeper, I don't think the htaccess rules stop the behavior because they are encoded before leaving the browser - they're coming through in the logs as hexidecimal encoded characters. Link to comment Share on other sites More sharing options...
ryan Posted February 5, 2013 Share Posted February 5, 2013 EDIT #2: Digging deeper, I don't think the htaccess rules stop the behavior because they are encoded before leaving the browser - they're coming through in the logs as hexidecimal encoded characters. Thanks I was able to duplicate with the example you posted on one server and not on another. The htaccess file shouldn't send the request on to PW if it contains anything other than "-_.a-z0-9/". But it looks like on some servers, Apache itself doesn't accept the other characters and just removes them, sending the URL on to ProcessWire. The result of something like "/*/" is double slashes, like "//". That's an unexpected condition--we don't expect this from Apache. So I updated ProcessPageView.module to expect it, so that it throws a 404 rather than a fatal 500 error. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now