misak1 / phpquery

Automatically exported from code.google.com/p/phpquery
0 stars 0 forks source link

XPath generation problem #102

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Source URL:
http://groups.google.com/group/phpquery/browse_thread/thread/7f2f2cda727f7afa

$doc = phpQuery::newDocumentFileHTML('http://www.google.de');
$images = $doc['img'];

<pre>Array
(
    [0] => FIND
    [1] => img
    [2] => Array
        (
            [0] => Array
                (
                    [0] =>
                    [1] => img
                )

        )

)
</pre>
<pre>XPATH: ////</pre> 

PHP 5.2.6-3 on Debian
phpQuery-0.9.5.343.zip 

Multibyte Section in phpinfo():

Multibyte Support     enabled
Multibyte string engine     libmbfl
Multibyte (japanese) regex support     enabled
Multibyte regex (oniguruma) version     4.4.4
Multibyte regex (oniguruma) backtrack check     On

mbstring extension makes use of "streamable kanji code filter and
converter", which is distributed under the GNU Lesser General Public License
version 2.1.

Directive    Local Value    Master Value
mbstring.detect_order    no value    no value
mbstring.encoding_translation    Off    Off
mbstring.func_overload    0    0
mbstring.http_input    pass    pass
mbstring.http_output    pass    pass
mbstring.internal_encoding    no value    no value
mbstring.language    neutral    neutral
mbstring.strict_detection    Off    Off
mbstring.substitute_character    no value    no value 

Original issue reported on code.google.com by tobiasz....@gmail.com on 30 Mar 2009 at 9:39

GoogleCodeExporter commented 8 years ago
Hello, here the output of the last version (phpQuery-dev)

Original comment by derFic...@gmail.com on 30 Mar 2009 at 9:00

Attachments:

GoogleCodeExporter commented 8 years ago
If i change phpQueryObject.php in line 718 from:

$isTag = extension_loaded('mbstring')
? mb_ereg_match('^[\w|\||-]+$', $s) || $s == '*'
: preg_match('@^[\w|\||-]+$@', $s) || $s == '*';

to:

$isTag = preg_match('@^[\w|\||-]+$@', $s);

it seems to work correct, please see attached file for debug output.

Original comment by derFic...@gmail.com on 30 Mar 2009 at 9:16

Attachments:

GoogleCodeExporter commented 8 years ago
I'm happy that those regexps are the problem, but on the other hand this still 
is
quite odd. If you could check full condition (with '*') for both of regexps, 
inside
the method (what could make the difference). That would be:

var_dump(mb_ereg_match('^[\w|\||-]+$', $s) || $s == '*');
var_dump(preg_match('@^[\w|\||-]+$@', $s) || $s == '*');

And also check mbstring version separately, like so:

var_dump(mb_ereg_match('^[\w|\||-]+$', $s));

Anyway, to get it working without mbstring support don't forget the '*' 
comparison,
which is mandatory.

Original comment by tobiasz....@gmail.com on 31 Mar 2009 at 8:06