Search

I've just encountered a weird error with a simple section containing 2 fields on a 2.2.5 install:

preg_match(): Delimiter must not be alphanumeric or backslash
/var/www/domain/symphony/lib/toolkit/class.general.php line 64

59          if(!is_array($rule)) $rule = array($rule);
60          if(!is_array($string)) $string = array($string);
61
62          foreach($rule as $r){
63              foreach($string as $s){
64                  if(!preg_match($r, $s)) return false;
65              }
66          }
67          return true;
68      }

Could someone point me in the direction of what could be causing this?

2 Fields Text input for title and a Text input with Validation set to URI and a checkbox for publishing.

I've tried changing the section, deleting it completely and adding it again, but still get the same issue. :(

Anyone?

The URI regex is wrong by the looks of it as preg_match cannot correctly escape it.

Can you post it here?

Regex in the input field is:

/^[^s:/?#]+:(?:/{2,3})?[^s./?#]+(?:.[^s./?#]+)*(?:/[^s?#]*??[^s?#]*(#[^s#]*)?)?$/

Weirdly if I remove the regex pattern I still get a fatal error thrown with the same report.

That is weird then, can you log it on github Andrew? Cheers. Just reference this post.

Simply, the regex is incorrect, where did you get it from? It looks similar to the default Symphony URL validator, but it's missing all the escape characters for the backslashes.

See this pastie.org

Ah, but pasting into the forum removes them unless you double escape. I think that's what's happened there. As Andrew says, the error occurs even without a regex.

This is a default 2.2.5 pulled from git a while back. Has there been any bugs that addressed this prior to 2.3 focus that I may be missing?

See grab from my 2.2.5 install regex which I believe is correct.

Attachments:
Screen Shot 2012-08-17 at 09.06.09.png

I noticed in your issue that you said the error occurs with or without the URI regex, can you confirm that?

If you are setting the regex field to be empty, then the error is originating from elsewhere, can you post a screenshot of the full error description?

Hi Brendo, correct, I get the error with and without regex pattern filled in.

Screenshot attached of error when I attempt to create entry.

Attachments:
Screen Shot 2012-08-19 at 22.19.18.png

Is there any whitespace at all in the validator field?

You can verify this by adding var_dump($rule); after line 75 of /symphony/lib/toolkit/fields/field.input.php (the output of that var_dump will be useful to know).

Brendo,

var_dump returns: string(5) "title"

This is the returned result whether there are URI regex patterns in the section field or not.

What other extensions do you have installed in your Section? For some reason the field appears to be saved with "title" as the validation rule.

The section itself has Text input x 2 and a checkbox field and that's it.

I do have a number of extensions installed, but am unsure if they would conflict with such a simple section entry creation.

Is there a debug method I could use to check this action? maybe php_error flags in the htaccess file?

Do you have Custom Field Captions installed?

Nope. I just did a var_dump of $fields and $entry inside the content.publish.php file to see if the values were being carried across and they are all present as expected, so it must be something interfering with the creation of the entry.. as you say an extension of some sort. what PHP file would be best to check output of vars to the result page?

I'll give you a line number when I get home off the tube but somewhere in content. publish.PHP around the actions methods will help. Can you screenshot the extensions page?

Thanks Brendo, no rush. The list of extensions is quite extensive so screenshot maybe not the best approach.

If there is a location in the content.publish.php I can place a var_dump of some sort to check what's triggering under the hood that would be ace.

Line #607, var_dump($fields) will show what is being posted to each field.

Additionally in the Input where you dumped $rule, can you dump just $this->get()?

Perhaps SQL dump of your extensions table would be easier to generate?

This is the dump of $rule and $this->get() from field.input.php

string(5) "title" array(11) { ["required"]=> string(3) "yes" ["show_column"]=> string(3) "yes" ["id"]=> string(3) "111" ["label"]=> string(5) "Title" ["element_name"]=> string(5) "title" ["type"]=> string(5) "input" ["parent_section"]=> string(2) "25" ["sortorder"]=> string(1) "0" ["location"]=> string(4) "main" ["field_id"]=> string(3) "111" ["validator"]=> string(5) "title" } string(11) "Gorilla FTP"

and this is the dump of $fields from content.publish.php

array(3) { ["title"]=> string(11) "Gorilla FTP" ["link"]=> string(31) "http://twitter.com" ["published"]=> string(3) "yes" }

Url changed for privacy so string count won't look right here.

Attached is sql of Extensions table.

Still not 100% what's going on tbh.

Attachments:
sym_extensions.sql

Oh, my, forkin god!

I just looked at the section entry and I'd put title as a validation rule in the title field.

Totally missed it, was so focussed on the regex being wrong I hadn't picked up on the string in the validation of the title field above it.

So sorry to have wasted your time.

all sorted, please add solved to thread.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details