From:             
Operating system: debian lenny13
PHP version:      Irrelevant
Package:          DOM XML related
Bug Type:         Bug
Bug description:DOMXpath doesn't return everything, when reading certain HTML 
pages

Description:
------------
when using DOMXpath class to get all links (using '//a'), on certain pages
not all links get returned. I ran the script on my local testserver as well
with php version 5.3.5 as well but it didn't work out either. The strange
thing is that on viper-7's codepad the script is running just fine (
http://codepad.viper-7.com/m8IM9b ). He's using libxml version 2.6.26, on
our production server 2.6.32 and on my local machine even 2.7.7.

Test script:
---------------
<?php
$url =
'http://home.immobilienscout24.de/289805/offers/Habitation/listed/Aktualität/0';
//$url =
'http://www.3-eck-immobilien.de/index.php?ziel=Immobilien&target=1&seite=1';

libxml_use_internal_errors(true);
$dom = new DOMDocument/*('1.0', 'iso-8859-1')*/;  //tried to pass the
encoding because when not using libxml_use_internal_errors(true) a warning
is echo'd saying that there was an issue with the encoding of the site but
that didn't help
$dom->loadHTMLFile($url);
$dom->normalizeDocument();
libxml_clear_errors();

$xpath = new DOMXpath($dom);
//$tmpObj = $xpath->query('/html/body//a');
$tmpObj = $xpath->query('//a');

echo "<pre>\n";
foreach($tmpObj as $domnode) {
    echo "url: " .
utf8_decode($domnode->attributes->getNamedItem('href')->nodeValue) . "\n";
    echo "content: " . utf8_decode($domnode->textContent) . "\n";
}
echo "</pre>\n";
?>

Expected result:
----------------
url: /289805
content: » Startseite
url: /289805/content/523612
content: » Schöne Sommerferien
url: /289805/content/488545
content: » Unsere Top-Immobilie des Monats
url: /289805/offers/Habitation/listed/Aktualität/0
content: » Wohnimmobilien
url: /289805/offers/AppartmentRent/listed/Aktualität/0
content:     » Wohnung Miete
url: /289805/offers/AppartmentBuy/listed/Aktualität/0
content:     » Wohnung Kauf
url: /289805/offers/HouseBuy/listed/Aktualität/0
content:     » Haus Kauf
url: /289805/offers/SiteLivingBuy/listed/Aktualität/0
content:     » Wohngrundstücke Kauf
url: /289805/offers/Trade/listed/Aktualität/0
content: » Gewerbeimmobilien
url: /289805/offers/Investment/listed/Aktualität/0
content: » Anlageobjekte
url: /289805/content/16428
content: » Kostenfrei...
url: /289805/content/16431
content: » Aktuelles für Sie
url: /289805/content/16437
content: » Unsere Leistungen
url: /289805/content/487731
content: » Referenzen
url: /289805/content/16421
content: » Kontakt
url: /289805/content/16422
content: » Impressum
url: /289805/content/236930
content: » Interessante Links
url: /289805/offers/Habitation/listed/Aktualität/0
content: 
                Listenansicht
        
url: /289805/offers/Habitation/gallery/Aktualität/0
content: 
                Galerieansicht
        
