Jump to content

ProcessDatabaseBackup work no longer


Juergen
 Share

Recommended Posts

I have upgraded PW to the latest dev version (21) and now I get the following error if I want to open a backup:

Error: Exception: Unknown Selector operator: '' -- was your selector value properly escaped? (in /home/.sites/24/site1275/web/wire/core/Selectors.php line 283)

#0 /home/.sites/24/site1275/web/wire/core/Selectors.php(320): Selectors->create('0', '', ':7232549db11.sq...')
#1 /home/.sites/24/site1275/web/wire/core/Selectors.php(115): Selectors->extractString('0:7232549db11.s...')
#2 /home/.sites/24/site1275/web/wire/core/Selectors.php(104): Selectors->setSelectorString('0:7232549db11.s...')
#3 /home/.sites/24/site1275/web/wire/core/Pages.php(213): Selectors->__construct('0:7232549db11.s...')
#4 [internal function]: Pages->___find('0:7232549db11.s...', Array)
#5 /home/.sites/24/site1275/web/wire/core/Wire.php(397): call_user_func_array(Array, Array)
#6 /home/.sites/24/site1275/web/wire/core/Wire.php(332): Wire->runHooks('find', Array)
#7 /home/.sites/24/site1275/web/wire/core/Pages.php(320): Wire->__call('find', Array)
#8 /home/.sites/24/site1275/web/wire/core/Pages.php(320): Pages->find('0:7232549db11.s...', Array)
 

I dont know if the error exist only after the last upgrade or if it occured earlier.

What does this error message means? Does anyone have the same problem?

Best regards

Link to comment
Share on other sites

  • 2 months later...

I have had this too and it is also reported on Github. The error comes from other third party admin modules that try to fetch the id of the currently edited page in admin. The error is raised because those third party modules blindly assume the id is an integer value and passes it unsanitized, for example, via $pages->get($input->get->id). That will raise those errors. Very hard to debug and detect is such a unsanitized selector request when it is called in a autoloaded modules ready event! :)

I have submitted a patch / pull request for that issue on github.

PS: Devs of third party modules that need to fetch the currently edited page can do it at least like:

$p = $pages->get('id=' . $input->get->id);

// but better validate the id before using:
if(!is_int($input->get->id) && !is_numeric($input->get->id)) return false;

// or only using is_int() ??
if(is_int($input->get->id)) {
    $p = $pages->get('id=' . $input->get->id);

 .

PPS: I have to admit that I had done it wrong too in some of my custom modules. :ph34r: 

  • Like 6
Link to comment
Share on other sites

  • 1 month later...

Just following up on this - for my future benefit as much as anyone else's :)

This option from Ryan is a better approach and should work in all situations.

$process = $this->wire('process');

if($process instanceof WirePageEditor) {
    // tell us that user is currently in: ProcessPageEdit, ProcessPageAdd, ProcessPageListerPro,
    // or anything else that bills itself as able to edit pages and implementing getPage() method.

    $page = $process->getPage(); 
    // $page is now the page that is being edited
}
  • Like 1
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...