Bug #69983 [Fbk->Opn]: get_browser fails on 7.0 with user agent of null works on 5.6.8

From: Date: Fri, 03 Jul 2015 11:46:26 +0000
Subject: Bug #69983 [Fbk->Opn]: get_browser fails on 7.0 with user agent of null works on 5.6.8
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-194098@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
 User updated by:    php7testing at prodpartners dot com
 Reported by:        php7testing at prodpartners dot com
 Summary:            get_browser fails on 7.0 with user agent of null
                     works on 5.6.8
-Status:             Feedback
+Status:             Open
 Type:               Bug
 Package:            *General Issues
 Operating System:   Centos 7
 PHP Version:        7.0.0alpha2
 Block user comment: N
 Private report:     N

 New Comment:

Using the code snippet in this report:

With 5.6.8 I do not get a warning and I get the following output from print_r:

Array ( [browser_name_regex] => ~^mozilla/5\.0 \(.*windows nt 6\.1.*\) gecko.* firefox/38\.0.*$~
[browser_name_pattern] => Mozilla/5.0 (*Windows NT 6.1*) Gecko* Firefox/38.0* [parent] =>
Firefox 38.0 [platform] => Win7 [comment] => Firefox 38.0 [browser] => Firefox [version]
=> 38.0 [device_type] => Desktop [ismobiledevice] => [istablet] => ) 

With 7.0 Alpha 2 I get the warning listed in this bug report and I do not get any output from
print_r.

The tests are run on the same machine.  To change versions I stop php-fpm, run make install for the
version that I want, and then start php-fpm.


Previous Comments:
------------------------------------------------------------------------
[2015-07-03 02:59:07] laruence@php.net

$ /home/huixinchen/local/php56/bin/php -dbrowscap=/tmp/browscap.ini /tmp/1.php

Warning: get_browser(): HTTP_USER_AGENT variable is not set, cannot determine user agent name in
/tmp/1.php on line 2

I get same warning in 5.6, did I misunderstand you?

------------------------------------------------------------------------
[2015-07-02 21:11:38] php7testing at prodpartners dot com

Description:
------------
get browser issues a warning on 7.0 alpha 2 when user-agent string is null - works fine on 5.6.8.

get_browser works with user-agent string of $_SERVER['HTTP_USER_AGENT']

Warning: get_browser(): HTTP_USER_AGENT variable is not set, cannot determine user agent name in
/usr/local/apache2/htdocs/php7testing/browscap_test.php on line 2


Test script:
---------------
<?php
	$browser=get_browser(NULL, true);
	print_r($browser);
?>



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



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


Thread (12 messages)

« previous php.bugs (#194098) next »