Skip to:
Content

bbPress.org

Opened 7 months ago

Closed 5 weeks ago

Last modified 5 weeks ago

#3257 closed defect (fixed)

Importer issue - PHP Fatal error: Uncaught Error: Cannot pass parameter 1 by reference in bbpress/includes/admin/parser.php:1485

Reported by: webmaigcz Owned by: johnjamesjacoby
Milestone: 2.6 Priority: normal
Severity: normal Version:
Component: API - Importers Keywords:
Cc:

Description

I saw an issue while importing forums from PunBB 1.2.10 into bbPress. This problem exists in bbPress 2.5.15 and 2.6-RC-7.

Because PunBB 1.2.10 importer isn't included with the most recent version of bbPress (2.5.15, 2.6-RC-7), I had to create a custom importer, which seems to be working fine.

However, it always stuck on the same post. I managed to find a workaround, but in order to apply a fix I had to touch the core bbPress file /admin/includes/parser.php - and I'd like to get this issue resolved in bbPress 2.6 if possible.

Here's the topic content I'm trying to import:

Ac merentur natura te vel sem te aut ante lius eorum eum eos Quasi assum te ac platea.
Numero aut tui pede praecipue!

Dicta sunt malevolorum iste nunc morbi Nobis leo'a, A ille reiponde progredi est sequi et qui aliquam at 34€ dis per'i morbi, dis [b]dignus elit ante te hic vero sequi[/b]. 

Et haeres ac natus, rerum quia qui ac a amplissimum dolorem, il eos non'i nobile mi per est studium cum ab odio est nam, me a editur dolorum . (A nam in ex a saepe dominium est - a erat lius nec...)

[img]http://www.example.com/images/screenshots/screenshot.jpg[/img]

[b][1.0 alpha 10][/b]
[b]dicta arcu[/b]
  - gentes zzril amplexum ea est innocentia sem (fames-saemre esse)
  - liber eius patiebatur (SEM) rem eaque (nam domini mi EUM lacus)
[img]http://www.example.com/images/screenshot2.jpg[/img]

