php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76574 use of undeclared identifiers INT_MAX and LONG_MAX
Submitted: 2018-07-03 18:56 UTC Modified: 2018-07-10 06:22 UTC
From: php-bugs-2018 at ryandesign dot com Assigned: cmb (profile)
Status: Closed Package: mbstring related
PHP Version: 7.3.0alpha2 OS: macOS 10.12.6
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
34 - 29 = ?
Subscribe to this entry?

 
 [2018-07-03 18:56 UTC] php-bugs-2018 at ryandesign dot com
Description:
------------
ext/mbstring/oniguruma/src/regparse.c:206:11: error: use of undeclared identifier 'INT_MAX'
  if (x < INT_MAX / y)
          ^
ext/mbstring/oniguruma/src/regparse.c:6760:49: error: use of undeclared identifier 'LONG_MAX'
            r = parse_long(enc, buf, bufend, 1, LONG_MAX, &rl);
                                                ^
2 errors generated.
make: *** [oniguruma/src/regparse.lo] Error 1



Patches

fix-76574 (last revision 2018-07-08 18:37 UTC by cmb@php.net)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-07-04 05:24 UTC] php-bugs-2018 at ryandesign dot com
I do not see the problem when I build oniguruma 6.7.1 by itself outside of PHP.

It looks like one needs to #include <limits.h> in order to get the definitions of INT_MAX and LONG_MAX. The oniguruma source code does do that, but only if its configure script determined that the header exists; it sets HAVE_LIMITS_H when that's the case. It doesn't look like PHP runs oniguruma's configure script, so it's not set.

I am able to build successfully by adding "-DHAVE_LIMITS_H=1" to CFLAGS, but of course I shouldn't have to do that.
 [2018-07-04 09:59 UTC] dc dot link at yahoo dot fr
Odd, because normally limits.h is checked in the configure step.
 [2018-07-04 13:48 UTC] ab@php.net
-Status: Open +Status: Feedback
 [2018-07-04 13:48 UTC] ab@php.net
Thanks for the report. What are the configure flags? Especially, is --disable-mbregex used?

Thanks.
 [2018-07-05 04:52 UTC] php-bugs-2018 at ryandesign dot com
-Status: Feedback +Status: Open
 [2018-07-05 04:52 UTC] php-bugs-2018 at ryandesign dot com
I'm building mbstring as a separate extension, using MacPorts. (I'm the MacPorts maintainer of PHP.) The only configure flags are:

--prefix=/opt/local --with-php-config=/opt/local/bin/php-config72

The configure output doesn't mention limits.
 [2018-07-05 06:24 UTC] ab@php.net
-Status: Open +Status: Feedback
 [2018-07-05 06:24 UTC] ab@php.net
Ah, that explains it. Extensions in the core are usually not prepared for phpize usage. In this particular case, the config expects an in core path, so it can create conifig.h dynamically. Anything prevents to compile shared in the core?

Thanks.
 [2018-07-05 06:26 UTC] php-bugs-2018 at ryandesign dot com
-Status: Feedback +Status: Open
 [2018-07-05 06:26 UTC] php-bugs-2018 at ryandesign dot com
Extensions in core have worked fine with phpize until now. I'm not sure what further feedback you're asking me to provide...
 [2018-07-05 06:37 UTC] ab@php.net
Nope, by luck they could have worked, but otherwise there are cases where it depends on the exact paths. In general, it is better to compile in core. 

Especially it's to see you use 7.2 config but the ticket tells mbstring is from 7.3. The compatibility is not guaranteed. Otherwise, it looks like configure doesn't create config.h for oniguruma or it is wrong in some way, but under this constellation i'm not sure which config is used at all. Please be sure you at least use php-config for 7.3 in first place, oniguruma/src/config.h is created after the configure and include paths point to the correct location.

Thanks.
 [2018-07-05 06:40 UTC] php-bugs-2018 at ryandesign dot com
Yes, I am using php-config73; apologies for the above typo.
 [2018-07-08 18:37 UTC] cmb@php.net
The following patch has been added/updated:

Patch Name: fix-76574
Revision:   1531075063
URL:        https://bugs.php.net/patch-display.php?bug=76574&patch=fix-76574&revision=1531075063
 [2018-07-08 18:38 UTC] cmb@php.net
-Status: Open +Status: Verified
 [2018-07-08 18:38 UTC] cmb@php.net
Sorry, my mistake!  When updating the bundled Oniguruma to
6.7.1[1], I've overlooked that it requires limits.h as of
Oniguruma 6.4.0.

The attached patch should resolve the build failure.

[1] <https://github.com/php/php-src/commit/d48b233991c6ae916ca2b7e8d7c965fbc7eb00b7>
[2] <https://github.com/kkos/oniguruma/commit/f6db0dde64e4b6a806e52f45307459d433803094>
 [2018-07-08 18:38 UTC] cmb@php.net
-Assigned To: +Assigned To: cmb
 [2018-07-10 06:22 UTC] php-bugs-2018 at ryandesign dot com
Thanks, that patch works for me.
 [2018-07-10 12:28 UTC] cmb@php.net
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=271ae3eb2b142b3ecabe01ebdcc2d29acdd9bc1a
Log: Fix #76574: use of undeclared identifiers INT_MAX and LONG_MAX
 [2018-07-10 12:28 UTC] cmb@php.net
-Status: Verified +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 21:01:28 2024 UTC