php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42793 php function get_meta_tags()
Submitted: 2007-09-28 20:58 UTC Modified: 2007-09-29 02:45 UTC
From: webmaster at adriaportal dot com Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 5.2.4 OS: Windows NT 5.2 build 3790
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: webmaster at adriaportal dot com
New email:
PHP Version: OS:

 

 [2007-09-28 20:58 UTC] webmaster at adriaportal dot com
Description:
------------
Hello,

here is a piece of index.php of my site ("www.adriaportal.com" / "www.adriaportal.eu"), between opening and closing tag of head.

<head>
 <meta http-equiv="Content-Language" content="cs">
 <meta http-equiv="Content-Type" content="text/html; charset=windows-1250">
 <title>Adria portal</title>
 <meta name="description" content="Promotion of tourism and introduction to the culture of Czech and Croatian people." lang="en-US">
 <meta name="description" content="Podpora rozvoje turizmu a vz?jemn? pozn?v?n? kultur Chorvat? a ?ech?." lang="cs-CZ">
 <meta name="description" content="Podr?ka razvoja turizma i uzajamnog upoznavanja kultura ?eha i Hrvata." lang="hr-HR">
 <meta name="keywords" content="czech,republic,croatia,holiday,sea,adritic,links,portal,accomodation,connections,directory,dictionary,news" lang="en-US">
 <meta name="keywords" content="?echy,?esk?,republika,chorvatsk?,chorvatsko,dovolen?,mo?e,jadran,odkazy,port?l,ubytov?n?,spojen?,adres??,slovn?k,novinky" lang="cs-CZ">
 <meta name="keywords" content="?e?ka,republika,hrvatska,odmor,more,jadran,linkovi,portal,smje?taj,veze,adresao,rije?nik,vijesti" lang="hr-HR">
</head>

I'm test the function on my site index page.

Reproduce code:
---------------
Here is my code of testing:

$myArr = get_meta_tags("http://www.adriaportal.com/");

print_r($myArr);


Expected result:
----------------
Expected is:

Array ( 
 [http-equiv][0]  => "Content-Language" content="cs",
 [http-equiv][1]  => "Content-Type" content="text/html; charset=windows-1250",
 [description][0] => Promotion of tourism and introduction to the culture of Czech and Croatian people.,
 [description][1] => Podpora rozvoje turizmu a vz?jemn? pozn?v?n? kultur Chorvat? a ?ech?.,
 [description][2] => Podr?ka razvoja turizma i uzajamnog upoznavanja kultura ?eha i Hrvata., 
 [keywords][0]    => czech,republic,croatia,holiday,sea,adritic,links,portal,accomodation,connections,directory,dictionary,news, 
 [keywords][1]    => ?echy,?esk?,republika,chorvatsk?,chorvatsko,dovolen?,mo?e,jadran,odkazy,port?l,ubytov?n?,spojen?,adres??,slovn?k,novinky,
 [keywords][2]    => ?e?ka,republika,hrvatska,odmor,more,jadran,linkovi,portal,smje?taj,veze,adresao,rije?nik,vijesti, 
)

or better array structure with all attributes of adequate meta tag


Actual result:
--------------
And the result:

Array ( 
 [description] => Podr?ka razvoja turizma i uzajamnog upoznavanja kultura ?eha i Hrvata. 
 [keywords] => ?e?ka,republika,hrvatska,odmor,more,jadran,linkovi,portal,smje?taj,veze,adresao,rije?nik,vijesti 
)

I'm cannot see in result these tags:

<meta http-equiv="Content-Language" content="cs">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1250">

and i'm see only

the description and keywords meta tags, all the last rows in header, here in croatian language (owerrides the before parsed rows?).

Is this a BUG or i'm make something false?

Thank's for your response ;o)

Djordje Zurovac

P.S. Sorry for my english (?), i'm can active only czech, croatian and german languages. 


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-09-29 02:45 UTC] jani@php.net
From the manual page: http://php.net/get_meta_tags you can find this:

"The value of the name property becomes the key, the value of the content property becomes the value of the returned array, so you can easily use standard array functions to traverse it or access single values. Special characters in the value of the name property are substituted with '_', the rest is converted to lower case. If two meta tags have the same name, only the last one is returned."

So there is no bug here.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 07 09:01:33 2025 UTC