Problem testing JString

17 views
Skip to first unread message

Paladin

unread,
Nov 7, 2009, 12:00:47 PM11/7/09
to Joomla! Framework Development
I can't seem to write tests for the JString class at all. Whatever I
try I get:

Fatal error: Call to undefined function mb_strpos()

Seems like multi-byte support is having trouble here. Is this
something that has to go through the apache .so module? Any ideas what
to do to get around this, or do I have to recompile my copy of php?

Niels Braczek

unread,
Nov 7, 2009, 1:10:25 PM11/7/09
to joomla-dev...@googlegroups.com
Paladin schrieb:

I think, you've found a bug...

As the multibyte extension is not provided with all PHP installations,
it should have a fallback. This should be in
joomla.utilities.compat.compat, which should define required, but not
existing functions, like

if ( !function_exists( 'mb_strpos' ) ) {
function mb_strpos(...)
{
...
}
}

and be called once during system initialization.

Regards,
Niels

--
| http://www.kolleg.de · Das Portal der Kollegs in Deutschland |
| http://www.bsds.de · BSDS Braczek Software- und DatenSysteme |
| Webdesign · Webhosting · e-Commerce · Joomla! Content Management |
------------------------------------------------------------------

Paladin

unread,
Nov 9, 2009, 8:46:20 AM11/9/09
to Joomla! Framework Development


On Nov 7, 12:10 pm, Niels Braczek <nbrac...@bsds.de> wrote:
> I think, you've found a bug...
>
> As the multibyte extension is not provided with all PHP installations,
> it should have a fallback.

Agree, but in any case, since I don't currently have mb support in my
testing environment, I'm going to have to leave off testing this
class. Either someone else will have to do this bit of testing, or
it's going to have to wait until I feel like updating/changing my php
installation (which in my current mood will be a cold day in hell, but
in all likelihood will probably occur long before that time, but even
so not until long after I've finished ripping linux out of my desktop
machine -- a Shuttle XPC, unlike my main workstation which is a
MacBook -- and installing BSD instead; I've had it with Ubuntu
breaking my network every time it upgrades, but that's another story).

Ian MacLennan

unread,
Nov 9, 2009, 9:27:43 AM11/9/09
to joomla-dev...@googlegroups.com
I wonder if we need to resurrect the JString class from Joomla 1.5, which had a library that provided this functionality for installs that didn't have the extension.  It seems like we assumed it was always present for PHP 5.2+ and that now seems to not be the case.

Ian

Paladin

unread,
Nov 9, 2009, 10:11:09 AM11/9/09
to Joomla! Framework Development


On Nov 9, 8:27 am, Ian MacLennan <ian.maclen...@joomla.org> wrote:
> I wonder if we need to resurrect the JString class from Joomla 1.5, which
> had a library that provided this functionality for installs that didn't have
> the extension.  It seems like we assumed it was always present for PHP 5.2+
> and that now seems to not be the case.

I could easily be in the minority. I built the php on my system from
source. Don't think I specifically intended not to include mb support,
but obviously it never got included.

Ian MacLennan

unread,
Nov 9, 2009, 10:17:08 AM11/9/09
to joomla-dev...@googlegroups.com
No, according to http://ca.php.net/manual/en/mbstring.installation.php

> mbstring is a non-default extension.

Since a. it is non-standard and b. we more or less have the code already, I would suggest that we revert it.  I feel like I must be crazy though - I wasn't involved in the change but I'm sure that at some point out of curiosity I checked that and it seemed to be one of those things that wasn't needed for PHP 5.2+.  I thought I had written some crude unit tests for it as well (when I was just learning about UT).

Ian

Paladin

unread,
Nov 9, 2009, 10:34:51 AM11/9/09
to Joomla! Framework Development


On Nov 9, 9:17 am, Ian MacLennan <ian.maclen...@joomla.org> wrote:
> No, according tohttp://ca.php.net/manual/en/mbstring.installation.php
>
> *> mbstring* is a non-default extension.

Is there a difference between php from the commandline and php from an
apache .so? Maybe it's the default for php_mod, but not from the
command-line?

Ian MacLennan

unread,
Nov 9, 2009, 10:49:31 AM11/9/09
to joomla-dev...@googlegroups.com
My understanding is that it is a PHP extension.  As a result, it wouldn't make a difference.  I think you've just picked up on something we've missed.

Ian

Ed Stafford

unread,
Nov 9, 2009, 11:14:07 AM11/9/09
to joomla-dev...@googlegroups.com

Yes and no. It depends on the setup of your system. php uses a
config file 'php.ini'. Some distro's have a different init file for
CLI vs Web. Opensuse used to do this (not sure if 11.x does still).
The .ini can load/not-load modules, including mb_string, which you
could probably just build the single module and put it in the .ini
file to load.

--
Ed Stafford

Ian MacLennan

unread,
Nov 9, 2009, 11:25:02 AM11/9/09
to joomla-dev...@googlegroups.com
Well, fair enough.  Anyway, the end of the day, we can't guarantee that it is available in all installations, so I would argue for keeping the emulation layer.

Ian

Paladin

unread,
Nov 9, 2009, 12:01:01 PM11/9/09
to Joomla! Framework Development


On Nov 9, 10:25 am, Ian MacLennan <ian.maclen...@joomla.org> wrote:
> Well, fair enough.  Anyway, the end of the day, we can't guarantee that it
> is available in all installations, so I would argue for keeping the
> emulation layer.

As long as mb_string support is optional, I'd say that would be a good
idea. Either that or note in the Jommla requirements that mb support
is required and check for it during the install.

Andrew Eddie

unread,
Nov 9, 2009, 9:49:05 PM11/9/09
to joomla-dev...@googlegroups.com
I'm seeing a lot of reports of this error at install time from the
Alpha 2. I think it's safe to say we can't rely on mbstring to be
there by default so as you suggest, we need to keep/put back the
emulation layer. Like Ian though, I'm shaking my head because I'm
sure we checked this before.

Regards,
Andrew Eddie
http://www.theartofjoomla.com - the art of becoming a Joomla developer




2009/11/10 Paladin <arlen....@gmail.com>:

Ed Stafford

unread,
Nov 10, 2009, 10:29:02 AM11/10/09
to joomla-dev...@googlegroups.com
On Mon, Nov 9, 2009 at 8:49 PM, Andrew Eddie <mamb...@gmail.com> wrote:
>
> I'm seeing a lot of reports of this error at install time from the
> Alpha 2.  I think it's safe to say we can't rely on mbstring to be
> there by default so as you suggest, we need to keep/put back the
> emulation layer.  Like Ian though, I'm shaking my head because I'm
> sure we checked this before.

Heck, it could be something that the PHP Devs were originally going to
do and ended up not implementing in 5.3. Usually when I've seen cases
like this, it's because there was some truth prior, but the change was
missed.

--
Ed Stafford

Reply all
Reply to author
Forward
0 new messages