BibTex importing not working

28 views
Skip to first unread message

M. A.

unread,
Dec 14, 2018, 5:48:42 PM12/14/18
to J!Research Support
Is anyone else having problems importing bibtex files since upgrading to Joomla 3.9 and using php 7+?

This is the error I receive 

Call to undefined function split() 

I found that function split() was deprecated in php 7 and discovered  ./administrator/components/com_jresearch/includes/BibTex.php used split and replaced it as follows, but that didn't solve the problem. The error went away, but bibtex files aren't importing.


421c421
<             $arr = split('\{', $entry);
---
>             $arr = preg_split('\{', $entry);
630c630
<         $authorarray = split(' and ', $entry);
---
>         $authorarray = preg_split(' and ', $entry);
642c642
<                 $tmparray = split(' |~', $author);
---
>                 $tmparray = preg_split(' |~', $author);

Any suggestions? I can't give you access to my development server because I'm behind a corporate firewall.

thanks!

M. A.

unread,
Dec 17, 2018, 6:23:51 PM12/17/18
to J!Research Support
I have edited administrator/components/com_jresearch/includes/BibTEx.php

diff BibTex.php-orig BibTex.php
421c421
<             $arr = split('\{', $entry);
---
>             $arr = preg_split('~\{~', $entry);
630,631c630,631
<         $authorarray = split(' and ', $entry);
<         for ($i = 0; $i < sizeof($authorarray); $i++) {
---
>         $authorarray = preg_split('~and~', $entry);
>         for ($i = 0; $i < is_array($authorarray); $i++) {
642,643c642,643
<                 $tmparray = split(' |~', $author);
<                 $size     = sizeof($tmparray);
---
>                 $tmparray = preg_split('~|~', $author);
>                 $size     = is_array($tmparray);

And now, I get this error 
Argument 1 passed to JResearchMember::bindFromArray() must be of the type array, string given, called in administrator/components/com_jresearch/helpers/importers/bibtex.php on line 57 

I think this is using the function from administrator/components/com_jresearch/tables/member.php, but I can't figure out what I need to tweak for it to behave.

Luis Galárraga

unread,
Jan 12, 2019, 10:46:02 AM1/12/19
to jresearc...@googlegroups.com
Hi,

Sorry for the late reply. The aforementioned line looks like this:

    if($member->bindFromArray(JResearchPublicationsHelper::bibCharsToUtf8FromArray($auth)))

This means that JResearchPublicationsHelper::bibCharsToUtf8FromArray is not returning an array, but a string. May I have a look at the file you are importing? It seems an encoding problem to me.

Best,
Luis

--
You received this message because you are subscribed to the Google Groups "J!Research Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jresearch-supp...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

M. A. Ladd

unread,
Jan 15, 2019, 6:54:29 PM1/15/19
to jresearc...@googlegroups.com
Attached are a couple of my bibtex files. I moved php BACK to 5.6 (I'm on a private Plesk server) and everything uploads properly.
2018-3-27.bib
2018-12-19.bib

M. A.

unread,
Jan 23, 2019, 2:59:04 PM1/23/19
to J!Research Support
Did you find any problems with the bibtex files? 


On Tuesday, January 15, 2019 at 6:54:29 PM UTC-5, M. A. wrote:
Attached are a couple of my bibtex files. I moved php BACK to 5.6 (I'm on a private Plesk server) and everything uploads properly.

On Sat, Jan 12, 2019 at 10:46 AM Luis Galárraga < wrote:
Hi,

Sorry for the late reply. The aforementioned line looks like this:

    if($member->bindFromArray(JResearchPublicationsHelper::bibCharsToUtf8FromArray($auth)))

This means that JResearchPublicationsHelper::bibCharsToUtf8FromArray is not returning an array, but a string. May I have a look at the file you are importing? It seems an encoding problem to me.

Best,
Luis

To unsubscribe from this group and stop receiving emails from it, send an email to jresearch-support+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "J!Research Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jresearch-support+unsubscribe@googlegroups.com.

M. A.

unread,
Jan 23, 2019, 4:27:00 PM1/23/19
to J!Research Support
I think I mentioned these bibtex files upload fine w/ php5.6 and JResearch 3.1

M. A.

unread,
Jan 23, 2019, 6:37:37 PM1/23/19
to J!Research Support
In administrator/components/com_jresearch/includes/BibTEx.php, I replaced split w/ explode, and it almost worked. The @article{citekey munged together in the database and it only uploaded one publication in the two publication file. I suspect the arguments to the explode function need something different. Since split was removed in php7, one of the alternatives is needed. http://php.net/manual/en/function.split.php

M. A.

unread,
Feb 5, 2019, 3:37:28 PM2/5/19
to J!Research Support
Any chance you have had time to work on this?

M. A.

unread,
Feb 27, 2019, 4:29:00 PM2/27/19
to J!Research Support
I see that the person who created bibtex.php isn't updating it anymore. Any chance this could be a replacement? https://github.com/renanbr/bibtex-parser#usage
Reply all
Reply to author
Forward
0 new messages