url: /289805/offers/Habitation/listed/Aktualität/1
content: 2
url: /289805/offers/Habitation/listed/Aktualität/2
content: 3
url: /289805/offers/Habitation/listed/Aktualität/3
content: 4
url: /289805/offers/Habitation/listed/Aktualität/1
content: Nächste Seite
url: /289805/expose/61677760
content: 
url: /289805/expose/61677760
content: Wunderschöne und super helle 3-Zimmer-Dachgeschosswohnung in
ruhiger Lage von Rodgau (Wohnung Kauf)
url: /289805/expose/61677760
content: Details
url: /289805/expose/61675958
content: 
url: /289805/expose/61675958
content: Besondere Immobilie für Naturliebhaber, die auf die Vorzüge des
"Stadtlebens" nicht verzichten möcht (Haus Kauf)
url: /289805/expose/61675958
content: Details
url: /289805/expose/61647677
content: 
url: /289805/expose/61647677
content: Sehr schöne Dachgeschoss - Wohnung mit großer Dachterrasse in
kleiner Wohneinheit (Wohnung Miete)
url: /289805/expose/61647677
content: Details
url: /289805/expose/61586639
content: 
url: /289805/expose/61586639
content: Hier können Sie sich verwirklichen: Grundsanierungsbedürftiges
Haus in Toplage (Haus Kauf)
url: /289805/expose/61586639
content: Details
url: /289805/expose/61580675
content: 
url: /289805/expose/61580675
content: Große Neubau-Doppelhaushälfte auf schönem Grundstück in
zentraler Lage von Jügesheim (Haus Kauf)
url: /289805/expose/61580675
content: Details
url: /289805/expose/61506416
content: 
url: /289805/expose/61506416
content: Eine prima Eigentumswohnung: 3-Zimmer, Erdgeschoss, Terrasse UND
Balkon (Wohnung Kauf)
url: /289805/expose/61506416
content: Details
url: /289805/expose/61494550
content: 
url: /289805/expose/61494550
content: Außergewöhnlich gut: Zentrumsnah und trotzdem mit Blick ins
Grüne! 3-Zimmerwohnung in Bierstadt (Wohnung Kauf)
url: /289805/expose/61494550
content: Details
url: /289805/expose/61430456
content: 
url: /289805/expose/61430456
content: Top Investition für Kapitalanleger: 2-Zimmer-Erdgeschosswohnung
mit Terrasse in Rodgau (Wohnung Kauf)
url: /289805/expose/61430456
content: Details
url: /289805/expose/61235581
content: 
url: /289805/expose/61235581
content: Charmante und sehr wohnliche 3-Zimmerwohnung im begehrten
Obertshausen (Wohnung Kauf)
url: /289805/expose/61235581
content: Details
url: /289805/expose/61304802
content: 
url: /289805/expose/61304802
content: 3-Zimmer-Erdgeschosswohnung mit Terrasse !!! FÜR KAPITALANLEGER
!!! (Wohnung Kauf)
url: /289805/expose/61304802
content: Details
url: /289805/expose/61417790
content: 
url: /289805/expose/61417790
content: Neu, geräumig, modern, provisionsfrei: Eine Doppelhaushälfte die
all Ihre Wünsche erfüllt! (Haus Kauf)
url: /289805/expose/61417790
content: Details
url: /289805/expose/61417776
content: 
url: /289805/expose/61417776
content: Ein traumhafter Garten, eine wunderschöne und moderne
Doppelhaushälfte und das alles auch noch provi (Haus Kauf)
url: /289805/expose/61417776
content: Details
url: /289805/expose/61417785
content: 
url: /289805/expose/61417785
content: Provisionsfreie Neubau-Doppelhaus in Mühlheim: Erfüllen Sie sich
Ihren Traum vom Eigenheim (Haus Kauf)
url: /289805/expose/61417785
content: Details
url: /289805/expose/61075707
content: 
url: /289805/expose/61075707
content: Ein Wohntraum direkt am Main !!! (Wohnung Kauf)
url: /289805/expose/61075707
content: Details
url: /289805/expose/61348638
content: 
url: /289805/expose/61348638
content: Helle 3-Zimmerwohnung mit Sonnenbalkon in ruhiger Lage (Wohnung
Miete)
url: /289805/expose/61348638
content: Details
url: /289805/offers/Habitation/listed/Aktualität/1
content: 2
url: /289805/offers/Habitation/listed/Aktualität/2
content: 3
url: /289805/offers/Habitation/listed/Aktualität/3
content: 4
url: /289805/offers/Habitation/listed/Aktualität/1
content: Nächste Seite
url: /289805/content/16422
content: Impressum
url: http://www.immobilienscout24.de
content: ImmobilienScout24



Actual result:
--------------
url: http://www.immobilienscout24.de
content: 
                        
url: http://www.immobilienscout24.de
content: www.immobilienscout24.de
url: mailto:webmas...@immobilienscout24.de
content: webmas...@immobilienscout24.de
url: #
content: 
                                                



-- 
Edit bug report at https://bugs.php.net/bug.php?id=55396&edit=1
-- 
Try a snapshot (PHP 5.4):            
https://bugs.php.net/fix.php?id=55396&r=trysnapshot54
Try a snapshot (PHP 5.3):            
https://bugs.php.net/fix.php?id=55396&r=trysnapshot53
Try a snapshot (trunk):              
https://bugs.php.net/fix.php?id=55396&r=trysnapshottrunk
Fixed in SVN:                        
https://bugs.php.net/fix.php?id=55396&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=55396&r=needdocs
Fixed in release:                    
https://bugs.php.net/fix.php?id=55396&r=alreadyfixed
Need backtrace:                      
https://bugs.php.net/fix.php?id=55396&r=needtrace
Need Reproduce Script:               
https://bugs.php.net/fix.php?id=55396&r=needscript
Try newer version:                   
https://bugs.php.net/fix.php?id=55396&r=oldversion
Not developer issue:                 
https://bugs.php.net/fix.php?id=55396&r=support
Expected behavior:                   
https://bugs.php.net/fix.php?id=55396&r=notwrong
Not enough info:                     
https://bugs.php.net/fix.php?id=55396&r=notenoughinfo
Submitted twice:                     
https://bugs.php.net/fix.php?id=55396&r=submittedtwice
register_globals:                    
https://bugs.php.net/fix.php?id=55396&r=globals
PHP 4 support discontinued:          
https://bugs.php.net/fix.php?id=55396&r=php4
Daylight Savings:                    https://bugs.php.net/fix.php?id=55396&r=dst
IIS Stability:                       
https://bugs.php.net/fix.php?id=55396&r=isapi
Install GNU Sed:                     
https://bugs.php.net/fix.php?id=55396&r=gnused
Floating point limitations:          
https://bugs.php.net/fix.php?id=55396&r=float
No Zend Extensions:                  
https://bugs.php.net/fix.php?id=55396&r=nozend
MySQL Configuration Error:           
https://bugs.php.net/fix.php?id=55396&r=mysqlcfg

Reply via email to