[b][1.0 alpha 9][/b
[img]http://www.example.com/images/screenshot3.jpg[/img]
[b]dicta arcu[/b]
  - massa Diam/Commodi typi Rem hac autem te est doming lapidem
  - sed fastus intermedi id est postulatu reddite 
  - cxcusat ultimum

[b][1.0 alpha 8][/b]
[b]dicta arcu[/b]
  - nec illud unde te regibus at dis congressu virlutis.
  - iterum promisti adipiscing te est admiratio
  - pungit eros et nibh in commodo si leo regnandum
  - vero in fuga quo malevolis ad aut zzril modi te quantum ut dui sagittis
  - mus't laesio est consulere & class reddet eius sed suscipit te dis contraxit occulte.
  - mus capere primis facere at leo Assumenda.
  - sed clari fiant sensim te dis quae ruinae
  - nullum eventus si est romanorum
  - saevire antiguo quam te est class lius
  - Regibus quaedam subsequi te dui NON regibus 

[b]recordatione[/b]
  - honorem ante usus id aut sentiebat
  - scomata accusare et augusti (sem http://www.example.com/link)

[img]http://www.example.com/screenshots/screenshot4.jpg[/img]

[b][1.0 alpha 7][/b]
ullam pede
  - per ipsam clari simpliciter te hic porta (cras noctis nec relalioncm)
  - sed iure promisti quas orci eros a typi clari.
  - solidam aliquet ut vel eget troiano metus
  - qui elit rem floret te Cras Quantum pede't sanguine massa
  - dextram partibus enim et Cras Commodi (esse a autem veneni te cumulabat)

[img]http://www.example.com/images/screenshot5.jpg[/img]

[b][1.0 alpha 6][/b]
adlaborabunt
  - illi quae parum reniam
  - proin illum assum quia
zzril quas
  - quos saevire matretn nemo si vinctas magni & Notare Mazim.

[img]http://www.example.com/images/screenshot8.jpg[/img]

[b][2.0]  Earum Angeum Altiora[/b]
hac qui unde bonuni [url=http://www.example.com/test/][b]unde[/b][/url] 


[b]nunc ipsa 306 heldonoriam:[/b]
  - proin cursus aversionem
  - 80 morbi at/est
  - autem/quos/arcu utraque ipsam honorem et vel erat nemo
  - cum continuo certabit vel Praesidium integer invasor: quasi ad domina lorem
  - quo eros arcu : 'duis', 'nemo' ad 'orci tot'
  - benevolentia integro vel tui praesidio periculo (est est vestra nam nibh si tot aliuando).
  - nobis + ipsum omnium te sequi naturom (amet, odio-iste, etiam, pericula, triduo, error)
[img]http://www.example.com/images/screenshot10.jpg[/img]
  - ad quam iuratoria ornare eorum activitatis 
  - deesse vestra quaeque at metenda (hac physim)
  - pede SentiEbat praecedentia
  - risus vincere AB donec ut VulpuTate
  - usus interdum nicolae ut dis reponat/ depenDentias :6,1,3,9,33,49,17,77 urna 
  - Per serpens at dis iure arcu in enim tot est harum ordinem (dis] sem)
  - non verbum purus bonuni contra (porro sem a vacare mi michael dui populum spiritus)
  - nec Arcui Impiorum eos-netus te dui cedant minimum 
  - mus Quae Neglexi nam-ipsum si hic humani nostris
  - minima massam (fronte at amet) physim
  - fastus fiant-rutrum qualitalibus
  - pede miscere Quas Nisl Erat Morbi sensim te leo Tempore
  - quo competens mentes quae spoliare; eum dissimillimas mirum.
  - qui mazim et hic odit at est peccat porta id leo arcu modi est antiquo magni
  - si vel lapidem te Ipsum, est nisl amet habent insignia at himenaeos 
  - porro usus si est culpa est usus tempore excessivos
  - urna viscera nostramm ut qui eorum nemo idiota si leo discursus/proin surdis 
  - vel class est at dominus modo a minus litterarum id partus sit
  - 'tertius' illum/vivitp ut qui Dennuntio Nicolae primam
  - leo obesse assum eum decessu proin nisi (eum 'minus aliquid' innumeros)
  - a mus sequi mus ad certus id metenda jagiellonicus
  - est vestra nuntius rerum modi iuribus mi/aut
  - sed ‘ultimus atque’ personami mi palmam, eodem
  - conubia successore/propter ullo'a si hic est orandum throno
  - vel conclusum sed eorum tot hic eripere mi dis diam in urna quas (qui odio qui urgentis metus); quo similitudines morbi.
  - leo 'quas rutrum' utinam at ultimum te enim cras (leo orci id dolor dubiae unde)
  - Quorum Metus Optio

[b]similitudines nobis[/b]
  - dui rem decipitur avertat/occasione fames leones in hic amplissima nisl magni servire.
  - nonummy at est sed quas congressu te est personami, eos mus vero pede liber dissimillimas cadentes nisi magni subsequi.

This is the error message:

PHP Fatal error:  Uncaught Error: Cannot pass parameter 1 by reference in .../wp-content/plugins/bbpress/includes/admin/parser.php:1485

Stack trace:
  #0 .../wp-content/plugins/bbpress/includes/admin/parser.php(2079): BBCode->Internal_GenerateOutput(0)
  #1 .../wp-content/plugins/bbpress/includes/admin/classes/class-bbp-converter-base.php(1211): BBCode->Parse('Ac merentur nat...')
  #2 .../wp-content/plugins/bbpress/includes/admin/classes/class-bbp-converter-base.php(457): BBP_Converter_Base->callback_html('Ac merentur nat...', Array)
  #3 .../wp-content/plugins/bbpress/includes/admin/classes/class-bbp-converter-base.php(280): BBP_Converter_Base->convert_table('topic', 600)
  #4 .../wp-content/plugins/bbpress/includes/admin/classes/class-bbp-converter.php(634): BBP_Converter_Base->convert_topics(600)
  #5 .../wp-content/plugins/bbpress/includes/a in .../wp-content/plugins/bbpress/includes/admin/parser.php on line 1485, referer: http://example.domain/wp-admin/tools.php?page=bbp-converter

It breaks on this line of code:

$this->Internal_UpdateParamsForMissingEndTag(@$token[BBCODE_STACK_TAG]);

Value of the $token[BBCODE_STACK_TAG] array item for this particular post is:

array (size=7)
  '_tag' => string '[b]' (length=3)
  '_endtag' => string '' (length=0)
  '_name' => string 'b' (length=1)
  '_hasend' => boolean false
  '_end' => boolean false
  '_default' => boolean false
  '_params' => 
    array (size=1)
      0 => 
        array (size=2)
          'key' => string '' (length=0)
          'value' => string '' (length=0)

I resolved the issue by making two changes to the parser.php file.

First, replaced the line 1485:

$this->Internal_UpdateParamsForMissingEndTag(@$token[BBCODE_STACK_TAG]);

with the following code:

@$token[BBCODE_STACK_TAG] = $this->Internal_UpdateParamsForMissingEndTag(@$token[BBCODE_STACK_TAG]);

And then, changed Internal_UpdateParamsForMissingEndTag function definition to this:

function Internal_UpdateParamsForMissingEndTag($params) {
switch ($this->tag_marker) {
case '[': $tail_marker = ']'; break;
case '<': $tail_marker = '>'; break;
case '{': $tail_marker = '}'; break;
case '(': $tail_marker = ')'; break;
default: $tail_marker = $this->tag_marker; break;
}
$params['_endtag'] = $this->tag_marker . '/' . $params['_name'] . $tail_marker;
return $params;
}

Notice that I removed the reference sign & in front of the $params parameter and added return $params at the end of the function definition.

Could you please apply the fix in the core file or provide a different solution?

Thank you.

Change History (3)

#1 @johnjamesjacoby
5 weeks ago

  • Milestone changed from Awaiting Review to 2.6
  • Owner set to johnjamesjacoby
  • Status changed from new to assigned

#2 @johnjamesjacoby
5 weeks ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 6929:

Importer: remove byref usade in parser.php.

This commit removes an old byref in the bbCode parser. It wasn't really necessary, and was causing problems with certain PHP versions.

Fixes #3257. Props webmaigcz.

#3 @johnjamesjacoby
5 weeks ago

Developers note: this was previously masked upstream in the NBBC fork, and will be merged upstream.

See: https://github.com/bbpress/NBBC/commit/3df6cd7f1f786a9496aca0a1c7d0493a1d97ecb0

Note: See TracTickets for help on using tickets.