# Running mhash tests

- Thread: https://externals.io/message/55443
- Original archive: https://news-web.php.net/php.internals/55443
- Started by Alexey Shein on 2011-09-14T19:58:22+00:00
- Messages: 6
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #55443 — Alexey Shein — 2011-09-14T19:58:22+00:00

URL: https://externals.io/message/55443#55443

Hello, I tried to run skipped mhash tests in ext/hash, these ones in trunk:
SKIP mhash() test [ext/hash/tests/mhash_001.phpt] reason: mhash
extension is not available
SKIP mhash_get_block_size() & mhash_get_hash_name() test
[ext/hash/tests/mhash_002.phpt] reason: mhash extension is not
available
SKIP mhash_keygen_s2k() test [ext/hash/tests/mhash_003.phpt] reason:
mhash extension is not available
SKIP mhash() modifying algorithm parameter
[ext/hash/tests/mhash_004.phpt] reason: mhash extension is not
available

My configure line:
'./configure' '--with-bz2' '--enable-bcmath'
'--with-apxs2=/usr/bin/apxs2' '--with-gd' '--enable-calendar'
'--enable-gd-native-ttf' '--with-freetype-dir' '--with-jpeg-dir'
'--with-png-dir' '--enable-exif' '--with-mysql' '--with-zlib'
'--with-gettext' '--with-mcrypt' '--with-ldap' '--with-iconv'
'--enable-sockets' '--with-openssl' '--with-imap' '--with-imap-ssl'
'--with-kerberos' '--with-pspell' '--with-pdo-mysql'
'--with-pdo-sqlite' '--enable-soap' '--enable-xmlreader' '--with-xsl'
'--enable-ftp' '--enable-cgi' '--with-curl' '--with-tidy'
'--with-xmlrpc' '--enable-mbstring' '--enable-sysvsem'
'--enable-sysvshm' '--enable-sysvmsg' '--enable-shmop'
'--with-readline' '--with-mysqli' '--enable-zip' '--enable-wddx'
'--enable-pdo' '--with-pdo-firebird' '--with-interbase'
'--with-enchant' '--enable-intl' '--with-mhash'

So, as you see, I actually have --with-mhash in the end and don't have
--disable-hash, so usual hash tests pass correctly.
From the docs (http://www.php.net/manual/en/mhash.installation.php)
I've found out that mhash is now emulated by hash extension and is
actually obsoleted.

Should we delete these tests (and, maybe deprecate/move to pecl the
extension itself)?
If not, I'd like to know how to run these tests.

Thank you.

-- 
Regards,
Shein Alexey

---

## #55444 — Pierre Joye — 2011-09-14T20:26:14+00:00

URL: https://externals.io/message/55443#55444 · In reply to: #55443

hi,



> Should we delete these tests (and, maybe deprecate/move to pecl the
> extension itself)?

I don't think we should, they are here to make sure that the emulation
layer works fine.

> If not, I'd like to know how to run these tests.

Maybe the skipif is wrong, as far as I remember there was an issue
with seeing the "mhash" layer as being the mhash extension. Maybe we
should change the skipif and uses function_exists instead? Have you
tried it?



-- 
Pierre

@pierrejoye | http://blog.thepimp.net | http://www.libgd.org

---

## #55445 — Scott MacVicar — 2011-09-14T20:41:42+00:00

URL: https://externals.io/message/55443#55445 · In reply to: #55444

> hi,
> 
> 
> 
> > […]
> 
> I don't think we should, they are here to make sure that the emulation
> layer works fine.
> 
> > […]
> 
> Maybe the skipif is wrong, as far as I remember there was an issue
> with seeing the "mhash" layer as being the mhash extension. Maybe we
> should change the skipif and uses function_exists instead? Have you
> tried it?

It definitely should have a 'mhash' entry, it creates a mhash_module_entry and registers that.

If you enable mash only, it silently enables hash.

- Scott

---

## #55446 — Alexey Shein — 2011-09-14T20:46:21+00:00

URL: https://externals.io/message/55443#55446 · In reply to: #55444

2011/9/15 Pierre Joye <pierre.php@gmail.com>:
> hi,
>
> 
>
> > […]
>
> I don't think we should, they are here to make sure that the emulation
> layer works fine.
>
> > […]
>
> Maybe the skipif is wrong, as far as I remember there was an issue
> with seeing the "mhash" layer as being the mhash extension. Maybe we
> should change the skipif and uses function_exists instead? Have you
> tried it?
>

They both return false for me:
conf@laptop ~/php-src/trunk $ sapi/cli/php -r
'var_dump(extension_loaded("mhash"), function_exists("mhash"));'
bool(false)
bool(false)
conf@laptop ~/php-src/trunk $

>
> --
> Pierre
>
> @pierrejoye | http://blog.thepimp.net | http://www.libgd.org
>



-- 
Regards,
Shein Alexey

---

## #55447 — Scott MacVicar — 2011-09-14T21:01:12+00:00

URL: https://externals.io/message/55443#55447 · In reply to: #55446

> 2011/9/15 Pierre Joye <pierre.php@gmail.com>:
> > […]
> 
> They both return false for me:
> conf@laptop ~/php-src/trunk $ sapi/cli/php -r
> 'var_dump(extension_loaded("mhash"), function_exists("mhash"));'
> bool(false)
> bool(false)
> conf@laptop ~/php-src/trunk $

Definitely works for me on latest trunk. Does a shorter configure fix this? I wonder if something elsewhere is breaking this.

macvicar-mba:trunk macvicar$ cat config.nice 
#! /bin/sh
#
# Created by configure

'./configure' \
'--disable-all' \
'--with-mhash' \
"$@"

macvicar-mba:trunk macvicar$ sapi/cli/php -m
[PHP Modules]
Core
date
ereg
hash
mhash
pcre
Reflection
SPL
standard

[Zend Modules]

macvicar-mba:trunk macvicar$ sapi/cli/php -r 'var_dump(extension_loaded("mhash"));'
bool(true)

---

## #55456 — Alexey Shein — 2011-09-15T17:22:27+00:00

URL: https://externals.io/message/55443#55456 · In reply to: #55447

It's very strange but after 5-6 recompiles with different
configurations (I tried to reduce "breaking" setup) my current
configuration started to work itself.

Thanks everybody for help.

2011/9/15 Scott MacVicar <scott@macvicar.net>:
>
> 
>
> > […]
>
> Definitely works for me on latest trunk. Does a shorter configure fix this? I wonder if something elsewhere is breaking this.
>
> macvicar-mba:trunk macvicar$ cat config.nice
> #! /bin/sh
> #
> # Created by configure
>
> './configure' \
> '--disable-all' \
> '--with-mhash' \
> "$@"
>
> macvicar-mba:trunk macvicar$ sapi/cli/php -m
> [PHP Modules]
> Core
> date
> ereg
> hash
> mhash
> pcre
> Reflection
> SPL
> standard
>
> [Zend Modules]
>
> macvicar-mba:trunk macvicar$ sapi/cli/php -r 'var_dump(extension_loaded("mhash"));'
> bool(true)



-- 
Regards,
Shein Alexey
