Bug #69983 [Ver->Csd]: get_browser fails with user agent of null

From: Date: Sat, 04 Jul 2015 03:10:05 +0000
Subject: Bug #69983 [Ver->Csd]: get_browser fails with user agent of null
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-194115@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69983&edit=1

 ID:                 69983
 Updated by:         laruence@php.net
 Reported by:        php7testing at prodpartners dot com
 Summary:            get_browser fails with user agent of null
-Status:             Verified
+Status:             Closed
 Type:               Bug
 Package:            Unknown/Other Function
 Operating System:   *
 PHP Version:        7.0.0alpha2
 Assigned To:        Kalle
 Block user comment: N
 Private report:     N

 New Comment:

Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=550bbf8f4614a5c868010195f562be3e9ee6bb00
Log: Fixed bug #69983 (get_browser fails with user agent of null)


Previous Comments:
------------------------------------------------------------------------
[2015-07-03 23:59:03] cmb@php.net

Thanks for having a look, Kalle. Frankly, I can't tell, what's the
correct solution. This goes too deep into the innards of the
engine, and is well beyond my (current) comprehension. The
relevant commit is da7d94c[1], and indeed that suggests that the
|| should be a &&, and with this change the test script also
succeeds.

> I cannot properly test since I only got CLI

The attached phpt runs with the built-in webserver, and is
supposed to pass with PHP 5.6.x, but to fail for master.

> (Assigned it to you, to notice this comment)

Generally a good idea, as the bug tracker doesn't send mails to
all involved parties automatically (maybe something that could be
improved). However, I have explicitly subscribed to this ticket,
and I'll try to follow the discussion anyway. :)

[1] <https://github.com/php/php-src/commit/da7d94cd73a1f654bf49b16b5d1bf221255710de>

------------------------------------------------------------------------
[2015-07-03 22:50:59] kalle@php.net

Christoph, I think its the conditional that is wrong, instead of || after the zend_is_auto_global()
call, use &&, like other places where the same code is used seems right, but so far I cannot
properly test since I only got CLI available.

(Assigned it to you, to notice this comment)

------------------------------------------------------------------------
[2015-07-03 18:42:25] cmb@php.net

The following patch has been added/updated:

Patch Name: bug69983.phpt
Revision:   1435948945
URL:        https://bugs.php.net/patch-display.php?bug=69983&patch=bug69983.phpt&revision=1435948945

------------------------------------------------------------------------
[2015-07-03 17:29:41] cmb@php.net

There seems to be a logic error in the detection of the user
agent[1]. zend_is_auto_global_str(ZEND_STRL("_SERVER"))) yields 1,
and so the error is triggered.

Is it supposed to be
!zend_is_auto_global_str(ZEND_STRL("_SERVER")))?

@laruence: Can you please have a look at the issue?

[1] <http://lxr.php.net/xref/PHP_TRUNK/ext/standard/browscap.c#465>

------------------------------------------------------------------------
[2015-07-03 16:41:24] cmb@php.net

I can confirm this issue for PHP 7.0.0-alpha2 with the CLI server
on Windows. Works fine with PHP 5.6.10, though. I'll do some
debugging.

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=69983


--
Edit this bug report at https://bugs.php.net/bug.php?id=69983&edit=1


Thread (12 messages)

« previous php.bugs (#194115) next »