DOMDocument行为因各种PHP配置而异

时间:2018-04-01 17:10:52

标签: php docker

这是一个代码示例,其行为与

不同
  • import facebook import warnings # Hide deprecation warnings. The facebook module isn't that up-to-date (facebook.GraphAPIError). warnings.filterwarnings('ignore', category=DeprecationWarning) # Parameters of your app and the id of the profile you want to mess with. FACEBOOK_APP_ID = 'SECRET' FACEBOOK_APP_SECRET = 'SECRET' FACEBOOK_PROFILE_ID = 'SECRET' fb_api=facebook.GraphAPI() api_token=fb_api.get_app_access_token(app_id=FACEBOOK_APP_ID, app_secret=FACEBOOK_APP_SECRET, offline=True) graph = facebook.GraphAPI(api_token) # Try to post something on the wall. try: fb_response = graph.put_object(parent_object=FACEBOOK_PROFILE_ID, connection_name='feed', message='Hello, world') print(fb_response) except facebook.GraphAPIError as e: print('Something went wrong:', e.type, e.message)
  • phpbrew's php 7.1.5

    docker container with php 7.1.15

    $ DOMDocument = new DOMDocument;

    $ elementMarkup = mb_convert_encoding($ elementMarkup,' HTML-ENTITIES',' UTF-8');

    $上一层> loadHTML($ elementMarkup);

    $上一层> removeChild之($上一层>!DOCTYPE);

    $ DOMDocument-> replaceChild($ DOMDocument-> firstChild-> firstChild-> firstChild,$ DOMDocument-> firstChild);

$elementMarkup = ' <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> </body> </html> '; 显示不正确的行为 它应该是$DOMDocument->firstChild->firstChild->firstChild(来自xdebug的Nodenames:html-head-meta)和phpbrew的php工作正常。

但是dockerized php cathes meta(Nodenames:html-#text-null)。

Dockerfile

null

0 个答案:

没有答案